blob: 5d4c148fb3d1172faaa0840192b1605d49f1a486 [file] [log] [blame]
Brad Bishop64c979e2019-11-04 13:55:29 -05001From e3bb9bfb76c17b1d05814436ced62c05c4011f48 Mon Sep 17 00:00:00 2001
2From: Karel Zak <kzak@redhat.com>
3Date: Thu, 27 Jun 2019 09:22:18 +0200
4Subject: [PATCH] lsblk: force to print PKNAME for partition
5
6PKNAME (parent kernel device name) is based on printed tree according
7to parent -> child relationship. The tree is optional and not printed
8if partition specified (.e.g "lsblk -o+PKNAME /dev/sda1"), but old
9versions print the PKNAME also in this case.
10
11Upstream-Status: Backport [https://github.com/karelzak/util-linux/commit/e3bb9bfb76c17b1d05814436ced62c05c4011f48]
12
13Addresses: https://github.com/karelzak/util-linux/issues/813
14Signed-off-by: Karel Zak <kzak@redhat.com>
15Signed-off-by: Liwei Song <liwei.song@windriver.com>
16---
17 misc-utils/lsblk.c | 3 +++
18 1 file changed, 3 insertions(+)
19
20diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
21index e95af7af0256..3ce6da730264 100644
22--- a/misc-utils/lsblk.c
23+++ b/misc-utils/lsblk.c
24@@ -1019,6 +1019,9 @@ static void device_to_scols(
25 DBG(DEV, ul_debugobj(dev, "add '%s' to scols", dev->name));
26 ON_DBG(DEV, if (ul_path_isopen_dirfd(dev->sysfs)) ul_debugobj(dev, " %s ---> is open!", dev->name));
27
28+ if (!parent && dev->wholedisk)
29+ parent = dev->wholedisk;
30+
31 /* Do not print device more than one in --list mode */
32 if (!(lsblk->flags & LSBLK_TREE) && dev->is_printed)
33 return;
34--
352.17.1
36