diff options
author | marcel <marcel@FreeBSD.org> | 2002-11-02 07:08:15 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2002-11-02 07:08:15 +0000 |
commit | 31c989afa3922a58dd8729950e9958b50702b723 (patch) | |
tree | eb56da074b111610275e0d94879c4ab06af6e5cd /sbin/gpt | |
parent | 1e67f1b1da96606fe4b70253018584632058c90a (diff) | |
download | FreeBSD-src-31c989afa3922a58dd8729950e9958b50702b723.zip FreeBSD-src-31c989afa3922a58dd8729950e9958b50702b723.tar.gz |
o Remove the fallback implementations of uuid_create(),
uuid_from_string(), uuid_is_nil() and uuid_to_string().
o Include <uuid.h> where appropriate.
Diffstat (limited to 'sbin/gpt')
-rw-r--r-- | sbin/gpt/add.c | 1 | ||||
-rw-r--r-- | sbin/gpt/create.c | 1 | ||||
-rw-r--r-- | sbin/gpt/gpt.c | 58 | ||||
-rw-r--r-- | sbin/gpt/gpt.h | 11 | ||||
-rw-r--r-- | sbin/gpt/migrate.c | 1 | ||||
-rw-r--r-- | sbin/gpt/show.c | 1 |
6 files changed, 5 insertions, 68 deletions
diff --git a/sbin/gpt/add.c b/sbin/gpt/add.c index 3423918..64cdbea 100644 --- a/sbin/gpt/add.c +++ b/sbin/gpt/add.c @@ -37,6 +37,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <uuid.h> #include "map.h" #include "gpt.h" diff --git a/sbin/gpt/create.c b/sbin/gpt/create.c index b2904f6..834d7ec 100644 --- a/sbin/gpt/create.c +++ b/sbin/gpt/create.c @@ -36,6 +36,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <uuid.h> #include "map.h" #include "gpt.h" diff --git a/sbin/gpt/gpt.c b/sbin/gpt/gpt.c index 18156e8..4ada0b6 100644 --- a/sbin/gpt/gpt.c +++ b/sbin/gpt/gpt.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <uuid.h> #include "map.h" #include "gpt.h" @@ -127,63 +128,6 @@ unicode16(short *dst, const wchar_t *src, size_t len) *dst = 0; } -#ifdef NEED_UUID_FUNCTIONS -void -uuid_create(uuid_t *u, uint32_t *st __unused) -{ - uuidgen(u, 1); -} - -void -uuid_from_string(const char *s, uuid_t *u, uint32_t *st) -{ - int n; - - *st = uuid_s_invalid_string_uuid; - - if (strlen(s) != 36 || s[8] != '-') - return; - - n = sscanf(s, - "%8x-%4hx-%4hx-%2hhx%2hhx-%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx", - &u->time_low, &u->time_mid, &u->time_hi_and_version, - &u->clock_seq_hi_and_reserved, &u->clock_seq_low, &u->node[0], - &u->node[1], &u->node[2], &u->node[3], &u->node[4], &u->node[5]); - - if (n != 11) - return; - - n = u->clock_seq_hi_and_reserved; - if ((n & 0x80) != 0x00 && /* variant 0? */ - (n & 0xc0) != 0x80 && /* variant 1? */ - (n & 0xe0) != 0xc0) /* variant 2? */ - *st = uuid_s_bad_version; - else - *st = uuid_s_ok; -} - -int32_t -uuid_is_nil(uuid_t *u, uint32_t *st __unused) -{ - uint32_t *p; - - p = (uint32_t*)u; - return ((p[0] == 0 && p[1] == 0 && p[2] == 0 && p[3] == 0) ? 1 : 0); -} - -void -uuid_to_string(uuid_t *u, char **s, uint32_t *st __unused) -{ - char buf[40]; - - sprintf(buf, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - u->time_low, u->time_mid, u->time_hi_and_version, - u->clock_seq_hi_and_reserved, u->clock_seq_low, u->node[0], - u->node[1], u->node[2], u->node[3], u->node[4], u->node[5]); - *s = strdup(buf); -} -#endif - void* gpt_read(int fd, off_t lba, size_t count) { diff --git a/sbin/gpt/gpt.h b/sbin/gpt/gpt.h index a670b32..4aa8666 100644 --- a/sbin/gpt/gpt.h +++ b/sbin/gpt/gpt.h @@ -51,17 +51,6 @@ struct mbr { #define MBR_SIG 0xAA55 }; -#ifndef uuid_s_ok -#define NEED_UUID_FUNCTIONS -#define uuid_s_ok 0 -#define uuid_s_bad_version 1 -#define uuid_s_invalid_string_uuid 2 -void uuid_create(uuid_t *, uint32_t *); -void uuid_from_string(const char *, uuid_t *, uint32_t *); -int32_t uuid_is_nil(uuid_t *, uint32_t *); -void uuid_to_string(uuid_t *, char **, uint32_t *); -#endif - extern char device_name[]; extern off_t mediasz; extern u_int parts; diff --git a/sbin/gpt/migrate.c b/sbin/gpt/migrate.c index 97e1f6a..fb5d5fb 100644 --- a/sbin/gpt/migrate.c +++ b/sbin/gpt/migrate.c @@ -37,6 +37,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <uuid.h> #include "map.h" #include "gpt.h" diff --git a/sbin/gpt/show.c b/sbin/gpt/show.c index 8b651b7..c12c117 100644 --- a/sbin/gpt/show.c +++ b/sbin/gpt/show.c @@ -36,6 +36,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <uuid.h> #include "map.h" #include "gpt.h" |