Fix: c99: use __asm__ __volatile__
[lttng-ust.git] / src / common / ringbuffer / frontend_api.h
index ac5e31bf1c4f0ee95b0b74066b8fb9566a16672e..e35070736e36f32875e9512921c941a585147cbe 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <urcu/compiler.h>
 
+#include "common/getcpu.h"
 #include "frontend.h"
 
 /**
@@ -25,7 +26,7 @@
  * Returns a nesting level >= 0 on success, -EPERM on failure (nesting
  * count too high).
  *
- * asm volatile and "memory" clobber prevent the compiler from moving
+ * __asm__ __volatile__ and "memory" clobber prevent the compiler from moving
  * instructions out of the ring buffer nesting count. This is required to ensure
  * that probe side-effects which can cause recursion (e.g. unforeseen traps,
  * divisions by 0, ...) are triggered within the incremented nesting count
@@ -33,7 +34,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 +50,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 +70,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 +102,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 +141,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 +220,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 +238,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;
@@ -256,7 +257,7 @@ void lib_ring_buffer_commit(const struct lttng_ust_lib_ring_buffer_config *confi
        /*
         * Must count record before incrementing the commit count.
         */
-       subbuffer_count_record(config, ctx, &buf->backend, endidx, handle);
+       subbuffer_count_record(config, ctx);
 
        /*
         * Order all writes to buffer before the commit count update that will
@@ -287,7 +288,7 @@ void lib_ring_buffer_commit(const struct lttng_ust_lib_ring_buffer_config *confi
        commit_count = v_read(config, &cc_hot->cc);
 
        lib_ring_buffer_check_deliver(config, buf, chan, offset_end - 1,
-                                     commit_count, endidx, handle, ctx_private->tsc);
+                                     commit_count, endidx, handle, ctx);
        /*
         * Update used size at each commit. It's needed only for extracting
         * ring_buffer buffers from vmcore, after crash.
@@ -307,11 +308,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 +338,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);
 }
This page took 0.028341 seconds and 4 git commands to generate.