include/linux/codetag.h
Source file repositories/reference/linux-study-clean/include/linux/codetag.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/codetag.h- Extension
.h- Size
- 3538 bytes
- Lines
- 116
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.h
Detected Declarations
struct codetag_iteratorstruct codetag_typestruct codetag_modulestruct seq_bufstruct modulestruct codetagstruct codetag_type_descstruct codetag_iteratorfunction codetag_needs_module_sectionfunction codetag_alloc_module_sectionfunction codetag_free_module_sectionsfunction codetag_unload_module
Annotated Snippet
struct codetag {
unsigned int flags;
unsigned int lineno;
const char *modname;
const char *function;
const char *filename;
} __aligned(8);
union codetag_ref {
struct codetag *ct;
};
struct codetag_type_desc {
const char *section;
size_t tag_size;
int (*module_load)(struct module *mod,
struct codetag *start, struct codetag *end);
void (*module_unload)(struct module *mod,
struct codetag *start, struct codetag *end);
#ifdef CONFIG_MODULES
void (*module_replaced)(struct module *mod, struct module *new_mod);
bool (*needs_section_mem)(struct module *mod, unsigned long size);
void *(*alloc_section_mem)(struct module *mod, unsigned long size,
unsigned int prepend, unsigned long align);
void (*free_section_mem)(struct module *mod, bool used);
#endif
};
struct codetag_iterator {
struct codetag_type *cttype;
struct codetag_module *cmod;
unsigned long mod_id;
struct codetag *ct;
unsigned long mod_seq;
};
#ifdef MODULE
#define CT_MODULE_NAME KBUILD_MODNAME
#else
#define CT_MODULE_NAME NULL
#endif
#define CODE_TAG_INIT { \
.modname = CT_MODULE_NAME, \
.function = __func__, \
.filename = __FILE__, \
.lineno = __LINE__, \
.flags = 0, \
}
void codetag_lock_module_list(struct codetag_type *cttype, bool lock);
bool codetag_trylock_module_list(struct codetag_type *cttype);
struct codetag_iterator codetag_get_ct_iter(struct codetag_type *cttype);
struct codetag *codetag_next_ct(struct codetag_iterator *iter);
void codetag_to_text(struct seq_buf *out, struct codetag *ct);
struct codetag_type *
codetag_register_type(const struct codetag_type_desc *desc);
#if defined(CONFIG_CODE_TAGGING) && defined(CONFIG_MODULES)
bool codetag_needs_module_section(struct module *mod, const char *name,
unsigned long size);
void *codetag_alloc_module_section(struct module *mod, const char *name,
unsigned long size, unsigned int prepend,
unsigned long align);
void codetag_free_module_sections(struct module *mod);
void codetag_module_replaced(struct module *mod, struct module *new_mod);
int codetag_load_module(struct module *mod);
void codetag_unload_module(struct module *mod);
#else /* defined(CONFIG_CODE_TAGGING) && defined(CONFIG_MODULES) */
static inline bool
codetag_needs_module_section(struct module *mod, const char *name,
unsigned long size) { return false; }
static inline void *
codetag_alloc_module_section(struct module *mod, const char *name,
unsigned long size, unsigned int prepend,
unsigned long align) { return NULL; }
static inline void codetag_free_module_sections(struct module *mod) {}
static inline void codetag_module_replaced(struct module *mod, struct module *new_mod) {}
static inline int codetag_load_module(struct module *mod) { return 0; }
static inline void codetag_unload_module(struct module *mod) {}
#endif /* defined(CONFIG_CODE_TAGGING) && defined(CONFIG_MODULES) */
#endif /* _LINUX_CODETAG_H */
Annotation
- Immediate include surface: `linux/types.h`.
- Detected declarations: `struct codetag_iterator`, `struct codetag_type`, `struct codetag_module`, `struct seq_buf`, `struct module`, `struct codetag`, `struct codetag_type_desc`, `struct codetag_iterator`, `function codetag_needs_module_section`, `function codetag_alloc_module_section`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.