From c743faee0808f4fa885c0c3bda8523047b0692c7 Mon Sep 17 00:00:00 2001 From: Erik Troan Date: Tue, 20 Jul 1999 22:48:57 +0000 Subject: *** empty log message *** --- utils/Makefile | 5 +++++ utils/modlist.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 utils/Makefile create mode 100644 utils/modlist.c (limited to 'utils') diff --git a/utils/Makefile b/utils/Makefile new file mode 100644 index 000000000..ba60074c5 --- /dev/null +++ b/utils/Makefile @@ -0,0 +1,5 @@ +LOADLIBES = -lpopt -L../isys -lisys +CFLAGS = -Wall -g +LDFLAGS = -g + +all: modlist diff --git a/utils/modlist.c b/utils/modlist.c new file mode 100644 index 000000000..12e325d28 --- /dev/null +++ b/utils/modlist.c @@ -0,0 +1,54 @@ +#include +#include +#include +#include + +#include "../isys/isys.h" + +int main(int argc, char ** argv) { + poptContext optCon; + char * modInfoFile = "/boot/module-info"; + enum driverMajor major; + char * type; + struct moduleInfo * list, * m; + int rc; + struct poptOption optionTable[] = { + { "modinfo", 'm', POPT_ARG_STRING, &modInfoFile, 0 }, + POPT_AUTOHELP + { 0, 0, 0, 0, 0 } + }; + + optCon = poptGetContext(NULL, argc, argv, optionTable, 0); + + if ((rc = poptGetNextOpt(optCon)) < -1) { + fprintf(stderr, "bad option %s: %s\n", + poptBadOption(optCon, POPT_BADOPTION_NOALIAS), + poptStrerror(rc)); + exit(1); + } + + if (isysReadModuleInfo(modInfoFile)) { + fprintf(stderr, "Failed to read %s\n", modInfoFile); + exit(1); + } + + while ((type = poptGetArg(optCon))) { + if (!strcasecmp(type, "scsi")) { + major = DRIVER_SCSI; + } else if (!strcasecmp(type, "net")) { + major = DRIVER_NET; + } else if (!strcasecmp(type, "fs")) { + major = DRIVER_FS; + } else { + fprintf(stderr, "type must be one of scsi, net, fs\n"); + exit(1); + } + + list = isysGetModuleList(major); + for (m = list; m && m->moduleName; m++) + printf("%s\n", m->moduleName); + free(list); + } + + return 0; +} -- cgit