Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\power\snapshot.c Create Date:2022-07-28 10:01:36
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:snapshot_write_next - Get the address to store the next image page.*@handle: Snapshot handle structure to guide the writing.* On the first call, @handle should point to a zeroed snapshot_handle* structure

Proto:int snapshot_write_next(struct snapshot_handle *handle)

Type:int

Parameter:

TypeParameterName
struct snapshot_handle *handle
2594  error = 0
2597  If umber of the block of PAGE_SIZE bytes the* next operation will refer to (ie. current) > 1 && umber of the block of PAGE_SIZE bytes the* next operation will refer to (ie. current) > Number of pages needed for saving the original pfns of the image pages + Total number of image pages Then Return 0
2600  Set to one to notify the caller of* snapshot_write_next() that it may* need to call wait_on_bio_chain() = 1
2602  If Not umber of the block of PAGE_SIZE bytes the* next operation will refer to (ie. current) Then
2603  If Not Pointer to an auxiliary buffer (1 page) Then Pointer to an auxiliary buffer (1 page) = get_image_page - Allocate a page for a hibernation image
2607  If Not Pointer to an auxiliary buffer (1 page) Then Return -ENOMEM
2610  address of the block to read from* or write to = Pointer to an auxiliary buffer (1 page)
2611  Else if umber of the block of PAGE_SIZE bytes the* next operation will refer to (ie. current) == 1 Then
2612  error = load header - Check the image header and copy the data from it.
2613  If error Then Return error
2616  List of "safe" pages (ie. pages that were not used by the image kernel* before hibernation) that may be used as temporary storage for image kernel* memory contents. = NULL
2618  error = memory_bm_create - Allocate memory for a memory bitmap.
2619  If error Then Return error
2623  error = page_key_alloc(Total number of image pages )
2624  If error Then Return error
2627  hibernate_restore_protection_begin()
2628  Else if umber of the block of PAGE_SIZE bytes the* next operation will refer to (ie. current) <= Number of pages needed for saving the original pfns of the image pages + 1 Then
2629  error = pack_orig_pfns - Set bits corresponding to given PFNs in a memory bitmap.*@bm: Memory bitmap.*@buf: Area of memory containing the PFNs.* For each element of the array pointed to by @buf (1 page at a time), set the* corresponding bit in @bm.
2630  If error Then Return error
2635  If error Then Return error
2646  Else
2647  copy_last_highmem_page()
2649  page_key_write(address of the block to read from* or write to)
2650  hibernate_restore_protect_page(address of the block to read from* or write to)
2651  address of the block to read from* or write to = get_buffer - Get the address to store the next image data page.* Get the address that snapshot_write_next() should return to its caller to* write to.
2652  If IS_ERR(address of the block to read from* or write to) Then Return PTR_ERR(address of the block to read from* or write to)
2654  If address of the block to read from* or write to != Pointer to an auxiliary buffer (1 page) Then Set to one to notify the caller of* snapshot_write_next() that it may* need to call wait_on_bio_chain() = 0
2657  umber of the block of PAGE_SIZE bytes the* next operation will refer to (ie. current)++
2658  Return PAGE_SIZE
Caller
NameDescribe
load_imageload_image - load the image using the swap map handle*@handle and the snapshot handle @snapshot* (assume there are @nr_pages pages to load)
load_image_lzoload_image_lzo - Load compressed image data and decompress them with LZO.*@handle: Swap map handle to use for loading data.*@snapshot: Image to copy uncompressed data into.*@nr_to_read: Number of pages to load.
swsusp_readswsusp_read - read the hibernation image.*@flags_p: flags passed by the "frozen" kernel in the image header should* be written into this memory location
snapshot_write