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