summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-ioctl.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2017-01-16 16:07:01 -0500
committerMike Snitzer <snitzer@redhat.com>2017-06-19 11:03:50 -0400
commit23d70c5e52dd68448bb14fdef5efe04d81973b31 (patch)
tree790860981a8c8ea5a72cca9407117974419c1ae3 /drivers/md/dm-ioctl.c
parentfc1841e1c15d72b0897ecfc1627ecdc284f0ec95 (diff)
dm ioctl: report event number in DM_LIST_DEVICES
Report 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> Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-ioctl.c')
-rw-r--r--drivers/md/dm-ioctl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index a69658b18dc9..e06f0ef7d2ec 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -506,6 +506,7 @@ static int list_devices(struct file *filp, struct dm_ioctl *param, size_t param_
506 size_t len, needed = 0; 506 size_t len, needed = 0;
507 struct gendisk *disk; 507 struct gendisk *disk;
508 struct dm_name_list *nl, *old_nl = NULL; 508 struct dm_name_list *nl, *old_nl = NULL;
509 uint32_t *event_nr;
509 510
510 down_write(&_hash_lock); 511 down_write(&_hash_lock);
511 512
@@ -518,6 +519,7 @@ static int list_devices(struct file *filp, struct dm_ioctl *param, size_t param_
518 needed += sizeof(struct dm_name_list); 519 needed += sizeof(struct dm_name_list);
519 needed += strlen(hc->name) + 1; 520 needed += strlen(hc->name) + 1;
520 needed += ALIGN_MASK; 521 needed += ALIGN_MASK;
522 needed += (sizeof(uint32_t) + ALIGN_MASK) & ~ALIGN_MASK;
521 } 523 }
522 } 524 }
523 525
@@ -547,7 +549,9 @@ static int list_devices(struct file *filp, struct dm_ioctl *param, size_t param_
547 strcpy(nl->name, hc->name); 549 strcpy(nl->name, hc->name);
548 550
549 old_nl = nl; 551 old_nl = nl;
550 nl = align_ptr(((void *) ++nl) + strlen(hc->name) + 1); 552 event_nr = align_ptr(((void *) (nl + 1)) + strlen(hc->name) + 1);
553 *event_nr = dm_get_event_nr(hc->md);
554 nl = align_ptr(event_nr + 1);
551 } 555 }
552 } 556 }
553 557