scripts/mod/modpost.h
Source file repositories/reference/linux-study-clean/scripts/mod/modpost.h
File Facts
- System
- Linux kernel
- Corpus path
scripts/mod/modpost.h- Extension
.h- Size
- 6818 bytes
- Lines
- 245
- Domain
- Support Tooling And Documentation
- Bucket
- scripts
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
byteswap.hstdbool.hstdio.hstdlib.hstdarg.hstring.hsys/types.hsys/stat.hsys/mman.hfcntl.hunistd.helf.h../../include/linux/module_symbol.hlist_types.helfconfig.h
Detected Declarations
struct bufferstruct module_aliasstruct modulestruct elf_infofunction get_secindexfunction is_valid_name
Annotated Snippet
struct buffer {
char *p;
int pos;
int size;
};
void __attribute__((format(printf, 2, 3)))
buf_printf(struct buffer *buf, const char *fmt, ...);
void
buf_write(struct buffer *buf, const char *s, int len);
/**
* struct module_alias - auto-generated MODULE_ALIAS()
*
* @node: linked to module::aliases
* @modname: name of the builtin module (only for vmlinux)
* @str: a string for MODULE_ALIAS()
*/
struct module_alias {
struct list_head node;
char *builtin_modname;
char str[];
};
/**
* struct module - represent a module (vmlinux or *.ko)
*
* @dump_file: path to the .symvers file if loaded from a file
* @aliases: list head for module_aliases
* @no_trim_symbol: .no_trim_symbol section data
* @no_trim_symbol_len: length of the .no_trim_symbol section
*/
struct module {
struct list_head list;
struct list_head exported_symbols;
struct list_head unresolved_symbols;
const char *dump_file;
bool is_gpl_compatible;
bool is_vmlinux;
bool seen;
bool has_init;
bool has_cleanup;
char srcversion[25];
// Missing namespace dependencies
struct list_head missing_namespaces;
// Actual imported namespaces
struct list_head imported_namespaces;
struct list_head aliases;
char *no_trim_symbol;
unsigned int no_trim_symbol_len;
char name[];
};
struct elf_info {
size_t size;
Elf_Ehdr *hdr;
Elf_Shdr *sechdrs;
Elf_Sym *symtab_start;
Elf_Sym *symtab_stop;
unsigned int export_symbol_secndx; /* .export_symbol section */
char *strtab;
char *modinfo;
unsigned int modinfo_len;
char *no_trim_symbol;
unsigned int no_trim_symbol_len;
/* support for 32bit section numbers */
unsigned int num_sections; /* max_secindex + 1 */
unsigned int secindex_strings;
/* if Nth symbol table entry has .st_shndx = SHN_XINDEX,
* take shndx from symtab_shndx_start[N] instead */
Elf32_Word *symtab_shndx_start;
Elf32_Word *symtab_shndx_stop;
struct symsearch *symsearch;
};
/* Accessor for sym->st_shndx, hides ugliness of "64k sections" */
static inline unsigned int get_secindex(const struct elf_info *info,
const Elf_Sym *sym)
{
unsigned int index = sym->st_shndx;
/*
* Elf{32,64}_Sym::st_shndx is 2 byte. Big section numbers are available
* in the .symtab_shndx section.
*/
if (index == SHN_XINDEX)
Annotation
- Immediate include surface: `byteswap.h`, `stdbool.h`, `stdio.h`, `stdlib.h`, `stdarg.h`, `string.h`, `sys/types.h`, `sys/stat.h`.
- Detected declarations: `struct buffer`, `struct module_alias`, `struct module`, `struct elf_info`, `function get_secindex`, `function is_valid_name`.
- Atlas domain: Support Tooling And Documentation / scripts.
- Implementation status: source implementation candidate.
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.