Cleanup: Move lttng-modules instrumentation headers
[lttng-modules.git] / lttng-abi.c
index 4df3d673b18c0d84e4d80047fdf096ed52a81350..01eb4d55addea3ea41b5def0ed79ca9efd91fcf1 100644 (file)
@@ -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
  *
 #include <linux/uaccess.h>
 #include <linux/slab.h>
 #include <linux/err.h>
-#include <wrapper/vmalloc.h>   /* for wrapper_vmalloc_sync_all() */
-#include <wrapper/ringbuffer/vfs.h>
-#include <wrapper/ringbuffer/backend.h>
-#include <wrapper/ringbuffer/frontend.h>
+#include <wrapper/vmalloc.h>   /* for wrapper_vmalloc_sync_mappings() */
+#include <ringbuffer/vfs.h>
+#include <ringbuffer/backend.h>
+#include <ringbuffer/frontend.h>
 #include <wrapper/poll.h>
 #include <wrapper/file.h>
 #include <wrapper/kref.h>
-#include <lttng-string-utils.h>
-#include <lttng-abi.h>
-#include <lttng-abi-old.h>
-#include <lttng-events.h>
-#include <lttng-tracer.h>
-#include <lttng-tp-mempool.h>
-#include <lib/ringbuffer/frontend_types.h>
+#include <lttng/string-utils.h>
+#include <lttng/abi.h>
+#include <lttng/abi-old.h>
+#include <lttng/events.h>
+#include <lttng/tracer.h>
+#include <lttng/tp-mempool.h>
+#include <ringbuffer/frontend_types.h>
 
 /*
  * This is LTTng's own personal way to create a system call as an external
  */
 
 static struct proc_dir_entry *lttng_proc_dentry;
-static const struct file_operations lttng_fops;
+
+#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;
 static const struct file_operations lttng_metadata_fops;
@@ -391,13 +397,22 @@ long lttng_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        }
 }
 
-static const struct file_operations lttng_fops = {
+#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
+#endif /* CONFIG_COMPAT */
 };
+#endif
 
 static
 int lttng_abi_create_channel(struct file *session_file,
@@ -1206,7 +1221,8 @@ 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;
@@ -1357,9 +1373,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;
@@ -1923,7 +1938,7 @@ int __init lttng_abi_init(void)
 {
        int ret = 0;
 
-       wrapper_vmalloc_sync_all();
+       wrapper_vmalloc_sync_mappings();
        lttng_clock_ref();
 
        ret = lttng_tp_mempool_init();
@@ -1932,7 +1947,7 @@ int __init lttng_abi_init(void)
        }
 
        lttng_proc_dentry = proc_create_data("lttng", S_IRUSR | S_IWUSR, NULL,
-                                       &lttng_fops, NULL);
+                                       &lttng_proc_ops, NULL);
 
        if (!lttng_proc_dentry) {
                printk(KERN_ERR "Error creating LTTng control file\n");
This page took 0.027369 seconds and 4 git commands to generate.