Refactor enumeration, sequence, array, structure, and variant types.
Implement internal data structures to support nested types.
All probe providers using ctf_enum(), ctf_array*() and ctf_sequence*()
are switched to this new internal type representation.
Each of sequence, array, struct and variant gain a "alignment" property,
which is a feature which was needed in lttng-modules to express
alignment for an array or sequence of bits.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
[0] = {
.name = "unknown",
.type = {
- .atype = atype_struct,
- .u._struct.nr_fields = ARRAY_SIZE(emptyfields),
- .u._struct.fields = emptyfields,
+ .atype = atype_struct_nestable,
+ .u.struct_nestable.nr_fields = ARRAY_SIZE(emptyfields),
+ .u.struct_nestable.fields = emptyfields,
+ .u.struct_nestable.alignment = 0,
},
+ .nofilter = 1,
},
[1] = {
.name = "tcp",
.type = {
- .atype = atype_struct,
- .u._struct.nr_fields = ARRAY_SIZE(tcpfields),
- .u._struct.fields = tcpfields,
+ .atype = atype_struct_nestable,
+ .u.struct_nestable.nr_fields = ARRAY_SIZE(tcpfields),
+ .u.struct_nestable.fields = tcpfields,
+ .u.struct_nestable.alignment = 0,
},
+ .nofilter = 1,
},
[2] = {
.name = "udp",
.type = {
- .atype = atype_struct,
- .u._struct.nr_fields = ARRAY_SIZE(udpfields),
- .u._struct.fields = udpfields,
+ .atype = atype_struct_nestable,
+ .u.struct_nestable.nr_fields = ARRAY_SIZE(udpfields),
+ .u.struct_nestable.fields = udpfields,
+ .u.struct_nestable.alignment = 0,
},
+ .nofilter = 1,
},
[3] = {
.name = "icmp",
.type = {
- .atype = atype_struct,
- .u._struct.nr_fields = ARRAY_SIZE(icmpfields),
- .u._struct.fields = icmpfields,
+ .atype = atype_struct_nestable,
+ .u.struct_nestable.nr_fields = ARRAY_SIZE(icmpfields),
+ .u.struct_nestable.fields = icmpfields,
+ .u.struct_nestable.alignment = 0,
},
+ .nofilter = 1,
},
};
[7] = {
.name = "protocol",
.type = {
- .atype = atype_enum,
- .u.basic.enumeration.desc =
+ .atype = atype_enum_nestable,
+ .u.enum_nestable.desc =
&proto_transport_header_type,
- .u.basic.enumeration.container_type = {
- .size = 8,
- .alignment = 8,
- .signedness = 0,
- .reverse_byte_order =
- __BIG_ENDIAN != __BYTE_ORDER,
- .base = 10,
- .encoding = lttng_encode_none,
- },
+ .u.enum_nestable.container_type =
+ __LTTNG_COMPOUND_LITERAL(struct lttng_type,
+ __type_integer(uint8_t, 0, 0, -1,
+ __BIG_ENDIAN, 10, none)),
},
},
[8] = {
[9] = {
.name = "saddr",
.type = {
- .atype = atype_array,
- .u.array.elem_type =
- __type_integer(uint8_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- .u.array.length = 4,
- .u.array.elem_alignment = lttng_alignof(uint8_t),
+ .atype = atype_array_nestable,
+ .u.array_nestable.elem_type =
+ __LTTNG_COMPOUND_LITERAL(struct lttng_type,
+ __type_integer(uint8_t, 0, 0, 0,
+ __BIG_ENDIAN, 10, none)),
+ .u.array_nestable.length = 4,
+ .u.array_nestable.alignment = lttng_alignof(uint8_t),
},
},
[10] = {
.name = "daddr",
.type = {
- .atype = atype_array,
- .u.array.elem_type =
- __type_integer(uint8_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- .u.array.length = 4,
- .u.array.elem_alignment = lttng_alignof(uint8_t),
+ .atype = atype_array_nestable,
+ .u.array_nestable.elem_type =
+ __LTTNG_COMPOUND_LITERAL(struct lttng_type,
+ __type_integer(uint8_t, 0, 0, 0,
+ __BIG_ENDIAN, 10, none)),
+ .u.array_nestable.length = 4,
+ .u.array_nestable.alignment = lttng_alignof(uint8_t),
},
},
[11] = {
.name = "transport_header_type",
.type = {
- .atype = atype_enum,
- .u.basic.enumeration.desc = &transport_header_type,
- .u.basic.enumeration.container_type = {
- .size = 8,
- .alignment = 8,
- .signedness = 0,
- .reverse_byte_order = 0,
- .base = 10,
- .encoding = lttng_encode_none,
- },
+ .atype = atype_enum_nestable,
+ .u.enum_nestable.desc = &transport_header_type,
+ .u.enum_nestable.container_type =
+ __LTTNG_COMPOUND_LITERAL(struct lttng_type,
+ __type_integer(uint8_t, 0, 0, -1,
+ __BYTE_ORDER, 10, none)),
},
},
[12] = {
.name = "transport_header",
.type = {
- .atype = atype_variant,
- .u.variant.tag_name = "transport_header_type",
- .u.variant.choices = transport_fields,
- .u.variant.nr_choices = ARRAY_SIZE(transport_fields),
+ .atype = atype_variant_nestable,
+ .u.variant_nestable.tag_name = "transport_header_type",
+ .u.variant_nestable.choices = transport_fields,
+ .u.variant_nestable.nr_choices = ARRAY_SIZE(transport_fields),
+ .u.variant_nestable.alignment = 0,
},
},
};
[2] = {
.name = "flow_lbl",
.type = {
- .atype = atype_array,
- .u.array.elem_type =
- __type_integer(uint8_t, 0, 0, 0,
- __BIG_ENDIAN, 16, none),
- .u.array.length = 3,
- .u.array.elem_alignment = lttng_alignof(uint8_t),
+ .atype = atype_array_nestable,
+ .u.array_nestable.elem_type =
+ __LTTNG_COMPOUND_LITERAL(struct lttng_type,
+ __type_integer(uint8_t, 0, 0, 0,
+ __BIG_ENDIAN, 16, none)),
+ .u.array_nestable.length = 3,
+ .u.array_nestable.alignment = lttng_alignof(uint8_t),
},
},
[3] = {
[4] = {
.name = "nexthdr",
.type = {
- .atype = atype_enum,
- .u.basic.enumeration.desc =
+ .atype = atype_enum_nestable,
+ .u.enum_nestable.desc =
&proto_transport_header_type,
- .u.basic.enumeration.container_type = {
- .size = 8,
- .alignment = 8,
- .signedness = 0,
- .reverse_byte_order =
- __BIG_ENDIAN != __BYTE_ORDER,
- .base = 10,
- .encoding = lttng_encode_none,
- },
+ .u.enum_nestable.container_type =
+ __LTTNG_COMPOUND_LITERAL(struct lttng_type,
+ __type_integer(uint8_t, 0, 0, -1,
+ __BIG_ENDIAN, 10, none)),
},
},
[5] = {
[6] = {
.name = "saddr",
.type = {
- .atype = atype_array,
- .u.array.elem_type =
- __type_integer(uint16_t, 0, 0, 0,
- __BIG_ENDIAN, 16, none),
- .u.array.length = 8,
- .u.array.elem_alignment = lttng_alignof(uint16_t),
+ .atype = atype_array_nestable,
+ .u.array_nestable.elem_type =
+ __LTTNG_COMPOUND_LITERAL(struct lttng_type,
+ __type_integer(uint16_t, 0, 0, 0,
+ __BIG_ENDIAN, 16, none)),
+ .u.array_nestable.length = 8,
+ .u.array_nestable.alignment = lttng_alignof(uint16_t),
},
},
[7] = {
.name = "daddr",
.type = {
- .atype = atype_array,
- .u.array.elem_type =
- __type_integer(uint16_t, 0, 0, 0,
- __BIG_ENDIAN, 16, none),
- .u.array.length = 8,
- .u.array.elem_alignment = lttng_alignof(uint16_t),
+ .atype = atype_array_nestable,
+ .u.array_nestable.elem_type =
+ __LTTNG_COMPOUND_LITERAL(struct lttng_type,
+ __type_integer(uint16_t, 0, 0, 0,
+ __BIG_ENDIAN, 16, none)),
+ .u.array_nestable.length = 8,
+ .u.array_nestable.alignment = lttng_alignof(uint16_t),
},
},
[8] = {
.name = "transport_header_type",
.type = {
- .atype = atype_enum,
- .u.basic.enumeration.desc = &transport_header_type,
- .u.basic.enumeration.container_type = {
- .size = 8,
- .alignment = 8,
- .signedness = 0,
- .reverse_byte_order = 0,
- .base = 10,
- .encoding = lttng_encode_none,
- },
+ .atype = atype_enum_nestable,
+ .u.enum_nestable.desc = &transport_header_type,
+ .u.enum_nestable.container_type =
+ __LTTNG_COMPOUND_LITERAL(struct lttng_type,
+ __type_integer(uint8_t, 0, 0, -1,
+ __BYTE_ORDER, 10, none)),
},
},
[9] = {
.name = "transport_header",
.type = {
- .atype = atype_variant,
- .u.variant.tag_name = "transport_header_type",
- .u.variant.choices = transport_fields,
- .u.variant.nr_choices = ARRAY_SIZE(transport_fields),
+ .atype = atype_variant_nestable,
+ .u.variant_nestable.tag_name = "transport_header_type",
+ .u.variant_nestable.choices = transport_fields,
+ .u.variant_nestable.nr_choices = ARRAY_SIZE(transport_fields),
+ .u.variant_nestable.alignment = 0,
},
},
};
[0] = {
.name = "unknown",
.type = {
- .atype = atype_struct,
- .u._struct.nr_fields = 0,
- .u._struct.fields = emptyfields,
+ .atype = atype_struct_nestable,
+ .u.struct_nestable.nr_fields = 0,
+ .u.struct_nestable.fields = emptyfields,
+ .u.struct_nestable.alignment = 0,
},
},
[1] = {
.name = "ipv4",
.type = {
- .atype = atype_struct,
- .u._struct.nr_fields = ARRAY_SIZE(ipv4fields),
- .u._struct.fields = ipv4fields,
+ .atype = atype_struct_nestable,
+ .u.struct_nestable.nr_fields = ARRAY_SIZE(ipv4fields),
+ .u.struct_nestable.fields = ipv4fields,
+ .u.struct_nestable.alignment = 0,
},
},
[2] = {
.name = "ipv6",
.type = {
- .atype = atype_struct,
- .u._struct.nr_fields = ARRAY_SIZE(ipv6fields),
- .u._struct.fields = ipv6fields,
+ .atype = atype_struct_nestable,
+ .u.struct_nestable.nr_fields = ARRAY_SIZE(ipv6fields),
+ .u.struct_nestable.fields = ipv6fields,
+ .u.struct_nestable.alignment = 0,
},
},
};
network_header_type, __get_network_header_type(skb))
ctf_custom_field(
ctf_custom_type(
- .atype = atype_variant,
- .u.variant.tag_name = "network_header_type",
- .u.variant.choices = network_fields,
- .u.variant.nr_choices =
- ARRAY_SIZE(network_fields),
+ {
+ .atype = atype_variant_nestable,
+ .u.variant_nestable.tag_name = "network_header_type",
+ .u.variant_nestable.choices = network_fields,
+ .u.variant_nestable.nr_choices =
+ ARRAY_SIZE(network_fields),
+ .u.variant_nestable.alignment = 0,
+ }
),
network_header,
ctf_custom_code(
#define LTTNG_SYSCALL_SELECT_fds_field_LE(name, input) \
ctf_custom_field( \
ctf_custom_type( \
- .atype = atype_sequence, \
- .u.sequence.length_type = __type_integer( \
- uint8_t, 0, 0, 0, __BYTE_ORDER, 10, none), \
- .u.sequence.elem_type = __type_integer(uint8_t, 0, 0, 0, \
- __BYTE_ORDER, 16, none), \
+ __type_integer(uint8_t, 0, 0, 0, __BYTE_ORDER, 10, none) \
), \
- name, \
+ _ ## name ## _length, \
ctf_custom_code( \
- unsigned int src; \
- unsigned int nr_bytes_out = 0; \
- \
if (input) { \
ctf_integer_type(uint8_t, tp_locvar->nr_bytes) \
ctf_align(uint8_t) \
} else { \
ctf_integer_type(uint8_t, 0) \
ctf_align(uint8_t) \
- goto skip_##name; \
} \
+ ) \
+ ) \
+ ctf_custom_field( \
+ ctf_custom_type( \
+ { \
+ .atype = atype_sequence_nestable, \
+ .u.sequence_nestable.length_name = "_" #name "_length", \
+ .u.sequence_nestable.elem_type = __LTTNG_COMPOUND_LITERAL(struct lttng_type, \
+ __type_integer(uint8_t, 0, 0, 0, __BYTE_ORDER, 16, none)), \
+ .u.sequence_nestable.alignment = 0, \
+ } \
+ ), \
+ name, \
+ ctf_custom_code( \
+ unsigned int src; \
+ unsigned int nr_bytes_out = 0; \
+ \
+ if (!input) \
+ goto skip_##name; \
\
for (src = 0; src < tp_locvar->nr_ulong; src++) { \
int dst; \
#define LTTNG_SYSCALL_SELECT_fds_field_BE(name, input) \
ctf_custom_field( \
ctf_custom_type( \
- .atype = atype_sequence, \
- .u.sequence.length_type = __type_integer( \
- uint8_t, 0, 0, 0, __BYTE_ORDER, 10, none), \
- .u.sequence.elem_type = __type_integer(uint8_t, 0, 0, 0, \
- __BYTE_ORDER, 16, none), \
+ __type_integer(uint8_t, 0, 0, 0, __BYTE_ORDER, 10, none) \
), \
- name, \
+ _ ## name ## _length, \
ctf_custom_code( \
- unsigned int src, nr_bytes_out = 0; \
- \
if (input) { \
ctf_integer_type(uint8_t, tp_locvar->nr_bytes) \
ctf_align(uint8_t) \
} else { \
ctf_integer_type(uint8_t, 0) \
ctf_align(uint8_t) \
- goto skip_##name; \
} \
+ ) \
+ ) \
+ ctf_custom_field( \
+ ctf_custom_type( \
+ { \
+ .atype = atype_sequence_nestable, \
+ .u.sequence_nestable.elem_type = __LTTNG_COMPOUND_LITERAL(struct lttng_type, \
+ __type_integer(uint8_t, 0, 0, 0, __BYTE_ORDER, 16, none)), \
+ .u.sequence_nestable.alignment = 0, \
+ } \
+ ), \
+ name, \
+ ctf_custom_code( \
+ unsigned int src, nr_bytes_out = 0; \
+ \
+ if (!input) \
+ goto skip_##name; \
\
for (src = 0; src < tp_locvar->nr_ulong; src++) { \
int dst; \
[2] = {
.name = "events",
.type = {
- .atype = atype_struct,
- .u._struct.nr_fields = ARRAY_SIZE(lttng_pollfd_flag_fields),
- .u._struct.fields = lttng_pollfd_flag_fields,
+ .atype = atype_struct_nestable,
+ .u.struct_nestable.nr_fields = ARRAY_SIZE(lttng_pollfd_flag_fields),
+ .u.struct_nestable.fields = lttng_pollfd_flag_fields,
+ .u.struct_nestable.alignment = 0,
}
},
};
static struct lttng_type lttng_pollfd_elem = {
- .atype = atype_struct,
- .u._struct.nr_fields = ARRAY_SIZE(lttng_pollfd_fields),
- .u._struct.fields = lttng_pollfd_fields,
+ .atype = atype_struct_nestable,
+ .u.struct_nestable.nr_fields = ARRAY_SIZE(lttng_pollfd_fields),
+ .u.struct_nestable.fields = lttng_pollfd_fields,
+ .u.struct_nestable.alignment = 0,
};
#endif /* ONCE_LTTNG_TRACE_POLL_H */
sc_in( \
ctf_custom_field( \
ctf_custom_type( \
- .atype = atype_sequence_compound, \
- .u.sequence_compound.length_name = "fds_length", \
- .u.sequence_compound.elem_type = <tng_pollfd_elem, \
+ { \
+ .atype = atype_sequence_nestable, \
+ .u.sequence_nestable.length_name = "fds_length", \
+ .u.sequence_nestable.elem_type = <tng_pollfd_elem, \
+ } \
), \
fds, \
ctf_custom_code( \
sc_out( \
ctf_custom_field( \
ctf_custom_type( \
- .atype = atype_sequence_compound, \
- .u.sequence_compound.length_name = "fds_length", \
- .u.sequence_compound.elem_type = <tng_pollfd_elem, \
+ { \
+ .atype = atype_sequence_nestable, \
+ .u.sequence_nestable.length_name = "fds_length", \
+ .u.sequence_nestable.elem_type = <tng_pollfd_elem, \
+ } \
), \
fds, \
ctf_custom_code( \
[0] = {
.name = "data_union",
.type = {
- .atype = atype_struct,
- .u._struct.nr_fields = ARRAY_SIZE(lttng_epoll_data_fields),
- .u._struct.fields = lttng_epoll_data_fields,
+ .atype = atype_struct_nestable,
+ .u.struct_nestable.nr_fields = ARRAY_SIZE(lttng_epoll_data_fields),
+ .u.struct_nestable.fields = lttng_epoll_data_fields,
+ .u.struct_nestable.alignment = 0,
}
},
[1] = {
[2] = {
.name = "events",
.type = {
- .atype = atype_struct,
- .u._struct.nr_fields = ARRAY_SIZE(lttng_epoll_ctl_events_fields),
- .u._struct.fields = lttng_epoll_ctl_events_fields,
+ .atype = atype_struct_nestable,
+ .u.struct_nestable.nr_fields = ARRAY_SIZE(lttng_epoll_ctl_events_fields),
+ .u.struct_nestable.fields = lttng_epoll_ctl_events_fields,
+ .u.struct_nestable.alignment = 0,
}
},
};
sc_in(
ctf_custom_field(
ctf_custom_type(
- .atype = atype_struct,
- .u._struct.nr_fields = ARRAY_SIZE(epoll_ctl_fields),
- .u._struct.fields = epoll_ctl_fields,
+ {
+ .atype = atype_struct_nestable,
+ .u.struct_nestable.nr_fields = ARRAY_SIZE(epoll_ctl_fields),
+ .u.struct_nestable.fields = epoll_ctl_fields,
+ .u.struct_nestable.alignment = 0,
+ }
),
event,
ctf_custom_code(
[0] = {
.name = "data_union",
.type = {
- .atype = atype_struct,
- .u._struct.nr_fields = ARRAY_SIZE(lttng_epoll_data_fields),
- .u._struct.fields = lttng_epoll_data_fields,
+ .atype = atype_struct_nestable,
+ .u.struct_nestable.nr_fields = ARRAY_SIZE(lttng_epoll_data_fields),
+ .u.struct_nestable.fields = lttng_epoll_data_fields,
+ .u.struct_nestable.alignment = 0,
}
},
[1] = {
[2] = {
.name = "events",
.type = {
- .atype = atype_struct,
- .u._struct.nr_fields = ARRAY_SIZE(lttng_epoll_ctl_events_fields),
- .u._struct.fields = lttng_epoll_ctl_events_fields,
+ .atype = atype_struct_nestable,
+ .u.struct_nestable.nr_fields = ARRAY_SIZE(lttng_epoll_ctl_events_fields),
+ .u.struct_nestable.fields = lttng_epoll_ctl_events_fields,
+ .u.struct_nestable.alignment = 0,
}
},
};
static struct lttng_type lttng_epoll_wait_elem = {
- .atype = atype_struct,
- .u._struct.nr_fields = ARRAY_SIZE(lttng_epoll_wait_fields),
- .u._struct.fields = lttng_epoll_wait_fields,
+ .atype = atype_struct_nestable,
+ .u.struct_nestable.nr_fields = ARRAY_SIZE(lttng_epoll_wait_fields),
+ .u.struct_nestable.fields = lttng_epoll_wait_fields,
+ .u.struct_nestable.alignment = 0,
};
#endif /* ONCE_LTTNG_TRACE_EPOLL_H */
#define LTTNG_SYSCALL_EPOLL_WAIT_fds_field \
ctf_custom_field( \
ctf_custom_type( \
- .atype = atype_sequence_compound, \
- .u.sequence_compound.length_name = \
- "fds_length", \
- .u.sequence_compound.elem_type = \
- <tng_epoll_wait_elem, \
+ { \
+ .atype = atype_sequence_nestable, \
+ .u.sequence_nestable.length_name = \
+ "fds_length", \
+ .u.sequence_nestable.elem_type = \
+ <tng_epoll_wait_elem, \
+ } \
), \
fds, \
ctf_custom_code( \
struct lttng_cs_type {
const char *name;
+ const char *length_name;
const char *save_func_name;
void (*save_func)(struct stack_trace *trace);
};
static struct lttng_cs_type cs_types[] = {
{
.name = "callstack_kernel",
+ .length_name = "_callstack_kernel_length",
.save_func_name = "save_stack_trace",
.save_func = NULL,
},
{
.name = "callstack_user",
+ .length_name = "_callstack_user_length",
.save_func_name = "save_stack_trace_user",
.save_func = NULL,
},
return cs_types[mode].name;
}
+static
+const char *lttng_cs_ctx_mode_length_name(enum lttng_cs_ctx_modes mode)
+{
+ return cs_types[mode].length_name;
+}
+
static
int init_type(enum lttng_cs_ctx_modes mode)
{
return &cs->dispatch[buffer_nesting].stack_trace;
}
+static
+size_t lttng_callstack_length_get_size(size_t offset, struct lttng_ctx_field *field,
+ struct lib_ring_buffer_ctx *ctx,
+ struct lttng_channel *chan)
+{
+ size_t orig_offset = offset;
+
+ offset += lib_ring_buffer_align(offset, lttng_alignof(unsigned int));
+ offset += sizeof(unsigned int);
+ return offset - orig_offset;
+}
+
/*
* In order to reserve the correct size, the callstack is computed. The
* resulting callstack is saved to be accessed in the record step.
*/
static
-size_t lttng_callstack_get_size(size_t offset, struct lttng_ctx_field *field,
- struct lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+size_t lttng_callstack_sequence_get_size(size_t offset, struct lttng_ctx_field *field,
+ struct lib_ring_buffer_ctx *ctx,
+ struct lttng_channel *chan)
{
struct stack_trace *trace;
struct field_data *fdata = field->priv;
/* do not write data if no space is available */
trace = stack_trace_context(field, ctx);
if (unlikely(!trace)) {
- offset += lib_ring_buffer_align(offset, lttng_alignof(unsigned int));
- offset += sizeof(unsigned int);
offset += lib_ring_buffer_align(offset, lttng_alignof(unsigned long));
return offset - orig_offset;
}
&& trace->entries[trace->nr_entries - 1] == ULONG_MAX) {
trace->nr_entries--;
}
- offset += lib_ring_buffer_align(offset, lttng_alignof(unsigned int));
- offset += sizeof(unsigned int);
offset += lib_ring_buffer_align(offset, lttng_alignof(unsigned long));
offset += sizeof(unsigned long) * trace->nr_entries;
/* Add our own ULONG_MAX delimiter to show incomplete stack. */
}
static
-void lttng_callstack_record(struct lttng_ctx_field *field,
+void lttng_callstack_length_record(struct lttng_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
struct stack_trace *trace = stack_trace_context(field, ctx);
unsigned int nr_seq_entries;
+ lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned int));
if (unlikely(!trace)) {
nr_seq_entries = 0;
- lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned int));
- chan->ops->event_write(ctx, &nr_seq_entries, sizeof(unsigned int));
- lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned long));
+ } else {
+ nr_seq_entries = trace->nr_entries;
+ if (trace->nr_entries == trace->max_entries)
+ nr_seq_entries++;
+ }
+ chan->ops->event_write(ctx, &nr_seq_entries, sizeof(unsigned int));
+}
+static
+void lttng_callstack_sequence_record(struct lttng_ctx_field *field,
+ struct lib_ring_buffer_ctx *ctx,
+ struct lttng_channel *chan)
+{
+ struct stack_trace *trace = stack_trace_context(field, ctx);
+ unsigned int nr_seq_entries;
+
+ lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned long));
+ if (unlikely(!trace)) {
return;
}
- lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned int));
nr_seq_entries = trace->nr_entries;
if (trace->nr_entries == trace->max_entries)
nr_seq_entries++;
- chan->ops->event_write(ctx, &nr_seq_entries, sizeof(unsigned int));
- lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned long));
chan->ops->event_write(ctx, trace->entries,
sizeof(unsigned long) * trace->nr_entries);
/* Add our own ULONG_MAX delimiter to show incomplete stack. */
}
}
+static
+const char *lttng_cs_ctx_mode_length_name(enum lttng_cs_ctx_modes mode)
+{
+ switch (mode) {
+ case CALLSTACK_KERNEL:
+ return "_callstack_kernel_length";
+ case CALLSTACK_USER:
+ return "_callstack_user_length";
+ default:
+ return NULL;
+ }
+}
+
static
int init_type_callstack_kernel(void)
{
return &cs->stack_trace[buffer_nesting];
}
+static
+size_t lttng_callstack_length_get_size(size_t offset, struct lttng_ctx_field *field,
+ struct lib_ring_buffer_ctx *ctx,
+ struct lttng_channel *chan)
+{
+ size_t orig_offset = offset;
+
+ offset += lib_ring_buffer_align(offset, lttng_alignof(unsigned int));
+ offset += sizeof(unsigned int);
+ return offset - orig_offset;
+}
+
/*
* In order to reserve the correct size, the callstack is computed. The
* resulting callstack is saved to be accessed in the record step.
*/
static
-size_t lttng_callstack_get_size(size_t offset, struct lttng_ctx_field *field,
- struct lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+size_t lttng_callstack_sequence_get_size(size_t offset, struct lttng_ctx_field *field,
+ struct lib_ring_buffer_ctx *ctx,
+ struct lttng_channel *chan)
{
struct lttng_stack_trace *trace;
struct field_data *fdata = field->priv;
/* do not write data if no space is available */
trace = stack_trace_context(field, ctx);
if (unlikely(!trace)) {
- offset += lib_ring_buffer_align(offset, lttng_alignof(unsigned int));
- offset += sizeof(unsigned int);
offset += lib_ring_buffer_align(offset, lttng_alignof(unsigned long));
return offset - orig_offset;
}
* If the array is filled, add our own marker to show that the
* stack is incomplete.
*/
- offset += lib_ring_buffer_align(offset, lttng_alignof(unsigned int));
- offset += sizeof(unsigned int);
offset += lib_ring_buffer_align(offset, lttng_alignof(unsigned long));
offset += sizeof(unsigned long) * trace->nr_entries;
/* Add our own ULONG_MAX delimiter to show incomplete stack. */
}
static
-void lttng_callstack_record(struct lttng_ctx_field *field,
+void lttng_callstack_length_record(struct lttng_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
struct lttng_stack_trace *trace = stack_trace_context(field, ctx);
unsigned int nr_seq_entries;
+ lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned int));
if (unlikely(!trace)) {
nr_seq_entries = 0;
- lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned int));
- chan->ops->event_write(ctx, &nr_seq_entries, sizeof(unsigned int));
- lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned long));
+ } else {
+ nr_seq_entries = trace->nr_entries;
+ if (trace->nr_entries == MAX_ENTRIES)
+ nr_seq_entries++;
+ }
+ chan->ops->event_write(ctx, &nr_seq_entries, sizeof(unsigned int));
+}
+
+static
+void lttng_callstack_sequence_record(struct lttng_ctx_field *field,
+ struct lib_ring_buffer_ctx *ctx,
+ struct lttng_channel *chan)
+{
+ struct lttng_stack_trace *trace = stack_trace_context(field, ctx);
+ unsigned int nr_seq_entries;
+
+ lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned long));
+ if (unlikely(!trace)) {
return;
}
- lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned int));
nr_seq_entries = trace->nr_entries;
if (trace->nr_entries == MAX_ENTRIES)
nr_seq_entries++;
- chan->ops->event_write(ctx, &nr_seq_entries, sizeof(unsigned int));
- lib_ring_buffer_align_ctx(ctx, lttng_alignof(unsigned long));
chan->ops->event_write(ctx, trace->entries,
sizeof(unsigned long) * trace->nr_entries);
/* Add our own ULONG_MAX delimiter to show incomplete stack. */
#include "wrapper/ringbuffer/frontend.h"
#include "wrapper/vmalloc.h"
#include "lttng-tracer.h"
+#include "lttng-endian.h"
#ifdef CONFIG_ARCH_STACKWALK
#include "lttng-context-callstack-stackwalk-impl.h"
}
static
-void lttng_callstack_destroy(struct lttng_ctx_field *field)
+void lttng_callstack_sequence_destroy(struct lttng_ctx_field *field)
{
struct field_data *fdata = field->priv;
field_data_free(fdata);
}
+static const struct lttng_type sequence_elem_type =
+ __type_integer(unsigned long, 0, 0, -1, __BYTE_ORDER, 16, none);
+
static
int __lttng_add_callstack_generic(struct lttng_ctx **ctx,
enum lttng_cs_ctx_modes mode)
{
const char *ctx_name = lttng_cs_ctx_mode_name(mode);
- struct lttng_ctx_field *field;
+ const char *ctx_length_name = lttng_cs_ctx_mode_length_name(mode);
+ struct lttng_ctx_field *length_field, *sequence_field;
+ struct lttng_event_field *field;
struct field_data *fdata;
int ret;
ret = init_type(mode);
if (ret)
return ret;
- field = lttng_append_context(ctx);
- if (!field)
+ length_field = lttng_append_context(ctx);
+ if (!length_field)
+ return -ENOMEM;
+ sequence_field = lttng_append_context(ctx);
+ if (!sequence_field) {
+ lttng_remove_context_field(ctx, length_field);
return -ENOMEM;
+ }
if (lttng_find_context(*ctx, ctx_name)) {
ret = -EEXIST;
goto error_find;
goto error_create;
}
- field->event_field.name = ctx_name;
- field->event_field.type.atype = atype_sequence;
- field->event_field.type.u.sequence.elem_type.atype = atype_integer;
- field->event_field.type.u.sequence.elem_type.u.basic.integer.size = sizeof(unsigned long) * CHAR_BIT;
- field->event_field.type.u.sequence.elem_type.u.basic.integer.alignment = lttng_alignof(long) * CHAR_BIT;
- field->event_field.type.u.sequence.elem_type.u.basic.integer.signedness = lttng_is_signed_type(unsigned long);
- field->event_field.type.u.sequence.elem_type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.sequence.elem_type.u.basic.integer.base = 16;
- field->event_field.type.u.sequence.elem_type.u.basic.integer.encoding = lttng_encode_none;
-
- field->event_field.type.u.sequence.length_type.atype = atype_integer;
- field->event_field.type.u.sequence.length_type.u.basic.integer.size = sizeof(unsigned int) * CHAR_BIT;
- field->event_field.type.u.sequence.length_type.u.basic.integer.alignment = lttng_alignof(unsigned int) * CHAR_BIT;
- field->event_field.type.u.sequence.length_type.u.basic.integer.signedness = lttng_is_signed_type(unsigned int);
- field->event_field.type.u.sequence.length_type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.sequence.length_type.u.basic.integer.base = 10;
- field->event_field.type.u.sequence.length_type.u.basic.integer.encoding = lttng_encode_none;
-
- field->get_size_arg = lttng_callstack_get_size;
- field->record = lttng_callstack_record;
- field->priv = fdata;
- field->destroy = lttng_callstack_destroy;
+ field = &length_field->event_field;
+ field->name = ctx_length_name;
+ field->type.atype = atype_integer;
+ field->type.u.integer.size = sizeof(unsigned int) * CHAR_BIT;
+ field->type.u.integer.alignment = lttng_alignof(unsigned int) * CHAR_BIT;
+ field->type.u.integer.signedness = lttng_is_signed_type(unsigned int);
+ field->type.u.integer.reverse_byte_order = 0;
+ field->type.u.integer.base = 10;
+ field->type.u.integer.encoding = lttng_encode_none;
+ length_field->get_size_arg = lttng_callstack_length_get_size;
+ length_field->record = lttng_callstack_length_record;
+
+ field = &sequence_field->event_field;
+ field->name = ctx_name;
+ field->type.atype = atype_sequence_nestable;
+ field->type.u.sequence_nestable.elem_type = &sequence_elem_type;
+ field->type.u.sequence_nestable.alignment = 0;
+ sequence_field->get_size_arg = lttng_callstack_sequence_get_size;
+ sequence_field->record = lttng_callstack_sequence_record;
+ sequence_field->priv = fdata;
+ sequence_field->destroy = lttng_callstack_sequence_destroy;
+
wrapper_vmalloc_sync_all();
return 0;
error_create:
field_data_free(fdata);
error_find:
- lttng_remove_context_field(ctx, field);
+ lttng_remove_context_field(ctx, sequence_field);
+ lttng_remove_context_field(ctx, length_field);
return ret;
}
}
field->event_field.name = "cgroup_ns";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(unsigned int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(unsigned int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(unsigned int);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(unsigned int) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(unsigned int) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(unsigned int);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = cgroup_ns_get_size;
field->record = cgroup_ns_record;
field->get_value = cgroup_ns_get_value;
}
field->event_field.name = "cpu_id";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(int);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(int) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(int) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(int);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = cpu_id_get_size;
field->record = cpu_id_record;
field->get_value = cpu_id_get_value;
}
field->event_field.name = "egid";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(gid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(gid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(gid_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(gid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(gid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(gid_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = egid_get_size;
field->record = egid_record;
field->get_value = egid_get_value;
}
field->event_field.name = "euid";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(uid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(uid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(uid_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(uid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(uid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(uid_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = euid_get_size;
field->record = euid_record;
field->get_value = euid_get_value;
}
field->event_field.name = "gid";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(gid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(gid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(gid_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(gid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(gid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(gid_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = gid_get_size;
field->record = gid_record;
field->get_value = gid_get_value;
value->str = hostname;
}
+static const struct lttng_type hostname_array_elem_type =
+ __type_integer(char, 0, 0, -1, __BYTE_ORDER, 10, UTF8);
+
int lttng_add_hostname_to_ctx(struct lttng_ctx **ctx)
{
struct lttng_ctx_field *field;
return -EEXIST;
}
field->event_field.name = "hostname";
- field->event_field.type.atype = atype_array;
- field->event_field.type.u.array.elem_type.atype = atype_integer;
- field->event_field.type.u.array.elem_type.u.basic.integer.size = sizeof(char) * CHAR_BIT;
- field->event_field.type.u.array.elem_type.u.basic.integer.alignment = lttng_alignof(char) * CHAR_BIT;
- field->event_field.type.u.array.elem_type.u.basic.integer.signedness = lttng_is_signed_type(char);
- field->event_field.type.u.array.elem_type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.array.elem_type.u.basic.integer.base = 10;
- field->event_field.type.u.array.elem_type.u.basic.integer.encoding = lttng_encode_UTF8;
- field->event_field.type.u.array.length = LTTNG_HOSTNAME_CTX_LEN;
+ field->event_field.type.atype = atype_array_nestable;
+ field->event_field.type.u.array_nestable.elem_type =
+ &hostname_array_elem_type;
+ field->event_field.type.u.array_nestable.length = LTTNG_HOSTNAME_CTX_LEN;
+ field->event_field.type.u.array_nestable.alignment = 0;
field->get_size = hostname_get_size;
field->record = hostname_record;
}
field->event_field.name = "interruptible";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(int8_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(int8_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(int8_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(int8_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(int8_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(int8_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = interruptible_get_size;
field->record = interruptible_record;
field->get_value = interruptible_get_value;
}
field->event_field.name = "ipc_ns";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(unsigned int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(unsigned int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(unsigned int);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(unsigned int) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(unsigned int) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(unsigned int);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = ipc_ns_get_size;
field->record = ipc_ns_record;
field->get_value = ipc_ns_get_value;
}
field->event_field.name = "migratable";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(uint8_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(uint8_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(uint8_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(uint8_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(uint8_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(uint8_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = migratable_get_size;
field->record = migratable_record;
field->get_value = migratable_get_value;
}
field->event_field.name = "mnt_ns";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(unsigned int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(unsigned int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(unsigned int);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(unsigned int) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(unsigned int) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(unsigned int);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = mnt_ns_get_size;
field->record = mnt_ns_record;
field->get_value = mnt_ns_get_value;
}
field->event_field.name = "need_reschedule";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(uint8_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(uint8_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(uint8_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(uint8_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(uint8_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(uint8_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = need_reschedule_get_size;
field->record = need_reschedule_record;
field->get_value = need_reschedule_get_value;
}
field->event_field.name = "net_ns";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(unsigned int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(unsigned int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(unsigned int);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(unsigned int) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(unsigned int) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(unsigned int);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = net_ns_get_size;
field->record = net_ns_record;
field->get_value = net_ns_get_value;
}
field->event_field.name = "nice";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(int);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(int) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(int) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(int);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = nice_get_size;
field->record = nice_record;
field->get_value = nice_get_value;
field->event_field.name = name_alloc;
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(uint64_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(uint64_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(uint64_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(uint64_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(uint64_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(uint64_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = perf_counter_get_size;
field->record = perf_counter_record;
field->u.perf_counter = perf_field;
}
field->event_field.name = "pid_ns";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(unsigned int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(unsigned int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(unsigned int);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(unsigned int) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(unsigned int) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(unsigned int);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = pid_ns_get_size;
field->record = pid_ns_record;
field->get_value = pid_ns_get_value;
}
field->event_field.name = "pid";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(pid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(pid_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(pid_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = pid_get_size;
field->record = pid_record;
field->get_value = pid_get_value;
}
field->event_field.name = "ppid";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(pid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(pid_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(pid_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = ppid_get_size;
field->record = ppid_record;
field->get_value = ppid_get_value;
}
field->event_field.name = "preemptible";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(uint8_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(uint8_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(uint8_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(uint8_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(uint8_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(uint8_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = preemptible_get_size;
field->record = preemptible_record;
field->get_value = preemptible_get_value;
}
field->event_field.name = "prio";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(int);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(int) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(int) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(int);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = prio_get_size;
field->record = prio_record;
field->get_value = prio_get_value;
#include <wrapper/ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <lttng-tracer.h>
+#include <lttng-endian.h>
static
size_t procname_get_size(size_t offset)
value->str = current->comm;
}
+static const struct lttng_type procname_array_elem_type =
+ __type_integer(char, 0, 0, -1, __BYTE_ORDER, 10, UTF8);
+
int lttng_add_procname_to_ctx(struct lttng_ctx **ctx)
{
struct lttng_ctx_field *field;
return -EEXIST;
}
field->event_field.name = "procname";
- field->event_field.type.atype = atype_array;
- field->event_field.type.u.array.elem_type.atype = atype_integer;
- field->event_field.type.u.array.elem_type.u.basic.integer.size = sizeof(char) * CHAR_BIT;
- field->event_field.type.u.array.elem_type.u.basic.integer.alignment = lttng_alignof(char) * CHAR_BIT;
- field->event_field.type.u.array.elem_type.u.basic.integer.signedness = lttng_is_signed_type(char);
- field->event_field.type.u.array.elem_type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.array.elem_type.u.basic.integer.base = 10;
- field->event_field.type.u.array.elem_type.u.basic.integer.encoding = lttng_encode_UTF8;
- field->event_field.type.u.array.length = sizeof(current->comm);
+ field->event_field.type.atype = atype_array_nestable;
+ field->event_field.type.u.array_nestable.elem_type = &procname_array_elem_type;
+ field->event_field.type.u.array_nestable.length = sizeof(current->comm);
+ field->event_field.type.u.array_nestable.alignment = 0;
field->get_size = procname_get_size;
field->record = procname_record;
}
field->event_field.name = "sgid";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(gid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(gid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(gid_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(gid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(gid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(gid_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = sgid_get_size;
field->record = sgid_record;
field->get_value = sgid_get_value;
}
field->event_field.name = "suid";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(uid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(uid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(uid_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(uid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(uid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(uid_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = suid_get_size;
field->record = suid_record;
field->get_value = suid_get_value;
}
field->event_field.name = "tid";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(pid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(pid_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(pid_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = tid_get_size;
field->record = tid_record;
field->get_value = tid_get_value;
}
field->event_field.name = "uid";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(uid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(uid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(uid_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(uid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(uid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(uid_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = uid_get_size;
field->record = uid_record;
field->get_value = uid_get_value;
}
field->event_field.name = "user_ns";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(unsigned int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(unsigned int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(unsigned int);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(unsigned int) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(unsigned int) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(unsigned int);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = user_ns_get_size;
field->record = user_ns_record;
field->get_value = user_ns_get_value;
}
field->event_field.name = "uts_ns";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(unsigned int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(unsigned int) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(unsigned int);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(unsigned int) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(unsigned int) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(unsigned int);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = uts_ns_get_size;
field->record = uts_ns_record;
field->get_value = uts_ns_get_value;
}
field->event_field.name = "vegid";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(gid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(gid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(gid_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(gid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(gid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(gid_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = vegid_get_size;
field->record = vegid_record;
field->get_value = vegid_get_value;
}
field->event_field.name = "veuid";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(uid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(uid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(uid_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(uid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(uid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(uid_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = veuid_get_size;
field->record = veuid_record;
field->get_value = veuid_get_value;
}
field->event_field.name = "vgid";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(gid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(gid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(gid_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(gid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(gid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(gid_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = vgid_get_size;
field->record = vgid_record;
field->get_value = vgid_get_value;
}
field->event_field.name = "vpid";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(pid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(pid_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(pid_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = vpid_get_size;
field->record = vpid_record;
field->get_value = vpid_get_value;
}
field->event_field.name = "vppid";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(pid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(pid_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(pid_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = vppid_get_size;
field->record = vppid_record;
field->get_value = vppid_get_value;
}
field->event_field.name = "vsgid";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(gid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(gid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(gid_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(gid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(gid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(gid_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = vsgid_get_size;
field->record = vsgid_record;
field->get_value = vsgid_get_value;
}
field->event_field.name = "vsuid";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(uid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(uid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(uid_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(uid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(uid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(uid_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = vsuid_get_size;
field->record = vsuid_record;
field->get_value = vsuid_get_value;
}
field->event_field.name = "vtid";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(pid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(pid_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(pid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(pid_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = vtid_get_size;
field->record = vtid_record;
field->get_value = vtid_get_value;
}
field->event_field.name = "vuid";
field->event_field.type.atype = atype_integer;
- field->event_field.type.u.basic.integer.size = sizeof(uid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.alignment = lttng_alignof(uid_t) * CHAR_BIT;
- field->event_field.type.u.basic.integer.signedness = lttng_is_signed_type(uid_t);
- field->event_field.type.u.basic.integer.reverse_byte_order = 0;
- field->event_field.type.u.basic.integer.base = 10;
- field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
+ field->event_field.type.u.integer.size = sizeof(uid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.alignment = lttng_alignof(uid_t) * CHAR_BIT;
+ field->event_field.type.u.integer.signedness = lttng_is_signed_type(uid_t);
+ field->event_field.type.u.integer.reverse_byte_order = 0;
+ field->event_field.type.u.integer.base = 10;
+ field->event_field.type.u.integer.encoding = lttng_encode_none;
field->get_size = vuid_get_size;
field->record = vuid_record;
field->get_value = vuid_get_value;
type = &ctx->fields[i].event_field.type;
switch (type->atype) {
case atype_integer:
- field_align = type->u.basic.integer.alignment;
+ field_align = type->u.integer.alignment;
break;
- case atype_array:
- case atype_array_bitfield:
+ case atype_array_nestable:
{
- struct lttng_basic_type *btype;
+ const struct lttng_type *nested_type;
- btype = &type->u.array.elem_type;
- switch (btype->atype) {
+ nested_type = type->u.array_nestable.elem_type;
+ switch (nested_type->atype) {
case atype_integer:
- field_align = btype->u.basic.integer.alignment;
+ field_align = nested_type->u.integer.alignment;
break;
case atype_string:
break;
- case atype_array:
- case atype_sequence:
- case atype_array_bitfield:
- case atype_sequence_bitfield:
- case atype_struct:
- case atype_array_compound:
- case atype_sequence_compound:
- case atype_variant:
+ case atype_array_nestable:
+ case atype_sequence_nestable:
+ case atype_struct_nestable:
+ case atype_variant_nestable:
default:
WARN_ON_ONCE(1);
break;
}
+ field_align = max_t(size_t, field_align,
+ type->u.array_nestable.alignment);
break;
}
- case atype_sequence:
- case atype_sequence_bitfield:
+ case atype_sequence_nestable:
{
- struct lttng_basic_type *btype;
+ const struct lttng_type *nested_type;
- btype = &type->u.sequence.length_type;
- switch (btype->atype) {
+ nested_type = type->u.sequence_nestable.elem_type;
+ switch (nested_type->atype) {
case atype_integer:
- field_align = btype->u.basic.integer.alignment;
- break;
-
- case atype_string:
- case atype_array:
- case atype_sequence:
- case atype_array_bitfield:
- case atype_sequence_bitfield:
- case atype_struct:
- case atype_array_compound:
- case atype_sequence_compound:
- case atype_variant:
- default:
- WARN_ON_ONCE(1);
- break;
- }
-
- btype = &type->u.sequence.elem_type;
- switch (btype->atype) {
- case atype_integer:
- field_align = max_t(size_t,
- field_align,
- btype->u.basic.integer.alignment);
+ field_align = nested_type->u.integer.alignment;
break;
case atype_string:
break;
- case atype_array:
- case atype_sequence:
- case atype_array_bitfield:
- case atype_sequence_bitfield:
- case atype_struct:
- case atype_array_compound:
- case atype_sequence_compound:
- case atype_variant:
+ case atype_array_nestable:
+ case atype_sequence_nestable:
+ case atype_struct_nestable:
+ case atype_variant_nestable:
default:
WARN_ON_ONCE(1);
break;
}
+ field_align = max_t(size_t, field_align,
+ type->u.sequence_nestable.alignment);
break;
}
case atype_string:
break;
- case atype_struct:
- case atype_array_compound:
- case atype_sequence_compound:
- case atype_variant:
+ case atype_struct_nestable:
+ case atype_variant_nestable:
break;
- case atype_enum:
+ case atype_enum_nestable:
default:
WARN_ON_ONCE(1);
break;
static
void _lttng_metadata_channel_hangup(struct lttng_metadata_stream *stream);
static
+int _lttng_type_statedump(struct lttng_session *session,
+ const struct lttng_type *type,
+ size_t nesting);
+static
int _lttng_field_statedump(struct lttng_session *session,
const struct lttng_event_field *field,
size_t nesting);
return 0;
}
+static
+int lttng_field_name_statedump(struct lttng_session *session,
+ const struct lttng_event_field *field,
+ size_t nesting)
+{
+ return lttng_metadata_printf(session, " _%s;\n", field->name);
+}
+
+static
+int _lttng_integer_type_statedump(struct lttng_session *session,
+ const struct lttng_type *type,
+ size_t nesting)
+{
+ int ret;
+
+ WARN_ON_ONCE(type->atype != atype_integer);
+ ret = print_tabs(session, nesting);
+ if (ret)
+ return ret;
+ ret = lttng_metadata_printf(session,
+ "integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s }",
+ type->u.integer.size,
+ type->u.integer.alignment,
+ type->u.integer.signedness,
+ (type->u.integer.encoding == lttng_encode_none)
+ ? "none"
+ : (type->u.integer.encoding == lttng_encode_UTF8)
+ ? "UTF8"
+ : "ASCII",
+ type->u.integer.base,
+#if __BYTE_ORDER == __BIG_ENDIAN
+ type->u.integer.reverse_byte_order ? " byte_order = le;" : ""
+#else
+ type->u.integer.reverse_byte_order ? " byte_order = be;" : ""
+#endif
+ );
+ return ret;
+}
+
/*
* Must be called with sessions_mutex held.
*/
{
int ret;
uint32_t i, nr_fields;
+ unsigned int alignment;
+
+ WARN_ON_ONCE(type->atype != atype_struct_nestable);
ret = print_tabs(session, nesting);
if (ret)
"struct {\n");
if (ret)
return ret;
- nr_fields = type->u._struct.nr_fields;
+ nr_fields = type->u.struct_nestable.nr_fields;
for (i = 0; i < nr_fields; i++) {
const struct lttng_event_field *iter_field;
- iter_field = &type->u._struct.fields[i];
+ iter_field = &type->u.struct_nestable.fields[i];
ret = _lttng_field_statedump(session, iter_field, nesting + 1);
if (ret)
return ret;
ret = print_tabs(session, nesting);
if (ret)
return ret;
- ret = lttng_metadata_printf(session,
- "}");
+ alignment = type->u.struct_nestable.alignment;
+ if (alignment) {
+ ret = lttng_metadata_printf(session,
+ "} align(%u)",
+ alignment);
+ } else {
+ ret = lttng_metadata_printf(session,
+ "}");
+ }
return ret;
}
* Must be called with sessions_mutex held.
*/
static
-int _lttng_struct_statedump(struct lttng_session *session,
+int _lttng_struct_field_statedump(struct lttng_session *session,
const struct lttng_event_field *field,
size_t nesting)
{
&field->type, nesting);
if (ret)
return ret;
- ret = lttng_metadata_printf(session,
- "_%s;\n",
- field->name);
- return ret;
+ return lttng_field_name_statedump(session, field, nesting);
}
/*
int ret;
uint32_t i, nr_choices;
+ WARN_ON_ONCE(type->atype != atype_variant_nestable);
+ /*
+ * CTF 1.8 does not allow expressing nonzero variant alignment in a nestable way.
+ */
+ if (type->u.variant_nestable.alignment != 0)
+ return -EINVAL;
ret = print_tabs(session, nesting);
if (ret)
return ret;
ret = lttng_metadata_printf(session,
"variant <_%s> {\n",
- type->u.variant.tag_name);
+ type->u.variant_nestable.tag_name);
if (ret)
return ret;
- nr_choices = type->u.variant.nr_choices;
+ nr_choices = type->u.variant_nestable.nr_choices;
for (i = 0; i < nr_choices; i++) {
const struct lttng_event_field *iter_field;
- iter_field = &type->u.variant.choices[i];
+ iter_field = &type->u.variant_nestable.choices[i];
ret = _lttng_field_statedump(session, iter_field, nesting + 1);
if (ret)
return ret;
* Must be called with sessions_mutex held.
*/
static
-int _lttng_variant_statedump(struct lttng_session *session,
+int _lttng_variant_field_statedump(struct lttng_session *session,
const struct lttng_event_field *field,
size_t nesting)
{
&field->type, nesting);
if (ret)
return ret;
- ret = lttng_metadata_printf(session,
- "_%s;\n",
- field->name);
- return ret;
+ return lttng_field_name_statedump(session, field, nesting);
}
/*
* Must be called with sessions_mutex held.
*/
static
-int _lttng_array_compound_statedump(struct lttng_session *session,
+int _lttng_array_field_statedump(struct lttng_session *session,
const struct lttng_event_field *field,
size_t nesting)
{
int ret;
const struct lttng_type *elem_type;
- /* Only array of structures and variants are currently supported. */
- elem_type = field->type.u.array_compound.elem_type;
- switch (elem_type->atype) {
- case atype_struct:
- ret = _lttng_struct_type_statedump(session, elem_type, nesting);
+ WARN_ON_ONCE(field->type.atype != atype_array_nestable);
+
+ if (field->type.u.array_nestable.alignment) {
+ ret = print_tabs(session, nesting);
if (ret)
return ret;
- break;
- case atype_variant:
- ret = _lttng_variant_type_statedump(session, elem_type, nesting);
+ ret = lttng_metadata_printf(session,
+ "struct { } align(%u) _%s_padding;\n",
+ field->type.u.array_nestable.alignment * CHAR_BIT,
+ field->name);
+ if (ret)
+ return ret;
+ }
+ /*
+ * Nested compound types: Only array of structures and variants are
+ * currently supported.
+ */
+ elem_type = field->type.u.array_nestable.elem_type;
+ switch (elem_type->atype) {
+ case atype_integer:
+ case atype_struct_nestable:
+ case atype_variant_nestable:
+ ret = _lttng_type_statedump(session, elem_type, nesting);
if (ret)
return ret;
break;
+
default:
return -EINVAL;
}
ret = lttng_metadata_printf(session,
" _%s[%u];\n",
field->name,
- field->type.u.array_compound.length);
+ field->type.u.array_nestable.length);
return ret;
}
* Must be called with sessions_mutex held.
*/
static
-int _lttng_sequence_compound_statedump(struct lttng_session *session,
+int _lttng_sequence_field_statedump(struct lttng_session *session,
const struct lttng_event_field *field,
size_t nesting)
{
const char *length_name;
const struct lttng_type *elem_type;
- length_name = field->type.u.sequence_compound.length_name;
+ WARN_ON_ONCE(field->type.atype != atype_sequence_nestable);
- /* Only array of structures and variants are currently supported. */
- elem_type = field->type.u.sequence_compound.elem_type;
- switch (elem_type->atype) {
- case atype_struct:
- ret = _lttng_struct_type_statedump(session, elem_type, nesting);
+ length_name = field->type.u.sequence_nestable.length_name;
+
+ if (field->type.u.sequence_nestable.alignment) {
+ ret = print_tabs(session, nesting);
if (ret)
return ret;
- break;
- case atype_variant:
- ret = _lttng_variant_type_statedump(session, elem_type, nesting);
+ ret = lttng_metadata_printf(session,
+ "struct { } align(%u) _%s_padding;\n",
+ field->type.u.sequence_nestable.alignment * CHAR_BIT,
+ field->name);
+ if (ret)
+ return ret;
+ }
+
+ /*
+ * Nested compound types: Only array of structures and variants are
+ * currently supported.
+ */
+ elem_type = field->type.u.sequence_nestable.elem_type;
+ switch (elem_type->atype) {
+ case atype_integer:
+ case atype_struct_nestable:
+ case atype_variant_nestable:
+ ret = _lttng_type_statedump(session, elem_type, nesting);
if (ret)
return ret;
break;
+
default:
return -EINVAL;
}
ret = lttng_metadata_printf(session,
" _%s[ _%s ];\n",
field->name,
- length_name);
+ field->type.u.sequence_nestable.length_name);
return ret;
}
* Must be called with sessions_mutex held.
*/
static
-int _lttng_enum_statedump(struct lttng_session *session,
- const struct lttng_event_field *field,
+int _lttng_enum_type_statedump(struct lttng_session *session,
+ const struct lttng_type *type,
size_t nesting)
{
const struct lttng_enum_desc *enum_desc;
- const struct lttng_integer_type *container_type;
+ const struct lttng_type *container_type;
int ret;
unsigned int i, nr_entries;
- enum_desc = field->type.u.basic.enumeration.desc;
- container_type = &field->type.u.basic.enumeration.container_type;
+ container_type = type->u.enum_nestable.container_type;
+ if (container_type->atype != atype_integer) {
+ ret = -EINVAL;
+ goto end;
+ }
+ enum_desc = type->u.enum_nestable.desc;
nr_entries = enum_desc->nr_entries;
ret = print_tabs(session, nesting);
if (ret)
goto end;
- ret = lttng_metadata_printf(session,
- "enum : integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } {\n",
- container_type->size,
- container_type->alignment,
- container_type->signedness,
- (container_type->encoding == lttng_encode_none)
- ? "none"
- : (container_type->encoding == lttng_encode_UTF8)
- ? "UTF8"
- : "ASCII",
- container_type->base,
-#if __BYTE_ORDER == __BIG_ENDIAN
- container_type->reverse_byte_order ? " byte_order = le;" : ""
-#else
- container_type->reverse_byte_order ? " byte_order = be;" : ""
-#endif
- );
+ ret = lttng_metadata_printf(session, "enum : ");
if (ret)
- goto end;
+ goto end;
+ ret = _lttng_integer_type_statedump(session, container_type, 0);
+ if (ret)
+ goto end;
+ ret = lttng_metadata_printf(session, " {\n");
+ if (ret)
+ goto end;
/* Dump all entries */
for (i = 0; i < nr_entries; i++) {
const struct lttng_enum_entry *entry = &enum_desc->entries[i];
ret = print_tabs(session, nesting);
if (ret)
goto end;
- ret = lttng_metadata_printf(session, "} _%s;\n",
- field->name);
+ ret = lttng_metadata_printf(session, "}");
end:
return ret;
}
* Must be called with sessions_mutex held.
*/
static
-int _lttng_field_statedump(struct lttng_session *session,
+int _lttng_enum_field_statedump(struct lttng_session *session,
+ const struct lttng_event_field *field,
+ size_t nesting)
+{
+ int ret;
+
+ ret = _lttng_enum_type_statedump(session, &field->type, nesting);
+ if (ret)
+ return ret;
+ return lttng_field_name_statedump(session, field, nesting);
+}
+
+static
+int _lttng_integer_field_statedump(struct lttng_session *session,
+ const struct lttng_event_field *field,
+ size_t nesting)
+{
+ int ret;
+
+ ret = _lttng_integer_type_statedump(session, &field->type, nesting);
+ if (ret)
+ return ret;
+ return lttng_field_name_statedump(session, field, nesting);
+}
+
+static
+int _lttng_string_type_statedump(struct lttng_session *session,
+ const struct lttng_type *type,
+ size_t nesting)
+{
+ int ret;
+
+ WARN_ON_ONCE(type->atype != atype_string);
+ /* Default encoding is UTF8 */
+ ret = print_tabs(session, nesting);
+ if (ret)
+ return ret;
+ ret = lttng_metadata_printf(session,
+ "string%s",
+ type->u.string.encoding == lttng_encode_ASCII ?
+ " { encoding = ASCII; }" : "");
+ return ret;
+}
+
+static
+int _lttng_string_field_statedump(struct lttng_session *session,
const struct lttng_event_field *field,
size_t nesting)
+{
+ int ret;
+
+ WARN_ON_ONCE(field->type.atype != atype_string);
+ ret = _lttng_string_type_statedump(session, &field->type, nesting);
+ if (ret)
+ return ret;
+ return lttng_field_name_statedump(session, field, nesting);
+}
+
+/*
+ * Must be called with sessions_mutex held.
+ */
+static
+int _lttng_type_statedump(struct lttng_session *session,
+ const struct lttng_type *type,
+ size_t nesting)
{
int ret = 0;
- switch (field->type.atype) {
+ switch (type->atype) {
case atype_integer:
- ret = print_tabs(session, nesting);
- if (ret)
- return ret;
- ret = lttng_metadata_printf(session,
- "integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } _%s;\n",
- field->type.u.basic.integer.size,
- field->type.u.basic.integer.alignment,
- field->type.u.basic.integer.signedness,
- (field->type.u.basic.integer.encoding == lttng_encode_none)
- ? "none"
- : (field->type.u.basic.integer.encoding == lttng_encode_UTF8)
- ? "UTF8"
- : "ASCII",
- field->type.u.basic.integer.base,
-#if __BYTE_ORDER == __BIG_ENDIAN
- field->type.u.basic.integer.reverse_byte_order ? " byte_order = le;" : "",
-#else
- field->type.u.basic.integer.reverse_byte_order ? " byte_order = be;" : "",
-#endif
- field->name);
+ ret = _lttng_integer_type_statedump(session, type, nesting);
break;
- case atype_enum:
- ret = _lttng_enum_statedump(session, field, nesting);
+ case atype_enum_nestable:
+ ret = _lttng_enum_type_statedump(session, type, nesting);
break;
- case atype_array:
- case atype_array_bitfield:
- {
- const struct lttng_basic_type *elem_type;
-
- elem_type = &field->type.u.array.elem_type;
- if (field->type.u.array.elem_alignment) {
- ret = print_tabs(session, nesting);
- if (ret)
- return ret;
- ret = lttng_metadata_printf(session,
- "struct { } align(%u) _%s_padding;\n",
- field->type.u.array.elem_alignment * CHAR_BIT,
- field->name);
- if (ret)
- return ret;
- }
- ret = print_tabs(session, nesting);
- if (ret)
- return ret;
- ret = lttng_metadata_printf(session,
- "integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } _%s[%u];\n",
- elem_type->u.basic.integer.size,
- elem_type->u.basic.integer.alignment,
- elem_type->u.basic.integer.signedness,
- (elem_type->u.basic.integer.encoding == lttng_encode_none)
- ? "none"
- : (elem_type->u.basic.integer.encoding == lttng_encode_UTF8)
- ? "UTF8"
- : "ASCII",
- elem_type->u.basic.integer.base,
-#if __BYTE_ORDER == __BIG_ENDIAN
- elem_type->u.basic.integer.reverse_byte_order ? " byte_order = le;" : "",
-#else
- elem_type->u.basic.integer.reverse_byte_order ? " byte_order = be;" : "",
-#endif
- field->name, field->type.u.array.length);
+ case atype_string:
+ ret = _lttng_string_type_statedump(session, type, nesting);
break;
+ case atype_struct_nestable:
+ ret = _lttng_struct_type_statedump(session, type, nesting);
+ break;
+ case atype_variant_nestable:
+ ret = _lttng_variant_type_statedump(session, type, nesting);
+ break;
+
+ /* Nested arrays and sequences are not supported yet. */
+ case atype_array_nestable:
+ case atype_sequence_nestable:
+ default:
+ WARN_ON_ONCE(1);
+ return -EINVAL;
}
- case atype_sequence:
- case atype_sequence_bitfield:
- {
- const struct lttng_basic_type *elem_type;
- const struct lttng_basic_type *length_type;
+ return ret;
+}
- elem_type = &field->type.u.sequence.elem_type;
- length_type = &field->type.u.sequence.length_type;
- ret = print_tabs(session, nesting);
- if (ret)
- return ret;
- ret = lttng_metadata_printf(session,
- "integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } __%s_length;\n",
- length_type->u.basic.integer.size,
- (unsigned int) length_type->u.basic.integer.alignment,
- length_type->u.basic.integer.signedness,
- (length_type->u.basic.integer.encoding == lttng_encode_none)
- ? "none"
- : ((length_type->u.basic.integer.encoding == lttng_encode_UTF8)
- ? "UTF8"
- : "ASCII"),
- length_type->u.basic.integer.base,
-#if __BYTE_ORDER == __BIG_ENDIAN
- length_type->u.basic.integer.reverse_byte_order ? " byte_order = le;" : "",
-#else
- length_type->u.basic.integer.reverse_byte_order ? " byte_order = be;" : "",
-#endif
- field->name);
- if (ret)
- return ret;
+/*
+ * Must be called with sessions_mutex held.
+ */
+static
+int _lttng_field_statedump(struct lttng_session *session,
+ const struct lttng_event_field *field,
+ size_t nesting)
+{
+ int ret = 0;
- if (field->type.u.sequence.elem_alignment) {
- ret = print_tabs(session, nesting);
- if (ret)
- return ret;
- ret = lttng_metadata_printf(session,
- "struct { } align(%u) _%s_padding;\n",
- field->type.u.sequence.elem_alignment * CHAR_BIT,
- field->name);
- if (ret)
- return ret;
- }
- ret = print_tabs(session, nesting);
- if (ret)
- return ret;
- ret = lttng_metadata_printf(session,
- "integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } _%s[ __%s_length ];\n",
- elem_type->u.basic.integer.size,
- (unsigned int) elem_type->u.basic.integer.alignment,
- elem_type->u.basic.integer.signedness,
- (elem_type->u.basic.integer.encoding == lttng_encode_none)
- ? "none"
- : ((elem_type->u.basic.integer.encoding == lttng_encode_UTF8)
- ? "UTF8"
- : "ASCII"),
- elem_type->u.basic.integer.base,
-#if __BYTE_ORDER == __BIG_ENDIAN
- elem_type->u.basic.integer.reverse_byte_order ? " byte_order = le;" : "",
-#else
- elem_type->u.basic.integer.reverse_byte_order ? " byte_order = be;" : "",
-#endif
- field->name,
- field->name);
+ switch (field->type.atype) {
+ case atype_integer:
+ ret = _lttng_integer_field_statedump(session, field, nesting);
+ break;
+ case atype_enum_nestable:
+ ret = _lttng_enum_field_statedump(session, field, nesting);
break;
- }
-
case atype_string:
- /* Default encoding is UTF8 */
- ret = print_tabs(session, nesting);
- if (ret)
- return ret;
- ret = lttng_metadata_printf(session,
- "string%s _%s;\n",
- field->type.u.basic.string.encoding == lttng_encode_ASCII ?
- " { encoding = ASCII; }" : "",
- field->name);
+ ret = _lttng_string_field_statedump(session, field, nesting);
break;
- case atype_struct:
- ret = _lttng_struct_statedump(session, field, nesting);
+ case atype_struct_nestable:
+ ret = _lttng_struct_field_statedump(session, field, nesting);
break;
- case atype_array_compound:
- ret = _lttng_array_compound_statedump(session, field, nesting);
+ case atype_array_nestable:
+ ret = _lttng_array_field_statedump(session, field, nesting);
break;
- case atype_sequence_compound:
- ret = _lttng_sequence_compound_statedump(session, field, nesting);
+ case atype_sequence_nestable:
+ ret = _lttng_sequence_field_statedump(session, field, nesting);
break;
- case atype_variant:
- ret = _lttng_variant_statedump(session, field, nesting);
+ case atype_variant_nestable:
+ ret = _lttng_variant_field_statedump(session, field, nesting);
break;
default:
#include <lttng-tracer.h>
#include <lttng-abi.h>
#include <lttng-abi-old.h>
+#include <lttng-endian.h>
#define lttng_is_signed_type(type) (((type)(-1)) < 0)
enum abstract_types {
atype_integer,
- atype_enum,
- atype_array,
- atype_sequence,
atype_string,
- atype_struct,
- atype_array_compound, /* Array of compound types. */
- atype_sequence_compound, /* Sequence of compound types. */
- atype_variant,
- atype_array_bitfield,
- atype_sequence_bitfield,
+ atype_enum_nestable,
+ atype_array_nestable,
+ atype_sequence_nestable,
+ atype_struct_nestable,
+ atype_variant_nestable,
NR_ABSTRACT_TYPES,
};
_byte_order, _base, _encoding) \
{ \
.atype = atype_integer, \
- .u.basic.integer = \
+ .u.integer = \
{ \
.size = (_size) ? : sizeof(_type) * CHAR_BIT, \
.alignment = (_alignment) ? : lttng_alignof(_type) * CHAR_BIT, \
enum lttng_string_encodings encoding;
};
-union _lttng_basic_type {
- struct lttng_integer_type integer;
- struct {
- const struct lttng_enum_desc *desc; /* Enumeration mapping */
- struct lttng_integer_type container_type;
- } enumeration;
- struct {
- enum lttng_string_encodings encoding;
- } string;
-};
-
-struct lttng_basic_type {
- enum abstract_types atype;
- union {
- union _lttng_basic_type basic;
- } u;
-};
-
struct lttng_type {
enum abstract_types atype;
union {
- union _lttng_basic_type basic;
+ struct lttng_integer_type integer;
struct {
- struct lttng_basic_type elem_type;
- unsigned int length; /* num. elems. */
- unsigned int elem_alignment; /* alignment override */
- } array;
+ enum lttng_string_encodings encoding;
+ } string;
struct {
- struct lttng_basic_type length_type;
- struct lttng_basic_type elem_type;
- unsigned int elem_alignment; /* alignment override */
- } sequence;
+ const struct lttng_enum_desc *desc; /* Enumeration mapping */
+ const struct lttng_type *container_type;
+ } enum_nestable;
struct {
- uint32_t nr_fields;
- struct lttng_event_field *fields; /* Array of fields. */
- } _struct;
+ const struct lttng_type *elem_type;
+ unsigned int length; /* Num. elems. */
+ unsigned int alignment;
+ } array_nestable;
struct {
- struct lttng_type *elem_type;
- unsigned int length; /* num. elems. */
- } array_compound;
+ const char *length_name; /* Length field name. */
+ const struct lttng_type *elem_type;
+ unsigned int alignment; /* Alignment before elements. */
+ } sequence_nestable;
struct {
- struct lttng_type *elem_type;
- const char *length_name;
- } sequence_compound;
+ unsigned int nr_fields;
+ const struct lttng_event_field *fields; /* Array of fields. */
+ unsigned int alignment;
+ } struct_nestable;
struct {
const char *tag_name;
- struct lttng_event_field *choices; /* Array of fields. */
- uint32_t nr_choices;
- } variant;
+ const struct lttng_event_field *choices; /* Array of fields. */
+ unsigned int nr_choices;
+ unsigned int alignment;
+ } variant_nestable;
} u;
};
const char *name;
struct lttng_type type;
unsigned int nowrite:1, /* do not write into trace */
- user:1; /* fetch from user-space */
+ user:1, /* fetch from user-space */
+ nofilter:1; /* do not consider for filter */
};
union lttng_ctx_value {
#define TRACEPOINT_HAS_DATA_ARG
+static inline bool lttng_is_bytewise_integer(const struct lttng_type *type)
+{
+ if (type->atype != atype_integer)
+ return false;
+ switch (type->u.integer.size) {
+ case 8: /* Fall-through. */
+ case 16: /* Fall-through. */
+ case 32: /* Fall-through. */
+ case 64:
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
+
#endif /* _LTTNG_EVENTS_H */
switch (field->type.atype) {
case atype_integer:
ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
- if (field->type.u.basic.integer.signedness) {
+ if (field->type.u.integer.signedness) {
ptr->object_type = OBJECT_TYPE_S64;
ptr->u.s64 = v.s64;
ptr->ptr = &ptr->u.s64;
ptr->ptr = &ptr->u.u64;
}
break;
- case atype_enum:
+ case atype_enum_nestable:
{
const struct lttng_integer_type *itype =
- &field->type.u.basic.enumeration.container_type;
+ &field->type.u.enum_nestable.container_type->u.integer;
ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
if (itype->signedness) {
}
break;
}
- case atype_array:
- if (field->type.u.array.elem_type.atype != atype_integer) {
+ case atype_array_nestable:
+ if (!lttng_is_bytewise_integer(field->type.u.array_nestable.elem_type)) {
printk(KERN_WARNING "Array nesting only supports integer types.\n");
return -EINVAL;
}
- if (field->type.u.array.elem_type.u.basic.integer.encoding == lttng_encode_none) {
+ if (field->type.u.array_nestable.elem_type->u.integer.encoding == lttng_encode_none) {
printk(KERN_WARNING "Only string arrays are supported for contexts.\n");
return -EINVAL;
}
ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
ptr->ptr = v.str;
break;
- case atype_sequence:
- if (field->type.u.sequence.elem_type.atype != atype_integer) {
+ case atype_sequence_nestable:
+ if (!lttng_is_bytewise_integer(field->type.u.sequence_nestable.elem_type)) {
printk(KERN_WARNING "Sequence nesting only supports integer types.\n");
return -EINVAL;
}
- if (field->type.u.sequence.elem_type.u.basic.integer.encoding == lttng_encode_none) {
+ if (field->type.u.sequence_nestable.elem_type->u.integer.encoding == lttng_encode_none) {
printk(KERN_WARNING "Only string sequences are supported for contexts.\n");
return -EINVAL;
}
ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
ptr->ptr = v.str;
break;
- case atype_array_bitfield:
- printk(KERN_WARNING "Bitfield array type is not supported.\n");
- return -EINVAL;
- case atype_sequence_bitfield:
- printk(KERN_WARNING "Bitfield sequence type is not supported.\n");
- return -EINVAL;
case atype_string:
ptr->object_type = OBJECT_TYPE_STRING;
ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
ptr->ptr = v.str;
break;
- case atype_struct:
+ case atype_struct_nestable:
printk(KERN_WARNING "Structure type cannot be loaded.\n");
return -EINVAL;
+ case atype_variant_nestable:
+ printk(KERN_WARNING "Variant type cannot be loaded.\n");
+ return -EINVAL;
default:
printk(KERN_WARNING "Unknown type: %d", (int) field->type.atype);
return -EINVAL;
switch (stack_top->load.object_type) {
case OBJECT_TYPE_ARRAY:
{
+ const struct lttng_integer_type *integer_type;
const struct lttng_event_field *field;
uint32_t elem_len, num_elems;
int signedness;
field = stack_top->load.field;
- elem_len = field->type.u.array.elem_type.u.basic.integer.size;
- signedness = field->type.u.array.elem_type.u.basic.integer.signedness;
- num_elems = field->type.u.array.length;
+ if (!lttng_is_bytewise_integer(field->type.u.array_nestable.elem_type)) {
+ ret = -EINVAL;
+ goto end;
+ }
+ integer_type = &field->type.u.array_nestable.elem_type->u.integer;
+ num_elems = field->type.u.array_nestable.length;
+ elem_len = integer_type->size;
+ signedness = integer_type->signedness;
if (index >= num_elems) {
ret = -EINVAL;
goto end;
gid.array_len = num_elems * (elem_len / CHAR_BIT);
gid.elem.type = stack_top->load.object_type;
gid.elem.len = elem_len;
- if (field->type.u.array.elem_type.u.basic.integer.reverse_byte_order)
+ if (integer_type->reverse_byte_order)
gid.elem.rev_bo = true;
stack_top->load.rev_bo = gid.elem.rev_bo;
break;
}
case OBJECT_TYPE_SEQUENCE:
{
+ const struct lttng_integer_type *integer_type;
const struct lttng_event_field *field;
uint32_t elem_len;
int signedness;
field = stack_top->load.field;
- elem_len = field->type.u.sequence.elem_type.u.basic.integer.size;
- signedness = field->type.u.sequence.elem_type.u.basic.integer.signedness;
+ if (!lttng_is_bytewise_integer(field->type.u.sequence_nestable.elem_type)) {
+ ret = -EINVAL;
+ goto end;
+ }
+ integer_type = &field->type.u.sequence_nestable.elem_type->u.integer;
+ elem_len = integer_type->size;
+ signedness = integer_type->signedness;
ret = specialize_get_index_object_type(&stack_top->load.object_type,
signedness, elem_len);
if (ret)
gid.offset = index * (elem_len / CHAR_BIT);
gid.elem.type = stack_top->load.object_type;
gid.elem.len = elem_len;
- if (field->type.u.sequence.elem_type.u.basic.integer.reverse_byte_order)
+ if (integer_type->reverse_byte_order)
gid.elem.rev_bo = true;
stack_top->load.rev_bo = gid.elem.rev_bo;
break;
*/
switch (field->type.atype) {
case atype_integer:
- if (field->type.u.basic.integer.signedness)
+ if (field->type.u.integer.signedness)
load->object_type = OBJECT_TYPE_S64;
else
load->object_type = OBJECT_TYPE_U64;
load->rev_bo = false;
break;
- case atype_enum:
+ case atype_enum_nestable:
{
const struct lttng_integer_type *itype =
- &field->type.u.basic.enumeration.container_type;
+ &field->type.u.enum_nestable.container_type->u.integer;
if (itype->signedness)
load->object_type = OBJECT_TYPE_S64;
load->rev_bo = false;
break;
}
- case atype_array:
- if (field->type.u.array.elem_type.atype != atype_integer) {
+ case atype_array_nestable:
+ if (!lttng_is_bytewise_integer(field->type.u.array_nestable.elem_type)) {
printk(KERN_WARNING "Array nesting only supports integer types.\n");
return -EINVAL;
}
if (is_context) {
load->object_type = OBJECT_TYPE_STRING;
} else {
- if (field->type.u.array.elem_type.u.basic.integer.encoding == lttng_encode_none) {
+ if (field->type.u.array_nestable.elem_type->u.integer.encoding == lttng_encode_none) {
load->object_type = OBJECT_TYPE_ARRAY;
load->field = field;
} else {
}
}
break;
- case atype_sequence:
- if (field->type.u.sequence.elem_type.atype != atype_integer) {
+ case atype_sequence_nestable:
+ if (!lttng_is_bytewise_integer(field->type.u.sequence_nestable.elem_type)) {
printk(KERN_WARNING "Sequence nesting only supports integer types.\n");
return -EINVAL;
}
if (is_context) {
load->object_type = OBJECT_TYPE_STRING;
} else {
- if (field->type.u.sequence.elem_type.u.basic.integer.encoding == lttng_encode_none) {
+ if (field->type.u.sequence_nestable.elem_type->u.integer.encoding == lttng_encode_none) {
load->object_type = OBJECT_TYPE_SEQUENCE;
load->field = field;
} else {
}
}
break;
- case atype_array_bitfield:
- printk(KERN_WARNING "Bitfield array type is not supported.\n");
- return -EINVAL;
- case atype_sequence_bitfield:
- printk(KERN_WARNING "Bitfield sequence type is not supported.\n");
- return -EINVAL;
case atype_string:
load->object_type = OBJECT_TYPE_STRING;
break;
- case atype_struct:
+ case atype_struct_nestable:
printk(KERN_WARNING "Structure type cannot be loaded.\n");
return -EINVAL;
+ case atype_variant_nestable:
+ printk(KERN_WARNING "Variant type cannot be loaded.\n");
+ return -EINVAL;
default:
printk(KERN_WARNING "Unknown type: %d", (int) field->type.atype);
return -EINVAL;
name = runtime->p.bc->bc.data + runtime->p.bc->bc.reloc_offset + offset;
for (i = 0; i < nr_fields; i++) {
field = &desc->fields[i];
+ if (field->nofilter) {
+ continue;
+ }
if (!strcmp(field->name, name)) {
found = true;
break;
/* compute field offset on stack */
switch (field->type.atype) {
case atype_integer:
- case atype_enum:
+ case atype_enum_nestable:
field_offset += sizeof(int64_t);
break;
- case atype_array:
- case atype_sequence:
- case atype_array_bitfield:
- case atype_sequence_bitfield:
+ case atype_array_nestable:
+ case atype_sequence_nestable:
field_offset += sizeof(unsigned long);
field_offset += sizeof(void *);
break;
return -EINVAL;
nr_fields = desc->nr_fields;
for (i = 0; i < nr_fields; i++) {
+ if (fields[i].nofilter)
+ continue;
if (!strcmp(fields[i].name, field_name)) {
field = &fields[i];
break;
/* compute field offset */
switch (fields[i].type.atype) {
case atype_integer:
- case atype_enum:
+ case atype_enum_nestable:
field_offset += sizeof(int64_t);
break;
- case atype_array:
- case atype_sequence:
- case atype_array_bitfield:
- case atype_sequence_bitfield:
+ case atype_array_nestable:
+ if (!lttng_is_bytewise_integer(fields[i].type.u.array_nestable.elem_type))
+ return -EINVAL;
+ field_offset += sizeof(unsigned long);
+ field_offset += sizeof(void *);
+ break;
+ case atype_sequence_nestable:
+ if (!lttng_is_bytewise_integer(fields[i].type.u.sequence_nestable.elem_type))
+ return -EINVAL;
field_offset += sizeof(unsigned long);
field_offset += sizeof(void *);
break;
case atype_string:
field_offset += sizeof(void *);
break;
- case atype_struct: /* Unsupported. */
- case atype_array_compound: /* Unsupported. */
- case atype_sequence_compound: /* Unsupported. */
- case atype_variant: /* Unsupported. */
+ case atype_struct_nestable: /* Unsupported. */
+ case atype_variant_nestable: /* Unsupported. */
default:
return -EINVAL;
}
field_ref = (struct field_ref *) op->data;
switch (field->type.atype) {
case atype_integer:
- case atype_enum:
+ case atype_enum_nestable:
op->op = FILTER_OP_LOAD_FIELD_REF_S64;
break;
- case atype_array:
- case atype_sequence:
+ case atype_array_nestable:
+ case atype_sequence_nestable:
if (field->user)
op->op = FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE;
else
else
op->op = FILTER_OP_LOAD_FIELD_REF_STRING;
break;
- case atype_struct: /* Unsupported. */
- case atype_array_compound: /* Unsupported. */
- case atype_sequence_compound: /* Unsupported. */
- case atype_variant: /* Unsupported. */
- case atype_array_bitfield: /* Unsupported. */
- case atype_sequence_bitfield: /* Unsupported. */
+ case atype_struct_nestable: /* Unsupported. */
+ case atype_variant_nestable: /* Unsupported. */
default:
return -EINVAL;
}
field_ref = (struct field_ref *) op->data;
switch (ctx_field->event_field.type.atype) {
case atype_integer:
- case atype_enum:
+ case atype_enum_nestable:
op->op = FILTER_OP_GET_CONTEXT_REF_S64;
break;
/* Sequence and array supported as string */
case atype_string:
- case atype_array:
- case atype_sequence:
BUG_ON(ctx_field->event_field.user);
op->op = FILTER_OP_GET_CONTEXT_REF_STRING;
break;
- case atype_struct: /* Unsupported. */
- case atype_array_compound: /* Unsupported. */
- case atype_sequence_compound: /* Unsupported. */
- case atype_variant: /* Unsupported. */
- case atype_array_bitfield: /* Unsupported. */
- case atype_sequence_bitfield: /* Unsupported. */
+ case atype_array_nestable:
+ if (!lttng_is_bytewise_integer(ctx_field->event_field.type.u.array_nestable.elem_type))
+ return -EINVAL;
+ BUG_ON(ctx_field->event_field.user);
+ op->op = FILTER_OP_GET_CONTEXT_REF_STRING;
+ break;
+ case atype_sequence_nestable:
+ if (!lttng_is_bytewise_integer(ctx_field->event_field.type.u.sequence_nestable.elem_type))
+ return -EINVAL;
+ BUG_ON(ctx_field->event_field.user);
+ op->op = FILTER_OP_GET_CONTEXT_REF_STRING;
+ break;
+ case atype_struct_nestable: /* Unsupported. */
+ case atype_variant_nestable: /* Unsupported. */
default:
return -EINVAL;
}
}
field->name = "ip";
field->type.atype = atype_integer;
- field->type.u.basic.integer.size = sizeof(unsigned long) * CHAR_BIT;
- field->type.u.basic.integer.alignment = lttng_alignof(unsigned long) * CHAR_BIT;
- field->type.u.basic.integer.signedness = lttng_is_signed_type(unsigned long);
- field->type.u.basic.integer.reverse_byte_order = 0;
- field->type.u.basic.integer.base = 16;
- field->type.u.basic.integer.encoding = lttng_encode_none;
+ field->type.u.integer.size = sizeof(unsigned long) * CHAR_BIT;
+ field->type.u.integer.alignment = lttng_alignof(unsigned long) * CHAR_BIT;
+ field->type.u.integer.signedness = lttng_is_signed_type(unsigned long);
+ field->type.u.integer.reverse_byte_order = 0;
+ field->type.u.integer.base = 16;
+ field->type.u.integer.encoding = lttng_encode_none;
desc->owner = THIS_MODULE;
event->desc = desc;
}
fields[0].name = "ip";
fields[0].type.atype = atype_integer;
- fields[0].type.u.basic.integer.size = sizeof(unsigned long) * CHAR_BIT;
- fields[0].type.u.basic.integer.alignment = lttng_alignof(unsigned long) * CHAR_BIT;
- fields[0].type.u.basic.integer.signedness = lttng_is_signed_type(unsigned long);
- fields[0].type.u.basic.integer.reverse_byte_order = 0;
- fields[0].type.u.basic.integer.base = 16;
- fields[0].type.u.basic.integer.encoding = lttng_encode_none;
+ fields[0].type.u.integer.size = sizeof(unsigned long) * CHAR_BIT;
+ fields[0].type.u.integer.alignment = lttng_alignof(unsigned long) * CHAR_BIT;
+ fields[0].type.u.integer.signedness = lttng_is_signed_type(unsigned long);
+ fields[0].type.u.integer.reverse_byte_order = 0;
+ fields[0].type.u.integer.base = 16;
+ fields[0].type.u.integer.encoding = lttng_encode_none;
fields[1].name = "parent_ip";
fields[1].type.atype = atype_integer;
- fields[1].type.u.basic.integer.size = sizeof(unsigned long) * CHAR_BIT;
- fields[1].type.u.basic.integer.alignment = lttng_alignof(unsigned long) * CHAR_BIT;
- fields[1].type.u.basic.integer.signedness = lttng_is_signed_type(unsigned long);
- fields[1].type.u.basic.integer.reverse_byte_order = 0;
- fields[1].type.u.basic.integer.base = 16;
- fields[1].type.u.basic.integer.encoding = lttng_encode_none;
+ fields[1].type.u.integer.size = sizeof(unsigned long) * CHAR_BIT;
+ fields[1].type.u.integer.alignment = lttng_alignof(unsigned long) * CHAR_BIT;
+ fields[1].type.u.integer.signedness = lttng_is_signed_type(unsigned long);
+ fields[1].type.u.integer.reverse_byte_order = 0;
+ fields[1].type.u.integer.base = 16;
+ fields[1].type.u.integer.encoding = lttng_encode_none;
desc->owner = THIS_MODULE;
event->desc = desc;
#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _user, _nowrite) \
{ \
.name = #_item, \
- .type = __type_integer(_type, 0, 0, -1, _byte_order, _base, none),\
+ .type = __type_integer(_type, 0, 0, -1, _byte_order, _base, none), \
.nowrite = _nowrite, \
.user = _user, \
+ .nofilter = 0, \
},
#undef _ctf_array_encoded
-#define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _byte_order, _base, _user, _nowrite) \
+#define _ctf_array_encoded(_type, _item, _src, _length, \
+ _encoding, _byte_order, _elem_type_base, _user, _nowrite) \
{ \
.name = #_item, \
.type = \
{ \
- .atype = atype_array, \
+ .atype = atype_array_nestable, \
.u = \
{ \
- .array = \
+ .array_nestable = \
{ \
- .elem_type = __type_integer(_type, 0, 0, 0, _byte_order, _base, _encoding), \
+ .elem_type = __LTTNG_COMPOUND_LITERAL(struct lttng_type, \
+ __type_integer(_type, 0, 0, -1, _byte_order, _elem_type_base, _encoding)), \
.length = _length, \
+ .alignment = 0, \
} \
} \
}, \
.nowrite = _nowrite, \
.user = _user, \
+ .nofilter = 0, \
},
#undef _ctf_array_bitfield
.name = #_item, \
.type = \
{ \
- .atype = atype_array_bitfield, \
+ .atype = atype_array_nestable, \
.u = \
{ \
- .array = \
+ .array_nestable = \
{ \
- .elem_type = __type_integer(_type, 1, 1, 0, __LITTLE_ENDIAN, 10, none), \
+ .elem_type = __LTTNG_COMPOUND_LITERAL(struct lttng_type, \
+ __type_integer(_type, 1, 1, 0, __LITTLE_ENDIAN, 10, none)), \
.length = (_length) * sizeof(_type) * CHAR_BIT, \
- .elem_alignment = lttng_alignof(_type), \
+ .alignment = lttng_alignof(_type), \
} \
} \
}, \
.nowrite = _nowrite, \
.user = _user, \
+ .nofilter = 0, \
},
#undef _ctf_sequence_encoded
#define _ctf_sequence_encoded(_type, _item, _src, \
_length_type, _src_length, _encoding, \
- _byte_order, _base, _user, _nowrite) \
+ _byte_order, _elem_type_base, _user, _nowrite) \
+ { \
+ .name = "_" #_item "_length", \
+ .type = __type_integer(_length_type, 0, 0, -1, __BYTE_ORDER, 10, none), \
+ .nowrite = _nowrite, \
+ .nofilter = 1, \
+ }, \
{ \
.name = #_item, \
.type = \
{ \
- .atype = atype_sequence, \
+ .atype = atype_sequence_nestable, \
.u = \
{ \
- .sequence = \
+ .sequence_nestable = \
{ \
- .length_type = __type_integer(_length_type, 0, 0, 0, __BYTE_ORDER, 10, none), \
- .elem_type = __type_integer(_type, 0, 0, -1, _byte_order, _base, _encoding), \
+ .length_name = "_" #_item "_length", \
+ .elem_type = __LTTNG_COMPOUND_LITERAL(struct lttng_type, \
+ __type_integer(_type, 0, 0, -1, _byte_order, _elem_type_base, _encoding)), \
+ .alignment = 0, \
}, \
}, \
}, \
.nowrite = _nowrite, \
.user = _user, \
+ .nofilter = 0, \
},
#undef _ctf_sequence_bitfield
#define _ctf_sequence_bitfield(_type, _item, _src, \
_length_type, _src_length, \
_user, _nowrite) \
+ { \
+ .name = "_" #_item "_length", \
+ .type = __type_integer(_length_type, 0, 0, -1, __BYTE_ORDER, 10, none), \
+ .nowrite = _nowrite, \
+ .nofilter = 1, \
+ }, \
{ \
.name = #_item, \
.type = \
{ \
- .atype = atype_sequence_bitfield, \
+ .atype = atype_sequence_nestable, \
.u = \
{ \
- .sequence = \
+ .sequence_nestable = \
{ \
- .length_type = __type_integer(_length_type, 0, 0, 0, __BYTE_ORDER, 10, none), \
- .elem_type = __type_integer(_type, 1, 1, 0, __LITTLE_ENDIAN, 10, none), \
- .elem_alignment = lttng_alignof(_type), \
+ .length_name = "_" #_item "_length", \
+ .elem_type = __LTTNG_COMPOUND_LITERAL(struct lttng_type, \
+ __type_integer(_type, 1, 1, 0, __LITTLE_ENDIAN, 10, none)), \
+ .alignment = lttng_alignof(_type), \
}, \
}, \
}, \
.nowrite = _nowrite, \
.user = _user, \
+ .nofilter = 0, \
},
#undef _ctf_string
.atype = atype_string, \
.u = \
{ \
- .basic = { .string = { .encoding = lttng_encode_UTF8 } } \
+ .string = { .encoding = lttng_encode_UTF8 }, \
}, \
}, \
.nowrite = _nowrite, \
.user = _user, \
+ .nofilter = 0, \
},
#undef _ctf_enum
{ \
.name = #_item, \
.type = { \
- .atype = atype_enum, \
+ .atype = atype_enum_nestable, \
.u = { \
- .basic = { \
- .enumeration = { \
- .desc = &__enum_##_name, \
- .container_type = { \
- .size = sizeof(_type) * CHAR_BIT, \
- .alignment = lttng_alignof(_type) * CHAR_BIT, \
- .signedness = lttng_is_signed_type(_type), \
- .reverse_byte_order = 0, \
- .base = 10, \
- .encoding = lttng_encode_none, \
- }, \
- }, \
- }, \
+ .enum_nestable = { \
+ .desc = &__enum_##_name, \
+ .container_type = __LTTNG_COMPOUND_LITERAL(struct lttng_type, \
+ __type_integer(_type, 0, 0, -1, __BYTE_ORDER, 10, none)), \
+ }, \
}, \
}, \
.nowrite = _nowrite, \
.user = _user, \
+ .nofilter = 0, \
},
#undef ctf_custom_field
#define ctf_custom_field(_type, _item, _code) \
{ \
.name = #_item, \
- .type = { _type }, \
+ .type = _type, \
.nowrite = 0, \
.user = 0, \
+ .nofilter = 1, \
},
#undef ctf_custom_type
}
fields[0].name = "ip";
fields[0].type.atype = atype_integer;
- fields[0].type.u.basic.integer.size = sizeof(unsigned long) * CHAR_BIT;
- fields[0].type.u.basic.integer.alignment = lttng_alignof(unsigned long) * CHAR_BIT;
- fields[0].type.u.basic.integer.signedness = lttng_is_signed_type(unsigned long);
- fields[0].type.u.basic.integer.reverse_byte_order = 0;
- fields[0].type.u.basic.integer.base = 16;
- fields[0].type.u.basic.integer.encoding = lttng_encode_none;
+ fields[0].type.u.integer.size = sizeof(unsigned long) * CHAR_BIT;
+ fields[0].type.u.integer.alignment = lttng_alignof(unsigned long) * CHAR_BIT;
+ fields[0].type.u.integer.signedness = lttng_is_signed_type(unsigned long);
+ fields[0].type.u.integer.reverse_byte_order = 0;
+ fields[0].type.u.integer.base = 16;
+ fields[0].type.u.integer.encoding = lttng_encode_none;
desc->owner = THIS_MODULE;
event->desc = desc;