]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsblk: force to print PKNAME for partition
authorKarel Zak <kzak@redhat.com>
Thu, 27 Jun 2019 07:22:18 +0000 (09:22 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 27 Jun 2019 07:22:18 +0000 (09:22 +0200)
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>
misc-utils/lsblk.c

index e95af7af0256ec85ad063ba3e3f9669d4e92e81d..3ce6da730264f24e524d65ea5a387ca2679587ff 100644 (file)
@@ -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;