X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fwrapper%2Frandom.c;h=7a81bea60e588ed99d657131cfe00b50df8b55db;hb=28cbcb59855c099a89b02054b15b45ee3ad6a52a;hp=7b91fc7f3e146a4b8046b7996ecb4855812537a5;hpb=cfa6cc1d0f01c2cfcc1a679abf3a6572d411c309;p=lttng-modules.git diff --git a/src/wrapper/random.c b/src/wrapper/random.c index 7b91fc7f..7a81bea6 100644 --- a/src/wrapper/random.c +++ b/src/wrapper/random.c @@ -12,7 +12,7 @@ /* boot_id depends on sysctl */ #if defined(CONFIG_SYSCTL) -#include +#include #include #include #include @@ -26,21 +26,12 @@ 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); + len = lttng_kernel_read(file, bootid, BOOT_ID_LEN - 1, &file->f_pos); if (len != BOOT_ID_LEN - 1) { ret = -EINVAL; goto end; @@ -49,7 +40,6 @@ int wrapper_get_bootid(char *bootid) bootid[BOOT_ID_LEN - 1] = '\0'; ret = 0; end: - set_fs(old_fs); filp_close(file, current->files); return ret; }