diff options
Diffstat (limited to 'include/linux/device-mapper.h')
-rw-r--r-- | include/linux/device-mapper.h | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index 0d8d419d191a..c17fd334e574 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
@@ -9,11 +9,12 @@ | |||
9 | #define _LINUX_DEVICE_MAPPER_H | 9 | #define _LINUX_DEVICE_MAPPER_H |
10 | 10 | ||
11 | #include <linux/bio.h> | 11 | #include <linux/bio.h> |
12 | #include <linux/blkdev.h> | ||
12 | 13 | ||
13 | struct dm_target; | 14 | struct dm_target; |
14 | struct dm_table; | 15 | struct dm_table; |
15 | struct dm_dev; | ||
16 | struct mapped_device; | 16 | struct mapped_device; |
17 | struct bio_vec; | ||
17 | 18 | ||
18 | typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t; | 19 | typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t; |
19 | 20 | ||
@@ -68,10 +69,12 @@ typedef int (*dm_status_fn) (struct dm_target *ti, status_type_t status_type, | |||
68 | 69 | ||
69 | typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv); | 70 | typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv); |
70 | 71 | ||
71 | typedef int (*dm_ioctl_fn) (struct dm_target *ti, struct inode *inode, | 72 | typedef int (*dm_ioctl_fn) (struct dm_target *ti, unsigned int cmd, |
72 | struct file *filp, unsigned int cmd, | ||
73 | unsigned long arg); | 73 | unsigned long arg); |
74 | 74 | ||
75 | typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, | ||
76 | struct bio_vec *biovec, int max_size); | ||
77 | |||
75 | void dm_error(const char *message); | 78 | void dm_error(const char *message); |
76 | 79 | ||
77 | /* | 80 | /* |
@@ -79,13 +82,19 @@ void dm_error(const char *message); | |||
79 | */ | 82 | */ |
80 | void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev); | 83 | void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev); |
81 | 84 | ||
85 | struct dm_dev { | ||
86 | struct block_device *bdev; | ||
87 | fmode_t mode; | ||
88 | char name[16]; | ||
89 | }; | ||
90 | |||
82 | /* | 91 | /* |
83 | * Constructors should call these functions to ensure destination devices | 92 | * Constructors should call these functions to ensure destination devices |
84 | * are opened/closed correctly. | 93 | * are opened/closed correctly. |
85 | * FIXME: too many arguments. | 94 | * FIXME: too many arguments. |
86 | */ | 95 | */ |
87 | int dm_get_device(struct dm_target *ti, const char *path, sector_t start, | 96 | int dm_get_device(struct dm_target *ti, const char *path, sector_t start, |
88 | sector_t len, int mode, struct dm_dev **result); | 97 | sector_t len, fmode_t mode, struct dm_dev **result); |
89 | void dm_put_device(struct dm_target *ti, struct dm_dev *d); | 98 | void dm_put_device(struct dm_target *ti, struct dm_dev *d); |
90 | 99 | ||
91 | /* | 100 | /* |
@@ -107,6 +116,7 @@ struct target_type { | |||
107 | dm_status_fn status; | 116 | dm_status_fn status; |
108 | dm_message_fn message; | 117 | dm_message_fn message; |
109 | dm_ioctl_fn ioctl; | 118 | dm_ioctl_fn ioctl; |
119 | dm_merge_fn merge; | ||
110 | }; | 120 | }; |
111 | 121 | ||
112 | struct io_restrictions { | 122 | struct io_restrictions { |
@@ -196,6 +206,7 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid); | |||
196 | struct gendisk *dm_disk(struct mapped_device *md); | 206 | struct gendisk *dm_disk(struct mapped_device *md); |
197 | int dm_suspended(struct mapped_device *md); | 207 | int dm_suspended(struct mapped_device *md); |
198 | int dm_noflush_suspending(struct dm_target *ti); | 208 | int dm_noflush_suspending(struct dm_target *ti); |
209 | union map_info *dm_get_mapinfo(struct bio *bio); | ||
199 | 210 | ||
200 | /* | 211 | /* |
201 | * Geometry functions. | 212 | * Geometry functions. |
@@ -211,7 +222,7 @@ int dm_set_geometry(struct mapped_device *md, struct hd_geometry *geo); | |||
211 | /* | 222 | /* |
212 | * First create an empty table. | 223 | * First create an empty table. |
213 | */ | 224 | */ |
214 | int dm_table_create(struct dm_table **result, int mode, | 225 | int dm_table_create(struct dm_table **result, fmode_t mode, |
215 | unsigned num_targets, struct mapped_device *md); | 226 | unsigned num_targets, struct mapped_device *md); |
216 | 227 | ||
217 | /* | 228 | /* |
@@ -226,6 +237,11 @@ int dm_table_add_target(struct dm_table *t, const char *type, | |||
226 | int dm_table_complete(struct dm_table *t); | 237 | int dm_table_complete(struct dm_table *t); |
227 | 238 | ||
228 | /* | 239 | /* |
240 | * Unplug all devices in a table. | ||
241 | */ | ||
242 | void dm_table_unplug_all(struct dm_table *t); | ||
243 | |||
244 | /* | ||
229 | * Table reference counting. | 245 | * Table reference counting. |
230 | */ | 246 | */ |
231 | struct dm_table *dm_get_table(struct mapped_device *md); | 247 | struct dm_table *dm_get_table(struct mapped_device *md); |
@@ -237,7 +253,7 @@ void dm_table_put(struct dm_table *t); | |||
237 | */ | 253 | */ |
238 | sector_t dm_table_get_size(struct dm_table *t); | 254 | sector_t dm_table_get_size(struct dm_table *t); |
239 | unsigned int dm_table_get_num_targets(struct dm_table *t); | 255 | unsigned int dm_table_get_num_targets(struct dm_table *t); |
240 | int dm_table_get_mode(struct dm_table *t); | 256 | fmode_t dm_table_get_mode(struct dm_table *t); |
241 | struct mapped_device *dm_table_get_md(struct dm_table *t); | 257 | struct mapped_device *dm_table_get_md(struct dm_table *t); |
242 | 258 | ||
243 | /* | 259 | /* |
@@ -250,6 +266,11 @@ void dm_table_event(struct dm_table *t); | |||
250 | */ | 266 | */ |
251 | int dm_swap_table(struct mapped_device *md, struct dm_table *t); | 267 | int dm_swap_table(struct mapped_device *md, struct dm_table *t); |
252 | 268 | ||
269 | /* | ||
270 | * A wrapper around vmalloc. | ||
271 | */ | ||
272 | void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size); | ||
273 | |||
253 | /*----------------------------------------------------------------- | 274 | /*----------------------------------------------------------------- |
254 | * Macros. | 275 | * Macros. |
255 | *---------------------------------------------------------------*/ | 276 | *---------------------------------------------------------------*/ |
@@ -332,6 +353,9 @@ int dm_swap_table(struct mapped_device *md, struct dm_table *t); | |||
332 | */ | 353 | */ |
333 | #define dm_round_up(n, sz) (dm_div_up((n), (sz)) * (sz)) | 354 | #define dm_round_up(n, sz) (dm_div_up((n), (sz)) * (sz)) |
334 | 355 | ||
356 | #define dm_array_too_big(fixed, obj, num) \ | ||
357 | ((num) > (UINT_MAX - (fixed)) / (obj)) | ||
358 | |||
335 | static inline sector_t to_sector(unsigned long n) | 359 | static inline sector_t to_sector(unsigned long n) |
336 | { | 360 | { |
337 | return (n >> SECTOR_SHIFT); | 361 | return (n >> SECTOR_SHIFT); |