lttng-modules v0.19-stable: setup_trace_write: Fix recursive locking
[lttng-modules.git] / ltt-type-serializer.h
1 #ifndef _LTT_TYPE_SERIALIZER_H
2 #define _LTT_TYPE_SERIALIZER_H
3
4 #include <linux/if.h> /* For IFNAMSIZ */
5
6 #include "ltt-tracer.h"
7
8 /*
9 * largest_align must be non-zero, equal to the minimum between the largest type
10 * and sizeof(void *).
11 */
12 extern void _ltt_specialized_trace(const struct marker *mdata, void *probe_data,
13 void *serialize_private, unsigned int data_size,
14 unsigned int largest_align);
15
16 /*
17 * Statically check that 0 < largest_align < sizeof(void *) to make sure it is
18 * dumb-proof. It will make sure 0 is changed into 1 and unsigned long long is
19 * changed into sizeof(void *) on 32-bit architectures.
20 */
21 static inline void ltt_specialized_trace(const struct marker *mdata,
22 void *probe_data,
23 void *serialize_private, unsigned int data_size,
24 unsigned int largest_align)
25 {
26 largest_align = min_t(unsigned int, largest_align, sizeof(void *));
27 largest_align = max_t(unsigned int, largest_align, 1);
28 _ltt_specialized_trace(mdata, probe_data, serialize_private, data_size,
29 largest_align);
30 }
31
32 /*
33 * Type serializer definitions.
34 */
35
36 /*
37 * Return size of structure without end-of-structure padding.
38 */
39 #define serialize_sizeof(type) offsetof(typeof(type), end_field)
40
41 struct serialize_long_int {
42 unsigned long f1;
43 unsigned int f2;
44 unsigned char end_field[0];
45 } LTT_ALIGN;
46
47 struct serialize_int_int_long {
48 unsigned int f1;
49 unsigned int f2;
50 unsigned long f3;
51 unsigned char end_field[0];
52 } LTT_ALIGN;
53
54 struct serialize_int_int_short {
55 unsigned int f1;
56 unsigned int f2;
57 unsigned short f3;
58 unsigned char end_field[0];
59 } LTT_ALIGN;
60
61 struct serialize_long_long_long {
62 unsigned long f1;
63 unsigned long f2;
64 unsigned long f3;
65 unsigned char end_field[0];
66 } LTT_ALIGN;
67
68 struct serialize_long_long_int {
69 unsigned long f1;
70 unsigned long f2;
71 unsigned int f3;
72 unsigned char end_field[0];
73 } LTT_ALIGN;
74
75 struct serialize_long_long_short_char {
76 unsigned long f1;
77 unsigned long f2;
78 unsigned short f3;
79 unsigned char f4;
80 unsigned char end_field[0];
81 } LTT_ALIGN;
82
83 struct serialize_long_long_short {
84 unsigned long f1;
85 unsigned long f2;
86 unsigned short f3;
87 unsigned char end_field[0];
88 } LTT_ALIGN;
89
90 struct serialize_long_short_char {
91 unsigned long f1;
92 unsigned short f2;
93 unsigned char f3;
94 unsigned char end_field[0];
95 } LTT_ALIGN;
96
97 struct serialize_long_short {
98 unsigned long f1;
99 unsigned short f2;
100 unsigned char end_field[0];
101 } LTT_ALIGN;
102
103 struct serialize_long_char {
104 unsigned long f1;
105 unsigned char f2;
106 unsigned char end_field[0];
107 } LTT_ALIGN;
108
109 struct serialize_long_ifname {
110 unsigned long f1;
111 unsigned char f2[IFNAMSIZ];
112 unsigned char end_field[0];
113 } LTT_ALIGN;
114
115 struct serialize_sizet_int {
116 size_t f1;
117 unsigned int f2;
118 unsigned char end_field[0];
119 } LTT_ALIGN;
120
121 struct serialize_long_long_sizet_int {
122 unsigned long f1;
123 unsigned long f2;
124 size_t f3;
125 unsigned int f4;
126 unsigned char end_field[0];
127 } LTT_ALIGN;
128
129 struct serialize_long_long_sizet_int_int {
130 unsigned long f1;
131 unsigned long f2;
132 size_t f3;
133 unsigned int f4;
134 unsigned int f5;
135 unsigned char end_field[0];
136 } LTT_ALIGN;
137
138 struct serialize_l4421224411111 {
139 unsigned long f1;
140 uint32_t f2;
141 uint32_t f3;
142 uint16_t f4;
143 uint8_t f5;
144 uint16_t f6;
145 uint16_t f7;
146 uint32_t f8;
147 uint32_t f9;
148 uint8_t f10;
149 uint8_t f11;
150 uint8_t f12;
151 uint8_t f13;
152 uint8_t f14;
153 unsigned char end_field[0];
154 } LTT_ALIGN;
155
156 struct serialize_l214421224411111 {
157 unsigned long f1;
158 uint16_t f2;
159 uint8_t f3;
160 uint32_t f4;
161 uint32_t f5;
162 uint16_t f6;
163 uint8_t f7;
164 uint16_t f8;
165 uint16_t f9;
166 uint32_t f10;
167 uint32_t f11;
168 uint8_t f12;
169 uint8_t f13;
170 uint8_t f14;
171 uint8_t f15;
172 uint8_t f16;
173 uint8_t end_field[0];
174 } LTT_ALIGN;
175
176 struct serialize_l4412228 {
177 unsigned long f1;
178 uint32_t f2;
179 uint32_t f3;
180 uint8_t f4;
181 uint16_t f5;
182 uint16_t f6;
183 uint16_t f7;
184 uint64_t f8;
185 unsigned char end_field[0];
186 } LTT_ALIGN;
187 #endif /* _LTT_TYPE_SERIALIZER_H */
This page took 0.032335 seconds and 4 git commands to generate.