1
2
3
4
5
6
7
8
9
10 #ifndef _LINUX_DM_IO_H
11 #define _LINUX_DM_IO_H
12
13 #ifdef __KERNEL__
14
15 #include <linux/types.h>
16
17 struct dm_io_region {
18 struct block_device *bdev;
19 sector_t sector;
20 sector_t count;
21 };
22
23 struct page_list {
24 struct page_list *next;
25 struct page *page;
26 };
27
28 typedef void (*io_notify_fn)(unsigned long error, void *context);
29
30 enum dm_io_mem_type {
31 DM_IO_PAGE_LIST,
32 DM_IO_BIO,
33 DM_IO_VMA,
34 DM_IO_KMEM,
35 };
36
37 struct dm_io_memory {
38 enum dm_io_mem_type type;
39
40 unsigned offset;
41
42 union {
43 struct page_list *pl;
44 struct bio *bio;
45 void *vma;
46 void *addr;
47 } ptr;
48 };
49
50 struct dm_io_notify {
51 io_notify_fn fn;
52 void *context;
53 };
54
55
56
57
58 struct dm_io_client;
59 struct dm_io_request {
60 int bi_op;
61 int bi_op_flags;
62 struct dm_io_memory mem;
63 struct dm_io_notify notify;
64 struct dm_io_client *client;
65 };
66
67
68
69
70
71
72
73 struct dm_io_client *dm_io_client_create(void);
74 void dm_io_client_destroy(struct dm_io_client *client);
75
76
77
78
79
80
81 int dm_io(struct dm_io_request *io_req, unsigned num_regions,
82 struct dm_io_region *region, unsigned long *sync_error_bits);
83
84 #endif
85 #endif