aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/device-mapper.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/device-mapper.h')
-rw-r--r--include/linux/device-mapper.h30
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
14struct dm_target; 14struct dm_target;
15struct dm_table; 15struct dm_table;
16struct dm_dev;
17struct mapped_device; 16struct mapped_device;
18struct bio_vec; 17struct bio_vec;
19 18
@@ -70,8 +69,7 @@ typedef int (*dm_status_fn) (struct dm_target *ti, status_type_t status_type,
70 69
71typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv); 70typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv);
72 71
73typedef int (*dm_ioctl_fn) (struct dm_target *ti, struct inode *inode, 72typedef 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
77typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, 75typedef 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 */
85void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev); 83void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev);
86 84
85struct 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 */
92int dm_get_device(struct dm_target *ti, const char *path, sector_t start, 96int 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);
94void dm_put_device(struct dm_target *ti, struct dm_dev *d); 98void 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);
202struct gendisk *dm_disk(struct mapped_device *md); 206struct gendisk *dm_disk(struct mapped_device *md);
203int dm_suspended(struct mapped_device *md); 207int dm_suspended(struct mapped_device *md);
204int dm_noflush_suspending(struct dm_target *ti); 208int dm_noflush_suspending(struct dm_target *ti);
209union 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 */
220int dm_table_create(struct dm_table **result, int mode, 225int 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,
232int dm_table_complete(struct dm_table *t); 237int dm_table_complete(struct dm_table *t);
233 238
234/* 239/*
240 * Unplug all devices in a table.
241 */
242void dm_table_unplug_all(struct dm_table *t);
243
244/*
235 * Table reference counting. 245 * Table reference counting.
236 */ 246 */
237struct dm_table *dm_get_table(struct mapped_device *md); 247struct dm_table *dm_get_table(struct mapped_device *md);
@@ -243,7 +253,7 @@ void dm_table_put(struct dm_table *t);
243 */ 253 */
244sector_t dm_table_get_size(struct dm_table *t); 254sector_t dm_table_get_size(struct dm_table *t);
245unsigned int dm_table_get_num_targets(struct dm_table *t); 255unsigned int dm_table_get_num_targets(struct dm_table *t);
246int dm_table_get_mode(struct dm_table *t); 256fmode_t dm_table_get_mode(struct dm_table *t);
247struct mapped_device *dm_table_get_md(struct dm_table *t); 257struct 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 */
257int dm_swap_table(struct mapped_device *md, struct dm_table *t); 267int dm_swap_table(struct mapped_device *md, struct dm_table *t);
258 268
269/*
270 * A wrapper around vmalloc.
271 */
272void *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
341static inline sector_t to_sector(unsigned long n) 359static inline sector_t to_sector(unsigned long n)
342{ 360{
343 return (n >> SECTOR_SHIFT); 361 return (n >> SECTOR_SHIFT);