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
8 #include <linux/seq_file.h>
12 # include <asm/byteorder.h>
14 # define __BYTE_ORDER __BIG_ENDIAN
15 # elif defined(__LITTLE_ENDIAN)
16 # define __BYTE_ORDER __LITTLE_ENDIAN
18 # error "unknown endianness"
21 # define __BIG_ENDIAN 4321
23 #ifndef __LITTLE_ENDIAN
24 # define __LITTLE_ENDIAN 1234
30 /* Update the astract_types name table in lttng-types.c along with this enum */
40 /* Update the string_encodings name table in lttng-types.c along with this enum */
41 enum lttng_string_encodings
{
42 lttng_encode_UTF8
= 0,
43 lttng_encode_ASCII
= 1,
47 struct lttng_enum_entry
{
48 unsigned long long start
, end
; /* start and end are inclusive */
53 const struct lttng_enum_entry
*entries
;
58 enum abstract_types atype
;
62 unsigned int size
; /* in bits */
63 unsigned short alignment
; /* in bits */
64 unsigned int signedness
:1;
65 unsigned int reverse_byte_order
:1;
68 const char *parent_type
;
69 const struct lttng_enum def
;
72 const char *elem_type
;
73 unsigned int length
; /* num. elems. */
76 const char *elem_type
;
77 const char *length_type
;
80 enum lttng_string_encodings encoding
;
83 } __attribute__((packed
));
85 void lttng_print_event_type(struct seq_file
*m
, unsigned int indent
,
86 const struct lttng_type
*type
);
88 #endif /* _LTTNG_PROBES_LTTNG_TYPES_H */
91 /* Export enumerations */
93 #ifdef STAGE_EXPORT_ENUMS
95 #undef TRACE_EVENT_TYPE
96 #define TRACE_EVENT_TYPE(_name, _abstract_type, args...)
98 #undef TRACE_EVENT_ENUM
99 #define TRACE_EVENT_ENUM(_name, _entries...) \
100 const struct lttng_enum_entry __trace_event_enum_##_name[] = { \
104 /* Enumeration entry (single value) */
106 #define V(_string) { _string, _string, #_string}
108 /* Enumeration entry (range) */
110 #define R(_string, _range_start, _range_end) \
111 { _range_start, _range_end, #_string }
113 #endif /* STAGE_EXPORT_ENUMS */
116 /* Export named types */
118 #ifdef STAGE_EXPORT_TYPES
120 #undef TRACE_EVENT_TYPE___integer_ext
121 #define TRACE_EVENT_TYPE___integer_ext(_name, _byte_order) \
123 .atype = atype_integer, \
125 .u.integer.size = sizeof(_name) * 8, \
126 .u.integer.alignment = __alignof__(_name) * 8,\
127 .u.integer.signedness = is_signed_type(_name),\
128 .u.integer.reverse_byte_order = ((_byte_order) != __BYTE_ORDER),\
131 #undef TRACE_EVENT_TYPE___integer
132 #define TRACE_EVENT_TYPE___integer(_name, _unused) \
133 TRACE_EVENT_TYPE___integer_ext(_name, __BYTE_ORDER)
135 #undef TRACE_EVENT_TYPE___enum
136 #define TRACE_EVENT_TYPE___enum(_name, _parent_type) \
138 .atype = atype_enum, \
140 .u.enumeration.parent_type = #_parent_type, \
141 .u.enumeration.def.entries = __trace_event_enum_##_name, \
142 .u.enumeration.def.len = ARRAY_SIZE(__trace_event_enum_##_name), \
145 #undef TRACE_EVENT_TYPE___array
146 #define TRACE_EVENT_TYPE___array(_name, _elem_type, _length) \
148 .atype = atype_array, \
150 .u.array.elem_type = #_elem_type, \
151 .u.array.length = _length, \
154 #undef TRACE_EVENT_TYPE___sequence
155 #define TRACE_EVENT_TYPE___sequence(_name, _elem_type, _length_type) \
157 .atype = atype_sequence, \
159 .u.sequence.elem_type = #_elem_type, \
160 .u.sequence.length_type = #_length_type, \
163 #undef TRACE_EVENT_TYPE___string
164 #define TRACE_EVENT_TYPE___string(_name, _encoding) \
166 .atype = atype_string, \
168 .u.string.encoding = lttng_encode_##_encoding,\
172 /* Local declaration */
173 #undef TRACE_EVENT_TYPE
174 #define TRACE_EVENT_TYPE(_name, _abstract_type, args...) \
175 TRACE_EVENT_TYPE___##_abstract_type(_name, args)
177 #undef TRACE_EVENT_ENUM
178 #define TRACE_EVENT_ENUM(_name, _entries...)
180 #endif /* STAGE_EXPORT_TYPES */