Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
swap.c File Reference
#include <linux/module.h>
#include <linux/file.h>
#include <linux/delay.h>
#include <linux/bitops.h>
#include <linux/genhd.h>
#include <linux/device.h>
#include <linux/bio.h>
#include <linux/blkdev.h>
#include <linux/swap.h>
#include <linux/swapops.h>
#include <linux/pm.h>
#include <linux/slab.h>
#include <linux/lzo.h>
#include <linux/vmalloc.h>
#include <linux/cpumask.h>
#include <linux/atomic.h>
#include <linux/kthread.h>
#include <linux/crc32.h>
#include "power.h"

Go to the source code of this file.

Data Structures

struct  swap_map_page
 
struct  swap_map_page_list
 
struct  swap_map_handle
 
struct  swsusp_header
 
struct  swsusp_extent
 
struct  crc_data
 
struct  cmp_data
 
struct  dec_data
 

Macros

#define HIBERNATE_SIG   "S1SUSPEND"
 
#define MAP_PAGE_ENTRIES   (PAGE_SIZE / sizeof(sector_t) - 1)
 
#define LZO_HEADER   sizeof(size_t)
 
#define LZO_UNC_PAGES   32
 
#define LZO_UNC_SIZE   (LZO_UNC_PAGES * PAGE_SIZE)
 
#define LZO_CMP_PAGES
 
#define LZO_CMP_SIZE   (LZO_CMP_PAGES * PAGE_SIZE)
 
#define LZO_THREADS   3
 
#define LZO_MIN_RD_PAGES   1024
 
#define LZO_MAX_RD_PAGES   8192
 

Functions

struct swsusp_header __attribute__ ((packed))
 
sector_t alloc_swapdev_block (int swap)
 
void free_all_swap_pages (int swap)
 
int swsusp_swap_in_use (void)
 
int swsusp_write (unsigned int flags)
 
int swsusp_read (unsigned int *flags_p)
 
int swsusp_check (void)
 
void swsusp_close (fmode_t mode)
 
 core_initcall (swsusp_header_init)
 

Variables

char reserved [PAGE_SIZE-20-sizeof(sector_t)-sizeof(int)-sizeof(u32)]
 
u32 crc32
 
sector_t image
 
unsigned int flags
 
char orig_sig [10]
 
char sig [10]
 
struct swsusp_extent __attribute__
 
struct block_devicehib_resume_bdev
 

Macro Definition Documentation

#define HIBERNATE_SIG   "S1SUSPEND"

Definition at line 36 of file swap.c.

#define LZO_CMP_PAGES
Value:

Definition at line 423 of file swap.c.

#define LZO_CMP_SIZE   (LZO_CMP_PAGES * PAGE_SIZE)

Definition at line 425 of file swap.c.

#define LZO_HEADER   sizeof(size_t)

Definition at line 416 of file swap.c.

#define LZO_MAX_RD_PAGES   8192

Definition at line 432 of file swap.c.

#define LZO_MIN_RD_PAGES   1024

Definition at line 431 of file swap.c.

#define LZO_THREADS   3

Definition at line 428 of file swap.c.

#define LZO_UNC_PAGES   32

Definition at line 419 of file swap.c.

#define LZO_UNC_SIZE   (LZO_UNC_PAGES * PAGE_SIZE)

Definition at line 420 of file swap.c.

#define MAP_PAGE_ENTRIES   (PAGE_SIZE / sizeof(sector_t) - 1)

Definition at line 52 of file swap.c.

Function Documentation

struct swsusp_header __attribute__ ( (packed)  )
read

mcontroller : adapter info structure for old mimd_t apps

: base address : irq number : number of logical drives : pci bus : pci device : pci function : pci id : vendor id : slot number : unique id

Definition at line 171 of file esd_usb2.c.

sector_t alloc_swapdev_block ( int  swap)

alloc_swapdev_block - allocate a swap page and register that it has been allocated, so that it can be freed in case of an error.

Definition at line 167 of file swap.c.

core_initcall ( swsusp_header_init  )
void free_all_swap_pages ( int  swap)

free_all_swap_pages - free swap pages allocated for saving image data. It also frees the extents used to register which swap entries had been allocated.

Definition at line 187 of file swap.c.

int swsusp_check ( void  )

swsusp_check - Check for swsusp signature in the resume device

Definition at line 1423 of file swap.c.

void swsusp_close ( fmode_t  mode)

swsusp_close - close swap device.

Definition at line 1465 of file swap.c.

int swsusp_read ( unsigned int flags_p)

swsusp_read - read the hibernation image. : flags passed by the "frozen" kernel in the image header should be written into this memory location

Definition at line 1388 of file swap.c.

int swsusp_swap_in_use ( void  )

Definition at line 204 of file swap.c.

int swsusp_write ( unsigned int  flags)

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.)

Definition at line 813 of file swap.c.

Variable Documentation

u32 crc32

Definition at line 107 of file swap.c.

unsigned int flags

Definition at line 109 of file swap.c.

struct block_device* hib_resume_bdev

Definition at line 214 of file swap.c.

sector_t image

Definition at line 108 of file swap.c.

char orig_sig[10]

Definition at line 110 of file swap.c.

Definition at line 106 of file swap.c.

char sig[10]

Definition at line 111 of file swap.c.