Linux Kernel
3.7.1
|
#include <linux/suspend.h>
#include <linux/suspend_ioctls.h>
#include <linux/utsname.h>
#include <linux/freezer.h>
Go to the source code of this file.
Data Structures | |
struct | swsusp_info |
struct | snapshot_handle |
Macros | |
#define | power_attr(_name) |
#define | data_of(handle) ((handle).buffer) |
#define | SF_PLATFORM_MODE 1 |
#define | SF_NOCOMPRESS_MODE 2 |
#define | SF_CRC32_MODE 4 |
#define | TEST_FIRST TEST_NONE |
#define | TEST_MAX (__TEST_AFTER_LAST - 1) |
Enumerations | |
enum | { TEST_NONE, TEST_CORE, TEST_CPUS, TEST_PLATFORM, TEST_DEVICES, TEST_FREEZER, __TEST_AFTER_LAST } |
Variables | |
struct new_utsname | uts |
u32 | version_code |
unsigned long | num_physpages |
int | cpus |
unsigned long | image_pages |
unsigned long | pages |
unsigned long | size |
unsigned long | image_size |
unsigned long | reserved_size |
int | in_suspend |
dev_t | swsusp_resume_device |
sector_t | swsusp_resume_block |
struct snapshot_handle | __attribute__ |
atomic_t | snapshot_device_available |
struct block_device * | hib_resume_bdev |
int | pm_test_level |
#define power_attr | ( | _name | ) |
#define TEST_MAX (__TEST_AFTER_LAST - 1) |
anonymous enum |
create_basic_memory_bitmaps - create bitmaps needed for marking page frames that should not be saved and free page frames. The pointers forbidden_pages_map and free_pages_map are only modified if everything goes well, because we don't want the bits to be used before both bitmaps are set up.
Definition at line 740 of file snapshot.c.
free_basic_memory_bitmaps - free memory bitmaps allocated by create_basic_memory_bitmaps(). The auxiliary pointers are necessary so that the bitmaps themselves are not referred to while they are being freed.
Definition at line 787 of file snapshot.c.
Definition at line 65 of file block_io.c.
Definition at line 71 of file block_io.c.
Definition at line 77 of file block_io.c.
hibernate_preallocate_memory - Preallocate memory for hibernation image
To create a hibernation image it is necessary to make a copy of every page frame in use. We also need a number of page frames to be free during hibernation for allocations made while saving the image and for device drivers, in case they need to allocate memory from their hibernation callbacks (these two numbers are given by PAGES_FOR_IO (which is a rough estimate) and reserverd_size divided by PAGE_SIZE (which is tunable through /sys/power/reserved_size, respectively). To make this happen, we compute the total number of available page frames and allocate at least
([page frames total] + PAGES_FOR_IO + [metadata pages]) / 2
of them, which corresponds to the maximum size of a hibernation image.
If image_size is set below the number following from the above formula, the preallocation of memory is continued until the total number of saveable pages in the system is below the requested image size or the minimum acceptable image size returned by minimum_image_size(), whichever is greater.
Definition at line 1305 of file snapshot.c.
Definition at line 1646 of file snapshot.c.
int snapshot_image_loaded | ( | struct snapshot_handle * | handle | ) |
Definition at line 2300 of file snapshot.c.
int snapshot_read_next | ( | struct snapshot_handle * | handle | ) |
snapshot_read_next - used for reading the system memory snapshot.
On the first call to it should point to a zeroed snapshot_handle structure. The structure gets updated and a pointer to it should be passed to this function every next time.
On success the function returns a positive number. Then, the caller is allowed to read up to the returned number of bytes from the memory location computed by the data_of() macro.
The function returns 0 to indicate the end of data stream condition, and a negative number is returned on error. In such cases the structure pointed to by is not updated and should not be used any more.
Definition at line 1698 of file snapshot.c.
void snapshot_write_finalize | ( | struct snapshot_handle * | handle | ) |
snapshot_write_finalize - must be called after the last call to snapshot_write_next() in case the last page in the image happens to be a highmem page and its contents should be stored in the highmem. Additionally, it releases the memory that will not be used any more.
Definition at line 2287 of file snapshot.c.
int snapshot_write_next | ( | struct snapshot_handle * | handle | ) |
snapshot_write_next - used for writing the system memory snapshot.
On the first call to it should point to a zeroed snapshot_handle structure. The structure gets updated and a pointer to it should be passed to this function every next time.
On success the function returns a positive number. Then, the caller is allowed to write up to the returned number of bytes to the memory location computed by the data_of() macro.
The function returns 0 to indicate the "end of file" condition, and a negative number is returned on error. In such cases the structure pointed to by is not updated and should not be used any more.
Definition at line 2213 of file snapshot.c.
asmlinkage int swsusp_arch_resume | ( | void | ) |
Definition at line 122 of file hibernate.c.
asmlinkage int swsusp_arch_suspend | ( | void | ) |
swsusp_free - free pages allocated for the suspend.
Suspend pages are alocated before the atomic copy is made, so we need to release them after the resume.
Definition at line 1089 of file snapshot.c.
void swsusp_show_speed | ( | struct timeval * | start, |
struct timeval * | stop, | ||
unsigned | nr_pages, | ||
char * | msg | ||
) |
swsusp_show_speed - Print time elapsed between two events during hibernation. : Starting event. : Final event. : Number of memory pages processed between and . : Additional diagnostic message to print.
Definition at line 227 of file hibernate.c.
swsusp_write - Write entire image and metadata. : flags to pass to the "boot" kernel in the image header
It is important NOT to umount filesystems at this point. We want them synced (in case something goes wrong) but we DO not want to mark filesystem clean: it is not. (And it does not matter, if we resume correctly, we'll mark system clean, anyway.)
struct block_device* hib_resume_bdev |
unsigned long image_size |
Definition at line 63 of file rbd_types.h.
int in_suspend |
int pm_test_level |
unsigned long reserved_size |
Definition at line 48 of file snapshot.c.
sector_t swsusp_resume_block |
Definition at line 41 of file hibernate.c.
dev_t swsusp_resume_device |
Definition at line 40 of file hibernate.c.
struct new_utsname uts |