2 * Protect against multiple inclusion of structure declarations, but run the
3 * stages below each time.
5 #ifndef _LTTNG_PROBES_LTTNG_TYPES_H
6 #define _LTTNG_PROBES_LTTNG_TYPES_H
11 # include <asm/byteorder.h>
13 # define __BYTE_ORDER __BIG_ENDIAN
14 # elif defined(__LITTLE_ENDIAN)
15 # define __BYTE_ORDER __LITTLE_ENDIAN
17 # error "unknown endianness"
20 # define __BIG_ENDIAN 4321
22 #ifndef __LITTLE_ENDIAN
23 # define __LITTLE_ENDIAN 1234
29 /* Update the astract_types name table in lttng-types.c along with this enum */
39 /* Update the string_encodings name table in lttng-types.c along with this enum */
40 enum lttng_string_encodings
{
41 lttng_encode_UTF8
= 0,
42 lttng_encode_ASCII
= 1,
46 struct lttng_enum_entry
{
47 unsigned long long start
, end
; /* start and end are inclusive */
52 const struct lttng_enum_entry
*entries
;
57 enum abstract_types atype
;
61 unsigned int size
; /* in bits */
62 unsigned short alignment
; /* in bits */
63 unsigned int signedness
:1;
64 unsigned int reverse_byte_order
:1;
67 const char *parent_type
;
68 const struct lttng_enum def
;
71 const char *elem_type
;
72 unsigned int length
; /* num. elems. */
75 const char *elem_type
;
76 const char *length_type
;
79 enum lttng_string_encodings encoding
;
82 } __attribute__((packed
));
84 #endif /* _LTTNG_PROBES_LTTNG_TYPES_H */
87 /* Export enumerations */
89 #ifdef STAGE_EXPORT_ENUMS
91 #undef TRACE_EVENT_TYPE
92 #define TRACE_EVENT_TYPE(_name, _abstract_type, args...)
94 #undef TRACE_EVENT_ENUM
95 #define TRACE_EVENT_ENUM(_name, _entries...) \
96 const struct lttng_enum_entry __trace_event_enum_##_name[] = { \
100 /* Enumeration entry (single value) */
102 #define V(_string) { _string, _string, #_string}
104 /* Enumeration entry (range) */
106 #define R(_string, _range_start, _range_end) \
107 { _range_start, _range_end, #_string }
109 #endif /* STAGE_EXPORT_ENUMS */
112 /* Export named types */
114 #ifdef STAGE_EXPORT_TYPES
116 #undef TRACE_EVENT_TYPE___integer_ext
117 #define TRACE_EVENT_TYPE___integer_ext(_name, _byte_order) \
119 .atype = atype_integer, \
121 .u.integer.size = sizeof(_name) * 8, \
122 .u.integer.alignment = __alignof__(_name) * 8,\
123 .u.integer.signedness = is_signed_type(_name),\
124 .u.integer.reverse_byte_order = ((_byte_order) != __BYTE_ORDER),\
127 #undef TRACE_EVENT_TYPE___integer
128 #define TRACE_EVENT_TYPE___integer(_name, _unused) \
129 TRACE_EVENT_TYPE___integer_ext(_name, __BYTE_ORDER)
131 #undef TRACE_EVENT_TYPE___enum
132 #define TRACE_EVENT_TYPE___enum(_name, _parent_type) \
134 .atype = atype_enum, \
136 .u.enumeration.parent_type = #_parent_type, \
137 .u.enumeration.def.entries = __trace_event_enum_##_name, \
138 .u.enumeration.def.len = ARRAY_SIZE(__trace_event_enum_##_name), \
141 #undef TRACE_EVENT_TYPE___array
142 #define TRACE_EVENT_TYPE___array(_name, _elem_type, _length) \
144 .atype = atype_array, \
146 .u.array.elem_type = #_elem_type, \
147 .u.array.length = _length, \
150 #undef TRACE_EVENT_TYPE___sequence
151 #define TRACE_EVENT_TYPE___sequence(_name, _elem_type, _length_type) \
153 .atype = atype_sequence, \
155 .u.sequence.elem_type = #_elem_type, \
156 .u.sequence.length_type = #_length_type, \
159 #undef TRACE_EVENT_TYPE___string
160 #define TRACE_EVENT_TYPE___string(_name, _encoding) \
162 .atype = atype_string, \
164 .u.string.encoding = lttng_encode_##_encoding,\
168 /* Local declaration */
169 #undef TRACE_EVENT_TYPE
170 #define TRACE_EVENT_TYPE(_name, _abstract_type, args...) \
171 TRACE_EVENT_TYPE___##_abstract_type(_name, args)
173 #undef TRACE_EVENT_ENUM
174 #define TRACE_EVENT_ENUM(_name, _entries...)
176 #endif /* STAGE_EXPORT_TYPES */