* [PATCH] lsblk: Display mountpoint even for top-level device
@ 2015-07-30 14:18 Milan Broz
2015-07-31 8:47 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Milan Broz @ 2015-07-30 14:18 UTC (permalink / raw)
To: util-linux; +Cc: Milan Broz
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(-)
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index cfd304a..4cfeef8 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -916,8 +916,7 @@ static void set_scols_data(struct blkdev_cxt *cxt, int col, int id, struct libsc
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);
--
2.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] lsblk: Display mountpoint even for top-level device
2015-07-30 14:18 [PATCH] lsblk: Display mountpoint even for top-level device Milan Broz
@ 2015-07-31 8:47 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2015-07-31 8:47 UTC (permalink / raw)
To: Milan Broz; +Cc: util-linux
On Thu, Jul 30, 2015 at 04:18:28PM +0200, Milan Broz wrote:
> misc-utils/lsblk.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-07-31 8:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-30 14:18 [PATCH] lsblk: Display mountpoint even for top-level device Milan Broz
2015-07-31 8:47 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox