From: Mathieu Desnoyers Date: Tue, 14 Apr 2020 13:13:38 +0000 (-0400) Subject: wrapper: remove random wrapper X-Git-Tag: for-upstreaming-review-1~2 X-Git-Url: http://git.liburcu.org/?p=lttng-modules.git;a=commitdiff_plain;h=84bbd9eadd688868296ee22e296dde9426924303 wrapper: remove random wrapper --- diff --git a/Makefile b/Makefile index 9c5acf01..3486002b 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ ifneq ($(KERNELRELEASE),) lttng-context-interruptible.o \ lttng-context-need-reschedule.o \ lttng-context-callstack.o lttng-calibrate.o \ - lttng-context-hostname.o wrapper/random.o \ + lttng-context-hostname.o \ probes/lttng.o wrapper/trace-clock.o \ lttng-tracker-id.o \ lttng-filter.o lttng-filter-interpreter.o \ diff --git a/lttng-events.c b/lttng-events.c index aec99fb6..5ecdd732 100644 --- a/lttng-events.c +++ b/lttng-events.c @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include @@ -2574,7 +2574,7 @@ static int _lttng_session_metadata_statedump(struct lttng_session *session) { unsigned char *uuid_c = session->uuid.b; - unsigned char uuid_s[37], clock_uuid_s[BOOT_ID_LEN]; + unsigned char uuid_s[LTTNG_MODULES_UUID_STR_LEN], clock_uuid_s[LTTNG_MODULES_UUID_STR_LEN]; const char *product_uuid; struct lttng_channel *chan; struct lttng_event *event; diff --git a/wrapper/random.c b/wrapper/random.c deleted file mode 100644 index e2cee70c..00000000 --- a/wrapper/random.c +++ /dev/null @@ -1,64 +0,0 @@ -/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) - * - * wrapper/random.c - * - * wrapper around bootid read. Read the boot id through the /proc filesystem. - * - * Copyright (C) 2011-2012 Mathieu Desnoyers - */ - -#include - -/* boot_id depends on sysctl */ -#if defined(CONFIG_SYSCTL) - -#include -#include -#include -#include -#include - -/* - * Returns string boot id. - */ -int wrapper_get_bootid(char *bootid) -{ - struct file *file; - int ret; - ssize_t len; - mm_segment_t old_fs; - - file = filp_open("/proc/sys/kernel/random/boot_id", O_RDONLY, 0); - if (IS_ERR(file)) - return PTR_ERR(file); - - old_fs = get_fs(); - set_fs(KERNEL_DS); - - if (!file->f_op || !file->f_op->read) { - ret = -EINVAL; - goto end; - } - - len = file->f_op->read(file, bootid, BOOT_ID_LEN - 1, &file->f_pos); - if (len != BOOT_ID_LEN - 1) { - ret = -EINVAL; - goto end; - } - - bootid[BOOT_ID_LEN - 1] = '\0'; - ret = 0; -end: - set_fs(old_fs); - filp_close(file, current->files); - return ret; -} - -#else - -int wrapper_get_bootid(char *bootid) -{ - return -ENOSYS; -} - -#endif diff --git a/wrapper/random.h b/wrapper/random.h deleted file mode 100644 index 073a09a2..00000000 --- a/wrapper/random.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: (GPL-2.0-only OR LGPL-2.1-only) - * - * wrapper/random.h - * - * wrapper around bootid read. Read the boot id through the /proc filesystem. - * - * Copyright (C) 2011-2012 Mathieu Desnoyers - */ - -#ifndef _LTTNG_WRAPPER_RANDOM_H -#define _LTTNG_WRAPPER_RANDOM_H - -#include - -#define BOOT_ID_LEN LTTNG_MODULES_UUID_STR_LEN - -int wrapper_get_bootid(char *bootid); - -#endif /* _LTTNG_WRAPPER_RANDOM_H */ diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h index 5b44db2f..28ee90eb 100644 --- a/wrapper/trace-clock.h +++ b/wrapper/trace-clock.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include extern struct lttng_trace_clock *lttng_trace_clock; @@ -111,7 +111,11 @@ static inline u64 trace_clock_freq_monotonic(void) static inline int trace_clock_uuid_monotonic(char *uuid) { - return wrapper_get_bootid(uuid); + unsigned char *boot_id; + + boot_id = get_kernel_boot_id(); + sprintf(uuid, "%pU", boot_id); + return 0; } static inline const char *trace_clock_name_monotonic(void)