From: Karel Zak Date: Tue, 2 Dec 2014 10:09:04 +0000 (+0100) Subject: lsblk: add HOTPLUG column X-Git-Tag: v2.26-rc1~155 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=483987c275e461f4118a89d3be013698845d702b;p=thirdparty%2Futil-linux.git lsblk: add HOTPLUG column Signed-off-by: Karel Zak --- diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index a87d997eb3..ba2e03ad3d 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -78,6 +78,7 @@ enum { COL_RA, COL_RO, COL_RM, + COL_HOTPLUG, COL_MODEL, COL_SERIAL, COL_SIZE, @@ -105,7 +106,7 @@ enum { COL_HCTL, COL_TRANSPORT, COL_REV, - COL_VENDOR, + COL_VENDOR }; /* basic table settings */ @@ -151,6 +152,7 @@ static struct colinfo infos[] = { [COL_RA] = { "RA", 3, SCOLS_FL_RIGHT, N_("read-ahead of the device"), SORT_U64 }, [COL_RO] = { "RO", 1, SCOLS_FL_RIGHT, N_("read-only device") }, [COL_RM] = { "RM", 1, SCOLS_FL_RIGHT, N_("removable device") }, + [COL_HOTPLUG]= { "HOTPLUG", 1, SCOLS_FL_RIGHT, N_("removable or hotplug device (usb, pcmcia, ...)") }, [COL_ROTA] = { "ROTA", 1, SCOLS_FL_RIGHT, N_("rotational device") }, [COL_RAND] = { "RAND", 1, SCOLS_FL_RIGHT, N_("adds randomness") }, [COL_MODEL] = { "MODEL", 0.1, SCOLS_FL_TRUNC, N_("device identifier") }, @@ -890,6 +892,9 @@ static void set_scols_data(struct blkdev_cxt *cxt, int col, int id, struct libsc if (!str && cxt->sysfs.parent) str = sysfs_strdup(cxt->sysfs.parent, "removable"); break; + case COL_HOTPLUG: + str = sysfs_is_hotpluggable(&cxt->sysfs) ? xstrdup("1") : xstrdup("0"); + break; case COL_ROTA: str = sysfs_strdup(&cxt->sysfs, "queue/rotational"); break;