All of lore.kernel.org
 help / color / mirror / Atom feed
From: Milan Broz <gmazyland@gmail.com>
To: util-linux@vger.kernel.org
Cc: Milan Broz <gmazyland@gmail.com>
Subject: [PATCH] lsblk: Display mountpoint even for top-level device
Date: Thu, 30 Jul 2015 16:18:28 +0200	[thread overview]
Message-ID: <1438265908-4603-1-git-send-email-gmazyland@gmail.com> (raw)

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


             reply	other threads:[~2015-07-30 14:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-30 14:18 Milan Broz [this message]
2015-07-31  8:47 ` [PATCH] lsblk: Display mountpoint even for top-level device Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1438265908-4603-1-git-send-email-gmazyland@gmail.com \
    --to=gmazyland@gmail.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.