path: root/sys/sys/uuid.h
diff options
authorKyle Evans <kevans@FreeBSD.org>2020-04-15 18:39:12 +0000
committerKyle Evans <kevans@FreeBSD.org>2020-04-15 18:39:12 +0000
commit3fb92d4cb104eb6903a1a808e892ba46c1834e31 (patch)
treedcaf22a8d806dab98f95d108ca1d7d11236e66d7 /sys/sys/uuid.h
parentbfe26b9707b642458ff8a8bb4c8d8ad71450f13c (diff)
validate_uuid: absorb the rest of parse_uuid with a flags arg
This makes the naming annoyance (validate_uuid vs. parse_uuid) less of an issue and centralizes all of the functionality into the new KPI while still making the extra validation optional. The end-result is all the same as far as hostuuid validation-only goes.
Notes: svn path=/head/; revision=359980
Diffstat (limited to 'sys/sys/uuid.h')
1 files changed, 10 insertions, 12 deletions
diff --git a/sys/sys/uuid.h b/sys/sys/uuid.h
index 9f0ea3d70fd4..95050d0f8d20 100644
--- a/sys/sys/uuid.h
+++ b/sys/sys/uuid.h
@@ -68,20 +68,18 @@ int printf_uuid(struct uuid *);
int sbuf_printf_uuid(struct sbuf *, struct uuid *);
- * There are a few key differences between validate_uuid and parse_uuid:
- *
- * - The struct uuid * parameter to validate_uuid is optional, so the caller
- * can simply validate UUID format without doing anything with the result.
- * - validate_uuid will not pass an empty string as a valid UUID, as it doesn't
- * strictly meet the formatting requirements. parse_uuid will accept an
- * empty string and zero out the uuid struct accordingly.
- * - parse_uuid does additional semantic checks on clock_seq_hi_and_reserved
- * that validate_uuid will not do.
- *
- * validate_uuid is intended to strictly check that it's a well-formed uuid.
+ * validate_uuid will, with no flags passed, validate only the format of the
+ * passed in UUID. Flags below are available to give it part of or all of the
+ * functionality that parse_uuid has traditionally had: acknowledging an empty
+ * string as valid, and checking the semantics of the UUID as well.
-int validate_uuid(const char *, size_t, struct uuid *);
+int validate_uuid(const char *, size_t, struct uuid *, int);
int parse_uuid(const char *, struct uuid *);
+/* Flags to validate_uuid(). */
+#define VUUIDF_EMPTYOK 0x0001
int uuidcmp(const struct uuid *, const struct uuid *);
void be_uuid_dec(void const *buf, struct uuid *uuid);