diff mbox series

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

Message ID 20171007004458.5788-12-blp@ovn.org
State Accepted
Headers show
Series clustering implementation, part 1 | expand

Commit Message

Ben Pfaff Oct. 7, 2017, 12:44 a.m. UTC
Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 lib/uuid.c | 8 ++++++++
 lib/uuid.h | 1 +
 2 files changed, 9 insertions(+)

Comments

Russell Bryant Oct. 9, 2017, 8:04 p.m. UTC | #1
On Fri, Oct 6, 2017 at 8:44 PM, Ben Pfaff <blp@ovn.org> wrote:
> Signed-off-by: Ben Pfaff <blp@ovn.org>
> ---
>  lib/uuid.c | 8 ++++++++
>  lib/uuid.h | 1 +
>  2 files changed, 9 insertions(+)

Acked-by: Russell Bryant <russell@ovn.org>
diff mbox series

Patch

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 *);