From 88147f314c6237be119bea9dd239b250378d7835 Mon Sep 17 00:00:00 2001 From: Mike Anderson Date: Fri, 19 Oct 2007 22:47:59 +0100 Subject: [PATCH] --- yaml --- r: 71731 b: refs/heads/master c: 96a1f7dba6e464155c0d1dc69c6c2efa96b644ac h: refs/heads/master i: 71729: e3246b3cd015d4e81d5006449d4d5d9e9a287022 71727: f953a03e48d4e4fadd890457b6aa0eafdd314ddf v: v3 --- [refs] | 2 +- trunk/drivers/md/dm-ioctl.c | 32 +++++++++++++++++++++++++++++ trunk/include/linux/device-mapper.h | 1 + 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 429b10a02c24..40fe4a91c2ff 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: aa5617c55357d86c9082ba1d66fa9795370c9954 +refs/heads/master: 96a1f7dba6e464155c0d1dc69c6c2efa96b644ac diff --git a/trunk/drivers/md/dm-ioctl.c b/trunk/drivers/md/dm-ioctl.c index 6af95f9b7b52..138200bf5e0b 100644 --- a/trunk/drivers/md/dm-ioctl.c +++ b/trunk/drivers/md/dm-ioctl.c @@ -1515,3 +1515,35 @@ void dm_interface_exit(void) dm_hash_exit(); } + +/** + * dm_copy_name_and_uuid - Copy mapped device name & uuid into supplied buffers + * @md: Pointer to mapped_device + * @name: Buffer (size DM_NAME_LEN) for name + * @uuid: Buffer (size DM_UUID_LEN) for uuid or empty string if uuid not defined + */ +int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid) +{ + int r = 0; + struct hash_cell *hc; + + if (!md) + return -ENXIO; + + dm_get(md); + down_read(&_hash_lock); + hc = dm_get_mdptr(md); + if (!hc || hc->md != md) { + r = -ENXIO; + goto out; + } + + strcpy(name, hc->name); + strcpy(uuid, hc->uuid ? : ""); + +out: + up_read(&_hash_lock); + dm_put(md); + + return r; +} diff --git a/trunk/include/linux/device-mapper.h b/trunk/include/linux/device-mapper.h index 499f5373e213..8b3c7cdc599c 100644 --- a/trunk/include/linux/device-mapper.h +++ b/trunk/include/linux/device-mapper.h @@ -188,6 +188,7 @@ int dm_wait_event(struct mapped_device *md, int event_nr); * Info functions. */ const char *dm_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 mapped_device *md); int dm_noflush_suspending(struct dm_target *ti);