mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Some ioctl interface changes. (Do we want these?)
- use status bits (so we can add flags without changing the struct size) - use dev_t
This commit is contained in:
parent
406d287ae1
commit
c9dbb9efe7
@ -49,13 +49,19 @@ int dm_task_get_info(struct dm_task *dmt, struct dm_info *info)
|
|||||||
if (!dmt->dmi)
|
if (!dmt->dmi)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
info->exists = dmt->dmi->exists;
|
memset(info, 0, sizeof(*info));
|
||||||
info->suspended = dmt->dmi->suspend;
|
|
||||||
info->open_count = dmt->dmi->open_count;
|
info->exists = dmt->dmi->status & DM_EXISTS_FLAG ? 1 : 0;
|
||||||
info->major = dmt->dmi->major;
|
if (!info->exists)
|
||||||
info->minor = dmt->dmi->minor;
|
return 1;
|
||||||
info->read_only = dmt->dmi->read_only;
|
|
||||||
|
info->suspended = dmt->dmi->status & DM_SUSPEND_FLAG ? 1 : 0;
|
||||||
|
info->read_only = dmt->dmi->status & DM_READONLY_FLAG ? 1 : 0;
|
||||||
info->target_count = dmt->dmi->target_count;
|
info->target_count = dmt->dmi->target_count;
|
||||||
|
info->open_count = dmt->dmi->open_count;
|
||||||
|
info->major = MAJOR(dmt->dmi->dev);
|
||||||
|
info->minor = MINOR(dmt->dmi->dev);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,10 +189,16 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt)
|
|||||||
strncpy(dmi->version, DM_IOCTL_VERSION, sizeof(dmi->version));
|
strncpy(dmi->version, DM_IOCTL_VERSION, sizeof(dmi->version));
|
||||||
dmi->data_size = len;
|
dmi->data_size = len;
|
||||||
strncpy(dmi->name, dmt->dev_name, sizeof(dmi->name));
|
strncpy(dmi->name, dmt->dev_name, sizeof(dmi->name));
|
||||||
dmi->suspend = (dmt->type == DM_DEVICE_SUSPEND) ? 1 : 0;
|
|
||||||
dmi->open_count = 0;
|
if (dmt->type == DM_DEVICE_SUSPEND)
|
||||||
dmi->minor = dmt->minor;
|
dmi->status |= DM_SUSPEND_FLAG;
|
||||||
dmi->read_only = dmt->read_only;
|
if (dmt->read_only)
|
||||||
|
dmi->status |= DM_READONLY_FLAG;
|
||||||
|
|
||||||
|
if (dmt->minor > 0) {
|
||||||
|
dmi->status |= DM_PERSISTENT_DEV_FLAG;
|
||||||
|
dmi->dev = MKDEV(0, dmt->minor);
|
||||||
|
}
|
||||||
|
|
||||||
dmi->target_count = count;
|
dmi->target_count = count;
|
||||||
|
|
||||||
@ -269,7 +281,7 @@ int dm_task_run(struct dm_task *dmt)
|
|||||||
|
|
||||||
switch (dmt->type) {
|
switch (dmt->type) {
|
||||||
case DM_DEVICE_CREATE:
|
case DM_DEVICE_CREATE:
|
||||||
add_dev_node(dmt->dev_name, MKDEV(dmi->major, dmi->minor));
|
add_dev_node(dmt->dev_name, dmi->dev);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DM_DEVICE_REMOVE:
|
case DM_DEVICE_REMOVE:
|
||||||
|
Loading…
Reference in New Issue
Block a user