util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Milan Broz <mbroz@redhat.com>
To: util-linux@vger.kernel.org
Cc: Milan Broz <mbroz@redhat.com>
Subject: [PATCH 2/3] lsblk: Add vendor column
Date: Fri,  2 Nov 2012 18:56:30 +0100	[thread overview]
Message-ID: <1351878991-3472-2-git-send-email-mbroz@redhat.com> (raw)
In-Reply-To: <1351878991-3472-1-git-send-email-mbroz@redhat.com>

Signed-off-by: Milan Broz <mbroz@redhat.com>
---
 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


  reply	other threads:[~2012-11-02 17:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-02 17:56 [PATCH 1/3] lsblk: Add revision column Milan Broz
2012-11-02 17:56 ` Milan Broz [this message]
2012-11-02 17:56 ` [PATCH 3/3] lsblk: Add --scsi switch Milan Broz
2012-11-07 16:43 ` [PATCH 1/3] lsblk: Add revision column 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=1351878991-3472-2-git-send-email-mbroz@redhat.com \
    --to=mbroz@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).