History

modpost: Add modname to mod_device_table alias

At this point, if a symbol is compiled as part of the kernel, information about which module the symbol belongs to is lost. To save this it is possible to add the module name to the alias name. It's not very pretty, but it's possible for now.

Alexey Gladkov committed 1 year ago

Commit 83fb4931 parent b88f88c3 files · +29 −8Browse files

Showing the changes to scripts (1 of 3 files). Show all

Unified · Split

scripts/mod/file2alias.c+12−3
@@ -1476,7 +1476,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, · 1475 unmodified lines
1476{1476{
1477 void *symval;1477 void *symval;
1478 char *zeros = NULL;1478 char *zeros = NULL;
1479 const char *type, *name;1479 const char *type, *name, *modname;
1480 size_t typelen;1480 size_t typelen;
1481 static const char *prefix = "__mod_device_table__";1481 static const char *prefix = "__mod_device_table__";
1482 1482
@@ -1488,10 +1488,19 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, · 5 unmodified lines
1488 if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT)1488 if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT)
1489 return;1489 return;
1490 1490
1491 /* All our symbols are of form __mod_device_table__<type>__<name>. */1491 /* All our symbols are of form __mod_device_table__kmod_<modname>__<type>__<name>. */
1492 if (!strstarts(symname, prefix))1492 if (!strstarts(symname, prefix))
1493 return;1493 return;
1494 type = symname + strlen(prefix);1494
1495 modname = strstr(symname, "__kmod_");
1496 if (!modname)
1497 return;
1498 modname += strlen("__kmod_");
1499
1500 type = strstr(modname, "__");
1501 if (!type)
1502 return;
1503 type += strlen("__");
1495 1504
1496 name = strstr(type, "__");1505 name = strstr(type, "__");
1497 if (!name)1506 if (!name)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t