summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorErik Troan <ewt@redhat.com>2001-11-13 21:11:33 +0000
committerErik Troan <ewt@redhat.com>2001-11-13 21:11:33 +0000
commit97a3cd864677164834d5520dcef5e11221e78a28 (patch)
treee8aeae72518cc37c1151019e336405ab4e81457d /isys
parent0c9da29f6bad397e0a0aa45d10271946145d6adb (diff)
downloadanaconda-97a3cd864677164834d5520dcef5e11221e78a28.tar.gz
anaconda-97a3cd864677164834d5520dcef5e11221e78a28.tar.xz
anaconda-97a3cd864677164834d5520dcef5e11221e78a28.zip
changes isys to use libgzip rather then libz
Diffstat (limited to 'isys')
-rw-r--r--isys/Makefile18
-rw-r--r--isys/cpio.c1
-rw-r--r--isys/cpio.h3
-rw-r--r--isys/lang.c32
-rw-r--r--isys/otherinsmod.c5
-rw-r--r--isys/uncpio.c26
6 files changed, 52 insertions, 33 deletions
diff --git a/isys/Makefile b/isys/Makefile
index da9cff007..c046e1884 100644
--- a/isys/Makefile
+++ b/isys/Makefile
@@ -4,7 +4,7 @@ ARCH := $(patsubst i%86,i386,$(shell uname -m))
ARCH := $(patsubst sparc%,sparc,$(ARCH))
CFLAGS = -ffunction-sections -I$(PYTHONINCLUDE) -I.. -Wall -Os -g -DHAVE_NFS -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1
-OBJECTS = nfsmount.o dns.o nfsmount_clnt.o nfsmount_xdr.o imount.o \
+OBJECTS = nfsmount.o nfsmount_clnt.o nfsmount_xdr.o imount.o \
smp.o moduleinfo.o devnodes.o cpio.o probe.o uncpio.o \
lang.o isofs.o pdc.o
SOBJECTS = $(patsubst %.o,%.lo,$(OBJECTS))
@@ -12,10 +12,17 @@ SOURCES = $(patsubst %.o,%.c,$(OBJECTS)) isys.c
STATICOBJS = otherinsmod.o
LOADLIBES = -lresolv -lz -lpci -lpopt -lpump -lext2fs
PYMODULES = _isys.so
-SUBDIRS = modutils
+SUBDIRS = modutils gzlib
+DIET = diet
+
+DOBJECTS = $(patsubst %.o,%.do,$(OBJECTS) $(STATICOBJS))
GENERATED = nfs_mountversion.h
+ifeq ($(ARCH),i386)
+DIETLIB=libisys-diet.a
+endif
+
ifeq ($(ARCH),sparc)
PYMODULES += _silo.so
SOURCES += silo.c
@@ -29,11 +36,14 @@ endif
everything: $(TARGET)
-all: subdirs $(PYMODULES) libisys.a
+all: subdirs $(PYMODULES) libisys.a $(DIETLIB)
%.lo: %.c
$(CC) -c $(CFLAGS) -fPIC -o $@ $<
+%.do: %.c
+ $(DIET) $(CC) -c $(CFLAGS) -DDIET=1 "-Du_char=unsigned char" -o $@ $<
+
_isys.so: isys.lo $(SOBJECTS)
gcc -shared -g -o $@ isys.lo $(SOBJECTS) $(LOADLIBES)
@@ -42,6 +52,8 @@ _silo.so: silo.c
libisys.a: libisys.a($(OBJECTS) $(STATICOBJS))
+libisys-diet.a: libisys-diet.a($(DOBJECTS))
+
clean:
rm -f *.o *.so *.lo *.a *.pyc $(TARGET) $(SOBJECTS) $(OBJECTS) $(GENERATED)
for d in $(SUBDIRS); do make -C $$d clean; done
diff --git a/isys/cpio.c b/isys/cpio.c
index 97d411764..7aeb16d38 100644
--- a/isys/cpio.c
+++ b/isys/cpio.c
@@ -3,7 +3,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <zlib.h>
#include "cpio.h"
diff --git a/isys/cpio.h b/isys/cpio.h
index 06aa985c6..89fd7a884 100644
--- a/isys/cpio.h
+++ b/isys/cpio.h
@@ -1,9 +1,10 @@
#ifndef H_CPIO
#define H_CPIO
-#include <zlib.h>
#include <sys/types.h>
+#include "gzlib/gzlib.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. */
#define CPIOERR_CHECK_ERRNO 0x80000000
diff --git a/isys/lang.c b/isys/lang.c
index eff9b6b93..32232cffd 100644
--- a/isys/lang.c
+++ b/isys/lang.c
@@ -4,13 +4,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/kd.h>
#include <sys/ioctl.h>
#include <unistd.h>
-#include <zlib.h>
#include <linux/keyboard.h>
-#include <linux/kd.h>
+#include "linux/kd.h"
#include "cpio.h"
@@ -24,12 +22,12 @@ int isysLoadFont(char * fontFile) {
gzFile stream;
int rc;
- stream = gzopen("/etc/fonts.cgz", "r");
+ stream = gunzip_open("/etc/fonts.cgz");
if (!stream)
return -EACCES;
rc = installCpioFile(stream, fontFile, "/tmp/font", 1);
- gzclose(stream);
+ gunzip_close(stream);
if (rc || access("/tmp/font", R_OK))
return -EACCES;
@@ -76,12 +74,12 @@ static int loadKeymap(gzFile stream) {
int magic;
short keymap[NR_KEYS];
- if (gzread(stream, &magic, sizeof(magic)) != sizeof(magic))
+ if (gunzip_read(stream, &magic, sizeof(magic)) != sizeof(magic))
return -EIO;
if (magic != KMAP_MAGIC) return -EINVAL;
- if (gzread(stream, keymaps, sizeof(keymaps)) != sizeof(keymaps))
+ if (gunzip_read(stream, keymaps, sizeof(keymaps)) != sizeof(keymaps))
return -EINVAL;
console = open("/dev/console", O_RDWR);
@@ -91,7 +89,7 @@ static int loadKeymap(gzFile stream) {
for (kmap = 0; kmap < MAX_NR_KEYMAPS; kmap++) {
if (!keymaps[kmap]) continue;
- if (gzread(stream, keymap, sizeof(keymap)) != sizeof(keymap)) {
+ if (gunzip_read(stream, keymap, sizeof(keymap)) != sizeof(keymap)) {
close(console);
return -EIO;
}
@@ -123,18 +121,18 @@ int isysLoadKeymap(char * keymap) {
char buf[16384]; /* I hope this is big enough */
int i;
- f = gzopen("/etc/keymaps.gz", "r");
+ f = gunzip_open("/etc/keymaps.gz");
if (!f) return -EACCES;
- if (gzread(f, &hdr, sizeof(hdr)) != sizeof(hdr)) {
- gzclose(f);
+ if (gunzip_read(f, &hdr, sizeof(hdr)) != sizeof(hdr)) {
+ gunzip_close(f);
return -EINVAL;
}
i = hdr.numEntries * sizeof(*infoTable);
infoTable = alloca(i);
- if (gzread(f, infoTable, i) != i) {
- gzclose(f);
+ if (gunzip_read(f, infoTable, i) != i) {
+ gunzip_close(f);
return -EIO;
}
@@ -145,20 +143,20 @@ int isysLoadKeymap(char * keymap) {
}
if (num == -1) {
- gzclose(f);
+ gunzip_close(f);
return -ENOENT;
}
for (i = 0; i < num; i++) {
- if (gzread(f, buf, infoTable[i].size) != infoTable[i].size) {
- gzclose(f);
+ if (gunzip_read(f, buf, infoTable[i].size) != infoTable[i].size) {
+ gunzip_close(f);
return -EIO;
}
}
rc = loadKeymap(f);
- gzclose(f);
+ gunzip_close(f);
return rc;
}
diff --git a/isys/otherinsmod.c b/isys/otherinsmod.c
index c09798eee..0a33e1ac3 100644
--- a/isys/otherinsmod.c
+++ b/isys/otherinsmod.c
@@ -1,7 +1,6 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <zlib.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/utsname.h>
@@ -17,7 +16,7 @@ int ourInsmodCommand(int argc, char ** argv) {
char * file;
char finalName[100];
char * chptr;
- gzFile fd;
+ int fd;
int rc, rmObj = 0;
int sparc64 = 0, i;
char * ballPath = NULL;
@@ -55,7 +54,7 @@ int ourInsmodCommand(int argc, char ** argv) {
/* Try two balls on sparc64, one elsewhere */
for (i = 0; ; i++) {
/* it might be having a ball */
- fd = gzopen(ballPath, "r");
+ fd = gunzip_open(ballPath, 0);
if (!fd) {
free(ballPath);
return 1;
diff --git a/isys/uncpio.c b/isys/uncpio.c
index e41fb0ccb..2bbd1e6b0 100644
--- a/isys/uncpio.c
+++ b/isys/uncpio.c
@@ -19,6 +19,7 @@
#include <utime.h>
#include "cpio.h"
+#include "gzlib/gzlib.h"
#if MAJOR_IN_SYSMACROS
#include <sys/sysmacros.h>
@@ -86,7 +87,7 @@ struct cpioHeader {
static inline off_t ourread(struct ourfd * thefd, void * buf, size_t size) {
off_t i;
- i = gzread(thefd->fd, buf, size);
+ i = gunzip_read(thefd->fd, buf, size);
thefd->pos += i;
return i;
@@ -109,8 +110,10 @@ static inline int padoutfd(struct ourfd * fd, size_t * where, int modulo) {
amount = (modulo - *where % modulo) % modulo;
*where += amount;
- if (gzwrite(fd->fd, buf, amount) != amount)
+#if 0
+ if (gunzip_write(fd->fd, buf, amount) != amount)
return CPIOERR_WRITE_FAILED;
+#endif
return 0;
}
@@ -154,7 +157,8 @@ static int getNextHeader(struct ourfd * fd, struct cpioHeader * chPtr,
if (strncmp(CPIO_CRC_MAGIC, physHeader.magic, strlen(CPIO_CRC_MAGIC)) &&
strncmp(CPIO_NEWC_MAGIC, physHeader.magic, strlen(CPIO_NEWC_MAGIC)))
- return CPIOERR_BAD_MAGIC;
+ /*return CPIOERR_BAD_MAGIC;*/
+ abort();
GET_NUM_FIELD(physHeader.inode, chPtr->inode);
GET_NUM_FIELD(physHeader.mode, chPtr->mode);
@@ -700,18 +704,22 @@ static int copyFile(struct ourfd * inFd, struct ourfd * outFd,
amount = strlen(chp->path) + 1;
memcpy(pHdr->magic, CPIO_NEWC_MAGIC, sizeof(pHdr->magic));
- gzwrite(outFd->fd, pHdr, PHYS_HDR_SIZE);
- gzwrite(outFd->fd, chp->path, amount);
+#if 0
+ gunzip_write(outFd->fd, pHdr, PHYS_HDR_SIZE);
+ gunzip_write(outFd->fd, chp->path, amount);
+#endif
outFd->pos += PHYS_HDR_SIZE + amount;
padoutfd(outFd, &outFd->pos, 4);
+#if 0
while (size) {
amount = ourread(inFd, buf, size > sizeof(buf) ? sizeof(buf) : size);
- gzwrite(outFd->fd, buf, amount);
+ gunzip_write(outFd->fd, buf, amount);
size -= amount;
}
+#endif
outFd->pos += chp->size;
@@ -762,8 +770,10 @@ int myCpioFilterArchive(gzFile inStream, gzFile outStream, char ** patterns) {
memcpy(pHeader.magic, CPIO_NEWC_MAGIC, sizeof(pHeader.magic));
memcpy(pHeader.nlink, "00000001", 8);
memcpy(pHeader.namesize, "0000000b", 8);
- gzwrite(outFd.fd, &pHeader, PHYS_HDR_SIZE);
- gzwrite(outFd.fd, "TRAILER!!!", 11);
+ #if 0
+ gunzip_write(outFd.fd, &pHeader, PHYS_HDR_SIZE);
+ gunzip_write(outFd.fd, "TRAILER!!!", 11);
+ #endif
outFd.pos += PHYS_HDR_SIZE + 11;