kernel/module/internal.h
Source file repositories/reference/linux-study-clean/kernel/module/internal.h
File Facts
- System
- Linux kernel
- Corpus path
kernel/module/internal.h- Extension
.h- Size
- 12749 bytes
- Lines
- 424
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/elf.hlinux/compiler.hlinux/module.hlinux/mutex.hlinux/rculist.hlinux/rcupdate.hlinux/mm.h
Detected Declarations
struct kernel_symbolstruct load_infostruct find_symbol_argstruct module_usestruct mod_fail_loadstruct mod_unload_taintstruct mod_tree_rootstruct modversion_info_extenum mod_licenseenum fail_dup_mod_reasonfunction kernel_symbol_valuefunction copy_module_elffunction free_module_elffunction try_add_failed_modulefunction mod_stat_bump_invalidfunction kmod_dup_request_exists_waitfunction kmod_dup_request_announcefunction try_add_tainted_modulefunction print_unloaded_tainted_modulesfunction module_decompressfunction module_decompress_cleanupfunction mod_tree_insertfunction list_for_each_entry_rcufunction module_sig_checkfunction kmemleak_load_modulefunction sect_emptyfunction init_build_idfunction mod_sysfs_setupfunction mod_sysfs_teardownfunction check_versionfunction check_modstruct_versionfunction same_magic
Annotated Snippet
struct kernel_symbol {
#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
int value_offset;
int name_offset;
int namespace_offset;
#else
unsigned long value;
const char *name;
const char *namespace;
#endif
};
extern struct mutex module_mutex;
extern struct list_head modules;
extern const struct module_attribute *const modinfo_attrs[];
extern const size_t modinfo_attrs_count;
/* Provided by the linker */
extern const struct kernel_symbol __start___ksymtab[];
extern const struct kernel_symbol __stop___ksymtab[];
extern const u32 __start___kcrctab[];
extern const u8 __start___kflagstab[];
#define KMOD_PATH_LEN 256
extern char modprobe_path[];
struct load_info {
const char *name;
/* pointer to module in temporary copy, freed at end of load_module() */
struct module *mod;
Elf_Ehdr *hdr;
unsigned long len;
Elf_Shdr *sechdrs;
char *secstrings, *strtab;
unsigned long symoffs, stroffs, init_typeoffs, core_typeoffs;
bool sig_ok;
#ifdef CONFIG_KALLSYMS
unsigned long mod_kallsyms_init_off;
#endif
#ifdef CONFIG_MODULE_DECOMPRESS
#ifdef CONFIG_MODULE_STATS
unsigned long compressed_len;
#endif
struct page **pages;
unsigned int max_pages;
unsigned int used_pages;
#endif
struct {
unsigned int sym;
unsigned int str;
unsigned int mod;
unsigned int vers;
unsigned int info;
unsigned int pcpu;
unsigned int vers_ext_crc;
unsigned int vers_ext_name;
} index;
};
enum mod_license {
NOT_GPL_ONLY,
GPL_ONLY,
};
struct find_symbol_arg {
/* Input */
const char *name;
bool gplok;
bool warn;
/* Output */
struct module *owner;
const u32 *crc;
const struct kernel_symbol *sym;
enum mod_license license;
};
/* modules using other modules */
struct module_use {
struct list_head source_list;
struct list_head target_list;
struct module *source, *target;
};
int mod_verify_sig(const void *mod, struct load_info *info);
int try_to_force_load(struct module *mod, const char *reason);
bool find_symbol(struct find_symbol_arg *fsa);
struct module *find_module_all(const char *name, size_t len, bool even_unformed);
int cmp_name(const void *name, const void *sym);
Annotation
- Immediate include surface: `linux/elf.h`, `linux/compiler.h`, `linux/module.h`, `linux/mutex.h`, `linux/rculist.h`, `linux/rcupdate.h`, `linux/mm.h`.
- Detected declarations: `struct kernel_symbol`, `struct load_info`, `struct find_symbol_arg`, `struct module_use`, `struct mod_fail_load`, `struct mod_unload_taint`, `struct mod_tree_root`, `struct modversion_info_ext`, `enum mod_license`, `enum fail_dup_mod_reason`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.