From dc61cb20e08da3e6ac798f22ca0d4a5025a18fb5 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 13 Apr 2020 12:16:43 -0400 Subject: [PATCH] Introduce lttng_guid_gen wrapper for kernels >= 5.7.0 Signed-off-by: Mathieu Desnoyers --- lttng-events.c | 3 ++- wrapper/uuid.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 wrapper/uuid.h diff --git a/lttng-events.c b/lttng-events.c index 067bcc53..6233c75c 100644 --- a/lttng-events.c +++ b/lttng-events.c @@ -29,6 +29,7 @@ #include #include +#include #include /* for wrapper_vmalloc_sync_all() */ #include #include @@ -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 index 00000000..74946e23 --- /dev/null +++ b/wrapper/uuid.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) + * + * wrapper/uuid.h + * + * Copyright (C) 2020 Mathieu Desnoyers + */ + +#ifndef _LTTNG_WRAPPER_UUID_H +#define _LTTNG_WRAPPER_UUID_H + +#include +#include + +#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 */ -- 2.34.1