]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsblk: Display mountpoint even for top-level device
authorMilan Broz <gmazyland@gmail.com>
Thu, 30 Jul 2015 14:18:28 +0000 (16:18 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 31 Jul 2015 08:44:57 +0000 (10:44 +0200)
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

index cfd304a7e1125b9ebeda4702a212dfdc00df5f15..4cfeef890bb4c2795e2c4df774b67e1e82bb2e24 100644 (file)
@@ -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);