kernel/fail_function.c
Source file repositories/reference/linux-study-clean/kernel/fail_function.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/fail_function.c- Extension
.c- Size
- 6948 bytes
- Lines
- 335
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/error-injection.hlinux/debugfs.hlinux/fault-inject.hlinux/kallsyms.hlinux/kprobes.hlinux/module.hlinux/mutex.hlinux/slab.hlinux/uaccess.h
Detected Declarations
struct fei_attrfunction fei_post_handlerfunction adjust_error_retvalfunction fei_attr_freefunction list_for_each_entryfunction fei_attr_is_validfunction list_for_each_entryfunction fei_retval_setfunction fei_retval_getfunction fei_debugfs_add_attrfunction fei_debugfs_remove_attrfunction fei_kprobe_handlerfunction fei_seq_stopfunction fei_seq_showfunction fei_openfunction fei_attr_removefunction fei_attr_remove_allfunction list_for_each_entry_safefunction fei_writefunction fei_debugfs_init
Annotated Snippet
static const struct file_operations fei_ops = {
.open = fei_open,
.read = seq_read,
.write = fei_write,
.llseek = seq_lseek,
.release = seq_release,
};
static int __init fei_debugfs_init(void)
{
struct dentry *dir;
dir = fault_create_debugfs_attr("fail_function", NULL,
&fei_fault_attr);
if (IS_ERR(dir))
return PTR_ERR(dir);
/* injectable attribute is just a symlink of error_inject/list */
debugfs_create_symlink("injectable", dir, "../error_injection/list");
debugfs_create_file("inject", 0600, dir, NULL, &fei_ops);
fei_debugfs_dir = dir;
return 0;
}
late_initcall(fei_debugfs_init);
Annotation
- Immediate include surface: `linux/error-injection.h`, `linux/debugfs.h`, `linux/fault-inject.h`, `linux/kallsyms.h`, `linux/kprobes.h`, `linux/module.h`, `linux/mutex.h`, `linux/slab.h`.
- Detected declarations: `struct fei_attr`, `function fei_post_handler`, `function adjust_error_retval`, `function fei_attr_free`, `function list_for_each_entry`, `function fei_attr_is_valid`, `function list_for_each_entry`, `function fei_retval_set`, `function fei_retval_get`, `function fei_debugfs_add_attr`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- Implementation status: pattern 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.