diff options
author | Karel Zak | 2014-03-07 11:14:46 +0100 |
---|---|---|
committer | Karel Zak | 2014-03-07 11:14:46 +0100 |
commit | 5a2fd9329ed090795ded44e9d90b0c393b3d01c7 (patch) | |
tree | 9f62c378b5726f97d00ee2574ceccf4878e9c731 /misc-utils/lsblk.c | |
parent | libmount: add statfs_magic.h (diff) | |
download | kernel-qcow2-util-linux-5a2fd9329ed090795ded44e9d90b0c393b3d01c7.tar.gz kernel-qcow2-util-linux-5a2fd9329ed090795ded44e9d90b0c393b3d01c7.tar.xz kernel-qcow2-util-linux-5a2fd9329ed090795ded44e9d90b0c393b3d01c7.zip |
lsblk: add PARTFLAGS column
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/lsblk.c')
-rw-r--r-- | misc-utils/lsblk.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 706153195..88fb2dc42 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -74,6 +74,7 @@ enum { COL_PARTTYPE, COL_PARTLABEL, COL_PARTUUID, + COL_PARTFLAGS, COL_RA, COL_RO, COL_RM, @@ -129,6 +130,7 @@ static struct colinfo infos[] = { [COL_PARTTYPE] = { "PARTTYPE", 36, 0, N_("partition type UUID") }, [COL_PARTLABEL] = { "PARTLABEL", 0.1, 0, N_("partition LABEL") }, [COL_PARTUUID] = { "PARTUUID", 36, 0, N_("partition UUID") }, + [COL_PARTFLAGS] = { "PARTFLAGS", 36, 0, N_("partition flags") }, [COL_RA] = { "RA", 3, TT_FL_RIGHT, N_("read-ahead of the device") }, [COL_RO] = { "RO", 1, TT_FL_RIGHT, N_("read-only device") }, @@ -213,6 +215,7 @@ struct blkdev_cxt { char *parttype; /* partiton type UUID */ char *partuuid; /* partition UUID */ char *partlabel; /* partiton label */ + char *partflags; /* partition flags */ char *wwn; /* storage WWN */ char *serial; /* disk serial number */ @@ -449,6 +452,8 @@ static int get_udev_properties(struct blkdev_cxt *cxt) cxt->parttype = xstrdup(data); if ((data = udev_device_get_property_value(dev, "ID_PART_ENTRY_UUID"))) cxt->partuuid = xstrdup(data); + if ((data = udev_device_get_property_value(dev, "ID_PART_ENTRY_FLAGS"))) + cxt->partflags = xstrdup(data); if ((data = udev_device_get_property_value(dev, "ID_WWN"))) cxt->wwn = xstrdup(data); if ((data = udev_device_get_property_value(dev, "ID_SERIAL_SHORT"))) @@ -508,7 +513,8 @@ static void probe_device(struct blkdev_cxt *cxt) cxt->partuuid = xstrdup(data); if (!blkid_probe_lookup_value(pr, "PART_ENTRY_NAME", &data, NULL)) cxt->partlabel = xstrdup(data); - + if (!blkid_probe_lookup_value(pr, "PART_ENTRY_FLAGS", &data, NULL)) + cxt->partflags = xstrdup(data); } blkid_free_probe(pr); @@ -777,6 +783,11 @@ static void set_tt_data(struct blkdev_cxt *cxt, int col, int id, struct tt_line if (cxt->partuuid) tt_line_set_data(ln, col, xstrdup(cxt->partuuid)); break; + case COL_PARTFLAGS: + probe_device(cxt); + if (cxt->partflags) + tt_line_set_data(ln, col, xstrdup(cxt->partflags)); + break; case COL_WWN: get_udev_properties(cxt); if (cxt->wwn) |