mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
modpost: introduce module_alias_printf() helper
The generic ->do_entry() handler is currently limited to returning a single alias string. However, this is not flexible enough for several subsystems, which currently require their own implementations: - do_usb_table() - do_of_table() - do_pnp_device_entry() - do_pnp_card_entries() This commit introduces a helper function so that these special cases can add multiple MODULE_ALIAS() and then migrate to the generic framework. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
@@ -176,6 +176,7 @@ static struct module *new_module(const char *name, size_t namelen)
|
||||
INIT_LIST_HEAD(&mod->unresolved_symbols);
|
||||
INIT_LIST_HEAD(&mod->missing_namespaces);
|
||||
INIT_LIST_HEAD(&mod->imported_namespaces);
|
||||
INIT_LIST_HEAD(&mod->aliases);
|
||||
|
||||
memcpy(mod->name, name, namelen);
|
||||
mod->name[namelen] = '\0';
|
||||
@@ -1966,6 +1967,7 @@ static void write_vmlinux_export_c_file(struct module *mod)
|
||||
static void write_mod_c_file(struct module *mod)
|
||||
{
|
||||
struct buffer buf = { };
|
||||
struct module_alias *alias, *next;
|
||||
char fname[PATH_MAX];
|
||||
int ret;
|
||||
|
||||
@@ -1973,7 +1975,14 @@ static void write_mod_c_file(struct module *mod)
|
||||
add_exported_symbols(&buf, mod);
|
||||
add_versions(&buf, mod);
|
||||
add_depends(&buf, mod);
|
||||
add_moddevtable(&buf, mod);
|
||||
|
||||
buf_printf(&buf, "\n");
|
||||
list_for_each_entry_safe(alias, next, &mod->aliases, node) {
|
||||
buf_printf(&buf, "MODULE_ALIAS(\"%s\");\n", alias->str);
|
||||
list_del(&alias->node);
|
||||
free(alias);
|
||||
}
|
||||
|
||||
add_srcversion(&buf, mod);
|
||||
|
||||
ret = snprintf(fname, sizeof(fname), "%s.mod.c", mod->name);
|
||||
|
||||
Reference in New Issue
Block a user