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.h36
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
13struct dm_target; 14struct dm_target;
14struct dm_table; 15struct dm_table;
15struct dm_dev;
16struct mapped_device; 16struct mapped_device;
17struct bio_vec;
17 18
18typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t; 19typedef 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
69typedef 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);
70 71
71typedef int (*dm_ioctl_fn) (struct dm_target *ti, struct inode *inode, 72typedef 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
75typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm,
76 struct bio_vec *biovec, int max_size);
77
75void dm_error(const char *message); 78void dm_error(const char *message);
76 79
77/* 80/*
@@ -79,13 +82,19 @@ void dm_error(const char *message);
79 */ 82 */
80void 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);
81 84
85struct 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 */
87int 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,
88 sector_t len, int mode, struct dm_dev **result); 97 sector_t len, fmode_t mode, struct dm_dev **result);
89void dm_put_device(struct dm_target *ti, struct dm_dev *d); 98void 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
112struct io_restrictions { 122struct io_restrictions {
@@ -196,6 +206,7 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid);
196struct gendisk *dm_disk(struct mapped_device *md); 206struct gendisk *dm_disk(struct mapped_device *md);
197int dm_suspended(struct mapped_device *md); 207int dm_suspended(struct mapped_device *md);
198int dm_noflush_suspending(struct dm_target *ti); 208int dm_noflush_suspending(struct dm_target *ti);
209union 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 */
214int dm_table_create(struct dm_table **result, int mode, 225int 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,
226int dm_table_complete(struct dm_table *t); 237int dm_table_complete(struct dm_table *t);
227 238
228/* 239/*
240 * Unplug all devices in a table.
241 */
242void dm_table_unplug_all(struct dm_table *t);
243
244/*
229 * Table reference counting. 245 * Table reference counting.
230 */ 246 */
231struct dm_table *dm_get_table(struct mapped_device *md); 247struct dm_table *dm_get_table(struct mapped_device *md);
@@ -237,7 +253,7 @@ void dm_table_put(struct dm_table *t);
237 */ 253 */
238sector_t dm_table_get_size(struct dm_table *t); 254sector_t dm_table_get_size(struct dm_table *t);
239unsigned int dm_table_get_num_targets(struct dm_table *t); 255unsigned int dm_table_get_num_targets(struct dm_table *t);
240int dm_table_get_mode(struct dm_table *t); 256fmode_t dm_table_get_mode(struct dm_table *t);
241struct mapped_device *dm_table_get_md(struct dm_table *t); 257struct 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 */
251int dm_swap_table(struct mapped_device *md, struct dm_table *t); 267int dm_swap_table(struct mapped_device *md, struct dm_table *t);
252 268
269/*
270 * A wrapper around vmalloc.
271 */
272void *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
335static inline sector_t to_sector(unsigned long n) 359static inline sector_t to_sector(unsigned long n)
336{ 360{
337 return (n >> SECTOR_SHIFT); 361 return (n >> SECTOR_SHIFT);