diff options
author | Karel Zak | 2012-09-25 10:23:36 +0200 |
---|---|---|
committer | Karel Zak | 2012-09-27 13:38:13 +0200 |
commit | 559d921edad8be1ec4e2837095b327eb9e297b7a (patch) | |
tree | 0ff49ebac62e3782401dc4de5f9f892e6dd0873e /fdisks/fdisksunlabel.c | |
parent | fdisk: improve list partition types (diff) | |
download | kernel-qcow2-util-linux-559d921edad8be1ec4e2837095b327eb9e297b7a.tar.gz kernel-qcow2-util-linux-559d921edad8be1ec4e2837095b327eb9e297b7a.tar.xz kernel-qcow2-util-linux-559d921edad8be1ec4e2837095b327eb9e297b7a.zip |
fdisk: add new functions for work with fdisk_parttype
- add flags to fdisk_parttype to store more information about the types
- function for conversion from code to fdisk_parttype
- function for conversion from string to fdisk_parttype
- function for conversion from user input to fdisk_parttype
- support for unknown complex types (e.g. unknown UUIDs)
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisks/fdisksunlabel.c')
-rw-r--r-- | fdisks/fdisksunlabel.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fdisks/fdisksunlabel.c b/fdisks/fdisksunlabel.c index 7ec2d5783..acc280842 100644 --- a/fdisks/fdisksunlabel.c +++ b/fdisks/fdisksunlabel.c @@ -538,7 +538,6 @@ int sun_change_sysid(struct fdisk_context *cxt, int i, uint16_t sys) void sun_list_table(struct fdisk_context *cxt, int xtra) { int i, w; - char *type; w = strlen(cxt->dev_path); if (xtra) @@ -573,6 +572,8 @@ void sun_list_table(struct fdisk_context *cxt, int xtra) if (part->num_sectors) { uint32_t start = SSWAP32(part->start_cylinder) * cxt->geom.heads * cxt->geom.sectors; uint32_t len = SSWAP32(part->num_sectors); + struct fdisk_parttype *t = fdisk_get_parttype_from_code(cxt, SSWAP16(tag->tag)); + printf( "%s %c%c %9lu %9lu %9lu%c %2x %s\n", /* device */ partname(cxt->dev_path, i+1, w), @@ -582,8 +583,7 @@ void sun_list_table(struct fdisk_context *cxt, int xtra) /* end */ (unsigned long) scround(start+len), /* odd flag on end */ (unsigned long) len / 2, len & 1 ? '+' : ' ', /* type id */ SSWAP16(tag->tag), -/* type name */ (type = partition_type(cxt, SSWAP16(tag->tag))) - ? type : _("Unknown")); +/* type name */ t ? t->name : _("Unknown")); } } } @@ -653,6 +653,7 @@ const struct fdisk_label sun_label = { .name = "sun", .parttypes = sun_parttypes, + .nparttypes = ARRAY_SIZE(sun_parttypes), .probe = sun_probe_label, .write = sun_write_disklabel, |