/* * Copyright (C) 2001, 2002 Sistina Software (UK) Limited. * Copyright (C) 2004 - 2006 Red Hat, Inc. All rights reserved. * * This file is released under the GPL. */#include"dm.h"#include <linux/module.h>#include <linux/vmalloc.h>#include <linux/miscdevice.h>#include <linux/init.h>#include <linux/wait.h>#include <linux/slab.h>#include <linux/dm-ioctl.h>#include <linux/hdreg.h>#include <linux/compat.h>#include <asm/uaccess.h>#define DM_MSG_PREFIX"ioctl"#define DM_DRIVER_EMAIL"dm-devel@redhat.com"/*----------------------------------------------------------------- * The ioctl interface needs to be able to look up devices by * name or uuid. *---------------------------------------------------------------*/struct hash_cell {struct list_head name_list;struct list_head uuid_list;char*name;char*uuid;struct mapped_device *md;struct dm_table *new_map;};struct vers_iter {size_t param_size;struct dm_target_versions *vers, *old_vers;char*end;uint32_t flags;};#define NUM_BUCKETS 64#define MASK_BUCKETS (NUM_BUCKETS - 1)static struct list_head _name_buckets[NUM_BUCKETS];static struct list_head _uuid_buckets[NUM_BUCKETS];static voiddm_hash_remove_all(int keep_open_devices);/* * Guards access to both hash tables. */staticDECLARE_RWSEM(_hash_lock);static voidinit_buckets(struct list_head *buckets){unsigned int i;for(i =0; i < NUM_BUCKETS; i++)INIT_LIST_HEAD(buckets + i);}static intdm_hash_init(void){init_buckets(_name_buckets);init_buckets(_uuid_buckets);return0;}static void