diff options
| author | Karel Zak <kzak@redhat.com> | 2019-12-04 12:38:57 +0100 |
|---|---|---|
| committer | Karel Zak <kzak@redhat.com> | 2019-12-04 12:38:57 +0100 |
| commit | 107e95594642b96cde430229095edcacb81dfa2f (patch) | |
| tree | 895a8e20e067e2af3440fbc7c12dbe40cddd2a34 /misc-utils/lsblk.c | |
| parent | 96c2b09fcba374457c75412156e3fb86ed53de66 (diff) | |
| download | util-linux-107e95594642b96cde430229095edcacb81dfa2f.tar.gz | |
lsblk: add PARTTYPENAME column
Print also partition type in human-readable way.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1777261
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 cd9f1f823d..441655e249 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -79,6 +79,7 @@ enum { COL_PTUUID, COL_PTTYPE, COL_PARTTYPE, + COL_PARTTYPENAME, COL_PARTLABEL, COL_PARTUUID, COL_PARTFLAGS, @@ -168,7 +169,8 @@ static struct colinfo infos[] = { [COL_PTUUID] = { "PTUUID", 36, 0, N_("partition table identifier (usually UUID)") }, [COL_PTTYPE] = { "PTTYPE", 0.1, 0, N_("partition table type") }, - [COL_PARTTYPE] = { "PARTTYPE", 36, 0, N_("partition type UUID") }, + [COL_PARTTYPE] = { "PARTTYPE", 36, 0, N_("partition type code or UUID") }, + [COL_PARTTYPENAME] = { "PARTTYPENAME", 0.1, 0, N_("partition type name") }, [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") }, @@ -826,6 +828,15 @@ static char *device_get_data( if (prop && prop->parttype) str = xstrdup(prop->parttype); break; + case COL_PARTTYPENAME: + prop = lsblk_device_get_properties(dev); + if (prop && prop->parttype && prop->pttype) { + const char *x = lsblk_parttype_code_to_string( + prop->parttype, prop->pttype); + if (x) + str = xstrdup(x); + } + break; case COL_PARTLABEL: prop = lsblk_device_get_properties(dev); if (prop && prop->partlabel) |
