aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2004-08-02 19:28:03 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2004-08-02 19:28:03 +0000
commit2ef70adc0cc443e0ae7e74e2320f6fd2afb8ef71 (patch)
tree1fde3cebf6a74dfc457bd5b0940a07028d4df8ee /sbin
parent814db82be5c5994a232beb382fc86af2e7e0881e (diff)
downloadsrc-2ef70adc0cc443e0ae7e74e2320f6fd2afb8ef71.tar.gz
src-2ef70adc0cc443e0ae7e74e2320f6fd2afb8ef71.zip
Add Linux swap partition and MS reserved partition descriptions.
While here: o Make the UUIDs static to avoid runtime initialization, o Rename ext to mslinux, o Replace the use of memcmp() with uuid_equal(), o Various style(9) improvements, o Order the comparisons based on importance, o Remove the word partition from all the descriptions, o Other description improvements. Includes patch from: T. Muthu Mohan < Muthu_T at dell dot com >
Notes
Notes: svn path=/head/; revision=133031
Diffstat (limited to 'sbin')
-rw-r--r--sbin/gpt/show.c46
1 files changed, 27 insertions, 19 deletions
diff --git a/sbin/gpt/show.c b/sbin/gpt/show.c
index 117cd9bca168..d5c449d987fe 100644
--- a/sbin/gpt/show.c
+++ b/sbin/gpt/show.c
@@ -52,31 +52,39 @@ usage_show(void)
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;
- uuid_t ext = GPT_ENT_TYPE_MS_BASIC_DATA;
+ static uuid_t efi_slice = GPT_ENT_TYPE_EFI;
+ static uuid_t mslinux = GPT_ENT_TYPE_MS_BASIC_DATA;
+ static uuid_t freebsd = GPT_ENT_TYPE_FREEBSD;
+ static uuid_t linuxswap = GPT_ENT_TYPE_LINUX_SWAP;
+ static uuid_t msr = GPT_ENT_TYPE_MS_RESERVED;
+ static uuid_t swap = GPT_ENT_TYPE_FREEBSD_SWAP;
+ static uuid_t ufs = GPT_ENT_TYPE_FREEBSD_UFS;
+ static 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";
- else if (memcmp(t, &ext, sizeof(uuid_t)) == 0)
- return "Linux/Windows";
+ if (uuid_equal(t, &efi_slice, NULL))
+ return ("EFI System");
+ if (uuid_equal(t, &swap, NULL))
+ return ("FreeBSD swap");
+ if (uuid_equal(t, &ufs, NULL))
+ return ("FreeBSD UFS/UFS2");
+ if (uuid_equal(t, &vinum, NULL))
+ return ("FreeBSD vinum");
+
+ if (uuid_equal(t, &freebsd, NULL))
+ return ("FreeBSD legacy");
+ if (uuid_equal(t, &mslinux, NULL))
+ return ("Linux/Windows");
+ if (uuid_equal(t, &linuxswap, NULL))
+ return ("Linux swap");
+ if (uuid_equal(t, &msr, NULL))
+ return ("Windows reserved");
+
uuid_to_string(t, &s, NULL);
strlcpy(buf, s, sizeof buf);
free(s);
- return buf;
+ return (buf);
}
static void