#include <linux/device-mapper.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/vmalloc.h>
#define DM_MSG_PREFIX …
region_table_slot_t;
struct switch_path { … };
struct switch_ctx { … };
static struct switch_ctx *alloc_switch_ctx(struct dm_target *ti, unsigned int nr_paths,
unsigned int region_size)
{ … }
static int alloc_region_table(struct dm_target *ti, unsigned int nr_paths)
{ … }
static void switch_get_position(struct switch_ctx *sctx, unsigned long region_nr,
unsigned long *region_index, unsigned int *bit)
{ … }
static unsigned int switch_region_table_read(struct switch_ctx *sctx, unsigned long region_nr)
{ … }
static unsigned int switch_get_path_nr(struct switch_ctx *sctx, sector_t offset)
{ … }
static void switch_region_table_write(struct switch_ctx *sctx, unsigned long region_nr,
unsigned int value)
{ … }
static void initialise_region_table(struct switch_ctx *sctx)
{ … }
static int parse_path(struct dm_arg_set *as, struct dm_target *ti)
{ … }
static void switch_dtr(struct dm_target *ti)
{ … }
static int switch_ctr(struct dm_target *ti, unsigned int argc, char **argv)
{ … }
static int switch_map(struct dm_target *ti, struct bio *bio)
{ … }
static const unsigned char hex_table[256] = …;
static __always_inline unsigned long parse_hex(const char **string)
{ … }
static int process_set_region_mappings(struct switch_ctx *sctx,
unsigned int argc, char **argv)
{ … }
static int switch_message(struct dm_target *ti, unsigned int argc, char **argv,
char *result, unsigned int maxlen)
{ … }
static void switch_status(struct dm_target *ti, status_type_t type,
unsigned int status_flags, char *result, unsigned int maxlen)
{ … }
static int switch_prepare_ioctl(struct dm_target *ti, struct block_device **bdev)
{ … }
static int switch_iterate_devices(struct dm_target *ti,
iterate_devices_callout_fn fn, void *data)
{ … }
static struct target_type switch_target = …;
module_dm(switch);
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;