discover/devmapper: Read device size from sysfs
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>
Thu, 7 Apr 2016 05:29:02 +0000 (15:29 +1000)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Fri, 8 Apr 2016 04:16:00 +0000 (14:16 +1000)
commit0739476294f6925b01ad12b1b198f85b41bc657d
treea2d1f20bd197ce8f6a441b299fcef300baf61333
parent3b286d116f8fb8438b8ae52669d2c1778b7a370b
discover/devmapper: Read device size from sysfs

If udev doesn't export the ID_PART_ENTRY_SIZE variable for a device we
skip creating a snapshot for it. However in most cases the sysfs
attribute which udev reads to find ID_PART_ENTRY_SIZE is still
available. Therefore if we don't have access to ID_PART_ENTRY_SIZE try
to find the size in sysfs directly.
This allows us to create snapshots for devices which often don't have
this udev variable set, such as software raid (md) devices and NVMe
devices.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
discover/devmapper.c
discover/udev.c