Rename shm_handle to lttng_ust_shm_handle
[lttng-ust.git] / libringbuffer / ring_buffer_backend.c
index 3e202978465ba73923a5c75645011ede0ff18954..adf5978485f12577dd551a1c063256407abb913d 100644 (file)
@@ -29,7 +29,7 @@ int lib_ring_buffer_backend_allocate(const struct lib_ring_buffer_config *config
                                     struct lib_ring_buffer_backend *bufb,
                                     size_t size, size_t num_subbuf,
                                     int extra_reader_sb,
-                                    struct shm_handle *handle,
+                                    struct lttng_ust_shm_handle *handle,
                                     struct shm_object *shmobj)
 {
        struct channel_backend *chanb = &shmp(handle, bufb->chan)->backend;
@@ -115,10 +115,10 @@ array_error:
 
 int lib_ring_buffer_backend_create(struct lib_ring_buffer_backend *bufb,
                                   struct channel_backend *chanb, int cpu,
-                                  struct shm_handle *handle,
+                                  struct lttng_ust_shm_handle *handle,
                                   struct shm_object *shmobj)
 {
-       const struct lib_ring_buffer_config *config = chanb->config;
+       const struct lib_ring_buffer_config *config = &chanb->config;
 
        set_shmp(bufb->chan, handle->chan._ref);
        bufb->cpu = cpu;
@@ -138,10 +138,10 @@ void lib_ring_buffer_backend_free(struct lib_ring_buffer_backend *bufb)
 }
 
 void lib_ring_buffer_backend_reset(struct lib_ring_buffer_backend *bufb,
-                                  struct shm_handle *handle)
+                                  struct lttng_ust_shm_handle *handle)
 {
        struct channel_backend *chanb = &shmp(handle, bufb->chan)->backend;
-       const struct lib_ring_buffer_config *config = chanb->config;
+       const struct lib_ring_buffer_config *config = &chanb->config;
        unsigned long num_subbuf_alloc;
        unsigned int i;
 
@@ -175,7 +175,7 @@ void lib_ring_buffer_backend_reset(struct lib_ring_buffer_backend *bufb,
 void channel_backend_reset(struct channel_backend *chanb)
 {
        struct channel *chan = caa_container_of(chanb, struct channel, backend);
-       const struct lib_ring_buffer_config *config = chanb->config;
+       const struct lib_ring_buffer_config *config = &chanb->config;
 
        /*
         * Don't reset buf_size, subbuf_size, subbuf_size_order,
@@ -194,7 +194,7 @@ void channel_backend_reset(struct channel_backend *chanb)
  * @parent: dentry of parent directory, %NULL for root directory
  * @subbuf_size: size of sub-buffers (> PAGE_SIZE, power of 2)
  * @num_subbuf: number of sub-buffers (power of 2)
- * @shm_handle: shared memory handle
+ * @lttng_ust_shm_handle: shared memory handle
  *
  * Returns channel pointer if successful, %NULL otherwise.
  *
@@ -208,7 +208,7 @@ int channel_backend_init(struct channel_backend *chanb,
                         const char *name,
                         const struct lib_ring_buffer_config *config,
                         void *priv, size_t subbuf_size, size_t num_subbuf,
-                        struct shm_handle *handle)
+                        struct lttng_ust_shm_handle *handle)
 {
        struct channel *chan = caa_container_of(chanb, struct channel, backend);
        unsigned int i;
@@ -246,7 +246,7 @@ int channel_backend_init(struct channel_backend *chanb,
        chanb->num_subbuf = num_subbuf;
        strncpy(chanb->name, name, NAME_MAX);
        chanb->name[NAME_MAX - 1] = '\0';
-       chanb->config = config;
+       memcpy(&chanb->config, config, sizeof(*config));
 
        /* Per-cpu buffer size: control (prior to backend) */
        shmsize = offset_align(shmsize, __alignof__(struct lib_ring_buffer));
@@ -334,9 +334,9 @@ end:
  * Destroy all channel buffers and frees the channel.
  */
 void channel_backend_free(struct channel_backend *chanb,
-                         struct shm_handle *handle)
+                         struct lttng_ust_shm_handle *handle)
 {
-       const struct lib_ring_buffer_config *config = chanb->config;
+       const struct lib_ring_buffer_config *config = &chanb->config;
        unsigned int i;
 
        if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) {
@@ -367,10 +367,10 @@ void channel_backend_free(struct channel_backend *chanb,
  * Returns the length copied.
  */
 size_t lib_ring_buffer_read(struct lib_ring_buffer_backend *bufb, size_t offset,
-                           void *dest, size_t len, struct shm_handle *handle)
+                           void *dest, size_t len, struct lttng_ust_shm_handle *handle)
 {
        struct channel_backend *chanb = &shmp(handle, bufb->chan)->backend;
-       const struct lib_ring_buffer_config *config = chanb->config;
+       const struct lib_ring_buffer_config *config = &chanb->config;
        ssize_t orig_len;
        struct lib_ring_buffer_backend_pages_shmp *rpages;
        unsigned long sb_bindex, id;
@@ -405,10 +405,10 @@ size_t lib_ring_buffer_read(struct lib_ring_buffer_backend *bufb, size_t offset,
  * Should be protected by get_subbuf/put_subbuf.
  */
 int lib_ring_buffer_read_cstr(struct lib_ring_buffer_backend *bufb, size_t offset,
-                             void *dest, size_t len, struct shm_handle *handle)
+                             void *dest, size_t len, struct lttng_ust_shm_handle *handle)
 {
        struct channel_backend *chanb = &shmp(handle, bufb->chan)->backend;
-       const struct lib_ring_buffer_config *config = chanb->config;
+       const struct lib_ring_buffer_config *config = &chanb->config;
        ssize_t string_len, orig_offset;
        char *str;
        struct lib_ring_buffer_backend_pages_shmp *rpages;
@@ -447,11 +447,11 @@ int lib_ring_buffer_read_cstr(struct lib_ring_buffer_backend *bufb, size_t offse
  */
 void *lib_ring_buffer_read_offset_address(struct lib_ring_buffer_backend *bufb,
                                          size_t offset,
-                                         struct shm_handle *handle)
+                                         struct lttng_ust_shm_handle *handle)
 {
        struct lib_ring_buffer_backend_pages_shmp *rpages;
        struct channel_backend *chanb = &shmp(handle, bufb->chan)->backend;
-       const struct lib_ring_buffer_config *config = chanb->config;
+       const struct lib_ring_buffer_config *config = &chanb->config;
        unsigned long sb_bindex, id;
 
        offset &= chanb->buf_size - 1;
@@ -475,14 +475,13 @@ void *lib_ring_buffer_read_offset_address(struct lib_ring_buffer_backend *bufb,
  */
 void *lib_ring_buffer_offset_address(struct lib_ring_buffer_backend *bufb,
                                     size_t offset,
-                                    struct shm_handle *handle)
+                                    struct lttng_ust_shm_handle *handle)
 {
        size_t sbidx;
        struct lib_ring_buffer_backend_pages_shmp *rpages;
        struct channel_backend *chanb = &shmp(handle, bufb->chan)->backend;
-       const struct lib_ring_buffer_config *config = chanb->config;
+       const struct lib_ring_buffer_config *config = &chanb->config;
        unsigned long sb_bindex, id;
-       void *ret;
 
        offset &= chanb->buf_size - 1;
        sbidx = offset >> chanb->subbuf_size_order;
This page took 0.026446 seconds and 4 git commands to generate.