struct shm_object *shmobj);
void channel_backend_unregister_notifiers(struct channel_backend *chanb);
struct shm_object *shmobj);
void channel_backend_unregister_notifiers(struct channel_backend *chanb);
- const struct lib_ring_buffer_config *config,
- void *priv, size_t subbuf_size,
- size_t num_subbuf, struct shm_handle *handle);
+ const struct lttng_ust_lib_ring_buffer_config *config,
+ size_t subbuf_size,
+ size_t num_subbuf, struct lttng_ust_shm_handle *handle);
-void lib_ring_buffer_backend_reset(struct lib_ring_buffer_backend *bufb,
- struct shm_handle *handle);
+void lib_ring_buffer_backend_reset(struct lttng_ust_lib_ring_buffer_backend *bufb,
+ struct lttng_ust_shm_handle *handle);
void channel_backend_reset(struct channel_backend *chanb);
int lib_ring_buffer_backend_init(void);
void lib_ring_buffer_backend_exit(void);
void channel_backend_reset(struct channel_backend *chanb);
int lib_ring_buffer_backend_init(void);
void lib_ring_buffer_backend_exit(void);
size_t offset, const void *src, size_t len,
ssize_t pagecpy);
size_t offset, const void *src, size_t len,
ssize_t pagecpy);
unsigned long id, unsigned long offset)
{
return (id & SB_ID_OFFSET_MASK) == (offset << SB_ID_OFFSET_SHIFT);
}
static inline
unsigned long id, unsigned long offset)
{
return (id & SB_ID_OFFSET_MASK) == (offset << SB_ID_OFFSET_SHIFT);
}
static inline
-void subbuffer_count_record(const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer_backend *bufb,
- unsigned long idx, struct shm_handle *handle)
+void subbuffer_count_record(const struct lttng_ust_lib_ring_buffer_config *config,
+ struct lttng_ust_lib_ring_buffer_backend *bufb,
+ unsigned long idx, struct lttng_ust_shm_handle *handle)
- sb_bindex = subbuffer_id_get_index(config, shmp(handle, bufb->buf_wsb)[idx].id);
- v_inc(config, &shmp(handle, (shmp(handle, bufb->array)[sb_bindex]).shmp)->records_commit);
+ sb_bindex = subbuffer_id_get_index(config, shmp_index(handle, bufb->buf_wsb, idx)->id);
+ v_inc(config, &shmp(handle, shmp_index(handle, bufb->array, sb_bindex)->shmp)->records_commit);
-void subbuffer_consume_record(const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer_backend *bufb,
- struct shm_handle *handle)
+void subbuffer_consume_record(const struct lttng_ust_lib_ring_buffer_config *config,
+ struct lttng_ust_lib_ring_buffer_backend *bufb,
+ struct lttng_ust_shm_handle *handle)
{
unsigned long sb_bindex;
sb_bindex = subbuffer_id_get_index(config, bufb->buf_rsb.id);
CHAN_WARN_ON(shmp(handle, bufb->chan),
{
unsigned long sb_bindex;
sb_bindex = subbuffer_id_get_index(config, bufb->buf_rsb.id);
CHAN_WARN_ON(shmp(handle, bufb->chan),
- !v_read(config, &shmp(handle, (shmp(handle, bufb->array)[sb_bindex]).shmp)->records_unread));
+ !v_read(config, &shmp(handle, shmp_index(handle, bufb->array, sb_bindex)->shmp)->records_unread));
- _v_dec(config, &shmp(handle, (shmp(handle, bufb->array)[sb_bindex]).shmp)->records_unread);
+ _v_dec(config, &shmp(handle, shmp_index(handle, bufb->array, sb_bindex)->shmp)->records_unread);
v_inc(config, &bufb->records_read);
}
static inline
unsigned long subbuffer_get_records_count(
v_inc(config, &bufb->records_read);
}
static inline
unsigned long subbuffer_get_records_count(
- const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer_backend *bufb,
+ const struct lttng_ust_lib_ring_buffer_config *config,
+ struct lttng_ust_lib_ring_buffer_backend *bufb,
- sb_bindex = subbuffer_id_get_index(config, shmp(handle, bufb->buf_wsb)[idx].id);
- return v_read(config, &shmp(handle, (shmp(handle, bufb->array)[sb_bindex]).shmp)->records_commit);
+ sb_bindex = subbuffer_id_get_index(config, shmp_index(handle, bufb->buf_wsb, idx)->id);
+ return v_read(config, &shmp(handle, shmp_index(handle, bufb->array, sb_bindex)->shmp)->records_commit);
- const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer_backend *bufb,
+ const struct lttng_ust_lib_ring_buffer_config *config,
+ struct lttng_ust_lib_ring_buffer_backend *bufb,
- sb_bindex = subbuffer_id_get_index(config, shmp(handle, bufb->buf_wsb)[idx].id);
- pages = &shmp(handle, bufb->array)[sb_bindex];
+ sb_bindex = subbuffer_id_get_index(config, shmp_index(handle, bufb->buf_wsb, idx)->id);
+ pages = shmp_index(handle, bufb->array, sb_bindex);
overruns = v_read(config, &shmp(handle, pages->shmp)->records_unread);
v_set(config, &shmp(handle, pages->shmp)->records_unread,
v_read(config, &shmp(handle, pages->shmp)->records_commit));
overruns = v_read(config, &shmp(handle, pages->shmp)->records_unread);
v_set(config, &shmp(handle, pages->shmp)->records_unread,
v_read(config, &shmp(handle, pages->shmp)->records_commit));
-void subbuffer_set_data_size(const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer_backend *bufb,
+void subbuffer_set_data_size(const struct lttng_ust_lib_ring_buffer_config *config,
+ struct lttng_ust_lib_ring_buffer_backend *bufb,
- sb_bindex = subbuffer_id_get_index(config, shmp(handle, bufb->buf_wsb)[idx].id);
- pages = &shmp(handle, bufb->array)[sb_bindex];
+ sb_bindex = subbuffer_id_get_index(config, shmp_index(handle, bufb->buf_wsb, idx)->id);
+ pages = shmp_index(handle, bufb->array, sb_bindex);
shmp(handle, pages->shmp)->data_size = data_size;
}
static inline
unsigned long subbuffer_get_read_data_size(
shmp(handle, pages->shmp)->data_size = data_size;
}
static inline
unsigned long subbuffer_get_read_data_size(
- const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer_backend *bufb,
- struct shm_handle *handle)
+ const struct lttng_ust_lib_ring_buffer_config *config,
+ struct lttng_ust_lib_ring_buffer_backend *bufb,
+ struct lttng_ust_shm_handle *handle)
return shmp(handle, pages->shmp)->data_size;
}
static inline
unsigned long subbuffer_get_data_size(
return shmp(handle, pages->shmp)->data_size;
}
static inline
unsigned long subbuffer_get_data_size(
- const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer_backend *bufb,
+ const struct lttng_ust_lib_ring_buffer_config *config,
+ struct lttng_ust_lib_ring_buffer_backend *bufb,
- sb_bindex = subbuffer_id_get_index(config, shmp(handle, bufb->buf_wsb)[idx].id);
- pages = &shmp(handle, bufb->array)[sb_bindex];
+ sb_bindex = subbuffer_id_get_index(config, shmp_index(handle, bufb->buf_wsb, idx)->id);
+ pages = shmp_index(handle, bufb->array, sb_bindex);
-void lib_ring_buffer_clear_noref(const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer_backend *bufb,
+void lib_ring_buffer_clear_noref(const struct lttng_ust_lib_ring_buffer_config *config,
+ struct lttng_ust_lib_ring_buffer_backend *bufb,
* Performing a volatile access to read the sb_pages, because we want to
* read a coherent version of the pointer and the associated noref flag.
*/
* Performing a volatile access to read the sb_pages, because we want to
* read a coherent version of the pointer and the associated noref flag.
*/
/*
* Store after load dependency ordering the writes to
* the subbuffer after load and test of the noref flag
/*
* Store after load dependency ordering the writes to
* the subbuffer after load and test of the noref flag
- new_id = uatomic_cmpxchg(&shmp(handle, bufb->buf_wsb)[idx].id, id, new_id);
- if (likely(new_id == id))
+ new_id = uatomic_cmpxchg(&shmp_index(handle, bufb->buf_wsb, idx)->id, id, new_id);
+ if (caa_likely(new_id == id))
-void lib_ring_buffer_set_noref_offset(const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer_backend *bufb,
+void lib_ring_buffer_set_noref_offset(const struct lttng_ust_lib_ring_buffer_config *config,
+ struct lttng_ust_lib_ring_buffer_backend *bufb,
* readers of the noref flag.
*/
CHAN_WARN_ON(shmp(handle, bufb->chan),
* readers of the noref flag.
*/
CHAN_WARN_ON(shmp(handle, bufb->chan),
- subbuffer_id_is_noref(config, shmp(handle, bufb->buf_wsb)[idx].id));
+ subbuffer_id_is_noref(config, shmp_index(handle, bufb->buf_wsb, idx)->id));
- subbuffer_id_set_noref_offset(config, &shmp(handle, bufb->buf_wsb)[idx].id, offset);
+ subbuffer_id_set_noref_offset(config, &shmp_index(handle, bufb->buf_wsb, idx)->id, offset);
-int update_read_sb_index(const struct lib_ring_buffer_config *config,
- struct lib_ring_buffer_backend *bufb,
+int update_read_sb_index(const struct lttng_ust_lib_ring_buffer_config *config,
+ struct lttng_ust_lib_ring_buffer_backend *bufb,
struct channel_backend *chanb,
unsigned long consumed_idx,
unsigned long consumed_count,
struct channel_backend *chanb,
unsigned long consumed_idx,
unsigned long consumed_count,
- old_id = shmp(handle, bufb->buf_wsb)[consumed_idx].id;
- if (unlikely(!subbuffer_id_is_noref(config, old_id)))
+ old_id = shmp_index(handle, bufb->buf_wsb, consumed_idx)->id;
+ if (caa_unlikely(!subbuffer_id_is_noref(config, old_id)))
consumed_count)))
return -EAGAIN;
CHAN_WARN_ON(shmp(handle, bufb->chan),
!subbuffer_id_is_noref(config, bufb->buf_rsb.id));
subbuffer_id_set_noref_offset(config, &bufb->buf_rsb.id,
consumed_count);
consumed_count)))
return -EAGAIN;
CHAN_WARN_ON(shmp(handle, bufb->chan),
!subbuffer_id_is_noref(config, bufb->buf_rsb.id));
subbuffer_id_set_noref_offset(config, &bufb->buf_rsb.id,
consumed_count);
- new_id = uatomic_cmpxchg(&shmp(handle, bufb->buf_wsb)[consumed_idx].id, old_id,
+ new_id = uatomic_cmpxchg(&shmp_index(handle, bufb->buf_wsb, consumed_idx)->id, old_id,
return -EAGAIN;
bufb->buf_rsb.id = new_id;
} else {
/* No page exchange, use the writer page directly */
return -EAGAIN;
bufb->buf_rsb.id = new_id;
} else {
/* No page exchange, use the writer page directly */