summaryrefslogtreecommitdiffstats
path: root/misc-utils/lsblk.c
diff options
context:
space:
mode:
authorMichael Marineau2014-01-14 22:19:50 +0100
committerKarel Zak2014-02-10 10:47:21 +0100
commit4686ba17a8239d9a840a901abf780c4ea02ea1f9 (patch)
treea69ca918bbf03ee38d92b435d36285b3fe37e29f /misc-utils/lsblk.c
parenttests: automatic whitespace trimming broke earlier commit (diff)
downloadkernel-qcow2-util-linux-4686ba17a8239d9a840a901abf780c4ea02ea1f9.tar.gz
kernel-qcow2-util-linux-4686ba17a8239d9a840a901abf780c4ea02ea1f9.tar.xz
kernel-qcow2-util-linux-4686ba17a8239d9a840a901abf780c4ea02ea1f9.zip
lsblk: add PARTTYPE tag
To stay in sync with blkid add PARTTYPE as an available output column.
Diffstat (limited to 'misc-utils/lsblk.c')
-rw-r--r--misc-utils/lsblk.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index 9b53be35d..706153195 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -71,6 +71,7 @@ enum {
COL_TARGET,
COL_LABEL,
COL_UUID,
+ COL_PARTTYPE,
COL_PARTLABEL,
COL_PARTUUID,
COL_RA,
@@ -125,6 +126,7 @@ static struct colinfo infos[] = {
[COL_LABEL] = { "LABEL", 0.1, 0, N_("filesystem LABEL") },
[COL_UUID] = { "UUID", 36, 0, N_("filesystem UUID") },
+ [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") },
@@ -208,6 +210,7 @@ struct blkdev_cxt {
char *fstype; /* detected fs, NULL or "?" if cannot detect */
char *uuid; /* filesystem UUID (or stack uuid) */
char *label; /* filesystem label */
+ char *parttype; /* partiton type UUID */
char *partuuid; /* partition UUID */
char *partlabel; /* partiton label */
char *wwn; /* storage WWN */
@@ -291,6 +294,7 @@ static void reset_blkdev_cxt(struct blkdev_cxt *cxt)
free(cxt->fstype);
free(cxt->uuid);
free(cxt->label);
+ free(cxt->parttype);
free(cxt->partuuid);
free(cxt->partlabel);
free(cxt->wwn);
@@ -441,6 +445,8 @@ static int get_udev_properties(struct blkdev_cxt *cxt)
}
if ((data = udev_device_get_property_value(dev, "ID_FS_TYPE")))
cxt->fstype = xstrdup(data);
+ if ((data = udev_device_get_property_value(dev, "ID_PART_ENTRY_TYPE")))
+ 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_WWN")))
@@ -496,6 +502,8 @@ static void probe_device(struct blkdev_cxt *cxt)
cxt->uuid = xstrdup(data);
if (!blkid_probe_lookup_value(pr, "LABEL", &data, NULL))
cxt->label = xstrdup(data);
+ if (!blkid_probe_lookup_value(pr, "PART_ENTRY_TYPE", &data, NULL))
+ cxt->parttype = xstrdup(data);
if (!blkid_probe_lookup_value(pr, "PART_ENTRY_UUID", &data, NULL))
cxt->partuuid = xstrdup(data);
if (!blkid_probe_lookup_value(pr, "PART_ENTRY_NAME", &data, NULL))
@@ -752,6 +760,11 @@ static void set_tt_data(struct blkdev_cxt *cxt, int col, int id, struct tt_line
if (cxt->uuid)
tt_line_set_data(ln, col, xstrdup(cxt->uuid));
break;
+ case COL_PARTTYPE:
+ probe_device(cxt);
+ if (cxt->parttype)
+ tt_line_set_data(ln, col, xstrdup(cxt->parttype));
+ break;
case COL_PARTLABEL:
probe_device(cxt);
if (!cxt->partlabel)