diff options
Diffstat (limited to 'include/linux/device-mapper.h')
-rw-r--r-- | include/linux/device-mapper.h | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index a90222e3297d..c17fd334e574 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
@@ -13,7 +13,6 @@ | |||
13 | 13 | ||
14 | struct dm_target; | 14 | struct dm_target; |
15 | struct dm_table; | 15 | struct dm_table; |
16 | struct dm_dev; | ||
17 | struct mapped_device; | 16 | struct mapped_device; |
18 | struct bio_vec; | 17 | struct bio_vec; |
19 | 18 | ||
@@ -70,8 +69,7 @@ typedef int (*dm_status_fn) (struct dm_target *ti, status_type_t status_type, | |||
70 | 69 | ||
71 | 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); |
72 | 71 | ||
73 | 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, |
74 | struct file *filp, unsigned int cmd, | ||
75 | unsigned long arg); | 73 | unsigned long arg); |
76 | 74 | ||
77 | typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, | 75 | typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, |
@@ -84,13 +82,19 @@ void dm_error(const char *message); | |||
84 | */ | 82 | */ |
85 | 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); |
86 | 84 | ||
85 | struct dm_dev { | ||
86 | struct block_device *bdev; | ||
87 | fmode_t mode; | ||
88 | char name[16]; | ||
89 | }; | ||
90 | |||
87 | /* | 91 | /* |
88 | * Constructors should call these functions to ensure destination devices | 92 | * Constructors should call these functions to ensure destination devices |
89 | * are opened/closed correctly. | 93 | * are opened/closed correctly. |
90 | * FIXME: too many arguments. | 94 | * FIXME: too many arguments. |
91 | */ | 95 | */ |
92 | 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, |
93 | sector_t len, int mode, struct dm_dev **result); | 97 | sector_t len, fmode_t mode, struct dm_dev **result); |
94 | 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); |
95 | 99 | ||
96 | /* | 100 | /* |
@@ -202,6 +206,7 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid); | |||
202 | struct gendisk *dm_disk(struct mapped_device *md); | 206 | struct gendisk *dm_disk(struct mapped_device *md); |
203 | int dm_suspended(struct mapped_device *md); | 207 | int dm_suspended(struct mapped_device *md); |
204 | 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); | ||
205 | 210 | ||
206 | /* | 211 | /* |
207 | * Geometry functions. | 212 | * Geometry functions. |
@@ -217,7 +222,7 @@ int dm_set_geometry(struct mapped_device *md, struct hd_geometry *geo); | |||
217 | /* | 222 | /* |
218 | * First create an empty table. | 223 | * First create an empty table. |
219 | */ | 224 | */ |
220 | int dm_table_create(struct dm_table **result, int mode, | 225 | int dm_table_create(struct dm_table **result, fmode_t mode, |
221 | unsigned num_targets, struct mapped_device *md); | 226 | unsigned num_targets, struct mapped_device *md); |
222 | 227 | ||
223 | /* | 228 | /* |
@@ -232,6 +237,11 @@ int dm_table_add_target(struct dm_table *t, const char *type, | |||
232 | int dm_table_complete(struct dm_table *t); | 237 | int dm_table_complete(struct dm_table *t); |
233 | 238 | ||
234 | /* | 239 | /* |
240 | * Unplug all devices in a table. | ||
241 | */ | ||
242 | void dm_table_unplug_all(struct dm_table *t); | ||
243 | |||
244 | /* | ||
235 | * Table reference counting. | 245 | * Table reference counting. |
236 | */ | 246 | */ |
237 | struct dm_table *dm_get_table(struct mapped_device *md); | 247 | struct dm_table *dm_get_table(struct mapped_device *md); |
@@ -243,7 +253,7 @@ void dm_table_put(struct dm_table *t); | |||
243 | */ | 253 | */ |
244 | sector_t dm_table_get_size(struct dm_table *t); | 254 | sector_t dm_table_get_size(struct dm_table *t); |
245 | unsigned int dm_table_get_num_targets(struct dm_table *t); | 255 | unsigned int dm_table_get_num_targets(struct dm_table *t); |
246 | int dm_table_get_mode(struct dm_table *t); | 256 | fmode_t dm_table_get_mode(struct dm_table *t); |
247 | struct mapped_device *dm_table_get_md(struct dm_table *t); | 257 | struct mapped_device *dm_table_get_md(struct dm_table *t); |
248 | 258 | ||
249 | /* | 259 | /* |
@@ -256,6 +266,11 @@ void dm_table_event(struct dm_table *t); | |||
256 | */ | 266 | */ |
257 | 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); |
258 | 268 | ||
269 | /* | ||
270 | * A wrapper around vmalloc. | ||
271 | */ | ||
272 | void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size); | ||
273 | |||
259 | /*----------------------------------------------------------------- | 274 | /*----------------------------------------------------------------- |
260 | * Macros. | 275 | * Macros. |
261 | *---------------------------------------------------------------*/ | 276 | *---------------------------------------------------------------*/ |
@@ -338,6 +353,9 @@ int dm_swap_table(struct mapped_device *md, struct dm_table *t); | |||
338 | */ | 353 | */ |
339 | #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)) |
340 | 355 | ||
356 | #define dm_array_too_big(fixed, obj, num) \ | ||
357 | ((num) > (UINT_MAX - (fixed)) / (obj)) | ||
358 | |||
341 | static inline sector_t to_sector(unsigned long n) | 359 | static inline sector_t to_sector(unsigned long n) |
342 | { | 360 | { |
343 | return (n >> SECTOR_SHIFT); | 361 | return (n >> SECTOR_SHIFT); |