tracepoint: Refactor representation of nested types before-upstreaming
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 7 Apr 2020 17:07:54 +0000 (13:07 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 13 Apr 2020 14:43:04 +0000 (10:43 -0400)
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>
50 files changed:
instrumentation/events/lttng-module/net.h
instrumentation/syscalls/headers/syscalls_pointers_override.h
lttng-context-callstack-legacy-impl.h
lttng-context-callstack-stackwalk-impl.h
lttng-context-callstack.c
lttng-context-cgroup-ns.c
lttng-context-cpu-id.c
lttng-context-egid.c
lttng-context-euid.c
lttng-context-gid.c
lttng-context-hostname.c
lttng-context-interruptible.c
lttng-context-ipc-ns.c
lttng-context-migratable.c
lttng-context-mnt-ns.c
lttng-context-need-reschedule.c
lttng-context-net-ns.c
lttng-context-nice.c
lttng-context-perf-counters.c
lttng-context-pid-ns.c
lttng-context-pid.c
lttng-context-ppid.c
lttng-context-preemptible.c
lttng-context-prio.c
lttng-context-procname.c
lttng-context-sgid.c
lttng-context-suid.c
lttng-context-tid.c
lttng-context-uid.c
lttng-context-user-ns.c
lttng-context-uts-ns.c
lttng-context-vegid.c
lttng-context-veuid.c
lttng-context-vgid.c
lttng-context-vpid.c
lttng-context-vppid.c
lttng-context-vsgid.c
lttng-context-vsuid.c
lttng-context-vtid.c
lttng-context-vuid.c
lttng-context.c
lttng-events.c
lttng-events.h
lttng-filter-interpreter.c
lttng-filter-specialize.c
lttng-filter.c
probes/lttng-kprobes.c
probes/lttng-kretprobes.c
probes/lttng-tracepoint-event-impl.h
probes/lttng-uprobes.c

index 66fd1f59a2c5ea2c7bab4daee8558ef11f7c3acc..55aba4e0c99634d3b098957c0721f44cce4e6e0e 100644 (file)
@@ -138,34 +138,42 @@ static struct lttng_event_field transport_fields[] = {
        [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,
        },
 };
 
@@ -341,18 +349,13 @@ static struct lttng_event_field ipv4fields[] = {
        [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] = {
@@ -363,47 +366,46 @@ static struct lttng_event_field ipv4fields[] = {
        [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,
                },
        },
 };
@@ -422,12 +424,13 @@ static struct lttng_event_field ipv6fields[] = {
        [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] = {
@@ -438,18 +441,13 @@ static struct lttng_event_field ipv6fields[] = {
        [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] = {
@@ -460,47 +458,46 @@ static struct lttng_event_field ipv6fields[] = {
        [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,
                },
        },
 };
@@ -509,25 +506,28 @@ static struct lttng_event_field network_fields[] = {
        [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,
                },
        },
 };
@@ -591,11 +591,14 @@ LTTNG_TRACEPOINT_EVENT_CLASS(net_dev_template,
                        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(
index d4c7ab04dc4dc7db74a85be30f3a0983e0643496..89f2cd8e61f7a3bdc7f866b1d0637af39d594cbf 100644 (file)
@@ -149,25 +149,36 @@ end:      ; /* Label at end of compound statement. */                                     \
 #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;                                                                \
@@ -186,24 +197,34 @@ end:      ; /* Label at end of compound statement. */                                     \
 #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;                                                                \
@@ -353,17 +374,19 @@ static struct lttng_event_field lttng_pollfd_fields[] = {
        [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 */
 
@@ -432,9 +455,11 @@ end:                                                                                       \
        sc_in(                                                                                  \
                ctf_custom_field(                                                               \
                        ctf_custom_type(                                                        \
-                               .atype = atype_sequence_compound,                               \
-                               .u.sequence_compound.length_name = "fds_length",                \
-                               .u.sequence_compound.elem_type = &lttng_pollfd_elem,            \
+                               {                                                               \
+                                       .atype = atype_sequence_nestable,                       \
+                                       .u.sequence_nestable.length_name = "fds_length",        \
+                                       .u.sequence_nestable.elem_type = &lttng_pollfd_elem,    \
+                               }                                                               \
                        ),                                                                      \
                        fds,                                                                    \
                        ctf_custom_code(                                                        \
@@ -453,9 +478,11 @@ end:                                                                                       \
        sc_out(                                                                                 \
                ctf_custom_field(                                                               \
                        ctf_custom_type(                                                        \
-                               .atype = atype_sequence_compound,                               \
-                               .u.sequence_compound.length_name = "fds_length",                \
-                               .u.sequence_compound.elem_type = &lttng_pollfd_elem,            \
+                               {                                                               \
+                                       .atype = atype_sequence_nestable,                       \
+                                       .u.sequence_nestable.length_name = "fds_length",        \
+                                       .u.sequence_nestable.elem_type = &lttng_pollfd_elem,    \
+                               }                                                               \
                        ),                                                                      \
                        fds,                                                                    \
                        ctf_custom_code(                                                        \
@@ -619,9 +646,10 @@ static struct lttng_event_field epoll_ctl_fields[] = {
        [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] = {
@@ -631,9 +659,10 @@ static struct lttng_event_field epoll_ctl_fields[] = {
        [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,
                }
        },
 };
@@ -662,9 +691,12 @@ SC_LTTNG_TRACEPOINT_EVENT_CODE(epoll_ctl,
                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(
@@ -697,9 +729,10 @@ static struct lttng_event_field lttng_epoll_wait_fields[] = {
        [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] = {
@@ -709,17 +742,19 @@ static struct lttng_event_field lttng_epoll_wait_fields[] = {
        [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 */
@@ -778,11 +813,13 @@ static struct lttng_type lttng_epoll_wait_elem = {
 #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 =                                \
-                               &lttng_epoll_wait_elem,                                 \
+                       {                                                               \
+                               .atype = atype_sequence_nestable,                       \
+                               .u.sequence_nestable.length_name =                      \
+                                       "fds_length",                                   \
+                               .u.sequence_nestable.elem_type =                        \
+                                       &lttng_epoll_wait_elem,                         \
+                       }                                                               \
                ),                                                                      \
                fds,                                                                    \
                ctf_custom_code(                                                        \
index 31942fd1575dff2fa3d4f64cc1be61c9c9cdb7ec..8d78fb95700891b0a2f2dc622b6c36b2b5f3fce6 100644 (file)
@@ -36,6 +36,7 @@ struct field_data {
 
 struct lttng_cs_type {
        const char *name;
+       const char *length_name;
        const char *save_func_name;
        void (*save_func)(struct stack_trace *trace);
 };
@@ -43,11 +44,13 @@ struct lttng_cs_type {
 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,
        },
@@ -59,6 +62,12 @@ const char *lttng_cs_ctx_mode_name(enum lttng_cs_ctx_modes mode)
        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)
 {
@@ -130,14 +139,26 @@ struct stack_trace *stack_trace_context(struct lttng_ctx_field *field,
        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;
@@ -146,8 +167,6 @@ size_t lttng_callstack_get_size(size_t offset, struct lttng_ctx_field *field,
        /* 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;
        }
@@ -173,8 +192,6 @@ size_t lttng_callstack_get_size(size_t offset, struct lttng_ctx_field *field,
                        && 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. */
@@ -184,26 +201,38 @@ size_t lttng_callstack_get_size(size_t offset, struct lttng_ctx_field *field,
 }
 
 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. */
index 6a46c351c07a6290b1b26b0e45fe83279f5a72bf..42f4273d8abae4f1f63069e443228f56b385b472 100644 (file)
@@ -53,6 +53,19 @@ const char *lttng_cs_ctx_mode_name(enum lttng_cs_ctx_modes mode)
        }
 }
 
+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)
 {
@@ -142,14 +155,26 @@ struct lttng_stack_trace *stack_trace_context(struct lttng_ctx_field *field,
        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;
@@ -158,8 +183,6 @@ size_t lttng_callstack_get_size(size_t offset, struct lttng_ctx_field *field,
        /* 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;
        }
@@ -188,8 +211,6 @@ size_t lttng_callstack_get_size(size_t offset, struct lttng_ctx_field *field,
         * 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. */
@@ -199,26 +220,39 @@ size_t lttng_callstack_get_size(size_t offset, struct lttng_ctx_field *field,
 }
 
 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. */
index 881c36e52935aa9accb21ea1036f8c9789e580f1..317efdf4f7eeb9b438f0679e8f46f2610fe6e8c3 100644 (file)
@@ -48,6 +48,7 @@
 #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"
@@ -87,28 +88,38 @@ error_alloc:
 }
 
 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;
@@ -119,35 +130,36 @@ int __lttng_add_callstack_generic(struct lttng_ctx **ctx,
                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;
 }
 
index 35accb85430b35937a1cd37bb1d9e655701cde28..a7f4e80f6565068b824efc0a526a7864a81689b5 100644 (file)
@@ -87,12 +87,12 @@ int lttng_add_cgroup_ns_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index de3d3c1f2a2a4a6f87274407eb586e104dcb04a2..d3d55b8891a8516eccc670bd125541e8216563ae 100644 (file)
@@ -58,12 +58,12 @@ int lttng_add_cpu_id_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 43744a6a81879c857f75703694aff12e88fd74c1..fcd01461fdbacf5aa21aaf89fb8c7f2ece377617 100644 (file)
@@ -60,12 +60,12 @@ int lttng_add_egid_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index fe0fb39d8ca3d4d14e6af323e58926a9f0fca224..b4b72184ea18c3a9b50fb42c3c2607f2b6010065 100644 (file)
@@ -60,12 +60,12 @@ int lttng_add_euid_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 8348a9d0c9781d9c6cae88fe13e5f11b1fdb5e5d..586934ed5b960a1b57cb7478c1621170f5cae4d1 100644 (file)
@@ -60,12 +60,12 @@ int lttng_add_gid_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 6f9d130cb6acfbef5747e403bba97285521017b2..0bbb1c78d78f3479000d1672585187408e3dbccf 100644 (file)
@@ -75,6 +75,9 @@ void hostname_get_value(struct lttng_ctx_field *field,
        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;
@@ -87,15 +90,11 @@ int lttng_add_hostname_to_ctx(struct lttng_ctx **ctx)
                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;
index 24866a4af0199d21c59493d84568e795c4d063fb..c07cba18f984ce30cc5e23c57fbb2928269940b1 100644 (file)
@@ -65,12 +65,12 @@ int lttng_add_interruptible_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 0673044dcbe29990d714d4b340587add8e92a1c8..cccd976602b7ec97118d50d959eae28731aa878d 100644 (file)
@@ -86,12 +86,12 @@ int lttng_add_ipc_ns_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 95f868e2ab2358d95e1efab858b76a0e1b5561ec..1a0dc4a13bd15d7de53a7bdee8e58ead9dd9bc48 100644 (file)
@@ -58,12 +58,12 @@ int lttng_add_migratable_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 9443f40996086a77e1d81c608c3e633fa10aef1e..029401396cf24a73122be447a549e31b078caefc 100644 (file)
@@ -88,12 +88,12 @@ int lttng_add_mnt_ns_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 3f52d7bd7cf0d6b0f292c0e96db5c287a85f0f9a..9a51f0c60714df4a47f05dd1b56be406f6c17a06 100644 (file)
@@ -58,12 +58,12 @@ int lttng_add_need_reschedule_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 2222080a27b53184f3f7d17aefcd204680f584c5..4584991f2e0b582e077f2769e9976d09c43f2325 100644 (file)
@@ -87,12 +87,12 @@ int lttng_add_net_ns_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 035b7c0594f826835498aa994aef1d119b49c0e3..89283d0f82472f4434ddaff91df029ed30ce4186 100644 (file)
@@ -58,12 +58,12 @@ int lttng_add_nice_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 03de7b428e6b12658b437e01ef3132baa88fe329..1c5ab9fbc99e67b6a455aad9c1cf19693b3eadde 100644 (file)
@@ -310,12 +310,12 @@ int lttng_add_perf_counter_to_ctx(uint32_t type,
 
        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;
index c749b678c19449469b2e77fd43fe19c51e495858..e4d3a3a3a5331840a15b7bad6392390cb9e20613 100644 (file)
@@ -88,12 +88,12 @@ int lttng_add_pid_ns_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index b5d9c5c95c9653ce5e36037df318da5c14b15b96..3cdc51284588994a164c38bbdc72b7dfe5d4ed6d 100644 (file)
@@ -58,12 +58,12 @@ int lttng_add_pid_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index b75b099f02218891ed12f00a452ef3ded4d10a90..8935fad019256b5aeef441a6fcec2afeeee2c1cc 100644 (file)
@@ -80,12 +80,12 @@ int lttng_add_ppid_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index c1c293be6bd2b7a0e2b2da0bf1a9696e5520efb6..6a40f03a266bf44d66fa474c8ef84db26ec9a515 100644 (file)
@@ -76,12 +76,12 @@ int lttng_add_preemptible_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index b3e942d174cf8df5dd2e05ecd65bb54502a2abe8..9cd843d5437e45af1a2afe9fd924cff247dcc254 100644 (file)
@@ -79,12 +79,12 @@ int lttng_add_prio_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index f1605a0ae7ea541e4c8c16a3392c515e07ae743d..8e4bbf97b52bb8485cc2f7b99c252a247bdb0f5a 100644 (file)
@@ -14,6 +14,7 @@
 #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)
@@ -46,6 +47,9 @@ void procname_get_value(struct lttng_ctx_field *field,
        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;
@@ -58,15 +62,10 @@ int lttng_add_procname_to_ctx(struct lttng_ctx **ctx)
                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;
index e6f1a636650bb05205ad92317914a10248eca8d1..4f58a14f680e4332d33420529a52c1a5f942bf62 100644 (file)
@@ -60,12 +60,12 @@ int lttng_add_sgid_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 9b0f44d681200d3ed322ac1e8e062dd0c58092e1..4b8477e50a9655613daf664ebe488d988d4e083f 100644 (file)
@@ -60,12 +60,12 @@ int lttng_add_suid_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 736d13d8a27889ca5272374c0072c096fdf80935..5f8e68fac7e6fa4386fce87fc2006923e7973ff6 100644 (file)
@@ -61,12 +61,12 @@ int lttng_add_tid_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index c0e9c8f7cf746af50ed5e7d340e9bb0f350d8db4..c7a2bb180bad663b60737e346e04059dcee4b28b 100644 (file)
@@ -60,12 +60,12 @@ int lttng_add_uid_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 940e42104bdf6951ac25c281a0d17f7542859660..ff56f551ae5e1ac4aaccabeccbdc45f8863e0b47 100644 (file)
@@ -72,12 +72,12 @@ int lttng_add_user_ns_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 7f80bbdf04d536c19bf7f9a8b471d06039bd4136..67c42764fcc84cce391050639e120d495657a7dc 100644 (file)
@@ -86,12 +86,12 @@ int lttng_add_uts_ns_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 5d970565bd3ffa32a256de35da8729f3f2e54b0a..501b01e6eb425411e5924e24dd7d6c0db06f3e75 100644 (file)
@@ -60,12 +60,12 @@ int lttng_add_vegid_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index c1c840e1ee316118fe50b23aa3017c1ce5238bae..a8810a770f7c0fda9b0d94f71cd6175bab0e1a61 100644 (file)
@@ -60,12 +60,12 @@ int lttng_add_veuid_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index cb924205cd54139c19749357108a93a6f2c0ba10..92ac567b828b1a8f8ec615252d647696e400c5a7 100644 (file)
@@ -60,12 +60,12 @@ int lttng_add_vgid_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 6b8b7f1fa83d158a2cea26348d7ce856196f877c..31a2c15e48dee190e08ca1120205521d01b5c89b 100644 (file)
@@ -73,12 +73,12 @@ int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 691cf4fd7fa1c8550babdeef76ba930c8ba81829..43bfcc1249e10d8901ed7e264ffbbd24d659aad7 100644 (file)
@@ -102,12 +102,12 @@ int lttng_add_vppid_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 9f48efb4c01d9172d9979256faf5c8d8c4cd02d1..20987ddec5fc1dec255f7a83dd91636bb91177e2 100644 (file)
@@ -60,12 +60,12 @@ int lttng_add_vsgid_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 491d8e37fa09ef211a806cb7990c75b4c961cadc..7cefd53532f95387e574ec15b8f69f25f11ce0fc 100644 (file)
@@ -60,12 +60,12 @@ int lttng_add_vsuid_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index c6baeb16d759e97628f1012573e26ad5c7142645..a7da7d2efa320e23c70a1871aa70e6a867efd90c 100644 (file)
@@ -73,12 +73,12 @@ int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 826e2bff367e20ad267ed01ce7b75ace527389f4..427ada715c1f9db437d5e538084f85c7feed570b 100644 (file)
@@ -60,12 +60,12 @@ int lttng_add_vuid_to_ctx(struct lttng_ctx **ctx)
        }
        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;
index 825eda5eb75acaeff3f7a0e0e81d1d0688faf160..54fa447848177770d47e309d6eb52e60477cabb5 100644 (file)
@@ -112,95 +112,65 @@ void lttng_context_update(struct lttng_ctx *ctx)
                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;
index c8e4cd76d4f56dc7d99fe57d2f6ce92929e63ef1..c14ea3f20060e4f470e0b8d00c91cc9a7faf222d 100644 (file)
@@ -71,6 +71,10 @@ int _lttng_session_metadata_statedump(struct lttng_session *session);
 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);
@@ -1754,6 +1758,45 @@ int print_tabs(struct lttng_session *session, 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.
  */
@@ -1764,6 +1807,9 @@ int _lttng_struct_type_statedump(struct lttng_session *session,
 {
        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)
@@ -1772,11 +1818,11 @@ int _lttng_struct_type_statedump(struct lttng_session *session,
                "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;
@@ -1784,8 +1830,15 @@ int _lttng_struct_type_statedump(struct lttng_session *session,
        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;
 }
 
@@ -1793,7 +1846,7 @@ int _lttng_struct_type_statedump(struct lttng_session *session,
  * 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)
 {
@@ -1803,10 +1856,7 @@ int _lttng_struct_statedump(struct lttng_session *session,
                        &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);
 }
 
 /*
@@ -1820,19 +1870,25 @@ int _lttng_variant_type_statedump(struct lttng_session *session,
        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;
@@ -1849,7 +1905,7 @@ int _lttng_variant_type_statedump(struct lttng_session *session,
  * 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)
 {
@@ -1859,43 +1915,54 @@ int _lttng_variant_statedump(struct lttng_session *session,
                        &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;
 }
 
@@ -1903,7 +1970,7 @@ int _lttng_array_compound_statedump(struct lttng_session *session,
  * 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)
 {
@@ -1911,28 +1978,43 @@ int _lttng_sequence_compound_statedump(struct lttng_session *session,
        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;
 }
 
@@ -1940,41 +2022,35 @@ int _lttng_sequence_compound_statedump(struct lttng_session *session,
  * 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];
@@ -2053,8 +2129,7 @@ int _lttng_enum_statedump(struct lttng_session *session,
        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;
 }
@@ -2063,165 +2138,132 @@ end:
  * 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:
index ec23512a18b79806bf11e8390a544bd848a240d6..8197eb83a5bafc8c11e17f1a3d3f0bbdc5599262 100644 (file)
@@ -20,6 +20,7 @@
 #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)
 
@@ -35,16 +36,12 @@ struct lib_ring_buffer_config;
 
 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,
 };
 
@@ -77,7 +74,7 @@ struct lttng_enum_entry {
                _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, \
@@ -97,55 +94,38 @@ struct lttng_integer_type {
        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;
 };
 
@@ -161,7 +141,8 @@ struct lttng_event_field {
        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 {
@@ -982,4 +963,20 @@ extern const struct file_operations lttng_syscall_list_fops;
 
 #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 */
index 3dad6cc6650830f2990ec410f09b523dd59573d3..c7ce7d331bd2dc4eb8639751d7b38377ed451fca 100644 (file)
@@ -288,7 +288,7 @@ static int context_get_index(struct lttng_probe_ctx *lttng_probe_ctx,
        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;
@@ -298,10 +298,10 @@ static int context_get_index(struct lttng_probe_ctx *lttng_probe_ctx,
                        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) {
@@ -315,12 +315,12 @@ static int context_get_index(struct lttng_probe_ctx *lttng_probe_ctx,
                }
                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;
                }
@@ -328,12 +328,12 @@ static int context_get_index(struct lttng_probe_ctx *lttng_probe_ctx,
                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;
                }
@@ -341,20 +341,17 @@ static int context_get_index(struct lttng_probe_ctx *lttng_probe_ctx,
                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;
index 4f9a0cd1833da967fdc9fee7fb62cd74d2cb7771..3dc82d847181edd3aa58c640bba37355533ce8b3 100644 (file)
@@ -198,14 +198,20 @@ static int specialize_get_index(struct bytecode_runtime *runtime,
                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;
@@ -218,20 +224,26 @@ static int specialize_get_index(struct bytecode_runtime *runtime,
                        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)
@@ -239,7 +251,7 @@ static int specialize_get_index(struct bytecode_runtime *runtime,
                        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;
@@ -305,16 +317,16 @@ static int specialize_load_object(const struct lttng_event_field *field,
         */
        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;
@@ -323,15 +335,15 @@ static int specialize_load_object(const struct lttng_event_field *field,
                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 {
@@ -339,15 +351,15 @@ static int specialize_load_object(const struct lttng_event_field *field,
                        }
                }
                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 {
@@ -355,18 +367,15 @@ static int specialize_load_object(const struct lttng_event_field *field,
                        }
                }
                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;
@@ -428,6 +437,9 @@ static int specialize_event_payload_lookup(struct lttng_event *event,
        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;
@@ -435,13 +447,11 @@ static int specialize_event_payload_lookup(struct lttng_event *event,
                /* 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;
index 325ae7bbc0538c975ca00bcd305f9ba4cc4fd063..45319d6f0ef7a0ccd60270d21e50d77a77cc1d71 100644 (file)
@@ -191,6 +191,8 @@ int apply_field_reloc(struct lttng_event *event,
                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;
@@ -198,23 +200,26 @@ int apply_field_reloc(struct lttng_event *event,
                /* 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;
                }
@@ -237,11 +242,11 @@ int apply_field_reloc(struct lttng_event *event,
                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
@@ -253,12 +258,8 @@ int apply_field_reloc(struct lttng_event *event,
                        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;
                }
@@ -307,22 +308,28 @@ int apply_context_reloc(struct lttng_event *event,
                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;
                }
index a6e2ca1ca1baf850811ef6b38ee87d3b6d767e79..40fe0f68d54e41e8d032ece226ef117cbf06a416 100644 (file)
@@ -76,12 +76,12 @@ int lttng_create_kprobe_event(const char *name, struct lttng_event *event)
        }
        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;
 
index 9ef4eefac06ceeadf12be02458b55f6e1b527f7a..40938f2b7110bd5506862d982ee8deca997bc614 100644 (file)
@@ -130,21 +130,21 @@ int lttng_create_kprobe_event(const char *name, struct lttng_event *event,
        }
        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;
index b304dde368b90e46ba480e9cbcd3ede633221b04..5f77bf4d5405f6c8c50bc06f99e5a166869f4765 100644 (file)
@@ -257,29 +257,34 @@ void __event_template_proto___##_name(void);
 #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
@@ -288,65 +293,84 @@ void __event_template_proto___##_name(void);
          .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
@@ -358,11 +382,12 @@ void __event_template_proto___##_name(void);
                  .atype = atype_string,                        \
                  .u =                                          \
                        {                                       \
-                         .basic = { .string = { .encoding = lttng_encode_UTF8 } } \
+                         .string = { .encoding = lttng_encode_UTF8 }, \
                        },                                      \
                },                                              \
          .nowrite = _nowrite,                                  \
          .user = _user,                                        \
+         .nofilter = 0,                                        \
        },
 
 #undef _ctf_enum
@@ -370,34 +395,28 @@ void __event_template_proto___##_name(void);
        {                                                       \
                .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
index 10f435fec989cdb3ab0829e6aea8fb924fac1c6e..175c0dd9d5993ddcfb63865a6971715b6f94e504 100644 (file)
@@ -92,12 +92,12 @@ int lttng_create_uprobe_event(const char *name, struct lttng_event *event)
        }
        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;
This page took 0.08686 seconds and 4 git commands to generate.