]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
Use correct partition names for /dev/mapper
authorStanislav Brabec <sbrabec@suse.cz>
Mon, 25 May 2015 19:17:52 +0000 (21:17 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 26 May 2015 09:42:38 +0000 (11:42 +0200)
The default configuration of multipath-tools appends "-partN" to
partition nodes. Follow this conventions and do the same.

It fixes for example fdisk -l /dev/mapper/name_of_the_device.

Note that the current implementation only partially fixes the problem. It
does not reflect any udev configuration changes, as udev does not provide
any function to return names of future (or current) partitions of a
particular device. It also does not fix fdisk -l /dev/dm-0.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
libfdisk/src/utils.c

index cc470d99bb78f8e8908af28a5daebf931014a9e4..4789dbd22659f7af2ba4761642689af3eae349b8 100644 (file)
@@ -139,9 +139,11 @@ char *fdisk_partname(const char *dev, size_t partno)
        }
 
        /* udev names partitions by appending -partN
-          e.g. ata-SAMSUNG_SV8004H_0357J1FT712448-part1 */
+          e.g. ata-SAMSUNG_SV8004H_0357J1FT712448-part1
+          multipath-tools kpartx.rules also append -partN */
        if ((strncmp(dev, _PATH_DEV_BYID, sizeof(_PATH_DEV_BYID) - 1) == 0) ||
-            strncmp(dev, _PATH_DEV_BYPATH, sizeof(_PATH_DEV_BYPATH) - 1) == 0) {
+            strncmp(dev, _PATH_DEV_BYPATH, sizeof(_PATH_DEV_BYPATH) - 1) == 0 ||
+            strncmp(dev, "/dev/mapper", sizeof("/dev/mapper") - 1) == 0) {
               p = "-part";
        }