[ovs-dev] [PATCH 11/13] uuid: New function uuid_random().

Ben Pfaff blp at ovn.org
Sat Oct 7 00:44:56 UTC 2017


Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 lib/uuid.c | 8 ++++++++
 lib/uuid.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/lib/uuid.c b/lib/uuid.c
index 06f8792592d2..13d20ac64977 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -101,6 +101,14 @@ uuid_generate(struct uuid *uuid)
     uuid_set_bits_v4(uuid);
 }
 
+struct uuid
+uuid_random(void)
+{
+    struct uuid uuid;
+    uuid_generate(&uuid);
+    return uuid;
+}
+
 void
 uuid_set_bits_v4(struct uuid *uuid)
 {
diff --git a/lib/uuid.h b/lib/uuid.h
index 10bc8b541bac..dba6e1c11ea1 100644
--- a/lib/uuid.h
+++ b/lib/uuid.h
@@ -59,6 +59,7 @@ uuid_equals(const struct uuid *a, const struct uuid *b)
 
 void uuid_init(void);
 void uuid_generate(struct uuid *);
+struct uuid uuid_random(void);
 void uuid_zero(struct uuid *);
 bool uuid_is_zero(const struct uuid *);
 int uuid_compare_3way(const struct uuid *, const struct uuid *);
-- 
2.10.2



More information about the dev mailing list