X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=libringbuffer%2Fbackend_internal.h;h=0e5e7940c30efb0cb51b00f5ebf8e21a134b0bc3;hb=1d18d519668cd559dcafa1f18113edceb2418ed0;hp=f492cc3eaff18cb36197f8cf0b0ed0161964cc60;hpb=b4051ad8c170901d5297e1b3005b24e63cb0ab1e;p=lttng-ust.git diff --git a/libringbuffer/backend_internal.h b/libringbuffer/backend_internal.h index f492cc3e..0e5e7940 100644 --- a/libringbuffer/backend_internal.h +++ b/libringbuffer/backend_internal.h @@ -1,33 +1,21 @@ -#ifndef _LTTNG_RING_BUFFER_BACKEND_INTERNAL_H -#define _LTTNG_RING_BUFFER_BACKEND_INTERNAL_H - /* - * libringbuffer/backend_internal.h - * - * Ring buffer backend (internal helpers). + * SPDX-License-Identifier: LGPL-2.1-only * * Copyright (C) 2005-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 + * Ring buffer backend (internal helpers). */ +#ifndef _LTTNG_RING_BUFFER_BACKEND_INTERNAL_H +#define _LTTNG_RING_BUFFER_BACKEND_INTERNAL_H + #include +#include #include #include -#include +#include +#include "ringbuffer-config.h" #include "backend_types.h" #include "frontend_types.h" #include "shm.h" @@ -37,30 +25,47 @@ /* Ring buffer and channel backend create/free */ int lib_ring_buffer_backend_create(struct lttng_ust_lib_ring_buffer_backend *bufb, - struct channel_backend *chan, int cpu, + struct channel_backend *chan, + int cpu, struct lttng_ust_shm_handle *handle, - struct shm_object *shmobj); -void channel_backend_unregister_notifiers(struct channel_backend *chanb); -void lib_ring_buffer_backend_free(struct lttng_ust_lib_ring_buffer_backend *bufb); + struct shm_object *shmobj) + __attribute__((visibility("hidden"))); + +void channel_backend_unregister_notifiers(struct channel_backend *chanb) + __attribute__((visibility("hidden"))); + +void lib_ring_buffer_backend_free(struct lttng_ust_lib_ring_buffer_backend *bufb) + __attribute__((visibility("hidden"))); + int channel_backend_init(struct channel_backend *chanb, const char *name, const struct lttng_ust_lib_ring_buffer_config *config, size_t subbuf_size, size_t num_subbuf, struct lttng_ust_shm_handle *handle, - const int *stream_fds); + const int *stream_fds) + __attribute__((visibility("hidden"))); + void channel_backend_free(struct channel_backend *chanb, - struct lttng_ust_shm_handle *handle); + struct lttng_ust_shm_handle *handle) + __attribute__((visibility("hidden"))); void lib_ring_buffer_backend_reset(struct lttng_ust_lib_ring_buffer_backend *bufb, - struct lttng_ust_shm_handle *handle); -void channel_backend_reset(struct channel_backend *chanb); + struct lttng_ust_shm_handle *handle) + __attribute__((visibility("hidden"))); + +void channel_backend_reset(struct channel_backend *chanb) + __attribute__((visibility("hidden"))); + +int lib_ring_buffer_backend_init(void) + __attribute__((visibility("hidden"))); -int lib_ring_buffer_backend_init(void); -void lib_ring_buffer_backend_exit(void); +void lib_ring_buffer_backend_exit(void) + __attribute__((visibility("hidden"))); extern void _lib_ring_buffer_write(struct lttng_ust_lib_ring_buffer_backend *bufb, size_t offset, const void *src, size_t len, - ssize_t pagecpy); + ssize_t pagecpy) + __attribute__((visibility("hidden"))); /* * Subbuffer ID bits for overwrite mode. Need to fit within a single word to be @@ -202,11 +207,12 @@ int lib_ring_buffer_backend_get_pages(const struct lttng_ust_lib_ring_buffer_con struct lttng_ust_lib_ring_buffer_ctx *ctx, struct lttng_ust_lib_ring_buffer_backend_pages **backend_pages) { - struct lttng_ust_lib_ring_buffer_backend *bufb = &ctx->buf->backend; - struct channel_backend *chanb = &ctx->chan->backend; - struct lttng_ust_shm_handle *handle = ctx->handle; + struct lttng_ust_lib_ring_buffer_ctx_private *ctx_private = ctx->priv; + struct lttng_ust_lib_ring_buffer_backend *bufb = &ctx_private->buf->backend; + struct channel_backend *chanb = &ctx_private->chan->backend; + struct lttng_ust_shm_handle *handle = ctx_private->chan->handle; size_t sbidx; - size_t offset = ctx->buf_offset; + size_t offset = ctx_private->buf_offset; struct lttng_ust_lib_ring_buffer_backend_subbuffer *wsb; struct lttng_ust_lib_ring_buffer_backend_pages_shmp *rpages; unsigned long sb_bindex, id; @@ -222,7 +228,7 @@ int lib_ring_buffer_backend_get_pages(const struct lttng_ust_lib_ring_buffer_con rpages = shmp_index(handle, bufb->array, sb_bindex); if (caa_unlikely(!rpages)) return -1; - CHAN_WARN_ON(ctx->chan, + CHAN_WARN_ON(ctx_private->chan, config->mode == RING_BUFFER_OVERWRITE && subbuffer_id_is_noref(config, id)); _backend_pages = shmp(handle, rpages->shmp); @@ -238,10 +244,7 @@ struct lttng_ust_lib_ring_buffer_backend_pages * lib_ring_buffer_get_backend_pages_from_ctx(const struct lttng_ust_lib_ring_buffer_config *config, struct lttng_ust_lib_ring_buffer_ctx *ctx) { - if (caa_unlikely(ctx->ctx_len - < sizeof(struct lttng_ust_lib_ring_buffer_ctx))) - return NULL; - return ctx->backend_pages; + return ctx->priv->backend_pages; } /* @@ -284,7 +287,7 @@ void subbuffer_consume_record(const struct lttng_ust_lib_ring_buffer_config *con struct lttng_ust_shm_handle *handle) { unsigned long sb_bindex; - struct channel *chan; + struct lttng_ust_lib_ring_buffer_channel *chan; struct lttng_ust_lib_ring_buffer_backend_pages_shmp *pages_shmp; struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; @@ -504,7 +507,7 @@ void lib_ring_buffer_set_noref_offset(const struct lttng_ust_lib_ring_buffer_con struct lttng_ust_shm_handle *handle) { struct lttng_ust_lib_ring_buffer_backend_subbuffer *wsb; - struct channel *chan; + struct lttng_ust_lib_ring_buffer_channel *chan; if (config->mode != RING_BUFFER_OVERWRITE) return; @@ -554,7 +557,7 @@ int update_read_sb_index(const struct lttng_ust_lib_ring_buffer_config *config, return -EPERM; if (config->mode == RING_BUFFER_OVERWRITE) { - struct channel *chan; + struct lttng_ust_lib_ring_buffer_channel *chan; /* * Exchange the target writer subbuffer with our own unused @@ -633,7 +636,7 @@ do { \ * write len bytes to dest with c */ static inline -void lib_ring_buffer_do_memset(char *dest, int c, unsigned long len) +void lib_ring_buffer_do_memset(char *dest, char c, unsigned long len) { unsigned long i;