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 | |
parent | c8ff634241cb6406975171fac66f400da7982e19 (diff) | |
download | anaconda-8a2bb5dc041c7598fef108eac0edddb0eea4f08c.tar.gz anaconda-8a2bb5dc041c7598fef108eac0edddb0eea4f08c.tar.xz anaconda-8a2bb5dc041c7598fef108eac0edddb0eea4f08c.zip |
merge using zlib for stage2 instead of gzlib
-rw-r--r-- | isys/Makefile | 4 | ||||
-rw-r--r-- | isys/cpio.h | 2 | ||||
-rw-r--r-- | isys/lang.c | 1 | ||||
-rw-r--r-- | isys/otherinsmod.c | 1 | ||||
-rw-r--r-- | isys/stubs.h | 23 | ||||
-rw-r--r-- | isys/uncpio.c | 2 | ||||
-rw-r--r-- | loader/Makefile | 6 | ||||
-rw-r--r-- | loader/moduledeps.c | 115 | ||||
-rw-r--r-- | loader/moduledeps.h | 18 | ||||
-rw-r--r-- | loader/modules.c | 115 | ||||
-rw-r--r-- | utils/Makefile | 12 |
11 files changed, 172 insertions, 127 deletions
diff --git a/isys/Makefile b/isys/Makefile index 747f523ab..744ed54a0 100644 --- a/isys/Makefile +++ b/isys/Makefile @@ -10,7 +10,7 @@ OBJECTS = nfsmount.o nfsmount_clnt.o nfsmount_xdr.o imount.o \ SOBJECTS = $(patsubst %.o,%.lo,$(OBJECTS)) SOURCES = $(patsubst %.o,%.c,$(OBJECTS)) isys.c STATICOBJS = otherinsmod.o -LOADLIBES = -lresolv -lpci -lpopt -lpump -lext2fs -L./gzlib -lgunzip +LOADLIBES = -lresolv -lpci -lpopt -lpump -lext2fs -lz PYMODULES = _isys.so SUBDIRS = gzlib DIET = diet @@ -42,7 +42,7 @@ all: subdirs $(PYMODULES) libisys.a $(DIETLIB) $(CC) -c $(CFLAGS) -fPIC -o $@ $< %.do: %.c - $(DIET) $(CC) -c $(CFLAGS) -DDIET=1 "-Du_char=unsigned char" -o $@ $< + $(DIET) $(CC) -c $(CFLAGS) -DGZLIB=1 -DDIET=1 "-Du_char=unsigned char" -o $@ $< _isys.so: isys.lo $(SOBJECTS) gcc -shared -g -o $@ isys.lo $(SOBJECTS) $(LOADLIBES) diff --git a/isys/cpio.h b/isys/cpio.h index 89fd7a884..1caa4e464 100644 --- a/isys/cpio.h +++ b/isys/cpio.h @@ -3,7 +3,7 @@ #include <sys/types.h> -#include "gzlib/gzlib.h" +#include "stubs.h" /* Note the CPIO_CHECK_ERRNO bit is set only if errno is valid. These have to be positive numbers or this setting the high bit stuff is a bad idea. */ diff --git a/isys/lang.c b/isys/lang.c index 32232cffd..8442607d3 100644 --- a/isys/lang.c +++ b/isys/lang.c @@ -11,6 +11,7 @@ #include "linux/kd.h" #include "cpio.h" +#include "stubs.h" int isysLoadFont(char * fontFile) { char font[8192]; diff --git a/isys/otherinsmod.c b/isys/otherinsmod.c index 95c073b72..881946533 100644 --- a/isys/otherinsmod.c +++ b/isys/otherinsmod.c @@ -8,6 +8,7 @@ #include "cpio.h" #include "isys.h" +#include "stubs.h" /* hack */ int combined_insmod_main(int argc, char ** argv); diff --git a/isys/stubs.h b/isys/stubs.h new file mode 100644 index 000000000..b7da85226 --- /dev/null +++ b/isys/stubs.h @@ -0,0 +1,23 @@ +/* we use gzlib when linked against dietlibc, but otherwise, we should use + zlib. it would make more sense to do the defines in the other direction, + but that causes symbol wackiness because both gunzip_open and gzip_open in + gzlib are gzopen from zlib +*/ + +#ifndef ISYS_STUB +#define ISYS_STUB + +#ifndef GZLIB +#include <zlib.h> + +#define gunzip_open(x) gzopen(x, "r") +#define gunzip_close gzclose +#define gunzip_read gzread +#define gzip_write gzwrite + +#else +#include "gzlib/gzlib.h" + +#endif + +#endif diff --git a/isys/uncpio.c b/isys/uncpio.c index a90d0ddc3..a3232c3c0 100644 --- a/isys/uncpio.c +++ b/isys/uncpio.c @@ -19,7 +19,7 @@ #include <utime.h> #include "cpio.h" -#include "gzlib/gzlib.h" +#include "stubs.h" #if MAJOR_IN_SYSMACROS #include <sys/sysmacros.h> 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; diff --git a/utils/Makefile b/utils/Makefile index c2035ffe2..378b7c09b 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -23,15 +23,15 @@ all: modlist $(MODDEPS) genhdlist snarffont mapshdr readmap modlist: modlist.o -modules.o: ../loader/modules.c - cp ../loader/modules.c ./ - $(CC) $(CFLAGS) -I../loader -c modules.c +moduledeps.o: ../loader/moduledeps.c + cp ../loader/moduledeps.c ./ + $(CC) $(CFLAGS) -I../loader -c moduledeps.c -moddeps: moddeps.o modules.o - $(CC) $(LDFLAGS) -o moddeps moddeps.o modules.o \ +moddeps: moddeps.o moduledeps.o + $(CC) $(LDFLAGS) -o moddeps moddeps.o moduledeps.o \ $(LOADLIBES) -lresolv \ -lmodutils -lmodutilobj -lmodutilutil \ - -lpopt -lgunzip -L../isys/gzlib -lbz2 + -lpopt -lbz2 genhdlist: genhdlist.c hash.c $(CC) $(LDFLAGS) $(CFLAGS) $(RPMCFLAGS) -o genhdlist genhdlist.c hash.c -lrpm -lrpmdb -lrpmio \ |