wok view busybox/stuff/busybox-1.12.0-zmodules.u @ rev 5738
Add 'git-gui' package, v0.12.0.66.
Tested on Stable (built & installed) and Cooking (installed after upgrade) successfully.
Tested on Stable (built & installed) and Cooking (installed after upgrade) successfully.
author | Ben Arnold <ben@seawolfsanctuary.com> |
---|---|
date | Sat Jun 26 13:59:56 2010 +0100 (2010-06-26) |
parents | 3fd828035bdb |
children |
line source
1 --- busybox-1.12.0/modutils/depmod.c
2 +++ busybox-1.12.0/modutils/depmod.c
3 @@ -53,27 +53,14 @@ static int FAST_FUNC fileAction(const ch
4 size_t len = sb->st_size;
5 void *the_module;
6 char *ptr;
7 - int fd;
8 char *depends, *deps;
9 dep_lst_t *this;
10 + extern void *xalloc_load_module(const char filename[], size_t *len);
12 if (strrstr(fname, ".ko") == NULL) /* not a module */
13 goto skip;
15 -/*XXX: FIXME: does not handle compressed modules!
16 - * There should be a function that looks at the extension and sets up
17 - * open_transformer for us.
18 - */
19 - fd = xopen(fname, O_RDONLY);
20 - the_module = mmap(NULL, len, PROT_READ, MAP_SHARED
21 -#if defined MAP_POPULATE
22 - |MAP_POPULATE
23 -#endif
24 - , fd, 0);
25 - close(fd);
26 - if (the_module == MAP_FAILED)
27 - bb_perror_msg_and_die("mmap");
28 -
29 + the_module = xalloc_load_module(fname, &len);
30 this = xzalloc(sizeof(dep_lst_t));
31 this->name = xstrdup(fname);
32 this->next = G.lst;
33 @@ -104,7 +91,7 @@ static int FAST_FUNC fileAction(const ch
34 pos = (ptr - (char*)the_module);
35 } while (1);
36 }
37 - munmap(the_module, sb->st_size);
38 + free(the_module);
39 skip:
40 return TRUE;
41 }
43 --- busybox-1.12.0/modutils/insmod.c
44 +++ busybox-1.12.0/modutils/insmod.c
45 @@ -59,6 +59,7 @@
46 */
48 #include "libbb.h"
49 +#include "unarchive.h"
50 #include <libgen.h>
51 #include <sys/utsname.h>
53 @@ -4212,6 +4213,60 @@ static const char *moderror(int err)
54 }
55 }
57 +void *xalloc_load_module(const char filename[], size_t *len);
58 +void *xalloc_load_module(const char filename[], size_t *len)
59 +{
60 + int fd, max;
61 + unsigned char head[16];
62 + void *map;
63 + size_t l;
64 +
65 + max = 8 * 1024;
66 + fd = open(filename, O_RDONLY);
67 + if (fd < 0) return NULL;
68 + xread(fd,head,sizeof(head));
69 + lseek(fd,0L,SEEK_SET);
70 +#if ENABLE_FEATURE_SEAMLESS_GZ
71 + if (head[0] == 0x1f && head[1] == 0x8b) { /* gzip */
72 +#if BB_MMU
73 + xread(fd,head,2); // bb wierdness...
74 +#endif
75 + open_transformer(fd, unpack_gz_stream, "gunzip");
76 + }
77 +#endif
78 +#if ENABLE_FEATURE_SEAMLESS_BZ2
79 +#if ENABLE_FEATURE_SEAMLESS_GZ
80 + else
81 +#endif
82 + if (head[0] == 'B' && head[1] == 'Z' &&
83 + head[2] == 'h' && isdigit(head[3])) { /* bzip2 */
84 + open_transformer(fd, unpack_bz2_stream, "bunzip2");
85 + }
86 +#endif
87 +#if ENABLE_FEATURE_SEAMLESS_LZMA
88 +#if ENABLE_FEATURE_SEAMLESS_GZ || ENABLE_FEATURE_SEAMLESS_BZ2
89 + else
90 +#endif
91 + if (head[1] != 'E' || head[2] != 'L' || head[3] != 'F') {
92 + open_transformer(fd, unpack_lzma_stream, "unlzma");
93 + if (* (unsigned *) (head + 9) == 0)
94 + max = 1 + head[5] + (head[6]<<8)
95 + + (head[7]<<16) + (head[8]<<24);
96 + }
97 +#endif
98 + l = 0;
99 + map = xmalloc(max);
100 + while (1) {
101 + l += full_read(fd, l + (char *) map, max - l);
102 + if (l != max) break;
103 + max <<= 1;
104 + map = xrealloc(map, max);
105 + }
106 + if (len)
107 + *len = l;
108 + return xrealloc(map, l);
109 +}
110 +
111 #if !ENABLE_FEATURE_2_4_MODULES
112 int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
113 int insmod_main(int argc UNUSED_PARAM, char **argv)
114 @@ -4264,8 +4319,7 @@ static int insmod_ng_main(int argc UNUSE
115 xread(fd, map, len);
116 }
117 #else
118 - len = MAXINT(ssize_t);
119 - map = xmalloc_open_read_close(filename, &len);
120 + map = xalloc_load_module(filename, &len);
121 #endif
123 if (init_module(map, len, options) != 0)
125 --- busybox-1.12.0/modutils/modprobe.c
126 +++ busybox-1.12.0/modutils/modprobe.c
127 @@ -396,6 +396,29 @@ static int include_conf_file2(struct inc
128 return include_conf_file(conf, oldname);
129 }
131 +static int ext_size(char *end USE_FEATURE_2_6_MODULES(, int k_version))
132 +{
133 + int ext;
134 + char *next;
135 +
136 + ext = 0;
137 + if (end[-2] == '.' && end[-1] == 'g' && end[0] == 'z')
138 + ext = 3;
139 + if (end[-3] == '.' && end[-2] == 'b' && end[-1] == 'z' && end[0] == '2')
140 + ext = 4;
141 + next = end - ext;
142 +#if ENABLE_FEATURE_2_6_MODULES
143 + if (ENABLE_FEATURE_2_6_MODULES
144 + && (k_version > 4) && (next[-2] == '.')
145 + && (next[-1] == 'k') && (next[0] == 'o'))
146 + ext += 3;
147 + else
148 +#endif
149 + if ((next[-1] == '.') && (next[0] == 'o'))
150 + ext += 2;
151 + return ext;
152 +}
153 +
154 /*
155 * This function builds a list of dependency rules from /lib/modules/`uname -r`/modules.dep.
156 * It then fills every modules and aliases with their default options, found by parsing
157 @@ -464,12 +487,7 @@ static struct dep_t *build_dep(void)
158 if (!modpath)
159 modpath = line_buffer; /* module with no path */
160 /* find the end of the module name in the file name */
161 - if (ENABLE_FEATURE_2_6_MODULES &&
162 - (k_version > 4) && (col[-3] == '.') &&
163 - (col[-2] == 'k') && (col[-1] == 'o'))
164 - dot = col - 3;
165 - else if ((col[-2] == '.') && (col[-1] == 'o'))
166 - dot = col - 2;
167 + dot = col - ext_size(col - 1 USE_FEATURE_2_6_MODULES(, k_version));
169 mod = xstrndup(mods, dot - mods);
171 @@ -522,12 +540,7 @@ static struct dep_t *build_dep(void)
172 deps = skip_whitespace(deps);
174 /* find the end of the module name in the file name */
175 - if (ENABLE_FEATURE_2_6_MODULES
176 - && (k_version > 4) && (next[-2] == '.')
177 - && (next[-1] == 'k') && (next[0] == 'o'))
178 - ext = 3;
179 - else if ((next[-1] == '.') && (next[0] == 'o'))
180 - ext = 2;
181 + ext = ext_size(next USE_FEATURE_2_6_MODULES(, k_version));
183 /* Cope with blank lines */
184 if ((next - deps - ext + 1) <= 0)
186 --- busybox-1.12.0/modutils/depmod.c
187 +++ busybox-1.12.0/modutils/depmod.c
188 @@ -109,11 +109,15 @@
189 ARG_b = (1<<2), /* not /lib/modules/$(uname -r)/ but this base-dir */
190 ARG_e = (1<<3), /* with -F, print unresolved symbols */
191 ARG_F = (1<<4), /* System.map that contains the symbols */
192 - ARG_n = (1<<5) /* dry-run, print to stdout only */
193 + ARG_n = (1<<5), /* dry-run, print to stdout only */
194 + ARG_u = (1<<6), /* unresolved-error: ignored */
195 + ARG_q = (1<<7), /* quiet: ignored */
196 + ARG_r = (1<<8), /* root: ignored */
197 + ARG_C = (1<<9) /* config: ignored */
198 };
199 INIT_G();
201 - getopt32(argv, "aAb:eF:n", &moddir_base, &system_map);
202 + getopt32(argv, "aAb:eF:nuqrC", &moddir_base, &system_map);
203 argv += optind;
205 /* If a version is provided, then that kernel version’s module directory
207 --- busybox-1.12.0/modutils/depmod.c
208 +++ busybox-1.12.0/modutils/depmod.c
209 @@ -141,6 +141,11 @@
211 if (!(option_mask32 & ARG_n)) { /* --dry-run */
212 chp = concat_path_file(moddir, CONFIG_DEFAULT_DEPMOD_FILE);
213 + if (option_mask32 & ARG_b) {
214 + char *s = concat_path_file(moddir_base, chp);
215 + free(chp);
216 + chp = s;
217 + }
218 filedes = xfopen_for_write(chp);
219 if (ENABLE_FEATURE_CLEAN_UP)
220 free(chp);