2 * kernel/power/tuxonice_bio.h
4 * Copyright (C) 2004-2010 Nigel Cunningham (nigel at tuxonice net)
6 * Distributed under GPLv2.
8 * This file contains declarations for functions exported from
9 * tuxonice_bio.c, which contains low level io functions.
12 #include <linux/buffer_head.h>
13 #include "tuxonice_extent.h"
15 void toi_put_extent_chain(struct hibernate_extent_chain
*chain
);
16 int toi_add_to_extent_chain(struct hibernate_extent_chain
*chain
,
17 unsigned long start
, unsigned long end
);
19 struct hibernate_extent_saved_state
{
21 struct hibernate_extent
*extent_ptr
;
25 struct toi_bdev_info
{
26 struct toi_bdev_info
*next
;
27 struct hibernate_extent_chain blocks
;
28 struct block_device
*bdev
;
29 struct toi_module_ops
*allocator
;
31 struct hibernate_extent_chain allocations
;
32 char name
[266]; /* "swap on " or "file " + up to 256 chars */
40 unsigned long pages_used
;
41 struct hibernate_extent_saved_state saved_state
[4];
44 struct toi_extent_iterate_state
{
45 struct toi_bdev_info
*current_chain
;
47 int saved_chain_number
[4];
48 struct toi_bdev_info
*saved_chain_ptr
[4];
52 * Our exported interface so the swapwriter and filewriter don't
53 * need these functions duplicated.
56 int (*bdev_page_io
) (int rw
, struct block_device
*bdev
, long pos
, struct page
*page
);
57 int (*register_storage
) (struct toi_bdev_info
*new);
58 void (*free_storage
) (void);
61 struct toi_allocator_ops
{
62 unsigned long (*toi_swap_storage_available
) (void);
65 extern struct toi_bio_ops toi_bio_ops
;
67 extern char *toi_writer_buffer
;
68 extern int toi_writer_buffer_posn
;
70 struct toi_bio_allocator_ops
{
71 int (*register_storage
) (void);
72 unsigned long (*storage_available
) (void);
73 int (*allocate_storage
) (struct toi_bdev_info
*, unsigned long);
74 int (*bmap
) (struct toi_bdev_info
*);
75 void (*free_storage
) (struct toi_bdev_info
*);