diff options
author | Alasdair G Kergon <agk@redhat.com> | 2008-04-24 17:02:01 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2008-04-25 08:26:55 -0400 |
commit | a765e20eeb423d0fa6a02ffab51141e53bbd93cb (patch) | |
tree | fc7279fa73a21518373e1ba2efad27dab89a2214 /include/linux/dm-io.h | |
parent | 2d1e580afe23287871529ce54429e249809525a1 (diff) |
dm: move include files
Publish the dm-io, dm-log and dm-kcopyd headers in include/linux.
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'include/linux/dm-io.h')
-rw-r--r-- | include/linux/dm-io.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/include/linux/dm-io.h b/include/linux/dm-io.h new file mode 100644 index 000000000000..b6bf17ee2f61 --- /dev/null +++ b/include/linux/dm-io.h | |||
@@ -0,0 +1,85 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2003 Sistina Software | ||
3 | * Copyright (C) 2004 - 2008 Red Hat, Inc. All rights reserved. | ||
4 | * | ||
5 | * Device-Mapper low-level I/O. | ||
6 | * | ||
7 | * This file is released under the GPL. | ||
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; /* If this is zero the region is ignored. */ | ||
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,/* Page list */ | ||
32 | DM_IO_BVEC, /* Bio vector */ | ||
33 | DM_IO_VMA, /* Virtual memory area */ | ||
34 | DM_IO_KMEM, /* Kernel memory */ | ||
35 | }; | ||
36 | |||
37 | struct dm_io_memory { | ||
38 | enum dm_io_mem_type type; | ||
39 | |||
40 | union { | ||
41 | struct page_list *pl; | ||
42 | struct bio_vec *bvec; | ||
43 | void *vma; | ||
44 | void *addr; | ||
45 | } ptr; | ||
46 | |||
47 | unsigned offset; | ||
48 | }; | ||
49 | |||
50 | struct dm_io_notify { | ||
51 | io_notify_fn fn; /* Callback for asynchronous requests */ | ||
52 | void *context; /* Passed to callback */ | ||
53 | }; | ||
54 | |||
55 | /* | ||
56 | * IO request structure | ||
57 | */ | ||
58 | struct dm_io_client; | ||
59 | struct dm_io_request { | ||
60 | int bi_rw; /* READ|WRITE - not READA */ | ||
61 | struct dm_io_memory mem; /* Memory to use for io */ | ||
62 | struct dm_io_notify notify; /* Synchronous if notify.fn is NULL */ | ||
63 | struct dm_io_client *client; /* Client memory handler */ | ||
64 | }; | ||
65 | |||
66 | /* | ||
67 | * For async io calls, users can alternatively use the dm_io() function below | ||
68 | * and dm_io_client_create() to create private mempools for the client. | ||
69 | * | ||
70 | * Create/destroy may block. | ||
71 | */ | ||
72 | struct dm_io_client *dm_io_client_create(unsigned num_pages); | ||
73 | int dm_io_client_resize(unsigned num_pages, struct dm_io_client *client); | ||
74 | void dm_io_client_destroy(struct dm_io_client *client); | ||
75 | |||
76 | /* | ||
77 | * IO interface using private per-client pools. | ||
78 | * Each bit in the optional 'sync_error_bits' bitset indicates whether an | ||
79 | * error occurred doing io to the corresponding region. | ||
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 /* __KERNEL__ */ | ||
85 | #endif /* _LINUX_DM_IO_H */ | ||