[PATCH] device-mapper: add dm_get_md
From: Alasdair G Kergon
Date: Fri Nov 18 2005 - 09:59:02 EST
Add dm_get_dev() to get a mapped device given its dev_t.
From: David Teigland <teigland@xxxxxxxxxx>
Signed-Off-By: Alasdair G Kergon <agk@xxxxxxxxxx>
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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/