Introduce lttng_guid_gen wrapper for kernels >= 5.7.0
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 13 Apr 2020 16:16:43 +0000 (12:16 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 8 May 2020 17:56:38 +0000 (13:56 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lttng-events.c
wrapper/uuid.h [new file with mode: 0644]

index 067bcc53f61b0d38b79eb04f3e8b8a4f9083f065..6233c75ce15b954a72c96ba49647e55549525fd1 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/vmalloc.h>
 #include <linux/uuid.h>
 
+#include <wrapper/uuid.h>
 #include <wrapper/vmalloc.h>   /* for wrapper_vmalloc_sync_all() */
 #include <wrapper/random.h>
 #include <wrapper/tracepoint.h>
@@ -130,7 +131,7 @@ struct lttng_session *lttng_session_create(void)
                goto err;
        INIT_LIST_HEAD(&session->chan);
        INIT_LIST_HEAD(&session->events);
-       uuid_le_gen(&session->uuid);
+       lttng_guid_gen(&session->uuid);
 
        metadata_cache = kzalloc(sizeof(struct lttng_metadata_cache),
                        GFP_KERNEL);
diff --git a/wrapper/uuid.h b/wrapper/uuid.h
new file mode 100644 (file)
index 0000000..74946e2
--- /dev/null
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * wrapper/uuid.h
+ *
+ * Copyright (C) 2020 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#ifndef _LTTNG_WRAPPER_UUID_H
+#define _LTTNG_WRAPPER_UUID_H
+
+#include <linux/version.h>
+#include <linux/uuid.h>
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0))
+static inline
+void lttng_guid_gen(guid_t *u)
+{
+       return guid_gen(u);
+}
+#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) */
+static inline
+void lttng_guid_gen(guid_t *u)
+{
+       return uuid_le_gen(u);
+}
+#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) */
+
+#endif /* _LTTNG_WRAPPER_UUID_H */
This page took 0.028581 seconds and 4 git commands to generate.