From: Mathieu Desnoyers Date: Thu, 15 Apr 2021 20:19:13 +0000 (-0400) Subject: Rename lttng_ust_lib_ring_buffer to lttng_ust_ring_buffer X-Git-Tag: v2.13.0-rc1~96 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b5457df5fd74e033cbaa75307f9bbc12aff4ab8f;p=lttng-ust.git Rename lttng_ust_lib_ring_buffer to lttng_ust_ring_buffer Rename type and identifiers across the entire lttng-ust project. The "lib_" part does not add any information. Signed-off-by: Mathieu Desnoyers Change-Id: I861d9edc7c43689288c0765a8f66b20087aa3e88 --- diff --git a/include/lttng/ringbuffer-context.h b/include/lttng/ringbuffer-context.h index 8c9595fd..a31e80e3 100644 --- a/include/lttng/ringbuffer-context.h +++ b/include/lttng/ringbuffer-context.h @@ -19,10 +19,10 @@ #include #include -struct lttng_ust_lib_ring_buffer; -struct lttng_ust_lib_ring_buffer_channel; -struct lttng_ust_lib_ring_buffer_ctx; -struct lttng_ust_lib_ring_buffer_ctx_private; +struct lttng_ust_ring_buffer; +struct lttng_ust_ring_buffer_channel; +struct lttng_ust_ring_buffer_ctx; +struct lttng_ust_ring_buffer_ctx_private; /* * ring buffer context @@ -35,7 +35,7 @@ struct lttng_ust_lib_ring_buffer_ctx_private; * structure. It should be queried before using additional fields added * at the end of the structure. */ -struct lttng_ust_lib_ring_buffer_ctx { +struct lttng_ust_ring_buffer_ctx { uint32_t struct_size; /* Size of this structure. */ void *client_priv; /* Ring buffer client private data */ @@ -47,13 +47,13 @@ struct lttng_ust_lib_ring_buffer_ctx { void *ip; /* caller ip address */ /* Private ring buffer context, set by reserve callback. */ - struct lttng_ust_lib_ring_buffer_ctx_private *priv; + struct lttng_ust_ring_buffer_ctx_private *priv; /* End of base ABI. Fields below should be used after checking struct_size. */ }; /** - * lttng_ust_lib_ring_buffer_ctx_init - initialize ring buffer context + * lttng_ust_ring_buffer_ctx_init - initialize ring buffer context * @ctx: ring buffer context to initialize * @client_priv: client private data * @data_size: size of record data payload @@ -61,16 +61,16 @@ struct lttng_ust_lib_ring_buffer_ctx { * @ip: caller ip address */ static inline -void lttng_ust_lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, +void lttng_ust_ring_buffer_ctx_init(struct lttng_ust_ring_buffer_ctx *ctx, void *client_priv, size_t data_size, int largest_align, void *ip) lttng_ust_notrace; static inline -void lttng_ust_lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, +void lttng_ust_ring_buffer_ctx_init(struct lttng_ust_ring_buffer_ctx *ctx, void *client_priv, size_t data_size, int largest_align, void *ip) { - ctx->struct_size = sizeof(struct lttng_ust_lib_ring_buffer_ctx); + ctx->struct_size = sizeof(struct lttng_ust_ring_buffer_ctx); ctx->client_priv = client_priv; ctx->data_size = data_size; ctx->largest_align = largest_align; @@ -90,15 +90,15 @@ void lttng_ust_lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ct # define LTTNG_UST_RING_BUFFER_ALIGN_ATTR /* Default arch alignment */ /* - * lttng_ust_lib_ring_buffer_align - Calculate the offset needed to align the type. + * lttng_ust_ring_buffer_align - Calculate the offset needed to align the type. * @align_drift: object offset from an "alignment"-aligned address. * @size_of_type: Must be non-zero, power of 2. */ static inline -unsigned int lttng_ust_lib_ring_buffer_align(size_t align_drift, size_t size_of_type) +unsigned int lttng_ust_ring_buffer_align(size_t align_drift, size_t size_of_type) lttng_ust_notrace; static inline -unsigned int lttng_ust_lib_ring_buffer_align(size_t align_drift, size_t size_of_type) +unsigned int lttng_ust_ring_buffer_align(size_t align_drift, size_t size_of_type) { return lttng_ust_offset_align(align_drift, size_of_type); } @@ -108,15 +108,15 @@ unsigned int lttng_ust_lib_ring_buffer_align(size_t align_drift, size_t size_of_ # define LTTNG_UST_RING_BUFFER_ALIGN_ATTR __attribute__((packed)) /* - * lttng_ust_lib_ring_buffer_align - Calculate the offset needed to align the type. + * lttng_ust_ring_buffer_align - Calculate the offset needed to align the type. * @align_drift: object offset from an "alignment"-aligned address. * @size_of_type: Must be non-zero, power of 2. */ static inline -unsigned int lttng_ust_lib_ring_buffer_align(size_t align_drift, size_t size_of_type) +unsigned int lttng_ust_ring_buffer_align(size_t align_drift, size_t size_of_type) lttng_ust_notrace; static inline -unsigned int lttng_ust_lib_ring_buffer_align(size_t align_drift __attribute__((unused)), +unsigned int lttng_ust_ring_buffer_align(size_t align_drift __attribute__((unused)), size_t size_of_type __attribute__((unused))) { /* diff --git a/include/lttng/ust-ctl.h b/include/lttng/ust-ctl.h index 9cf724a7..a6e18023 100644 --- a/include/lttng/ust-ctl.h +++ b/include/lttng/ust-ctl.h @@ -34,8 +34,6 @@ "lttng-ust-wait-" \ lttng_ust_stringify(LTTNG_UST_ABI_MAJOR_VERSION) -struct lttng_ust_lib_ring_buffer; - struct ustctl_consumer_channel_attr { enum lttng_ust_abi_chan_type type; uint64_t subbuf_size; /* bytes */ diff --git a/include/lttng/ust-events.h b/include/lttng/ust-events.h index 63a6f158..2b035d8f 100644 --- a/include/lttng/ust-events.h +++ b/include/lttng/ust-events.h @@ -37,7 +37,7 @@ extern "C" { struct lttng_ust_channel_buffer; struct lttng_ust_session; -struct lttng_ust_lib_ring_buffer_ctx; +struct lttng_ust_ring_buffer_ctx; struct lttng_ust_event_field; struct lttng_ust_registered_probe; @@ -429,7 +429,7 @@ struct lttng_ust_event_notifier { /* End of base ABI. Fields below should be used after checking struct_size. */ }; -struct lttng_ust_lib_ring_buffer_channel; +struct lttng_ust_ring_buffer_channel; struct lttng_ust_channel_buffer_ops_private; /* @@ -446,13 +446,13 @@ struct lttng_ust_channel_buffer_ops { struct lttng_ust_channel_buffer_ops_private *priv; /* Private channel buffer ops interface */ - int (*event_reserve)(struct lttng_ust_lib_ring_buffer_ctx *ctx); - void (*event_commit)(struct lttng_ust_lib_ring_buffer_ctx *ctx); - void (*event_write)(struct lttng_ust_lib_ring_buffer_ctx *ctx, + int (*event_reserve)(struct lttng_ust_ring_buffer_ctx *ctx); + void (*event_commit)(struct lttng_ust_ring_buffer_ctx *ctx); + void (*event_write)(struct lttng_ust_ring_buffer_ctx *ctx, const void *src, size_t len, size_t alignment); - void (*event_strcpy)(struct lttng_ust_lib_ring_buffer_ctx *ctx, + void (*event_strcpy)(struct lttng_ust_ring_buffer_ctx *ctx, const char *src, size_t len); - void (*event_pstrcpy_pad)(struct lttng_ust_lib_ring_buffer_ctx *ctx, + void (*event_pstrcpy_pad)(struct lttng_ust_ring_buffer_ctx *ctx, const char *src, size_t len); /* End of base ABI. Fields below should be used after checking struct_size. */ diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index 7b99ecb6..28684092 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -413,14 +413,14 @@ static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)); #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \ if (0) \ (void) (_src); /* Unused */ \ - __event_len += lttng_ust_lib_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \ + __event_len += lttng_ust_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \ __event_len += sizeof(_type); #undef _ctf_float #define _ctf_float(_type, _item, _src, _nowrite) \ if (0) \ (void) (_src); /* Unused */ \ - __event_len += lttng_ust_lib_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \ + __event_len += lttng_ust_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \ __event_len += sizeof(_type); #undef _ctf_array_encoded @@ -428,7 +428,7 @@ static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)); _nowrite, _elem_type_base) \ if (0) \ (void) (_src); /* Unused */ \ - __event_len += lttng_ust_lib_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \ + __event_len += lttng_ust_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \ __event_len += sizeof(_type) * (_length); #undef _ctf_sequence_encoded @@ -436,9 +436,9 @@ static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)); _src_length, _encoding, _nowrite, _elem_type_base) \ if (0) \ (void) (_src); /* Unused */ \ - __event_len += lttng_ust_lib_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_length_type)); \ + __event_len += lttng_ust_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_length_type)); \ __event_len += sizeof(_length_type); \ - __event_len += lttng_ust_lib_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \ + __event_len += lttng_ust_ring_buffer_align(__event_len, lttng_ust_rb_alignof(_type)); \ __dynamic_len[__dynamic_len_idx] = (_src_length); \ __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx]; \ __dynamic_len_idx++; @@ -889,12 +889,12 @@ void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) \ size_t __event_len, __event_align; \ struct lttng_ust_event_recorder *__event_recorder = (struct lttng_ust_event_recorder *) __event->child; \ struct lttng_ust_channel_buffer *__chan = __event_recorder->chan; \ - struct lttng_ust_lib_ring_buffer_ctx __ctx; \ + struct lttng_ust_ring_buffer_ctx __ctx; \ \ __event_len = __event_get_size__##_provider##___##_name(__stackvar.__dynamic_len, \ _TP_ARGS_DATA_VAR(_args)); \ __event_align = __event_get_align__##_provider##___##_name(_TP_ARGS_VAR(_args)); \ - lttng_ust_lib_ring_buffer_ctx_init(&__ctx, __event_recorder, __event_len, __event_align, \ + lttng_ust_ring_buffer_ctx_init(&__ctx, __event_recorder, __event_len, __event_align, \ _TP_IP_PARAM(TP_IP_PARAM)); \ __ret = __chan->ops->event_reserve(&__ctx); \ if (__ret < 0) \ diff --git a/src/common/events.h b/src/common/events.h index bf3367b7..e827f71d 100644 --- a/src/common/events.h +++ b/src/common/events.h @@ -253,7 +253,7 @@ struct lttng_transport { const char *name; struct cds_list_head node; struct lttng_ust_channel_buffer_ops ops; - const struct lttng_ust_lib_ring_buffer_config *client_config; + const struct lttng_ust_ring_buffer_config *client_config; }; struct lttng_counter_transport { @@ -389,7 +389,7 @@ struct lttng_ust_channel_buffer_private { unsigned int id; /* Channel ID */ enum lttng_ust_abi_chan_type type; struct lttng_ust_ctx *ctx; - struct lttng_ust_lib_ring_buffer_channel *rb_chan; /* Ring buffer channel */ + struct lttng_ust_ring_buffer_channel *rb_chan; /* Ring buffer channel */ unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */ }; @@ -442,7 +442,7 @@ struct lttng_ust_registered_probe { struct lttng_ust_ctx_field { const struct lttng_ust_event_field *event_field; size_t (*get_size)(void *priv, size_t offset); - void (*record)(void *priv, struct lttng_ust_lib_ring_buffer_ctx *ctx, + void (*record)(void *priv, struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan); void (*get_value)(void *priv, struct lttng_ust_ctx_value *value); void (*destroy)(void *priv); diff --git a/src/common/ringbuffer/backend.h b/src/common/ringbuffer/backend.h index 0b482182..701e2c2b 100644 --- a/src/common/ringbuffer/backend.h +++ b/src/common/ringbuffer/backend.h @@ -23,12 +23,12 @@ /* Ring buffer backend access (read/write) */ -extern size_t lib_ring_buffer_read(struct lttng_ust_lib_ring_buffer_backend *bufb, +extern size_t lib_ring_buffer_read(struct lttng_ust_ring_buffer_backend *bufb, size_t offset, void *dest, size_t len, struct lttng_ust_shm_handle *handle) __attribute__((visibility("hidden"))); -extern int lib_ring_buffer_read_cstr(struct lttng_ust_lib_ring_buffer_backend *bufb, +extern int lib_ring_buffer_read_cstr(struct lttng_ust_ring_buffer_backend *bufb, size_t offset, void *dest, size_t len, struct lttng_ust_shm_handle *handle) __attribute__((visibility("hidden"))); @@ -40,13 +40,13 @@ extern int lib_ring_buffer_read_cstr(struct lttng_ust_lib_ring_buffer_backend *b * as long as the write is never bigger than a page size. */ extern void * -lib_ring_buffer_offset_address(struct lttng_ust_lib_ring_buffer_backend *bufb, +lib_ring_buffer_offset_address(struct lttng_ust_ring_buffer_backend *bufb, size_t offset, struct lttng_ust_shm_handle *handle) __attribute__((visibility("hidden"))); extern void * -lib_ring_buffer_read_offset_address(struct lttng_ust_lib_ring_buffer_backend *bufb, +lib_ring_buffer_read_offset_address(struct lttng_ust_ring_buffer_backend *bufb, size_t offset, struct lttng_ust_shm_handle *handle) __attribute__((visibility("hidden"))); @@ -64,20 +64,20 @@ lib_ring_buffer_read_offset_address(struct lttng_ust_lib_ring_buffer_backend *bu * if copy is crossing a page boundary. */ static inline -void lib_ring_buffer_write(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_ctx *ctx, +void lib_ring_buffer_write(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_ctx *ctx, const void *src, size_t len) __attribute__((always_inline)); static inline -void lib_ring_buffer_write(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_ctx *ctx, +void lib_ring_buffer_write(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_ctx *ctx, const void *src, size_t len) { - struct lttng_ust_lib_ring_buffer_ctx_private *ctx_private = ctx->priv; + struct lttng_ust_ring_buffer_ctx_private *ctx_private = ctx->priv; struct channel_backend *chanb = &ctx_private->chan->backend; struct lttng_ust_shm_handle *handle = ctx_private->chan->handle; size_t offset = ctx_private->buf_offset; - struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; + struct lttng_ust_ring_buffer_backend_pages *backend_pages; void *p; if (caa_unlikely(!len)) @@ -105,12 +105,12 @@ void lib_ring_buffer_write(const struct lttng_ust_lib_ring_buffer_config *config * copied. Does *not* terminate @dest with NULL terminating character. */ static inline -size_t lib_ring_buffer_do_strcpy(const struct lttng_ust_lib_ring_buffer_config *config, +size_t lib_ring_buffer_do_strcpy(const struct lttng_ust_ring_buffer_config *config, char *dest, const char *src, size_t len) __attribute__((always_inline)); static inline size_t lib_ring_buffer_do_strcpy( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), char *dest, const char *src, size_t len) { size_t count; @@ -146,21 +146,21 @@ size_t lib_ring_buffer_do_strcpy( * the buffer with @pad characters (e.g. '#'). */ static inline -void lib_ring_buffer_strcpy(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_ctx *ctx, +void lib_ring_buffer_strcpy(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_ctx *ctx, const char *src, size_t len, char pad) __attribute__((always_inline)); static inline -void lib_ring_buffer_strcpy(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_ctx *ctx, +void lib_ring_buffer_strcpy(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_ctx *ctx, const char *src, size_t len, char pad) { - struct lttng_ust_lib_ring_buffer_ctx_private *ctx_private = ctx->priv; + struct lttng_ust_ring_buffer_ctx_private *ctx_private = ctx->priv; struct channel_backend *chanb = &ctx_private->chan->backend; struct lttng_ust_shm_handle *handle = ctx_private->chan->handle; size_t count; size_t offset = ctx_private->buf_offset; - struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; + struct lttng_ust_ring_buffer_backend_pages *backend_pages; void *p; if (caa_unlikely(!len)) @@ -216,21 +216,21 @@ void lib_ring_buffer_strcpy(const struct lttng_ust_lib_ring_buffer_config *confi * is either the array or sequence length. */ static inline -void lib_ring_buffer_pstrcpy(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_ctx *ctx, +void lib_ring_buffer_pstrcpy(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_ctx *ctx, const char *src, size_t len, char pad) __attribute__((always_inline)); static inline -void lib_ring_buffer_pstrcpy(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_ctx *ctx, +void lib_ring_buffer_pstrcpy(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_ctx *ctx, const char *src, size_t len, char pad) { - struct lttng_ust_lib_ring_buffer_ctx_private *ctx_private = ctx->priv; + struct lttng_ust_ring_buffer_ctx_private *ctx_private = ctx->priv; struct channel_backend *chanb = &ctx_private->chan->backend; struct lttng_ust_shm_handle *handle = ctx_private->chan->handle; size_t count; size_t offset = ctx_private->buf_offset; - struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; + struct lttng_ust_ring_buffer_backend_pages *backend_pages; void *p; if (caa_unlikely(!len)) @@ -270,22 +270,22 @@ void lib_ring_buffer_pstrcpy(const struct lttng_ust_lib_ring_buffer_config *conf */ static inline unsigned long lib_ring_buffer_get_records_unread( - const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf, + const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_backend *bufb = &buf->backend; + struct lttng_ust_ring_buffer_backend *bufb = &buf->backend; unsigned long records_unread = 0, sb_bindex; unsigned int i; - struct lttng_ust_lib_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer_channel *chan; chan = shmp(handle, bufb->chan); if (!chan) return 0; for (i = 0; i < chan->backend.num_subbuf; i++) { - struct lttng_ust_lib_ring_buffer_backend_subbuffer *wsb; - struct lttng_ust_lib_ring_buffer_backend_pages_shmp *rpages; - struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; + struct lttng_ust_ring_buffer_backend_subbuffer *wsb; + struct lttng_ust_ring_buffer_backend_pages_shmp *rpages; + struct lttng_ust_ring_buffer_backend_pages *backend_pages; wsb = shmp_index(handle, bufb->buf_wsb, i); if (!wsb) @@ -300,8 +300,8 @@ unsigned long lib_ring_buffer_get_records_unread( records_unread += v_read(config, &backend_pages->records_unread); } if (config->mode == RING_BUFFER_OVERWRITE) { - struct lttng_ust_lib_ring_buffer_backend_pages_shmp *rpages; - struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; + struct lttng_ust_ring_buffer_backend_pages_shmp *rpages; + struct lttng_ust_ring_buffer_backend_pages *backend_pages; sb_bindex = subbuffer_id_get_index(config, bufb->buf_rsb.id); rpages = shmp_index(handle, bufb->array, sb_bindex); diff --git a/src/common/ringbuffer/backend_internal.h b/src/common/ringbuffer/backend_internal.h index a325875c..96561b03 100644 --- a/src/common/ringbuffer/backend_internal.h +++ b/src/common/ringbuffer/backend_internal.h @@ -24,7 +24,7 @@ /* Ring buffer and channel backend create/free */ -int lib_ring_buffer_backend_create(struct lttng_ust_lib_ring_buffer_backend *bufb, +int lib_ring_buffer_backend_create(struct lttng_ust_ring_buffer_backend *bufb, struct channel_backend *chan, int cpu, struct lttng_ust_shm_handle *handle, @@ -34,12 +34,12 @@ int lib_ring_buffer_backend_create(struct lttng_ust_lib_ring_buffer_backend *buf 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) +void lib_ring_buffer_backend_free(struct lttng_ust_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, + const struct lttng_ust_ring_buffer_config *config, size_t subbuf_size, size_t num_subbuf, struct lttng_ust_shm_handle *handle, const int *stream_fds) @@ -49,7 +49,7 @@ void channel_backend_free(struct channel_backend *chanb, struct lttng_ust_shm_handle *handle) __attribute__((visibility("hidden"))); -void lib_ring_buffer_backend_reset(struct lttng_ust_lib_ring_buffer_backend *bufb, +void lib_ring_buffer_backend_reset(struct lttng_ust_ring_buffer_backend *bufb, struct lttng_ust_shm_handle *handle) __attribute__((visibility("hidden"))); @@ -62,7 +62,7 @@ int lib_ring_buffer_backend_init(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, +extern void _lib_ring_buffer_write(struct lttng_ust_ring_buffer_backend *bufb, size_t offset, const void *src, size_t len, ssize_t pagecpy) __attribute__((visibility("hidden"))); @@ -105,7 +105,7 @@ extern void _lib_ring_buffer_write(struct lttng_ust_lib_ring_buffer_backend *buf * mode). */ static inline -unsigned long subbuffer_id(const struct lttng_ust_lib_ring_buffer_config *config, +unsigned long subbuffer_id(const struct lttng_ust_ring_buffer_config *config, unsigned long offset, unsigned long noref, unsigned long index) { @@ -123,14 +123,14 @@ unsigned long subbuffer_id(const struct lttng_ust_lib_ring_buffer_config *config */ static inline int subbuffer_id_compare_offset( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), unsigned long id, unsigned long offset) { return (id & SB_ID_OFFSET_MASK) == (offset << SB_ID_OFFSET_SHIFT); } static inline -unsigned long subbuffer_id_get_index(const struct lttng_ust_lib_ring_buffer_config *config, +unsigned long subbuffer_id_get_index(const struct lttng_ust_ring_buffer_config *config, unsigned long id) { if (config->mode == RING_BUFFER_OVERWRITE) @@ -140,7 +140,7 @@ unsigned long subbuffer_id_get_index(const struct lttng_ust_lib_ring_buffer_conf } static inline -unsigned long subbuffer_id_is_noref(const struct lttng_ust_lib_ring_buffer_config *config, +unsigned long subbuffer_id_is_noref(const struct lttng_ust_ring_buffer_config *config, unsigned long id) { if (config->mode == RING_BUFFER_OVERWRITE) @@ -154,7 +154,7 @@ unsigned long subbuffer_id_is_noref(const struct lttng_ust_lib_ring_buffer_confi * needed. */ static inline -void subbuffer_id_set_noref(const struct lttng_ust_lib_ring_buffer_config *config, +void subbuffer_id_set_noref(const struct lttng_ust_ring_buffer_config *config, unsigned long *id) { if (config->mode == RING_BUFFER_OVERWRITE) @@ -162,7 +162,7 @@ void subbuffer_id_set_noref(const struct lttng_ust_lib_ring_buffer_config *confi } static inline -void subbuffer_id_set_noref_offset(const struct lttng_ust_lib_ring_buffer_config *config, +void subbuffer_id_set_noref_offset(const struct lttng_ust_ring_buffer_config *config, unsigned long *id, unsigned long offset) { unsigned long tmp; @@ -179,7 +179,7 @@ void subbuffer_id_set_noref_offset(const struct lttng_ust_lib_ring_buffer_config /* No volatile access, since already used locally */ static inline -void subbuffer_id_clear_noref(const struct lttng_ust_lib_ring_buffer_config *config, +void subbuffer_id_clear_noref(const struct lttng_ust_ring_buffer_config *config, unsigned long *id) { if (config->mode == RING_BUFFER_OVERWRITE) @@ -194,7 +194,7 @@ void subbuffer_id_clear_noref(const struct lttng_ust_lib_ring_buffer_config *con * -EPERM on failure. */ static inline -int subbuffer_id_check_index(const struct lttng_ust_lib_ring_buffer_config *config, +int subbuffer_id_check_index(const struct lttng_ust_ring_buffer_config *config, unsigned long num_subbuf) { if (config->mode == RING_BUFFER_OVERWRITE) @@ -204,20 +204,20 @@ int subbuffer_id_check_index(const struct lttng_ust_lib_ring_buffer_config *conf } static inline -int lib_ring_buffer_backend_get_pages(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_ust_lib_ring_buffer_backend_pages **backend_pages) +int lib_ring_buffer_backend_get_pages(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_backend_pages **backend_pages) { - 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 lttng_ust_ring_buffer_ctx_private *ctx_private = ctx->priv; + struct lttng_ust_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_private->buf_offset; - struct lttng_ust_lib_ring_buffer_backend_subbuffer *wsb; - struct lttng_ust_lib_ring_buffer_backend_pages_shmp *rpages; + struct lttng_ust_ring_buffer_backend_subbuffer *wsb; + struct lttng_ust_ring_buffer_backend_pages_shmp *rpages; unsigned long sb_bindex, id; - struct lttng_ust_lib_ring_buffer_backend_pages *_backend_pages; + struct lttng_ust_ring_buffer_backend_pages *_backend_pages; offset &= chanb->buf_size - 1; sbidx = offset >> chanb->subbuf_size_order; @@ -241,10 +241,10 @@ int lib_ring_buffer_backend_get_pages(const struct lttng_ust_lib_ring_buffer_con /* Get backend pages from cache. */ static inline -struct lttng_ust_lib_ring_buffer_backend_pages * +struct lttng_ust_ring_buffer_backend_pages * lib_ring_buffer_get_backend_pages_from_ctx( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx) + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), + struct lttng_ust_ring_buffer_ctx *ctx) { return ctx->priv->backend_pages; } @@ -255,12 +255,12 @@ struct lttng_ust_lib_ring_buffer_backend_pages * */ #ifdef LTTNG_RING_BUFFER_COUNT_EVENTS static inline -void subbuffer_count_record(const struct lttng_ust_lib_ring_buffer_config *config, - const struct lttng_ust_lib_ring_buffer_ctx *ctx, - struct lttng_ust_lib_ring_buffer_backend *bufb, +void subbuffer_count_record(const struct lttng_ust_ring_buffer_config *config, + const struct lttng_ust_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_backend *bufb, unsigned long idx, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; + struct lttng_ust_ring_buffer_backend_pages *backend_pages; backend_pages = lib_ring_buffer_get_backend_pages_from_ctx(config, ctx); if (caa_unlikely(!backend_pages)) { @@ -271,9 +271,9 @@ void subbuffer_count_record(const struct lttng_ust_lib_ring_buffer_config *confi } #else /* LTTNG_RING_BUFFER_COUNT_EVENTS */ static inline -void subbuffer_count_record(const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), - const struct lttng_ust_lib_ring_buffer_ctx *ctx __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_backend *bufb __attribute__((unused)), +void subbuffer_count_record(const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), + const struct lttng_ust_ring_buffer_ctx *ctx __attribute__((unused)), + struct lttng_ust_ring_buffer_backend *bufb __attribute__((unused)), unsigned long idx __attribute__((unused)), struct lttng_ust_shm_handle *handle __attribute__((unused))) { @@ -285,14 +285,14 @@ void subbuffer_count_record(const struct lttng_ust_lib_ring_buffer_config *confi * perform the decrement atomically. */ static inline -void subbuffer_consume_record(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_backend *bufb, +void subbuffer_consume_record(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_backend *bufb, struct lttng_ust_shm_handle *handle) { unsigned long sb_bindex; - 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; + struct lttng_ust_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer_backend_pages_shmp *pages_shmp; + struct lttng_ust_ring_buffer_backend_pages *backend_pages; sb_bindex = subbuffer_id_get_index(config, bufb->buf_rsb.id); chan = shmp(handle, bufb->chan); @@ -312,15 +312,15 @@ void subbuffer_consume_record(const struct lttng_ust_lib_ring_buffer_config *con static inline unsigned long subbuffer_get_records_count( - const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_backend *bufb, + const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_backend *bufb, unsigned long idx, struct lttng_ust_shm_handle *handle) { unsigned long sb_bindex; - struct lttng_ust_lib_ring_buffer_backend_subbuffer *wsb; - struct lttng_ust_lib_ring_buffer_backend_pages_shmp *rpages; - struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; + struct lttng_ust_ring_buffer_backend_subbuffer *wsb; + struct lttng_ust_ring_buffer_backend_pages_shmp *rpages; + struct lttng_ust_ring_buffer_backend_pages *backend_pages; wsb = shmp_index(handle, bufb->buf_wsb, idx); if (!wsb) @@ -344,15 +344,15 @@ unsigned long subbuffer_get_records_count( */ static inline unsigned long subbuffer_count_records_overrun( - const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_backend *bufb, + const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_backend *bufb, unsigned long idx, struct lttng_ust_shm_handle *handle) { unsigned long overruns, sb_bindex; - struct lttng_ust_lib_ring_buffer_backend_subbuffer *wsb; - struct lttng_ust_lib_ring_buffer_backend_pages_shmp *rpages; - struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; + struct lttng_ust_ring_buffer_backend_subbuffer *wsb; + struct lttng_ust_ring_buffer_backend_pages_shmp *rpages; + struct lttng_ust_ring_buffer_backend_pages *backend_pages; wsb = shmp_index(handle, bufb->buf_wsb, idx); if (!wsb) @@ -373,16 +373,16 @@ unsigned long subbuffer_count_records_overrun( } static inline -void subbuffer_set_data_size(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_backend *bufb, +void subbuffer_set_data_size(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_backend *bufb, unsigned long idx, unsigned long data_size, struct lttng_ust_shm_handle *handle) { unsigned long sb_bindex; - struct lttng_ust_lib_ring_buffer_backend_subbuffer *wsb; - struct lttng_ust_lib_ring_buffer_backend_pages_shmp *rpages; - struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; + struct lttng_ust_ring_buffer_backend_subbuffer *wsb; + struct lttng_ust_ring_buffer_backend_pages_shmp *rpages; + struct lttng_ust_ring_buffer_backend_pages *backend_pages; wsb = shmp_index(handle, bufb->buf_wsb, idx); if (!wsb) @@ -399,13 +399,13 @@ void subbuffer_set_data_size(const struct lttng_ust_lib_ring_buffer_config *conf static inline unsigned long subbuffer_get_read_data_size( - const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_backend *bufb, + const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_backend *bufb, struct lttng_ust_shm_handle *handle) { unsigned long sb_bindex; - struct lttng_ust_lib_ring_buffer_backend_pages_shmp *pages_shmp; - struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; + struct lttng_ust_ring_buffer_backend_pages_shmp *pages_shmp; + struct lttng_ust_ring_buffer_backend_pages *backend_pages; sb_bindex = subbuffer_id_get_index(config, bufb->buf_rsb.id); pages_shmp = shmp_index(handle, bufb->array, sb_bindex); @@ -419,15 +419,15 @@ unsigned long subbuffer_get_read_data_size( static inline unsigned long subbuffer_get_data_size( - const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_backend *bufb, + const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_backend *bufb, unsigned long idx, struct lttng_ust_shm_handle *handle) { unsigned long sb_bindex; - struct lttng_ust_lib_ring_buffer_backend_subbuffer *wsb; - struct lttng_ust_lib_ring_buffer_backend_pages_shmp *rpages; - struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; + struct lttng_ust_ring_buffer_backend_subbuffer *wsb; + struct lttng_ust_ring_buffer_backend_pages_shmp *rpages; + struct lttng_ust_ring_buffer_backend_pages *backend_pages; wsb = shmp_index(handle, bufb->buf_wsb, idx); if (!wsb) @@ -444,11 +444,11 @@ unsigned long subbuffer_get_data_size( static inline void subbuffer_inc_packet_count( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_backend *bufb, + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), + struct lttng_ust_ring_buffer_backend *bufb, unsigned long idx, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_backend_counts *counts; + struct lttng_ust_ring_buffer_backend_counts *counts; counts = shmp_index(handle, bufb->buf_cnt, idx); if (!counts) @@ -461,13 +461,13 @@ void subbuffer_inc_packet_count( * writer. */ static inline -void lib_ring_buffer_clear_noref(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_backend *bufb, +void lib_ring_buffer_clear_noref(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_backend *bufb, unsigned long idx, struct lttng_ust_shm_handle *handle) { unsigned long id, new_id; - struct lttng_ust_lib_ring_buffer_backend_subbuffer *wsb; + struct lttng_ust_ring_buffer_backend_subbuffer *wsb; if (config->mode != RING_BUFFER_OVERWRITE) return; @@ -505,13 +505,13 @@ void lib_ring_buffer_clear_noref(const struct lttng_ust_lib_ring_buffer_config * * called by writer. */ static inline -void lib_ring_buffer_set_noref_offset(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_backend *bufb, +void lib_ring_buffer_set_noref_offset(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_backend *bufb, unsigned long idx, unsigned long offset, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_backend_subbuffer *wsb; - struct lttng_ust_lib_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer_backend_subbuffer *wsb; + struct lttng_ust_ring_buffer_channel *chan; if (config->mode != RING_BUFFER_OVERWRITE) return; @@ -546,14 +546,14 @@ void lib_ring_buffer_set_noref_offset(const struct lttng_ust_lib_ring_buffer_con * update_read_sb_index - Read-side subbuffer index update. */ static inline -int update_read_sb_index(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_backend *bufb, +int update_read_sb_index(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_backend *bufb, struct channel_backend *chanb __attribute__((unused)), unsigned long consumed_idx, unsigned long consumed_count, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_backend_subbuffer *wsb; + struct lttng_ust_ring_buffer_backend_subbuffer *wsb; unsigned long old_id, new_id; wsb = shmp_index(handle, bufb->buf_wsb, consumed_idx); @@ -561,7 +561,7 @@ int update_read_sb_index(const struct lttng_ust_lib_ring_buffer_config *config, return -EPERM; if (config->mode == RING_BUFFER_OVERWRITE) { - struct lttng_ust_lib_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer_channel *chan; /* * Exchange the target writer subbuffer with our own unused diff --git a/src/common/ringbuffer/backend_types.h b/src/common/ringbuffer/backend_types.h index 19d6513d..a4e207f4 100644 --- a/src/common/ringbuffer/backend_types.h +++ b/src/common/ringbuffer/backend_types.h @@ -15,7 +15,7 @@ #include "vatomic.h" #define RB_BACKEND_PAGES_PADDING 16 -struct lttng_ust_lib_ring_buffer_backend_pages { +struct lttng_ust_ring_buffer_backend_pages { unsigned long mmap_offset; /* offset of the subbuffer in mmap */ union v_atomic records_commit; /* current records committed count */ union v_atomic records_unread; /* records to read */ @@ -24,12 +24,12 @@ struct lttng_ust_lib_ring_buffer_backend_pages { char padding[RB_BACKEND_PAGES_PADDING]; }; -struct lttng_ust_lib_ring_buffer_backend_subbuffer { +struct lttng_ust_ring_buffer_backend_subbuffer { /* Identifier for subbuf backend pages. Exchanged atomically. */ unsigned long id; /* backend subbuffer identifier */ }; -struct lttng_ust_lib_ring_buffer_backend_counts { +struct lttng_ust_ring_buffer_backend_counts { /* * Counter specific to the sub-buffer location within the ring buffer. * The actual sequence number of the packet within the entire ring @@ -42,37 +42,37 @@ struct lttng_ust_lib_ring_buffer_backend_counts { /* * Forward declaration of frontend-specific channel and ring_buffer. */ -struct lttng_ust_lib_ring_buffer_channel; -struct lttng_ust_lib_ring_buffer; +struct lttng_ust_ring_buffer_channel; +struct lttng_ust_ring_buffer; -struct lttng_ust_lib_ring_buffer_backend_pages_shmp { - DECLARE_SHMP(struct lttng_ust_lib_ring_buffer_backend_pages, shmp); +struct lttng_ust_ring_buffer_backend_pages_shmp { + DECLARE_SHMP(struct lttng_ust_ring_buffer_backend_pages, shmp); }; #define RB_BACKEND_RING_BUFFER_PADDING 64 -struct lttng_ust_lib_ring_buffer_backend { +struct lttng_ust_ring_buffer_backend { /* Array of ring_buffer_backend_subbuffer for writer */ - DECLARE_SHMP(struct lttng_ust_lib_ring_buffer_backend_subbuffer, buf_wsb); + DECLARE_SHMP(struct lttng_ust_ring_buffer_backend_subbuffer, buf_wsb); /* ring_buffer_backend_subbuffer for reader */ - struct lttng_ust_lib_ring_buffer_backend_subbuffer buf_rsb; + struct lttng_ust_ring_buffer_backend_subbuffer buf_rsb; /* Array of lib_ring_buffer_backend_counts for the packet counter */ - DECLARE_SHMP(struct lttng_ust_lib_ring_buffer_backend_counts, buf_cnt); + DECLARE_SHMP(struct lttng_ust_ring_buffer_backend_counts, buf_cnt); /* * Pointer array of backend pages, for whole buffer. * Indexed by ring_buffer_backend_subbuffer identifier (id) index. */ - DECLARE_SHMP(struct lttng_ust_lib_ring_buffer_backend_pages_shmp, array); + DECLARE_SHMP(struct lttng_ust_ring_buffer_backend_pages_shmp, array); DECLARE_SHMP(char, memory_map); /* memory mapping */ - DECLARE_SHMP(struct lttng_ust_lib_ring_buffer_channel, chan); /* Associated channel */ + DECLARE_SHMP(struct lttng_ust_ring_buffer_channel, chan); /* Associated channel */ int cpu; /* This buffer's cpu. -1 if global. */ union v_atomic records_read; /* Number of records read */ unsigned int allocated:1; /* is buffer allocated ? */ char padding[RB_BACKEND_RING_BUFFER_PADDING]; }; -struct lttng_ust_lib_ring_buffer_shmp { - DECLARE_SHMP(struct lttng_ust_lib_ring_buffer, shmp); /* Channel per-cpu buffers */ +struct lttng_ust_ring_buffer_shmp { + DECLARE_SHMP(struct lttng_ust_ring_buffer, shmp); /* Channel per-cpu buffers */ }; #define RB_BACKEND_CHANNEL_PADDING 64 @@ -89,10 +89,10 @@ struct channel_backend { unsigned long num_subbuf; /* Number of sub-buffers for writer */ uint64_t start_tsc; /* Channel creation TSC value */ DECLARE_SHMP(void *, priv_data);/* Client-specific information */ - struct lttng_ust_lib_ring_buffer_config config; /* Ring buffer configuration */ + struct lttng_ust_ring_buffer_config config; /* Ring buffer configuration */ char name[NAME_MAX]; /* Channel name */ char padding[RB_BACKEND_CHANNEL_PADDING]; - struct lttng_ust_lib_ring_buffer_shmp buf[]; + struct lttng_ust_ring_buffer_shmp buf[]; }; #endif /* _LTTNG_RING_BUFFER_BACKEND_TYPES_H */ diff --git a/src/common/ringbuffer/frontend.h b/src/common/ringbuffer/frontend.h index 12e21005..cc9d80d5 100644 --- a/src/common/ringbuffer/frontend.h +++ b/src/common/ringbuffer/frontend.h @@ -40,7 +40,7 @@ */ extern -struct lttng_ust_shm_handle *channel_create(const struct lttng_ust_lib_ring_buffer_config *config, +struct lttng_ust_shm_handle *channel_create(const struct lttng_ust_ring_buffer_config *config, const char *name, size_t priv_data_align, size_t priv_data_size, @@ -58,7 +58,7 @@ struct lttng_ust_shm_handle *channel_create(const struct lttng_ust_lib_ring_buff * channel_destroy finalizes all channel's buffers, waits for readers to * release all references, and destroys the channel. */ -void channel_destroy(struct lttng_ust_lib_ring_buffer_channel *chan, +void channel_destroy(struct lttng_ust_ring_buffer_channel *chan, struct lttng_ust_shm_handle *handle, int consumer) __attribute__((visibility("hidden"))); @@ -75,9 +75,9 @@ void channel_destroy(struct lttng_ust_lib_ring_buffer_channel *chan, #define for_each_channel_cpu(cpu, chan) \ for_each_possible_cpu(cpu) -extern struct lttng_ust_lib_ring_buffer *channel_get_ring_buffer( - const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_channel *chan, int cpu, +extern struct lttng_ust_ring_buffer *channel_get_ring_buffer( + const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_channel *chan, int cpu, struct lttng_ust_shm_handle *handle, int *shm_fd, int *wait_fd, int *wakeup_fd, @@ -85,36 +85,36 @@ extern struct lttng_ust_lib_ring_buffer *channel_get_ring_buffer( __attribute__((visibility("hidden"))); extern -int ring_buffer_channel_close_wait_fd(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_channel *chan, +int ring_buffer_channel_close_wait_fd(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_channel *chan, struct lttng_ust_shm_handle *handle) __attribute__((visibility("hidden"))); extern -int ring_buffer_channel_close_wakeup_fd(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_channel *chan, +int ring_buffer_channel_close_wakeup_fd(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_channel *chan, struct lttng_ust_shm_handle *handle) __attribute__((visibility("hidden"))); extern -int ring_buffer_stream_close_wait_fd(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_channel *chan, +int ring_buffer_stream_close_wait_fd(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_channel *chan, struct lttng_ust_shm_handle *handle, int cpu) __attribute__((visibility("hidden"))); extern -int ring_buffer_stream_close_wakeup_fd(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_channel *chan, +int ring_buffer_stream_close_wakeup_fd(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_channel *chan, struct lttng_ust_shm_handle *handle, int cpu) __attribute__((visibility("hidden"))); -extern int lib_ring_buffer_open_read(struct lttng_ust_lib_ring_buffer *buf, +extern int lib_ring_buffer_open_read(struct lttng_ust_ring_buffer *buf, struct lttng_ust_shm_handle *handle) __attribute__((visibility("hidden"))); -extern void lib_ring_buffer_release_read(struct lttng_ust_lib_ring_buffer *buf, +extern void lib_ring_buffer_release_read(struct lttng_ust_ring_buffer *buf, struct lttng_ust_shm_handle *handle) __attribute__((visibility("hidden"))); @@ -128,30 +128,30 @@ void lib_ringbuffer_signal_init(void) /* * Read sequence: snapshot, many get_subbuf/put_subbuf, move_consumer. */ -extern int lib_ring_buffer_snapshot(struct lttng_ust_lib_ring_buffer *buf, +extern int lib_ring_buffer_snapshot(struct lttng_ust_ring_buffer *buf, unsigned long *consumed, unsigned long *produced, struct lttng_ust_shm_handle *handle) __attribute__((visibility("hidden"))); extern int lib_ring_buffer_snapshot_sample_positions( - struct lttng_ust_lib_ring_buffer *buf, + struct lttng_ust_ring_buffer *buf, unsigned long *consumed, unsigned long *produced, struct lttng_ust_shm_handle *handle) __attribute__((visibility("hidden"))); -extern void lib_ring_buffer_move_consumer(struct lttng_ust_lib_ring_buffer *buf, +extern void lib_ring_buffer_move_consumer(struct lttng_ust_ring_buffer *buf, unsigned long consumed_new, struct lttng_ust_shm_handle *handle) __attribute__((visibility("hidden"))); -extern int lib_ring_buffer_get_subbuf(struct lttng_ust_lib_ring_buffer *buf, +extern int lib_ring_buffer_get_subbuf(struct lttng_ust_ring_buffer *buf, unsigned long consumed, struct lttng_ust_shm_handle *handle) __attribute__((visibility("hidden"))); -extern void lib_ring_buffer_put_subbuf(struct lttng_ust_lib_ring_buffer *buf, +extern void lib_ring_buffer_put_subbuf(struct lttng_ust_ring_buffer *buf, struct lttng_ust_shm_handle *handle) __attribute__((visibility("hidden"))); @@ -159,7 +159,7 @@ extern void lib_ring_buffer_put_subbuf(struct lttng_ust_lib_ring_buffer *buf, * lib_ring_buffer_get_next_subbuf/lib_ring_buffer_put_next_subbuf are helpers * to read sub-buffers sequentially. */ -static inline int lib_ring_buffer_get_next_subbuf(struct lttng_ust_lib_ring_buffer *buf, +static inline int lib_ring_buffer_get_next_subbuf(struct lttng_ust_ring_buffer *buf, struct lttng_ust_shm_handle *handle) { int ret; @@ -173,10 +173,10 @@ static inline int lib_ring_buffer_get_next_subbuf(struct lttng_ust_lib_ring_buff } static inline -void lib_ring_buffer_put_next_subbuf(struct lttng_ust_lib_ring_buffer *buf, +void lib_ring_buffer_put_next_subbuf(struct lttng_ust_ring_buffer *buf, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer_channel *chan; chan = shmp(handle, buf->backend.chan); if (!chan) @@ -186,24 +186,24 @@ void lib_ring_buffer_put_next_subbuf(struct lttng_ust_lib_ring_buffer *buf, handle); } -extern void channel_reset(struct lttng_ust_lib_ring_buffer_channel *chan) +extern void channel_reset(struct lttng_ust_ring_buffer_channel *chan) __attribute__((visibility("hidden"))); -extern void lib_ring_buffer_reset(struct lttng_ust_lib_ring_buffer *buf, +extern void lib_ring_buffer_reset(struct lttng_ust_ring_buffer *buf, struct lttng_ust_shm_handle *handle) __attribute__((visibility("hidden"))); static inline -unsigned long lib_ring_buffer_get_offset(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf) +unsigned long lib_ring_buffer_get_offset(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf) { return v_read(config, &buf->offset); } static inline unsigned long lib_ring_buffer_get_consumed( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), - struct lttng_ust_lib_ring_buffer *buf) + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), + struct lttng_ust_ring_buffer *buf) { return uatomic_read(&buf->consumed); } @@ -214,8 +214,8 @@ unsigned long lib_ring_buffer_get_consumed( */ static inline int lib_ring_buffer_is_finalized( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), - struct lttng_ust_lib_ring_buffer *buf) + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), + struct lttng_ust_ring_buffer *buf) { int finalized = CMM_ACCESS_ONCE(buf->finalized); /* @@ -226,21 +226,21 @@ int lib_ring_buffer_is_finalized( } static inline -int lib_ring_buffer_channel_is_finalized(const struct lttng_ust_lib_ring_buffer_channel *chan) +int lib_ring_buffer_channel_is_finalized(const struct lttng_ust_ring_buffer_channel *chan) { return chan->finalized; } static inline -int lib_ring_buffer_channel_is_disabled(const struct lttng_ust_lib_ring_buffer_channel *chan) +int lib_ring_buffer_channel_is_disabled(const struct lttng_ust_ring_buffer_channel *chan) { return uatomic_read(&chan->record_disabled); } static inline unsigned long lib_ring_buffer_get_read_data_size( - const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf, + const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf, struct lttng_ust_shm_handle *handle) { return subbuffer_get_read_data_size(config, &buf->backend, handle); @@ -248,48 +248,48 @@ unsigned long lib_ring_buffer_get_read_data_size( static inline unsigned long lib_ring_buffer_get_records_count( - const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf) + const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf) { return v_read(config, &buf->records_count); } static inline unsigned long lib_ring_buffer_get_records_overrun( - const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf) + const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf) { return v_read(config, &buf->records_overrun); } static inline unsigned long lib_ring_buffer_get_records_lost_full( - const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf) + const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf) { return v_read(config, &buf->records_lost_full); } static inline unsigned long lib_ring_buffer_get_records_lost_wrap( - const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf) + const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf) { return v_read(config, &buf->records_lost_wrap); } static inline unsigned long lib_ring_buffer_get_records_lost_big( - const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf) + const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf) { return v_read(config, &buf->records_lost_big); } static inline unsigned long lib_ring_buffer_get_records_read( - const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf) + const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf) { return v_read(config, &buf->backend.records_read); } diff --git a/src/common/ringbuffer/frontend_api.h b/src/common/ringbuffer/frontend_api.h index ac5e31bf..4cf7031b 100644 --- a/src/common/ringbuffer/frontend_api.h +++ b/src/common/ringbuffer/frontend_api.h @@ -33,7 +33,7 @@ */ static inline int lib_ring_buffer_nesting_inc( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused))) + const struct lttng_ust_ring_buffer_config *config __attribute__((unused))) { int nesting; @@ -49,14 +49,14 @@ int lib_ring_buffer_nesting_inc( static inline int lib_ring_buffer_nesting_count( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused))) + const struct lttng_ust_ring_buffer_config *config __attribute__((unused))) { return URCU_TLS(lib_ring_buffer_nesting); } static inline void lib_ring_buffer_nesting_dec( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused))) + const struct lttng_ust_ring_buffer_config *config __attribute__((unused))) { cmm_barrier(); URCU_TLS(lib_ring_buffer_nesting)--; /* TLS */ @@ -69,15 +69,15 @@ void lib_ring_buffer_nesting_dec( * returns 0 if reserve ok, or 1 if the slow path must be taken. */ static inline -int lib_ring_buffer_try_reserve(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_ctx *ctx, +int lib_ring_buffer_try_reserve(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_ctx *ctx, void *client_ctx, unsigned long *o_begin, unsigned long *o_end, unsigned long *o_old, size_t *before_hdr_pad) { - struct lttng_ust_lib_ring_buffer_ctx_private *ctx_private = ctx->priv; - struct lttng_ust_lib_ring_buffer_channel *chan = ctx_private->chan; - struct lttng_ust_lib_ring_buffer *buf = ctx_private->buf; + struct lttng_ust_ring_buffer_ctx_private *ctx_private = ctx->priv; + struct lttng_ust_ring_buffer_channel *chan = ctx_private->chan; + struct lttng_ust_ring_buffer *buf = ctx_private->buf; *o_begin = v_read(config, &buf->offset); *o_old = *o_begin; @@ -101,7 +101,7 @@ int lib_ring_buffer_try_reserve(const struct lttng_ust_lib_ring_buffer_config *c ctx_private->slot_size = record_header_size(config, chan, *o_begin, before_hdr_pad, ctx, client_ctx); ctx_private->slot_size += - lttng_ust_lib_ring_buffer_align(*o_begin + ctx_private->slot_size, + lttng_ust_ring_buffer_align(*o_begin + ctx_private->slot_size, ctx->largest_align) + ctx->data_size; if (caa_unlikely((subbuf_offset(*o_begin, chan) + ctx_private->slot_size) > chan->backend.subbuf_size)) @@ -140,14 +140,14 @@ int lib_ring_buffer_try_reserve(const struct lttng_ust_lib_ring_buffer_config *c */ static inline -int lib_ring_buffer_reserve(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_ctx *ctx, +int lib_ring_buffer_reserve(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_ctx *ctx, void *client_ctx) { - struct lttng_ust_lib_ring_buffer_ctx_private *ctx_private = ctx->priv; - struct lttng_ust_lib_ring_buffer_channel *chan = ctx_private->chan; + struct lttng_ust_ring_buffer_ctx_private *ctx_private = ctx->priv; + struct lttng_ust_ring_buffer_channel *chan = ctx_private->chan; struct lttng_ust_shm_handle *handle = chan->handle; - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; unsigned long o_begin, o_end, o_old; size_t before_hdr_pad = 0; @@ -219,8 +219,8 @@ slow_path: */ static inline void lib_ring_buffer_switch( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), - struct lttng_ust_lib_ring_buffer *buf, enum switch_mode mode, + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), + struct lttng_ust_ring_buffer *buf, enum switch_mode mode, struct lttng_ust_shm_handle *handle) { lib_ring_buffer_switch_slow(buf, mode, handle); @@ -237,13 +237,13 @@ void lib_ring_buffer_switch( * specified sub-buffer, and delivers it if necessary. */ static inline -void lib_ring_buffer_commit(const struct lttng_ust_lib_ring_buffer_config *config, - const struct lttng_ust_lib_ring_buffer_ctx *ctx) +void lib_ring_buffer_commit(const struct lttng_ust_ring_buffer_config *config, + const struct lttng_ust_ring_buffer_ctx *ctx) { - struct lttng_ust_lib_ring_buffer_ctx_private *ctx_private = ctx->priv; - struct lttng_ust_lib_ring_buffer_channel *chan = ctx_private->chan; + struct lttng_ust_ring_buffer_ctx_private *ctx_private = ctx->priv; + struct lttng_ust_ring_buffer_channel *chan = ctx_private->chan; struct lttng_ust_shm_handle *handle = chan->handle; - struct lttng_ust_lib_ring_buffer *buf = ctx_private->buf; + struct lttng_ust_ring_buffer *buf = ctx_private->buf; unsigned long offset_end = ctx_private->buf_offset; unsigned long endidx = subbuf_index(offset_end - 1, chan); unsigned long commit_count; @@ -307,11 +307,11 @@ void lib_ring_buffer_commit(const struct lttng_ust_lib_ring_buffer_config *confi * Returns 0 upon success, -EPERM if the record cannot be discarded. */ static inline -int lib_ring_buffer_try_discard_reserve(const struct lttng_ust_lib_ring_buffer_config *config, - const struct lttng_ust_lib_ring_buffer_ctx *ctx) +int lib_ring_buffer_try_discard_reserve(const struct lttng_ust_ring_buffer_config *config, + const struct lttng_ust_ring_buffer_ctx *ctx) { - struct lttng_ust_lib_ring_buffer_ctx_private *ctx_private = ctx->priv; - struct lttng_ust_lib_ring_buffer *buf = ctx_private->buf; + struct lttng_ust_ring_buffer_ctx_private *ctx_private = ctx->priv; + struct lttng_ust_ring_buffer *buf = ctx_private->buf; unsigned long end_offset = ctx_private->pre_offset + ctx_private->slot_size; /* @@ -337,32 +337,32 @@ int lib_ring_buffer_try_discard_reserve(const struct lttng_ust_lib_ring_buffer_c static inline void channel_record_disable( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_channel *chan) + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), + struct lttng_ust_ring_buffer_channel *chan) { uatomic_inc(&chan->record_disabled); } static inline void channel_record_enable( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_channel *chan) + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), + struct lttng_ust_ring_buffer_channel *chan) { uatomic_dec(&chan->record_disabled); } static inline void lib_ring_buffer_record_disable( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), - struct lttng_ust_lib_ring_buffer *buf) + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), + struct lttng_ust_ring_buffer *buf) { uatomic_inc(&buf->record_disabled); } static inline void lib_ring_buffer_record_enable( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), - struct lttng_ust_lib_ring_buffer *buf) + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), + struct lttng_ust_ring_buffer *buf) { uatomic_dec(&buf->record_disabled); } diff --git a/src/common/ringbuffer/frontend_internal.h b/src/common/ringbuffer/frontend_internal.h index 7d905d4b..8ec90dbc 100644 --- a/src/common/ringbuffer/frontend_internal.h +++ b/src/common/ringbuffer/frontend_internal.h @@ -29,7 +29,7 @@ /* buf_trunc mask selects only the buffer number. */ static inline unsigned long buf_trunc(unsigned long offset, - struct lttng_ust_lib_ring_buffer_channel *chan) + struct lttng_ust_ring_buffer_channel *chan) { return offset & ~(chan->backend.buf_size - 1); @@ -38,7 +38,7 @@ unsigned long buf_trunc(unsigned long offset, /* Select the buffer number value (counter). */ static inline unsigned long buf_trunc_val(unsigned long offset, - struct lttng_ust_lib_ring_buffer_channel *chan) + struct lttng_ust_ring_buffer_channel *chan) { return buf_trunc(offset, chan) >> chan->backend.buf_size_order; } @@ -46,7 +46,7 @@ unsigned long buf_trunc_val(unsigned long offset, /* buf_offset mask selects only the offset within the current buffer. */ static inline unsigned long buf_offset(unsigned long offset, - struct lttng_ust_lib_ring_buffer_channel *chan) + struct lttng_ust_ring_buffer_channel *chan) { return offset & (chan->backend.buf_size - 1); } @@ -54,7 +54,7 @@ unsigned long buf_offset(unsigned long offset, /* subbuf_offset mask selects the offset within the current subbuffer. */ static inline unsigned long subbuf_offset(unsigned long offset, - struct lttng_ust_lib_ring_buffer_channel *chan) + struct lttng_ust_ring_buffer_channel *chan) { return offset & (chan->backend.subbuf_size - 1); } @@ -62,7 +62,7 @@ unsigned long subbuf_offset(unsigned long offset, /* subbuf_trunc mask selects the subbuffer number. */ static inline unsigned long subbuf_trunc(unsigned long offset, - struct lttng_ust_lib_ring_buffer_channel *chan) + struct lttng_ust_ring_buffer_channel *chan) { return offset & ~(chan->backend.subbuf_size - 1); } @@ -70,7 +70,7 @@ unsigned long subbuf_trunc(unsigned long offset, /* subbuf_align aligns the offset to the next subbuffer. */ static inline unsigned long subbuf_align(unsigned long offset, - struct lttng_ust_lib_ring_buffer_channel *chan) + struct lttng_ust_ring_buffer_channel *chan) { return (offset + chan->backend.subbuf_size) & ~(chan->backend.subbuf_size - 1); @@ -79,7 +79,7 @@ unsigned long subbuf_align(unsigned long offset, /* subbuf_index returns the index of the current subbuffer within the buffer. */ static inline unsigned long subbuf_index(unsigned long offset, - struct lttng_ust_lib_ring_buffer_channel *chan) + struct lttng_ust_ring_buffer_channel *chan) { return buf_offset(offset, chan) >> chan->backend.subbuf_size_order; } @@ -93,8 +93,8 @@ unsigned long subbuf_index(unsigned long offset, #if (CAA_BITS_PER_LONG == 32) static inline -void save_last_tsc(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf, uint64_t tsc) +void save_last_tsc(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf, uint64_t tsc) { if (config->tsc_bits == 0 || config->tsc_bits == 64) return; @@ -106,8 +106,8 @@ void save_last_tsc(const struct lttng_ust_lib_ring_buffer_config *config, } static inline -int last_tsc_overflow(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf, uint64_t tsc) +int last_tsc_overflow(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf, uint64_t tsc) { unsigned long tsc_shifted; @@ -123,8 +123,8 @@ int last_tsc_overflow(const struct lttng_ust_lib_ring_buffer_config *config, } #else static inline -void save_last_tsc(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf, uint64_t tsc) +void save_last_tsc(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf, uint64_t tsc) { if (config->tsc_bits == 0 || config->tsc_bits == 64) return; @@ -133,8 +133,8 @@ void save_last_tsc(const struct lttng_ust_lib_ring_buffer_config *config, } static inline -int last_tsc_overflow(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf, uint64_t tsc) +int last_tsc_overflow(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf, uint64_t tsc) { if (config->tsc_bits == 0 || config->tsc_bits == 64) return 0; @@ -148,19 +148,19 @@ int last_tsc_overflow(const struct lttng_ust_lib_ring_buffer_config *config, #endif extern -int lib_ring_buffer_reserve_slow(struct lttng_ust_lib_ring_buffer_ctx *ctx, +int lib_ring_buffer_reserve_slow(struct lttng_ust_ring_buffer_ctx *ctx, void *client_ctx) __attribute__((visibility("hidden"))); extern -void lib_ring_buffer_switch_slow(struct lttng_ust_lib_ring_buffer *buf, +void lib_ring_buffer_switch_slow(struct lttng_ust_ring_buffer *buf, enum switch_mode mode, struct lttng_ust_shm_handle *handle) __attribute__((visibility("hidden"))); -void lib_ring_buffer_check_deliver_slow(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +void lib_ring_buffer_check_deliver_slow(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, unsigned long offset, unsigned long commit_count, unsigned long idx, @@ -171,8 +171,8 @@ void lib_ring_buffer_check_deliver_slow(const struct lttng_ust_lib_ring_buffer_c /* Buffer write helpers */ static inline -void lib_ring_buffer_reserve_push_reader(struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +void lib_ring_buffer_reserve_push_reader(struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, unsigned long offset) { unsigned long consumed_old, consumed_new; @@ -208,11 +208,11 @@ void lib_ring_buffer_reserve_push_reader(struct lttng_ust_lib_ring_buffer *buf, * algorithm guarantees. */ static inline -void lib_ring_buffer_clear_reader(struct lttng_ust_lib_ring_buffer *buf, +void lib_ring_buffer_clear_reader(struct lttng_ust_ring_buffer *buf, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_channel *chan; - const struct lttng_ust_lib_ring_buffer_config *config; + struct lttng_ust_ring_buffer_channel *chan; + const struct lttng_ust_ring_buffer_config *config; unsigned long offset, consumed_old, consumed_new; chan = shmp(handle, buf->backend.chan); @@ -232,16 +232,16 @@ void lib_ring_buffer_clear_reader(struct lttng_ust_lib_ring_buffer *buf, } static inline -int lib_ring_buffer_pending_data(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan) +int lib_ring_buffer_pending_data(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan) { return !!subbuf_offset(v_read(config, &buf->offset), chan); } static inline -unsigned long lib_ring_buffer_get_data_size(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf, +unsigned long lib_ring_buffer_get_data_size(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf, unsigned long idx, struct lttng_ust_shm_handle *handle) { @@ -254,9 +254,9 @@ unsigned long lib_ring_buffer_get_data_size(const struct lttng_ust_lib_ring_buff * This is a very specific ftrace use-case, so we keep this as "internal" API. */ static inline -int lib_ring_buffer_reserve_committed(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +int lib_ring_buffer_reserve_committed(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, struct lttng_ust_shm_handle *handle) { unsigned long offset, idx, commit_count; @@ -294,9 +294,9 @@ int lib_ring_buffer_reserve_committed(const struct lttng_ust_lib_ring_buffer_con * timestamp of the following subbuffers. */ static inline -void lib_ring_buffer_check_deliver(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +void lib_ring_buffer_check_deliver(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, unsigned long offset, unsigned long commit_count, unsigned long idx, @@ -323,9 +323,9 @@ void lib_ring_buffer_check_deliver(const struct lttng_ust_lib_ring_buffer_config */ static inline void lib_ring_buffer_write_commit_counter( - const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_channel *chan, + const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf __attribute__((unused)), + struct lttng_ust_ring_buffer_channel *chan, unsigned long buf_offset, unsigned long commit_count, struct lttng_ust_shm_handle *handle __attribute__((unused)), @@ -350,13 +350,13 @@ void lib_ring_buffer_write_commit_counter( v_set(config, &cc_hot->seq, commit_count); } -extern int lib_ring_buffer_create(struct lttng_ust_lib_ring_buffer *buf, +extern int lib_ring_buffer_create(struct lttng_ust_ring_buffer *buf, struct channel_backend *chanb, int cpu, struct lttng_ust_shm_handle *handle, struct shm_object *shmobj) __attribute__((visibility("hidden"))); -extern void lib_ring_buffer_free(struct lttng_ust_lib_ring_buffer *buf, +extern void lib_ring_buffer_free(struct lttng_ust_ring_buffer *buf, struct lttng_ust_shm_handle *handle) __attribute__((visibility("hidden"))); diff --git a/src/common/ringbuffer/frontend_types.h b/src/common/ringbuffer/frontend_types.h index 467ece73..e368c734 100644 --- a/src/common/ringbuffer/frontend_types.h +++ b/src/common/ringbuffer/frontend_types.h @@ -36,7 +36,7 @@ enum switch_mode { SWITCH_ACTIVE, SWITCH_FLUSH }; /* channel: collection of per-cpu ring buffers. */ #define RB_CHANNEL_PADDING 32 -struct lttng_ust_lib_ring_buffer_channel { +struct lttng_ust_ring_buffer_channel { int record_disabled; unsigned long commit_count_mask; /* * Commit count mask, removing @@ -165,7 +165,7 @@ struct lttng_crash_abi { uint32_t mode; /* Buffer mode: 0: overwrite, 1: discard */ } __attribute__((packed)); -struct lttng_ust_lib_ring_buffer { +struct lttng_ust_ring_buffer { /* First 32 bytes are for the buffer crash dump ABI */ struct lttng_crash_abi crash_abi; @@ -185,7 +185,7 @@ struct lttng_ust_lib_ring_buffer { * Last timestamp written in the buffer. */ - struct lttng_ust_lib_ring_buffer_backend backend; + struct lttng_ust_ring_buffer_backend backend; /* Associated backend */ DECLARE_SHMP(struct commit_counters_cold, commit_cold); @@ -221,7 +221,7 @@ struct lttng_ust_lib_ring_buffer { unsigned long cons_snapshot; /* Consumer count snapshot */ unsigned int get_subbuf:1; /* Sub-buffer being held by reader */ /* shmp pointer to self */ - DECLARE_SHMP(struct lttng_ust_lib_ring_buffer, self); + DECLARE_SHMP(struct lttng_ust_ring_buffer, self); char padding[RB_RING_BUFFER_PADDING]; } __attribute__((aligned(CAA_CACHE_LINE_SIZE))); @@ -229,17 +229,17 @@ struct lttng_ust_lib_ring_buffer { * ring buffer private context * * Private context passed to lib_ring_buffer_reserve(), lib_ring_buffer_commit(), - * lib_ring_buffer_try_discard_reserve(), lttng_ust_lib_ring_buffer_align_ctx() and + * lib_ring_buffer_try_discard_reserve(), lttng_ust_ring_buffer_align_ctx() and * lib_ring_buffer_write(). * * This context is allocated on an internal shadow-stack by a successful reserve * operation, used by align/write, and freed by commit. */ -struct lttng_ust_lib_ring_buffer_ctx_private { +struct lttng_ust_ring_buffer_ctx_private { /* input received by lib_ring_buffer_reserve(). */ - struct lttng_ust_lib_ring_buffer_ctx *pub; - struct lttng_ust_lib_ring_buffer_channel *chan; /* channel */ + struct lttng_ust_ring_buffer_ctx *pub; + struct lttng_ust_ring_buffer_channel *chan; /* channel */ /* output from lib_ring_buffer_reserve() */ int reserve_cpu; /* processor id updated by the reserve */ @@ -255,27 +255,27 @@ struct lttng_ust_lib_ring_buffer_ctx_private { unsigned int rflags; /* reservation flags */ void *ip; /* caller ip address */ - struct lttng_ust_lib_ring_buffer *buf; /* + struct lttng_ust_ring_buffer *buf; /* * buffer corresponding to processor id * for this channel */ - struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; + struct lttng_ust_ring_buffer_backend_pages *backend_pages; }; static inline -void *channel_get_private_config(struct lttng_ust_lib_ring_buffer_channel *chan) +void *channel_get_private_config(struct lttng_ust_ring_buffer_channel *chan) { return ((char *) chan) + chan->priv_data_offset; } static inline -void *channel_get_private(struct lttng_ust_lib_ring_buffer_channel *chan) +void *channel_get_private(struct lttng_ust_ring_buffer_channel *chan) { return chan->u.s.priv; } static inline -void channel_set_private(struct lttng_ust_lib_ring_buffer_channel *chan, void *priv) +void channel_set_private(struct lttng_ust_ring_buffer_channel *chan, void *priv) { chan->u.s.priv = priv; } @@ -286,20 +286,20 @@ void channel_set_private(struct lttng_ust_lib_ring_buffer_channel *chan, void *p /* * Issue warnings and disable channels upon internal error. - * Can receive struct lttng_ust_lib_ring_buffer or struct lttng_ust_lib_ring_buffer_backend + * Can receive struct lttng_ust_ring_buffer or struct lttng_ust_ring_buffer_backend * parameters. */ #define CHAN_WARN_ON(c, cond) \ ({ \ - struct lttng_ust_lib_ring_buffer_channel *__chan; \ + struct lttng_ust_ring_buffer_channel *__chan; \ int _____ret = caa_unlikely(cond); \ if (_____ret) { \ if (__rb_same_type(*(c), struct channel_backend)) \ __chan = caa_container_of((void *) (c), \ - struct lttng_ust_lib_ring_buffer_channel, \ + struct lttng_ust_ring_buffer_channel, \ backend); \ else if (__rb_same_type(*(c), \ - struct lttng_ust_lib_ring_buffer_channel)) \ + struct lttng_ust_ring_buffer_channel)) \ __chan = (void *) (c); \ else \ BUG_ON(1); \ @@ -310,20 +310,20 @@ void channel_set_private(struct lttng_ust_lib_ring_buffer_channel *chan, void *p }) /** - * lttng_ust_lib_ring_buffer_align_ctx - Align context offset on "alignment" + * lttng_ust_ring_buffer_align_ctx - Align context offset on "alignment" * @ctx: ring buffer context. */ static inline -void lttng_ust_lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, +void lttng_ust_ring_buffer_align_ctx(struct lttng_ust_ring_buffer_ctx *ctx, size_t alignment) lttng_ust_notrace; static inline -void lttng_ust_lib_ring_buffer_align_ctx(struct lttng_ust_lib_ring_buffer_ctx *ctx, +void lttng_ust_ring_buffer_align_ctx(struct lttng_ust_ring_buffer_ctx *ctx, size_t alignment) { - struct lttng_ust_lib_ring_buffer_ctx_private *ctx_private = ctx->priv; + struct lttng_ust_ring_buffer_ctx_private *ctx_private = ctx->priv; - ctx_private->buf_offset += lttng_ust_lib_ring_buffer_align(ctx_private->buf_offset, + ctx_private->buf_offset += lttng_ust_ring_buffer_align(ctx_private->buf_offset, alignment); } diff --git a/src/common/ringbuffer/rb-init.h b/src/common/ringbuffer/rb-init.h index b3eb7568..83e32c1f 100644 --- a/src/common/ringbuffer/rb-init.h +++ b/src/common/ringbuffer/rb-init.h @@ -4,8 +4,8 @@ * Copyright (C) 2012-2016 Mathieu Desnoyers */ -#ifndef _LTTNG_UST_LIB_RINGBUFFER_RB_INIT_H -#define _LTTNG_UST_LIB_RINGBUFFER_RB_INIT_H +#ifndef _LTTNG_UST_RINGBUFFER_RB_INIT_H +#define _LTTNG_UST_RINGBUFFER_RB_INIT_H void lttng_fixup_ringbuffer_tls(void) __attribute__((visibility("hidden"))); @@ -13,4 +13,4 @@ void lttng_fixup_ringbuffer_tls(void) void lttng_ust_ringbuffer_set_allow_blocking(void) __attribute__((visibility("hidden"))); -#endif /* _LTTNG_UST_LIB_RINGBUFFER_RB_INIT_H */ +#endif /* _LTTNG_UST_RINGBUFFER_RB_INIT_H */ diff --git a/src/common/ringbuffer/ring_buffer_backend.c b/src/common/ringbuffer/ring_buffer_backend.c index b0a7c513..c880c9d6 100644 --- a/src/common/ringbuffer/ring_buffer_backend.c +++ b/src/common/ringbuffer/ring_buffer_backend.c @@ -31,8 +31,8 @@ * @extra_reader_sb: need extra subbuffer for reader */ static -int lib_ring_buffer_backend_allocate(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_backend *bufb, +int lib_ring_buffer_backend_allocate(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_backend *bufb, size_t size __attribute__((unused)), size_t num_subbuf, int extra_reader_sb, struct lttng_ust_shm_handle *handle, @@ -59,9 +59,9 @@ int lib_ring_buffer_backend_allocate(const struct lttng_ust_lib_ring_buffer_conf goto page_size_error; } - align_shm(shmobj, __alignof__(struct lttng_ust_lib_ring_buffer_backend_pages_shmp)); + align_shm(shmobj, __alignof__(struct lttng_ust_ring_buffer_backend_pages_shmp)); set_shmp(bufb->array, zalloc_shm(shmobj, - sizeof(struct lttng_ust_lib_ring_buffer_backend_pages_shmp) * num_subbuf_alloc)); + sizeof(struct lttng_ust_ring_buffer_backend_pages_shmp) * num_subbuf_alloc)); if (caa_unlikely(!shmp(handle, bufb->array))) goto array_error; @@ -77,24 +77,24 @@ int lib_ring_buffer_backend_allocate(const struct lttng_ust_lib_ring_buffer_conf /* Allocate backend pages array elements */ for (i = 0; i < num_subbuf_alloc; i++) { - align_shm(shmobj, __alignof__(struct lttng_ust_lib_ring_buffer_backend_pages)); + align_shm(shmobj, __alignof__(struct lttng_ust_ring_buffer_backend_pages)); set_shmp(shmp_index(handle, bufb->array, i)->shmp, zalloc_shm(shmobj, - sizeof(struct lttng_ust_lib_ring_buffer_backend_pages))); + sizeof(struct lttng_ust_ring_buffer_backend_pages))); if (!shmp(handle, shmp_index(handle, bufb->array, i)->shmp)) goto free_array; } /* Allocate write-side subbuffer table */ - align_shm(shmobj, __alignof__(struct lttng_ust_lib_ring_buffer_backend_subbuffer)); + align_shm(shmobj, __alignof__(struct lttng_ust_ring_buffer_backend_subbuffer)); set_shmp(bufb->buf_wsb, zalloc_shm(shmobj, - sizeof(struct lttng_ust_lib_ring_buffer_backend_subbuffer) + sizeof(struct lttng_ust_ring_buffer_backend_subbuffer) * num_subbuf)); if (caa_unlikely(!shmp(handle, bufb->buf_wsb))) goto free_array; for (i = 0; i < num_subbuf; i++) { - struct lttng_ust_lib_ring_buffer_backend_subbuffer *sb; + struct lttng_ust_ring_buffer_backend_subbuffer *sb; sb = shmp_index(handle, bufb->buf_wsb, i); if (!sb) @@ -110,17 +110,17 @@ int lib_ring_buffer_backend_allocate(const struct lttng_ust_lib_ring_buffer_conf bufb->buf_rsb.id = subbuffer_id(config, 0, 1, 0); /* Allocate subbuffer packet counter table */ - align_shm(shmobj, __alignof__(struct lttng_ust_lib_ring_buffer_backend_counts)); + align_shm(shmobj, __alignof__(struct lttng_ust_ring_buffer_backend_counts)); set_shmp(bufb->buf_cnt, zalloc_shm(shmobj, - sizeof(struct lttng_ust_lib_ring_buffer_backend_counts) + sizeof(struct lttng_ust_ring_buffer_backend_counts) * num_subbuf)); if (caa_unlikely(!shmp(handle, bufb->buf_cnt))) goto free_wsb; /* Assign pages to page index */ for (i = 0; i < num_subbuf_alloc; i++) { - struct lttng_ust_lib_ring_buffer_backend_pages_shmp *sbp; - struct lttng_ust_lib_ring_buffer_backend_pages *pages; + struct lttng_ust_ring_buffer_backend_pages_shmp *sbp; + struct lttng_ust_ring_buffer_backend_pages *pages; struct shm_ref ref; ref.index = bufb->memory_map._ref.index; @@ -152,12 +152,12 @@ page_size_error: return -ENOMEM; } -int lib_ring_buffer_backend_create(struct lttng_ust_lib_ring_buffer_backend *bufb, +int lib_ring_buffer_backend_create(struct lttng_ust_ring_buffer_backend *bufb, struct channel_backend *chanb, int cpu, struct lttng_ust_shm_handle *handle, struct shm_object *shmobj) { - const struct lttng_ust_lib_ring_buffer_config *config = &chanb->config; + const struct lttng_ust_ring_buffer_config *config = &chanb->config; set_shmp(bufb->chan, handle->chan._ref); bufb->cpu = cpu; @@ -168,11 +168,11 @@ int lib_ring_buffer_backend_create(struct lttng_ust_lib_ring_buffer_backend *buf handle, shmobj); } -void lib_ring_buffer_backend_reset(struct lttng_ust_lib_ring_buffer_backend *bufb, +void lib_ring_buffer_backend_reset(struct lttng_ust_ring_buffer_backend *bufb, struct lttng_ust_shm_handle *handle) { struct channel_backend *chanb; - const struct lttng_ust_lib_ring_buffer_config *config; + const struct lttng_ust_ring_buffer_config *config; unsigned long num_subbuf_alloc; unsigned int i; @@ -186,7 +186,7 @@ void lib_ring_buffer_backend_reset(struct lttng_ust_lib_ring_buffer_backend *buf num_subbuf_alloc++; for (i = 0; i < chanb->num_subbuf; i++) { - struct lttng_ust_lib_ring_buffer_backend_subbuffer *sb; + struct lttng_ust_ring_buffer_backend_subbuffer *sb; sb = shmp_index(handle, bufb->buf_wsb, i); if (!sb) @@ -200,8 +200,8 @@ void lib_ring_buffer_backend_reset(struct lttng_ust_lib_ring_buffer_backend *buf bufb->buf_rsb.id = subbuffer_id(config, 0, 1, 0); for (i = 0; i < num_subbuf_alloc; i++) { - struct lttng_ust_lib_ring_buffer_backend_pages_shmp *sbp; - struct lttng_ust_lib_ring_buffer_backend_pages *pages; + struct lttng_ust_ring_buffer_backend_pages_shmp *sbp; + struct lttng_ust_ring_buffer_backend_pages *pages; sbp = shmp_index(handle, bufb->array, i); if (!sbp) @@ -225,9 +225,9 @@ void lib_ring_buffer_backend_reset(struct lttng_ust_lib_ring_buffer_backend *buf */ void channel_backend_reset(struct channel_backend *chanb) { - struct lttng_ust_lib_ring_buffer_channel *chan = caa_container_of(chanb, - struct lttng_ust_lib_ring_buffer_channel, backend); - const struct lttng_ust_lib_ring_buffer_config *config = &chanb->config; + struct lttng_ust_ring_buffer_channel *chan = caa_container_of(chanb, + struct lttng_ust_ring_buffer_channel, backend); + const struct lttng_ust_ring_buffer_config *config = &chanb->config; /* * Don't reset buf_size, subbuf_size, subbuf_size_order, @@ -258,13 +258,13 @@ void channel_backend_reset(struct channel_backend *chanb) */ int channel_backend_init(struct channel_backend *chanb, const char *name, - const struct lttng_ust_lib_ring_buffer_config *config, + const struct lttng_ust_ring_buffer_config *config, size_t subbuf_size, size_t num_subbuf, struct lttng_ust_shm_handle *handle, const int *stream_fds) { - struct lttng_ust_lib_ring_buffer_channel *chan = caa_container_of(chanb, - struct lttng_ust_lib_ring_buffer_channel, backend); + struct lttng_ust_ring_buffer_channel *chan = caa_container_of(chanb, + struct lttng_ust_ring_buffer_channel, backend); unsigned int i; int ret; size_t shmsize = 0, num_subbuf_alloc; @@ -313,8 +313,8 @@ int channel_backend_init(struct channel_backend *chanb, memcpy(&chanb->config, config, sizeof(*config)); /* Per-cpu buffer size: control (prior to backend) */ - shmsize = lttng_ust_offset_align(shmsize, __alignof__(struct lttng_ust_lib_ring_buffer)); - shmsize += sizeof(struct lttng_ust_lib_ring_buffer); + shmsize = lttng_ust_offset_align(shmsize, __alignof__(struct lttng_ust_ring_buffer)); + shmsize += sizeof(struct lttng_ust_ring_buffer); shmsize += lttng_ust_offset_align(shmsize, __alignof__(struct commit_counters_hot)); shmsize += sizeof(struct commit_counters_hot) * num_subbuf; shmsize += lttng_ust_offset_align(shmsize, __alignof__(struct commit_counters_cold)); @@ -326,19 +326,19 @@ int channel_backend_init(struct channel_backend *chanb, /* Per-cpu buffer size: backend */ /* num_subbuf + 1 is the worse case */ num_subbuf_alloc = num_subbuf + 1; - shmsize += lttng_ust_offset_align(shmsize, __alignof__(struct lttng_ust_lib_ring_buffer_backend_pages_shmp)); - shmsize += sizeof(struct lttng_ust_lib_ring_buffer_backend_pages_shmp) * num_subbuf_alloc; + shmsize += lttng_ust_offset_align(shmsize, __alignof__(struct lttng_ust_ring_buffer_backend_pages_shmp)); + shmsize += sizeof(struct lttng_ust_ring_buffer_backend_pages_shmp) * num_subbuf_alloc; shmsize += lttng_ust_offset_align(shmsize, page_size); shmsize += subbuf_size * num_subbuf_alloc; - shmsize += lttng_ust_offset_align(shmsize, __alignof__(struct lttng_ust_lib_ring_buffer_backend_pages)); - shmsize += sizeof(struct lttng_ust_lib_ring_buffer_backend_pages) * num_subbuf_alloc; - shmsize += lttng_ust_offset_align(shmsize, __alignof__(struct lttng_ust_lib_ring_buffer_backend_subbuffer)); - shmsize += sizeof(struct lttng_ust_lib_ring_buffer_backend_subbuffer) * num_subbuf; - shmsize += lttng_ust_offset_align(shmsize, __alignof__(struct lttng_ust_lib_ring_buffer_backend_counts)); - shmsize += sizeof(struct lttng_ust_lib_ring_buffer_backend_counts) * num_subbuf; + shmsize += lttng_ust_offset_align(shmsize, __alignof__(struct lttng_ust_ring_buffer_backend_pages)); + shmsize += sizeof(struct lttng_ust_ring_buffer_backend_pages) * num_subbuf_alloc; + shmsize += lttng_ust_offset_align(shmsize, __alignof__(struct lttng_ust_ring_buffer_backend_subbuffer)); + shmsize += sizeof(struct lttng_ust_ring_buffer_backend_subbuffer) * num_subbuf; + shmsize += lttng_ust_offset_align(shmsize, __alignof__(struct lttng_ust_ring_buffer_backend_counts)); + shmsize += sizeof(struct lttng_ust_ring_buffer_backend_counts) * num_subbuf; if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; /* * We need to allocate for all possible cpus. */ @@ -349,8 +349,8 @@ int channel_backend_init(struct channel_backend *chanb, SHM_OBJECT_SHM, stream_fds[i], i); if (!shmobj) goto end; - align_shm(shmobj, __alignof__(struct lttng_ust_lib_ring_buffer)); - set_shmp(chanb->buf[i].shmp, zalloc_shm(shmobj, sizeof(struct lttng_ust_lib_ring_buffer))); + align_shm(shmobj, __alignof__(struct lttng_ust_ring_buffer)); + set_shmp(chanb->buf[i].shmp, zalloc_shm(shmobj, sizeof(struct lttng_ust_ring_buffer))); buf = shmp(handle, chanb->buf[i].shmp); if (!buf) goto end; @@ -362,14 +362,14 @@ int channel_backend_init(struct channel_backend *chanb, } } else { struct shm_object *shmobj; - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; shmobj = shm_object_table_alloc(handle->table, shmsize, SHM_OBJECT_SHM, stream_fds[0], -1); if (!shmobj) goto end; - align_shm(shmobj, __alignof__(struct lttng_ust_lib_ring_buffer)); - set_shmp(chanb->buf[0].shmp, zalloc_shm(shmobj, sizeof(struct lttng_ust_lib_ring_buffer))); + align_shm(shmobj, __alignof__(struct lttng_ust_ring_buffer)); + set_shmp(chanb->buf[0].shmp, zalloc_shm(shmobj, sizeof(struct lttng_ust_ring_buffer))); buf = shmp(handle, chanb->buf[0].shmp); if (!buf) goto end; @@ -411,14 +411,14 @@ void channel_backend_free(struct channel_backend *chanb __attribute__((unused)), * Should be protected by get_subbuf/put_subbuf. * Returns the length copied. */ -size_t lib_ring_buffer_read(struct lttng_ust_lib_ring_buffer_backend *bufb, size_t offset, +size_t lib_ring_buffer_read(struct lttng_ust_ring_buffer_backend *bufb, size_t offset, void *dest, size_t len, struct lttng_ust_shm_handle *handle) { struct channel_backend *chanb; - const struct lttng_ust_lib_ring_buffer_config *config; + const struct lttng_ust_ring_buffer_config *config; ssize_t orig_len; - struct lttng_ust_lib_ring_buffer_backend_pages_shmp *rpages; - struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; + struct lttng_ust_ring_buffer_backend_pages_shmp *rpages; + struct lttng_ust_ring_buffer_backend_pages *backend_pages; unsigned long sb_bindex, id; void *src; @@ -464,15 +464,15 @@ size_t lib_ring_buffer_read(struct lttng_ust_lib_ring_buffer_backend *bufb, size * Should be protected by get_subbuf/put_subbuf. * Destination length should be at least 1 to hold '\0'. */ -int lib_ring_buffer_read_cstr(struct lttng_ust_lib_ring_buffer_backend *bufb, size_t offset, +int lib_ring_buffer_read_cstr(struct lttng_ust_ring_buffer_backend *bufb, size_t offset, void *dest, size_t len, struct lttng_ust_shm_handle *handle) { struct channel_backend *chanb; - const struct lttng_ust_lib_ring_buffer_config *config; + const struct lttng_ust_ring_buffer_config *config; ssize_t string_len, orig_offset; char *str; - struct lttng_ust_lib_ring_buffer_backend_pages_shmp *rpages; - struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; + struct lttng_ust_ring_buffer_backend_pages_shmp *rpages; + struct lttng_ust_ring_buffer_backend_pages *backend_pages; unsigned long sb_bindex, id; chanb = &shmp(handle, bufb->chan)->backend; @@ -520,14 +520,14 @@ int lib_ring_buffer_read_cstr(struct lttng_ust_lib_ring_buffer_backend *bufb, si * from/to this address, as long as the read/write is never bigger than * a page size. */ -void *lib_ring_buffer_read_offset_address(struct lttng_ust_lib_ring_buffer_backend *bufb, +void *lib_ring_buffer_read_offset_address(struct lttng_ust_ring_buffer_backend *bufb, size_t offset, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_backend_pages_shmp *rpages; - struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; + struct lttng_ust_ring_buffer_backend_pages_shmp *rpages; + struct lttng_ust_ring_buffer_backend_pages *backend_pages; struct channel_backend *chanb; - const struct lttng_ust_lib_ring_buffer_config *config; + const struct lttng_ust_ring_buffer_config *config; unsigned long sb_bindex, id; chanb = &shmp(handle, bufb->chan)->backend; @@ -558,17 +558,17 @@ void *lib_ring_buffer_read_offset_address(struct lttng_ust_lib_ring_buffer_backe * it's always at the beginning of a page, it's safe to write directly to this * address, as long as the write is never bigger than a page size. */ -void *lib_ring_buffer_offset_address(struct lttng_ust_lib_ring_buffer_backend *bufb, +void *lib_ring_buffer_offset_address(struct lttng_ust_ring_buffer_backend *bufb, size_t offset, struct lttng_ust_shm_handle *handle) { size_t sbidx; - struct lttng_ust_lib_ring_buffer_backend_pages_shmp *rpages; - struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; + struct lttng_ust_ring_buffer_backend_pages_shmp *rpages; + struct lttng_ust_ring_buffer_backend_pages *backend_pages; struct channel_backend *chanb; - const struct lttng_ust_lib_ring_buffer_config *config; + const struct lttng_ust_ring_buffer_config *config; unsigned long sb_bindex, id; - struct lttng_ust_lib_ring_buffer_backend_subbuffer *sb; + struct lttng_ust_ring_buffer_backend_subbuffer *sb; chanb = &shmp(handle, bufb->chan)->backend; if (!chanb) diff --git a/src/common/ringbuffer/ring_buffer_frontend.c b/src/common/ringbuffer/ring_buffer_frontend.c index d08fab75..924d6852 100644 --- a/src/common/ringbuffer/ring_buffer_frontend.c +++ b/src/common/ringbuffer/ring_buffer_frontend.c @@ -115,8 +115,8 @@ DEFINE_URCU_TLS(unsigned int, lib_ring_buffer_nesting); static pthread_mutex_t wakeup_fd_mutex = PTHREAD_MUTEX_INITIALIZER; static -void lib_ring_buffer_print_errors(struct lttng_ust_lib_ring_buffer_channel *chan, - struct lttng_ust_lib_ring_buffer *buf, int cpu, +void lib_ring_buffer_print_errors(struct lttng_ust_ring_buffer_channel *chan, + struct lttng_ust_ring_buffer *buf, int cpu, struct lttng_ust_shm_handle *handle); /* @@ -147,7 +147,7 @@ void lttng_ust_ringbuffer_set_allow_blocking(void) } /* Get blocking timeout, in ms */ -static int lttng_ust_ringbuffer_get_timeout(struct lttng_ust_lib_ring_buffer_channel *chan) +static int lttng_ust_ringbuffer_get_timeout(struct lttng_ust_ring_buffer_channel *chan) { if (!lttng_ust_allow_blocking) return 0; @@ -163,11 +163,11 @@ static int lttng_ust_ringbuffer_get_timeout(struct lttng_ust_lib_ring_buffer_cha * should not be using the iterator concurrently with reset. The previous * current iterator record is reset. */ -void lib_ring_buffer_reset(struct lttng_ust_lib_ring_buffer *buf, +void lib_ring_buffer_reset(struct lttng_ust_ring_buffer *buf, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_channel *chan; - const struct lttng_ust_lib_ring_buffer_config *config; + struct lttng_ust_ring_buffer_channel *chan; + const struct lttng_ust_ring_buffer_config *config; unsigned int i; chan = shmp(handle, buf->backend.chan); @@ -220,7 +220,7 @@ void lib_ring_buffer_reset(struct lttng_ust_lib_ring_buffer *buf, * be using the iterator concurrently with reset. The previous current iterator * record is reset. */ -void channel_reset(struct lttng_ust_lib_ring_buffer_channel *chan) +void channel_reset(struct lttng_ust_ring_buffer_channel *chan) { /* * Reset iterators first. Will put the subbuffer if held for reading. @@ -234,9 +234,9 @@ void channel_reset(struct lttng_ust_lib_ring_buffer_channel *chan) } static -void init_crash_abi(const struct lttng_ust_lib_ring_buffer_config *config, +void init_crash_abi(const struct lttng_ust_ring_buffer_config *config, struct lttng_crash_abi *crash_abi, - struct lttng_ust_lib_ring_buffer *buf, + struct lttng_ust_ring_buffer *buf, struct channel_backend *chanb, struct shm_object *shmobj, struct lttng_ust_shm_handle *handle) @@ -264,14 +264,14 @@ void init_crash_abi(const struct lttng_ust_lib_ring_buffer_config *config, crash_abi->offset.buf_wsb_array = (uint32_t) ((char *) shmp(handle, buf->backend.buf_wsb) - (char *) buf); crash_abi->offset.buf_wsb_id = - offsetof(struct lttng_ust_lib_ring_buffer_backend_subbuffer, id); + offsetof(struct lttng_ust_ring_buffer_backend_subbuffer, id); crash_abi->offset.sb_array = (uint32_t) ((char *) shmp(handle, buf->backend.array) - (char *) buf); crash_abi->offset.sb_array_shmp_offset = - offsetof(struct lttng_ust_lib_ring_buffer_backend_pages_shmp, + offsetof(struct lttng_ust_ring_buffer_backend_pages_shmp, shmp._ref.offset); crash_abi->offset.sb_backend_p_offset = - offsetof(struct lttng_ust_lib_ring_buffer_backend_pages, + offsetof(struct lttng_ust_ring_buffer_backend_pages, p._ref.offset); /* Field length */ @@ -280,19 +280,19 @@ void init_crash_abi(const struct lttng_ust_lib_ring_buffer_config *config, crash_abi->length.commit_hot_seq = sizeof(((struct commit_counters_hot *) NULL)->seq); crash_abi->length.buf_wsb_id = - sizeof(((struct lttng_ust_lib_ring_buffer_backend_subbuffer *) NULL)->id); + sizeof(((struct lttng_ust_ring_buffer_backend_subbuffer *) NULL)->id); crash_abi->length.sb_array_shmp_offset = - sizeof(((struct lttng_ust_lib_ring_buffer_backend_pages_shmp *) NULL)->shmp._ref.offset); + sizeof(((struct lttng_ust_ring_buffer_backend_pages_shmp *) NULL)->shmp._ref.offset); crash_abi->length.sb_backend_p_offset = - sizeof(((struct lttng_ust_lib_ring_buffer_backend_pages *) NULL)->p._ref.offset); + sizeof(((struct lttng_ust_ring_buffer_backend_pages *) NULL)->p._ref.offset); /* Array stride */ crash_abi->stride.commit_hot_array = sizeof(struct commit_counters_hot); crash_abi->stride.buf_wsb_array = - sizeof(struct lttng_ust_lib_ring_buffer_backend_subbuffer); + sizeof(struct lttng_ust_ring_buffer_backend_subbuffer); crash_abi->stride.sb_array = - sizeof(struct lttng_ust_lib_ring_buffer_backend_pages_shmp); + sizeof(struct lttng_ust_ring_buffer_backend_pages_shmp); /* Buffer constants */ crash_abi->buf_size = chanb->buf_size; @@ -325,16 +325,16 @@ void init_crash_abi(const struct lttng_ust_lib_ring_buffer_config *config, /* * Must be called under cpu hotplug protection. */ -int lib_ring_buffer_create(struct lttng_ust_lib_ring_buffer *buf, +int lib_ring_buffer_create(struct lttng_ust_ring_buffer *buf, struct channel_backend *chanb, int cpu, struct lttng_ust_shm_handle *handle, struct shm_object *shmobj) { - const struct lttng_ust_lib_ring_buffer_config *config = &chanb->config; - struct lttng_ust_lib_ring_buffer_channel *chan = caa_container_of(chanb, - struct lttng_ust_lib_ring_buffer_channel, backend); - struct lttng_ust_lib_ring_buffer_backend_subbuffer *wsb; - struct lttng_ust_lib_ring_buffer_channel *shmp_chan; + const struct lttng_ust_ring_buffer_config *config = &chanb->config; + struct lttng_ust_ring_buffer_channel *chan = caa_container_of(chanb, + struct lttng_ust_ring_buffer_channel, backend); + struct lttng_ust_ring_buffer_backend_subbuffer *wsb; + struct lttng_ust_ring_buffer_channel *shmp_chan; struct commit_counters_hot *cc_hot; void *priv = channel_get_private_config(chan); size_t subbuf_header_size; @@ -431,9 +431,9 @@ static void lib_ring_buffer_channel_switch_timer(int sig __attribute__((unused)), siginfo_t *si, void *uc __attribute__((unused))) { - const struct lttng_ust_lib_ring_buffer_config *config; + const struct lttng_ust_ring_buffer_config *config; struct lttng_ust_shm_handle *handle; - struct lttng_ust_lib_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer_channel *chan; int cpu; assert(CMM_LOAD_SHARED(timer_signal.tid) == pthread_self()); @@ -450,7 +450,7 @@ void lib_ring_buffer_channel_switch_timer(int sig __attribute__((unused)), pthread_mutex_lock(&wakeup_fd_mutex); if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { for_each_possible_cpu(cpu) { - struct lttng_ust_lib_ring_buffer *buf = + struct lttng_ust_ring_buffer *buf = shmp(handle, chan->backend.buf[cpu].shmp); if (!buf) @@ -460,7 +460,7 @@ void lib_ring_buffer_channel_switch_timer(int sig __attribute__((unused)), chan->handle); } } else { - struct lttng_ust_lib_ring_buffer *buf = + struct lttng_ust_ring_buffer *buf = shmp(handle, chan->backend.buf[0].shmp); if (!buf) @@ -475,9 +475,9 @@ end: } static -int lib_ring_buffer_poll_deliver(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +int lib_ring_buffer_poll_deliver(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, struct lttng_ust_shm_handle *handle) { unsigned long consumed_old, consumed_idx, commit_count, write_offset; @@ -521,7 +521,7 @@ int lib_ring_buffer_poll_deliver(const struct lttng_ust_lib_ring_buffer_config * } static -void lib_ring_buffer_wakeup(struct lttng_ust_lib_ring_buffer *buf, +void lib_ring_buffer_wakeup(struct lttng_ust_ring_buffer *buf, struct lttng_ust_shm_handle *handle) { int wakeup_fd = shm_get_wakeup_fd(handle, &buf->self._ref); @@ -586,9 +586,9 @@ void lib_ring_buffer_wakeup(struct lttng_ust_lib_ring_buffer *buf, } static -void lib_ring_buffer_channel_do_read(struct lttng_ust_lib_ring_buffer_channel *chan) +void lib_ring_buffer_channel_do_read(struct lttng_ust_ring_buffer_channel *chan) { - const struct lttng_ust_lib_ring_buffer_config *config; + const struct lttng_ust_ring_buffer_config *config; struct lttng_ust_shm_handle *handle; int cpu; @@ -601,7 +601,7 @@ void lib_ring_buffer_channel_do_read(struct lttng_ust_lib_ring_buffer_channel *c pthread_mutex_lock(&wakeup_fd_mutex); if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { for_each_possible_cpu(cpu) { - struct lttng_ust_lib_ring_buffer *buf = + struct lttng_ust_ring_buffer *buf = shmp(handle, chan->backend.buf[cpu].shmp); if (!buf) @@ -613,7 +613,7 @@ void lib_ring_buffer_channel_do_read(struct lttng_ust_lib_ring_buffer_channel *c } } } else { - struct lttng_ust_lib_ring_buffer *buf = + struct lttng_ust_ring_buffer *buf = shmp(handle, chan->backend.buf[0].shmp); if (!buf) @@ -632,7 +632,7 @@ static void lib_ring_buffer_channel_read_timer(int sig __attribute__((unused)), siginfo_t *si, void *uc __attribute__((unused))) { - struct lttng_ust_lib_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer_channel *chan; assert(CMM_LOAD_SHARED(timer_signal.tid) == pthread_self()); chan = si->si_value.sival_ptr; @@ -782,7 +782,7 @@ void lib_ring_buffer_wait_signal_thread_qs(unsigned int signr) } static -void lib_ring_buffer_channel_switch_timer_start(struct lttng_ust_lib_ring_buffer_channel *chan) +void lib_ring_buffer_channel_switch_timer_start(struct lttng_ust_ring_buffer_channel *chan) { struct sigevent sev; struct itimerspec its; @@ -816,7 +816,7 @@ void lib_ring_buffer_channel_switch_timer_start(struct lttng_ust_lib_ring_buffer } static -void lib_ring_buffer_channel_switch_timer_stop(struct lttng_ust_lib_ring_buffer_channel *chan) +void lib_ring_buffer_channel_switch_timer_stop(struct lttng_ust_ring_buffer_channel *chan) { int ret; @@ -835,9 +835,9 @@ void lib_ring_buffer_channel_switch_timer_stop(struct lttng_ust_lib_ring_buffer_ } static -void lib_ring_buffer_channel_read_timer_start(struct lttng_ust_lib_ring_buffer_channel *chan) +void lib_ring_buffer_channel_read_timer_start(struct lttng_ust_ring_buffer_channel *chan) { - const struct lttng_ust_lib_ring_buffer_config *config = &chan->backend.config; + const struct lttng_ust_ring_buffer_config *config = &chan->backend.config; struct sigevent sev; struct itimerspec its; int ret; @@ -870,9 +870,9 @@ void lib_ring_buffer_channel_read_timer_start(struct lttng_ust_lib_ring_buffer_c } static -void lib_ring_buffer_channel_read_timer_stop(struct lttng_ust_lib_ring_buffer_channel *chan) +void lib_ring_buffer_channel_read_timer_stop(struct lttng_ust_ring_buffer_channel *chan) { - const struct lttng_ust_lib_ring_buffer_config *config = &chan->backend.config; + const struct lttng_ust_ring_buffer_config *config = &chan->backend.config; int ret; if (config->wakeup != RING_BUFFER_WAKEUP_BY_TIMER @@ -896,29 +896,29 @@ void lib_ring_buffer_channel_read_timer_stop(struct lttng_ust_lib_ring_buffer_ch chan->read_timer_enabled = 0; } -static void channel_unregister_notifiers(struct lttng_ust_lib_ring_buffer_channel *chan, +static void channel_unregister_notifiers(struct lttng_ust_ring_buffer_channel *chan, struct lttng_ust_shm_handle *handle __attribute__((unused))) { lib_ring_buffer_channel_switch_timer_stop(chan); lib_ring_buffer_channel_read_timer_stop(chan); } -static void channel_print_errors(struct lttng_ust_lib_ring_buffer_channel *chan, +static void channel_print_errors(struct lttng_ust_ring_buffer_channel *chan, struct lttng_ust_shm_handle *handle) { - const struct lttng_ust_lib_ring_buffer_config *config = + const struct lttng_ust_ring_buffer_config *config = &chan->backend.config; int cpu; if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { for_each_possible_cpu(cpu) { - struct lttng_ust_lib_ring_buffer *buf = + struct lttng_ust_ring_buffer *buf = shmp(handle, chan->backend.buf[cpu].shmp); if (buf) lib_ring_buffer_print_errors(chan, buf, cpu, handle); } } else { - struct lttng_ust_lib_ring_buffer *buf = + struct lttng_ust_ring_buffer *buf = shmp(handle, chan->backend.buf[0].shmp); if (buf) @@ -926,7 +926,7 @@ static void channel_print_errors(struct lttng_ust_lib_ring_buffer_channel *chan, } } -static void channel_free(struct lttng_ust_lib_ring_buffer_channel *chan, +static void channel_free(struct lttng_ust_ring_buffer_channel *chan, struct lttng_ust_shm_handle *handle, int consumer) { @@ -959,7 +959,7 @@ static void channel_free(struct lttng_ust_lib_ring_buffer_channel *chan, * Holds cpu hotplug. * Returns NULL on failure. */ -struct lttng_ust_shm_handle *channel_create(const struct lttng_ust_lib_ring_buffer_config *config, +struct lttng_ust_shm_handle *channel_create(const struct lttng_ust_ring_buffer_config *config, const char *name, size_t priv_data_align, size_t priv_data_size, @@ -973,7 +973,7 @@ struct lttng_ust_shm_handle *channel_create(const struct lttng_ust_lib_ring_buff { int ret; size_t shmsize, chansize; - struct lttng_ust_lib_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer_channel *chan; struct lttng_ust_shm_handle *handle; struct shm_object *shmobj; unsigned int nr_streams; @@ -1014,9 +1014,9 @@ struct lttng_ust_shm_handle *channel_create(const struct lttng_ust_lib_ring_buff goto error_table_alloc; /* Calculate the shm allocation layout */ - shmsize = sizeof(struct lttng_ust_lib_ring_buffer_channel); - shmsize += lttng_ust_offset_align(shmsize, __alignof__(struct lttng_ust_lib_ring_buffer_shmp)); - shmsize += sizeof(struct lttng_ust_lib_ring_buffer_shmp) * nr_streams; + shmsize = sizeof(struct lttng_ust_ring_buffer_channel); + shmsize += lttng_ust_offset_align(shmsize, __alignof__(struct lttng_ust_ring_buffer_shmp)); + shmsize += sizeof(struct lttng_ust_ring_buffer_shmp) * nr_streams; chansize = shmsize; if (priv_data_align) shmsize += lttng_ust_offset_align(shmsize, priv_data_align); @@ -1027,7 +1027,7 @@ struct lttng_ust_shm_handle *channel_create(const struct lttng_ust_lib_ring_buff -1, -1); if (!shmobj) goto error_append; - /* struct lttng_ust_lib_ring_buffer_channel is at object 0, offset 0 (hardcoded) */ + /* struct lttng_ust_ring_buffer_channel is at object 0, offset 0 (hardcoded) */ set_shmp(handle->chan, zalloc_shm(shmobj, chansize)); assert(handle->chan._ref.index == 0); assert(handle->chan._ref.offset == 0); @@ -1101,7 +1101,7 @@ struct lttng_ust_shm_handle *channel_handle_create(void *data, memory_map_size, wakeup_fd); if (!object) goto error_table_object; - /* struct lttng_ust_lib_ring_buffer_channel is at object 0, offset 0 (hardcoded) */ + /* struct lttng_ust_ring_buffer_channel is at object 0, offset 0 (hardcoded) */ handle->chan._ref.index = 0; handle->chan._ref.offset = 0; return handle; @@ -1135,7 +1135,7 @@ unsigned int channel_handle_get_nr_streams(struct lttng_ust_shm_handle *handle) } static -void channel_release(struct lttng_ust_lib_ring_buffer_channel *chan, struct lttng_ust_shm_handle *handle, +void channel_release(struct lttng_ust_ring_buffer_channel *chan, struct lttng_ust_shm_handle *handle, int consumer) { channel_free(chan, handle, consumer); @@ -1151,7 +1151,7 @@ void channel_release(struct lttng_ust_lib_ring_buffer_channel *chan, struct lttn * consumption of finalized channels, get_subbuf() will return -ENODATA. * They should release their handle at that point. */ -void channel_destroy(struct lttng_ust_lib_ring_buffer_channel *chan, struct lttng_ust_shm_handle *handle, +void channel_destroy(struct lttng_ust_ring_buffer_channel *chan, struct lttng_ust_shm_handle *handle, int consumer) { if (consumer) { @@ -1174,9 +1174,9 @@ void channel_destroy(struct lttng_ust_lib_ring_buffer_channel *chan, struct lttn return; } -struct lttng_ust_lib_ring_buffer *channel_get_ring_buffer( - const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_channel *chan, int cpu, +struct lttng_ust_ring_buffer *channel_get_ring_buffer( + const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_channel *chan, int cpu, struct lttng_ust_shm_handle *handle, int *shm_fd, int *wait_fd, int *wakeup_fd, @@ -1200,8 +1200,8 @@ struct lttng_ust_lib_ring_buffer *channel_get_ring_buffer( } int ring_buffer_channel_close_wait_fd( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_channel *chan __attribute__((unused)), + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), + struct lttng_ust_ring_buffer_channel *chan __attribute__((unused)), struct lttng_ust_shm_handle *handle) { struct shm_ref *ref; @@ -1211,8 +1211,8 @@ int ring_buffer_channel_close_wait_fd( } int ring_buffer_channel_close_wakeup_fd( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_channel *chan __attribute__((unused)), + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), + struct lttng_ust_ring_buffer_channel *chan __attribute__((unused)), struct lttng_ust_shm_handle *handle) { struct shm_ref *ref; @@ -1221,8 +1221,8 @@ int ring_buffer_channel_close_wakeup_fd( return shm_close_wakeup_fd(handle, ref); } -int ring_buffer_stream_close_wait_fd(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_channel *chan, +int ring_buffer_stream_close_wait_fd(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_channel *chan, struct lttng_ust_shm_handle *handle, int cpu) { @@ -1238,8 +1238,8 @@ int ring_buffer_stream_close_wait_fd(const struct lttng_ust_lib_ring_buffer_conf return shm_close_wait_fd(handle, ref); } -int ring_buffer_stream_close_wakeup_fd(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_channel *chan, +int ring_buffer_stream_close_wakeup_fd(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_channel *chan, struct lttng_ust_shm_handle *handle, int cpu) { @@ -1259,7 +1259,7 @@ int ring_buffer_stream_close_wakeup_fd(const struct lttng_ust_lib_ring_buffer_co return ret; } -int lib_ring_buffer_open_read(struct lttng_ust_lib_ring_buffer *buf, +int lib_ring_buffer_open_read(struct lttng_ust_ring_buffer *buf, struct lttng_ust_shm_handle *handle __attribute__((unused))) { if (uatomic_cmpxchg(&buf->active_readers, 0, 1) != 0) @@ -1268,10 +1268,10 @@ int lib_ring_buffer_open_read(struct lttng_ust_lib_ring_buffer *buf, return 0; } -void lib_ring_buffer_release_read(struct lttng_ust_lib_ring_buffer *buf, +void lib_ring_buffer_release_read(struct lttng_ust_ring_buffer *buf, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_channel *chan = shmp(handle, buf->backend.chan); + struct lttng_ust_ring_buffer_channel *chan = shmp(handle, buf->backend.chan); if (!chan) return; @@ -1290,12 +1290,12 @@ void lib_ring_buffer_release_read(struct lttng_ust_lib_ring_buffer *buf, * data to read at consumed position, or 0 if the get operation succeeds. */ -int lib_ring_buffer_snapshot(struct lttng_ust_lib_ring_buffer *buf, +int lib_ring_buffer_snapshot(struct lttng_ust_ring_buffer *buf, unsigned long *consumed, unsigned long *produced, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_channel *chan; - const struct lttng_ust_lib_ring_buffer_config *config; + struct lttng_ust_ring_buffer_channel *chan; + const struct lttng_ust_ring_buffer_config *config; unsigned long consumed_cur, write_offset; int finalized; @@ -1355,12 +1355,12 @@ nodata: * consumer positions without regard for the "snapshot" feature. */ int lib_ring_buffer_snapshot_sample_positions( - struct lttng_ust_lib_ring_buffer *buf, + struct lttng_ust_ring_buffer *buf, unsigned long *consumed, unsigned long *produced, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_channel *chan; - const struct lttng_ust_lib_ring_buffer_config *config; + struct lttng_ust_ring_buffer_channel *chan; + const struct lttng_ust_ring_buffer_config *config; chan = shmp(handle, buf->backend.chan); if (!chan) @@ -1385,12 +1385,12 @@ int lib_ring_buffer_snapshot_sample_positions( * @buf: ring buffer * @consumed_new: new consumed count value */ -void lib_ring_buffer_move_consumer(struct lttng_ust_lib_ring_buffer *buf, +void lib_ring_buffer_move_consumer(struct lttng_ust_ring_buffer *buf, unsigned long consumed_new, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_backend *bufb = &buf->backend; - struct lttng_ust_lib_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer_backend *bufb = &buf->backend; + struct lttng_ust_ring_buffer_channel *chan; unsigned long consumed; chan = shmp(handle, bufb->chan); @@ -1417,12 +1417,12 @@ void lib_ring_buffer_move_consumer(struct lttng_ust_lib_ring_buffer *buf, * Returns -ENODATA if buffer is finalized, -EAGAIN if there is currently no * data to read at consumed position, or 0 if the get operation succeeds. */ -int lib_ring_buffer_get_subbuf(struct lttng_ust_lib_ring_buffer *buf, +int lib_ring_buffer_get_subbuf(struct lttng_ust_ring_buffer *buf, unsigned long consumed, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_channel *chan; - const struct lttng_ust_lib_ring_buffer_config *config; + struct lttng_ust_ring_buffer_channel *chan; + const struct lttng_ust_ring_buffer_config *config; unsigned long consumed_cur, consumed_idx, commit_count, write_offset; int ret, finalized, nr_retry = LTTNG_UST_RING_BUFFER_GET_RETRY; struct commit_counters_cold *cc_cold; @@ -1581,15 +1581,15 @@ nodata: * lib_ring_buffer_put_subbuf - release exclusive subbuffer access * @buf: ring buffer */ -void lib_ring_buffer_put_subbuf(struct lttng_ust_lib_ring_buffer *buf, +void lib_ring_buffer_put_subbuf(struct lttng_ust_ring_buffer *buf, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_backend *bufb = &buf->backend; - struct lttng_ust_lib_ring_buffer_channel *chan; - const struct lttng_ust_lib_ring_buffer_config *config; + struct lttng_ust_ring_buffer_backend *bufb = &buf->backend; + struct lttng_ust_ring_buffer_channel *chan; + const struct lttng_ust_ring_buffer_config *config; unsigned long sb_bindex, consumed_idx, consumed; - struct lttng_ust_lib_ring_buffer_backend_pages_shmp *rpages; - struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; + struct lttng_ust_ring_buffer_backend_pages_shmp *rpages; + struct lttng_ust_ring_buffer_backend_pages *backend_pages; chan = shmp(handle, bufb->chan); if (!chan) @@ -1651,13 +1651,13 @@ void lib_ring_buffer_put_subbuf(struct lttng_ust_lib_ring_buffer *buf, * position and the writer position. (inclusive) */ static -void lib_ring_buffer_print_subbuffer_errors(struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +void lib_ring_buffer_print_subbuffer_errors(struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, unsigned long cons_offset, int cpu, struct lttng_ust_shm_handle *handle) { - const struct lttng_ust_lib_ring_buffer_config *config = &chan->backend.config; + const struct lttng_ust_ring_buffer_config *config = &chan->backend.config; unsigned long cons_idx, commit_count, commit_count_sb; struct commit_counters_hot *cc_hot; struct commit_counters_cold *cc_cold; @@ -1686,11 +1686,11 @@ void lib_ring_buffer_print_subbuffer_errors(struct lttng_ust_lib_ring_buffer *bu } static -void lib_ring_buffer_print_buffer_errors(struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +void lib_ring_buffer_print_buffer_errors(struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, int cpu, struct lttng_ust_shm_handle *handle) { - const struct lttng_ust_lib_ring_buffer_config *config = &chan->backend.config; + const struct lttng_ust_ring_buffer_config *config = &chan->backend.config; unsigned long write_offset, cons_offset; /* @@ -1716,11 +1716,11 @@ void lib_ring_buffer_print_buffer_errors(struct lttng_ust_lib_ring_buffer *buf, } static -void lib_ring_buffer_print_errors(struct lttng_ust_lib_ring_buffer_channel *chan, - struct lttng_ust_lib_ring_buffer *buf, int cpu, +void lib_ring_buffer_print_errors(struct lttng_ust_ring_buffer_channel *chan, + struct lttng_ust_ring_buffer *buf, int cpu, struct lttng_ust_shm_handle *handle) { - const struct lttng_ust_lib_ring_buffer_config *config = &chan->backend.config; + const struct lttng_ust_ring_buffer_config *config = &chan->backend.config; if (!strcmp(chan->backend.name, "relay-metadata-mmap")) { DBG("ring buffer %s: %lu records written, " @@ -1756,13 +1756,13 @@ void lib_ring_buffer_print_errors(struct lttng_ust_lib_ring_buffer_channel *chan * active or at buffer finalization (destroy). */ static -void lib_ring_buffer_switch_old_start(struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +void lib_ring_buffer_switch_old_start(struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, struct switch_offsets *offsets, uint64_t tsc, struct lttng_ust_shm_handle *handle) { - const struct lttng_ust_lib_ring_buffer_config *config = &chan->backend.config; + const struct lttng_ust_ring_buffer_config *config = &chan->backend.config; unsigned long oldidx = subbuf_index(offsets->old, chan); unsigned long commit_count; struct commit_counters_hot *cc_hot; @@ -1797,13 +1797,13 @@ void lib_ring_buffer_switch_old_start(struct lttng_ust_lib_ring_buffer *buf, * subbuffer. */ static -void lib_ring_buffer_switch_old_end(struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +void lib_ring_buffer_switch_old_end(struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, struct switch_offsets *offsets, uint64_t tsc, struct lttng_ust_shm_handle *handle) { - const struct lttng_ust_lib_ring_buffer_config *config = &chan->backend.config; + const struct lttng_ust_ring_buffer_config *config = &chan->backend.config; unsigned long oldidx = subbuf_index(offsets->old - 1, chan); unsigned long commit_count, padding_size, data_size; struct commit_counters_hot *cc_hot; @@ -1852,13 +1852,13 @@ void lib_ring_buffer_switch_old_end(struct lttng_ust_lib_ring_buffer *buf, * that this code is executed before the deliver of this sub-buffer. */ static -void lib_ring_buffer_switch_new_start(struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +void lib_ring_buffer_switch_new_start(struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, struct switch_offsets *offsets, uint64_t tsc, struct lttng_ust_shm_handle *handle) { - const struct lttng_ust_lib_ring_buffer_config *config = &chan->backend.config; + const struct lttng_ust_ring_buffer_config *config = &chan->backend.config; unsigned long beginidx = subbuf_index(offsets->begin, chan); unsigned long commit_count; struct commit_counters_hot *cc_hot; @@ -1892,13 +1892,13 @@ void lib_ring_buffer_switch_new_start(struct lttng_ust_lib_ring_buffer *buf, * we are currently doing the space reservation. */ static -void lib_ring_buffer_switch_new_end(struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +void lib_ring_buffer_switch_new_end(struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, struct switch_offsets *offsets, uint64_t tsc, struct lttng_ust_shm_handle *handle) { - const struct lttng_ust_lib_ring_buffer_config *config = &chan->backend.config; + const struct lttng_ust_ring_buffer_config *config = &chan->backend.config; unsigned long endidx, data_size; uint64_t *ts_end; @@ -1927,13 +1927,13 @@ void lib_ring_buffer_switch_new_end(struct lttng_ust_lib_ring_buffer *buf, */ static int lib_ring_buffer_try_switch_slow(enum switch_mode mode, - struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, + struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, struct switch_offsets *offsets, uint64_t *tsc, struct lttng_ust_shm_handle *handle) { - const struct lttng_ust_lib_ring_buffer_config *config = &chan->backend.config; + const struct lttng_ust_ring_buffer_config *config = &chan->backend.config; unsigned long off, reserve_commit_diff; offsets->begin = v_read(config, &buf->offset); @@ -2041,11 +2041,11 @@ int lib_ring_buffer_try_switch_slow(enum switch_mode mode, * RING_BUFFER_SYNC_GLOBAL ring buffers, this function can be called * from any CPU. */ -void lib_ring_buffer_switch_slow(struct lttng_ust_lib_ring_buffer *buf, enum switch_mode mode, +void lib_ring_buffer_switch_slow(struct lttng_ust_ring_buffer *buf, enum switch_mode mode, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_channel *chan; - const struct lttng_ust_lib_ring_buffer_config *config; + struct lttng_ust_ring_buffer_channel *chan; + const struct lttng_ust_ring_buffer_config *config; struct switch_offsets offsets; unsigned long oldidx; uint64_t tsc; @@ -2122,14 +2122,14 @@ bool handle_blocking_retry(int *timeout_left_ms) * -EIO if data cannot be written into the buffer for any other reason. */ static -int lib_ring_buffer_try_reserve_slow(struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +int lib_ring_buffer_try_reserve_slow(struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, struct switch_offsets *offsets, - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, void *client_ctx) { - struct lttng_ust_lib_ring_buffer_ctx_private *ctx_private = ctx->priv; - const struct lttng_ust_lib_ring_buffer_config *config = &chan->backend.config; + struct lttng_ust_ring_buffer_ctx_private *ctx_private = ctx->priv; + const struct lttng_ust_ring_buffer_config *config = &chan->backend.config; struct lttng_ust_shm_handle *handle = chan->handle; unsigned long reserve_commit_diff, offset_cmp; int timeout_left_ms = lttng_ust_ringbuffer_get_timeout(chan); @@ -2157,7 +2157,7 @@ retry: &offsets->pre_header_padding, ctx, client_ctx); offsets->size += - lttng_ust_lib_ring_buffer_align(offsets->begin + offsets->size, + lttng_ust_ring_buffer_align(offsets->begin + offsets->size, ctx->largest_align) + ctx->data_size; if (caa_unlikely(subbuf_offset(offsets->begin, chan) + @@ -2263,7 +2263,7 @@ retry: &offsets->pre_header_padding, ctx, client_ctx); offsets->size += - lttng_ust_lib_ring_buffer_align(offsets->begin + offsets->size, + lttng_ust_ring_buffer_align(offsets->begin + offsets->size, ctx->largest_align) + ctx->data_size; if (caa_unlikely(subbuf_offset(offsets->begin, chan) @@ -2315,14 +2315,14 @@ retry: * -EIO for other errors, else returns 0. * It will take care of sub-buffer switching. */ -int lib_ring_buffer_reserve_slow(struct lttng_ust_lib_ring_buffer_ctx *ctx, +int lib_ring_buffer_reserve_slow(struct lttng_ust_ring_buffer_ctx *ctx, void *client_ctx) { - struct lttng_ust_lib_ring_buffer_ctx_private *ctx_private = ctx->priv; - struct lttng_ust_lib_ring_buffer_channel *chan = ctx_private->chan; + struct lttng_ust_ring_buffer_ctx_private *ctx_private = ctx->priv; + struct lttng_ust_ring_buffer_channel *chan = ctx_private->chan; struct lttng_ust_shm_handle *handle = chan->handle; - const struct lttng_ust_lib_ring_buffer_config *config = &chan->backend.config; - struct lttng_ust_lib_ring_buffer *buf; + const struct lttng_ust_ring_buffer_config *config = &chan->backend.config; + struct lttng_ust_ring_buffer *buf; struct switch_offsets offsets; int ret; @@ -2391,8 +2391,8 @@ int lib_ring_buffer_reserve_slow(struct lttng_ust_lib_ring_buffer_ctx *ctx, } static -void lib_ring_buffer_vmcore_check_deliver(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf, +void lib_ring_buffer_vmcore_check_deliver(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf, unsigned long commit_count, unsigned long idx, struct lttng_ust_shm_handle *handle) @@ -2413,8 +2413,8 @@ void lib_ring_buffer_vmcore_check_deliver(const struct lttng_ust_lib_ring_buffer */ #ifdef LTTNG_RING_BUFFER_COUNT_EVENTS static -void deliver_count_events(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf, +void deliver_count_events(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf, unsigned long idx, struct lttng_ust_shm_handle *handle) { @@ -2428,17 +2428,17 @@ void deliver_count_events(const struct lttng_ust_lib_ring_buffer_config *config, #else /* LTTNG_RING_BUFFER_COUNT_EVENTS */ static void deliver_count_events( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), - struct lttng_ust_lib_ring_buffer *buf __attribute__((unused)), + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), + struct lttng_ust_ring_buffer *buf __attribute__((unused)), unsigned long idx __attribute__((unused)), struct lttng_ust_shm_handle *handle __attribute__((unused))) { } #endif /* #else LTTNG_RING_BUFFER_COUNT_EVENTS */ -void lib_ring_buffer_check_deliver_slow(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +void lib_ring_buffer_check_deliver_slow(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, unsigned long offset, unsigned long commit_count, unsigned long idx, diff --git a/src/common/ringbuffer/ringbuffer-config.h b/src/common/ringbuffer/ringbuffer-config.h index 2e10de03..94f283ff 100644 --- a/src/common/ringbuffer/ringbuffer-config.h +++ b/src/common/ringbuffer/ringbuffer-config.h @@ -20,10 +20,10 @@ #include #include -struct lttng_ust_lib_ring_buffer; -struct lttng_ust_lib_ring_buffer_channel; -struct lttng_ust_lib_ring_buffer_config; -struct lttng_ust_lib_ring_buffer_ctx_private; +struct lttng_ust_ring_buffer; +struct lttng_ust_ring_buffer_channel; +struct lttng_ust_ring_buffer_config; +struct lttng_ust_ring_buffer_ctx_private; struct lttng_ust_shm_handle; /* @@ -32,38 +32,38 @@ struct lttng_ust_shm_handle; * provided as inline functions too. These may simply return 0 if not used by * the client. */ -struct lttng_ust_lib_ring_buffer_client_cb { +struct lttng_ust_ring_buffer_client_cb { /* Mandatory callbacks */ /* A static inline version is also required for fast path */ - uint64_t (*ring_buffer_clock_read) (struct lttng_ust_lib_ring_buffer_channel *chan); - size_t (*record_header_size) (const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_channel *chan, + uint64_t (*ring_buffer_clock_read) (struct lttng_ust_ring_buffer_channel *chan); + size_t (*record_header_size) (const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_channel *chan, size_t offset, size_t *pre_header_padding, - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, void *client_ctx); /* Slow path only, at subbuffer switch */ size_t (*subbuffer_header_size) (void); - void (*buffer_begin) (struct lttng_ust_lib_ring_buffer *buf, uint64_t tsc, + void (*buffer_begin) (struct lttng_ust_ring_buffer *buf, uint64_t tsc, unsigned int subbuf_idx, struct lttng_ust_shm_handle *handle); - void (*buffer_end) (struct lttng_ust_lib_ring_buffer *buf, uint64_t tsc, + void (*buffer_end) (struct lttng_ust_ring_buffer *buf, uint64_t tsc, unsigned int subbuf_idx, unsigned long data_size, struct lttng_ust_shm_handle *handle); /* Optional callbacks (can be set to NULL) */ /* Called at buffer creation/finalize */ - int (*buffer_create) (struct lttng_ust_lib_ring_buffer *buf, void *priv, + int (*buffer_create) (struct lttng_ust_ring_buffer *buf, void *priv, int cpu, const char *name, struct lttng_ust_shm_handle *handle); /* * Clients should guarantee that no new reader handle can be opened * after finalize. */ - void (*buffer_finalize) (struct lttng_ust_lib_ring_buffer *buf, + void (*buffer_finalize) (struct lttng_ust_ring_buffer *buf, void *priv, int cpu, struct lttng_ust_shm_handle *handle); @@ -72,18 +72,18 @@ struct lttng_ust_lib_ring_buffer_client_cb { * record. Used by buffer iterators. Timestamp is only used by channel * iterator. */ - void (*record_get) (const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_channel *chan, - struct lttng_ust_lib_ring_buffer *buf, + void (*record_get) (const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_channel *chan, + struct lttng_ust_ring_buffer *buf, size_t offset, size_t *header_len, size_t *payload_len, uint64_t *timestamp, struct lttng_ust_shm_handle *handle); /* * Offset and size of content size field in client. */ - void (*content_size_field) (const struct lttng_ust_lib_ring_buffer_config *config, + void (*content_size_field) (const struct lttng_ust_ring_buffer_config *config, size_t *offset, size_t *length); - void (*packet_size_field) (const struct lttng_ust_lib_ring_buffer_config *config, + void (*packet_size_field) (const struct lttng_ust_ring_buffer_config *config, size_t *offset, size_t *length); }; @@ -126,22 +126,22 @@ struct lttng_ust_lib_ring_buffer_client_cb { */ #define LTTNG_UST_RING_BUFFER_CONFIG_PADDING 20 -enum lttng_ust_lib_ring_buffer_alloc_types { +enum lttng_ust_ring_buffer_alloc_types { RING_BUFFER_ALLOC_PER_CPU, RING_BUFFER_ALLOC_GLOBAL, }; -enum lttng_ust_lib_ring_buffer_sync_types { +enum lttng_ust_ring_buffer_sync_types { RING_BUFFER_SYNC_PER_CPU, /* Wait-free */ RING_BUFFER_SYNC_GLOBAL, /* Lock-free */ }; -enum lttng_ust_lib_ring_buffer_mode_types { +enum lttng_ust_ring_buffer_mode_types { RING_BUFFER_OVERWRITE = 0, /* Overwrite when buffer full */ RING_BUFFER_DISCARD = 1, /* Discard when buffer full */ }; -enum lttng_ust_lib_ring_buffer_output_types { +enum lttng_ust_ring_buffer_output_types { RING_BUFFER_SPLICE, RING_BUFFER_MMAP, RING_BUFFER_READ, /* TODO */ @@ -149,23 +149,23 @@ enum lttng_ust_lib_ring_buffer_output_types { RING_BUFFER_NONE, }; -enum lttng_ust_lib_ring_buffer_backend_types { +enum lttng_ust_ring_buffer_backend_types { RING_BUFFER_PAGE, RING_BUFFER_VMAP, /* TODO */ RING_BUFFER_STATIC, /* TODO */ }; -enum lttng_ust_lib_ring_buffer_oops_types { +enum lttng_ust_ring_buffer_oops_types { RING_BUFFER_NO_OOPS_CONSISTENCY, RING_BUFFER_OOPS_CONSISTENCY, }; -enum lttng_ust_lib_ring_buffer_ipi_types { +enum lttng_ust_ring_buffer_ipi_types { RING_BUFFER_IPI_BARRIER, RING_BUFFER_NO_IPI_BARRIER, }; -enum lttng_ust_lib_ring_buffer_wakeup_types { +enum lttng_ust_ring_buffer_wakeup_types { RING_BUFFER_WAKEUP_BY_TIMER, /* wake up performed by timer */ RING_BUFFER_WAKEUP_BY_WRITER, /* * writer wakes up reader, @@ -174,21 +174,21 @@ enum lttng_ust_lib_ring_buffer_wakeup_types { */ }; -struct lttng_ust_lib_ring_buffer_config { - enum lttng_ust_lib_ring_buffer_alloc_types alloc; - enum lttng_ust_lib_ring_buffer_sync_types sync; - enum lttng_ust_lib_ring_buffer_mode_types mode; - enum lttng_ust_lib_ring_buffer_output_types output; - enum lttng_ust_lib_ring_buffer_backend_types backend; - enum lttng_ust_lib_ring_buffer_oops_types oops; - enum lttng_ust_lib_ring_buffer_ipi_types ipi; - enum lttng_ust_lib_ring_buffer_wakeup_types wakeup; +struct lttng_ust_ring_buffer_config { + enum lttng_ust_ring_buffer_alloc_types alloc; + enum lttng_ust_ring_buffer_sync_types sync; + enum lttng_ust_ring_buffer_mode_types mode; + enum lttng_ust_ring_buffer_output_types output; + enum lttng_ust_ring_buffer_backend_types backend; + enum lttng_ust_ring_buffer_oops_types oops; + enum lttng_ust_ring_buffer_ipi_types ipi; + enum lttng_ust_ring_buffer_wakeup_types wakeup; /* * tsc_bits: timestamp bits saved at each record. * 0 and 64 disable the timestamp compression scheme. */ unsigned int tsc_bits; - struct lttng_ust_lib_ring_buffer_client_cb cb; + struct lttng_ust_ring_buffer_client_cb cb; /* * client_type is used by the consumer process (which is in a * different address space) to lookup the appropriate client @@ -196,7 +196,7 @@ struct lttng_ust_lib_ring_buffer_config { */ int client_type; int _unused1; - const struct lttng_ust_lib_ring_buffer_client_cb *cb_ptr; + const struct lttng_ust_ring_buffer_client_cb *cb_ptr; char padding[LTTNG_UST_RING_BUFFER_CONFIG_PADDING]; }; @@ -222,13 +222,13 @@ struct lttng_ust_lib_ring_buffer_config { * Used internally to check for valid configurations at channel creation. */ static inline -int lib_ring_buffer_check_config(const struct lttng_ust_lib_ring_buffer_config *config, +int lib_ring_buffer_check_config(const struct lttng_ust_ring_buffer_config *config, unsigned int switch_timer_interval, unsigned int read_timer_interval) lttng_ust_notrace; static inline -int lib_ring_buffer_check_config(const struct lttng_ust_lib_ring_buffer_config *config, +int lib_ring_buffer_check_config(const struct lttng_ust_ring_buffer_config *config, unsigned int switch_timer_interval, unsigned int read_timer_interval __attribute__((unused))) { diff --git a/src/common/ringbuffer/shm_types.h b/src/common/ringbuffer/shm_types.h index c1ad7b68..cff103b8 100644 --- a/src/common/ringbuffer/shm_types.h +++ b/src/common/ringbuffer/shm_types.h @@ -12,7 +12,7 @@ #include #include "shm_internal.h" -struct lttng_ust_lib_ring_buffer_channel; +struct lttng_ust_ring_buffer_channel; enum shm_object_type { SHM_OBJECT_SHM, @@ -38,7 +38,7 @@ struct shm_object_table { struct lttng_ust_shm_handle { struct shm_object_table *table; - DECLARE_SHMP(struct lttng_ust_lib_ring_buffer_channel, chan); + DECLARE_SHMP(struct lttng_ust_ring_buffer_channel, chan); }; #endif /* _LIBRINGBUFFER_SHM_TYPES_H */ diff --git a/src/common/ringbuffer/vatomic.h b/src/common/ringbuffer/vatomic.h index 199d2c77..26e15d24 100644 --- a/src/common/ringbuffer/vatomic.h +++ b/src/common/ringbuffer/vatomic.h @@ -24,14 +24,14 @@ union v_atomic { }; static inline -long v_read(const struct lttng_ust_lib_ring_buffer_config *config, union v_atomic *v_a) +long v_read(const struct lttng_ust_ring_buffer_config *config, union v_atomic *v_a) { assert(config->sync != RING_BUFFER_SYNC_PER_CPU); return uatomic_read(&v_a->a); } static inline -void v_set(const struct lttng_ust_lib_ring_buffer_config *config, union v_atomic *v_a, +void v_set(const struct lttng_ust_ring_buffer_config *config, union v_atomic *v_a, long v) { assert(config->sync != RING_BUFFER_SYNC_PER_CPU); @@ -39,14 +39,14 @@ void v_set(const struct lttng_ust_lib_ring_buffer_config *config, union v_atomic } static inline -void v_add(const struct lttng_ust_lib_ring_buffer_config *config, long v, union v_atomic *v_a) +void v_add(const struct lttng_ust_ring_buffer_config *config, long v, union v_atomic *v_a) { assert(config->sync != RING_BUFFER_SYNC_PER_CPU); uatomic_add(&v_a->a, v); } static inline -void v_inc(const struct lttng_ust_lib_ring_buffer_config *config, union v_atomic *v_a) +void v_inc(const struct lttng_ust_ring_buffer_config *config, union v_atomic *v_a) { assert(config->sync != RING_BUFFER_SYNC_PER_CPU); uatomic_inc(&v_a->a); @@ -56,13 +56,13 @@ void v_inc(const struct lttng_ust_lib_ring_buffer_config *config, union v_atomic * Non-atomic decrement. Only used by reader, apply to reader-owned subbuffer. */ static inline -void _v_dec(const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), union v_atomic *v_a) +void _v_dec(const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), union v_atomic *v_a) { --v_a->v; } static inline -long v_cmpxchg(const struct lttng_ust_lib_ring_buffer_config *config, union v_atomic *v_a, +long v_cmpxchg(const struct lttng_ust_ring_buffer_config *config, union v_atomic *v_a, long old, long _new) { assert(config->sync != RING_BUFFER_SYNC_PER_CPU); diff --git a/src/common/ust-context-provider.h b/src/common/ust-context-provider.h index 57dda8f3..c9362fb1 100644 --- a/src/common/ust-context-provider.h +++ b/src/common/ust-context-provider.h @@ -55,7 +55,7 @@ struct lttng_ust_context_provider { const char *name; size_t (*get_size)(void *priv, size_t offset); - void (*record)(void *priv, struct lttng_ust_lib_ring_buffer_ctx *ctx, + void (*record)(void *priv, struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan); void (*get_value)(void *priv, struct lttng_ust_ctx_value *value); void *priv; diff --git a/src/lib/lttng-ust-ctl/ustctl.c b/src/lib/lttng-ust-ctl/ustctl.c index 7c169fe1..4b0e3f76 100644 --- a/src/lib/lttng-ust-ctl/ustctl.c +++ b/src/lib/lttng-ust-ctl/ustctl.c @@ -57,7 +57,7 @@ struct ustctl_consumer_channel { * Stream representation within consumer. */ struct ustctl_consumer_stream { - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; struct ustctl_consumer_channel *chan; int shm_fd, wait_fd, wakeup_fd; int cpu; @@ -1320,9 +1320,9 @@ int ustctl_write_metadata_to_channel( const char *metadata_str, /* NOT null-terminated */ size_t len) /* metadata length */ { - struct lttng_ust_lib_ring_buffer_ctx ctx; + struct lttng_ust_ring_buffer_ctx ctx; struct lttng_ust_channel_buffer *lttng_chan_buf = channel->chan; - struct lttng_ust_lib_ring_buffer_channel *rb_chan = lttng_chan_buf->priv->rb_chan; + struct lttng_ust_ring_buffer_channel *rb_chan = lttng_chan_buf->priv->rb_chan; const char *str = metadata_str; int ret = 0, waitret; size_t reserve_len, pos; @@ -1331,7 +1331,7 @@ int ustctl_write_metadata_to_channel( reserve_len = min_t(size_t, lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf), len - pos); - lttng_ust_lib_ring_buffer_ctx_init(&ctx, rb_chan, reserve_len, sizeof(char), NULL); + lttng_ust_ring_buffer_ctx_init(&ctx, rb_chan, reserve_len, sizeof(char), NULL); /* * We don't care about metadata buffer's records lost * count, because we always retry here. Report error if @@ -1368,9 +1368,9 @@ ssize_t ustctl_write_one_packet_to_channel( const char *metadata_str, /* NOT null-terminated */ size_t len) /* metadata length */ { - struct lttng_ust_lib_ring_buffer_ctx ctx; + struct lttng_ust_ring_buffer_ctx ctx; struct lttng_ust_channel_buffer *lttng_chan_buf = channel->chan; - struct lttng_ust_lib_ring_buffer_channel *rb_chan = lttng_chan_buf->priv->rb_chan; + struct lttng_ust_ring_buffer_channel *rb_chan = lttng_chan_buf->priv->rb_chan; const char *str = metadata_str; ssize_t reserve_len; int ret; @@ -1378,7 +1378,7 @@ ssize_t ustctl_write_one_packet_to_channel( reserve_len = min_t(ssize_t, lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf), len); - lttng_ust_lib_ring_buffer_ctx_init(&ctx, rb_chan, reserve_len, sizeof(char), NULL); + lttng_ust_ring_buffer_ctx_init(&ctx, rb_chan, reserve_len, sizeof(char), NULL); ret = lttng_chan_buf->ops->event_reserve(&ctx); if (ret != 0) { DBG("LTTng: event reservation failed"); @@ -1395,7 +1395,7 @@ end: int ustctl_channel_close_wait_fd(struct ustctl_consumer_channel *consumer_chan) { - struct lttng_ust_lib_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer_channel *chan; int ret; chan = consumer_chan->chan->priv->rb_chan; @@ -1408,7 +1408,7 @@ int ustctl_channel_close_wait_fd(struct ustctl_consumer_channel *consumer_chan) int ustctl_channel_close_wakeup_fd(struct ustctl_consumer_channel *consumer_chan) { - struct lttng_ust_lib_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer_channel *chan; int ret; chan = consumer_chan->chan->priv->rb_chan; @@ -1421,7 +1421,7 @@ int ustctl_channel_close_wakeup_fd(struct ustctl_consumer_channel *consumer_chan int ustctl_stream_close_wait_fd(struct ustctl_consumer_stream *stream) { - struct lttng_ust_lib_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer_channel *chan; chan = stream->chan->chan->priv->rb_chan; return ring_buffer_stream_close_wait_fd(&chan->backend.config, @@ -1430,7 +1430,7 @@ int ustctl_stream_close_wait_fd(struct ustctl_consumer_stream *stream) int ustctl_stream_close_wakeup_fd(struct ustctl_consumer_stream *stream) { - struct lttng_ust_lib_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer_channel *chan; chan = stream->chan->chan->priv->rb_chan; return ring_buffer_stream_close_wakeup_fd(&chan->backend.config, @@ -1443,10 +1443,10 @@ struct ustctl_consumer_stream * { struct ustctl_consumer_stream *stream; struct lttng_ust_shm_handle *handle; - struct lttng_ust_lib_ring_buffer_channel *rb_chan; + struct lttng_ust_ring_buffer_channel *rb_chan; int shm_fd, wait_fd, wakeup_fd; uint64_t memory_map_size; - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; int ret; if (!channel) @@ -1483,7 +1483,7 @@ alloc_error: void ustctl_destroy_stream(struct ustctl_consumer_stream *stream) { - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; struct ustctl_consumer_channel *consumer_chan; assert(stream); @@ -1513,7 +1513,7 @@ int ustctl_channel_get_wakeup_fd(struct ustctl_consumer_channel *chan) int ustctl_stream_get_wait_fd(struct ustctl_consumer_stream *stream) { - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; struct ustctl_consumer_channel *consumer_chan; if (!stream) @@ -1525,7 +1525,7 @@ int ustctl_stream_get_wait_fd(struct ustctl_consumer_stream *stream) int ustctl_stream_get_wakeup_fd(struct ustctl_consumer_stream *stream) { - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; struct ustctl_consumer_channel *consumer_chan; if (!stream) @@ -1539,7 +1539,7 @@ int ustctl_stream_get_wakeup_fd(struct ustctl_consumer_stream *stream) void *ustctl_get_mmap_base(struct ustctl_consumer_stream *stream) { - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; struct ustctl_consumer_channel *consumer_chan; if (!stream) @@ -1555,7 +1555,7 @@ int ustctl_get_mmap_len(struct ustctl_consumer_stream *stream, { struct ustctl_consumer_channel *consumer_chan; unsigned long mmap_buf_len; - struct lttng_ust_lib_ring_buffer_channel *rb_chan; + struct lttng_ust_ring_buffer_channel *rb_chan; if (!stream) return -EINVAL; @@ -1577,7 +1577,7 @@ int ustctl_get_max_subbuf_size(struct ustctl_consumer_stream *stream, unsigned long *len) { struct ustctl_consumer_channel *consumer_chan; - struct lttng_ust_lib_ring_buffer_channel *rb_chan; + struct lttng_ust_ring_buffer_channel *rb_chan; if (!stream) return -EINVAL; @@ -1596,12 +1596,12 @@ int ustctl_get_max_subbuf_size(struct ustctl_consumer_stream *stream, int ustctl_get_mmap_read_offset(struct ustctl_consumer_stream *stream, unsigned long *off) { - struct lttng_ust_lib_ring_buffer_channel *rb_chan; + struct lttng_ust_ring_buffer_channel *rb_chan; unsigned long sb_bindex; - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; struct ustctl_consumer_channel *consumer_chan; - struct lttng_ust_lib_ring_buffer_backend_pages_shmp *barray_idx; - struct lttng_ust_lib_ring_buffer_backend_pages *pages; + struct lttng_ust_ring_buffer_backend_pages_shmp *barray_idx; + struct lttng_ust_ring_buffer_backend_pages *pages; if (!stream) return -EINVAL; @@ -1628,8 +1628,8 @@ int ustctl_get_subbuf_size(struct ustctl_consumer_stream *stream, unsigned long *len) { struct ustctl_consumer_channel *consumer_chan; - struct lttng_ust_lib_ring_buffer_channel *rb_chan; - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer_channel *rb_chan; + struct lttng_ust_ring_buffer *buf; if (!stream) return -EINVAL; @@ -1647,8 +1647,8 @@ int ustctl_get_padded_subbuf_size(struct ustctl_consumer_stream *stream, unsigned long *len) { struct ustctl_consumer_channel *consumer_chan; - struct lttng_ust_lib_ring_buffer_channel *rb_chan; - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer_channel *rb_chan; + struct lttng_ust_ring_buffer *buf; if (!stream) return -EINVAL; @@ -1664,7 +1664,7 @@ int ustctl_get_padded_subbuf_size(struct ustctl_consumer_stream *stream, /* Get exclusive read access to the next sub-buffer that can be read. */ int ustctl_get_next_subbuf(struct ustctl_consumer_stream *stream) { - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; struct ustctl_consumer_channel *consumer_chan; if (!stream) @@ -1679,7 +1679,7 @@ int ustctl_get_next_subbuf(struct ustctl_consumer_stream *stream) /* Release exclusive sub-buffer access, move consumer forward. */ int ustctl_put_next_subbuf(struct ustctl_consumer_stream *stream) { - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; struct ustctl_consumer_channel *consumer_chan; if (!stream) @@ -1695,7 +1695,7 @@ int ustctl_put_next_subbuf(struct ustctl_consumer_stream *stream) /* Get a snapshot of the current ring buffer producer and consumer positions */ int ustctl_snapshot(struct ustctl_consumer_stream *stream) { - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; struct ustctl_consumer_channel *consumer_chan; if (!stream) @@ -1713,7 +1713,7 @@ int ustctl_snapshot(struct ustctl_consumer_stream *stream) */ int ustctl_snapshot_sample_positions(struct ustctl_consumer_stream *stream) { - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; struct ustctl_consumer_channel *consumer_chan; if (!stream) @@ -1729,7 +1729,7 @@ int ustctl_snapshot_sample_positions(struct ustctl_consumer_stream *stream) int ustctl_snapshot_get_consumed(struct ustctl_consumer_stream *stream, unsigned long *pos) { - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; if (!stream) return -EINVAL; @@ -1742,7 +1742,7 @@ int ustctl_snapshot_get_consumed(struct ustctl_consumer_stream *stream, int ustctl_snapshot_get_produced(struct ustctl_consumer_stream *stream, unsigned long *pos) { - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; if (!stream) return -EINVAL; @@ -1755,7 +1755,7 @@ int ustctl_snapshot_get_produced(struct ustctl_consumer_stream *stream, int ustctl_get_subbuf(struct ustctl_consumer_stream *stream, unsigned long *pos) { - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; struct ustctl_consumer_channel *consumer_chan; if (!stream) @@ -1769,7 +1769,7 @@ int ustctl_get_subbuf(struct ustctl_consumer_stream *stream, /* Release exclusive sub-buffer access */ int ustctl_put_subbuf(struct ustctl_consumer_stream *stream) { - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; struct ustctl_consumer_channel *consumer_chan; if (!stream) @@ -1783,7 +1783,7 @@ int ustctl_put_subbuf(struct ustctl_consumer_stream *stream) void ustctl_flush_buffer(struct ustctl_consumer_stream *stream, int producer_active) { - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; struct ustctl_consumer_channel *consumer_chan; assert(stream); @@ -1796,7 +1796,7 @@ void ustctl_flush_buffer(struct ustctl_consumer_stream *stream, void ustctl_clear_buffer(struct ustctl_consumer_stream *stream) { - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; struct ustctl_consumer_channel *consumer_chan; assert(stream); @@ -1809,10 +1809,10 @@ void ustctl_clear_buffer(struct ustctl_consumer_stream *stream) static struct lttng_ust_client_lib_ring_buffer_client_cb *get_client_cb( - struct lttng_ust_lib_ring_buffer *buf __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_channel *chan) + struct lttng_ust_ring_buffer *buf __attribute__((unused)), + struct lttng_ust_ring_buffer_channel *chan) { - const struct lttng_ust_lib_ring_buffer_config *config; + const struct lttng_ust_ring_buffer_config *config; struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb; config = &chan->backend.config; @@ -1828,8 +1828,8 @@ int ustctl_get_timestamp_begin(struct ustctl_consumer_stream *stream, uint64_t *timestamp_begin) { struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb; - struct lttng_ust_lib_ring_buffer_channel *chan; - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer *buf; if (!stream || !timestamp_begin) return -EINVAL; @@ -1845,8 +1845,8 @@ int ustctl_get_timestamp_end(struct ustctl_consumer_stream *stream, uint64_t *timestamp_end) { struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb; - struct lttng_ust_lib_ring_buffer_channel *chan; - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer *buf; if (!stream || !timestamp_end) return -EINVAL; @@ -1862,8 +1862,8 @@ int ustctl_get_events_discarded(struct ustctl_consumer_stream *stream, uint64_t *events_discarded) { struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb; - struct lttng_ust_lib_ring_buffer_channel *chan; - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer *buf; if (!stream || !events_discarded) return -EINVAL; @@ -1879,8 +1879,8 @@ int ustctl_get_content_size(struct ustctl_consumer_stream *stream, uint64_t *content_size) { struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb; - struct lttng_ust_lib_ring_buffer_channel *chan; - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer *buf; if (!stream || !content_size) return -EINVAL; @@ -1896,8 +1896,8 @@ int ustctl_get_packet_size(struct ustctl_consumer_stream *stream, uint64_t *packet_size) { struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb; - struct lttng_ust_lib_ring_buffer_channel *chan; - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer *buf; if (!stream || !packet_size) return -EINVAL; @@ -1913,8 +1913,8 @@ int ustctl_get_stream_id(struct ustctl_consumer_stream *stream, uint64_t *stream_id) { struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb; - struct lttng_ust_lib_ring_buffer_channel *chan; - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer *buf; if (!stream || !stream_id) return -EINVAL; @@ -1930,8 +1930,8 @@ int ustctl_get_current_timestamp(struct ustctl_consumer_stream *stream, uint64_t *ts) { struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb; - struct lttng_ust_lib_ring_buffer_channel *chan; - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer *buf; if (!stream || !ts) return -EINVAL; @@ -1947,8 +1947,8 @@ int ustctl_get_sequence_number(struct ustctl_consumer_stream *stream, uint64_t *seq) { struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb; - struct lttng_ust_lib_ring_buffer_channel *chan; - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer *buf; if (!stream || !seq) return -EINVAL; @@ -1964,8 +1964,8 @@ int ustctl_get_instance_id(struct ustctl_consumer_stream *stream, uint64_t *id) { struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb; - struct lttng_ust_lib_ring_buffer_channel *chan; - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer *buf; if (!stream || !id) return -EINVAL; diff --git a/src/lib/lttng-ust-java-agent/jni/common/lttng_ust_context.c b/src/lib/lttng-ust-java-agent/jni/common/lttng_ust_context.c index 8570b211..1562ab0a 100644 --- a/src/lib/lttng-ust-java-agent/jni/common/lttng_ust_context.c +++ b/src/lib/lttng-ust-java-agent/jni/common/lttng_ust_context.c @@ -87,7 +87,7 @@ static size_t get_size_cb(void *priv, size_t offset) const char *ctx_name = jni_provider->name; enum lttng_ust_jni_type jni_type; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(char)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(char)); size += sizeof(char); /* tag */ jctx = lookup_ctx_by_name(ctx_name); if (!jctx) { @@ -99,28 +99,28 @@ static size_t get_size_cb(void *priv, size_t offset) case JNI_TYPE_NULL: break; case JNI_TYPE_INTEGER: - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(int32_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(int32_t)); size += sizeof(int32_t); /* variant */ break; case JNI_TYPE_LONG: - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(int64_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(int64_t)); size += sizeof(int64_t); /* variant */ break; case JNI_TYPE_DOUBLE: - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(double)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(double)); size += sizeof(double); /* variant */ break; case JNI_TYPE_FLOAT: - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(float)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(float)); size += sizeof(float); /* variant */ break; case JNI_TYPE_SHORT: - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(int16_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(int16_t)); size += sizeof(int16_t); /* variant */ break; case JNI_TYPE_BYTE: /* Fall-through. */ case JNI_TYPE_BOOLEAN: - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(char)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(char)); size += sizeof(char); /* variant */ break; case JNI_TYPE_STRING: @@ -142,7 +142,7 @@ static size_t get_size_cb(void *priv, size_t offset) } static void record_cb(void *priv, - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *lttng_chan_buf) { struct lttng_ust_jni_ctx_entry *jctx; diff --git a/src/lib/lttng-ust/context-provider-internal.h b/src/lib/lttng-ust/context-provider-internal.h index 27d79ce1..f9ee9b29 100644 --- a/src/lib/lttng-ust/context-provider-internal.h +++ b/src/lib/lttng-ust/context-provider-internal.h @@ -13,7 +13,7 @@ void lttng_ust_context_set_event_notifier_group_provider(const char *name, size_t (*get_size)(void *priv, size_t offset), void (*record)(void *priv, - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan), void (*get_value)(void *priv, struct lttng_ust_ctx_value *value), diff --git a/src/lib/lttng-ust/events.h b/src/lib/lttng-ust/events.h index 9d5fbd11..cd64a2d8 100644 --- a/src/lib/lttng-ust/events.h +++ b/src/lib/lttng-ust/events.h @@ -322,7 +322,7 @@ int lttng_ust_add_app_context_to_ctx_rcu(const char *name, struct lttng_ust_ctx int lttng_ust_context_set_provider_rcu(struct lttng_ust_ctx **_ctx, const char *name, size_t (*get_size)(void *priv, size_t offset), - void (*record)(void *priv, struct lttng_ust_lib_ring_buffer_ctx *ctx, + void (*record)(void *priv, struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan), void (*get_value)(void *priv, struct lttng_ust_ctx_value *value), void *priv) @@ -330,7 +330,7 @@ int lttng_ust_context_set_provider_rcu(struct lttng_ust_ctx **_ctx, void lttng_ust_context_set_session_provider(const char *name, size_t (*get_size)(void *priv, size_t offset), - void (*record)(void *priv, struct lttng_ust_lib_ring_buffer_ctx *ctx, + void (*record)(void *priv, struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan), void (*get_value)(void *priv, struct lttng_ust_ctx_value *value), void *priv) diff --git a/src/lib/lttng-ust/lttng-context-cgroup-ns.c b/src/lib/lttng-ust/lttng-context-cgroup-ns.c index 0a688db1..1d5abc2d 100644 --- a/src/lib/lttng-ust/lttng-context-cgroup-ns.c +++ b/src/lib/lttng-ust/lttng-context-cgroup-ns.c @@ -96,14 +96,14 @@ size_t cgroup_ns_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(ino_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(ino_t)); size += sizeof(ino_t); return size; } static void cgroup_ns_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { ino_t cgroup_ns; diff --git a/src/lib/lttng-ust/lttng-context-cpu-id.c b/src/lib/lttng-ust/lttng-context-cpu-id.c index 9a70ca52..9ade4dfb 100644 --- a/src/lib/lttng-ust/lttng-context-cpu-id.c +++ b/src/lib/lttng-ust/lttng-context-cpu-id.c @@ -30,14 +30,14 @@ size_t cpu_id_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(int)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(int)); size += sizeof(int); return size; } static void cpu_id_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { int cpu; diff --git a/src/lib/lttng-ust/lttng-context-ip.c b/src/lib/lttng-ust/lttng-context-ip.c index e9cc969f..9cf72eb2 100644 --- a/src/lib/lttng-ust/lttng-context-ip.c +++ b/src/lib/lttng-ust/lttng-context-ip.c @@ -23,14 +23,14 @@ size_t ip_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(void *)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(void *)); size += sizeof(void *); return size; } static void ip_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { void *ip; diff --git a/src/lib/lttng-ust/lttng-context-ipc-ns.c b/src/lib/lttng-ust/lttng-context-ipc-ns.c index a122d423..f37252cd 100644 --- a/src/lib/lttng-ust/lttng-context-ipc-ns.c +++ b/src/lib/lttng-ust/lttng-context-ipc-ns.c @@ -95,14 +95,14 @@ size_t ipc_ns_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(ino_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(ino_t)); size += sizeof(ino_t); return size; } static void ipc_ns_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { ino_t ipc_ns; diff --git a/src/lib/lttng-ust/lttng-context-mnt-ns.c b/src/lib/lttng-ust/lttng-context-mnt-ns.c index 3642b023..4cd552e7 100644 --- a/src/lib/lttng-ust/lttng-context-mnt-ns.c +++ b/src/lib/lttng-ust/lttng-context-mnt-ns.c @@ -78,14 +78,14 @@ size_t mnt_ns_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(ino_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(ino_t)); size += sizeof(ino_t); return size; } static void mnt_ns_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { ino_t mnt_ns; diff --git a/src/lib/lttng-ust/lttng-context-net-ns.c b/src/lib/lttng-ust/lttng-context-net-ns.c index 242b2e80..af80eab5 100644 --- a/src/lib/lttng-ust/lttng-context-net-ns.c +++ b/src/lib/lttng-ust/lttng-context-net-ns.c @@ -95,14 +95,14 @@ size_t net_ns_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(ino_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(ino_t)); size += sizeof(ino_t); return size; } static void net_ns_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { ino_t net_ns; diff --git a/src/lib/lttng-ust/lttng-context-perf-counters.c b/src/lib/lttng-ust/lttng-context-perf-counters.c index 2f145220..e1ce4890 100644 --- a/src/lib/lttng-ust/lttng-context-perf-counters.c +++ b/src/lib/lttng-ust/lttng-context-perf-counters.c @@ -165,7 +165,7 @@ size_t perf_counter_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uint64_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uint64_t)); size += sizeof(uint64_t); return size; } @@ -442,7 +442,7 @@ uint64_t wrapper_perf_counter_read(void *priv) static void perf_counter_record(void *priv, - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { uint64_t value; diff --git a/src/lib/lttng-ust/lttng-context-pid-ns.c b/src/lib/lttng-ust/lttng-context-pid-ns.c index 05b309b8..a67b0e3b 100644 --- a/src/lib/lttng-ust/lttng-context-pid-ns.c +++ b/src/lib/lttng-ust/lttng-context-pid-ns.c @@ -81,14 +81,14 @@ size_t pid_ns_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(ino_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(ino_t)); size += sizeof(ino_t); return size; } static void pid_ns_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { ino_t pid_ns; diff --git a/src/lib/lttng-ust/lttng-context-procname.c b/src/lib/lttng-ust/lttng-context-procname.c index bbc4687a..09484d85 100644 --- a/src/lib/lttng-ust/lttng-context-procname.c +++ b/src/lib/lttng-ust/lttng-context-procname.c @@ -74,7 +74,7 @@ size_t procname_get_size(void *priv __attribute__((unused)), static void procname_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { const char *procname; diff --git a/src/lib/lttng-ust/lttng-context-pthread-id.c b/src/lib/lttng-ust/lttng-context-pthread-id.c index da02d1a8..f6f8d768 100644 --- a/src/lib/lttng-ust/lttng-context-pthread-id.c +++ b/src/lib/lttng-ust/lttng-context-pthread-id.c @@ -22,14 +22,14 @@ size_t pthread_id_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(unsigned long)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(unsigned long)); size += sizeof(unsigned long); return size; } static void pthread_id_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { unsigned long pthread_id; diff --git a/src/lib/lttng-ust/lttng-context-time-ns.c b/src/lib/lttng-ust/lttng-context-time-ns.c index e8a9e01a..ea3acc21 100644 --- a/src/lib/lttng-ust/lttng-context-time-ns.c +++ b/src/lib/lttng-ust/lttng-context-time-ns.c @@ -94,14 +94,14 @@ size_t time_ns_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(ino_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(ino_t)); size += sizeof(ino_t); return size; } static void time_ns_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { ino_t time_ns; diff --git a/src/lib/lttng-ust/lttng-context-user-ns.c b/src/lib/lttng-ust/lttng-context-user-ns.c index ead9f14c..70c0b3e3 100644 --- a/src/lib/lttng-ust/lttng-context-user-ns.c +++ b/src/lib/lttng-ust/lttng-context-user-ns.c @@ -78,14 +78,14 @@ size_t user_ns_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(ino_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(ino_t)); size += sizeof(ino_t); return size; } static void user_ns_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { ino_t user_ns; diff --git a/src/lib/lttng-ust/lttng-context-uts-ns.c b/src/lib/lttng-ust/lttng-context-uts-ns.c index 5e37ae8f..3266b553 100644 --- a/src/lib/lttng-ust/lttng-context-uts-ns.c +++ b/src/lib/lttng-ust/lttng-context-uts-ns.c @@ -96,14 +96,14 @@ size_t uts_ns_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(ino_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(ino_t)); size += sizeof(ino_t); return size; } static void uts_ns_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { ino_t uts_ns; diff --git a/src/lib/lttng-ust/lttng-context-vegid.c b/src/lib/lttng-ust/lttng-context-vegid.c index 0f481783..b8b23ab7 100644 --- a/src/lib/lttng-ust/lttng-context-vegid.c +++ b/src/lib/lttng-ust/lttng-context-vegid.c @@ -67,14 +67,14 @@ size_t vegid_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(gid_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(gid_t)); size += sizeof(gid_t); return size; } static void vegid_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { gid_t vegid; diff --git a/src/lib/lttng-ust/lttng-context-veuid.c b/src/lib/lttng-ust/lttng-context-veuid.c index cb532be1..a351284f 100644 --- a/src/lib/lttng-ust/lttng-context-veuid.c +++ b/src/lib/lttng-ust/lttng-context-veuid.c @@ -67,14 +67,14 @@ size_t veuid_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uid_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uid_t)); size += sizeof(uid_t); return size; } static void veuid_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { uid_t veuid; diff --git a/src/lib/lttng-ust/lttng-context-vgid.c b/src/lib/lttng-ust/lttng-context-vgid.c index 9bf02abe..93f65e80 100644 --- a/src/lib/lttng-ust/lttng-context-vgid.c +++ b/src/lib/lttng-ust/lttng-context-vgid.c @@ -67,14 +67,14 @@ size_t vgid_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(gid_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(gid_t)); size += sizeof(gid_t); return size; } static void vgid_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { gid_t vgid; diff --git a/src/lib/lttng-ust/lttng-context-vpid.c b/src/lib/lttng-ust/lttng-context-vpid.c index 8bf4841e..37d607f8 100644 --- a/src/lib/lttng-ust/lttng-context-vpid.c +++ b/src/lib/lttng-ust/lttng-context-vpid.c @@ -51,14 +51,14 @@ size_t vpid_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(pid_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(pid_t)); size += sizeof(pid_t); return size; } static void vpid_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { pid_t vpid = wrapper_getvpid(); diff --git a/src/lib/lttng-ust/lttng-context-vsgid.c b/src/lib/lttng-ust/lttng-context-vsgid.c index 8034a024..1363265c 100644 --- a/src/lib/lttng-ust/lttng-context-vsgid.c +++ b/src/lib/lttng-ust/lttng-context-vsgid.c @@ -71,14 +71,14 @@ size_t vsgid_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(gid_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(gid_t)); size += sizeof(gid_t); return size; } static void vsgid_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { gid_t vsgid; diff --git a/src/lib/lttng-ust/lttng-context-vsuid.c b/src/lib/lttng-ust/lttng-context-vsuid.c index 7d400969..c679a26d 100644 --- a/src/lib/lttng-ust/lttng-context-vsuid.c +++ b/src/lib/lttng-ust/lttng-context-vsuid.c @@ -71,14 +71,14 @@ size_t vsuid_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uid_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uid_t)); size += sizeof(uid_t); return size; } static void vsuid_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { uid_t vsuid; diff --git a/src/lib/lttng-ust/lttng-context-vtid.c b/src/lib/lttng-ust/lttng-context-vtid.c index ce8dcd2c..ff91002d 100644 --- a/src/lib/lttng-ust/lttng-context-vtid.c +++ b/src/lib/lttng-ust/lttng-context-vtid.c @@ -42,7 +42,7 @@ size_t vtid_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(pid_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(pid_t)); size += sizeof(pid_t); return size; } @@ -62,7 +62,7 @@ pid_t wrapper_getvtid(void) static void vtid_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { pid_t vtid = wrapper_getvtid(); diff --git a/src/lib/lttng-ust/lttng-context-vuid.c b/src/lib/lttng-ust/lttng-context-vuid.c index 7153c130..8f40aae4 100644 --- a/src/lib/lttng-ust/lttng-context-vuid.c +++ b/src/lib/lttng-ust/lttng-context-vuid.c @@ -67,14 +67,14 @@ size_t vuid_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uid_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uid_t)); size += sizeof(uid_t); return size; } static void vuid_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { uid_t vuid; diff --git a/src/lib/lttng-ust/lttng-context.c b/src/lib/lttng-ust/lttng-context.c index 26d458a8..046f2a85 100644 --- a/src/lib/lttng-ust/lttng-context.c +++ b/src/lib/lttng-ust/lttng-context.c @@ -255,7 +255,7 @@ void lttng_destroy_context(struct lttng_ust_ctx *ctx) int lttng_ust_context_set_provider_rcu(struct lttng_ust_ctx **_ctx, const char *name, size_t (*get_size)(void *priv, size_t offset), - void (*record)(void *priv, struct lttng_ust_lib_ring_buffer_ctx *ctx, + void (*record)(void *priv, struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan), void (*get_value)(void *priv, struct lttng_ust_ctx_value *value), void *priv) diff --git a/src/lib/lttng-ust/lttng-events.c b/src/lib/lttng-ust/lttng-events.c index 8165bfd1..e8f9fd9f 100644 --- a/src/lib/lttng-ust/lttng-events.c +++ b/src/lib/lttng-ust/lttng-events.c @@ -248,7 +248,7 @@ struct lttng_event_notifier_group *lttng_event_notifier_group_create(void) static void _lttng_channel_unmap(struct lttng_ust_channel_buffer *lttng_chan) { - struct lttng_ust_lib_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer_channel *chan; struct lttng_ust_shm_handle *handle; cds_list_del(<tng_chan->priv->node); @@ -2000,7 +2000,7 @@ void lttng_session_lazy_sync_event_enablers(struct lttng_ust_session *session) */ void lttng_ust_context_set_session_provider(const char *name, size_t (*get_size)(void *priv, size_t offset), - void (*record)(void *priv, struct lttng_ust_lib_ring_buffer_ctx *ctx, + void (*record)(void *priv, struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan), void (*get_value)(void *priv, struct lttng_ust_ctx_value *value), void *priv) @@ -2040,7 +2040,7 @@ void lttng_ust_context_set_session_provider(const char *name, */ void lttng_ust_context_set_event_notifier_group_provider(const char *name, size_t (*get_size)(void *priv, size_t offset), - void (*record)(void *priv, struct lttng_ust_lib_ring_buffer_ctx *ctx, + void (*record)(void *priv, struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan), void (*get_value)(void *priv, struct lttng_ust_ctx_value *value), void *priv) diff --git a/src/lib/lttng-ust/lttng-rb-clients.h b/src/lib/lttng-ust/lttng-rb-clients.h index afdbd057..e08c32cf 100644 --- a/src/lib/lttng-ust/lttng-rb-clients.h +++ b/src/lib/lttng-ust/lttng-rb-clients.h @@ -11,33 +11,33 @@ #include "common/ringbuffer/ringbuffer-config.h" struct lttng_ust_client_lib_ring_buffer_client_cb { - struct lttng_ust_lib_ring_buffer_client_cb parent; + struct lttng_ust_ring_buffer_client_cb parent; - int (*timestamp_begin) (struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, + int (*timestamp_begin) (struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, uint64_t *timestamp_begin); - int (*timestamp_end) (struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, + int (*timestamp_end) (struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, uint64_t *timestamp_end); - int (*events_discarded) (struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, + int (*events_discarded) (struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, uint64_t *events_discarded); - int (*content_size) (struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, + int (*content_size) (struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, uint64_t *content_size); - int (*packet_size) (struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, + int (*packet_size) (struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, uint64_t *packet_size); - int (*stream_id) (struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, + int (*stream_id) (struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, uint64_t *stream_id); - int (*current_timestamp) (struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, + int (*current_timestamp) (struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, uint64_t *ts); - int (*sequence_number) (struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, uint64_t *seq); - int (*instance_id) (struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, uint64_t *id); + int (*sequence_number) (struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, uint64_t *seq); + int (*instance_id) (struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, uint64_t *id); }; /* diff --git a/src/lib/lttng-ust/lttng-ring-buffer-client-template.h b/src/lib/lttng-ust/lttng-ring-buffer-client-template.h index d4d2fdf0..14aa2a48 100644 --- a/src/lib/lttng-ust/lttng-ring-buffer-client-template.h +++ b/src/lib/lttng-ust/lttng-ring-buffer-client-template.h @@ -67,7 +67,7 @@ struct lttng_client_ctx { /* * Indexed by lib_ring_buffer_nesting_count(). */ -typedef struct lttng_ust_lib_ring_buffer_ctx_private private_ctx_stack_t[LIB_RING_BUFFER_MAX_NESTING]; +typedef struct lttng_ust_ring_buffer_ctx_private private_ctx_stack_t[LIB_RING_BUFFER_MAX_NESTING]; static DEFINE_URCU_TLS(private_ctx_stack_t, private_ctx_stack); /* @@ -79,7 +79,7 @@ void RING_BUFFER_MODE_TEMPLATE_TLS_FIXUP(void) } static inline uint64_t lib_ring_buffer_clock_read( - struct lttng_ust_lib_ring_buffer_channel *chan __attribute__((unused))) + struct lttng_ust_ring_buffer_channel *chan __attribute__((unused))) { return trace_clock_read64(); } @@ -92,7 +92,7 @@ size_t ctx_get_aligned_size(size_t offset, struct lttng_ust_ctx *ctx, if (caa_likely(!ctx)) return 0; - offset += lttng_ust_lib_ring_buffer_align(offset, ctx->largest_align); + offset += lttng_ust_ring_buffer_align(offset, ctx->largest_align); offset += ctx_len; return offset - orig_offset; } @@ -113,7 +113,7 @@ void ctx_get_struct_size(struct lttng_ust_ctx *ctx, size_t *ctx_len) } static inline -void ctx_record(struct lttng_ust_lib_ring_buffer_ctx *bufctx, +void ctx_record(struct lttng_ust_ring_buffer_ctx *bufctx, struct lttng_ust_channel_buffer *chan, struct lttng_ust_ctx *ctx) { @@ -121,7 +121,7 @@ void ctx_record(struct lttng_ust_lib_ring_buffer_ctx *bufctx, if (caa_likely(!ctx)) return; - lttng_ust_lib_ring_buffer_align_ctx(bufctx, ctx->largest_align); + lttng_ust_ring_buffer_align_ctx(bufctx, ctx->largest_align); for (i = 0; i < ctx->nr_fields; i++) ctx->fields[i].record(ctx->fields[i].priv, bufctx, chan); } @@ -141,11 +141,11 @@ void ctx_record(struct lttng_ust_lib_ring_buffer_ctx *bufctx, */ static __inline__ size_t record_header_size( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_channel *chan, + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), + struct lttng_ust_ring_buffer_channel *chan, size_t offset, size_t *pre_header_padding, - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_client_ctx *client_ctx) { struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(chan); @@ -154,7 +154,7 @@ size_t record_header_size( switch (lttng_chan->priv->header_type) { case 1: /* compact */ - padding = lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uint32_t)); + padding = lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uint32_t)); offset += padding; if (!(ctx->priv->rflags & (RING_BUFFER_RFLAG_FULL_TSC | LTTNG_RFLAG_EXTENDED))) { offset += sizeof(uint32_t); /* id and timestamp */ @@ -162,24 +162,24 @@ size_t record_header_size( /* Minimum space taken by LTTNG_COMPACT_EVENT_BITS id */ offset += (LTTNG_COMPACT_EVENT_BITS + CHAR_BIT - 1) / CHAR_BIT; /* Align extended struct on largest member */ - offset += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uint64_t)); + offset += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uint64_t)); offset += sizeof(uint32_t); /* id */ - offset += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uint64_t)); + offset += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uint64_t)); offset += sizeof(uint64_t); /* timestamp */ } break; case 2: /* large */ - padding = lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uint16_t)); + padding = lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uint16_t)); offset += padding; offset += sizeof(uint16_t); if (!(ctx->priv->rflags & (RING_BUFFER_RFLAG_FULL_TSC | LTTNG_RFLAG_EXTENDED))) { - offset += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uint32_t)); + offset += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uint32_t)); offset += sizeof(uint32_t); /* timestamp */ } else { /* Align extended struct on largest member */ - offset += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uint64_t)); + offset += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uint64_t)); offset += sizeof(uint32_t); /* id */ - offset += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uint64_t)); + offset += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uint64_t)); offset += sizeof(uint64_t); /* timestamp */ } break; @@ -199,8 +199,8 @@ size_t record_header_size( #include "lttng-rb-clients.h" static -void lttng_write_event_header_slow(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_ctx *ctx, +void lttng_write_event_header_slow(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_client_ctx *client_ctx, uint32_t event_id); @@ -214,8 +214,8 @@ void lttng_write_event_header_slow(const struct lttng_ust_lib_ring_buffer_config * @event_id: event ID */ static __inline__ -void lttng_write_event_header(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_ctx *ctx, +void lttng_write_event_header(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_client_ctx *client_ctx, uint32_t event_id) { @@ -246,7 +246,7 @@ void lttng_write_event_header(const struct lttng_ust_lib_ring_buffer_config *con uint16_t id = event_id; lib_ring_buffer_write(config, ctx, &id, sizeof(id)); - lttng_ust_lib_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(uint32_t)); + lttng_ust_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(uint32_t)); lib_ring_buffer_write(config, ctx, ×tamp, sizeof(timestamp)); break; } @@ -256,7 +256,7 @@ void lttng_write_event_header(const struct lttng_ust_lib_ring_buffer_config *con ctx_record(ctx, lttng_chan, client_ctx->chan_ctx); ctx_record(ctx, lttng_chan, client_ctx->event_ctx); - lttng_ust_lib_ring_buffer_align_ctx(ctx, ctx->largest_align); + lttng_ust_ring_buffer_align_ctx(ctx, ctx->largest_align); return; @@ -265,12 +265,12 @@ slow_path: } static -void lttng_write_event_header_slow(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_ctx *ctx, +void lttng_write_event_header_slow(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_client_ctx *client_ctx, uint32_t event_id) { - struct lttng_ust_lib_ring_buffer_ctx_private *ctx_private = ctx->priv; + struct lttng_ust_ring_buffer_ctx_private *ctx_private = ctx->priv; struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(ctx->priv->chan); switch (lttng_chan->priv->header_type) { @@ -297,9 +297,9 @@ void lttng_write_event_header_slow(const struct lttng_ust_lib_ring_buffer_config 31); lib_ring_buffer_write(config, ctx, &id, sizeof(id)); /* Align extended struct on largest member */ - lttng_ust_lib_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(uint64_t)); + lttng_ust_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(uint64_t)); lib_ring_buffer_write(config, ctx, &event_id, sizeof(event_id)); - lttng_ust_lib_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(uint64_t)); + lttng_ust_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(uint64_t)); lib_ring_buffer_write(config, ctx, ×tamp, sizeof(timestamp)); } break; @@ -310,7 +310,7 @@ void lttng_write_event_header_slow(const struct lttng_ust_lib_ring_buffer_config uint16_t id = event_id; lib_ring_buffer_write(config, ctx, &id, sizeof(id)); - lttng_ust_lib_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(uint32_t)); + lttng_ust_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(uint32_t)); lib_ring_buffer_write(config, ctx, ×tamp, sizeof(timestamp)); } else { uint16_t id = 65535; @@ -318,9 +318,9 @@ void lttng_write_event_header_slow(const struct lttng_ust_lib_ring_buffer_config lib_ring_buffer_write(config, ctx, &id, sizeof(id)); /* Align extended struct on largest member */ - lttng_ust_lib_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(uint64_t)); + lttng_ust_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(uint64_t)); lib_ring_buffer_write(config, ctx, &event_id, sizeof(event_id)); - lttng_ust_lib_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(uint64_t)); + lttng_ust_ring_buffer_align_ctx(ctx, lttng_ust_rb_alignof(uint64_t)); lib_ring_buffer_write(config, ctx, ×tamp, sizeof(timestamp)); } break; @@ -330,22 +330,22 @@ void lttng_write_event_header_slow(const struct lttng_ust_lib_ring_buffer_config } ctx_record(ctx, lttng_chan, client_ctx->chan_ctx); ctx_record(ctx, lttng_chan, client_ctx->event_ctx); - lttng_ust_lib_ring_buffer_align_ctx(ctx, ctx->largest_align); + lttng_ust_ring_buffer_align_ctx(ctx, ctx->largest_align); } -static const struct lttng_ust_lib_ring_buffer_config client_config; +static const struct lttng_ust_ring_buffer_config client_config; -static uint64_t client_ring_buffer_clock_read(struct lttng_ust_lib_ring_buffer_channel *chan) +static uint64_t client_ring_buffer_clock_read(struct lttng_ust_ring_buffer_channel *chan) { return lib_ring_buffer_clock_read(chan); } static -size_t client_record_header_size(const struct lttng_ust_lib_ring_buffer_config *config, - struct lttng_ust_lib_ring_buffer_channel *chan, +size_t client_record_header_size(const struct lttng_ust_ring_buffer_config *config, + struct lttng_ust_ring_buffer_channel *chan, size_t offset, size_t *pre_header_padding, - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, void *client_ctx) { return record_header_size(config, chan, offset, @@ -364,11 +364,11 @@ static size_t client_packet_header_size(void) return offsetof(struct packet_header, ctx.header_end); } -static void client_buffer_begin(struct lttng_ust_lib_ring_buffer *buf, uint64_t tsc, +static void client_buffer_begin(struct lttng_ust_ring_buffer *buf, uint64_t tsc, unsigned int subbuf_idx, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_channel *chan = shmp(handle, buf->backend.chan); + struct lttng_ust_ring_buffer_channel *chan = shmp(handle, buf->backend.chan); struct packet_header *header = (struct packet_header *) lib_ring_buffer_offset_address(&buf->backend, @@ -397,11 +397,11 @@ static void client_buffer_begin(struct lttng_ust_lib_ring_buffer *buf, uint64_t * offset is assumed to never be 0 here : never deliver a completely empty * subbuffer. data_size is between 1 and subbuf_size. */ -static void client_buffer_end(struct lttng_ust_lib_ring_buffer *buf, uint64_t tsc, +static void client_buffer_end(struct lttng_ust_ring_buffer *buf, uint64_t tsc, unsigned int subbuf_idx, unsigned long data_size, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_channel *chan = shmp(handle, buf->backend.chan); + struct lttng_ust_ring_buffer_channel *chan = shmp(handle, buf->backend.chan); struct packet_header *header = (struct packet_header *) lib_ring_buffer_offset_address(&buf->backend, @@ -425,7 +425,7 @@ static void client_buffer_end(struct lttng_ust_lib_ring_buffer *buf, uint64_t ts } static int client_buffer_create( - struct lttng_ust_lib_ring_buffer *buf __attribute__((unused)), + struct lttng_ust_ring_buffer *buf __attribute__((unused)), void *priv __attribute__((unused)), int cpu __attribute__((unused)), const char *name __attribute__((unused)), @@ -435,7 +435,7 @@ static int client_buffer_create( } static void client_buffer_finalize( - struct lttng_ust_lib_ring_buffer *buf __attribute__((unused)), + struct lttng_ust_ring_buffer *buf __attribute__((unused)), void *priv __attribute__((unused)), int cpu __attribute__((unused)), struct lttng_ust_shm_handle *handle __attribute__((unused))) @@ -443,7 +443,7 @@ static void client_buffer_finalize( } static void client_content_size_field( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), size_t *offset, size_t *length) { *offset = offsetof(struct packet_header, ctx.content_size); @@ -451,21 +451,21 @@ static void client_content_size_field( } static void client_packet_size_field( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), size_t *offset, size_t *length) { *offset = offsetof(struct packet_header, ctx.packet_size); *length = sizeof(((struct packet_header *) NULL)->ctx.packet_size); } -static struct packet_header *client_packet_header(struct lttng_ust_lib_ring_buffer *buf, +static struct packet_header *client_packet_header(struct lttng_ust_ring_buffer *buf, struct lttng_ust_shm_handle *handle) { return lib_ring_buffer_read_offset_address(&buf->backend, 0, handle); } -static int client_timestamp_begin(struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +static int client_timestamp_begin(struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, uint64_t *timestamp_begin) { struct lttng_ust_shm_handle *handle = chan->handle; @@ -478,8 +478,8 @@ static int client_timestamp_begin(struct lttng_ust_lib_ring_buffer *buf, return 0; } -static int client_timestamp_end(struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +static int client_timestamp_end(struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, uint64_t *timestamp_end) { struct lttng_ust_shm_handle *handle = chan->handle; @@ -492,8 +492,8 @@ static int client_timestamp_end(struct lttng_ust_lib_ring_buffer *buf, return 0; } -static int client_events_discarded(struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +static int client_events_discarded(struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, uint64_t *events_discarded) { struct lttng_ust_shm_handle *handle = chan->handle; @@ -506,8 +506,8 @@ static int client_events_discarded(struct lttng_ust_lib_ring_buffer *buf, return 0; } -static int client_content_size(struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +static int client_content_size(struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, uint64_t *content_size) { struct lttng_ust_shm_handle *handle = chan->handle; @@ -520,8 +520,8 @@ static int client_content_size(struct lttng_ust_lib_ring_buffer *buf, return 0; } -static int client_packet_size(struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +static int client_packet_size(struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, uint64_t *packet_size) { struct lttng_ust_shm_handle *handle = chan->handle; @@ -534,8 +534,8 @@ static int client_packet_size(struct lttng_ust_lib_ring_buffer *buf, return 0; } -static int client_stream_id(struct lttng_ust_lib_ring_buffer *buf __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_channel *chan, +static int client_stream_id(struct lttng_ust_ring_buffer *buf __attribute__((unused)), + struct lttng_ust_ring_buffer_channel *chan, uint64_t *stream_id) { struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(chan); @@ -546,8 +546,8 @@ static int client_stream_id(struct lttng_ust_lib_ring_buffer *buf __attribute__( } static int client_current_timestamp( - struct lttng_ust_lib_ring_buffer *buf __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_channel *chan, + struct lttng_ust_ring_buffer *buf __attribute__((unused)), + struct lttng_ust_ring_buffer_channel *chan, uint64_t *ts) { *ts = client_ring_buffer_clock_read(chan); @@ -555,8 +555,8 @@ static int client_current_timestamp( return 0; } -static int client_sequence_number(struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan, +static int client_sequence_number(struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan, uint64_t *seq) { struct lttng_ust_shm_handle *handle = chan->handle; @@ -569,8 +569,8 @@ static int client_sequence_number(struct lttng_ust_lib_ring_buffer *buf, return 0; } -static int client_instance_id(struct lttng_ust_lib_ring_buffer *buf, - struct lttng_ust_lib_ring_buffer_channel *chan __attribute__((unused)), +static int client_instance_id(struct lttng_ust_ring_buffer *buf, + struct lttng_ust_ring_buffer_channel *chan __attribute__((unused)), uint64_t *id) { *id = buf->backend.cpu; @@ -602,7 +602,7 @@ struct lttng_ust_client_lib_ring_buffer_client_cb client_cb = { .instance_id = client_instance_id, }; -static const struct lttng_ust_lib_ring_buffer_config client_config = { +static const struct lttng_ust_ring_buffer_config client_config = { .cb.ring_buffer_clock_read = client_ring_buffer_clock_read, .cb.record_header_size = client_record_header_size, .cb.subbuffer_header_size = client_packet_header_size, @@ -677,13 +677,13 @@ void lttng_channel_destroy(struct lttng_ust_channel_buffer *lttng_chan_buf) } static -int lttng_event_reserve(struct lttng_ust_lib_ring_buffer_ctx *ctx) +int lttng_event_reserve(struct lttng_ust_ring_buffer_ctx *ctx) { struct lttng_ust_event_recorder *event_recorder = ctx->client_priv; struct lttng_ust_channel_buffer *lttng_chan = event_recorder->chan; struct lttng_client_ctx client_ctx; int ret, nesting; - struct lttng_ust_lib_ring_buffer_ctx_private *private_ctx; + struct lttng_ust_ring_buffer_ctx_private *private_ctx; uint32_t event_id; event_id = event_recorder->priv->id; @@ -733,29 +733,29 @@ put: } static -void lttng_event_commit(struct lttng_ust_lib_ring_buffer_ctx *ctx) +void lttng_event_commit(struct lttng_ust_ring_buffer_ctx *ctx) { lib_ring_buffer_commit(&client_config, ctx); lib_ring_buffer_nesting_dec(&client_config); } static -void lttng_event_write(struct lttng_ust_lib_ring_buffer_ctx *ctx, +void lttng_event_write(struct lttng_ust_ring_buffer_ctx *ctx, const void *src, size_t len, size_t alignment) { - lttng_ust_lib_ring_buffer_align_ctx(ctx, alignment); + lttng_ust_ring_buffer_align_ctx(ctx, alignment); lib_ring_buffer_write(&client_config, ctx, src, len); } static -void lttng_event_strcpy(struct lttng_ust_lib_ring_buffer_ctx *ctx, +void lttng_event_strcpy(struct lttng_ust_ring_buffer_ctx *ctx, const char *src, size_t len) { lib_ring_buffer_strcpy(&client_config, ctx, src, len, '#'); } static -void lttng_event_pstrcpy_pad(struct lttng_ust_lib_ring_buffer_ctx *ctx, +void lttng_event_pstrcpy_pad(struct lttng_ust_ring_buffer_ctx *ctx, const char *src, size_t len) { lib_ring_buffer_pstrcpy(&client_config, ctx, src, len, '\0'); @@ -764,7 +764,7 @@ void lttng_event_pstrcpy_pad(struct lttng_ust_lib_ring_buffer_ctx *ctx, static int lttng_is_finalized(struct lttng_ust_channel_buffer *chan) { - struct lttng_ust_lib_ring_buffer_channel *rb_chan = chan->priv->rb_chan; + struct lttng_ust_ring_buffer_channel *rb_chan = chan->priv->rb_chan; return lib_ring_buffer_channel_is_finalized(rb_chan); } @@ -772,7 +772,7 @@ int lttng_is_finalized(struct lttng_ust_channel_buffer *chan) static int lttng_is_disabled(struct lttng_ust_channel_buffer *chan) { - struct lttng_ust_lib_ring_buffer_channel *rb_chan = chan->priv->rb_chan; + struct lttng_ust_ring_buffer_channel *rb_chan = chan->priv->rb_chan; return lib_ring_buffer_channel_is_disabled(rb_chan); } @@ -780,8 +780,8 @@ int lttng_is_disabled(struct lttng_ust_channel_buffer *chan) static int lttng_flush_buffer(struct lttng_ust_channel_buffer *chan) { - struct lttng_ust_lib_ring_buffer_channel *rb_chan = chan->priv->rb_chan; - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer_channel *rb_chan = chan->priv->rb_chan; + struct lttng_ust_ring_buffer *buf; int cpu; for_each_channel_cpu(cpu, rb_chan) { diff --git a/src/lib/lttng-ust/lttng-ring-buffer-metadata-client-template.h b/src/lib/lttng-ust/lttng-ring-buffer-metadata-client-template.h index fa9e4636..0ffebaa1 100644 --- a/src/lib/lttng-ust/lttng-ring-buffer-metadata-client-template.h +++ b/src/lib/lttng-ust/lttng-ring-buffer-metadata-client-template.h @@ -35,24 +35,24 @@ struct metadata_record_header { uint8_t header_end[0]; /* End of header */ }; -static const struct lttng_ust_lib_ring_buffer_config client_config; +static const struct lttng_ust_ring_buffer_config client_config; /* No nested use supported for metadata ring buffer. */ -static DEFINE_URCU_TLS(struct lttng_ust_lib_ring_buffer_ctx_private, private_ctx); +static DEFINE_URCU_TLS(struct lttng_ust_ring_buffer_ctx_private, private_ctx); static inline uint64_t lib_ring_buffer_clock_read( - struct lttng_ust_lib_ring_buffer_channel *chan __attribute__((unused))) + struct lttng_ust_ring_buffer_channel *chan __attribute__((unused))) { return 0; } static inline size_t record_header_size( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_channel *chan __attribute__((unused)), + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), + struct lttng_ust_ring_buffer_channel *chan __attribute__((unused)), size_t offset __attribute__((unused)), size_t *pre_header_padding __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx __attribute__((unused)), + struct lttng_ust_ring_buffer_ctx *ctx __attribute__((unused)), void *client_ctx __attribute__((unused))) { return 0; @@ -62,18 +62,18 @@ size_t record_header_size( #include "lttng-rb-clients.h" static uint64_t client_ring_buffer_clock_read( - struct lttng_ust_lib_ring_buffer_channel *chan __attribute__((unused))) + struct lttng_ust_ring_buffer_channel *chan __attribute__((unused))) { return 0; } static size_t client_record_header_size( - const struct lttng_ust_lib_ring_buffer_config *config __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_channel *chan __attribute__((unused)), + const struct lttng_ust_ring_buffer_config *config __attribute__((unused)), + struct lttng_ust_ring_buffer_channel *chan __attribute__((unused)), size_t offset __attribute__((unused)), size_t *pre_header_padding __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx __attribute__((unused)), + struct lttng_ust_ring_buffer_ctx *ctx __attribute__((unused)), void *client_ctx __attribute__((unused))) { return 0; @@ -91,12 +91,12 @@ static size_t client_packet_header_size(void) return offsetof(struct metadata_packet_header, header_end); } -static void client_buffer_begin(struct lttng_ust_lib_ring_buffer *buf, +static void client_buffer_begin(struct lttng_ust_ring_buffer *buf, uint64_t tsc __attribute__((unused)), unsigned int subbuf_idx, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_channel *chan = shmp(handle, buf->backend.chan); + struct lttng_ust_ring_buffer_channel *chan = shmp(handle, buf->backend.chan); struct metadata_packet_header *header = (struct metadata_packet_header *) lib_ring_buffer_offset_address(&buf->backend, @@ -123,12 +123,12 @@ static void client_buffer_begin(struct lttng_ust_lib_ring_buffer *buf, * offset is assumed to never be 0 here : never deliver a completely empty * subbuffer. data_size is between 1 and subbuf_size. */ -static void client_buffer_end(struct lttng_ust_lib_ring_buffer *buf, +static void client_buffer_end(struct lttng_ust_ring_buffer *buf, uint64_t tsc __attribute__((unused)), unsigned int subbuf_idx, unsigned long data_size, struct lttng_ust_shm_handle *handle) { - struct lttng_ust_lib_ring_buffer_channel *chan = shmp(handle, buf->backend.chan); + struct lttng_ust_ring_buffer_channel *chan = shmp(handle, buf->backend.chan); struct metadata_packet_header *header = (struct metadata_packet_header *) lib_ring_buffer_offset_address(&buf->backend, @@ -152,7 +152,7 @@ static void client_buffer_end(struct lttng_ust_lib_ring_buffer *buf, } static int client_buffer_create( - struct lttng_ust_lib_ring_buffer *buf __attribute__((unused)), + struct lttng_ust_ring_buffer *buf __attribute__((unused)), void *priv __attribute__((unused)), int cpu __attribute__((unused)), const char *name __attribute__((unused)), @@ -162,7 +162,7 @@ static int client_buffer_create( } static void client_buffer_finalize( - struct lttng_ust_lib_ring_buffer *buf __attribute__((unused)), + struct lttng_ust_ring_buffer *buf __attribute__((unused)), void *priv __attribute__((unused)), int cpu __attribute__((unused)), struct lttng_ust_shm_handle *handle __attribute__((unused))) @@ -182,7 +182,7 @@ struct lttng_ust_client_lib_ring_buffer_client_cb client_cb = { }, }; -static const struct lttng_ust_lib_ring_buffer_config client_config = { +static const struct lttng_ust_ring_buffer_config client_config = { .cb.ring_buffer_clock_read = client_ring_buffer_clock_read, .cb.record_header_size = client_record_header_size, .cb.subbuffer_header_size = client_packet_header_size, @@ -255,11 +255,11 @@ void lttng_channel_destroy(struct lttng_ust_channel_buffer *lttng_chan_buf) } static -int lttng_event_reserve(struct lttng_ust_lib_ring_buffer_ctx *ctx) +int lttng_event_reserve(struct lttng_ust_ring_buffer_ctx *ctx) { int ret; - memset(&URCU_TLS(private_ctx), 0, sizeof(struct lttng_ust_lib_ring_buffer_ctx_private)); + memset(&URCU_TLS(private_ctx), 0, sizeof(struct lttng_ust_ring_buffer_ctx_private)); URCU_TLS(private_ctx).pub = ctx; URCU_TLS(private_ctx).chan = ctx->client_priv; ctx->priv = &URCU_TLS(private_ctx); @@ -273,25 +273,25 @@ int lttng_event_reserve(struct lttng_ust_lib_ring_buffer_ctx *ctx) } static -void lttng_event_commit(struct lttng_ust_lib_ring_buffer_ctx *ctx) +void lttng_event_commit(struct lttng_ust_ring_buffer_ctx *ctx) { lib_ring_buffer_commit(&client_config, ctx); } static -void lttng_event_write(struct lttng_ust_lib_ring_buffer_ctx *ctx, +void lttng_event_write(struct lttng_ust_ring_buffer_ctx *ctx, const void *src, size_t len, size_t alignment) { - lttng_ust_lib_ring_buffer_align_ctx(ctx, alignment); + lttng_ust_ring_buffer_align_ctx(ctx, alignment); lib_ring_buffer_write(&client_config, ctx, src, len); } static size_t lttng_packet_avail_size(struct lttng_ust_channel_buffer *chan) { - struct lttng_ust_lib_ring_buffer_channel *rb_chan = chan->priv->rb_chan; + struct lttng_ust_ring_buffer_channel *rb_chan = chan->priv->rb_chan; unsigned long o_begin; - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer *buf; buf = shmp(rb_chan->handle, rb_chan->backend.buf[0].shmp); /* Only for global buffer ! */ o_begin = v_read(&client_config, &buf->offset); @@ -306,7 +306,7 @@ size_t lttng_packet_avail_size(struct lttng_ust_channel_buffer *chan) static int lttng_is_finalized(struct lttng_ust_channel_buffer *chan) { - struct lttng_ust_lib_ring_buffer_channel *rb_chan = chan->priv->rb_chan; + struct lttng_ust_ring_buffer_channel *rb_chan = chan->priv->rb_chan; return lib_ring_buffer_channel_is_finalized(rb_chan); } @@ -314,7 +314,7 @@ int lttng_is_finalized(struct lttng_ust_channel_buffer *chan) static int lttng_is_disabled(struct lttng_ust_channel_buffer *chan) { - struct lttng_ust_lib_ring_buffer_channel *rb_chan = chan->priv->rb_chan; + struct lttng_ust_ring_buffer_channel *rb_chan = chan->priv->rb_chan; return lib_ring_buffer_channel_is_disabled(rb_chan); } @@ -322,8 +322,8 @@ int lttng_is_disabled(struct lttng_ust_channel_buffer *chan) static int lttng_flush_buffer(struct lttng_ust_channel_buffer *chan) { - struct lttng_ust_lib_ring_buffer_channel *rb_chan = chan->priv->rb_chan; - struct lttng_ust_lib_ring_buffer *buf; + struct lttng_ust_ring_buffer_channel *rb_chan = chan->priv->rb_chan; + struct lttng_ust_ring_buffer *buf; int shm_fd, wait_fd, wakeup_fd; uint64_t memory_map_size; diff --git a/src/lib/lttng-ust/lttng-tracer-core.h b/src/lib/lttng-ust/lttng-tracer-core.h index 4c93428a..df4857b9 100644 --- a/src/lib/lttng-ust/lttng-tracer-core.h +++ b/src/lib/lttng-ust/lttng-tracer-core.h @@ -19,7 +19,7 @@ struct lttng_ust_session; struct lttng_ust_channel_buffer; struct lttng_ust_ctx_field; -struct lttng_ust_lib_ring_buffer_ctx; +struct lttng_ust_ring_buffer_ctx; struct lttng_ust_ctx_value; struct lttng_ust_event_recorder; struct lttng_ust_event_notifier; @@ -79,7 +79,7 @@ ssize_t lttng_ust_read(int fd, void *buf, size_t len) size_t lttng_ust_dummy_get_size(void *priv, size_t offset) __attribute__((visibility("hidden"))); -void lttng_ust_dummy_record(void *priv, struct lttng_ust_lib_ring_buffer_ctx *ctx, +void lttng_ust_dummy_record(void *priv, struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) __attribute__((visibility("hidden"))); diff --git a/src/lib/lttng-ust/lttng-ust-abi.c b/src/lib/lttng-ust/lttng-ust-abi.c index b6d49547..70445a19 100644 --- a/src/lib/lttng-ust/lttng-ust-abi.c +++ b/src/lib/lttng-ust/lttng-ust-abi.c @@ -291,7 +291,7 @@ int lttng_abi_create_root_handle(void) static int lttng_is_channel_ready(struct lttng_ust_channel_buffer *lttng_chan) { - struct lttng_ust_lib_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer_channel *chan; unsigned int nr_streams, exp_streams; chan = lttng_chan->priv->rb_chan; @@ -452,8 +452,8 @@ int lttng_abi_map_channel(int session_objd, struct lttng_ust_shm_handle *channel_handle; struct lttng_ust_abi_channel_config *lttng_chan_config; struct lttng_ust_channel_buffer *lttng_chan_buf; - struct lttng_ust_lib_ring_buffer_channel *chan; - struct lttng_ust_lib_ring_buffer_config *config; + struct lttng_ust_ring_buffer_channel *chan; + struct lttng_ust_ring_buffer_config *config; void *chan_data; int wakeup_fd; uint64_t len; diff --git a/src/lib/lttng-ust/ust-core.c b/src/lib/lttng-ust/ust-core.c index 95a0a2a2..ead25295 100644 --- a/src/lib/lttng-ust/ust-core.c +++ b/src/lib/lttng-ust/ust-core.c @@ -113,13 +113,13 @@ size_t lttng_ust_dummy_get_size(void *priv __attribute__((unused)), { size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(char)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(char)); size += sizeof(char); /* tag */ return size; } void lttng_ust_dummy_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan) { char sel_char = (char) LTTNG_UST_DYNAMIC_TYPE_NONE; diff --git a/tests/compile/test-app-ctx/hello.c b/tests/compile/test-app-ctx/hello.c index 26cca016..a8c40451 100644 --- a/tests/compile/test-app-ctx/hello.c +++ b/tests/compile/test-app-ctx/hello.c @@ -47,49 +47,49 @@ size_t test_get_size(void *priv __attribute__((unused)), size_t offset) int sel = test_count % _NR_LTTNG_UST_DYNAMIC_TYPES; size_t size = 0; - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(char)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(char)); size += sizeof(char); /* tag */ switch (sel) { case LTTNG_UST_DYNAMIC_TYPE_NONE: break; case LTTNG_UST_DYNAMIC_TYPE_S8: - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(int8_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(int8_t)); size += sizeof(int8_t); /* variant */ break; case LTTNG_UST_DYNAMIC_TYPE_S16: - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(int16_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(int16_t)); size += sizeof(int16_t); /* variant */ break; case LTTNG_UST_DYNAMIC_TYPE_S32: - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(int32_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(int32_t)); size += sizeof(int32_t); /* variant */ break; case LTTNG_UST_DYNAMIC_TYPE_S64: - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(int64_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(int64_t)); size += sizeof(int64_t); /* variant */ break; case LTTNG_UST_DYNAMIC_TYPE_U8: - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uint8_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uint8_t)); size += sizeof(uint8_t); /* variant */ break; case LTTNG_UST_DYNAMIC_TYPE_U16: - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uint16_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uint16_t)); size += sizeof(uint16_t); /* variant */ break; case LTTNG_UST_DYNAMIC_TYPE_U32: - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uint32_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uint32_t)); size += sizeof(uint32_t); /* variant */ break; case LTTNG_UST_DYNAMIC_TYPE_U64: - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(uint64_t)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(uint64_t)); size += sizeof(uint64_t); /* variant */ break; case LTTNG_UST_DYNAMIC_TYPE_FLOAT: - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(float)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(float)); size += sizeof(float); /* variant */ break; case LTTNG_UST_DYNAMIC_TYPE_DOUBLE: - size += lttng_ust_lib_ring_buffer_align(offset, lttng_ust_rb_alignof(double)); + size += lttng_ust_ring_buffer_align(offset, lttng_ust_rb_alignof(double)); size += sizeof(double); /* variant */ break; case LTTNG_UST_DYNAMIC_TYPE_STRING: @@ -104,7 +104,7 @@ size_t test_get_size(void *priv __attribute__((unused)), size_t offset) static void test_record(void *priv __attribute__((unused)), - struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *lttng_chan_buf) { int sel = test_count % _NR_LTTNG_UST_DYNAMIC_TYPES;