summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2019-06-27 09:22:18 +0200
committerKarel Zak2019-06-27 09:22:18 +0200
commite3bb9bfb76c17b1d05814436ced62c05c4011f48 (patch)
tree67bc7a4cb66ddf28d8468a87582d57155ca1c6d3
parentTODO: fix typo (diff)
downloadkernel-qcow2-util-linux-e3bb9bfb76c17b1d05814436ced62c05c4011f48.tar.gz
kernel-qcow2-util-linux-e3bb9bfb76c17b1d05814436ced62c05c4011f48.tar.xz
kernel-qcow2-util-linux-e3bb9bfb76c17b1d05814436ced62c05c4011f48.zip
lsblk: force to print PKNAME for partition
PKNAME (parent kernel device name) is based on printed tree according to parent -> child relationship. The tree is optional and not printed if partition specified (.e.g "lsblk -o+PKNAME /dev/sda1"), but old versions print the PKNAME also in this case. Addresses: https://github.com/karelzak/util-linux/issues/813 Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--misc-utils/lsblk.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index e95af7af0..3ce6da730 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -1019,6 +1019,9 @@ static void device_to_scols(
DBG(DEV, ul_debugobj(dev, "add '%s' to scols", dev->name));
ON_DBG(DEV, if (ul_path_isopen_dirfd(dev->sysfs)) ul_debugobj(dev, " %s ---> is open!", dev->name));
+ if (!parent && dev->wholedisk)
+ parent = dev->wholedisk;
+
/* Do not print device more than one in --list mode */
if (!(lsblk->flags & LSBLK_TREE) && dev->is_printed)
return;