diff options
author | Erik Troan <ewt@redhat.com> | 1999-09-18 16:09:48 +0000 |
---|---|---|
committer | Erik Troan <ewt@redhat.com> | 1999-09-18 16:09:48 +0000 |
commit | bf59e01ea1fd1dbcc727b063fe9bf87885de3fe9 (patch) | |
tree | bc56cf1fddb3b023827bb95a0c514029dcc9e1ee /isys | |
parent | 7a0d620ca47468bdefac9f77ffb9548f3562429d (diff) | |
download | anaconda-bf59e01ea1fd1dbcc727b063fe9bf87885de3fe9.tar.gz anaconda-bf59e01ea1fd1dbcc727b063fe9bf87885de3fe9.tar.xz anaconda-bf59e01ea1fd1dbcc727b063fe9bf87885de3fe9.zip |
tried to add path information for modball to insmod -- totally untested ;-)
Diffstat (limited to 'isys')
-rw-r--r-- | isys/isys.h | 6 | ||||
-rw-r--r-- | isys/otherinsmod.c | 41 |
2 files changed, 35 insertions, 12 deletions
diff --git a/isys/isys.h b/isys/isys.h index bfa9aca89..065308642 100644 --- a/isys/isys.h +++ b/isys/isys.h @@ -21,6 +21,7 @@ struct moduleInfo { int numArgs; struct moduleArg * args; int flags; + char * path; }; struct moduleInfoSet_s { @@ -32,7 +33,8 @@ typedef struct moduleInfoSet_s * moduleInfoSet; moduleInfoSet isysNewModuleInfoSet(void); void isysFreeModuleInfoSet(moduleInfoSet mis); -int isysReadModuleInfo(const char * filename, moduleInfoSet mis); +int isysReadModuleInfo(const char * filename, moduleInfoSet mis, + char * path); struct moduleInfo * isysFindModuleInfo(moduleInfoSet mis, const char * moduleName); @@ -43,7 +45,7 @@ struct moduleInfo * isysGetModuleList(moduleInfoSet mis, /* returns -2 for errno, -1 for unknown device */ int devMakeInode(char * devName, char * path); -int insmod(char * modName, char ** args); +int insmod(char * modName, char * path, char ** args); int rmmod(char * modName); #endif diff --git a/isys/otherinsmod.c b/isys/otherinsmod.c index d83dc13f9..3f283e3b5 100644 --- a/isys/otherinsmod.c +++ b/isys/otherinsmod.c @@ -21,6 +21,7 @@ int ourInsmodCommand(int argc, char ** argv) { FD_t fd; int rc, rmObj = 0; int sparc64 = 0; + char * ballPath = NULL; #ifdef __sparc__ struct utsname u; @@ -30,16 +31,26 @@ int ourInsmodCommand(int argc, char ** argv) { #endif if (argc < 2) { - fprintf(stderr, "usage: insmod <module>.o [params]\n"); + fprintf(stderr, "usage: insmod [-p <path>] <module>.o [params]\n"); return 1; } + if (!strcmp(argv[1], "-p")) { + ballPath = malloc(strlen(argv[2]) + 30); + sprintf(ballPath, "%s/%s", argv[2], sparc64 ? + "/modules/modules64.cgz" : "/modules/modules.cgz"); + argv += 2; + } else { + ballPath = sparc64 ? + "/modules/modules64.cgz" : "/modules/modules.cgz"; + + } + file = argv[1]; + if (access(file, R_OK)) { /* it might be having a ball */ - fd = fdOpen(sparc64 ? - "/modules/modules64.cgz" : "/modules/modules.cgz", - O_RDONLY, 0); + fd = fdOpen(ballPath, O_RDONLY, 0); if (fdFileno(fd) < 0) { return 1; } @@ -90,25 +101,35 @@ int rmmod(char * modName) { return rc; } -int insmod(char * modName, char ** args) { +int insmod(char * modName, char * path, char ** args) { int argc; char ** argv; int rc = 0; pid_t child; int status; - + int count; argc = 0; for (argv = args; argv && *argv; argv++, argc++); - argv = alloca(sizeof(*argv) * (argc + 3)); + argv = alloca(sizeof(*argv) * (argc + 5)); argv[0] = "/bin/insmod"; + count = 1; + if (path) { + argv[1] = "-p"; + argv[2] = path; + count += 2; + } + argv[1] = modName; + count++; + if (args) - memcpy(argv + 2, args, sizeof(*args) * argc); - argv[argc + 2] = NULL; + memcpy(argv + count, args, sizeof(*args) * argc); + + argv[argc + count] = NULL; - argc += 2; + argc += count; if ((child = fork()) == 0) { exit(ourInsmodCommand(argc, argv)); |