From 447eed8c489258552942afbba8ea042f99c838e6 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Tue, 30 Oct 2012 04:08:54 -0200 Subject: [PATCH] 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. --- tools/depmod.c | 16 ++++++---------- 1 file 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; } -- 2.7.4