dm ioctl: return UUID in DM_LIST_DEVICES_CMD result
authorMikulas Patocka <mpatocka@redhat.com>
Fri, 12 Mar 2021 14:07:30 +0000 (09:07 -0500)
committerMike Snitzer <snitzer@redhat.com>
Fri, 26 Mar 2021 18:53:41 +0000 (14:53 -0400)
commit8b638081bd4520f63db1defc660666ec5f65bc15
treeaf1a56b4acdcff94e679306f6b0ce8177a13a935
parentb82096afc8afdc55408efb54ede2ec55c1f3f8c8
dm ioctl: return UUID in DM_LIST_DEVICES_CMD result

When LVM needs to find a device with a particular UUID it needs to ask for
UUID for each device. This patch returns UUID directly in the list of
devices, so that LVM doesn't have to query all the devices with an ioctl.
The UUID is returned if the flag DM_UUID_FLAG is set in the parameters.

Returning UUID is done in backward-compatible way. There's one unused
32-bit word value after the event number. This patch sets the bit
DM_NAME_LIST_FLAG_HAS_UUID if UUID is present and
DM_NAME_LIST_FLAG_DOESNT_HAVE_UUID if it isn't (if none of these bits is
set, then we have an old kernel that doesn't support returning UUIDs). The
UUID is stored after this word. The 'next' value is updated to point after
the UUID, so that old version of libdevmapper will skip the UUID without
attempting to interpret it.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-ioctl.c
include/uapi/linux/dm-ioctl.h