[PATCH 2/3] lsblk: Add vendor column

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Milan Broz <mbroz@xxxxxxxxxx>
---
 misc-utils/lsblk.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index 671d912..f8bc6ea 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -101,6 +101,7 @@ enum {
 	COL_HCTL,
 	COL_TRANSPORT,
 	COL_REV,
+	COL_VENDOR,
 };
 
 /* column names */
@@ -152,6 +153,7 @@ static struct colinfo infos[] = {
 	[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") },
+	[COL_VENDOR] = { "VENDOR", 0.1, TT_FL_TRUNC, N_("device vendor") },
 };
 
 struct lsblk {
@@ -775,6 +777,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_VENDOR:
+		if (!cxt->partition && cxt->nslaves == 0) {
+			p = sysfs_strdup(&cxt->sysfs, "device/vendor");
+			if (p)
+				tt_line_set_data(ln, col, p);
+		}
+		break;
 	case COL_SIZE:
 		if (cxt->size) {
 			if (lsblk->bytes) {
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux