diff options
author | Erik Troan <ewt@redhat.com> | 1999-07-20 22:48:57 +0000 |
---|---|---|
committer | Erik Troan <ewt@redhat.com> | 1999-07-20 22:48:57 +0000 |
commit | c743faee0808f4fa885c0c3bda8523047b0692c7 (patch) | |
tree | f25ca6791071fd5dc3df70321fc6bcd14afd1716 /utils | |
parent | 43009b3b5c3b2e1022cb3c2133d3729a49d84ce3 (diff) | |
download | anaconda-c743faee0808f4fa885c0c3bda8523047b0692c7.tar.gz anaconda-c743faee0808f4fa885c0c3bda8523047b0692c7.tar.xz anaconda-c743faee0808f4fa885c0c3bda8523047b0692c7.zip |
*** empty log message ***
Diffstat (limited to 'utils')
-rw-r--r-- | utils/Makefile | 5 | ||||
-rw-r--r-- | utils/modlist.c | 54 |
2 files changed, 59 insertions, 0 deletions
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 <popt.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#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; +} |