File util-linux-lsblk-mountpoint-toplevel.patch of Package util-linux.4136

From c49ff158aa21a16b94cf19bc8527cfdd67963082 Mon Sep 17 00:00:00 2001
From: Milan Broz <gmazyland@gmail.com>
Date: Thu, 30 Jul 2015 16:18:28 +0200
Subject: [PATCH] lsblk: Display mountpoint even for top-level device
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

If a filesystem is mounted on top-level block device
with existing partitions, the mountpoint is not displayed
in the lsblk output.

This situation can happen by a configuration mistake
and lsblk could be used to detect such a mistake.

This patch allows searching for a mountpoint for all displayed
devices, not only for leaf nodes.
(It should be pretty cheap operation, mtab is parsed only once.)

For example: lsblk /dev/loop1
NAME      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop1       7:1    0  128M  0 loop /mnt/tst
└─loop1p1 259:0    0  127M  0 loop

Signed-off-by: Milan Broz <gmazyland@gmail.com>
---
 misc-utils/lsblk.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Index: util-linux-2.25/misc-utils/lsblk.c
===================================================================
--- util-linux-2.25.orig/misc-utils/lsblk.c
+++ util-linux-2.25/misc-utils/lsblk.c
@@ -840,8 +840,7 @@ static void set_scols_data(struct blkdev
 			str = xstrdup(cxt->fstype);
 		break;
 	case COL_TARGET:
-		if (!(cxt->nholders + cxt->npartitions))
-			str = get_device_mountpoint(cxt);
+		str = get_device_mountpoint(cxt);
 		break;
 	case COL_LABEL:
 		probe_device(cxt);
openSUSE Build Service is sponsored by