Hibernation: Introduce SNAPSHOT_GET_IMAGE_SIZE ioctl
Add a new ioctl, SNAPSHOT_GET_IMAGE_SIZE, returning the size of the (just created) hibernation image, to the hibernation userland interface. This ioctl is necessary so that the userland utilities using the interface need not access the hibernation image header, owned by the kernel, in order to obtain the size of the image. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:

committed by
Len Brown

parent
aa62999269
commit
af508b34d2
@@ -1264,12 +1264,17 @@ static char *check_image_kernel(struct swsusp_info *info)
|
||||
}
|
||||
#endif /* CONFIG_ARCH_HIBERNATION_HEADER */
|
||||
|
||||
unsigned long snapshot_get_image_size(void)
|
||||
{
|
||||
return nr_copy_pages + nr_meta_pages + 1;
|
||||
}
|
||||
|
||||
static int init_header(struct swsusp_info *info)
|
||||
{
|
||||
memset(info, 0, sizeof(struct swsusp_info));
|
||||
info->num_physpages = num_physpages;
|
||||
info->image_pages = nr_copy_pages;
|
||||
info->pages = nr_copy_pages + nr_meta_pages + 1;
|
||||
info->pages = snapshot_get_image_size();
|
||||
info->size = info->pages;
|
||||
info->size <<= PAGE_SHIFT;
|
||||
return init_header_complete(info);
|
||||
|
Reference in New Issue
Block a user