]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsblk: Add revision column
authorMilan Broz <mbroz@redhat.com>
Fri, 2 Nov 2012 17:56:29 +0000 (18:56 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 7 Nov 2012 12:20:26 +0000 (13:20 +0100)
Signed-off-by: Milan Broz <mbroz@redhat.com>
misc-utils/lsblk.c

index c57e78f1f84db44d48f4a8cf0f68706cdc280669..671d91295d10b422ed5e3bb7b7e3c053759a987b 100644 (file)
@@ -100,6 +100,7 @@ enum {
        COL_PKNAME,
        COL_HCTL,
        COL_TRANSPORT,
+       COL_REV,
 };
 
 /* column names */
@@ -150,6 +151,7 @@ static struct colinfo infos[] = {
        [COL_WWN]    = { "WWN",     18, 0, N_("unique storage identifier") },
        [COL_HCTL]   = { "HCTL", 10, 0, N_("Host:Channel:Target:Lun for SCSI") },
        [COL_TRANSPORT] = { "TRAN", 6, 0, N_("device transport type") },
+       [COL_REV]    = { "REV",   4, TT_FL_RIGHT, N_("device revision") },
 };
 
 struct lsblk {
@@ -766,6 +768,13 @@ static void set_tt_data(struct blkdev_cxt *cxt, int col, int id, struct tt_line
                                tt_line_set_data(ln, col, p);
                }
                break;
+       case COL_REV:
+               if (!cxt->partition && cxt->nslaves == 0) {
+                       p = sysfs_strdup(&cxt->sysfs, "device/rev");
+                       if (p)
+                               tt_line_set_data(ln, col, p);
+               }
+               break;
        case COL_SIZE:
                if (cxt->size) {
                        if (lsblk->bytes) {