summaryrefslogtreecommitdiffstats
path: root/loader
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2002-03-12 00:16:09 +0000
committerJeremy Katz <katzj@redhat.com>2002-03-12 00:16:09 +0000
commit8a2bb5dc041c7598fef108eac0edddb0eea4f08c (patch)
tree24643a43117f2ba33740cbbe139d116b6a5d56eb /loader
parentc8ff634241cb6406975171fac66f400da7982e19 (diff)
downloadanaconda-8a2bb5dc041c7598fef108eac0edddb0eea4f08c.tar.gz
anaconda-8a2bb5dc041c7598fef108eac0edddb0eea4f08c.tar.xz
anaconda-8a2bb5dc041c7598fef108eac0edddb0eea4f08c.zip
merge using zlib for stage2 instead of gzlib
Diffstat (limited to 'loader')
-rw-r--r--loader/Makefile6
-rw-r--r--loader/moduledeps.c115
-rw-r--r--loader/moduledeps.h18
-rw-r--r--loader/modules.c115
4 files changed, 137 insertions, 117 deletions
diff --git a/loader/Makefile b/loader/Makefile
index ea24a5782..ff57dafdc 100644
--- a/loader/Makefile
+++ b/loader/Makefile
@@ -5,7 +5,7 @@ VERSION = 7.2
DESTDIR = ../../trees/initrd
OBJS = log.o windows.o modules.o devices.o cdrom.o urls.o kickstart.o lang.o \
- misc.o ftp.o md5.o mediacheck.o
+ misc.o ftp.o md5.o mediacheck.o moduledeps.o
SLANGLIB = -lslang
ifneq (ia64, $(ARCH))
@@ -28,7 +28,7 @@ MODULELINKAGE :=-lmodutils -lmodutilutil -lmodutilobj
COPTS = $(DEBUG) -Wall -DVERSION='"$(VERSION)"'
-CFLAGS = $(COPTS) $(OPTS) -ffunction-sections -D_GNU_SOURCE=1 -I/usr/include/kudzu -I/usr/include/rpm -I.. -DHAVE_LIBIO_H -ggdb
+CFLAGS = $(COPTS) $(OPTS) -ffunction-sections -D_GNU_SOURCE=1 -I/usr/include/kudzu -I/usr/include/rpm -I.. -DHAVE_LIBIO_H -ggdb -DGZLIB=1
ALLOBJS = $(OBJS) $(PCMCIAOBJS)
@@ -83,7 +83,7 @@ STATIC = -static
ifeq (i386, $(ARCH))
MINILIBC=minilibc.o
-COPTS+=-DUSE_MINILIBC=1 -DUSE_LOGDEV
+COPTS+=-DUSE_MINILIBC=1 -DUSE_LOGDEV
LDFLAGS = -nostdlib /usr/lib/crt1.o
LOADERLIBS += -lrpc
ISYS = ../isys/libisys-diet.a
diff --git a/loader/moduledeps.c b/loader/moduledeps.c
new file mode 100644
index 000000000..16f9a0e3a
--- /dev/null
+++ b/loader/moduledeps.c
@@ -0,0 +1,115 @@
+#include <alloca.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <newt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "misc.h"
+#include "modules.h"
+#include "moduledeps.h"
+
+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;
+}
+
+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;
+}
diff --git a/loader/moduledeps.h b/loader/moduledeps.h
new file mode 100644
index 000000000..832423298
--- /dev/null
+++ b/loader/moduledeps.h
@@ -0,0 +1,18 @@
+#ifndef MODULEDEPS_H
+#define MODULEDEPS_H
+
+struct moduleDependency_s {
+ char * name;
+ char ** deps;
+};
+
+struct extractedModule {
+ char * path;
+ char * location;
+};
+
+moduleDeps mlNewDeps(void);
+int mlLoadDeps(moduleDeps * moduleDepListPtr, const char * path);
+char ** mlGetDeps(moduleDeps modDeps, const char * modName);
+
+#endif
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;