kernel/power/power.h
Source file repositories/reference/linux-study-clean/kernel/power/power.h
File Facts
- System
- Linux kernel
- Corpus path
kernel/power/power.h- Extension
.h- Size
- 9993 bytes
- Lines
- 355
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/suspend.hlinux/suspend_ioctls.hlinux/utsname.hlinux/freezer.hlinux/compiler.hlinux/cpu.hlinux/cpuidle.hlinux/crypto.h
Detected Declarations
struct swsusp_infostruct snapshot_handlestruct __kernel_old_timevalfunction init_header_completefunction enable_restore_image_protectionfunction hibernate_reserved_size_initfunction swsusp_unmarkfunction suspend_devices_and_enterfunction suspend_test_startfunction count_highmem_pagesfunction restore_highmemfunction suspend_freeze_processesfunction suspend_thaw_processesfunction suspend_freeze_processesfunction suspend_thaw_processesfunction pm_autosleep_initfunction pm_autosleep_lockfunction pm_autosleep_unlockfunction pm_sleep_disable_secondary_cpusfunction pm_sleep_enable_secondary_cpus
Annotated Snippet
struct swsusp_info {
struct new_utsname uts;
u32 version_code;
unsigned long num_physpages;
int cpus;
unsigned long image_pages;
unsigned long pages;
unsigned long size;
} __aligned(PAGE_SIZE);
#if defined(CONFIG_SUSPEND) || defined(CONFIG_HIBERNATION)
extern int pm_sleep_fs_sync(void);
extern bool filesystem_freeze_enabled;
#endif
#ifdef CONFIG_HIBERNATION
/* kernel/power/snapshot.c */
extern void __init hibernate_reserved_size_init(void);
extern void __init hibernate_image_size_init(void);
#ifdef CONFIG_ARCH_HIBERNATION_HEADER
/* Maximum size of architecture specific data in a hibernation header */
#define MAX_ARCH_HEADER_SIZE (sizeof(struct new_utsname) + 4)
static inline int init_header_complete(struct swsusp_info *info)
{
return arch_hibernation_header_save(info, MAX_ARCH_HEADER_SIZE);
}
static inline const char *check_image_kernel(struct swsusp_info *info)
{
return arch_hibernation_header_restore(info) ?
"architecture specific data" : NULL;
}
#endif /* CONFIG_ARCH_HIBERNATION_HEADER */
/*
* Keep some memory free so that I/O operations can succeed without paging
* [Might this be more than 4 MB?]
*/
#define PAGES_FOR_IO ((4096 * 1024) >> PAGE_SHIFT)
/*
* Keep 1 MB of memory free so that device drivers can allocate some pages in
* their .suspend() routines without breaking the suspend to disk.
*/
#define SPARE_PAGES ((1024 * 1024) >> PAGE_SHIFT)
asmlinkage int swsusp_save(void);
/* kernel/power/hibernate.c */
extern bool freezer_test_done;
extern char hib_comp_algo[CRYPTO_MAX_ALG_NAME];
/* kernel/power/swap.c */
extern unsigned int swsusp_header_flags;
extern int hibernation_snapshot(int platform_mode);
extern int hibernation_restore(int platform_mode);
extern int hibernation_platform_enter(void);
#ifdef CONFIG_STRICT_KERNEL_RWX
/* kernel/power/snapshot.c */
extern void enable_restore_image_protection(void);
#else
static inline void enable_restore_image_protection(void) {}
#endif /* CONFIG_STRICT_KERNEL_RWX */
extern bool hibernation_in_progress(void);
#else /* !CONFIG_HIBERNATION */
static inline void hibernate_reserved_size_init(void) {}
static inline void hibernate_image_size_init(void) {}
static inline bool hibernation_in_progress(void) { return false; }
#endif /* !CONFIG_HIBERNATION */
#define power_attr(_name) \
static struct kobj_attribute _name##_attr = { \
.attr = { \
.name = __stringify(_name), \
.mode = 0644, \
}, \
.show = _name##_show, \
.store = _name##_store, \
}
#define power_attr_ro(_name) \
static struct kobj_attribute _name##_attr = { \
Annotation
- Immediate include surface: `linux/suspend.h`, `linux/suspend_ioctls.h`, `linux/utsname.h`, `linux/freezer.h`, `linux/compiler.h`, `linux/cpu.h`, `linux/cpuidle.h`, `linux/crypto.h`.
- Detected declarations: `struct swsusp_info`, `struct snapshot_handle`, `struct __kernel_old_timeval`, `function init_header_complete`, `function enable_restore_image_protection`, `function hibernate_reserved_size_init`, `function swsusp_unmark`, `function suspend_devices_and_enter`, `function suspend_test_start`, `function count_highmem_pages`.
- 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.