include/linux/kmsg_dump.h
Source file repositories/reference/linux-study-clean/include/linux/kmsg_dump.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/kmsg_dump.h- Extension
.h- Size
- 3192 bytes
- Lines
- 127
- 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/errno.hlinux/list.h
Detected Declarations
struct kmsg_dump_iterstruct kmsg_dump_detailstruct kmsg_dumperenum kmsg_dump_reasonfunction kmsg_dump_descfunction kmsg_dump_get_bufferfunction kmsg_dump_rewindfunction kmsg_dump_unregisterfunction kmsg_dump
Annotated Snippet
struct kmsg_dump_iter {
u64 cur_seq;
u64 next_seq;
};
/**
* struct kmsg_dump_detail - kernel crash detail
* @reason: reason for the crash, see kmsg_dump_reason.
* @description: optional short string, to provide additional information.
*/
struct kmsg_dump_detail {
enum kmsg_dump_reason reason;
const char *description;
};
/**
* struct kmsg_dumper - kernel crash message dumper structure
* @list: Entry in the dumper list (private)
* @dump: Call into dumping code which will retrieve the data with
* through the record iterator
* @max_reason: filter for highest reason number that should be dumped
* @registered: Flag that specifies if this is already registered
*/
struct kmsg_dumper {
struct list_head list;
void (*dump)(struct kmsg_dumper *dumper, struct kmsg_dump_detail *detail);
enum kmsg_dump_reason max_reason;
bool registered;
};
#ifdef CONFIG_PRINTK
void kmsg_dump_desc(enum kmsg_dump_reason reason, const char *desc);
bool kmsg_dump_get_line(struct kmsg_dump_iter *iter, bool syslog,
char *line, size_t size, size_t *len);
bool kmsg_dump_get_buffer(struct kmsg_dump_iter *iter, bool syslog,
char *buf, size_t size, size_t *len_out);
void kmsg_dump_rewind(struct kmsg_dump_iter *iter);
int kmsg_dump_register(struct kmsg_dumper *dumper);
int kmsg_dump_unregister(struct kmsg_dumper *dumper);
const char *kmsg_dump_reason_str(enum kmsg_dump_reason reason);
#else
static inline void kmsg_dump_desc(enum kmsg_dump_reason reason, const char *desc)
{
}
static inline bool kmsg_dump_get_line(struct kmsg_dump_iter *iter, bool syslog,
const char *line, size_t size, size_t *len)
{
return false;
}
static inline bool kmsg_dump_get_buffer(struct kmsg_dump_iter *iter, bool syslog,
char *buf, size_t size, size_t *len)
{
return false;
}
static inline void kmsg_dump_rewind(struct kmsg_dump_iter *iter)
{
}
static inline int kmsg_dump_register(struct kmsg_dumper *dumper)
{
return -EINVAL;
}
static inline int kmsg_dump_unregister(struct kmsg_dumper *dumper)
{
return -EINVAL;
}
static inline const char *kmsg_dump_reason_str(enum kmsg_dump_reason reason)
{
return "Disabled";
}
#endif
static inline void kmsg_dump(enum kmsg_dump_reason reason)
{
kmsg_dump_desc(reason, NULL);
}
#endif /* _LINUX_KMSG_DUMP_H */
Annotation
- Immediate include surface: `linux/errno.h`, `linux/list.h`.
- Detected declarations: `struct kmsg_dump_iter`, `struct kmsg_dump_detail`, `struct kmsg_dumper`, `enum kmsg_dump_reason`, `function kmsg_dump_desc`, `function kmsg_dump_get_buffer`, `function kmsg_dump_rewind`, `function kmsg_dump_unregister`, `function kmsg_dump`.
- 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.