Messages in this thread Patch in this message |  | | | Date | Fri, 18 Nov 2005 14:59:21 +0000 | | From | Alasdair G Kergon <> | | Subject | [PATCH] device-mapper: add dm_get_md |
| |
Add dm_get_dev() to get a mapped device given its dev_t.
From: David Teigland <teigland@redhat.com> Signed-Off-By: Alasdair G Kergon <agk@redhat.com>
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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |