Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
device-mapper.h File Reference
#include <linux/bio.h>
#include <linux/blkdev.h>
#include <linux/ratelimit.h>

Go to the source code of this file.

Data Structures

struct  map_info
 
struct  dm_dev
 
struct  target_type
 
struct  dm_target
 
struct  dm_target_callbacks
 
struct  dm_arg_set
 
struct  dm_arg
 

Macros

#define DM_TARGET_SINGLETON   0x00000001
 
#define dm_target_needs_singleton(type)   ((type)->features & DM_TARGET_SINGLETON)
 
#define DM_TARGET_ALWAYS_WRITEABLE   0x00000002
 
#define dm_target_always_writeable(type)   ((type)->features & DM_TARGET_ALWAYS_WRITEABLE)
 
#define DM_TARGET_IMMUTABLE   0x00000004
 
#define dm_target_is_immutable(type)   ((type)->features & DM_TARGET_IMMUTABLE)
 
#define DM_ANY_MINOR   (-1)
 
#define DM_NAME   "device-mapper"
 
#define dm_ratelimit()   0
 
#define DMCRIT(f, arg...)   printk(KERN_CRIT DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
 
#define DMERR(f, arg...)   printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
 
#define DMERR_LIMIT(f, arg...)
 
#define DMWARN(f, arg...)   printk(KERN_WARNING DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
 
#define DMWARN_LIMIT(f, arg...)
 
#define DMINFO(f, arg...)   printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
 
#define DMINFO_LIMIT(f, arg...)
 
#define DMDEBUG(f, arg...)   do {} while (0)
 
#define DMDEBUG_LIMIT(f, arg...)   do {} while (0)
 
#define DMEMIT(x...)
 
#define SECTOR_SHIFT   9
 
#define DM_ENDIO_INCOMPLETE   1
 
#define DM_ENDIO_REQUEUE   2
 
#define DM_MAPIO_SUBMITTED   0
 
#define DM_MAPIO_REMAPPED   1
 
#define DM_MAPIO_REQUEUE   DM_ENDIO_REQUEUE
 
#define dm_div_up(n, sz)   (((n) + (sz) - 1) / (sz))
 
#define dm_sector_div_up(n, sz)
 
#define dm_round_up(n, sz)   (dm_div_up((n), (sz)) * (sz))
 
#define dm_array_too_big(fixed, obj, num)   ((num) > (UINT_MAX - (fixed)) / (obj))
 
#define dm_target_offset(ti, sector)   ((sector) - (ti)->begin)
 

Typedefs

typedef int(* dm_ctr_fn )(struct dm_target *target, unsigned int argc, char **argv)
 
typedef void(* dm_dtr_fn )(struct dm_target *ti)
 
typedef int(* dm_map_fn )(struct dm_target *ti, struct bio *bio, union map_info *map_context)
 
typedef int(* dm_map_request_fn )(struct dm_target *ti, struct request *clone, union map_info *map_context)
 
typedef int(* dm_endio_fn )(struct dm_target *ti, struct bio *bio, int error, union map_info *map_context)
 
typedef int(* dm_request_endio_fn )(struct dm_target *ti, struct request *clone, int error, union map_info *map_context)
 
typedef void(* dm_presuspend_fn )(struct dm_target *ti)
 
typedef void(* dm_postsuspend_fn )(struct dm_target *ti)
 
typedef int(* dm_preresume_fn )(struct dm_target *ti)
 
typedef void(* dm_resume_fn )(struct dm_target *ti)
 
typedef int(* dm_status_fn )(struct dm_target *ti, status_type_t status_type, unsigned status_flags, char *result, unsigned maxlen)
 
typedef int(* dm_message_fn )(struct dm_target *ti, unsigned argc, char **argv)
 
typedef int(* dm_ioctl_fn )(struct dm_target *ti, unsigned int cmd, unsigned long arg)
 
typedef int(* dm_merge_fn )(struct dm_target *ti, struct bvec_merge_data *bvm, struct bio_vec *biovec, int max_size)
 
typedef int(* iterate_devices_callout_fn )(struct dm_target *ti, struct dm_dev *dev, sector_t start, sector_t len, void *data)
 
typedef int(* dm_iterate_devices_fn )(struct dm_target *ti, iterate_devices_callout_fn fn, void *data)
 
typedef void(* dm_io_hints_fn )(struct dm_target *ti, struct queue_limits *limits)
 
typedef int(* dm_busy_fn )(struct dm_target *ti)
 

Enumerations

enum  status_type_t { STATUSTYPE_INFO, STATUSTYPE_TABLE }
 

Functions

void dm_error (const char *message)
 
int dm_set_device_limits (struct dm_target *ti, struct dm_dev *dev, sector_t start, sector_t len, void *data)
 
int dm_get_device (struct dm_target *ti, const char *path, fmode_t mode, struct dm_dev **result)
 
void dm_put_device (struct dm_target *ti, struct dm_dev *d)
 
int dm_register_target (struct target_type *t)
 
void dm_unregister_target (struct target_type *t)
 
int dm_read_arg (struct dm_arg *arg, struct dm_arg_set *arg_set, unsigned *value, char **error)
 
int dm_read_arg_group (struct dm_arg *arg, struct dm_arg_set *arg_set, unsigned *num_args, char **error)
 
const chardm_shift_arg (struct dm_arg_set *as)
 
void dm_consume_args (struct dm_arg_set *as, unsigned num_args)
 
int dm_create (int minor, struct mapped_device **md)
 
struct mapped_devicedm_get_md (dev_t dev)
 
void dm_get (struct mapped_device *md)
 
void dm_put (struct mapped_device *md)
 
void dm_set_mdptr (struct mapped_device *md, void *ptr)
 
voiddm_get_mdptr (struct mapped_device *md)
 
int dm_suspend (struct mapped_device *md, unsigned suspend_flags)
 
int dm_resume (struct mapped_device *md)
 
uint32_t dm_get_event_nr (struct mapped_device *md)
 
int dm_wait_event (struct mapped_device *md, int event_nr)
 
uint32_t dm_next_uevent_seq (struct mapped_device *md)
 
void dm_uevent_add (struct mapped_device *md, struct list_head *elist)
 
const chardm_device_name (struct mapped_device *md)
 
int dm_copy_name_and_uuid (struct mapped_device *md, char *name, char *uuid)
 
struct gendisk * dm_disk (struct mapped_device *md)
 
int dm_suspended (struct dm_target *ti)
 
int dm_noflush_suspending (struct dm_target *ti)
 
union map_infodm_get_mapinfo (struct bio *bio)
 
union map_infodm_get_rq_mapinfo (struct request *rq)
 
int dm_get_geometry (struct mapped_device *md, struct hd_geometry *geo)
 
int dm_set_geometry (struct mapped_device *md, struct hd_geometry *geo)
 
int dm_table_create (struct dm_table **result, fmode_t mode, unsigned num_targets, struct mapped_device *md)
 
int dm_table_add_target (struct dm_table *t, const char *type, sector_t start, sector_t len, char *params)
 
void dm_table_add_target_callbacks (struct dm_table *t, struct dm_target_callbacks *cb)
 
int dm_table_complete (struct dm_table *t)
 
int __must_check dm_set_target_max_io_len (struct dm_target *ti, sector_t len)
 
struct dm_tabledm_get_live_table (struct mapped_device *md)
 
void dm_table_get (struct dm_table *t)
 
void dm_table_put (struct dm_table *t)
 
sector_t dm_table_get_size (struct dm_table *t)
 
unsigned int dm_table_get_num_targets (struct dm_table *t)
 
fmode_t dm_table_get_mode (struct dm_table *t)
 
struct mapped_devicedm_table_get_md (struct dm_table *t)
 
void dm_table_event (struct dm_table *t)
 
struct dm_tabledm_swap_table (struct mapped_device *md, struct dm_table *t)
 
voiddm_vcalloc (unsigned long nmemb, unsigned long elem_size)
 
void dm_dispatch_request (struct request *rq)
 
void dm_requeue_unmapped_request (struct request *rq)
 
void dm_kill_unmapped_request (struct request *rq, int error)
 
int dm_underlying_device_busy (struct request_queue *q)
 

Macro Definition Documentation

#define DM_ANY_MINOR   (-1)

Definition at line 298 of file device-mapper.h.

#define dm_array_too_big (   fixed,
  obj,
  num 
)    ((num) > (UINT_MAX - (fixed)) / (obj))

Definition at line 502 of file device-mapper.h.

#define dm_div_up (   n,
  sz 
)    (((n) + (sz) - 1) / (sz))

Definition at line 487 of file device-mapper.h.

#define DM_ENDIO_INCOMPLETE   1

Definition at line 474 of file device-mapper.h.

#define DM_ENDIO_REQUEUE   2

Definition at line 475 of file device-mapper.h.

#define DM_MAPIO_REMAPPED   1

Definition at line 481 of file device-mapper.h.

#define DM_MAPIO_REQUEUE   DM_ENDIO_REQUEUE

Definition at line 482 of file device-mapper.h.

#define DM_MAPIO_SUBMITTED   0

Definition at line 480 of file device-mapper.h.

#define DM_NAME   "device-mapper"

Definition at line 412 of file device-mapper.h.

#define dm_ratelimit ( )    0

Definition at line 419 of file device-mapper.h.

#define dm_round_up (   n,
  sz 
)    (dm_div_up((n), (sz)) * (sz))

Definition at line 500 of file device-mapper.h.

#define dm_sector_div_up (   n,
  sz 
)
Value:
( \
{ \
sector_t _r = ((n) + (sz) - 1); \
sector_div(_r, (sz)); \
_r; \
} \
)

Definition at line 489 of file device-mapper.h.

#define DM_TARGET_ALWAYS_WRITEABLE   0x00000002

Definition at line 170 of file device-mapper.h.

#define dm_target_always_writeable (   type)    ((type)->features & DM_TARGET_ALWAYS_WRITEABLE)

Definition at line 171 of file device-mapper.h.

#define DM_TARGET_IMMUTABLE   0x00000004

Definition at line 178 of file device-mapper.h.

#define dm_target_is_immutable (   type)    ((type)->features & DM_TARGET_IMMUTABLE)

Definition at line 179 of file device-mapper.h.

#define dm_target_needs_singleton (   type)    ((type)->features & DM_TARGET_SINGLETON)

Definition at line 165 of file device-mapper.h.

#define dm_target_offset (   ti,
  sector 
)    ((sector) - (ti)->begin)

Definition at line 509 of file device-mapper.h.

#define DM_TARGET_SINGLETON   0x00000001

Definition at line 164 of file device-mapper.h.

#define DMCRIT (   f,
  arg... 
)    printk(KERN_CRIT DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)

Definition at line 422 of file device-mapper.h.

#define DMDEBUG (   f,
  arg... 
)    do {} while (0)

Definition at line 462 of file device-mapper.h.

#define DMDEBUG_LIMIT (   f,
  arg... 
)    do {} while (0)

Definition at line 463 of file device-mapper.h.

#define DMEMIT (   x...)
Value:
sz += ((sz >= maxlen) ? \
0 : scnprintf(result + sz, maxlen - sz, x))

Definition at line 466 of file device-mapper.h.

#define DMERR (   f,
  arg... 
)    printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)

Definition at line 425 of file device-mapper.h.

#define DMERR_LIMIT (   f,
  arg... 
)
Value:
do { \
if (dm_ratelimit()) \
printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " \
f "\n", ## arg); \
} while (0)

Definition at line 427 of file device-mapper.h.

#define DMINFO (   f,
  arg... 
)    printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)

Definition at line 443 of file device-mapper.h.

#define DMINFO_LIMIT (   f,
  arg... 
)
Value:
do { \
if (dm_ratelimit()) \
printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f \
"\n", ## arg); \
} while (0)

Definition at line 445 of file device-mapper.h.

#define DMWARN (   f,
  arg... 
)    printk(KERN_WARNING DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)

Definition at line 434 of file device-mapper.h.

#define DMWARN_LIMIT (   f,
  arg... 
)
Value:
do { \
if (dm_ratelimit()) \
printk(KERN_WARNING DM_NAME ": " DM_MSG_PREFIX ": " \
f "\n", ## arg); \
} while (0)

Definition at line 436 of file device-mapper.h.

#define SECTOR_SHIFT   9

Definition at line 469 of file device-mapper.h.

Typedef Documentation

typedef int(* dm_busy_fn)(struct dm_target *ti)

Definition at line 102 of file device-mapper.h.

typedef int(* dm_ctr_fn)(struct dm_target *target, unsigned int argc, char **argv)

Definition at line 33 of file device-mapper.h.

typedef void(* dm_dtr_fn)(struct dm_target *ti)

Definition at line 40 of file device-mapper.h.

typedef int(* dm_endio_fn)(struct dm_target *ti, struct bio *bio, int error, union map_info *map_context)

Definition at line 62 of file device-mapper.h.

typedef void(* dm_io_hints_fn)(struct dm_target *ti, struct queue_limits *limits)

Definition at line 94 of file device-mapper.h.

typedef int(* dm_ioctl_fn)(struct dm_target *ti, unsigned int cmd, unsigned long arg)

Definition at line 79 of file device-mapper.h.

typedef int(* dm_iterate_devices_fn)(struct dm_target *ti, iterate_devices_callout_fn fn, void *data)

Definition at line 90 of file device-mapper.h.

typedef int(* dm_map_fn)(struct dm_target *ti, struct bio *bio, union map_info *map_context)

Definition at line 49 of file device-mapper.h.

typedef int(* dm_map_request_fn)(struct dm_target *ti, struct request *clone, union map_info *map_context)

Definition at line 51 of file device-mapper.h.

typedef int(* dm_merge_fn)(struct dm_target *ti, struct bvec_merge_data *bvm, struct bio_vec *biovec, int max_size)

Definition at line 82 of file device-mapper.h.

typedef int(* dm_message_fn)(struct dm_target *ti, unsigned argc, char **argv)

Definition at line 77 of file device-mapper.h.

typedef void(* dm_postsuspend_fn)(struct dm_target *ti)

Definition at line 70 of file device-mapper.h.

typedef int(* dm_preresume_fn)(struct dm_target *ti)

Definition at line 71 of file device-mapper.h.

typedef void(* dm_presuspend_fn)(struct dm_target *ti)

Definition at line 69 of file device-mapper.h.

typedef int(* dm_request_endio_fn)(struct dm_target *ti, struct request *clone, int error, union map_info *map_context)

Definition at line 65 of file device-mapper.h.

typedef void(* dm_resume_fn)(struct dm_target *ti)

Definition at line 72 of file device-mapper.h.

typedef int(* dm_status_fn)(struct dm_target *ti, status_type_t status_type, unsigned status_flags, char *result, unsigned maxlen)

Definition at line 74 of file device-mapper.h.

typedef int(* iterate_devices_callout_fn)(struct dm_target *ti, struct dm_dev *dev, sector_t start, sector_t len, void *data)

Definition at line 85 of file device-mapper.h.

Enumeration Type Documentation

Enumerator:
STATUSTYPE_INFO 
STATUSTYPE_TABLE 

Definition at line 21 of file device-mapper.h.

Function Documentation

void dm_consume_args ( struct dm_arg_set as,
unsigned  num_args 
)

Definition at line 888 of file dm-table.c.

int dm_copy_name_and_uuid ( struct mapped_device md,
char name,
char uuid 
)

Definition at line 1761 of file dm-ioctl.c.

int dm_create ( int  minor,
struct mapped_device **  md 
)

Definition at line 2127 of file dm.c.

const char* dm_device_name ( struct mapped_device md)

Definition at line 2262 of file dm.c.

struct gendisk* dm_disk ( struct mapped_device md)
read

Definition at line 2667 of file dm.c.

void dm_dispatch_request ( struct request rq)

Definition at line 1446 of file dm.c.

void dm_error ( const char message)
void dm_get ( struct mapped_device md)

Definition at line 2256 of file dm.c.

int dm_get_device ( struct dm_target ti,
const char path,
fmode_t  mode,
struct dm_dev **  result 
)

Definition at line 458 of file dm-table.c.

uint32_t dm_get_event_nr ( struct mapped_device md)

Definition at line 2643 of file dm.c.

int dm_get_geometry ( struct mapped_device md,
struct hd_geometry geo 
)

Definition at line 554 of file dm.c.

struct dm_table* dm_get_live_table ( struct mapped_device md)
read

Definition at line 537 of file dm.c.

union map_info* dm_get_mapinfo ( struct bio *  bio)
write

Definition at line 103 of file dm.c.

struct mapped_device* dm_get_md ( dev_t  dev)
read

Definition at line 2235 of file dm.c.

void* dm_get_mdptr ( struct mapped_device md)

Definition at line 2246 of file dm.c.

union map_info* dm_get_rq_mapinfo ( struct request rq)
write

Definition at line 110 of file dm.c.

void dm_kill_unmapped_request ( struct request rq,
int  error 
)

Definition at line 919 of file dm.c.

uint32_t dm_next_uevent_seq ( struct mapped_device md)

Definition at line 2638 of file dm.c.

int dm_noflush_suspending ( struct dm_target ti)

Definition at line 2708 of file dm.c.

void dm_put ( struct mapped_device md)

Definition at line 2314 of file dm.c.

void dm_put_device ( struct dm_target ti,
struct dm_dev d 
)

Definition at line 555 of file dm-table.c.

int dm_read_arg ( struct dm_arg arg,
struct dm_arg_set arg_set,
unsigned *  value,
char **  error 
)

Definition at line 859 of file dm-table.c.

int dm_read_arg_group ( struct dm_arg arg,
struct dm_arg_set arg_set,
unsigned *  num_args,
char **  error 
)

Definition at line 866 of file dm-table.c.

int dm_register_target ( struct target_type t)

Definition at line 83 of file dm-target.c.

void dm_requeue_unmapped_request ( struct request rq)

Definition at line 808 of file dm.c.

int dm_resume ( struct mapped_device md)

Definition at line 2580 of file dm.c.

int dm_set_device_limits ( struct dm_target ti,
struct dm_dev dev,
sector_t  start,
sector_t  len,
void data 
)

Definition at line 516 of file dm-table.c.

int dm_set_geometry ( struct mapped_device md,
struct hd_geometry geo 
)

Definition at line 564 of file dm.c.

void dm_set_mdptr ( struct mapped_device md,
void ptr 
)

Definition at line 2251 of file dm.c.

int __must_check dm_set_target_max_io_len ( struct dm_target ti,
sector_t  len 
)

Definition at line 987 of file dm.c.

const char* dm_shift_arg ( struct dm_arg_set as)

Definition at line 873 of file dm-table.c.

int dm_suspend ( struct mapped_device md,
unsigned  suspend_flags 
)

Definition at line 2476 of file dm.c.

int dm_suspended ( struct dm_target ti)

Definition at line 2702 of file dm.c.

struct dm_table* dm_swap_table ( struct mapped_device md,
struct dm_table t 
)
read

Definition at line 2390 of file dm.c.

int dm_table_add_target ( struct dm_table t,
const char type,
sector_t  start,
sector_t  len,
char params 
)

Definition at line 738 of file dm-table.c.

void dm_table_add_target_callbacks ( struct dm_table t,
struct dm_target_callbacks cb 
)

Definition at line 1546 of file dm-table.c.

int dm_table_complete ( struct dm_table t)

Definition at line 1124 of file dm-table.c.

int dm_table_create ( struct dm_table **  result,
fmode_t  mode,
unsigned  num_targets,
struct mapped_device md 
)

Definition at line 201 of file dm-table.c.

void dm_table_event ( struct dm_table t)

Definition at line 1163 of file dm-table.c.

void dm_table_get ( struct dm_table t)

Definition at line 278 of file dm-table.c.

struct mapped_device* dm_table_get_md ( struct dm_table t)
read

Definition at line 1592 of file dm-table.c.

fmode_t dm_table_get_mode ( struct dm_table t)

Definition at line 1483 of file dm-table.c.

unsigned int dm_table_get_num_targets ( struct dm_table t)

Definition at line 1473 of file dm-table.c.

sector_t dm_table_get_size ( struct dm_table t)

Definition at line 1178 of file dm-table.c.

void dm_table_put ( struct dm_table t)

Definition at line 284 of file dm-table.c.

void dm_uevent_add ( struct mapped_device md,
struct list_head elist 
)

Definition at line 2654 of file dm.c.

int dm_underlying_device_busy ( struct request_queue q)

Definition at line 1671 of file dm.c.

void dm_unregister_target ( struct target_type t)

Definition at line 97 of file dm-target.c.

void* dm_vcalloc ( unsigned long  nmemb,
unsigned long  elem_size 
)

Definition at line 146 of file dm-table.c.

int dm_wait_event ( struct mapped_device md,
int  event_nr 
)

Definition at line 2648 of file dm.c.