Add Maintainer and Mailing list contact information to README
[ust.git] / include / ust / 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
PMF
6#include <ust/core.h>
7
8/*
9 * largest_align must be non-zero, equal to the minimum between the largest type
10 * and sizeof(void *).
11 */
b521931e 12extern void _ltt_specialized_trace(const struct ust_marker *mdata, void *probe_data,
12e81b07
PMF
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 */
b521931e 21static inline void ltt_specialized_trace(const struct ust_marker *mdata,
12e81b07
PMF
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
41struct serialize_long_int {
42 unsigned long f1;
43 unsigned int f2;
44 unsigned char end_field[0];
45} LTT_ALIGN;
46
47struct 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
54struct 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
61struct 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
68struct 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
75struct 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
83struct 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
90struct 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
97struct serialize_long_short {
98 unsigned long f1;
99 unsigned short f2;
100 unsigned char end_field[0];
101} LTT_ALIGN;
102
103struct serialize_long_char {
104 unsigned long f1;
105 unsigned char f2;
106 unsigned char end_field[0];
107} LTT_ALIGN;
108
109struct serialize_sizet_int {
110 size_t f1;
111 unsigned int f2;
112 unsigned char end_field[0];
113} LTT_ALIGN;
114
115struct serialize_long_long_sizet_int {
116 unsigned long f1;
117 unsigned long f2;
118 size_t f3;
119 unsigned int f4;
120 unsigned char end_field[0];
121} LTT_ALIGN;
122
123struct serialize_long_long_sizet_int_int {
124 unsigned long f1;
125 unsigned long f2;
126 size_t f3;
127 unsigned int f4;
128 unsigned int f5;
129 unsigned char end_field[0];
130} LTT_ALIGN;
131
132struct serialize_l4421224411111 {
133 unsigned long f1;
134 uint32_t f2;
135 uint32_t f3;
136 uint16_t f4;
137 uint8_t f5;
138 uint16_t f6;
139 uint16_t f7;
140 uint32_t f8;
141 uint32_t f9;
142 uint8_t f10;
143 uint8_t f11;
144 uint8_t f12;
145 uint8_t f13;
146 uint8_t f14;
147 unsigned char end_field[0];
148} LTT_ALIGN;
149
150struct serialize_l214421224411111 {
151 unsigned long f1;
152 uint16_t f2;
153 uint8_t f3;
154 uint32_t f4;
155 uint32_t f5;
156 uint16_t f6;
157 uint8_t f7;
158 uint16_t f8;
159 uint16_t f9;
160 uint32_t f10;
161 uint32_t f11;
162 uint8_t f12;
163 uint8_t f13;
164 uint8_t f14;
165 uint8_t f15;
166 uint8_t f16;
167 uint8_t end_field[0];
168} LTT_ALIGN;
169
170struct serialize_l4412228 {
171 unsigned long f1;
172 uint32_t f2;
173 uint32_t f3;
174 uint8_t f4;
175 uint16_t f5;
176 uint16_t f6;
177 uint16_t f7;
178 uint64_t f8;
179 unsigned char end_field[0];
180} LTT_ALIGN;
535b0d0a 181
12e81b07 182#endif /* _LTT_TYPE_SERIALIZER_H */
This page took 0.036741 seconds and 4 git commands to generate.