]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
kmod-depmod: dump modules.symbols
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Fri, 23 Dec 2011 03:27:28 +0000 (01:27 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Tue, 27 Dec 2011 14:09:16 +0000 (12:09 -0200)
note that the hash algorithm is different thus the output order will
be different as well.

to compare the outputs, sort the files:

   depmod -n | grep '^alias symbol:' | sort > /tmp/orig
   kmod-depmod -n | grep '^alias symbol:' | sort > /tmp/new
   diff /tmp/orig /tmp/new

tools/kmod-depmod.c

index 998970544364855aa642a4fb17a3f0b5b3c095d5..6b78f6641b9d6fb865349c88fe808864cff671ba 100644 (file)
@@ -1676,6 +1676,28 @@ static int depmod_load(struct depmod *depmod)
        return 0;
 }
 
+static int output_symbols(struct depmod *depmod, FILE *out)
+{
+       size_t i;
+
+       fputs("# Aliases for symbols, used by symbol_request().\n", out);
+
+       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;
+                       if (sym->owner == NULL)
+                               continue;
+                       fprintf(out, "alias symbol:%s %s\n",
+                               sym->name, sym->owner->modname);
+               }
+       }
+
+       return 0;
+}
+
 static int output_devname(struct depmod *depmod, FILE *out)
 {
        size_t i;
@@ -1740,7 +1762,7 @@ static int depmod_output(struct depmod *depmod, FILE *out)
                //{"modules.alias", output_aliases},
                //{"modules.alias.bin", output_aliases_bin},
                //{"modules.softdep", output_softdeps},
-               //{"modules.symbols", output_symbols},
+               {"modules.symbols", output_symbols},
                //{"modules.symbols.bin", output_symbols_bin},
                //{"modules.builtin.bin", output_builtin_bin},
                {"modules.devname", output_devname},