Commit 9ade92a9 authored by Alasdair G Kergon's avatar Alasdair G Kergon Committed by Linus Torvalds

[PATCH] dm: tidy mdptr

Change dm_get_mdptr() to take a struct mapped_device instead of dev_t.
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7e51f257
...@@ -600,12 +600,22 @@ static int dev_create(struct dm_ioctl *param, size_t param_size) ...@@ -600,12 +600,22 @@ static int dev_create(struct dm_ioctl *param, size_t param_size)
*/ */
static struct hash_cell *__find_device_hash_cell(struct dm_ioctl *param) static struct hash_cell *__find_device_hash_cell(struct dm_ioctl *param)
{ {
struct mapped_device *md;
void *mdptr = NULL;
if (*param->uuid) if (*param->uuid)
return __get_uuid_cell(param->uuid); return __get_uuid_cell(param->uuid);
else if (*param->name)
if (*param->name)
return __get_name_cell(param->name); return __get_name_cell(param->name);
else
return dm_get_mdptr(huge_decode_dev(param->dev)); md = dm_get_md(huge_decode_dev(param->dev));
if (md) {
mdptr = dm_get_mdptr(md);
dm_put(md);
}
return mdptr;
} }
static struct mapped_device *find_device(struct dm_ioctl *param) static struct mapped_device *find_device(struct dm_ioctl *param)
......
...@@ -990,15 +990,9 @@ struct mapped_device *dm_get_md(dev_t dev) ...@@ -990,15 +990,9 @@ struct mapped_device *dm_get_md(dev_t dev)
return md; return md;
} }
void *dm_get_mdptr(dev_t dev) void *dm_get_mdptr(struct mapped_device *md)
{ {
struct mapped_device *md; return md->interface_ptr;
void *mdptr = NULL;
md = dm_find_md(dev);
if (md)
mdptr = md->interface_ptr;
return mdptr;
} }
void dm_set_mdptr(struct mapped_device *md, void *ptr) void dm_set_mdptr(struct mapped_device *md, void *ptr)
......
...@@ -47,7 +47,7 @@ struct mapped_device; ...@@ -47,7 +47,7 @@ struct mapped_device;
int dm_create(struct mapped_device **md); int dm_create(struct mapped_device **md);
int dm_create_with_minor(unsigned int minor, 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_set_mdptr(struct mapped_device *md, void *ptr);
void *dm_get_mdptr(dev_t dev); void *dm_get_mdptr(struct mapped_device *md);
struct mapped_device *dm_get_md(dev_t dev); struct mapped_device *dm_get_md(dev_t dev);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment