Commit | Line | Data |
---|---|---|
6fa3eb70 S |
1 | /* |
2 | * kernel/power/tuxonice_bio.h | |
3 | * | |
4 | * Copyright (C) 2004-2010 Nigel Cunningham (nigel at tuxonice net) | |
5 | * | |
6 | * Distributed under GPLv2. | |
7 | * | |
8 | * This file contains declarations for functions exported from | |
9 | * tuxonice_bio.c, which contains low level io functions. | |
10 | */ | |
11 | ||
12 | #include <linux/buffer_head.h> | |
13 | #include "tuxonice_extent.h" | |
14 | ||
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); | |
18 | ||
19 | struct hibernate_extent_saved_state { | |
20 | int extent_num; | |
21 | struct hibernate_extent *extent_ptr; | |
22 | unsigned long offset; | |
23 | }; | |
24 | ||
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; | |
30 | int allocator_index; | |
31 | struct hibernate_extent_chain allocations; | |
32 | char name[266]; /* "swap on " or "file " + up to 256 chars */ | |
33 | ||
34 | /* Saved in header */ | |
35 | char uuid[17]; | |
36 | dev_t dev_t; | |
37 | int prio; | |
38 | int bmap_shift; | |
39 | int blocks_per_page; | |
40 | unsigned long pages_used; | |
41 | struct hibernate_extent_saved_state saved_state[4]; | |
42 | }; | |
43 | ||
44 | struct toi_extent_iterate_state { | |
45 | struct toi_bdev_info *current_chain; | |
46 | int num_chains; | |
47 | int saved_chain_number[4]; | |
48 | struct toi_bdev_info *saved_chain_ptr[4]; | |
49 | }; | |
50 | ||
51 | /* | |
52 | * Our exported interface so the swapwriter and filewriter don't | |
53 | * need these functions duplicated. | |
54 | */ | |
55 | struct toi_bio_ops { | |
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); | |
59 | }; | |
60 | ||
61 | struct toi_allocator_ops { | |
62 | unsigned long (*toi_swap_storage_available) (void); | |
63 | }; | |
64 | ||
65 | extern struct toi_bio_ops toi_bio_ops; | |
66 | ||
67 | extern char *toi_writer_buffer; | |
68 | extern int toi_writer_buffer_posn; | |
69 | ||
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 *); | |
76 | }; |