]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
kmod-depmod: dump modules.symbols.bin
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Sat, 24 Dec 2011 01:20:44 +0000 (23:20 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Tue, 27 Dec 2011 14:09:16 +0000 (12:09 -0200)
tools/kmod-depmod.c

index 400a2ec20f9da1818265267d645fca43662eb058..cb55204b2238603df6f6fc1d44609250e3aa58ae 100644 (file)
@@ -2342,6 +2342,47 @@ static int output_symbols(struct depmod *depmod, FILE *out)
        return 0;
 }
 
+static int output_symbols_bin(struct depmod *depmod, FILE *out)
+{
+       struct index_node *idx;
+       char alias[1024];
+       size_t i, baselen = sizeof("symbol:") - 1;
+
+       if (out == stdout)
+               return 0;
+
+       idx = index_create();
+       if (idx == NULL)
+               return -ENOMEM;
+
+       memcpy(alias, "symbol:", baselen);
+
+       for (i = 0; i < depmod->symbols->n_buckets; i++) {
+               const struct hash_bucket *b = depmod->symbols->buckets + i;
+               unsigned j;
+               for (j = 0; j < b->used; j++) {
+                       const struct hash_entry *e = b->entries + j;
+                       const struct symbol *sym = e->value;
+                       int duplicate;
+
+                       if (sym->owner == NULL)
+                               continue;
+
+                       strcpy(alias + baselen, sym->name);
+                       duplicate = index_insert(idx, alias,
+                                                sym->owner->modname,
+                                                sym->owner->idx);
+                       if (duplicate && depmod->cfg->warn_dups)
+                               WRN("duplicate module syms:\n%s %s\n",
+                                   alias, sym->owner->modname);
+               }
+       }
+
+       index_write(idx, out);
+       index_destroy(idx);
+       return 0;
+}
+
 static int output_builtin_bin(struct depmod *depmod, FILE *out)
 {
        FILE *in;
@@ -2448,7 +2489,7 @@ static int depmod_output(struct depmod *depmod, FILE *out)
                //{"modules.alias.bin", output_aliases_bin},
                {"modules.softdep", output_softdeps},
                {"modules.symbols", output_symbols},
-               //{"modules.symbols.bin", output_symbols_bin},
+               {"modules.symbols.bin", output_symbols_bin},
                {"modules.builtin.bin", output_builtin_bin},
                {"modules.devname", output_devname},
                {NULL, NULL}