License cleanup, ifdef namespace cleanup
[lttng-modules.git] / lib / ringbuffer / ring_buffer_mmap.c
index 68221ee9a87030563ed212ac3b32afde26572f92..ec7d9530fd968544ad4ce0b5a70a1740545621ef 100644 (file)
@@ -3,11 +3,23 @@
  *
  * Copyright (C) 2002-2005 - Tom Zanussi <zanussi@us.ibm.com>, IBM Corp
  * Copyright (C) 1999-2005 - Karim Yaghmour <karim@opersys.com>
- * Copyright (C) 2008-2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ * Copyright (C) 2008-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
- * Re-using content from kernel/relay.c.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; only version 2 of the License.
  *
- * This file is released under the GPL v2.
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Re-using code from kernel/relay.c, hence the GPLv2 license for this
+ * file.
  */
 
 #include <linux/module.h>
@@ -24,15 +36,12 @@ static int lib_ring_buffer_fault(struct vm_area_struct *vma, struct vm_fault *vm
 {
        struct lib_ring_buffer *buf = vma->vm_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;
        pgoff_t pgoff = vmf->pgoff;
        struct page **page;
        void **virt;
        unsigned long offset, sb_bindex;
 
-       if (!buf)
-               return VM_FAULT_OOM;
-
        /*
         * Verify that faults are only done on the range of pages owned by the
         * reader.
@@ -77,15 +86,12 @@ static int lib_ring_buffer_mmap_buf(struct lib_ring_buffer *buf,
 {
        unsigned long length = vma->vm_end - vma->vm_start;
        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;
        unsigned long mmap_buf_len;
 
        if (config->output != RING_BUFFER_MMAP)
                return -EINVAL;
 
-       if (!buf)
-               return -EBADF;
-
        mmap_buf_len = chan->backend.buf_size;
        if (chan->backend.extra_reader_sb)
                mmap_buf_len += chan->backend.subbuf_size;
This page took 0.023503 seconds and 4 git commands to generate.