kernel/power/user.c
Source file repositories/reference/linux-study-clean/kernel/power/user.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/power/user.c- Extension
.c- Size
- 10286 bytes
- Lines
- 482
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/suspend.hlinux/reboot.hlinux/string.hlinux/device.hlinux/miscdevice.hlinux/mm.hlinux/swap.hlinux/swapops.hlinux/pm.hlinux/fs.hlinux/compat.hlinux/console.hlinux/cpu.hlinux/freezer.hlinux/uaccess.hpower.h
Detected Declarations
struct compat_resume_swap_areafunction is_hibernate_resume_devfunction snapshot_openfunction snapshot_releasefunction snapshot_readfunction snapshot_writefunction snapshot_set_swap_areafunction snapshot_ioctlfunction snapshot_compat_ioctlfunction snapshot_device_initmodule init snapshot_device_init
Annotated Snippet
static const struct file_operations snapshot_fops = {
.open = snapshot_open,
.release = snapshot_release,
.read = snapshot_read,
.write = snapshot_write,
.unlocked_ioctl = snapshot_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = snapshot_compat_ioctl,
#endif
};
static struct miscdevice snapshot_device = {
.minor = SNAPSHOT_MINOR,
.name = "snapshot",
.fops = &snapshot_fops,
};
static int __init snapshot_device_init(void)
{
return misc_register(&snapshot_device);
};
device_initcall(snapshot_device_init);
Annotation
- Immediate include surface: `linux/suspend.h`, `linux/reboot.h`, `linux/string.h`, `linux/device.h`, `linux/miscdevice.h`, `linux/mm.h`, `linux/swap.h`, `linux/swapops.h`.
- Detected declarations: `struct compat_resume_swap_area`, `function is_hibernate_resume_dev`, `function snapshot_open`, `function snapshot_release`, `function snapshot_read`, `function snapshot_write`, `function snapshot_set_swap_area`, `function snapshot_ioctl`, `function snapshot_compat_ioctl`, `function snapshot_device_init`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.