kernel/liveupdate/kexec_handover_debugfs.c
Source file repositories/reference/linux-study-clean/kernel/liveupdate/kexec_handover_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/liveupdate/kexec_handover_debugfs.c- Extension
.c- Size
- 4776 bytes
- Lines
- 215
- 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.
- 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/init.hlinux/io.hlinux/libfdt.hlinux/mm.hlinux/kho/abi/kexec_handover.hkexec_handover_internal.h
Detected Declarations
struct fdt_debugfsfunction __kho_debugfs_blob_addfunction kho_debugfs_blob_addfunction kho_debugfs_blob_removefunction list_for_each_entryfunction scratch_phys_showfunction scratch_len_showfunction kho_in_debugfs_initfunction fdt_for_each_subnodefunction kho_out_debugfs_initfunction kho_debugfs_init
Annotated Snippet
struct fdt_debugfs {
struct list_head list;
struct debugfs_blob_wrapper wrapper;
struct dentry *file;
};
static int __kho_debugfs_blob_add(struct list_head *list, struct dentry *dir,
const char *name, const void *blob,
size_t size)
{
struct fdt_debugfs *f;
struct dentry *file;
f = kmalloc_obj(*f);
if (!f)
return -ENOMEM;
f->wrapper.data = (void *)blob;
f->wrapper.size = size;
file = debugfs_create_blob(name, 0400, dir, &f->wrapper);
if (IS_ERR(file)) {
kfree(f);
return PTR_ERR(file);
}
f->file = file;
list_add(&f->list, list);
return 0;
}
int kho_debugfs_blob_add(struct kho_debugfs *dbg, const char *name,
const void *blob, size_t size, bool root)
{
struct dentry *dir;
if (root)
dir = dbg->dir;
else
dir = dbg->sub_fdt_dir;
return __kho_debugfs_blob_add(&dbg->fdt_list, dir, name, blob, size);
}
void kho_debugfs_blob_remove(struct kho_debugfs *dbg, void *blob)
{
struct fdt_debugfs *ff;
list_for_each_entry(ff, &dbg->fdt_list, list) {
if (ff->wrapper.data == blob) {
debugfs_remove(ff->file);
list_del(&ff->list);
kfree(ff);
break;
}
}
}
static int scratch_phys_show(struct seq_file *m, void *v)
{
for (int i = 0; i < kho_scratch_cnt; i++)
seq_printf(m, "0x%llx\n", kho_scratch[i].addr);
return 0;
}
DEFINE_SHOW_ATTRIBUTE(scratch_phys);
static int scratch_len_show(struct seq_file *m, void *v)
{
for (int i = 0; i < kho_scratch_cnt; i++)
seq_printf(m, "0x%llx\n", kho_scratch[i].size);
return 0;
}
DEFINE_SHOW_ATTRIBUTE(scratch_len);
__init void kho_in_debugfs_init(struct kho_debugfs *dbg, const void *fdt)
{
struct dentry *dir, *sub_fdt_dir;
int err, child;
INIT_LIST_HEAD(&dbg->fdt_list);
dir = debugfs_create_dir("in", debugfs_root);
if (IS_ERR(dir)) {
err = PTR_ERR(dir);
goto err_out;
}
Annotation
- Immediate include surface: `linux/init.h`, `linux/io.h`, `linux/libfdt.h`, `linux/mm.h`, `linux/kho/abi/kexec_handover.h`, `kexec_handover_internal.h`.
- Detected declarations: `struct fdt_debugfs`, `function __kho_debugfs_blob_add`, `function kho_debugfs_blob_add`, `function kho_debugfs_blob_remove`, `function list_for_each_entry`, `function scratch_phys_show`, `function scratch_len_show`, `function kho_in_debugfs_init`, `function fdt_for_each_subnode`, `function kho_out_debugfs_init`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- 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.