diff options
author | marcel <marcel@FreeBSD.org> | 2004-08-02 19:28:03 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2004-08-02 19:28:03 +0000 |
commit | d445c537c00e0d4353f28cfb89b0e1fef90c207f (patch) | |
tree | 1fde3cebf6a74dfc457bd5b0940a07028d4df8ee | |
parent | 7d35c7a3e746baf0c8cef3c49df098ee8cb50708 (diff) | |
download | FreeBSD-src-d445c537c00e0d4353f28cfb89b0e1fef90c207f.zip FreeBSD-src-d445c537c00e0d4353f28cfb89b0e1fef90c207f.tar.gz |
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 >
-rw-r--r-- | sbin/gpt/show.c | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/sbin/gpt/show.c b/sbin/gpt/show.c index 117cd9b..d5c449d 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 |