X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lib%2Fringbuffer%2Fring_buffer_mmap.c;h=06b67eb4d3944c410263a5f36ccf5246e409341d;hb=78f56ae3a0c007bf1be7e01731d372f79fe6781e;hp=35d30e7ec75d2426d4b74f3debb3466eb07b74ba;hpb=c075712b6e6ba766c844f4504ac012c49d1f6b4b;p=lttng-modules.git diff --git a/lib/ringbuffer/ring_buffer_mmap.c b/lib/ringbuffer/ring_buffer_mmap.c index 35d30e7e..06b67eb4 100644 --- a/lib/ringbuffer/ring_buffer_mmap.c +++ b/lib/ringbuffer/ring_buffer_mmap.c @@ -1,24 +1,12 @@ -/* +/* SPDX-License-Identifier: GPL-2.0 + * * ring_buffer_mmap.c * * Copyright (C) 2002-2005 - Tom Zanussi , IBM Corp * Copyright (C) 1999-2005 - Karim Yaghmour * Copyright (C) 2008-2012 - Mathieu Desnoyers * - * 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 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 + * Re-using code from kernel/relay.c, hence the GPL-2.0 license for this * file. */ @@ -32,7 +20,12 @@ /* * fault() vm_op implementation for ring buffer file mapping. */ -static int lib_ring_buffer_fault(struct vm_area_struct *vma, struct vm_fault *vmf) +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,1,0) || \ + LTTNG_RHEL_KERNEL_RANGE(4,18,0,193,0,0, 4,19,0,0,0,0)) +static vm_fault_t lib_ring_buffer_fault_compat(struct vm_area_struct *vma, struct vm_fault *vmf) +#else +static int lib_ring_buffer_fault_compat(struct vm_area_struct *vma, struct vm_fault *vmf) +#endif { struct lib_ring_buffer *buf = vma->vm_private_data; struct channel *chan = buf->backend.chan; @@ -65,6 +58,26 @@ static int lib_ring_buffer_fault(struct vm_area_struct *vma, struct vm_fault *vm return 0; } +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,1,0) || \ + LTTNG_RHEL_KERNEL_RANGE(4,18,0,193,0,0, 4,19,0,0,0,0)) +static vm_fault_t lib_ring_buffer_fault(struct vm_fault *vmf) +{ + struct vm_area_struct *vma = vmf->vma; + return lib_ring_buffer_fault_compat(vma, vmf); +} +#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) +static int lib_ring_buffer_fault(struct vm_fault *vmf) +{ + struct vm_area_struct *vma = vmf->vma; + return lib_ring_buffer_fault_compat(vma, vmf); +} +#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */ +static int lib_ring_buffer_fault(struct vm_area_struct *vma, struct vm_fault *vmf) +{ + return lib_ring_buffer_fault_compat(vma, vmf); +} +#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,11,0)) */ + /* * vm_ops for ring buffer file mappings. */