aboutsummaryrefslogtreecommitdiff
path: root/sbin/gpt
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2002-11-02 07:08:15 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2002-11-02 07:08:15 +0000
commitc1fd52ba742fe5d4b1e4252a174631a5d8252182 (patch)
treeeb56da074b111610275e0d94879c4ab06af6e5cd /sbin/gpt
parenta7f7dbc84a4cc90106ffc662bc21210d86b3c01c (diff)
downloadsrc-c1fd52ba742fe5d4b1e4252a174631a5d8252182.tar.gz
src-c1fd52ba742fe5d4b1e4252a174631a5d8252182.zip
o Remove the fallback implementations of uuid_create(),
uuid_from_string(), uuid_is_nil() and uuid_to_string(). o Include <uuid.h> where appropriate.
Notes
Notes: svn path=/head/; revision=106331
Diffstat (limited to 'sbin/gpt')
-rw-r--r--sbin/gpt/add.c1
-rw-r--r--sbin/gpt/create.c1
-rw-r--r--sbin/gpt/gpt.c58
-rw-r--r--sbin/gpt/gpt.h11
-rw-r--r--sbin/gpt/migrate.c1
-rw-r--r--sbin/gpt/show.c1
6 files changed, 5 insertions, 68 deletions
diff --git a/sbin/gpt/add.c b/sbin/gpt/add.c
index 3423918f9f56..64cdbea0341e 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 b2904f61e968..834d7ecfcf37 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 18156e8fff07..4ada0b62a2bd 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 a670b32f3790..4aa8666cba01 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 97e1f6a281fc..fb5d5fbe13e6 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 8b651b7e0d40..c12c117a64cb 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"