struct lttng_channel: split protocol ABI from instrumentation ABI
[lttng-ust.git] / libringbuffer / backend_types.h
index a53fb322ec109bb2fc5c9cc275e5f0118dd67bf5..19d6513d4d75689c6b033abf7673240d88b1d390 100644 (file)
@@ -1,29 +1,16 @@
-#ifndef _LTTNG_RING_BUFFER_BACKEND_TYPES_H
-#define _LTTNG_RING_BUFFER_BACKEND_TYPES_H
-
 /*
- * linux/ringbuffer/backend_types.h
- *
- * Ring buffer backend (types).
+ * SPDX-License-Identifier: LGPL-2.1-only
  *
  * Copyright (C) 2008-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; only
- * version 2.1 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Ring buffer backend (types).
  */
 
+#ifndef _LTTNG_RING_BUFFER_BACKEND_TYPES_H
+#define _LTTNG_RING_BUFFER_BACKEND_TYPES_H
+
 #include <limits.h>
+#include <stdint.h>
 #include "shm_internal.h"
 #include "vatomic.h"
 
@@ -42,10 +29,20 @@ struct lttng_ust_lib_ring_buffer_backend_subbuffer {
        unsigned long id;               /* backend subbuffer identifier */
 };
 
+struct lttng_ust_lib_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
+        * buffer can be derived from the formula nr_subbuffers * seq_cnt +
+        * subbuf_idx.
+        */
+       uint64_t seq_cnt;               /* packet sequence number */
+};
+
 /*
  * Forward declaration of frontend-specific channel and ring_buffer.
  */
-struct channel;
+struct lttng_ust_lib_ring_buffer_channel;
 struct lttng_ust_lib_ring_buffer;
 
 struct lttng_ust_lib_ring_buffer_backend_pages_shmp {
@@ -58,6 +55,8 @@ struct lttng_ust_lib_ring_buffer_backend {
        DECLARE_SHMP(struct lttng_ust_lib_ring_buffer_backend_subbuffer, buf_wsb);
        /* ring_buffer_backend_subbuffer for reader */
        struct lttng_ust_lib_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);
        /*
         * Pointer array of backend pages, for whole buffer.
         * Indexed by ring_buffer_backend_subbuffer identifier (id) index.
@@ -65,7 +64,7 @@ struct lttng_ust_lib_ring_buffer_backend {
        DECLARE_SHMP(struct lttng_ust_lib_ring_buffer_backend_pages_shmp, array);
        DECLARE_SHMP(char, memory_map); /* memory mapping */
 
-       DECLARE_SHMP(struct channel, chan);     /* Associated channel */
+       DECLARE_SHMP(struct lttng_ust_lib_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 ? */
This page took 0.024875 seconds and 4 git commands to generate.