Fix ring buffer 32/64 bits compat
[lttng-modules.git] / lib / ringbuffer / ring_buffer_vfs.c
index 8b783052a5f6cbe510e218120f6c16b56ebc96c5..c69b64e1d9ffea5a17d980f29e64d785b8d23762 100644 (file)
@@ -1,11 +1,23 @@
 /*
  * ring_buffer_vfs.c
  *
- * Copyright (C) 2009-2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
  * Ring Buffer VFS file operations.
  *
- * Dual LGPL v2.1/GPL v2 license.
+ * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; only
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <linux/module.h>
@@ -88,7 +100,7 @@ unsigned int lib_ring_buffer_poll(struct file *filp, poll_table *wait)
        unsigned int mask = 0;
        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 lib_ring_buffer_config *config = &chan->backend.config;
        int finalized, disabled;
 
        if (filp->f_mode & FMODE_READ) {
@@ -165,7 +177,7 @@ long lib_ring_buffer_ioctl(struct file *filp, unsigned int cmd, unsigned long ar
 {
        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 lib_ring_buffer_config *config = &chan->backend.config;
 
        if (lib_ring_buffer_channel_is_disabled(chan))
                return -EIO;
@@ -262,20 +274,20 @@ long lib_ring_buffer_compat_ioctl(struct file *filp, unsigned int cmd,
 {
        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 lib_ring_buffer_config *config = &chan->backend.config;
 
        if (lib_ring_buffer_channel_is_disabled(chan))
                return -EIO;
 
        switch (cmd) {
-       case RING_BUFFER_SNAPSHOT:
+       case RING_BUFFER_COMPAT_SNAPSHOT:
                return lib_ring_buffer_snapshot(buf, &buf->cons_snapshot,
                                                &buf->prod_snapshot);
-       case RING_BUFFER_SNAPSHOT_GET_CONSUMED:
+       case RING_BUFFER_COMPAT_SNAPSHOT_GET_CONSUMED:
                return compat_put_ulong(buf->cons_snapshot, arg);
-       case RING_BUFFER_SNAPSHOT_GET_PRODUCED:
+       case RING_BUFFER_COMPAT_SNAPSHOT_GET_PRODUCED:
                return compat_put_ulong(buf->prod_snapshot, arg);
-       case RING_BUFFER_GET_SUBBUF:
+       case RING_BUFFER_COMPAT_GET_SUBBUF:
        {
                __u32 uconsume;
                unsigned long consume;
@@ -294,11 +306,11 @@ long lib_ring_buffer_compat_ioctl(struct file *filp, unsigned int cmd,
                }
                return ret;
        }
-       case RING_BUFFER_PUT_SUBBUF:
+       case RING_BUFFER_COMPAT_PUT_SUBBUF:
                lib_ring_buffer_put_subbuf(buf);
                return 0;
 
-       case RING_BUFFER_GET_NEXT_SUBBUF:
+       case RING_BUFFER_COMPAT_GET_NEXT_SUBBUF:
        {
                long ret;
 
@@ -309,10 +321,10 @@ long lib_ring_buffer_compat_ioctl(struct file *filp, unsigned int cmd,
                }
                return ret;
        }
-       case RING_BUFFER_PUT_NEXT_SUBBUF:
+       case RING_BUFFER_COMPAT_PUT_NEXT_SUBBUF:
                lib_ring_buffer_put_next_subbuf(buf);
                return 0;
-       case RING_BUFFER_GET_SUBBUF_SIZE:
+       case RING_BUFFER_COMPAT_GET_SUBBUF_SIZE:
        {
                unsigned long data_size;
 
@@ -321,7 +333,7 @@ long lib_ring_buffer_compat_ioctl(struct file *filp, unsigned int cmd,
                        return -EFBIG;
                return put_ulong(data_size, arg);
        }
-       case RING_BUFFER_GET_PADDED_SUBBUF_SIZE:
+       case RING_BUFFER_COMPAT_GET_PADDED_SUBBUF_SIZE:
        {
                unsigned long size;
 
@@ -331,11 +343,11 @@ long lib_ring_buffer_compat_ioctl(struct file *filp, unsigned int cmd,
                        return -EFBIG;
                return put_ulong(size, arg);
        }
-       case RING_BUFFER_GET_MAX_SUBBUF_SIZE:
+       case RING_BUFFER_COMPAT_GET_MAX_SUBBUF_SIZE:
                if (chan->backend.subbuf_size > UINT_MAX)
                        return -EFBIG;
                return put_ulong(chan->backend.subbuf_size, arg);
-       case RING_BUFFER_GET_MMAP_LEN:
+       case RING_BUFFER_COMPAT_GET_MMAP_LEN:
        {
                unsigned long mmap_buf_len;
 
@@ -348,7 +360,7 @@ long lib_ring_buffer_compat_ioctl(struct file *filp, unsigned int cmd,
                        return -EFBIG;
                return put_ulong(mmap_buf_len, arg);
        }
-       case RING_BUFFER_GET_MMAP_READ_OFFSET:
+       case RING_BUFFER_COMPAT_GET_MMAP_READ_OFFSET:
        {
                unsigned long sb_bindex, read_offset;
 
@@ -361,7 +373,7 @@ long lib_ring_buffer_compat_ioctl(struct file *filp, unsigned int cmd,
                        return -EINVAL;
                return put_ulong(read_offset, arg);
        }
-       case RING_BUFFER_FLUSH:
+       case RING_BUFFER_COMPAT_FLUSH:
                lib_ring_buffer_switch_slow(buf, SWITCH_ACTIVE);
                return 0;
        default:
This page took 0.025864 seconds and 4 git commands to generate.