Packet headers and alignment
[lttng-modules.git] / probes / lttng-types.h
1 /*
2 * Protect against multiple inclusion of structure declarations, but run the
3 * stages below each time.
4 */
5 #ifndef _LTTNG_PROBES_LTTNG_TYPES_H
6 #define _LTTNG_PROBES_LTTNG_TYPES_H
7
8 #include <linux/seq_file.h>
9 #include "lttng.h"
10 #include "../ltt-events.h"
11 #include "../ltt-tracer.h"
12
13 #ifdef __KERNEL__
14 # include <asm/byteorder.h>
15 # ifdef __BIG_ENDIAN
16 # define __BYTE_ORDER __BIG_ENDIAN
17 # elif defined(__LITTLE_ENDIAN)
18 # define __BYTE_ORDER __LITTLE_ENDIAN
19 # else
20 # error "unknown endianness"
21 # endif
22 #ifndef __BIG_ENDIAN
23 # define __BIG_ENDIAN 4321
24 #endif
25 #ifndef __LITTLE_ENDIAN
26 # define __LITTLE_ENDIAN 1234
27 #endif
28 #else
29 # include <endian.h>
30 #endif
31
32 #endif /* _LTTNG_PROBES_LTTNG_TYPES_H */
33
34
35 /* Export enumerations */
36
37 #ifdef STAGE_EXPORT_ENUMS
38
39 #undef TRACE_EVENT_TYPE
40 #define TRACE_EVENT_TYPE(_name, _abstract_type, args...)
41
42 #undef TRACE_EVENT_ENUM
43 #define TRACE_EVENT_ENUM(_name, _entries...) \
44 const struct lttng_enum_entry __trace_event_enum_##_name[] = { \
45 PARAMS(_entries) \
46 };
47
48 /* Enumeration entry (single value) */
49 #undef V
50 #define V(_string) { _string, _string, #_string}
51
52 /* Enumeration entry (range) */
53 #undef R
54 #define R(_string, _range_start, _range_end) \
55 { _range_start, _range_end, #_string }
56
57 #endif /* STAGE_EXPORT_ENUMS */
58
59
60 /* Export named types */
61
62 #ifdef STAGE_EXPORT_TYPES
63
64 #undef TRACE_EVENT_TYPE___enum
65 #define TRACE_EVENT_TYPE___enum(_name, _container_type) \
66 { \
67 .name = #_name, \
68 .container_type = __type_integer(_container_type, __BYTE_ORDER), \
69 .entries = __trace_event_enum_##_name, \
70 .len = ARRAY_SIZE(__trace_event_enum_##_name), \
71 },
72
73 /* Local declaration */
74 #undef TRACE_EVENT_TYPE
75 #define TRACE_EVENT_TYPE(_name, _abstract_type, args...) \
76 TRACE_EVENT_TYPE___##_abstract_type(_name, args)
77
78 #undef TRACE_EVENT_ENUM
79 #define TRACE_EVENT_ENUM(_name, _entries...)
80
81 #endif /* STAGE_EXPORT_TYPES */
This page took 0.031319 seconds and 5 git commands to generate.