summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2003-02-13 01:00:26 +0000
committerpeter <peter@FreeBSD.org>2003-02-13 01:00:26 +0000
commit685d2ff0d7fa722fef55d3eae4140f73fa827510 (patch)
tree47bfdb86239e93b24c71f6864bae56df9fb65ec7 /sbin
parent946eac9366509b6c6dd690b9b601e8d63b7ddcc8 (diff)
downloadFreeBSD-src-685d2ff0d7fa722fef55d3eae4140f73fa827510.zip
FreeBSD-src-685d2ff0d7fa722fef55d3eae4140f73fa827510.tar.gz
Show the paritition types that we recognize in human readable format. eg:
pluto2# gpt show da0 start end size contents 0 0 1 PMBR 1 1 1 Pri GPT header 2 33 32 Pri GPT table 34 401595 401562 GPT part - EFI System partition 401596 925883 524288 GPT part - FreeBSD ufs partition 925884 9314491 8388608 GPT part - FreeBSD swap partition ... It'll print a plain uuid string for unrecognized types.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/gpt/show.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/sbin/gpt/show.c b/sbin/gpt/show.c
index 3e9ebc8..6acfbe0 100644
--- a/sbin/gpt/show.c
+++ b/sbin/gpt/show.c
@@ -49,6 +49,33 @@ usage_show(void)
exit(1);
}
+static const char *
+friendly(uuid_t *t)
+{
+ uuid_t efi_slice = GPT_ENT_TYPE_EFI;
+ uuid_t freebsd = GPT_ENT_TYPE_FREEBSD;
+ uuid_t swap = GPT_ENT_TYPE_FREEBSD_SWAP;
+ uuid_t ufs = GPT_ENT_TYPE_FREEBSD_UFS;
+ uuid_t vinum = GPT_ENT_TYPE_FREEBSD_VINUM;
+ static char buf[80];
+ char *s;
+
+ if (memcmp(t, &efi_slice, sizeof(uuid_t)) == 0)
+ return "EFI System partition";
+ else if (memcmp(t, &freebsd, sizeof(uuid_t)) == 0)
+ return "FreeBSD disklabel container";
+ else if (memcmp(t, &swap, sizeof(uuid_t)) == 0)
+ return "FreeBSD swap partition";
+ else if (memcmp(t, &ufs, sizeof(uuid_t)) == 0)
+ return "FreeBSD ufs partition";
+ else if (memcmp(t, &vinum, sizeof(uuid_t)) == 0)
+ return "FreeBSD vinum partition";
+ uuid_to_string(t, &s, NULL);
+ strlcpy(buf, s, sizeof buf);
+ free(s);
+ return buf;
+}
+
static void
show(int fd __unused)
{
@@ -56,7 +83,6 @@ show(int fd __unused)
map_t *m, *p;
struct mbr *mbr;
struct gpt_ent *ent;
- char *s;
unsigned int i;
printf(" %*s", lbawidth, "start");
@@ -107,9 +133,7 @@ show(int fd __unused)
case MAP_TYPE_GPT_PART:
printf("GPT part ");
ent = m->map_data;
- uuid_to_string(&ent->ent_type, &s, NULL);
- printf("%s", s);
- free(s);
+ printf("- %s", friendly(&ent->ent_type));
break;
case MAP_TYPE_PMBR:
printf("PMBR");
OpenPOWER on IntegriCloud