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>
Mon, 4 May 2020 19:46:21 +0000 (15:46 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lttng-events.c
wrapper/uuid.h [new file with mode: 0644]

index c14ea3f20060e4f470e0b8d00c91cc9a7faf222d..da949e970e3cd34c39a4ae63fd4def7ae8beedd5 100644 (file)
@@ -27,9 +27,9 @@
 #include <linux/jhash.h>
 #include <linux/uaccess.h>
 #include <linux/vmalloc.h>
-#include <linux/uuid.h>
 #include <linux/dmi.h>
 
+#include <wrapper/uuid.h>
 #include <wrapper/vmalloc.h>   /* for wrapper_vmalloc_sync_all() */
 #include <wrapper/random.h>
 #include <wrapper/tracepoint.h>
@@ -134,7 +134,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.035049 seconds and 4 git commands to generate.