SOURCES: module-init-tools-noescape.patch (NEW), module-init-tools...
glen
glen at pld-linux.org
Sat Dec 15 18:12:25 CET 2007
Author: glen Date: Sat Dec 15 17:12:25 2007 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- from fc
---- Files affected:
SOURCES:
module-init-tools-noescape.patch (NONE -> 1.1) (NEW), module-init-tools-dump_modversions.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/module-init-tools-noescape.patch
diff -u /dev/null SOURCES/module-init-tools-noescape.patch:1.1
--- /dev/null Sat Dec 15 18:12:25 2007
+++ SOURCES/module-init-tools-noescape.patch Sat Dec 15 18:12:19 2007
@@ -0,0 +1,18 @@
+diff -urNp module-init-tools-3.3-pre11_orig/depmod.c module-init-tools-3.3-pre11/depmod.c
+--- module-init-tools-3.3-pre11_orig/depmod.c 2007-03-22 12:36:02.000000000 -0400
++++ module-init-tools-3.3-pre11/depmod.c 2007-03-22 15:07:15.000000000 -0400
+@@ -701,13 +701,8 @@ static void filename2modname(char *modna
+ else
+ afterslash++;
+
+- /* Convert to underscores, stop at first . */
+- for (i = 0; afterslash[i] && afterslash[i] != '.'; i++) {
+- if (afterslash[i] == '-')
+- modname[i] = '_';
+- else
++ for (i = 0; afterslash[i] && afterslash[i] != '.'; i++)
+ modname[i] = afterslash[i];
+- }
+ modname[i] = '\0';
+ }
+
================================================================
Index: SOURCES/module-init-tools-dump_modversions.patch
diff -u /dev/null SOURCES/module-init-tools-dump_modversions.patch:1.1
--- /dev/null Sat Dec 15 18:12:25 2007
+++ SOURCES/module-init-tools-dump_modversions.patch Sat Dec 15 18:12:20 2007
@@ -0,0 +1,109 @@
+diff -urNp module-init-tools-3.3-pre11_orig/modprobe.c module-init-tools-3.3-pre11/modprobe.c
+--- module-init-tools-3.3-pre11_orig/modprobe.c 2007-03-22 12:36:02.000000000 -0400
++++ module-init-tools-3.3-pre11/modprobe.c 2007-03-22 15:08:52.000000000 -0400
+@@ -976,6 +976,67 @@ nonexistent_module:
+ goto remove_rest;
+ }
+
++struct modver32_info
++{
++ uint32_t crc;
++ char name[64 - sizeof(uint32_t)];
++};
++
++struct modver64_info
++{
++ uint64_t crc;
++ char name[64 - sizeof(uint64_t)];
++};
++
++const char *skip_dot(const char *str)
++{
++ /* For our purposes, .foo matches foo. PPC64 needs this. */
++ if (str && str[0] == '.')
++ return str + 1;
++ return str;
++}
++
++void dump_modversions(const char *filename, errfn_t error)
++{
++ unsigned long size, secsize;
++ void *file = grab_file(filename, &size);
++ struct modver32_info *info32;
++ struct modver64_info *info64;
++ int n;
++
++ if (!file) {
++ error("%s: %s\n", filename, strerror(errno));
++ return;
++ }
++ switch (elf_ident(file, size)) {
++ case ELFCLASS32:
++ info32 = get_section32(file, size, "__versions", &secsize);
++ if (!info32)
++ return; /* Does not seem to be a kernel module */
++ if (secsize % sizeof(struct modver32_info))
++ error("Wrong section size in %s\n", filename);
++ for (n = 0; n < secsize / sizeof(struct modver32_info); n++)
++ printf("0x%08lx\t%s\n", (unsigned long)
++ info32[n].crc, skip_dot(info32[n].name));
++ break;
++
++ case ELFCLASS64:
++ info64 = get_section64(file, size, "__versions", &secsize);
++ if (!info64)
++ return; /* Does not seem to be a kernel module */
++ if (secsize % sizeof(struct modver64_info))
++ error("Wrong section size in %s\n", filename);
++ for (n = 0; n < secsize / sizeof(struct modver64_info); n++)
++ printf("0x%08llx\t%s\n", (unsigned long long)
++ info64[n].crc, skip_dot(info64[n].name));
++ break;
++
++ default:
++ error("%s: ELF class not recognized\n", filename);
++ }
++}
++
++
+ /* Does path contain directory(s) subpath? */
+ static int type_matches(const char *path, const char *subpath)
+ {
+@@ -1384,6 +1445,7 @@ static struct option options[] = { { "ve
+ { "set-version", 1, NULL, 'S' },
+ { "show-depends", 0, NULL, 'D' },
+ { "first-time", 0, NULL, 3 },
++ { "dump-modversions", 0, NULL, 4 },
+ { "use-blacklist", 0, NULL, 'b' },
+ { NULL, 0, NULL, 0 } };
+
+@@ -1421,6 +1483,7 @@ int main(int argc, char *argv[])
+ int strip_modversion = 0;
+ int ignore_proc = 0;
+ int first_time = 0;
++ int dump_modver = 0;
+ int use_blacklist = 0;
+ unsigned int i, num_modules;
+ char *type = NULL;
+@@ -1537,6 +1600,9 @@ int main(int argc, char *argv[])
+ case 3:
+ first_time = 1;
+ break;
++ case 4:
++ dump_modver = 1;
++ break;
+ default:
+ print_usage(argv[0]);
+ }
+@@ -1602,6 +1668,11 @@ int main(int argc, char *argv[])
+ LIST_HEAD(list);
+ char *modulearg = argv[optind + i];
+
++ if (dump_modver) {
++ dump_modversions(modulearg, error);
++ continue;
++ }
++
+ /* Convert name we are looking for */
+ underscores(modulearg);
+
================================================================
More information about the pld-cvs-commit
mailing list