1 Quick and dirty lzma support for module-init-tools.
3 Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
7 zlibsupport.c | 25 ++++++++++++-------------
8 3 files changed, 14 insertions(+), 15 deletions(-)
10 --- module-init-tools-3.3-pre11.orig/zlibsupport.c
11 +++ module-init-tools-3.3-pre11/zlibsupport.c
15 #ifdef CONFIG_USE_ZLIB
19 -void *grab_contents(gzFile *gzfd, unsigned long *size)
20 +void *grab_contents(lzmadec_FILE *lzfd, unsigned long *size)
22 unsigned int max = 16384;
23 void *buffer = malloc(max);
24 @@ -28,7 +28,7 @@ void *grab_contents(gzFile *gzfd, unsign
28 - while ((ret = gzread(gzfd, buffer + *size, max - *size)) > 0) {
29 + while ((ret = lzmadec_read(lzfd, buffer + *size, max - *size)) > 0) {
33 @@ -52,29 +52,28 @@ out_err:
35 void *grab_fd(int fd, unsigned long *size)
40 - gzfd = gzdopen(fd, "rb");
42 + lzfd = lzmadec_dopen(fd);
46 /* gzclose(gzfd) would close fd, which would drop locks.
47 Don't blame zlib: POSIX locking semantics are so horribly
48 broken that they should be ripped out. */
49 - return grab_contents(gzfd, size);
50 + return grab_contents(lzfd, size);
53 -/* gzopen handles uncompressed files transparently. */
54 void *grab_file(const char *filename, unsigned long *size)
60 - gzfd = gzopen(filename, "rb");
62 + lzfd = lzmadec_open(filename);
65 - buffer = grab_contents(gzfd, size);
67 + buffer = grab_contents(lzfd, size);
68 + lzmadec_close(lzfd);
72 --- module-init-tools-3.3-pre11.orig/configure
73 +++ module-init-tools-3.3-pre11/configure
74 @@ -1796,7 +1796,7 @@ if test "${enable_zlib+set}" = set; then
75 #define CONFIG_USE_ZLIB 1
78 - zlib_flags="-Wl,-Bstatic -lz -Wl,-Bdynamic"
79 + zlib_flags="-Wl,-Bstatic -llzmadec -Wl,-Bdynamic"
83 --- module-init-tools-3.3-pre11.orig/depmod.c
84 +++ module-init-tools-3.3-pre11/depmod.c
85 @@ -507,7 +507,7 @@ static void output_deps(struct module *m
87 static int smells_like_module(const char *name)
89 - return ends_in(name,".ko") || ends_in(name, ".ko.gz");
90 + return ends_in(name,".ko") || ends_in(name, ".ko.lzma");
93 typedef struct module *(*do_module_t)(const char *dirname,