aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2006-01-06 03:20:01 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:34:00 -0500
commitd229a9589ff3b988d3f999cdcfa350f97a372673 (patch)
treeea6da350027f02736de7c1b7f350bc915abae39c
parent637842cfdbe2b981f7088f7633e630570f58efaf (diff)
[PATCH] device-mapper: add dm_get_md
Add dm_get_dev() to get a mapped device given its dev_t. Signed-off-by: Alasdair G Kergon <agk@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/md/dm.c10
-rw-r--r--drivers/md/dm.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 27cd234cf682..9e8c1edd89dd 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -921,6 +921,16 @@ static struct mapped_device *dm_find_md(dev_t dev)
921 return md; 921 return md;
922} 922}
923 923
924struct mapped_device *dm_get_md(dev_t dev)
925{
926 struct mapped_device *md = dm_find_md(dev);
927
928 if (md)
929 dm_get(md);
930
931 return md;
932}
933
924void *dm_get_mdptr(dev_t dev) 934void *dm_get_mdptr(dev_t dev)
925{ 935{
926 struct mapped_device *md; 936 struct mapped_device *md;
diff --git a/drivers/md/dm.h b/drivers/md/dm.h
index e38c3fc1a1db..ab078a249396 100644
--- a/drivers/md/dm.h
+++ b/drivers/md/dm.h
@@ -58,6 +58,7 @@ int dm_create(struct mapped_device **md);
58int dm_create_with_minor(unsigned int minor, struct mapped_device **md); 58int dm_create_with_minor(unsigned int minor, struct mapped_device **md);
59void dm_set_mdptr(struct mapped_device *md, void *ptr); 59void dm_set_mdptr(struct mapped_device *md, void *ptr);
60void *dm_get_mdptr(dev_t dev); 60void *dm_get_mdptr(dev_t dev);
61struct mapped_device *dm_get_md(dev_t dev);
61 62
62/* 63/*
63 * Reference counting for md. 64 * Reference counting for md.