Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Mikulas Patocka and committed by
Mike Snitzer
23d70c5e fc1841e1

+5 -1
+5 -1
drivers/md/dm-ioctl.c
··· 506 506 size_t len, needed = 0; 507 507 struct gendisk *disk; 508 508 struct dm_name_list *nl, *old_nl = NULL; 509 + uint32_t *event_nr; 509 510 510 511 down_write(&_hash_lock); 511 512 ··· 519 518 needed += sizeof(struct dm_name_list); 520 519 needed += strlen(hc->name) + 1; 521 520 needed += ALIGN_MASK; 521 + needed += (sizeof(uint32_t) + ALIGN_MASK) & ~ALIGN_MASK; 522 522 } 523 523 } 524 524 ··· 549 547 strcpy(nl->name, hc->name); 550 548 551 549 old_nl = nl; 552 - nl = align_ptr(((void *) ++nl) + strlen(hc->name) + 1); 550 + event_nr = align_ptr(((void *) (nl + 1)) + strlen(hc->name) + 1); 551 + *event_nr = dm_get_event_nr(hc->md); 552 + nl = align_ptr(event_nr + 1); 553 553 } 554 554 } 555 555