X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttng-abi.c;h=a32f419a4437b02806e9f584713aefc6bc8d3a02;hb=39848b23f3afb4e6a51550a9d12e5610fbfdb8b5;hp=9d610e9346f53c3669b5ca2b5c7de46475eed6d0;hpb=059de1478e398b662aaf1f5e71f07e0c78600545;p=lttng-modules.git diff --git a/lttng-abi.c b/lttng-abi.c index 9d610e93..a32f419a 100644 --- a/lttng-abi.c +++ b/lttng-abi.c @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) +/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) * * lttng-abi.c * @@ -30,13 +30,10 @@ #include #include #include -#include /* for wrapper_vmalloc_sync_all() */ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -52,11 +49,7 @@ static struct proc_dir_entry *lttng_proc_dentry; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) static const struct proc_ops lttng_proc_ops; -#else -static const struct file_operations lttng_proc_ops; -#endif static const struct file_operations lttng_session_fops; static const struct file_operations lttng_channel_fops; @@ -81,7 +74,7 @@ int lttng_abi_create_session(void) session = lttng_session_create(); if (!session) return -ENOMEM; - session_fd = lttng_get_unused_fd(); + session_fd = get_unused_fd_flags(0); if (session_fd < 0) { ret = session_fd; goto fd_error; @@ -110,7 +103,7 @@ int lttng_abi_tracepoint_list(void) struct file *tracepoint_list_file; int file_fd, ret; - file_fd = lttng_get_unused_fd(); + file_fd = get_unused_fd_flags(0); if (file_fd < 0) { ret = file_fd; goto fd_error; @@ -150,7 +143,7 @@ int lttng_abi_syscall_list(void) struct file *syscall_list_file; int file_fd, ret; - file_fd = lttng_get_unused_fd(); + file_fd = get_unused_fd_flags(0); if (file_fd < 0) { ret = file_fd; goto fd_error; @@ -397,22 +390,12 @@ long lttng_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) static const struct proc_ops lttng_proc_ops = { .proc_ioctl = lttng_ioctl, #ifdef CONFIG_COMPAT .proc_compat_ioctl = lttng_ioctl, #endif /* CONFIG_COMPAT */ }; -#else -static const struct file_operations lttng_proc_ops = { - .owner = THIS_MODULE, - .unlocked_ioctl = lttng_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = lttng_ioctl, -#endif /* CONFIG_COMPAT */ -}; -#endif static int lttng_abi_create_channel(struct file *session_file, @@ -427,7 +410,7 @@ int lttng_abi_create_channel(struct file *session_file, int chan_fd; int ret = 0; - chan_fd = lttng_get_unused_fd(); + chan_fd = get_unused_fd_flags(0); if (chan_fd < 0) { ret = chan_fd; goto fd_error; @@ -778,7 +761,6 @@ unsigned int lttng_metadata_ring_buffer_poll(struct file *filp, unsigned int mask = 0; if (filp->f_mode & FMODE_READ) { - poll_wait_set_exclusive(wait); poll_wait(filp, &stream->read_wait, wait); finalized = stream->finalized; @@ -1086,7 +1068,7 @@ int lttng_abi_create_stream_fd(struct file *channel_file, void *stream_priv, int stream_fd, ret; struct file *stream_file; - stream_fd = lttng_get_unused_fd(); + stream_fd = get_unused_fd_flags(0); if (stream_fd < 0) { ret = stream_fd; goto fd_error; @@ -1178,11 +1160,7 @@ int lttng_abi_open_metadata_stream(struct file *channel_file) goto notransport; } - if (!lttng_kref_get(&session->metadata_cache->refcount)) { - ret = -EOVERFLOW; - goto kref_error; - } - + kref_get(&session->metadata_cache->refcount); ret = lttng_abi_create_stream_fd(channel_file, stream_priv, <tng_metadata_ring_buffer_file_operations); if (ret < 0) @@ -1194,7 +1172,6 @@ int lttng_abi_open_metadata_stream(struct file *channel_file) fd_error: kref_put(&session->metadata_cache->refcount, metadata_cache_destroy); -kref_error: module_put(metadata_stream->transport->owner); notransport: kfree(metadata_stream); @@ -1221,12 +1198,13 @@ int lttng_abi_create_event(struct file *channel_file, event_param->u.kprobe.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; break; case LTTNG_KERNEL_FUNCTION: - event_param->u.ftrace.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; + WARN_ON_ONCE(1); + /* Not implemented. */ break; default: break; } - event_fd = lttng_get_unused_fd(); + event_fd = get_unused_fd_flags(0); if (event_fd < 0) { ret = event_fd; goto fd_error; @@ -1372,9 +1350,8 @@ long lttng_channel_ioctl(struct file *file, unsigned int cmd, unsigned long arg) sizeof(uevent_param->u.kretprobe.symbol_name)); break; case LTTNG_KERNEL_FUNCTION: - memcpy(uevent_param->u.ftrace.symbol_name, - old_uevent_param->u.ftrace.symbol_name, - sizeof(uevent_param->u.ftrace.symbol_name)); + WARN_ON_ONCE(1); + /* Not implemented. */ break; default: break; @@ -1511,7 +1488,6 @@ unsigned int lttng_channel_poll(struct file *file, poll_table *wait) unsigned int mask = 0; if (file->f_mode & FMODE_READ) { - poll_wait_set_exclusive(wait); poll_wait(file, channel->ops->get_hp_wait_queue(channel->chan), wait); @@ -1938,7 +1914,6 @@ int __init lttng_abi_init(void) { int ret = 0; - wrapper_vmalloc_sync_all(); lttng_clock_ref(); ret = lttng_tp_mempool_init();