]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsblk: always use "part" as TYPE for partitions
authorKarel Zak <kzak@redhat.com>
Wed, 3 Oct 2018 12:39:57 +0000 (14:39 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 3 Oct 2018 12:39:57 +0000 (14:39 +0200)
The current code uses "part" or "disk" only if nothing else is
possible to recognize. It means for example partitions on loops (or
RAIDs, etc) are marked as "loop" rather than "part".

Addresses: https://github.com/karelzak/util-linux/issues/700
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/lsblk.c

index c15e522305279f21fcae5462b2570683e89c133f..d63b65a3ad65d67f4c9a12f4328551b6099ed687 100644 (file)
@@ -413,6 +413,9 @@ static char *get_type(struct blkdev_cxt *cxt)
 {
        char *res = NULL, *p;
 
+       if (cxt->partition)
+               return xstrdup("part");
+
        if (is_dm(cxt->name)) {
                char *dm_uuid = NULL;
 
@@ -453,7 +456,7 @@ static char *get_type(struct blkdev_cxt *cxt)
                if (ul_path_read_s32(cxt->sysfs, &x, "device/type") == 0)
                        type = blkdev_scsi_type_to_name(x);
                if (!type)
-                       type = cxt->partition ? "part" : "disk";
+                       type = "disk";
                res = xstrdup(type);
        }