| 1 | /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) |
| 2 | * |
| 3 | * wrapper/uuid.h |
| 4 | * |
| 5 | * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 6 | */ |
| 7 | |
| 8 | #ifndef _LTTNG_WRAPPER_UUID_H |
| 9 | #define _LTTNG_WRAPPER_UUID_H |
| 10 | |
| 11 | #include <linux/version.h> |
| 12 | |
| 13 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) |
| 14 | #include <linux/uuid.h> |
| 15 | #else |
| 16 | |
| 17 | #include <linux/random.h> |
| 18 | |
| 19 | typedef struct { |
| 20 | __u8 b[16]; |
| 21 | } uuid_le; |
| 22 | |
| 23 | static inline |
| 24 | void uuid_le_gen(uuid_le *u) |
| 25 | { |
| 26 | generate_random_uuid(u->b); |
| 27 | } |
| 28 | |
| 29 | #endif |
| 30 | #endif /* _LTTNG_WRAPPER_UUID_H */ |