Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 262206
b: refs/heads/master
c: ba2e19b
h: refs/heads/master
v: v3
  • Loading branch information
Mikulas Patocka authored and Alasdair G Kergon committed Aug 2, 2011
1 parent 2c1e79a commit 87bfa87
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0ddf9644cc26e74ed671525e61a17bdbebf18da6
refs/heads/master: ba2e19b0f4ccd6920fe175a86521ff18ede260cb
41 changes: 24 additions & 17 deletions trunk/drivers/md/dm-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,24 @@ static struct hash_cell *__get_uuid_cell(const char *str)
return NULL;
}

static struct hash_cell *__get_dev_cell(uint64_t dev)
{
struct mapped_device *md;
struct hash_cell *hc;

md = dm_get_md(huge_decode_dev(dev));
if (!md)
return NULL;

hc = dm_get_mdptr(md);
if (!hc) {
dm_put(md);
return NULL;
}

return hc;
}

/*-----------------------------------------------------------------
* Inserting, removing and renaming a device.
*---------------------------------------------------------------*/
Expand Down Expand Up @@ -718,34 +736,23 @@ static int dev_create(struct dm_ioctl *param, size_t param_size)
*/
static struct hash_cell *__find_device_hash_cell(struct dm_ioctl *param)
{
struct mapped_device *md;
struct hash_cell *hc = NULL;

if (*param->uuid) {
hc = __get_uuid_cell(param->uuid);
if (!hc)
return NULL;
goto fill_params;
}

if (*param->name) {
} else if (*param->name) {
hc = __get_name_cell(param->name);
if (!hc)
return NULL;
goto fill_params;
}

md = dm_get_md(huge_decode_dev(param->dev));
if (!md)
return NULL;

hc = dm_get_mdptr(md);
if (!hc) {
dm_put(md);
} else if (param->dev) {
hc = __get_dev_cell(param->dev);
if (!hc)
return NULL;
} else
return NULL;
}

fill_params:
/*
* Sneakily write in both the name and the uuid
* while we have the cell.
Expand Down

0 comments on commit 87bfa87

Please sign in to comment.