• Home
  • Raw
  • Download

Lines Matching refs:handle

316 static int mark_swapfiles(struct swap_map_handle *handle, unsigned int flags)  in mark_swapfiles()  argument
326 swsusp_header->image = handle->first_sector; in mark_swapfiles()
329 swsusp_header->crc32 = handle->crc32; in mark_swapfiles()
410 static void release_swap_writer(struct swap_map_handle *handle) in release_swap_writer() argument
412 if (handle->cur) in release_swap_writer()
413 free_page((unsigned long)handle->cur); in release_swap_writer()
414 handle->cur = NULL; in release_swap_writer()
417 static int get_swap_writer(struct swap_map_handle *handle) in get_swap_writer() argument
427 handle->cur = (struct swap_map_page *)get_zeroed_page(GFP_KERNEL); in get_swap_writer()
428 if (!handle->cur) { in get_swap_writer()
432 handle->cur_swap = alloc_swapdev_block(root_swap); in get_swap_writer()
433 if (!handle->cur_swap) { in get_swap_writer()
437 handle->k = 0; in get_swap_writer()
438 handle->reqd_free_pages = reqd_free_pages(); in get_swap_writer()
439 handle->first_sector = handle->cur_swap; in get_swap_writer()
442 release_swap_writer(handle); in get_swap_writer()
448 static int swap_write_page(struct swap_map_handle *handle, void *buf, in swap_write_page() argument
454 if (!handle->cur) in swap_write_page()
460 handle->cur->entries[handle->k++] = offset; in swap_write_page()
461 if (handle->k >= MAP_PAGE_ENTRIES) { in swap_write_page()
465 handle->cur->next_swap = offset; in swap_write_page()
466 error = write_page(handle->cur, handle->cur_swap, hb); in swap_write_page()
469 clear_page(handle->cur); in swap_write_page()
470 handle->cur_swap = offset; in swap_write_page()
471 handle->k = 0; in swap_write_page()
473 if (hb && low_free_pages() <= handle->reqd_free_pages) { in swap_write_page()
481 handle->reqd_free_pages = reqd_free_pages(); in swap_write_page()
488 static int flush_swap_writer(struct swap_map_handle *handle) in flush_swap_writer() argument
490 if (handle->cur && handle->cur_swap) in flush_swap_writer()
491 return write_page(handle->cur, handle->cur_swap, NULL); in flush_swap_writer()
496 static int swap_writer_finish(struct swap_map_handle *handle, in swap_writer_finish() argument
501 error = mark_swapfiles(handle, flags); in swap_writer_finish()
503 flush_swap_writer(handle); in swap_writer_finish()
508 release_swap_writer(handle); in swap_writer_finish()
538 static int save_image(struct swap_map_handle *handle, in save_image() argument
563 ret = swap_write_page(handle, data_of(*snapshot), &hb); in save_image()
675 static int save_image_lzo(struct swap_map_handle *handle, in save_image_lzo() argument
749 handle->crc32 = 0; in save_image_lzo()
750 crc->crc32 = &handle->crc32; in save_image_lzo()
768 handle->reqd_free_pages = reqd_free_pages(); in save_image_lzo()
847 ret = swap_write_page(handle, page, &hb); in save_image_lzo()
913 struct swap_map_handle handle; in swsusp_write() local
920 error = get_swap_writer(&handle); in swsusp_write()
941 error = swap_write_page(&handle, header, NULL); in swsusp_write()
944 save_image(&handle, &snapshot, pages - 1) : in swsusp_write()
945 save_image_lzo(&handle, &snapshot, pages - 1); in swsusp_write()
948 error = swap_writer_finish(&handle, flags, error); in swsusp_write()
957 static void release_swap_reader(struct swap_map_handle *handle) in release_swap_reader() argument
961 while (handle->maps) { in release_swap_reader()
962 if (handle->maps->map) in release_swap_reader()
963 free_page((unsigned long)handle->maps->map); in release_swap_reader()
964 tmp = handle->maps; in release_swap_reader()
965 handle->maps = handle->maps->next; in release_swap_reader()
968 handle->cur = NULL; in release_swap_reader()
971 static int get_swap_reader(struct swap_map_handle *handle, in get_swap_reader() argument
983 handle->cur = NULL; in get_swap_reader()
984 last = handle->maps = NULL; in get_swap_reader()
987 tmp = kzalloc(sizeof(*handle->maps), GFP_KERNEL); in get_swap_reader()
989 release_swap_reader(handle); in get_swap_reader()
992 if (!handle->maps) in get_swap_reader()
993 handle->maps = tmp; in get_swap_reader()
1001 release_swap_reader(handle); in get_swap_reader()
1007 release_swap_reader(handle); in get_swap_reader()
1012 handle->k = 0; in get_swap_reader()
1013 handle->cur = handle->maps->map; in get_swap_reader()
1017 static int swap_read_page(struct swap_map_handle *handle, void *buf, in swap_read_page() argument
1024 if (!handle->cur) in swap_read_page()
1026 offset = handle->cur->entries[handle->k]; in swap_read_page()
1032 if (++handle->k >= MAP_PAGE_ENTRIES) { in swap_read_page()
1033 handle->k = 0; in swap_read_page()
1034 free_page((unsigned long)handle->maps->map); in swap_read_page()
1035 tmp = handle->maps; in swap_read_page()
1036 handle->maps = handle->maps->next; in swap_read_page()
1038 if (!handle->maps) in swap_read_page()
1039 release_swap_reader(handle); in swap_read_page()
1041 handle->cur = handle->maps->map; in swap_read_page()
1046 static int swap_reader_finish(struct swap_map_handle *handle) in swap_reader_finish() argument
1048 release_swap_reader(handle); in swap_reader_finish()
1059 static int load_image(struct swap_map_handle *handle, in load_image() argument
1084 ret = swap_read_page(handle, data_of(*snapshot), &hb); in load_image()
1165 static int load_image_lzo(struct swap_map_handle *handle, in load_image_lzo() argument
1244 handle->crc32 = 0; in load_image_lzo()
1245 crc->crc32 = &handle->crc32; in load_image_lzo()
1304 ret = swap_read_page(handle, page[ring], &hb); in load_image_lzo()
1310 if (handle->cur && in load_image_lzo()
1311 handle->cur->entries[handle->k]) { in load_image_lzo()
1452 if(handle->crc32 != swsusp_header->crc32) { in load_image_lzo()
1489 struct swap_map_handle handle; in swsusp_read() local
1498 error = get_swap_reader(&handle, flags_p); in swsusp_read()
1502 error = swap_read_page(&handle, header, NULL); in swsusp_read()
1505 load_image(&handle, &snapshot, header->pages - 1) : in swsusp_read()
1506 load_image_lzo(&handle, &snapshot, header->pages - 1); in swsusp_read()
1508 swap_reader_finish(&handle); in swsusp_read()