scripts: Move more scripts into it
[lcapit-junk-code.git] / PATCHES / module-init-tools-stupid-lzma-support.patch
blobfdc4eacf191d72307aaac51ad75e741d1163c655
1 Quick and dirty lzma support for module-init-tools.
3 Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
4 ---
5 configure | 2 +-
6 depmod.c | 2 +-
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
12 @@ -16,9 +16,9 @@
13 #include "testing.h"
15 #ifdef CONFIG_USE_ZLIB
16 -#include <zlib.h>
17 +#include <lzmadec.h>
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
25 return NULL;
27 *size = 0;
28 - while ((ret = gzread(gzfd, buffer + *size, max - *size)) > 0) {
29 + while ((ret = lzmadec_read(lzfd, buffer + *size, max - *size)) > 0) {
30 *size += ret;
31 if (*size == max) {
32 void *p;
33 @@ -52,29 +52,28 @@ out_err:
35 void *grab_fd(int fd, unsigned long *size)
37 - gzFile gzfd;
38 + lzmadec_FILE *lzfd;
40 - gzfd = gzdopen(fd, "rb");
41 - if (!gzfd)
42 + lzfd = lzmadec_dopen(fd);
43 + if (!lzfd)
44 return NULL;
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)
56 - gzFile gzfd;
57 + lzmadec_FILE *lzfd;
58 void *buffer;
60 - gzfd = gzopen(filename, "rb");
61 - if (!gzfd)
62 + lzfd = lzmadec_open(filename);
63 + if (!lzfd)
64 return NULL;
65 - buffer = grab_contents(gzfd, size);
66 - gzclose(gzfd);
67 + buffer = grab_contents(lzfd, size);
68 + lzmadec_close(lzfd);
69 return buffer;
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
76 _ACEOF
78 - zlib_flags="-Wl,-Bstatic -lz -Wl,-Bdynamic"
79 + zlib_flags="-Wl,-Bstatic -llzmadec -Wl,-Bdynamic"
81 fi;
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,