summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2018-10-03 14:39:57 +0200
committerKarel Zak2018-10-03 14:39:57 +0200
commitef2ce68b1f65f22f86272dc60902f9202380acd9 (patch)
tree0d3cbdc684d72f6eaea90a4cfdb2f3a6b7b35c6a
parentmount: add note about MS_BIND and _netdev (diff)
downloadkernel-qcow2-util-linux-ef2ce68b1f65f22f86272dc60902f9202380acd9.tar.gz
kernel-qcow2-util-linux-ef2ce68b1f65f22f86272dc60902f9202380acd9.tar.xz
kernel-qcow2-util-linux-ef2ce68b1f65f22f86272dc60902f9202380acd9.zip
lsblk: always use "part" as TYPE for partitions
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>
-rw-r--r--misc-utils/lsblk.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index c15e52230..d63b65a3a 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -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);
}