mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Some ioctl code tidying: removing duplicate internal buffers; making bounds
checks clearer (incl. variable renaming); using a flag to indicate when output data doesn't fit into supplied buffer instead of returning an error etc.
This commit is contained in:
parent
010c07de20
commit
41d02bc385
@ -471,7 +471,7 @@ void *dm_get_next_target(struct dm_task *dmt, void *next,
|
|||||||
/* Unmarshall the target info returned from a status call */
|
/* Unmarshall the target info returned from a status call */
|
||||||
static int _unmarshal_status(struct dm_task *dmt, struct dm_ioctl *dmi)
|
static int _unmarshal_status(struct dm_task *dmt, struct dm_ioctl *dmi)
|
||||||
{
|
{
|
||||||
char *outbuf = (char *) dmi + dmi->data_start;
|
char *outbuf = (char *) dmi + dmi->data_offset;
|
||||||
char *outptr = outbuf;
|
char *outptr = outbuf;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
struct dm_target_spec *spec;
|
struct dm_target_spec *spec;
|
||||||
@ -528,7 +528,7 @@ struct dm_deps *dm_task_get_deps(struct dm_task *dmt)
|
|||||||
return _dm_task_get_deps_v1(dmt);
|
return _dm_task_get_deps_v1(dmt);
|
||||||
|
|
||||||
return (struct dm_deps *) (((void *) dmt->dmi.v3) +
|
return (struct dm_deps *) (((void *) dmt->dmi.v3) +
|
||||||
dmt->dmi.v3->data_start);
|
dmt->dmi.v3->data_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dm_task_set_ro(struct dm_task *dmt)
|
int dm_task_set_ro(struct dm_task *dmt)
|
||||||
@ -663,7 +663,7 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt)
|
|||||||
dmi->version[2] = (*version)[2];
|
dmi->version[2] = (*version)[2];
|
||||||
|
|
||||||
dmi->data_size = len;
|
dmi->data_size = len;
|
||||||
dmi->data_start = sizeof(struct dm_ioctl);
|
dmi->data_offset = sizeof(struct dm_ioctl);
|
||||||
|
|
||||||
if (dmt->dev_name)
|
if (dmt->dev_name)
|
||||||
strncpy(dmi->name, dmt->dev_name, sizeof(dmi->name));
|
strncpy(dmi->name, dmt->dev_name, sizeof(dmi->name));
|
||||||
|
Loading…
Reference in New Issue
Block a user