Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 262205
b: refs/heads/master
c: 0ddf964
h: refs/heads/master
i:
  262203: c2a2c77
v: v3
  • Loading branch information
Mikulas Patocka authored and Alasdair G Kergon committed Aug 2, 2011
1 parent 0cf3eec commit 2c1e79a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 30 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: a3998799fb4df0b0af8271a7d50c4269032397aa
refs/heads/master: 0ddf9644cc26e74ed671525e61a17bdbebf18da6
63 changes: 36 additions & 27 deletions trunk/drivers/md/dm-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,24 +719,49 @@ 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;
void *mdptr = NULL;
struct hash_cell *hc = NULL;

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

if (*param->name)
return __get_name_cell(param->name);
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)
goto out;
return NULL;

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

out:
return mdptr;
fill_params:
/*
* Sneakily write in both the name and the uuid
* while we have the cell.
*/
strlcpy(param->name, hc->name, sizeof(param->name));
if (hc->uuid)
strlcpy(param->uuid, hc->uuid, sizeof(param->uuid));
else
param->uuid[0] = '\0';

if (hc->new_map)
param->flags |= DM_INACTIVE_PRESENT_FLAG;
else
param->flags &= ~DM_INACTIVE_PRESENT_FLAG;

return hc;
}

static struct mapped_device *find_device(struct dm_ioctl *param)
Expand All @@ -746,24 +771,8 @@ static struct mapped_device *find_device(struct dm_ioctl *param)

down_read(&_hash_lock);
hc = __find_device_hash_cell(param);
if (hc) {
if (hc)
md = hc->md;

/*
* Sneakily write in both the name and the uuid
* while we have the cell.
*/
strlcpy(param->name, hc->name, sizeof(param->name));
if (hc->uuid)
strlcpy(param->uuid, hc->uuid, sizeof(param->uuid));
else
param->uuid[0] = '\0';

if (hc->new_map)
param->flags |= DM_INACTIVE_PRESENT_FLAG;
else
param->flags &= ~DM_INACTIVE_PRESENT_FLAG;
}
up_read(&_hash_lock);

return md;
Expand Down
4 changes: 2 additions & 2 deletions trunk/include/linux/dm-ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,9 @@ enum {
#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)

#define DM_VERSION_MAJOR 4
#define DM_VERSION_MINOR 20
#define DM_VERSION_MINOR 21
#define DM_VERSION_PATCHLEVEL 0
#define DM_VERSION_EXTRA "-ioctl (2011-02-02)"
#define DM_VERSION_EXTRA "-ioctl (2011-07-06)"

/* Status bits */
#define DM_READONLY_FLAG (1 << 0) /* In/Out */
Expand Down

0 comments on commit 2c1e79a

Please sign in to comment.