wrapper: remove random wrapper
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 14 Apr 2020 13:13:38 +0000 (09:13 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 14 Apr 2020 13:18:40 +0000 (09:18 -0400)
Makefile
lttng-events.c
wrapper/random.c [deleted file]
wrapper/random.h [deleted file]
wrapper/trace-clock.h

index 9c5acf0109b89e7ab353345a66729650552e173e..3486002b47b65cb1e3d4dc5623154187c9d894bc 100644 (file)
--- 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 \
index aec99fb64956167a993889f40659e232ae8310df..5ecdd7320e8cff0308ff9b4ebb1bd30f6d155a52 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/vmalloc.h>
 #include <linux/limits.h>
 
-#include <wrapper/random.h>
+#include <linux/random.h>
 #include <lttng-kernel-version.h>
 #include <lttng-events.h>
 #include <lttng-tracer.h>
@@ -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 (file)
index e2cee70..0000000
+++ /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 <mathieu.desnoyers@efficios.com>
- */
-
-#include <linux/errno.h>
-
-/* boot_id depends on sysctl */
-#if defined(CONFIG_SYSCTL)
-
-#include <linux/fs.h>
-#include <linux/file.h>
-#include <linux/sched.h>
-#include <linux/uaccess.h>
-#include <wrapper/random.h>
-
-/*
- * 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 (file)
index 073a09a..0000000
+++ /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 <mathieu.desnoyers@efficios.com>
- */
-
-#ifndef _LTTNG_WRAPPER_RANDOM_H
-#define _LTTNG_WRAPPER_RANDOM_H
-
-#include <lttng-clock.h>
-
-#define BOOT_ID_LEN    LTTNG_MODULES_UUID_STR_LEN
-
-int wrapper_get_bootid(char *bootid);
-
-#endif /* _LTTNG_WRAPPER_RANDOM_H */
index 5b44db2fd5477a1b835ff32e4a2bb048434431fa..28ee90ebf0434aa0fb3015c4f8c42d833a4a0b98 100644 (file)
@@ -25,7 +25,7 @@
 #include <asm/local.h>
 #include <lttng-kernel-version.h>
 #include <lttng-clock.h>
-#include <wrapper/random.h>
+#include <linux/random.h>
 
 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)
This page took 0.028624 seconds and 4 git commands to generate.