X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lib%2Fringbuffer%2Fbackend_internal.h;h=3a2ce26f145669b913f6a0cde6e5e1c2ee818c59;hb=369708f464bedc0682151df9308cebfa14dbdb2b;hp=cb39ff69fe21fe6bc25fcd9df45e39515a537f71;hpb=327177e66f21b727a85de3c3f1ff06a84d7db461;p=lttng-modules.git diff --git a/lib/ringbuffer/backend_internal.h b/lib/ringbuffer/backend_internal.h index cb39ff69..3a2ce26f 100644 --- a/lib/ringbuffer/backend_internal.h +++ b/lib/ringbuffer/backend_internal.h @@ -1,31 +1,18 @@ -#ifndef _LIB_RING_BUFFER_BACKEND_INTERNAL_H -#define _LIB_RING_BUFFER_BACKEND_INTERNAL_H - -/* +/* SPDX-License-Identifier: (GPL-2.0-only OR LGPL-2.1-only) + * * lib/ringbuffer/backend_internal.h * * Ring buffer backend (internal helpers). * * Copyright (C) 2008-2012 Mathieu Desnoyers - * - * 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 -#include -#include +#ifndef _LIB_RING_BUFFER_BACKEND_INTERNAL_H +#define _LIB_RING_BUFFER_BACKEND_INTERNAL_H + +#include +#include +#include #include #include @@ -171,7 +158,7 @@ void subbuffer_id_set_noref_offset(const struct lib_ring_buffer_config *config, tmp |= offset << SB_ID_OFFSET_SHIFT; tmp |= SB_ID_NOREF_MASK; /* Volatile store, read concurrently by readers. */ - ACCESS_ONCE(*id) = tmp; + WRITE_ONCE(*id, tmp); } } @@ -379,7 +366,7 @@ void lib_ring_buffer_clear_noref(const struct lib_ring_buffer_config *config, * Performing a volatile access to read the sb_pages, because we want to * read a coherent version of the pointer and the associated noref flag. */ - id = ACCESS_ONCE(bufb->buf_wsb[idx].id); + id = READ_ONCE(bufb->buf_wsb[idx].id); for (;;) { /* This check is called on the fast path for each record. */ if (likely(!subbuffer_id_is_noref(config, id))) { @@ -448,7 +435,7 @@ int update_read_sb_index(const struct lib_ring_buffer_config *config, if (config->mode == RING_BUFFER_OVERWRITE) { /* * Exchange the target writer subbuffer with our own unused - * subbuffer. No need to use ACCESS_ONCE() here to read the + * subbuffer. No need to use READ_ONCE() here to read the * old_wpage, because the value read will be confirmed by the * following cmpxchg(). */ @@ -479,7 +466,7 @@ int update_read_sb_index(const struct lib_ring_buffer_config *config, } static inline __attribute__((always_inline)) -void lttng_inline_memcpy(void *dest, const void __user *src, +void lttng_inline_memcpy(void *dest, const void *src, unsigned long len) { switch (len) { @@ -496,7 +483,7 @@ void lttng_inline_memcpy(void *dest, const void __user *src, *(uint64_t *) dest = *(const uint64_t *) src; break; default: - inline_memcpy(dest, src, len); + memcpy(dest, src, len); } }