/* * Copyright (C) 2001, 2002 Sistina Software (UK) Limited. * Copyright (C) 2004 - 2005 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/devfs_fs_kernel.h>#include<linux/dm-ioctl.h>#include<asm/uaccess.h>#define DM_DRIVER_EMAIL "dm-devel@redhat.com"/*----------------------------------------------------------------- * The ioctl interface needs to be able to look up devices by * name or uuid. *---------------------------------------------------------------*/structhash_cell{structlist_headname_list;structlist_headuuid_list;char*name;char*uuid;structmapped_device*md;structdm_table*new_map;};structvers_iter{size_tparam_size;structdm_target_versions*vers,*old_vers;char*end;uint32_tflags;};#define NUM_BUCKETS 64#define MASK_BUCKETS (NUM_BUCKETS - 1)staticstructlist_head_name_buckets[NUM_BUCKETS];staticstructlist_head_uuid_buckets[NUM_BUCKETS];staticvoiddm_hash_remove_all(void);/* * Guards access to both hash tables. */staticDECLARE_RWSEM(_hash_lock);staticvoidinit_buckets(structlist_head*buckets){unsignedinti;for(i=0;i<NUM_BUCKETS;i++)INIT_LIST_HEAD(buckets+i);}staticintdm_hash_init(void){init_buckets(_name_buckets);init_buckets(_uuid_buckets);devfs_mk_dir(DM_DIR);return0;}staticvoiddm_hash_exit(void){dm_hash_remove_all();devfs_remove(DM_DIR);}/*----------------------------------------------------------------- * Hash function: * We're not really concerned with the