struct side_arg;
struct side_arg_vec;
struct side_arg_dynamic;
+struct side_arg_dynamic_field;
struct side_arg_dynamic_vla;
struct side_type;
struct side_event_field;
struct side_tracer_visitor_ctx;
struct side_tracer_dynamic_struct_visitor_ctx;
-struct side_tracer_dynamic_vla_visitor_ctx;
struct side_event_description;
-struct side_arg_dynamic_event_struct;
+struct side_arg_dynamic_struct;
struct side_events_register_handle;
enum side_type_label {
/* Statically declared compound types */
SIDE_TYPE_STRUCT,
- SIDE_TYPE_STRUCT_SG,
SIDE_TYPE_ARRAY,
SIDE_TYPE_VLA,
SIDE_TYPE_VLA_VISITOR,
/* Scatter-gather types */
SIDE_TYPE_SG_UNSIGNED_INT,
SIDE_TYPE_SG_SIGNED_INT,
+ SIDE_TYPE_SG_FLOAT,
SIDE_TYPE_SG_STRUCT,
/* Dynamic types */
# define SIDE_TYPE_FLOAT_WORD_ORDER_HOST SIDE_TYPE_BYTE_ORDER_BE
#endif
-typedef enum side_visitor_status (*side_visitor)(
+typedef enum side_visitor_status (*side_visitor_func)(
const struct side_tracer_visitor_ctx *tracer_ctx,
void *app_ctx);
-typedef enum side_visitor_status (*side_dynamic_struct_visitor)(
+typedef enum side_visitor_status (*side_dynamic_struct_visitor_func)(
const struct side_tracer_dynamic_struct_visitor_ctx *tracer_ctx,
void *app_ctx);
-typedef enum side_visitor_status (*side_dynamic_vla_visitor)(
- const struct side_tracer_dynamic_vla_visitor_ctx *tracer_ctx,
- void *app_ctx);
union side_integer_value {
uint8_t side_u8;
union side_float_value {
#if __HAVE_FLOAT16
- _Float16 side_float_binary16;
+ _Float16 side_float_binary16;
#endif
#if __HAVE_FLOAT32
- _Float32 side_float_binary32;
+ _Float32 side_float_binary32;
#endif
#if __HAVE_FLOAT64
- _Float64 side_float_binary64;
+ _Float64 side_float_binary64;
#endif
#if __HAVE_FLOAT128
- _Float128 side_float_binary128;
+ _Float128 side_float_binary128;
#endif
} SIDE_PACKED;
struct side_type_float {
const struct side_attr *attr;
uint32_t nr_attr;
- uint32_t byte_order; /* enum side_type_label_byte_order */
uint16_t float_size_bits; /* bits */
+ uint8_t byte_order; /* enum side_type_label_byte_order */
} SIDE_PACKED;
struct side_enum_mapping {
} SIDE_PACKED;
struct side_type_struct {
+ const struct side_event_field *fields;
+ const struct side_attr *attr;
uint32_t nr_fields;
uint32_t nr_attr;
- const struct side_event_field *fields;
+} SIDE_PACKED;
+
+struct side_type_array {
+ const struct side_type *elem_type;
+ const struct side_attr *attr;
+ uint32_t length;
+ uint32_t nr_attr;
+} SIDE_PACKED;
+
+struct side_type_vla {
+ const struct side_type *elem_type;
+ const struct side_attr *attr;
+ uint32_t nr_attr;
+} SIDE_PACKED;
+
+struct side_type_vla_visitor {
+ const struct side_type *elem_type;
+ side_visitor_func visitor;
const struct side_attr *attr;
+ uint32_t nr_attr;
+} SIDE_PACKED;
+
+struct side_type_enum {
+ const struct side_enum_mappings *mappings;
+ const struct side_type *elem_type;
+} SIDE_PACKED;
+
+struct side_type_enum_bitmap {
+ const struct side_enum_bitmap_mappings *mappings;
+ const struct side_type *elem_type;
+} SIDE_PACKED;
+
+struct side_type_sg_integer {
+ struct side_type_integer type;
+ uint16_t offset_bits; /* bits */
} SIDE_PACKED;
struct side_type_sg {
uint64_t offset; /* bytes */
union {
- struct {
- struct side_type_integer type;
- uint16_t offset_bits; /* bits */
- } SIDE_PACKED side_integer;
+ struct side_type_sg_integer side_integer;
+ struct side_type_float side_float;
const struct side_type_struct *side_struct;
} SIDE_PACKED u;
} SIDE_PACKED;
struct side_type_float side_float;
/* Compound types */
- struct {
- const struct side_type *elem_type;
- const struct side_attr *attr;
- uint32_t length;
- uint32_t nr_attr;
- } SIDE_PACKED side_array;
- struct {
- const struct side_type *elem_type;
- const struct side_attr *attr;
- uint32_t nr_attr;
- } SIDE_PACKED side_vla;
- struct {
- const struct side_type *elem_type;
- side_visitor visitor;
- const struct side_attr *attr;
- uint32_t nr_attr;
- } SIDE_PACKED side_vla_visitor;
+ struct side_type_array side_array;
+ struct side_type_vla side_vla;
+ struct side_type_vla_visitor side_vla_visitor;
const struct side_type_struct *side_struct;
/* Enumeration types */
- struct {
- const struct side_enum_mappings *mappings;
- const struct side_type *elem_type;
- } SIDE_PACKED side_enum;
- struct {
- const struct side_enum_bitmap_mappings *mappings;
- const struct side_type *elem_type;
- } SIDE_PACKED side_enum_bitmap;
-
- /* Scatter-gather type */
+ struct side_type_enum side_enum;
+ struct side_type_enum_bitmap side_enum_bitmap;
+
+ /* Scatter-gather types */
struct side_type_sg side_sg;
} SIDE_PACKED u;
} SIDE_PACKED;
void *priv);
void (*call_variadic)(const struct side_event_description *desc,
const struct side_arg_vec *side_arg_vec,
- const struct side_arg_dynamic_event_struct *var_struct,
+ const struct side_arg_dynamic_struct *var_struct,
void *priv);
} SIDE_PACKED u;
void *priv;
/* Scatter-gather */
void *side_integer_sg_ptr;
+ void *side_float_sg_ptr;
void *side_struct_sg_ptr;
} SIDE_PACKED;
+struct side_arg_dynamic_vla {
+ const struct side_arg *sav;
+ const struct side_attr *attr;
+ uint32_t len;
+ uint32_t nr_attr;
+} SIDE_PACKED;
+
+struct side_arg_dynamic_struct {
+ const struct side_arg_dynamic_field *fields;
+ const struct side_attr *attr;
+ uint32_t len;
+ uint32_t nr_attr;
+} SIDE_PACKED;
+
+struct side_dynamic_struct_visitor {
+ void *app_ctx;
+ side_dynamic_struct_visitor_func visitor;
+ const struct side_attr *attr;
+ uint32_t nr_attr;
+} SIDE_PACKED;
+
+struct side_dynamic_vla_visitor {
+ void *app_ctx;
+ side_visitor_func visitor;
+ const struct side_attr *attr;
+ uint32_t nr_attr;
+} SIDE_PACKED;
+
struct side_arg_dynamic {
/* Basic types */
struct side_type_null side_null;
} SIDE_PACKED side_float;
/* Compound types */
- const struct side_arg_dynamic_event_struct *side_dynamic_struct;
- struct {
- void *app_ctx;
- side_dynamic_struct_visitor visitor;
- const struct side_attr *attr;
- uint32_t nr_attr;
- } SIDE_PACKED side_dynamic_struct_visitor;
+ const struct side_arg_dynamic_struct *side_dynamic_struct;
const struct side_arg_dynamic_vla *side_dynamic_vla;
- struct {
- void *app_ctx;
- side_dynamic_vla_visitor visitor;
- const struct side_attr *attr;
- uint32_t nr_attr;
- } SIDE_PACKED side_dynamic_vla_visitor;
+
+ struct side_dynamic_struct_visitor side_dynamic_struct_visitor;
+ struct side_dynamic_vla_visitor side_dynamic_vla_visitor;
} SIDE_PACKED;
struct side_arg {
uint32_t len;
} SIDE_PACKED;
-struct side_event_description {
- uintptr_t *enabled;
- const char *provider_name;
- const char *event_name;
- const struct side_event_field *fields;
- const struct side_attr *attr;
- const struct side_callback *callbacks;
- uint64_t flags;
- uint32_t version;
- uint32_t loglevel; /* enum side_loglevel */
- uint32_t nr_fields;
- uint32_t nr_attr;
- uint32_t nr_callbacks;
-} SIDE_PACKED;
-
-struct side_arg_dynamic_vla {
- const struct side_arg *sav;
- const struct side_attr *attr;
- uint32_t len;
- uint32_t nr_attr;
-} SIDE_PACKED;
-
-struct side_arg_dynamic_event_field {
+struct side_arg_dynamic_field {
const char *field_name;
const struct side_arg elem;
} SIDE_PACKED;
-struct side_arg_dynamic_event_struct {
- const struct side_arg_dynamic_event_field *fields;
- const struct side_attr *attr;
- uint32_t len;
- uint32_t nr_attr;
-} SIDE_PACKED;
-
/* The visitor pattern is a double-dispatch visitor. */
struct side_tracer_visitor_ctx {
enum side_visitor_status (*write_elem)(
struct side_tracer_dynamic_struct_visitor_ctx {
enum side_visitor_status (*write_field)(
const struct side_tracer_dynamic_struct_visitor_ctx *tracer_ctx,
- const struct side_arg_dynamic_event_field *dynamic_field);
+ const struct side_arg_dynamic_field *dynamic_field);
void *priv; /* Private tracer context. */
} SIDE_PACKED;
-struct side_tracer_dynamic_vla_visitor_ctx {
- enum side_visitor_status (*write_elem)(
- const struct side_tracer_dynamic_vla_visitor_ctx *tracer_ctx,
- const struct side_arg *elem);
- void *priv; /* Private tracer context. */
+struct side_event_description {
+ uintptr_t *enabled;
+ const char *provider_name;
+ const char *event_name;
+ const struct side_event_field *fields;
+ const struct side_attr *attr;
+ const struct side_callback *callbacks;
+ uint64_t flags;
+ uint32_t version;
+ uint32_t loglevel; /* enum side_loglevel */
+ uint32_t nr_fields;
+ uint32_t nr_attr;
+ uint32_t nr_callbacks;
} SIDE_PACKED;
/* Event and type attributes */
.side_float = { \
.attr = _attr, \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
- .byte_order = _byte_order, \
.float_size_bits = _float_size_bits, \
+ .byte_order = _byte_order, \
}, \
}, \
}
#define _side_type_struct_define(_fields, _attr) \
{ \
- .nr_fields = SIDE_ARRAY_SIZE(SIDE_PARAM(_fields)), \
- .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
.fields = _fields, \
.attr = _attr, \
+ .nr_fields = SIDE_ARRAY_SIZE(SIDE_PARAM(_fields)), \
+ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
}
#define side_define_struct(_identifier, _fields, _attr) \
_side_type_sg_integer(SIDE_TYPE_SG_SIGNED_INT, true, SIDE_TYPE_BYTE_ORDER_HOST, \
_integer_offset, _integer_size_bits, _offset_bits, _len_bits, SIDE_PARAM(_attr))
+#define side_type_sg_unsigned_integer_le(_integer_offset, _integer_size_bits, _offset_bits, _len_bits, _attr) \
+ _side_type_sg_integer(SIDE_TYPE_SG_UNSIGNED_INT, false, SIDE_TYPE_BYTE_ORDER_LE, \
+ _integer_offset, _integer_size_bits, _offset_bits, _len_bits, SIDE_PARAM(_attr))
+#define side_type_sg_signed_integer_le(_integer_offset, _integer_size_bits, _offset_bits, _len_bits, _attr) \
+ _side_type_sg_integer(SIDE_TYPE_SG_SIGNED_INT, true, SIDE_TYPE_BYTE_ORDER_LE, \
+ _integer_offset, _integer_size_bits, _offset_bits, _len_bits, SIDE_PARAM(_attr))
+
+#define side_type_sg_unsigned_integer_be(_integer_offset, _integer_size_bits, _offset_bits, _len_bits, _attr) \
+ _side_type_sg_integer(SIDE_TYPE_SG_UNSIGNED_INT, false, SIDE_TYPE_BYTE_ORDER_BE, \
+ _integer_offset, _integer_size_bits, _offset_bits, _len_bits, SIDE_PARAM(_attr))
+#define side_type_sg_signed_integer_be(_integer_offset, _integer_size_bits, _offset_bits, _len_bits, _attr) \
+ _side_type_sg_integer(SIDE_TYPE_SG_SIGNED_INT, true, SIDE_TYPE_BYTE_ORDER_BE, \
+ _integer_offset, _integer_size_bits, _offset_bits, _len_bits, SIDE_PARAM(_attr))
+
#define side_field_sg_unsigned_integer(_name, _integer_offset, _integer_size_bits, _offset_bits, _len_bits, _attr) \
_side_field(_name, side_type_sg_unsigned_integer(_integer_offset, _integer_size_bits, _offset_bits, _len_bits, SIDE_PARAM(_attr)))
#define side_field_sg_signed_integer(_name, _integer_offset, _integer_size_bits, _offset_bits, _len_bits, _attr) \
_side_field(_name, side_type_sg_signed_integer(_integer_offset, _integer_size_bits, _offset_bits, _len_bits, SIDE_PARAM(_attr)))
-#define side_type_struct_sg(_struct_sg, _offset) \
+#define side_field_sg_unsigned_integer_le(_name, _integer_offset, _integer_size_bits, _offset_bits, _len_bits, _attr) \
+ _side_field(_name, side_type_sg_unsigned_integer_le(_integer_offset, _integer_size_bits, _offset_bits, _len_bits, SIDE_PARAM(_attr)))
+#define side_field_sg_signed_integer_le(_name, _integer_offset, _integer_size_bits, _offset_bits, _len_bits, _attr) \
+ _side_field(_name, side_type_sg_signed_integer_le(_integer_offset, _integer_size_bits, _offset_bits, _len_bits, SIDE_PARAM(_attr)))
+
+#define side_field_sg_unsigned_integer_be(_name, _integer_offset, _integer_size_bits, _offset_bits, _len_bits, _attr) \
+ _side_field(_name, side_type_sg_unsigned_integer_be(_integer_offset, _integer_size_bits, _offset_bits, _len_bits, SIDE_PARAM(_attr)))
+#define side_field_sg_signed_integer_be(_name, _integer_offset, _integer_size_bits, _offset_bits, _len_bits, _attr) \
+ _side_field(_name, side_type_sg_signed_integer_be(_integer_offset, _integer_size_bits, _offset_bits, _len_bits, SIDE_PARAM(_attr)))
+
+#define _side_type_sg_float(_byte_order, _offset, _float_size_bits, _attr) \
{ \
- .type = SIDE_TYPE_STRUCT_SG, \
+ .type = SIDE_TYPE_SG_FLOAT, \
+ .u = { \
+ .side_sg = { \
+ .offset = _offset, \
+ .u = { \
+ .side_float = { \
+ .attr = _attr, \
+ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .float_size_bits = _float_size_bits, \
+ .byte_order = _byte_order, \
+ }, \
+ }, \
+ }, \
+ }, \
+ }
+
+#define side_type_sg_float(_offset, _float_size_bits, _attr) \
+ _side_type_sg_float(SIDE_TYPE_FLOAT_WORD_ORDER_HOST, _offset, _float_size_bits, _attr)
+#define side_type_sg_float_le(_offset, _float_size_bits, _attr) \
+ _side_type_sg_float(SIDE_TYPE_BYTE_ORDER_LE, _offset, _float_size_bits, _attr)
+#define side_type_sg_float_be(_offset, _float_size_bits, _attr) \
+ _side_type_sg_float(SIDE_TYPE_BYTE_ORDER_BE, _offset, _float_size_bits, _attr)
+
+#define side_field_sg_float(_name, _offset, _float_size_bits, _attr) \
+ _side_field(_name, side_type_sg_float(_offset, _float_size_bits, _attr))
+#define side_field_sg_float_le(_name, _offset, _float_size_bits, _attr) \
+ _side_field(_name, side_type_sg_float_le(_offset, _float_size_bits, _attr))
+#define side_field_sg_float_be(_name, _offset, _float_size_bits, _attr) \
+ _side_field(_name, side_type_sg_float_be(_offset, _float_size_bits, _attr))
+
+#define side_type_sg_struct(_struct_sg, _offset) \
+ { \
+ .type = SIDE_TYPE_SG_STRUCT, \
.u = { \
.side_sg = { \
.offset = _offset, \
}, \
}, \
}
-#define side_field_struct_sg(_name, _struct_sg, _offset) \
- _side_field(_name, side_type_struct_sg(SIDE_PARAM(_struct_sg), _offset))
+#define side_field_sg_struct(_name, _struct_sg, _offset) \
+ _side_field(_name, side_type_sg_struct(SIDE_PARAM(_struct_sg), _offset))
#define side_type_array(_elem_type, _length, _attr) \
{ \
#define side_arg_float_binary128(_val) { .type = SIDE_TYPE_FLOAT_BINARY128, .u = { .side_static = { .float_value = { .side_float_binary128 = (_val) } } } }
#define side_arg_struct(_side_type) { .type = SIDE_TYPE_STRUCT, .u = { .side_static = { .side_struct = (_side_type) } } }
-#define side_arg_struct_sg(_ptr) { .type = SIDE_TYPE_STRUCT_SG, .u = { .side_static = { .side_struct_sg_ptr = (_ptr) } } }
-#define side_arg_unsigned_integer_sg(_ptr) { .type = SIDE_TYPE_SG_UNSIGNED_INT, .u = { .side_static = { .side_integer_sg_ptr = (_ptr) } } }
-#define side_arg_signed_integer_sg(_ptr) { .type = SIDE_TYPE_SG_SIGNED_INT, .u = { .side_static = { .side_integer_sg_ptr = (_ptr) } } }
+#define side_arg_sg_struct(_ptr) { .type = SIDE_TYPE_SG_STRUCT, .u = { .side_static = { .side_struct_sg_ptr = (_ptr) } } }
+#define side_arg_sg_unsigned_integer(_ptr) { .type = SIDE_TYPE_SG_UNSIGNED_INT, .u = { .side_static = { .side_integer_sg_ptr = (_ptr) } } }
+#define side_arg_sg_signed_integer(_ptr) { .type = SIDE_TYPE_SG_SIGNED_INT, .u = { .side_static = { .side_integer_sg_ptr = (_ptr) } } }
+#define side_arg_sg_float(_ptr) { .type = SIDE_TYPE_SG_FLOAT, .u = { .side_static = { .side_float_sg_ptr = (_ptr) } } }
#define side_arg_array(_side_type) { .type = SIDE_TYPE_ARRAY, .u = { .side_static = { .side_array = (_side_type) } } }
#define side_arg_vla(_side_type) { .type = SIDE_TYPE_VLA, .u = { .side_static = { .side_vla = (_side_type) } } }
#define side_arg_vla_visitor(_ctx) { .type = SIDE_TYPE_VLA_VISITOR, .u = { .side_static = { .side_vla_app_visitor_ctx = (_ctx) } } }
.type = { \
.attr = _attr, \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
- .byte_order = _byte_order, \
.float_size_bits = _float_size_bits, \
+ .byte_order = _byte_order, \
}, \
.value = { \
_field = (_val), \
}
#define side_arg_dynamic_define_struct(_identifier, _struct_fields, _attr) \
- const struct side_arg_dynamic_event_field _identifier##_fields[] = { _struct_fields }; \
- const struct side_arg_dynamic_event_struct _identifier = { \
+ const struct side_arg_dynamic_field _identifier##_fields[] = { _struct_fields }; \
+ const struct side_arg_dynamic_struct _identifier = { \
.fields = _identifier##_fields, \
.attr = _attr, \
.len = SIDE_ARRAY_SIZE(_identifier##_fields), \
.sav = side_sav, \
.len = SIDE_ARRAY_SIZE(side_sav), \
}; \
- const struct side_arg_dynamic_event_field side_fields[] = { _var_fields }; \
- const struct side_arg_dynamic_event_struct var_struct = { \
+ const struct side_arg_dynamic_field side_fields[] = { _var_fields }; \
+ const struct side_arg_dynamic_struct var_struct = { \
.fields = side_fields, \
.attr = _attr, \
.len = SIDE_ARRAY_SIZE(side_fields), \
SIDE_PARAM(_attr), SIDE_EVENT_FLAG_VARIADIC)
#define side_hidden_event(_identifier, _provider, _event, _loglevel, _fields, _attr) \
- _side_define_event(__attribute__((visibility("hidden"))), _identifier, _provider, _event, _loglevel, SIDE_PARAM(_fields), \
- SIDE_PARAM(_attr), 0)
+ _side_define_event(__attribute__((visibility("hidden"))), _identifier, _provider, _event, \
+ _loglevel, SIDE_PARAM(_fields), SIDE_PARAM(_attr), 0)
#define side_hidden_event_variadic(_identifier, _provider, _event, _loglevel, _fields, _attr) \
- _side_define_event(__attribute__((visibility("hidden"))), _identifier, _provider, _event, _loglevel, SIDE_PARAM(_fields), \
- SIDE_PARAM(_attr), SIDE_EVENT_FLAG_VARIADIC)
+ _side_define_event(__attribute__((visibility("hidden"))), _identifier, _provider, _event, \
+ _loglevel, SIDE_PARAM(_fields), SIDE_PARAM(_attr), SIDE_EVENT_FLAG_VARIADIC)
#define side_export_event(_identifier, _provider, _event, _loglevel, _fields, _attr) \
- _side_define_event(__attribute__((visibility("default"))), _identifier, _provider, _event, _loglevel, SIDE_PARAM(_fields), \
- SIDE_PARAM(_attr), 0)
+ _side_define_event(__attribute__((visibility("default"))), _identifier, _provider, _event, \
+ _loglevel, SIDE_PARAM(_fields), SIDE_PARAM(_attr), 0)
#define side_export_event_variadic(_identifier, _provider, _event, _loglevel, _fields, _attr) \
- _side_define_event(__attribute__((visibility("default"))), _identifier, _provider, _event, _loglevel, SIDE_PARAM(_fields), \
- SIDE_PARAM(_attr), SIDE_EVENT_FLAG_VARIADIC)
+ _side_define_event(__attribute__((visibility("default"))), _identifier, _provider, _event, \
+ _loglevel, SIDE_PARAM(_fields), SIDE_PARAM(_attr), SIDE_EVENT_FLAG_VARIADIC)
#define side_declare_event(_identifier) \
extern uintptr_t side_event_enable_##_identifier; \
const struct side_arg_vec *side_arg_vec);
void side_call_variadic(const struct side_event_description *desc,
const struct side_arg_vec *side_arg_vec,
- const struct side_arg_dynamic_event_struct *var_struct);
+ const struct side_arg_dynamic_struct *var_struct);
int side_tracer_callback_register(struct side_event_description *desc,
void (*call)(const struct side_event_description *desc,
int side_tracer_callback_variadic_register(struct side_event_description *desc,
void (*call_variadic)(const struct side_event_description *desc,
const struct side_arg_vec *side_arg_vec,
- const struct side_arg_dynamic_event_struct *var_struct,
+ const struct side_arg_dynamic_struct *var_struct,
void *priv),
void *priv);
int side_tracer_callback_unregister(struct side_event_description *desc,
int side_tracer_callback_variadic_unregister(struct side_event_description *desc,
void (*call_variadic)(const struct side_event_description *desc,
const struct side_arg_vec *side_arg_vec,
- const struct side_arg_dynamic_event_struct *var_struct,
+ const struct side_arg_dynamic_struct *var_struct,
void *priv),
void *priv);
-struct side_events_register_handle *side_events_register(struct side_event_description **events, uint32_t nr_events);
+struct side_events_register_handle *side_events_register(struct side_event_description **events,
+ uint32_t nr_events);
void side_events_unregister(struct side_events_register_handle *handle);
enum side_tracer_notification {