Fix lib ring buffer compile errors
[lttng-ust.git] / libringbuffer / backend_types.h
1 #ifndef _LINUX_RING_BUFFER_BACKEND_TYPES_H
2 #define _LINUX_RING_BUFFER_BACKEND_TYPES_H
3
4 /*
5 * linux/ringbuffer/backend_types.h
6 *
7 * Copyright (C) 2008-2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 *
9 * Ring buffer backend (types).
10 *
11 * Dual LGPL v2.1/GPL v2 license.
12 */
13
14 #include <limits.h>
15 #include "shm_internal.h"
16
17 struct lttng_ust_lib_ring_buffer_backend_pages {
18 unsigned long mmap_offset; /* offset of the subbuffer in mmap */
19 union v_atomic records_commit; /* current records committed count */
20 union v_atomic records_unread; /* records to read */
21 unsigned long data_size; /* Amount of data to read from subbuf */
22 DECLARE_SHMP(char, p); /* Backing memory map */
23 };
24
25 struct lttng_ust_lib_ring_buffer_backend_subbuffer {
26 /* Identifier for subbuf backend pages. Exchanged atomically. */
27 unsigned long id; /* backend subbuffer identifier */
28 };
29
30 /*
31 * Forward declaration of frontend-specific channel and ring_buffer.
32 */
33 struct channel;
34 struct lttng_ust_lib_ring_buffer;
35
36 struct lttng_ust_lib_ring_buffer_backend_pages_shmp {
37 DECLARE_SHMP(struct lttng_ust_lib_ring_buffer_backend_pages, shmp);
38 };
39
40 struct lttng_ust_lib_ring_buffer_backend {
41 /* Array of ring_buffer_backend_subbuffer for writer */
42 DECLARE_SHMP(struct lttng_ust_lib_ring_buffer_backend_subbuffer, buf_wsb);
43 /* ring_buffer_backend_subbuffer for reader */
44 struct lttng_ust_lib_ring_buffer_backend_subbuffer buf_rsb;
45 /*
46 * Pointer array of backend pages, for whole buffer.
47 * Indexed by ring_buffer_backend_subbuffer identifier (id) index.
48 */
49 DECLARE_SHMP(struct lttng_ust_lib_ring_buffer_backend_pages_shmp, array);
50 DECLARE_SHMP(char, memory_map); /* memory mapping */
51
52 DECLARE_SHMP(struct channel, chan); /* Associated channel */
53 int cpu; /* This buffer's cpu. -1 if global. */
54 union v_atomic records_read; /* Number of records read */
55 unsigned int allocated:1; /* Bool: is buffer allocated ? */
56 };
57
58 struct lttng_ust_lib_ring_buffer_shmp {
59 DECLARE_SHMP(struct lttng_ust_lib_ring_buffer, shmp); /* Channel per-cpu buffers */
60 };
61
62 struct channel_backend {
63 unsigned long buf_size; /* Size of the buffer */
64 unsigned long subbuf_size; /* Sub-buffer size */
65 unsigned int subbuf_size_order; /* Order of sub-buffer size */
66 unsigned int num_subbuf_order; /*
67 * Order of number of sub-buffers/buffer
68 * for writer.
69 */
70 unsigned int buf_size_order; /* Order of buffer size */
71 int extra_reader_sb:1; /* Bool: has extra reader subbuffer */
72 unsigned long num_subbuf; /* Number of sub-buffers for writer */
73 uint64_t start_tsc; /* Channel creation TSC value */
74 DECLARE_SHMP(void *, priv_data);/* Client-specific information */
75 struct lttng_ust_lib_ring_buffer_config config; /* Ring buffer configuration */
76 char name[NAME_MAX]; /* Channel name */
77 struct lttng_ust_lib_ring_buffer_shmp buf[];
78 };
79
80 #endif /* _LINUX_RING_BUFFER_BACKEND_TYPES_H */
This page took 0.038551 seconds and 5 git commands to generate.