diff options
author | Lucas De Marchi <lucas.de.marchi@gmail.com> | 2012-10-30 04:08:54 -0200 |
---|---|---|
committer | Lucas De Marchi <lucas.de.marchi@gmail.com> | 2012-10-30 04:11:24 -0200 |
commit | 447eed8c489258552942afbba8ea042f99c838e6 (patch) | |
tree | c4f1044f80177d62d532e472c45c4434e4d3b712 | |
parent | ec587f298cf172cf89382881bdb45f096376da1d (diff) | |
download | kmod-447eed8c489258552942afbba8ea042f99c838e6.tar.gz |
depmod: use our copy of modname instead of calling libkmod
In depmod_module_add() we already called kmod_module_get_name() and
copied the string to our struct. Use it instead of calling again and
again the libkmod function.
-rw-r--r-- | tools/depmod.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/tools/depmod.c b/tools/depmod.c index 0664725..154a0b3 100644 --- a/tools/depmod.c +++ b/tools/depmod.c @@ -1980,8 +1980,7 @@ static int output_aliases(struct depmod *depmod, FILE *out) if (!streq(key, "alias")) continue; - fprintf(out, "alias %s %s\n", - value, kmod_module_get_name(mod->kmod)); + fprintf(out, "alias %s %s\n", value, mod->modname); } } @@ -2008,7 +2007,7 @@ static int output_aliases_bin(struct depmod *depmod, FILE *out) kmod_list_foreach(l, mod->info_list) { const char *key = kmod_module_info_get_key(l); const char *value = kmod_module_info_get_value(l); - const char *modname, *alias; + const char *alias; int duplicate; if (!streq(key, "alias")) @@ -2018,12 +2017,11 @@ static int output_aliases_bin(struct depmod *depmod, FILE *out) if (alias == NULL) continue; - modname = kmod_module_get_name(mod->kmod); - duplicate = index_insert(idx, alias, modname, + duplicate = index_insert(idx, alias, mod->modname, mod->idx); if (duplicate && depmod->cfg->warn_dups) WRN("duplicate module alias:\n%s %s\n", - alias, modname); + alias, mod->modname); } } @@ -2052,8 +2050,7 @@ static int output_softdeps(struct depmod *depmod, FILE *out) if (!streq(key, "softdep")) continue; - fprintf(out, "softdep %s %s\n", - kmod_module_get_name(mod->kmod), value); + fprintf(out, "softdep %s %s\n", mod->modname, value); } } @@ -2197,8 +2194,7 @@ static int output_devname(struct depmod *depmod, FILE *out) } if (type != '\0' && devname != NULL) { - fprintf(out, "%s %s %c%u:%u\n", - kmod_module_get_name(mod->kmod), + fprintf(out, "%s %s %c%u:%u\n", mod->modname, devname, type, major, minor); break; } |