diff options
author | Denys Vlasenko | 2014-04-19 16:17:27 +0200 |
---|---|---|
committer | Denys Vlasenko | 2014-04-19 16:17:27 +0200 |
commit | 6116cb23cc2074f232397b406fabab1606b28fb6 (patch) | |
tree | 898b063730cc9f5bf2b0eff89c082015a03985f6 /modutils | |
parent | 5fd3ddfb243f8f3a8ef471ff8c323a76cf815574 (diff) | |
download | busybox-6116cb23cc2074f232397b406fabab1606b28fb6.zip busybox-6116cb23cc2074f232397b406fabab1606b28fb6.tar.gz |
modprobe-small: remove redundant aliases from modules.dep.bb
function old new delta
parse_module 309 395 +86
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'modutils')
-rw-r--r-- | modutils/modprobe-small.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c index 023755d..223eba9 100644 --- a/modutils/modprobe-small.c +++ b/modutils/modprobe-small.c @@ -212,6 +212,7 @@ static void parse_module(module_info *info, const char *pathname) reset_stringbuf(); pos = 0; while (1) { + unsigned start = stringbuf_idx; ptr = find_keyword(module_image + pos, len - pos, "alias="); if (!ptr) { ptr = find_keyword(module_image + pos, len - pos, "__ksymtab_"); @@ -228,6 +229,31 @@ static void parse_module(module_info *info, const char *pathname) } append(ptr); appendc(' '); + /* + * Don't add redundant aliases, such as: + * libcrc32c.ko symbol:crc32c symbol:crc32c + */ + if (start) { /* "if we aren't the first alias" */ + char *found, *last; + stringbuf[stringbuf_idx] = '\0'; + last = stringbuf + start; + /* + * String at last-1 is " symbol:crc32c " + * (with both leading and trailing spaces). + */ + if (strncmp(stringbuf, last, stringbuf_idx - start) == 0) + /* First alias matches us */ + found = stringbuf; + else + /* Does any other alias match? */ + found = strstr(stringbuf, last-1); + if (found < last-1) { + /* There is absolutely the same string before us */ + dbg2_error_msg("redundant:'%s'", last); + stringbuf_idx = start; + goto skip; + } + } skip: pos = (ptr - module_image); } |