Lines Matching refs:mod
174 struct module *mod; in find_module() local
176 for (mod = modules; mod; mod = mod->next) in find_module()
177 if (strcmp(mod->name, modname) == 0) in find_module()
179 return mod; in find_module()
184 struct module *mod; in new_module() local
186 mod = NOFAIL(malloc(sizeof(*mod) + strlen(modname) + 1)); in new_module()
187 memset(mod, 0, sizeof(*mod)); in new_module()
190 strcpy(mod->name, modname); in new_module()
191 mod->is_vmlinux = (strcmp(modname, "vmlinux") == 0); in new_module()
192 mod->gpl_compatible = -1; in new_module()
193 mod->next = modules; in new_module()
194 modules = mod; in new_module()
196 return mod; in new_module()
414 static struct symbol *sym_add_exported(const char *name, struct module *mod, in sym_add_exported() argument
420 s = new_symbol(name, mod, export); in sym_add_exported()
422 s->module == mod) { in sym_add_exported()
424 mod->name, name, s->module->name, in sym_add_exported()
428 s->module = mod; in sym_add_exported()
666 static void handle_modversion(const struct module *mod, in handle_modversion() argument
675 symname, mod->name, mod->is_vmlinux ? "" : ".ko", in handle_modversion()
693 static void handle_symbol(struct module *mod, struct elf_info *info, in handle_symbol() argument
709 warn("\"%s\" [%s] is COMMON symbol\n", symname, mod->name); in handle_symbol()
731 mod->unres = alloc_symbol(symname, in handle_symbol()
733 mod->unres); in handle_symbol()
739 sym_add_exported(name, mod, export); in handle_symbol()
742 mod->has_init = 1; in handle_symbol()
744 mod->has_cleanup = 1; in handle_symbol()
1917 static void check_sec_ref(struct module *mod, const char *modname, in check_sec_ref() argument
1956 struct module *mod; in read_symbols() local
1972 mod = new_module(tmp); in read_symbols()
1976 if (!mod->is_vmlinux) { in read_symbols()
1982 mod->gpl_compatible = 1; in read_symbols()
1984 mod->gpl_compatible = 0; in read_symbols()
1992 add_namespace(&mod->imported_namespaces, namespace); in read_symbols()
2001 handle_symbol(mod, &info, sym, symname); in read_symbols()
2002 handle_moddevtable(mod, &info, sym, symname); in read_symbols()
2015 handle_modversion(mod, &info, sym, in read_symbols()
2033 check_sec_ref(mod, modname, &info); in read_symbols()
2035 if (!mod->is_vmlinux) { in read_symbols()
2038 get_src_version(mod->name, mod->srcversion, in read_symbols()
2039 sizeof(mod->srcversion) - 1); in read_symbols()
2049 mod->unres = alloc_symbol("module_layout", 0, mod->unres); in read_symbols()
2116 static void check_exports(struct module *mod) in check_exports() argument
2120 for (s = mod->unres; s; s = s->next) { in check_exports()
2123 if (!exp || exp->module == mod) { in check_exports()
2127 s->name, mod->name); in check_exports()
2130 basename = strrchr(mod->name, '/'); in check_exports()
2134 basename = mod->name; in check_exports()
2137 !module_imports_namespace(mod, exp->namespace)) { in check_exports()
2141 add_namespace(&mod->missing_namespaces, exp->namespace); in check_exports()
2144 if (!mod->gpl_compatible) in check_exports()
2149 static void check_modname_len(struct module *mod) in check_modname_len() argument
2153 mod_name = strrchr(mod->name, '/'); in check_modname_len()
2155 mod_name = mod->name; in check_modname_len()
2159 error("module name is too long [%s.ko]\n", mod->name); in check_modname_len()
2165 static void add_header(struct buffer *b, struct module *mod) in add_header() argument
2187 if (mod->has_init) in add_header()
2189 if (mod->has_cleanup) in add_header()
2234 static void add_versions(struct buffer *b, struct module *mod) in add_versions() argument
2238 for (s = mod->unres; s; s = s->next) { in add_versions()
2240 if (!exp || exp->module == mod) in add_versions()
2254 for (s = mod->unres; s; s = s->next) { in add_versions()
2259 s->name, mod->name); in add_versions()
2264 s->name, mod->name); in add_versions()
2274 static void add_depends(struct buffer *b, struct module *mod) in add_depends() argument
2280 for (s = mod->unres; s; s = s->next) in add_depends()
2286 for (s = mod->unres; s; s = s->next) { in add_depends()
2306 static void add_srcversion(struct buffer *b, struct module *mod) in add_srcversion() argument
2308 if (mod->srcversion[0]) { in add_srcversion()
2311 mod->srcversion); in add_srcversion()
2386 struct module *mod; in read_dump() local
2405 mod = find_module(modname); in read_dump()
2406 if (!mod) { in read_dump()
2407 mod = new_module(modname); in read_dump()
2408 mod->from_dump = 1; in read_dump()
2410 s = sym_add_exported(symname, mod, export_no(export)); in read_dump()
2449 struct module *mod; in write_namespace_deps_files() local
2453 for (mod = modules; mod; mod = mod->next) { in write_namespace_deps_files()
2455 if (mod->from_dump || !mod->missing_namespaces) in write_namespace_deps_files()
2458 buf_printf(&ns_deps_buf, "%s.ko:", mod->name); in write_namespace_deps_files()
2460 for (ns = mod->missing_namespaces; ns; ns = ns->next) in write_namespace_deps_files()
2477 struct module *mod; in main() local
2547 for (mod = modules; mod; mod = mod->next) { in main()
2550 if (mod->is_vmlinux || mod->from_dump) in main()
2555 check_modname_len(mod); in main()
2556 check_exports(mod); in main()
2558 add_header(&buf, mod); in main()
2561 add_staging_flag(&buf, mod->name); in main()
2562 add_versions(&buf, mod); in main()
2563 add_depends(&buf, mod); in main()
2564 add_moddevtable(&buf, mod); in main()
2565 add_srcversion(&buf, mod); in main()
2568 sprintf(fname, "%s.mod.c", mod->name); in main()