Rename "tsc" to "timestamp"
[lttng-modules.git] / src / lttng-abi.c
index 9f06295ffa6981d9de6bf4182f8d57be74c825f9..caec803fe51e018f470ce03bb7003fbbaa73517f 100644 (file)
@@ -23,6 +23,7 @@
  *     - Takes instrumentation source specific arguments.
  */
 
+#include <asm/barrier.h>
 #include <linux/module.h>
 #include <linux/proc_fs.h>
 #include <linux/anon_inodes.h>
 #include <ringbuffer/vfs.h>
 #include <ringbuffer/backend.h>
 #include <ringbuffer/frontend.h>
+#include <wrapper/compiler_attributes.h>
 #include <wrapper/poll.h>
-#include <wrapper/file.h>
 #include <wrapper/kref.h>
-#include <wrapper/barrier.h>
 #include <lttng/string-utils.h>
 #include <lttng/abi.h>
 #include <lttng/abi-old.h>
@@ -91,14 +91,14 @@ static int validate_zeroed_padding(char *p, size_t len)
 static
 int lttng_abi_create_session(void)
 {
-       struct lttng_session *session;
+       struct lttng_kernel_session *session;
        struct file *session_file;
        int session_fd, ret;
 
        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 +110,7 @@ int lttng_abi_create_session(void)
                ret = PTR_ERR(session_file);
                goto file_error;
        }
-       session->file = session_file;
+       session->priv->file = session_file;
        fd_install(session_fd, session_file);
        return session_fd;
 
@@ -140,7 +140,7 @@ int lttng_abi_create_event_notifier_group(void)
        if (!event_notifier_group)
                return -ENOMEM;
 
-       event_notifier_group_fd = lttng_get_unused_fd();
+       event_notifier_group_fd = get_unused_fd_flags(0);
        if (event_notifier_group_fd < 0) {
                ret = event_notifier_group_fd;
                goto fd_error;
@@ -173,7 +173,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;
@@ -213,7 +213,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;
@@ -259,10 +259,10 @@ void lttng_abi_tracer_abi_version(struct lttng_kernel_abi_tracer_abi_version *v)
 static
 long lttng_abi_add_context(struct file *file,
        struct lttng_kernel_abi_context *context_param,
-       struct lttng_kernel_ctx **ctx, struct lttng_session *session)
+       struct lttng_kernel_ctx **ctx, struct lttng_kernel_session *session)
 {
 
-       if (session->been_active)
+       if (session->priv->been_active)
                return -EPERM;
 
        switch (context_param->ctx) {
@@ -488,15 +488,15 @@ int lttng_abi_create_channel(struct file *session_file,
                             struct lttng_kernel_abi_channel *chan_param,
                             enum channel_type channel_type)
 {
-       struct lttng_session *session = session_file->private_data;
+       struct lttng_kernel_session *session = session_file->private_data;
        const struct file_operations *fops = NULL;
        const char *transport_name;
-       struct lttng_channel *chan;
+       struct lttng_kernel_channel_buffer *chan;
        struct file *chan_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;
@@ -549,7 +549,7 @@ int lttng_abi_create_channel(struct file *session_file,
         * We tolerate no failure path after channel creation. It will stay
         * invariant for the rest of the session.
         */
-       chan = lttng_channel_create(session, transport_name, NULL,
+       chan = lttng_channel_buffer_create(session, transport_name, NULL,
                                  chan_param->subbuf_size,
                                  chan_param->num_subbuf,
                                  chan_param->switch_timer_interval,
@@ -559,7 +559,7 @@ int lttng_abi_create_channel(struct file *session_file,
                ret = -EINVAL;
                goto chan_error;
        }
-       chan->file = chan_file;
+       chan->priv->parent.file = chan_file;
        chan_file->private_data = chan;
        fd_install(chan_fd, chan_file);
 
@@ -576,7 +576,7 @@ fd_error:
 }
 
 static
-int lttng_abi_session_set_name(struct lttng_session *session,
+int lttng_abi_session_set_name(struct lttng_kernel_session *session,
                struct lttng_kernel_abi_session_name *name)
 {
        size_t len;
@@ -588,12 +588,12 @@ int lttng_abi_session_set_name(struct lttng_session *session,
                return -EINVAL;
        }
 
-       strcpy(session->name, name->name);
+       strcpy(session->priv->name, name->name);
        return 0;
 }
 
 static
-int lttng_abi_session_set_creation_time(struct lttng_session *session,
+int lttng_abi_session_set_creation_time(struct lttng_kernel_session *session,
                struct lttng_kernel_abi_session_creation_time *time)
 {
        size_t len;
@@ -605,7 +605,7 @@ int lttng_abi_session_set_creation_time(struct lttng_session *session,
                return -EINVAL;
        }
 
-       strcpy(session->creation_time, time->iso8601);
+       strcpy(session->priv->creation_time, time->iso8601);
        return 0;
 }
 
@@ -649,6 +649,8 @@ long lttng_counter_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                if (validate_zeroed_padding(local_counter_read.padding,
                                sizeof(local_counter_read.padding)))
                        return -EINVAL;
+               if (local_counter_read.index.number_dimensions > LTTNG_KERNEL_ABI_COUNTER_DIMENSION_MAX)
+                       return -EINVAL;
 
                /* Cast all indexes into size_t. */
                for (i = 0; i < local_counter_read.index.number_dimensions; i++)
@@ -684,6 +686,8 @@ long lttng_counter_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                if (validate_zeroed_padding(local_counter_aggregate.padding,
                                sizeof(local_counter_aggregate.padding)))
                        return -EINVAL;
+               if (local_counter_aggregate.index.number_dimensions > LTTNG_KERNEL_ABI_COUNTER_DIMENSION_MAX)
+                       return -EINVAL;
 
                /* Cast all indexes into size_t. */
                for (i = 0; i < local_counter_aggregate.index.number_dimensions; i++)
@@ -715,6 +719,8 @@ long lttng_counter_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                if (validate_zeroed_padding(local_counter_clear.padding,
                                sizeof(local_counter_clear.padding)))
                        return -EINVAL;
+               if (local_counter_clear.index.number_dimensions > LTTNG_KERNEL_ABI_COUNTER_DIMENSION_MAX)
+                       return -EINVAL;
 
                /* Cast all indexes into size_t. */
                for (i = 0; i < local_counter_clear.index.number_dimensions; i++)
@@ -723,7 +729,6 @@ long lttng_counter_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                return lttng_kernel_counter_clear(counter, indexes);
        }
        default:
-               WARN_ON_ONCE(1);
                return -ENOSYS;
        }
 }
@@ -789,10 +794,41 @@ enum tracker_type get_tracker_type(struct lttng_kernel_abi_tracker_args *tracker
 static
 long lttng_session_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-       struct lttng_session *session = file->private_data;
+       struct lttng_kernel_session *session = file->private_data;
        struct lttng_kernel_abi_channel chan_param;
        struct lttng_kernel_abi_old_channel old_chan_param;
 
+       /*
+        * Handle backward compatibility. OLD commands have wrong
+        * directions, replace them by the correct direction.
+        */
+       switch (cmd) {
+       case LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_PID:
+               cmd = LTTNG_KERNEL_ABI_SESSION_TRACK_PID;
+               break;
+       case LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_PID:
+               cmd = LTTNG_KERNEL_ABI_SESSION_UNTRACK_PID;
+               break;
+       case LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_ID:
+               cmd = LTTNG_KERNEL_ABI_SESSION_TRACK_ID;
+               break;
+       case LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_ID:
+               cmd = LTTNG_KERNEL_ABI_SESSION_UNTRACK_ID;
+               break;
+       case LTTNG_KERNEL_ABI_OLD_SESSION_LIST_TRACKER_IDS:
+               cmd = LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_IDS;
+               break;
+       case LTTNG_KERNEL_ABI_OLD_SESSION_SET_NAME:
+               cmd = LTTNG_KERNEL_ABI_SESSION_SET_NAME;
+               break;
+       case LTTNG_KERNEL_ABI_OLD_SESSION_SET_CREATION_TIME:
+               cmd = LTTNG_KERNEL_ABI_SESSION_SET_CREATION_TIME;
+               break;
+       default:
+               /* Nothing to do. */
+               break;
+       }
+
        switch (cmd) {
        case LTTNG_KERNEL_ABI_OLD_CHANNEL:
        {
@@ -943,7 +979,7 @@ long lttng_session_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 static
 int lttng_session_release(struct inode *inode, struct file *file)
 {
-       struct lttng_session *session = file->private_data;
+       struct lttng_kernel_session *session = file->private_data;
 
        if (session)
                lttng_session_destroy(session);
@@ -968,8 +1004,8 @@ ssize_t lttng_event_notifier_group_notif_read(struct file *filp, char __user *us
                size_t count, loff_t *ppos)
 {
        struct lttng_event_notifier_group *event_notifier_group = filp->private_data;
-       struct channel *chan = event_notifier_group->chan;
-       struct lib_ring_buffer *buf = event_notifier_group->buf;
+       struct lttng_kernel_ring_buffer_channel *chan = event_notifier_group->chan;
+       struct lttng_kernel_ring_buffer *buf = event_notifier_group->buf;
        ssize_t read_count = 0, len;
        size_t read_offset;
 
@@ -979,7 +1015,7 @@ ssize_t lttng_event_notifier_group_notif_read(struct file *filp, char __user *us
 
        /* Finish copy of previous record */
        if (*ppos != 0) {
-               if (read_count < count) {
+               if (count != 0) {
                        len = chan->iter.len_left;
                        read_offset = *ppos;
                        goto skip_get_next;
@@ -1059,7 +1095,8 @@ nodata:
        chan->iter.len_left = 0;
 
 put_record:
-       lib_ring_buffer_put_current_record(buf);
+       if (*ppos == 0)
+               lib_ring_buffer_put_current_record(buf);
        return read_count;
 }
 
@@ -1074,9 +1111,9 @@ unsigned int lttng_event_notifier_group_notif_poll(struct file *filp,
 {
        unsigned int mask = 0;
        struct lttng_event_notifier_group *event_notifier_group = filp->private_data;
-       struct channel *chan = event_notifier_group->chan;
-       struct lib_ring_buffer *buf = event_notifier_group->buf;
-       const struct lib_ring_buffer_config *config = &chan->backend.config;
+       struct lttng_kernel_ring_buffer_channel *chan = event_notifier_group->chan;
+       struct lttng_kernel_ring_buffer *buf = event_notifier_group->buf;
+       const struct lttng_kernel_ring_buffer_config *config = &chan->backend.config;
        int finalized, disabled;
        unsigned long consumed, offset;
        size_t subbuffer_header_size = config->cb.subbuffer_header_size();
@@ -1148,7 +1185,7 @@ retry:
 static int lttng_event_notifier_group_notif_open(struct inode *inode, struct file *file)
 {
        struct lttng_event_notifier_group *event_notifier_group = inode->i_private;
-       struct lib_ring_buffer *buf = event_notifier_group->buf;
+       struct lttng_kernel_ring_buffer *buf = event_notifier_group->buf;
 
        file->private_data = event_notifier_group;
        return lib_ring_buffer_open(inode, file, buf);
@@ -1164,7 +1201,7 @@ static int lttng_event_notifier_group_notif_open(struct inode *inode, struct fil
 static int lttng_event_notifier_group_notif_release(struct inode *inode, struct file *file)
 {
        struct lttng_event_notifier_group *event_notifier_group = file->private_data;
-       struct lib_ring_buffer *buf = event_notifier_group->buf;
+       struct lttng_kernel_ring_buffer *buf = event_notifier_group->buf;
        int ret;
 
        ret = lib_ring_buffer_release(inode, file, buf);
@@ -1194,7 +1231,7 @@ unsigned int lttng_metadata_ring_buffer_poll(struct file *filp,
                poll_table *wait)
 {
        struct lttng_metadata_stream *stream = filp->private_data;
-       struct lib_ring_buffer *buf = stream->priv;
+       struct lttng_kernel_ring_buffer *buf = stream->priv;
        int finalized;
        unsigned int mask = 0;
 
@@ -1270,7 +1307,7 @@ long lttng_metadata_ring_buffer_ioctl(struct file *filp,
 {
        int ret;
        struct lttng_metadata_stream *stream = filp->private_data;
-       struct lib_ring_buffer *buf = stream->priv;
+       struct lttng_kernel_ring_buffer *buf = stream->priv;
        unsigned int rb_cmd;
        bool coherent;
 
@@ -1283,8 +1320,8 @@ long lttng_metadata_ring_buffer_ioctl(struct file *filp,
        case LTTNG_KERNEL_ABI_RING_BUFFER_GET_NEXT_SUBBUF:
        {
                struct lttng_metadata_stream *stream = filp->private_data;
-               struct lib_ring_buffer *buf = stream->priv;
-               struct channel *chan = buf->backend.chan;
+               struct lttng_kernel_ring_buffer *buf = stream->priv;
+               struct lttng_kernel_ring_buffer_channel *chan = buf->backend.chan;
 
                ret = lttng_metadata_output_channel(stream, chan, NULL);
                if (ret > 0) {
@@ -1301,12 +1338,13 @@ long lttng_metadata_ring_buffer_ioctl(struct file *filp,
                 */
                return -ENOSYS;
        }
-       case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY:  /* Fall-through. */
+       case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY:
+               lttng_fallthrough;
        case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH:
        {
                struct lttng_metadata_stream *stream = filp->private_data;
-               struct lib_ring_buffer *buf = stream->priv;
-               struct channel *chan = buf->backend.chan;
+               struct lttng_kernel_ring_buffer *buf = stream->priv;
+               struct lttng_kernel_ring_buffer_channel *chan = buf->backend.chan;
 
                /*
                 * Before doing the actual ring buffer flush, write up to one
@@ -1332,8 +1370,8 @@ long lttng_metadata_ring_buffer_ioctl(struct file *filp,
        case LTTNG_KERNEL_ABI_RING_BUFFER_GET_NEXT_SUBBUF_METADATA_CHECK:
        {
                struct lttng_metadata_stream *stream = filp->private_data;
-               struct lib_ring_buffer *buf = stream->priv;
-               struct channel *chan = buf->backend.chan;
+               struct lttng_kernel_ring_buffer *buf = stream->priv;
+               struct lttng_kernel_ring_buffer_channel *chan = buf->backend.chan;
 
                ret = lttng_metadata_output_channel(stream, chan, &coherent);
                if (ret > 0) {
@@ -1379,7 +1417,7 @@ long lttng_metadata_ring_buffer_compat_ioctl(struct file *filp,
 {
        int ret;
        struct lttng_metadata_stream *stream = filp->private_data;
-       struct lib_ring_buffer *buf = stream->priv;
+       struct lttng_kernel_ring_buffer *buf = stream->priv;
        unsigned int rb_cmd;
        bool coherent;
 
@@ -1392,8 +1430,8 @@ long lttng_metadata_ring_buffer_compat_ioctl(struct file *filp,
        case LTTNG_KERNEL_ABI_RING_BUFFER_GET_NEXT_SUBBUF:
        {
                struct lttng_metadata_stream *stream = filp->private_data;
-               struct lib_ring_buffer *buf = stream->priv;
-               struct channel *chan = buf->backend.chan;
+               struct lttng_kernel_ring_buffer *buf = stream->priv;
+               struct lttng_kernel_ring_buffer_channel *chan = buf->backend.chan;
 
                ret = lttng_metadata_output_channel(stream, chan, NULL);
                if (ret > 0) {
@@ -1410,12 +1448,13 @@ long lttng_metadata_ring_buffer_compat_ioctl(struct file *filp,
                 */
                return -ENOSYS;
        }
-       case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY:  /* Fall-through. */
+       case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH_EMPTY:
+               lttng_fallthrough;
        case LTTNG_KERNEL_ABI_RING_BUFFER_FLUSH:
        {
                struct lttng_metadata_stream *stream = filp->private_data;
-               struct lib_ring_buffer *buf = stream->priv;
-               struct channel *chan = buf->backend.chan;
+               struct lttng_kernel_ring_buffer *buf = stream->priv;
+               struct lttng_kernel_ring_buffer_channel *chan = buf->backend.chan;
 
                /*
                 * Before doing the actual ring buffer flush, write up to one
@@ -1441,8 +1480,8 @@ long lttng_metadata_ring_buffer_compat_ioctl(struct file *filp,
        case LTTNG_KERNEL_ABI_RING_BUFFER_GET_NEXT_SUBBUF_METADATA_CHECK:
        {
                struct lttng_metadata_stream *stream = filp->private_data;
-               struct lib_ring_buffer *buf = stream->priv;
-               struct channel *chan = buf->backend.chan;
+               struct lttng_kernel_ring_buffer *buf = stream->priv;
+               struct lttng_kernel_ring_buffer_channel *chan = buf->backend.chan;
 
                ret = lttng_metadata_output_channel(stream, chan, &coherent);
                if (ret > 0) {
@@ -1490,7 +1529,7 @@ static
 int lttng_metadata_ring_buffer_open(struct inode *inode, struct file *file)
 {
        struct lttng_metadata_stream *stream = inode->i_private;
-       struct lib_ring_buffer *buf = stream->priv;
+       struct lttng_kernel_ring_buffer *buf = stream->priv;
 
        file->private_data = buf;
        /*
@@ -1508,7 +1547,7 @@ static
 int lttng_metadata_ring_buffer_release(struct inode *inode, struct file *file)
 {
        struct lttng_metadata_stream *stream = file->private_data;
-       struct lib_ring_buffer *buf = stream->priv;
+       struct lttng_kernel_ring_buffer *buf = stream->priv;
 
        mutex_lock(&stream->metadata_cache->lock);
        list_del(&stream->list);
@@ -1525,7 +1564,7 @@ ssize_t lttng_metadata_ring_buffer_splice_read(struct file *in, loff_t *ppos,
                unsigned int flags)
 {
        struct lttng_metadata_stream *stream = in->private_data;
-       struct lib_ring_buffer *buf = stream->priv;
+       struct lttng_kernel_ring_buffer *buf = stream->priv;
 
        return lib_ring_buffer_splice_read(in, ppos, pipe, len,
                        flags, buf);
@@ -1536,7 +1575,7 @@ int lttng_metadata_ring_buffer_mmap(struct file *filp,
                struct vm_area_struct *vma)
 {
        struct lttng_metadata_stream *stream = filp->private_data;
-       struct lib_ring_buffer *buf = stream->priv;
+       struct lttng_kernel_ring_buffer *buf = stream->priv;
 
        return lib_ring_buffer_mmap(filp, vma, buf);
 }
@@ -1563,7 +1602,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;
@@ -1596,12 +1635,12 @@ fd_error:
 static
 int lttng_abi_open_stream(struct file *channel_file)
 {
-       struct lttng_channel *channel = channel_file->private_data;
-       struct lib_ring_buffer *buf;
+       struct lttng_kernel_channel_buffer *channel = channel_file->private_data;
+       struct lttng_kernel_ring_buffer *buf;
        int ret;
        void *stream_priv;
 
-       buf = channel->ops->buffer_read_open(channel->chan);
+       buf = channel->ops->priv->buffer_read_open(channel->priv->rb_chan);
        if (!buf)
                return -ENOENT;
 
@@ -1615,21 +1654,21 @@ int lttng_abi_open_stream(struct file *channel_file)
        return ret;
 
 fd_error:
-       channel->ops->buffer_read_close(buf);
+       channel->ops->priv->buffer_read_close(buf);
        return ret;
 }
 
 static
 int lttng_abi_open_metadata_stream(struct file *channel_file)
 {
-       struct lttng_channel *channel = channel_file->private_data;
-       struct lttng_session *session = channel->session;
-       struct lib_ring_buffer *buf;
+       struct lttng_kernel_channel_buffer *channel = channel_file->private_data;
+       struct lttng_kernel_session *session = channel->parent.session;
+       struct lttng_kernel_ring_buffer *buf;
        int ret;
        struct lttng_metadata_stream *metadata_stream;
        void *stream_priv;
 
-       buf = channel->ops->buffer_read_open(channel->chan);
+       buf = channel->ops->priv->buffer_read_open(channel->priv->rb_chan);
        if (!buf)
                return -ENOENT;
 
@@ -1639,11 +1678,11 @@ int lttng_abi_open_metadata_stream(struct file *channel_file)
                ret = -ENOMEM;
                goto nomem;
        }
-       metadata_stream->metadata_cache = session->metadata_cache;
+       metadata_stream->metadata_cache = session->priv->metadata_cache;
        init_waitqueue_head(&metadata_stream->read_wait);
        metadata_stream->priv = buf;
        stream_priv = metadata_stream;
-       metadata_stream->transport = channel->transport;
+       metadata_stream->transport = channel->priv->transport;
        /* Initial state is an empty metadata, considered as incoherent. */
        metadata_stream->coherent = false;
 
@@ -1657,7 +1696,7 @@ int lttng_abi_open_metadata_stream(struct file *channel_file)
                goto notransport;
        }
 
-       if (!lttng_kref_get(&session->metadata_cache->refcount)) {
+       if (!lttng_kref_get(&session->priv->metadata_cache->refcount)) {
                ret = -EOVERFLOW;
                goto kref_error;
        }
@@ -1668,20 +1707,20 @@ int lttng_abi_open_metadata_stream(struct file *channel_file)
        if (ret < 0)
                goto fd_error;
 
-       mutex_lock(&session->metadata_cache->lock);
+       mutex_lock(&session->priv->metadata_cache->lock);
        list_add(&metadata_stream->list,
-               &session->metadata_cache->metadata_stream);
-       mutex_unlock(&session->metadata_cache->lock);
+               &session->priv->metadata_cache->metadata_stream);
+       mutex_unlock(&session->priv->metadata_cache->lock);
        return ret;
 
 fd_error:
-       kref_put(&session->metadata_cache->refcount, metadata_cache_destroy);
+       kref_put(&session->priv->metadata_cache->refcount, metadata_cache_destroy);
 kref_error:
        module_put(metadata_stream->transport->owner);
 notransport:
        kfree(metadata_stream);
 nomem:
-       channel->ops->buffer_read_close(buf);
+       channel->ops->priv->buffer_read_close(buf);
        return ret;
 }
 
@@ -1689,12 +1728,12 @@ static
 int lttng_abi_open_event_notifier_group_stream(struct file *notif_file)
 {
        struct lttng_event_notifier_group *event_notifier_group = notif_file->private_data;
-       struct channel *chan = event_notifier_group->chan;
-       struct lib_ring_buffer *buf;
+       struct lttng_kernel_ring_buffer_channel *chan = event_notifier_group->chan;
+       struct lttng_kernel_ring_buffer *buf;
        int ret;
        void *stream_priv;
 
-       buf = event_notifier_group->ops->buffer_read_open(chan);
+       buf = event_notifier_group->ops->priv->buffer_read_open(chan);
        if (!buf)
                return -ENOENT;
 
@@ -1716,7 +1755,7 @@ int lttng_abi_open_event_notifier_group_stream(struct file *notif_file)
 fd_error:
        atomic_long_dec(&notif_file->f_count);
 refcount_error:
-       event_notifier_group->ops->buffer_read_close(buf);
+       event_notifier_group->ops->priv->buffer_read_close(buf);
        return ret;
 }
 
@@ -1727,8 +1766,10 @@ int lttng_abi_validate_event_param(struct lttng_kernel_abi_event *event_param)
        switch (event_param->instrumentation) {
        case LTTNG_KERNEL_ABI_SYSCALL:
                switch (event_param->u.syscall.entryexit) {
-               case LTTNG_KERNEL_ABI_SYSCALL_ENTRY:    /* Fall-through */
-               case LTTNG_KERNEL_ABI_SYSCALL_EXIT:             /* Fall-through */
+               case LTTNG_KERNEL_ABI_SYSCALL_ENTRY:
+                       lttng_fallthrough;
+               case LTTNG_KERNEL_ABI_SYSCALL_EXIT:
+                       lttng_fallthrough;
                case LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT:
                        break;
                default:
@@ -1752,20 +1793,26 @@ int lttng_abi_validate_event_param(struct lttng_kernel_abi_event *event_param)
                switch (event_param->u.kretprobe.entryexit) {
                case LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT:
                        break;
-               case LTTNG_KERNEL_ABI_SYSCALL_ENTRY:    /* Fall-through */
-               case LTTNG_KERNEL_ABI_SYSCALL_EXIT:             /* Fall-through */
+               case LTTNG_KERNEL_ABI_SYSCALL_ENTRY:
+                       lttng_fallthrough;
+               case LTTNG_KERNEL_ABI_SYSCALL_EXIT:
+                       lttng_fallthrough;
                default:
                        return -EINVAL;
                }
                break;
 
-       case LTTNG_KERNEL_ABI_TRACEPOINT:       /* Fall-through */
-       case LTTNG_KERNEL_ABI_KPROBE:   /* Fall-through */
+       case LTTNG_KERNEL_ABI_TRACEPOINT:
+               lttng_fallthrough;
+       case LTTNG_KERNEL_ABI_KPROBE:
+               lttng_fallthrough;
        case LTTNG_KERNEL_ABI_UPROBE:
                break;
 
-       case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
-       case LTTNG_KERNEL_ABI_NOOP:             /* Fall-through */
+       case LTTNG_KERNEL_ABI_FUNCTION:
+               lttng_fallthrough;
+       case LTTNG_KERNEL_ABI_NOOP:
+               lttng_fallthrough;
        default:
                return -EINVAL;
        }
@@ -1777,7 +1824,7 @@ int lttng_abi_create_event(struct file *channel_file,
                           struct lttng_kernel_abi_event *event_param)
 {
        const struct file_operations *fops;
-       struct lttng_channel *channel = channel_file->private_data;
+       struct lttng_kernel_channel_buffer *channel = channel_file->private_data;
        int event_fd, ret;
        struct file *event_file;
        void *priv;
@@ -1799,23 +1846,28 @@ int lttng_abi_create_event(struct file *channel_file,
        }
 
        switch (event_param->instrumentation) {
-       case LTTNG_KERNEL_ABI_TRACEPOINT:               /* Fall-through */
+       case LTTNG_KERNEL_ABI_TRACEPOINT:
+               lttng_fallthrough;
        case LTTNG_KERNEL_ABI_SYSCALL:
                fops = &lttng_event_recorder_enabler_fops;
                break;
-       case LTTNG_KERNEL_ABI_KPROBE:                   /* Fall-through */
-       case LTTNG_KERNEL_ABI_KRETPROBE:                /* Fall-through */
+       case LTTNG_KERNEL_ABI_KPROBE:
+               lttng_fallthrough;
+       case LTTNG_KERNEL_ABI_KRETPROBE:
+               lttng_fallthrough;
        case LTTNG_KERNEL_ABI_UPROBE:
                fops = &lttng_event_recorder_event_fops;
                break;
 
-       case LTTNG_KERNEL_ABI_FUNCTION:                 /* Fall-through */
-       case LTTNG_KERNEL_ABI_NOOP:                     /* Fall-through */
+       case LTTNG_KERNEL_ABI_FUNCTION:
+               lttng_fallthrough;
+       case LTTNG_KERNEL_ABI_NOOP:
+               lttng_fallthrough;
        default:
                return -EINVAL;
        }
 
-       event_fd = lttng_get_unused_fd();
+       event_fd = get_unused_fd_flags(0);
        if (event_fd < 0) {
                ret = event_fd;
                goto fd_error;
@@ -1836,50 +1888,63 @@ int lttng_abi_create_event(struct file *channel_file,
                goto event_error;
 
        switch (event_param->instrumentation) {
-       case LTTNG_KERNEL_ABI_TRACEPOINT:               /* Fall-through */
+       case LTTNG_KERNEL_ABI_TRACEPOINT:
+               lttng_fallthrough;
        case LTTNG_KERNEL_ABI_SYSCALL:
        {
-               struct lttng_event_enabler *event_enabler;
+               struct lttng_event_recorder_enabler *event_enabler;
 
                if (strutils_is_star_glob_pattern(event_param->name)) {
                        /*
                         * If the event name is a star globbing pattern,
                         * we create the special star globbing enabler.
                         */
-                       event_enabler = lttng_event_enabler_create(LTTNG_ENABLER_FORMAT_STAR_GLOB,
+                       event_enabler = lttng_event_recorder_enabler_create(LTTNG_ENABLER_FORMAT_STAR_GLOB,
                                event_param, channel);
                } else {
-                       event_enabler = lttng_event_enabler_create(LTTNG_ENABLER_FORMAT_NAME,
+                       event_enabler = lttng_event_recorder_enabler_create(LTTNG_ENABLER_FORMAT_NAME,
                                event_param, channel);
                }
+               if (event_enabler)
+                       lttng_event_enabler_session_add(channel->parent.session, event_enabler);
                priv = event_enabler;
                break;
        }
 
-       case LTTNG_KERNEL_ABI_KPROBE:                   /* Fall-through */
-       case LTTNG_KERNEL_ABI_KRETPROBE:                /* Fall-through */
+       case LTTNG_KERNEL_ABI_KPROBE:
+               lttng_fallthrough;
+       case LTTNG_KERNEL_ABI_KRETPROBE:
+               lttng_fallthrough;
        case LTTNG_KERNEL_ABI_UPROBE:
        {
-               struct lttng_event *event;
+               struct lttng_kernel_event_common *event;
+               struct lttng_event_recorder_enabler *event_enabler;
 
+               event_enabler = lttng_event_recorder_enabler_create(LTTNG_ENABLER_FORMAT_NAME,
+                               event_param, channel);
+               if (!event_enabler) {
+                       ret = -ENOMEM;
+                       goto event_error;
+               }
                /*
                 * We tolerate no failure path after event creation. It
                 * will stay invariant for the rest of the session.
                 */
-               event = lttng_event_create(channel, event_param,
-                               NULL, NULL,
-                               event_param->instrumentation);
-               WARN_ON_ONCE(!event);
+               event = lttng_kernel_event_create(&event_enabler->parent, NULL);
+               WARN_ON_ONCE(IS_ERR(event));
+               lttng_event_enabler_destroy(&event_enabler->parent);
                if (IS_ERR(event)) {
                        ret = PTR_ERR(event);
                        goto event_error;
                }
-               priv = event;
+               priv = container_of(event, struct lttng_kernel_event_recorder, parent);
                break;
        }
 
-       case LTTNG_KERNEL_ABI_FUNCTION:                 /* Fall-through */
-       case LTTNG_KERNEL_ABI_NOOP:                     /* Fall-through */
+       case LTTNG_KERNEL_ABI_FUNCTION:
+               lttng_fallthrough;
+       case LTTNG_KERNEL_ABI_NOOP:
+               lttng_fallthrough;
        default:
                ret = -EINVAL;
                goto event_error;
@@ -1901,19 +1966,19 @@ fd_error:
 static
 long lttng_event_notifier_event_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-       struct lttng_event_notifier *event_notifier = file->private_data;
+       struct lttng_kernel_event_notifier *event_notifier = file->private_data;
 
        switch (cmd) {
        case LTTNG_KERNEL_ABI_ENABLE:
-               return lttng_event_notifier_enable(event_notifier);
+               return lttng_event_enable(&event_notifier->parent);
        case LTTNG_KERNEL_ABI_DISABLE:
-               return lttng_event_notifier_disable(event_notifier);
+               return lttng_event_disable(&event_notifier->parent);
        case LTTNG_KERNEL_ABI_FILTER:
                return -EINVAL;
        case LTTNG_KERNEL_ABI_CAPTURE:
                return -EINVAL;
        case LTTNG_KERNEL_ABI_ADD_CALLSITE:
-               return lttng_event_notifier_add_callsite(event_notifier,
+               return lttng_event_add_callsite(&event_notifier->parent,
                        (struct lttng_kernel_abi_event_callsite __user *) arg);
        default:
                return -ENOIOCTLCMD;
@@ -1927,12 +1992,11 @@ long lttng_event_notifier_enabler_ioctl(struct file *file, unsigned int cmd, uns
 
        switch (cmd) {
        case LTTNG_KERNEL_ABI_ENABLE:
-               return lttng_event_notifier_enabler_enable(event_notifier_enabler);
+               return lttng_event_enabler_enable(&event_notifier_enabler->parent);
        case LTTNG_KERNEL_ABI_DISABLE:
-               return lttng_event_notifier_enabler_disable(event_notifier_enabler);
+               return lttng_event_enabler_disable(&event_notifier_enabler->parent);
        case LTTNG_KERNEL_ABI_FILTER:
-               return lttng_event_notifier_enabler_attach_filter_bytecode(
-                               event_notifier_enabler,
+               return lttng_event_enabler_attach_filter_bytecode(&event_notifier_enabler->parent,
                        (struct lttng_kernel_abi_filter_bytecode __user *) arg);
        case LTTNG_KERNEL_ABI_CAPTURE:
                return lttng_event_notifier_enabler_attach_capture_bytecode(
@@ -1948,10 +2012,10 @@ long lttng_event_notifier_enabler_ioctl(struct file *file, unsigned int cmd, uns
 static
 int lttng_event_notifier_event_release(struct inode *inode, struct file *file)
 {
-       struct lttng_event_notifier *event_notifier = file->private_data;
+       struct lttng_kernel_event_notifier *event_notifier = file->private_data;
 
        if (event_notifier)
-               fput(event_notifier->group->file);
+               fput(event_notifier->priv->group->file);
        return 0;
 }
 
@@ -2013,18 +2077,23 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file,
        }
 
        switch (event_notifier_param->event.instrumentation) {
-       case LTTNG_KERNEL_ABI_TRACEPOINT:               /* Fall-through */
+       case LTTNG_KERNEL_ABI_TRACEPOINT:
+               lttng_fallthrough;
        case LTTNG_KERNEL_ABI_SYSCALL:
                fops = &lttng_event_notifier_enabler_fops;
                break;
-       case LTTNG_KERNEL_ABI_KPROBE:                   /* Fall-through */
-       case LTTNG_KERNEL_ABI_KRETPROBE:                /* Fall-through */
+       case LTTNG_KERNEL_ABI_KPROBE:
+               lttng_fallthrough;
+       case LTTNG_KERNEL_ABI_KRETPROBE:
+               lttng_fallthrough;
        case LTTNG_KERNEL_ABI_UPROBE:
                fops = &lttng_event_notifier_event_fops;
                break;
 
-       case LTTNG_KERNEL_ABI_FUNCTION:                 /* Fall-through */
-       case LTTNG_KERNEL_ABI_NOOP:                     /* Fall-through */
+       case LTTNG_KERNEL_ABI_FUNCTION:
+               lttng_fallthrough;
+       case LTTNG_KERNEL_ABI_NOOP:
+               lttng_fallthrough;
        default:
                ret = -EINVAL;
                goto inval_instr;
@@ -2032,7 +2101,7 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file,
 
        event_notifier_param->event.name[LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1] = '\0';
 
-       event_notifier_fd = lttng_get_unused_fd();
+       event_notifier_fd = get_unused_fd_flags(0);
        if (event_notifier_fd < 0) {
                ret = event_notifier_fd;
                goto fd_error;
@@ -2056,7 +2125,8 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file,
                goto event_notifier_error;
 
        switch (event_notifier_param->event.instrumentation) {
-       case LTTNG_KERNEL_ABI_TRACEPOINT:               /* Fall-through */
+       case LTTNG_KERNEL_ABI_TRACEPOINT:
+               lttng_fallthrough;
        case LTTNG_KERNEL_ABI_SYSCALL:
        {
                struct lttng_event_notifier_enabler *enabler;
@@ -2067,46 +2137,51 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file,
                         * we create the special star globbing enabler.
                         */
                        enabler = lttng_event_notifier_enabler_create(
-                                       event_notifier_group,
                                        LTTNG_ENABLER_FORMAT_STAR_GLOB,
-                                       event_notifier_param);
+                                       event_notifier_param,
+                                       event_notifier_group);
                } else {
                        enabler = lttng_event_notifier_enabler_create(
-                                       event_notifier_group,
                                        LTTNG_ENABLER_FORMAT_NAME,
-                                       event_notifier_param);
+                                       event_notifier_param,
+                                       event_notifier_group);
                }
+               if (enabler)
+                       lttng_event_notifier_enabler_group_add(event_notifier_group, enabler);
                priv = enabler;
                break;
        }
 
-       case LTTNG_KERNEL_ABI_KPROBE:                   /* Fall-through */
-       case LTTNG_KERNEL_ABI_KRETPROBE:                /* Fall-through */
+       case LTTNG_KERNEL_ABI_KPROBE:
+               lttng_fallthrough;
+       case LTTNG_KERNEL_ABI_KRETPROBE:
+               lttng_fallthrough;
        case LTTNG_KERNEL_ABI_UPROBE:
        {
-               struct lttng_event_notifier *event_notifier;
+               struct lttng_kernel_event_common *event;
+               struct lttng_event_notifier_enabler *event_notifier_enabler;
 
-               /*
-                * We tolerate no failure path after event notifier creation.
-                * It will stay invariant for the rest of the session.
-                */
-               event_notifier = lttng_event_notifier_create(NULL,
-                               event_notifier_param->event.token,
-                               event_notifier_param->error_counter_index,
-                               event_notifier_group,
-                               event_notifier_param, NULL,
-                               event_notifier_param->event.instrumentation);
-               WARN_ON_ONCE(!event_notifier);
-               if (IS_ERR(event_notifier)) {
-                       ret = PTR_ERR(event_notifier);
+               event_notifier_enabler = lttng_event_notifier_enabler_create(LTTNG_ENABLER_FORMAT_NAME,
+                               event_notifier_param, event_notifier_group);
+               if (!event_notifier_enabler) {
+                       ret = -ENOMEM;
                        goto event_notifier_error;
                }
-               priv = event_notifier;
+               event = lttng_kernel_event_create(&event_notifier_enabler->parent, NULL);
+               WARN_ON_ONCE(IS_ERR(event));
+               lttng_event_enabler_destroy(&event_notifier_enabler->parent);
+               if (IS_ERR(event)) {
+                       ret = PTR_ERR(event);
+                       goto event_notifier_error;
+               }
+               priv = container_of(event, struct lttng_kernel_event_notifier, parent);
                break;
        }
 
-       case LTTNG_KERNEL_ABI_FUNCTION:                 /* Fall-through */
-       case LTTNG_KERNEL_ABI_NOOP:                     /* Fall-through */
+       case LTTNG_KERNEL_ABI_FUNCTION:
+               lttng_fallthrough;
+       case LTTNG_KERNEL_ABI_NOOP:
+               lttng_fallthrough;
        default:
                ret = -EINVAL;
                goto event_notifier_error;
@@ -2173,7 +2248,7 @@ long lttng_abi_event_notifier_group_create_error_counter(
                goto fd_error;
        }
 
-       counter_fd = lttng_get_unused_fd();
+       counter_fd = get_unused_fd_flags(0);
        if (counter_fd < 0) {
                ret = counter_fd;
                goto fd_error;
@@ -2207,7 +2282,7 @@ long lttng_abi_event_notifier_group_create_error_counter(
         * in record_error. Ensures the counter is created and the
         * error_counter_len is set before they are used.
         */
-       lttng_smp_store_release(&event_notifier_group->error_counter, counter);
+       smp_store_release(&event_notifier_group->error_counter, counter);
 
        counter->file = counter_file;
        counter->owner = event_notifier_group->file;
@@ -2312,7 +2387,7 @@ static const struct file_operations lttng_event_notifier_group_fops = {
 static
 long lttng_channel_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-       struct lttng_channel *channel = file->private_data;
+       struct lttng_kernel_channel_buffer *channel = file->private_data;
 
        switch (cmd) {
        case LTTNG_KERNEL_ABI_OLD_STREAM:
@@ -2435,7 +2510,7 @@ old_event_end:
 
                ret = lttng_abi_add_context(file,
                                ucontext_param,
-                               &channel->ctx, channel->session);
+                               &channel->priv->ctx, channel->parent.session);
 
 old_ctx_error_free_old_param:
                kfree(old_ucontext_param);
@@ -2454,16 +2529,16 @@ old_ctx_end:
                        return -EFAULT;
                return lttng_abi_add_context(file,
                                &ucontext_param,
-                               &channel->ctx, channel->session);
+                               &channel->priv->ctx, channel->parent.session);
        }
        case LTTNG_KERNEL_ABI_OLD_ENABLE:
        case LTTNG_KERNEL_ABI_ENABLE:
-               return lttng_channel_enable(channel);
+               return lttng_channel_enable(&channel->parent);
        case LTTNG_KERNEL_ABI_OLD_DISABLE:
        case LTTNG_KERNEL_ABI_DISABLE:
-               return lttng_channel_disable(channel);
+               return lttng_channel_disable(&channel->parent);
        case LTTNG_KERNEL_ABI_SYSCALL_MASK:
-               return lttng_channel_syscall_mask(channel,
+               return lttng_syscall_table_get_active_mask(&channel->priv->parent.syscall_table,
                        (struct lttng_kernel_abi_syscall_mask __user *) arg);
        default:
                return -ENOIOCTLCMD;
@@ -2503,19 +2578,19 @@ long lttng_metadata_ioctl(struct file *file, unsigned int cmd, unsigned long arg
  */
 unsigned int lttng_channel_poll(struct file *file, poll_table *wait)
 {
-       struct lttng_channel *channel = file->private_data;
+       struct lttng_kernel_channel_buffer *channel = file->private_data;
        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),
+               poll_wait(file, channel->ops->priv->get_hp_wait_queue(channel->priv->rb_chan),
                          wait);
 
-               if (channel->ops->is_disabled(channel->chan))
+               if (channel->ops->priv->is_disabled(channel->priv->rb_chan))
                        return POLLERR;
-               if (channel->ops->is_finalized(channel->chan))
+               if (channel->ops->priv->is_finalized(channel->priv->rb_chan))
                        return POLLHUP;
-               if (channel->ops->buffer_has_read_closed_stream(channel->chan))
+               if (channel->ops->priv->buffer_has_read_closed_stream(channel->priv->rb_chan))
                        return POLLIN | POLLRDNORM;
                return 0;
        }
@@ -2526,20 +2601,20 @@ unsigned int lttng_channel_poll(struct file *file, poll_table *wait)
 static
 int lttng_channel_release(struct inode *inode, struct file *file)
 {
-       struct lttng_channel *channel = file->private_data;
+       struct lttng_kernel_channel_buffer *channel = file->private_data;
 
        if (channel)
-               fput(channel->session->file);
+               fput(channel->parent.session->priv->file);
        return 0;
 }
 
 static
 int lttng_metadata_channel_release(struct inode *inode, struct file *file)
 {
-       struct lttng_channel *channel = file->private_data;
+       struct lttng_kernel_channel_buffer *channel = file->private_data;
 
        if (channel) {
-               fput(channel->session->file);
+               fput(channel->parent.session->priv->file);
                lttng_metadata_channel_destroy(channel);
        }
 
@@ -2583,7 +2658,7 @@ static const struct file_operations lttng_metadata_fops = {
 static
 long lttng_event_recorder_event_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-       struct lttng_event *event = file->private_data;
+       struct lttng_kernel_event_recorder *event_recorder = file->private_data;
 
        switch (cmd) {
        case LTTNG_KERNEL_ABI_OLD_CONTEXT:
@@ -2598,14 +2673,14 @@ long lttng_event_recorder_event_ioctl(struct file *file, unsigned int cmd, unsig
        }
        case LTTNG_KERNEL_ABI_OLD_ENABLE:
        case LTTNG_KERNEL_ABI_ENABLE:
-               return lttng_event_enable(event);
+               return lttng_event_enable(&event_recorder->parent);
        case LTTNG_KERNEL_ABI_OLD_DISABLE:
        case LTTNG_KERNEL_ABI_DISABLE:
-               return lttng_event_disable(event);
+               return lttng_event_disable(&event_recorder->parent);
        case LTTNG_KERNEL_ABI_FILTER:
                return -EINVAL;
        case LTTNG_KERNEL_ABI_ADD_CALLSITE:
-               return lttng_event_add_callsite(event,
+               return lttng_event_add_callsite(&event_recorder->parent,
                        (struct lttng_kernel_abi_event_callsite __user *) arg);
        default:
                return -ENOIOCTLCMD;
@@ -2630,7 +2705,7 @@ long lttng_event_recorder_event_ioctl(struct file *file, unsigned int cmd, unsig
 static
 long lttng_event_recorder_enabler_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-       struct lttng_event_enabler *event_enabler = file->private_data;
+       struct lttng_event_recorder_enabler *event_enabler = file->private_data;
 
        switch (cmd) {
        case LTTNG_KERNEL_ABI_OLD_CONTEXT:
@@ -2645,13 +2720,12 @@ long lttng_event_recorder_enabler_ioctl(struct file *file, unsigned int cmd, uns
        }
        case LTTNG_KERNEL_ABI_OLD_ENABLE:
        case LTTNG_KERNEL_ABI_ENABLE:
-               return lttng_event_enabler_enable(event_enabler);
+               return lttng_event_enabler_enable(&event_enabler->parent);
        case LTTNG_KERNEL_ABI_OLD_DISABLE:
        case LTTNG_KERNEL_ABI_DISABLE:
-               return lttng_event_enabler_disable(event_enabler);
+               return lttng_event_enabler_disable(&event_enabler->parent);
        case LTTNG_KERNEL_ABI_FILTER:
-               return lttng_event_enabler_attach_filter_bytecode(
-                       event_enabler,
+               return lttng_event_enabler_attach_filter_bytecode(&event_enabler->parent,
                        (struct lttng_kernel_abi_filter_bytecode __user *) arg);
        case LTTNG_KERNEL_ABI_ADD_CALLSITE:
                return -EINVAL;
@@ -2663,20 +2737,20 @@ long lttng_event_recorder_enabler_ioctl(struct file *file, unsigned int cmd, uns
 static
 int lttng_event_recorder_event_release(struct inode *inode, struct file *file)
 {
-       struct lttng_event *event = file->private_data;
+       struct lttng_kernel_event_recorder *event = file->private_data;
 
        if (event)
-               fput(event->chan->file);
+               fput(event->chan->priv->parent.file);
        return 0;
 }
 
 static
 int lttng_event_recorder_enabler_release(struct inode *inode, struct file *file)
 {
-       struct lttng_event_enabler *event_enabler = file->private_data;
+       struct lttng_event_recorder_enabler *event_enabler = file->private_data;
 
        if (event_enabler)
-               fput(event_enabler->chan->file);
+               fput(event_enabler->chan->priv->parent.file);
        return 0;
 }
 
@@ -2711,10 +2785,10 @@ static int put_u32(uint32_t val, unsigned long arg)
 static long lttng_stream_ring_buffer_ioctl(struct file *filp,
                unsigned int cmd, unsigned long arg)
 {
-       struct lib_ring_buffer *buf = filp->private_data;
-       struct channel *chan = buf->backend.chan;
-       const struct lib_ring_buffer_config *config = &chan->backend.config;
-       const struct lttng_channel_ops *ops = chan->backend.priv_ops;
+       struct lttng_kernel_ring_buffer *buf = filp->private_data;
+       struct lttng_kernel_ring_buffer_channel *chan = buf->backend.chan;
+       const struct lttng_kernel_ring_buffer_config *config = &chan->backend.config;
+       const struct lttng_kernel_channel_buffer_ops *ops = chan->backend.priv_ops;
        int ret;
 
        if (atomic_read(&chan->record_disabled))
@@ -2725,7 +2799,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp,
        {
                uint64_t ts;
 
-               ret = ops->timestamp_begin(config, buf, &ts);
+               ret = ops->priv->timestamp_begin(config, buf, &ts);
                if (ret < 0)
                        goto error;
                return put_u64(ts, arg);
@@ -2734,7 +2808,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp,
        {
                uint64_t ts;
 
-               ret = ops->timestamp_end(config, buf, &ts);
+               ret = ops->priv->timestamp_end(config, buf, &ts);
                if (ret < 0)
                        goto error;
                return put_u64(ts, arg);
@@ -2743,7 +2817,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp,
        {
                uint64_t ed;
 
-               ret = ops->events_discarded(config, buf, &ed);
+               ret = ops->priv->events_discarded(config, buf, &ed);
                if (ret < 0)
                        goto error;
                return put_u64(ed, arg);
@@ -2752,7 +2826,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp,
        {
                uint64_t cs;
 
-               ret = ops->content_size(config, buf, &cs);
+               ret = ops->priv->content_size(config, buf, &cs);
                if (ret < 0)
                        goto error;
                return put_u64(cs, arg);
@@ -2761,7 +2835,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp,
        {
                uint64_t ps;
 
-               ret = ops->packet_size(config, buf, &ps);
+               ret = ops->priv->packet_size(config, buf, &ps);
                if (ret < 0)
                        goto error;
                return put_u64(ps, arg);
@@ -2770,7 +2844,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp,
        {
                uint64_t si;
 
-               ret = ops->stream_id(config, buf, &si);
+               ret = ops->priv->stream_id(config, buf, &si);
                if (ret < 0)
                        goto error;
                return put_u64(si, arg);
@@ -2779,7 +2853,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp,
        {
                uint64_t ts;
 
-               ret = ops->current_timestamp(config, buf, &ts);
+               ret = ops->priv->current_timestamp(config, buf, &ts);
                if (ret < 0)
                        goto error;
                return put_u64(ts, arg);
@@ -2788,7 +2862,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp,
        {
                uint64_t seq;
 
-               ret = ops->sequence_number(config, buf, &seq);
+               ret = ops->priv->sequence_number(config, buf, &seq);
                if (ret < 0)
                        goto error;
                return put_u64(seq, arg);
@@ -2797,7 +2871,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp,
        {
                uint64_t id;
 
-               ret = ops->instance_id(config, buf, &id);
+               ret = ops->priv->instance_id(config, buf, &id);
                if (ret < 0)
                        goto error;
                return put_u64(id, arg);
@@ -2815,10 +2889,10 @@ error:
 static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp,
                unsigned int cmd, unsigned long arg)
 {
-       struct lib_ring_buffer *buf = filp->private_data;
-       struct channel *chan = buf->backend.chan;
-       const struct lib_ring_buffer_config *config = &chan->backend.config;
-       const struct lttng_channel_ops *ops = chan->backend.priv_ops;
+       struct lttng_kernel_ring_buffer *buf = filp->private_data;
+       struct lttng_kernel_ring_buffer_channel *chan = buf->backend.chan;
+       const struct lttng_kernel_ring_buffer_config *config = &chan->backend.config;
+       const struct lttng_kernel_channel_buffer_ops *ops = chan->backend.priv_ops;
        int ret;
 
        if (atomic_read(&chan->record_disabled))
@@ -2829,7 +2903,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp,
        {
                uint64_t ts;
 
-               ret = ops->timestamp_begin(config, buf, &ts);
+               ret = ops->priv->timestamp_begin(config, buf, &ts);
                if (ret < 0)
                        goto error;
                return put_u64(ts, arg);
@@ -2838,7 +2912,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp,
        {
                uint64_t ts;
 
-               ret = ops->timestamp_end(config, buf, &ts);
+               ret = ops->priv->timestamp_end(config, buf, &ts);
                if (ret < 0)
                        goto error;
                return put_u64(ts, arg);
@@ -2847,7 +2921,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp,
        {
                uint64_t ed;
 
-               ret = ops->events_discarded(config, buf, &ed);
+               ret = ops->priv->events_discarded(config, buf, &ed);
                if (ret < 0)
                        goto error;
                return put_u64(ed, arg);
@@ -2856,7 +2930,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp,
        {
                uint64_t cs;
 
-               ret = ops->content_size(config, buf, &cs);
+               ret = ops->priv->content_size(config, buf, &cs);
                if (ret < 0)
                        goto error;
                return put_u64(cs, arg);
@@ -2865,7 +2939,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp,
        {
                uint64_t ps;
 
-               ret = ops->packet_size(config, buf, &ps);
+               ret = ops->priv->packet_size(config, buf, &ps);
                if (ret < 0)
                        goto error;
                return put_u64(ps, arg);
@@ -2874,7 +2948,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp,
        {
                uint64_t si;
 
-               ret = ops->stream_id(config, buf, &si);
+               ret = ops->priv->stream_id(config, buf, &si);
                if (ret < 0)
                        goto error;
                return put_u64(si, arg);
@@ -2883,7 +2957,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp,
        {
                uint64_t ts;
 
-               ret = ops->current_timestamp(config, buf, &ts);
+               ret = ops->priv->current_timestamp(config, buf, &ts);
                if (ret < 0)
                        goto error;
                return put_u64(ts, arg);
@@ -2892,7 +2966,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp,
        {
                uint64_t seq;
 
-               ret = ops->sequence_number(config, buf, &seq);
+               ret = ops->priv->sequence_number(config, buf, &seq);
                if (ret < 0)
                        goto error;
                return put_u64(seq, arg);
@@ -2901,7 +2975,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp,
        {
                uint64_t id;
 
-               ret = ops->instance_id(config, buf, &id);
+               ret = ops->priv->instance_id(config, buf, &id);
                if (ret < 0)
                        goto error;
                return put_u64(id, arg);
This page took 0.044386 seconds and 4 git commands to generate.