diff options
author | Jeremy Katz <katzj@redhat.com> | 2002-03-12 00:16:09 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2002-03-12 00:16:09 +0000 |
commit | 8a2bb5dc041c7598fef108eac0edddb0eea4f08c (patch) | |
tree | 24643a43117f2ba33740cbbe139d116b6a5d56eb /loader/modules.c | |
parent | c8ff634241cb6406975171fac66f400da7982e19 (diff) | |
download | anaconda-8a2bb5dc041c7598fef108eac0edddb0eea4f08c.tar.gz anaconda-8a2bb5dc041c7598fef108eac0edddb0eea4f08c.tar.xz anaconda-8a2bb5dc041c7598fef108eac0edddb0eea4f08c.zip |
merge using zlib for stage2 instead of gzlib
Diffstat (limited to 'loader/modules.c')
-rw-r--r-- | loader/modules.c | 115 |
1 files changed, 1 insertions, 114 deletions
diff --git a/loader/modules.c b/loader/modules.c index 8ab76f648..ffb0fc536 100644 --- a/loader/modules.c +++ b/loader/modules.c @@ -21,25 +21,14 @@ #include "log.h" #include "misc.h" #include "modules.h" +#include "moduledeps.h" #include "devices.h" #include "windows.h" -struct moduleDependency_s { - char * name; - char ** deps; -}; - -struct extractedModule { - char * path; - char * location; -}; - static int ethCount(void); static int scsiCount(void); int mlReadLoadedList(moduleList * mlp); void mlFreeList(moduleList ml); -moduleDeps mlNewDeps(void); -int mlLoadDeps(moduleDeps * moduleDepListPtr, const char * path); char ** tsortModules(moduleList modLoaded, moduleDeps ml, char ** args, int depth, char *** listPtr, int * listSizePtr); static int loadModule(const char * modName, struct extractedModule * path, @@ -58,7 +47,6 @@ int mlLoadModule(const char * modName, int mlLoadModuleSet(const char * modNames, moduleList modLoaded, moduleDeps modDeps, moduleInfoSet modInfo, int flags); -char ** mlGetDeps(moduleDeps modDeps, const char * modName); int mlModuleInList(const char * modName, moduleList list); int mlWriteConfModules(moduleList list, int fd); int simpleRemoveLoadedModule(const char * modName, moduleList modLoaded, @@ -163,97 +151,6 @@ void mlFreeList(moduleList ml) { free(ml); } -moduleDeps mlNewDeps(void) { - moduleDeps md; - - md = malloc(sizeof(*md)); - md->name = NULL; - md->deps = NULL; - - return md; -} - -int mlLoadDeps(moduleDeps * moduleDepListPtr, const char * path) { - int fd; - char * buf; - struct stat sb; - char * start, * end, * chptr; - int i, numItems; - moduleDeps nextDep; - moduleDeps moduleDepList = *moduleDepListPtr; - - fd = open(path, O_RDONLY); - if (fd < 0) { - return -1; - } - - fstat(fd, &sb); - buf = alloca(sb.st_size + 1); - read(fd, buf, sb.st_size); - buf[sb.st_size] = '\0'; - close(fd); - - start = buf; - numItems = 0; - while (start) { - numItems++; - start = strchr(start + 1, '\n'); - } - - for (nextDep = moduleDepList; nextDep->name; nextDep++) numItems++; - - moduleDepList = realloc(moduleDepList, sizeof(*moduleDepList) * numItems); - for (nextDep = moduleDepList; nextDep->name; nextDep++) ; - - start = buf; - while (start < (buf + sb.st_size) && *start) { - end = strchr(start, '\n'); - *end = '\0'; - - chptr = strchr(start, ':'); - if (!chptr) { - start = end + 1; - continue; - } - - *chptr++ = '\0'; - while (*chptr && isspace(*chptr)) chptr++; - if (!*chptr) { - start = end + 1; - continue; - } - - /* found something */ - nextDep->name = strdup(start); - nextDep->deps = malloc(sizeof(char *) * (strlen(chptr) + 1)); - start = chptr, i = 0; - while (start && *start) { - chptr = strchr(start, ' '); - if (chptr) *chptr = '\0'; - nextDep->deps[i++] = strdup(start); - if (chptr) - start = chptr + 1; - else - start = NULL; - while (start && *start && isspace(*start)) start++; - } - nextDep->deps[i] = NULL; - nextDep->deps = realloc(nextDep->deps, sizeof(char *) * (i + 1)); - nextDep++; - - start = end + 1; - } - - nextDep->name = NULL; - nextDep->deps = NULL; - moduleDepList = realloc(moduleDepList, sizeof(*moduleDepList) * - (nextDep - moduleDepList + 1)); - - *moduleDepListPtr = moduleDepList; - - return 0; -} - /* this leaks memory if their is a loop in the modules. oh well. */ char ** tsortModules(moduleList modLoaded, moduleDeps ml, char ** args, int depth, char *** listPtr, int * listSizePtr) { @@ -773,16 +670,6 @@ int mlLoadModuleSet(const char * modNames, NULL, NULL); } -char ** mlGetDeps(moduleDeps modDeps, const char * modName) { - moduleDeps dep; - - for (dep = modDeps; dep->name && strcmp(dep->name, modName); dep++); - - if (dep) return dep->deps; - - return NULL; -} - int mlModuleInList(const char * modName, moduleList list) { int i; |