]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsblk: remove (dm-N) from NAME for raw/pair output format
authorKarel Zak <kzak@redhat.com>
Wed, 7 Mar 2012 12:11:54 +0000 (13:11 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 7 Mar 2012 12:11:54 +0000 (13:11 +0100)
 $ lsblk -P -o NAME /dev/dm-0
 NAME="luks-10d813de-fa82-4f67-a86c-23d5d0e7c30e (dm-0)"

the (dm-0) sucks in the parsable output...

Reported-by: Peter Rajnoha <prajnoha@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/lsblk.c

index f33696a83fbcf4523a3e60c73737f85e35b71285..52833d6747885cbe16b7607715323242a120416b 100644 (file)
@@ -478,9 +478,14 @@ static void set_tt_data(struct blkdev_cxt *cxt, int col, int id, struct tt_line
        switch(id) {
        case COL_NAME:
                if (cxt->dm_name) {
-                       snprintf(buf, sizeof(buf), "%s (%s)",
+                       if ((lsblk->tt->flags & TT_FL_RAW) ||
+                           (lsblk->tt->flags & TT_FL_EXPORT))
+                               tt_line_set_data(ln, col, xstrdup(cxt->dm_name));
+                       else {
+                               snprintf(buf, sizeof(buf), "%s (%s)",
                                        cxt->dm_name, cxt->name);
-                       tt_line_set_data(ln, col, xstrdup(buf));
+                               tt_line_set_data(ln, col, xstrdup(buf));
+                       }
                        break;
                }
        case COL_KNAME: