[PATCH] device-mapper: add dm_get_md

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add dm_get_dev() to get a mapped device given its dev_t.

From: David Teigland <[email protected]>
Signed-Off-By: Alasdair G Kergon <[email protected]>

Index: linux-2.6.14/drivers/md/dm.c
===================================================================
--- linux-2.6.14.orig/drivers/md/dm.c	2005-11-18 14:40:48.000000000 +0000
+++ linux-2.6.14/drivers/md/dm.c	2005-11-18 14:40:52.000000000 +0000
@@ -932,6 +932,16 @@ static struct mapped_device *dm_find_md(
 	return md;
 }
 
+struct mapped_device *dm_get_md(dev_t dev)
+{
+	struct mapped_device *md = dm_find_md(dev);
+
+	if (md)
+		dm_get(md);
+
+	return md;
+}
+
 void *dm_get_mdptr(dev_t dev)
 {
 	struct mapped_device *md;
Index: linux-2.6.14/drivers/md/dm.h
===================================================================
--- linux-2.6.14.orig/drivers/md/dm.h	2005-11-18 14:40:40.000000000 +0000
+++ linux-2.6.14/drivers/md/dm.h	2005-11-18 14:40:52.000000000 +0000
@@ -58,6 +58,7 @@ int dm_create(struct mapped_device **md)
 int dm_create_with_minor(unsigned int minor, struct mapped_device **md);
 void dm_set_mdptr(struct mapped_device *md, void *ptr);
 void *dm_get_mdptr(dev_t dev);
+struct mapped_device *dm_get_md(dev_t dev);
 
 /*
  * Reference counting for md.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux