diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2017-01-16 16:07:01 -0500 |
---|---|---|
committer | Andy Grover <agrover@redhat.com> | 2017-05-05 11:16:35 -0700 |
commit | 3cc42d79629079d62f09b8b229fdfbcd78cecd0f (patch) | |
tree | f86ceb3c6cd7c9760706b686c4575a675458c591 | |
parent | b872f429880e5abfa391f7830cc8549460bf0d60 (diff) | |
download | linux-mikulas-dm-events.tar.gz linux-mikulas-dm-events.tar.xz linux-mikulas-dm-events.zip |
dm-ioctl: report event number in DM_LIST_DEVICESmikulas-dm-events
This patch reports the event numbers for all the devices, so that the
user doesn't have to ask them one by one. The event number is reported
after the name field in the dm_name_list structure.
The location of the next record is specified in the dm_name_list->next
field, that means that we can put the new data after the end of name and
it is backward compatible with the old code. The old code just skips the
event number without interpreting it.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
-rw-r--r-- | drivers/md/dm-ioctl.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index 84930a3e9911..0029776ab69d 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c @@ -518,6 +518,7 @@ static int list_devices(struct file *filp, struct dm_ioctl *param, size_t param_ needed += sizeof(struct dm_name_list); needed += strlen(hc->name) + 1; needed += ALIGN_MASK; + needed += (sizeof(uint32_t) + ALIGN_MASK) & ~ALIGN_MASK; } } @@ -538,6 +539,7 @@ static int list_devices(struct file *filp, struct dm_ioctl *param, size_t param_ */ for (i = 0; i < NUM_BUCKETS; i++) { list_for_each_entry (hc, _name_buckets + i, name_list) { + uint32_t *event_nr; if (old_nl) old_nl->next = (uint32_t) ((void *) nl - (void *) old_nl); @@ -547,7 +549,9 @@ static int list_devices(struct file *filp, struct dm_ioctl *param, size_t param_ strcpy(nl->name, hc->name); old_nl = nl; - nl = align_ptr(((void *) ++nl) + strlen(hc->name) + 1); + event_nr = align_ptr(((void *) (nl + 1)) + strlen(hc->name) + 1); + *event_nr = dm_get_event_nr(hc->md); + nl = align_ptr(event_nr + 1); } } |