return skb_network_header(skb) != skb->head;
}
-static struct lttng_event_field emptyfields[] = {
-};
-
-/* Structures for transport headers. */
-
-static struct lttng_event_field tcpfields[] = {
- [0] = {
- .name = "source_port",
- .type = __type_integer(uint16_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
- [1] = {
- .name = "dest_port",
- .type = __type_integer(uint16_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
- [2] = {
- .name = "seq",
- .type = __type_integer(uint32_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
- [3] = {
- .name = "ack_seq",
- .type = __type_integer(uint32_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
- [4] = {
- .name = "data_offset",
- .type = __type_integer(uint8_t, 4, 4, 0,
- __BIG_ENDIAN, 10, none),
- },
- [5] = {
- .name = "reserved",
- .type = __type_integer(uint8_t, 3, 1, 0,
- __BIG_ENDIAN, 10, none),
- },
- [6] = {
- .name = "flags",
- .type = __type_integer(uint8_t, 9, 1, 0,
- __BIG_ENDIAN, 16, none),
- },
- [7] = {
- .name = "window_size",
- .type = __type_integer(uint16_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
- [8] = {
- .name = "checksum",
- .type = __type_integer(uint16_t, 0, 0, 0,
- __BIG_ENDIAN, 16, none),
- },
- [9] = {
- .name = "urg_ptr",
- .type = __type_integer(uint16_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
-};
-
-static struct lttng_event_field udpfields[] = {
- [0] = {
- .name = "source_port",
- .type = __type_integer(uint16_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
- [1] = {
- .name = "dest_port",
- .type = __type_integer(uint16_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
- [2] = {
- .name = "len",
- .type = __type_integer(uint16_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
- [3] = {
- .name = "check",
- .type = __type_integer(uint16_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
-};
-
-static struct lttng_event_field icmpfields[] = {
- [0] = {
- .name = "type",
- .type = __type_integer(uint8_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
- [1] = {
- .name = "code",
- .type = __type_integer(uint8_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
- [2] = {
- .name = "checksum",
- .type = __type_integer(uint16_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
- [3] = {
- .name = "gateway",
- .type = __type_integer(uint32_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
-};
-
-
-static struct lttng_event_field transport_fields[] = {
- [0] = {
- .name = "unknown",
- .type = {
- .type = lttng_kernel_type_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 = {
- .type = lttng_kernel_type_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 = {
- .type = lttng_kernel_type_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 = {
- .type = lttng_kernel_type_struct_nestable,
- .u.struct_nestable.nr_fields = ARRAY_SIZE(icmpfields),
- .u.struct_nestable.fields = icmpfields,
- .u.struct_nestable.alignment = 0,
- },
- .nofilter = 1,
- },
-};
-
enum transport_header_types {
TH_NONE = 0,
TH_TCP = 1,
return TH_NONE;
}
-static struct lttng_kernel_enum_entry proto_transport_enum_entries[] = {
- [0] = {
- .start = { .value = 0, .signedness = 0, },
- .end = { .value = IPPROTO_ICMP - 1, .signedness = 0, },
- .string = "_unknown",
- },
- [1] = {
- .start = { .value = IPPROTO_ICMP, .signedness = 0, },
- .end = { .value = IPPROTO_ICMP, .signedness = 0, },
- .string = "_icmp",
- },
- [2] = {
- .start = { .value = IPPROTO_ICMP + 1, .signedness = 0, },
- .end = { .value = IPPROTO_TCP - 1, .signedness = 0, },
- .string = "_unknown",
- },
- [3] = {
- .start = { .value = IPPROTO_TCP, .signedness = 0, },
- .end = { .value = IPPROTO_TCP, .signedness = 0, },
- .string = "_tcp",
- },
- [4] = {
- .start = { .value = IPPROTO_TCP + 1, .signedness = 0, },
- .end = { .value = IPPROTO_UDP - 1, .signedness = 0, },
- .string = "_unknown",
- },
- [5] = {
- .start = { .value = IPPROTO_UDP, .signedness = 0, },
- .end = { .value = IPPROTO_UDP, .signedness = 0, },
- .string = "_udp",
- },
- [6] = {
- .start = { .value = IPPROTO_UDP + 1, .signedness = 0, },
- .end = { .value = 255, .signedness = 0, },
- .string = "_unknown",
- },
-};
-
-static const struct lttng_kernel_enum_desc proto_transport_header_type = {
- .name = "proto_transport_header_type",
- .entries = proto_transport_enum_entries,
- .nr_entries = ARRAY_SIZE(proto_transport_enum_entries),
-};
-
-static struct lttng_kernel_enum_entry transport_enum_entries[] = {
- [0] = {
- .start = { .value = TH_NONE, .signedness = 0, },
- .end = { .value = TH_NONE, .signedness = 0, },
- .string = "_unknown",
- },
- [1] = {
- .start = { .value = TH_TCP, .signedness = 0, },
- .end = { .value = TH_TCP, .signedness = 0, },
- .string = "_tcp",
- },
- [2] = {
- .start = { .value = TH_UDP, .signedness = 0, },
- .end = { .value = TH_UDP, .signedness = 0, },
- .string = "_udp",
- },
- [3] = {
- .start = { .value = TH_ICMP, .signedness = 0, },
- .end = { .value = TH_ICMP, .signedness = 0, },
- .string = "_icmp",
- },
-};
-
-static const struct lttng_kernel_enum_desc transport_header_type = {
- .name = "transport_header_type",
- .entries = transport_enum_entries,
- .nr_entries = ARRAY_SIZE(transport_enum_entries),
-};
-
-/* Structures for network headers. */
-
-static struct lttng_event_field ipv4fields[] = {
- [0] = {
- .name = "version",
- .type = __type_integer(uint8_t, 4, 4, 0,
- __BIG_ENDIAN, 10, none),
- },
- [1] = {
- .name = "ihl",
- .type = __type_integer(uint8_t, 4, 4, 0,
- __BIG_ENDIAN, 10, none),
- },
- [2] = {
- .name = "tos",
- .type = __type_integer(uint8_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
- [3] = {
- .name = "tot_len",
- .type = __type_integer(uint16_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
- [4] = {
- .name = "id",
- .type = __type_integer(uint16_t, 0, 0, 0,
- __BIG_ENDIAN, 16, none),
- },
- [5] = {
- .name = "frag_off",
- .type = __type_integer(uint16_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
- [6] = {
- .name = "ttl",
- .type = __type_integer(uint8_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
- [7] = {
- .name = "protocol",
- .type = {
- .type = lttng_kernel_type_enum_nestable,
- .u.enum_nestable.desc =
- &proto_transport_header_type,
- .u.enum_nestable.container_type =
- __LTTNG_COMPOUND_LITERAL(struct lttng_type,
- __type_integer(uint8_t, 0, 0, -1,
- __BIG_ENDIAN, 10, none)),
- },
- },
- [8] = {
- .name = "checksum",
- .type = __type_integer(uint16_t, 0, 0, 0,
- __BIG_ENDIAN, 16, none),
- },
- [9] = {
- .name = "saddr",
- .type = {
- .type = lttng_kernel_type_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 = {
- .type = lttng_kernel_type_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 = {
- .type = lttng_kernel_type_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 = {
- .type = lttng_kernel_type_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,
- },
- },
-};
-
-static struct lttng_event_field ipv6fields[] = {
- [0] = {
- .name = "version",
- .type = __type_integer(uint8_t, 4, 4, 0,
- __BIG_ENDIAN, 10, none),
- },
- [1] = {
- .name = "prio",
- .type = __type_integer(uint8_t, 4, 4, 0,
- __BIG_ENDIAN, 10, none),
- },
- [2] = {
- .name = "flow_lbl",
- .type = {
- .type = lttng_kernel_type_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] = {
- .name = "payload_len",
- .type = __type_integer(uint16_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
- [4] = {
- .name = "nexthdr",
- .type = {
- .type = lttng_kernel_type_enum_nestable,
- .u.enum_nestable.desc =
- &proto_transport_header_type,
- .u.enum_nestable.container_type =
- __LTTNG_COMPOUND_LITERAL(struct lttng_type,
- __type_integer(uint8_t, 0, 0, -1,
- __BIG_ENDIAN, 10, none)),
- },
- },
- [5] = {
- .name = "hop_limit",
- .type = __type_integer(uint8_t, 0, 0, 0,
- __BIG_ENDIAN, 10, none),
- },
- [6] = {
- .name = "saddr",
- .type = {
- .type = lttng_kernel_type_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 = {
- .type = lttng_kernel_type_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 = {
- .type = lttng_kernel_type_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 = {
- .type = lttng_kernel_type_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,
- },
- },
-};
-
-static struct lttng_event_field network_fields[] = {
- [0] = {
- .name = "unknown",
- .type = {
- .type = lttng_kernel_type_struct_nestable,
- .u.struct_nestable.nr_fields = 0,
- .u.struct_nestable.fields = emptyfields,
- .u.struct_nestable.alignment = 0,
- },
- },
- [1] = {
- .name = "ipv4",
- .type = {
- .type = lttng_kernel_type_struct_nestable,
- .u.struct_nestable.nr_fields = ARRAY_SIZE(ipv4fields),
- .u.struct_nestable.fields = ipv4fields,
- .u.struct_nestable.alignment = 0,
- },
- },
- [2] = {
- .name = "ipv6",
- .type = {
- .type = lttng_kernel_type_struct_nestable,
- .u.struct_nestable.nr_fields = ARRAY_SIZE(ipv6fields),
- .u.struct_nestable.fields = ipv6fields,
- .u.struct_nestable.alignment = 0,
- },
- },
-};
-
enum network_header_types {
NH_NONE,
NH_IPV4,
#endif
+#ifdef LTTNG_CREATE_FIELD_METADATA
+
+static const struct lttng_kernel_event_field *emptyfields[] = {
+};
+
+/* Structures for transport headers. */
+
+static const struct lttng_kernel_event_field *tcpfields[] = {
+ [0] = lttng_kernel_static_event_field("source_port",
+ lttng_kernel_static_type_integer_from_type(uint16_t, __BIG_ENDIAN, 10),
+ false, false, false),
+ [1] = lttng_kernel_static_event_field("dest_port",
+ lttng_kernel_static_type_integer_from_type(uint16_t, __BIG_ENDIAN, 10),
+ false, false, false),
+ [2] = lttng_kernel_static_event_field("seq",
+ lttng_kernel_static_type_integer_from_type(uint32_t, __BIG_ENDIAN, 10),
+ false, false, false),
+ [3] = lttng_kernel_static_event_field("ack_seq",
+ lttng_kernel_static_type_integer_from_type(uint32_t, __BIG_ENDIAN, 10),
+ false, false, false),
+ [4] = lttng_kernel_static_event_field("data_offset",
+ lttng_kernel_static_type_integer(4, 4, 0, __BIG_ENDIAN, 10),
+ false, false, false),
+ [5] = lttng_kernel_static_event_field("reserved",
+ lttng_kernel_static_type_integer(3, 1, 0, __BIG_ENDIAN, 10),
+ false, false, false),
+ [6] = lttng_kernel_static_event_field("flags",
+ lttng_kernel_static_type_integer(9, 1, 0, __BIG_ENDIAN, 16),
+ false, false, false),
+ [7] = lttng_kernel_static_event_field("window_size",
+ lttng_kernel_static_type_integer_from_type(uint16_t, __BIG_ENDIAN, 10),
+ false, false, false),
+ [8] = lttng_kernel_static_event_field("checksum",
+ lttng_kernel_static_type_integer_from_type(uint16_t, __BIG_ENDIAN, 16),
+ false, false, false),
+ [9] = lttng_kernel_static_event_field("urg_ptr",
+ lttng_kernel_static_type_integer_from_type(uint16_t, __BIG_ENDIAN, 10),
+ false, false, false),
+};
+
+static const struct lttng_kernel_event_field *udpfields[] = {
+ [0] = lttng_kernel_static_event_field("source_port",
+ lttng_kernel_static_type_integer_from_type(uint16_t, __BIG_ENDIAN, 10),
+ false, false, false),
+ [1] = lttng_kernel_static_event_field("dest_port",
+ lttng_kernel_static_type_integer_from_type(uint16_t, __BIG_ENDIAN, 10),
+ false, false, false),
+ [2] = lttng_kernel_static_event_field("len",
+ lttng_kernel_static_type_integer_from_type(uint16_t, __BIG_ENDIAN, 10),
+ false, false, false),
+ [3] = lttng_kernel_static_event_field("check",
+ lttng_kernel_static_type_integer_from_type(uint16_t, __BIG_ENDIAN, 10),
+ false, false, false),
+};
+
+static const struct lttng_kernel_event_field *icmpfields[] = {
+ [0] = lttng_kernel_static_event_field("type",
+ lttng_kernel_static_type_integer_from_type(uint8_t, __BIG_ENDIAN, 10),
+ false, false, false),
+ [1] = lttng_kernel_static_event_field("code",
+ lttng_kernel_static_type_integer_from_type(uint8_t, __BIG_ENDIAN, 10),
+ false, false, false),
+ [2] = lttng_kernel_static_event_field("checksum",
+ lttng_kernel_static_type_integer_from_type(uint16_t, __BIG_ENDIAN, 10),
+ false, false, false),
+ [3] = lttng_kernel_static_event_field("gateway",
+ lttng_kernel_static_type_integer_from_type(uint32_t, __BIG_ENDIAN, 10),
+ false, false, false),
+};
+
+static const struct lttng_kernel_event_field *transport_fields[] = {
+ [0] = lttng_kernel_static_event_field("unknown",
+ lttng_kernel_static_type_struct(ARRAY_SIZE(emptyfields), emptyfields, 0),
+ false, false, true),
+ [1] = lttng_kernel_static_event_field("tcp",
+ lttng_kernel_static_type_struct(ARRAY_SIZE(tcpfields), tcpfields, 0),
+ false, false, true),
+ [2] = lttng_kernel_static_event_field("udp",
+ lttng_kernel_static_type_struct(ARRAY_SIZE(udpfields), udpfields, 0),
+ false, false, true),
+ [3] = lttng_kernel_static_event_field("icmp",
+ lttng_kernel_static_type_struct(ARRAY_SIZE(icmpfields), icmpfields, 0),
+ false, false, true),
+};
+
+#endif /* LTTNG_CREATE_FIELD_METADATA */
+
+LTTNG_TRACEPOINT_ENUM(proto_transport_header_type,
+ TP_ENUM_VALUES(
+ ctf_enum_range("_unknown", 0, IPPROTO_ICMP - 1)
+ ctf_enum_value("_icmp", IPPROTO_ICMP)
+ ctf_enum_range("_unknown", IPPROTO_ICMP + 1, IPPROTO_TCP - 1)
+ ctf_enum_value("_tcp", IPPROTO_TCP)
+ ctf_enum_range("_unknown", IPPROTO_TCP + 1, IPPROTO_UDP - 1)
+ ctf_enum_value("_udp", IPPROTO_UDP)
+ ctf_enum_range("_unknown", IPPROTO_UDP + 1, 255)
+ )
+)
+
+LTTNG_TRACEPOINT_ENUM(transport_header_type,
+ TP_ENUM_VALUES(
+ ctf_enum_value("_unknown", TH_NONE)
+ ctf_enum_value("_tcp", TH_TCP)
+ ctf_enum_value("_udp", TH_UDP)
+ ctf_enum_value("_icmp", TH_ICMP)
+ )
+)
+
+#ifdef LTTNG_CREATE_FIELD_METADATA
+
+/* Structures for network headers. */
+
+static const struct lttng_kernel_event_field *ipv4fields[] = {
+ [0] = lttng_kernel_static_event_field("version",
+ lttng_kernel_static_type_integer(4, 4, 0, __BIG_ENDIAN, 10),
+ false, false, false),
+ [1] = lttng_kernel_static_event_field("ihl",
+ lttng_kernel_static_type_integer(4, 4, 0, __BIG_ENDIAN, 10),
+ false, false, false),
+ [2] = lttng_kernel_static_event_field("tos",
+ lttng_kernel_static_type_integer_from_type(uint8_t, __BIG_ENDIAN, 10),
+ false, false, false),
+ [3] = lttng_kernel_static_event_field("tot_len",
+ lttng_kernel_static_type_integer_from_type(uint16_t, __BIG_ENDIAN, 10),
+ false, false, false),
+ [4] = lttng_kernel_static_event_field("id",
+ lttng_kernel_static_type_integer_from_type(uint16_t, __BIG_ENDIAN, 16),
+ false, false, false),
+ [5] = lttng_kernel_static_event_field("frag_off",
+ lttng_kernel_static_type_integer_from_type(uint16_t, __BIG_ENDIAN, 10),
+ false, false, false),
+ [6] = lttng_kernel_static_event_field("ttl",
+ lttng_kernel_static_type_integer_from_type(uint8_t, __BIG_ENDIAN, 10),
+ false, false, false),
+ [7] = lttng_kernel_static_event_field("protocol",
+ lttng_kernel_static_type_enum(&__enum_proto_transport_header_type,
+ lttng_kernel_static_type_integer_from_type(uint8_t, __BIG_ENDIAN, 10)),
+ false, false, false),
+ [8] = lttng_kernel_static_event_field("checksum",
+ lttng_kernel_static_type_integer_from_type(uint16_t, __BIG_ENDIAN, 16),
+ false, false, false),
+ [9] = lttng_kernel_static_event_field("saddr",
+ lttng_kernel_static_type_array(4,
+ lttng_kernel_static_type_integer_from_type(uint8_t, __BIG_ENDIAN, 10),
+ lttng_alignof(uint8_t), none),
+ false, false, false),
+ [10] = lttng_kernel_static_event_field("daddr",
+ lttng_kernel_static_type_array(4,
+ lttng_kernel_static_type_integer_from_type(uint8_t, __BIG_ENDIAN, 10),
+ lttng_alignof(uint8_t), none),
+ false, false, false),
+ [11] = lttng_kernel_static_event_field("transport_header_type",
+ lttng_kernel_static_type_enum(&__enum_transport_header_type,
+ lttng_kernel_static_type_integer_from_type(uint8_t, __BYTE_ORDER, 10)),
+ false, false, false),
+ [12] = lttng_kernel_static_event_field("transport_header",
+ lttng_kernel_static_type_variant(ARRAY_SIZE(transport_fields), transport_fields,
+ "transport_header_type", 0),
+ false, false, false),
+};
+
+static const struct lttng_kernel_event_field *ipv6fields[] = {
+ [0] = lttng_kernel_static_event_field("version",
+ lttng_kernel_static_type_integer(4, 4, 0, __BIG_ENDIAN, 10),
+ false, false, false),
+ [1] = lttng_kernel_static_event_field("prio",
+ lttng_kernel_static_type_integer(4, 4, 0, __BIG_ENDIAN, 10),
+ false, false, false),
+ [2] = lttng_kernel_static_event_field("flow_lbl",
+ lttng_kernel_static_type_array(3, lttng_kernel_static_type_integer_from_type(uint8_t, __BIG_ENDIAN, 16), lttng_alignof(uint8_t), none),
+ false, false, false),
+ [3] = lttng_kernel_static_event_field("payload_len",
+ lttng_kernel_static_type_integer_from_type(uint16_t, __BIG_ENDIAN, 10),
+ false, false, false),
+ [4] = lttng_kernel_static_event_field("nexthdr",
+ lttng_kernel_static_type_enum(&__enum_proto_transport_header_type,
+ lttng_kernel_static_type_integer_from_type(uint8_t, __BIG_ENDIAN, 10)),
+ false, false, false),
+ [5] = lttng_kernel_static_event_field("hop_limit",
+ lttng_kernel_static_type_integer_from_type(uint8_t, __BIG_ENDIAN, 10),
+ false, false, false),
+ [6] = lttng_kernel_static_event_field("saddr",
+ lttng_kernel_static_type_array(8, lttng_kernel_static_type_integer_from_type(uint16_t, __BIG_ENDIAN, 16), lttng_alignof(uint16_t), none),
+ false, false, false),
+ [7] = lttng_kernel_static_event_field("daddr",
+ lttng_kernel_static_type_array(8, lttng_kernel_static_type_integer_from_type(uint16_t, __BIG_ENDIAN, 16), lttng_alignof(uint16_t), none),
+ false, false, false),
+ [8] = lttng_kernel_static_event_field("transport_header_type",
+ lttng_kernel_static_type_enum(&__enum_transport_header_type,
+ lttng_kernel_static_type_integer_from_type(uint8_t, __BYTE_ORDER, 10)),
+ false, false, false),
+ [9] = lttng_kernel_static_event_field("transport_header",
+ lttng_kernel_static_type_variant(ARRAY_SIZE(transport_fields),
+ transport_fields, "transport_header_type", 0),
+ false, false, false),
+};
+
+static const struct lttng_kernel_event_field *network_fields[] = {
+ [0] = lttng_kernel_static_event_field("unknown",
+ lttng_kernel_static_type_struct(0, emptyfields, 0),
+ false, false, false),
+ [1] = lttng_kernel_static_event_field("ipv4",
+ lttng_kernel_static_type_struct(ARRAY_SIZE(ipv4fields), ipv4fields, 0),
+ false, false, false),
+ [2] = lttng_kernel_static_event_field("ipv6",
+ lttng_kernel_static_type_struct(ARRAY_SIZE(ipv6fields), ipv6fields, 0),
+ false, false, false),
+};
+
+#endif /* LTTNG_CREATE_FIELD_METADATA */
+
LTTNG_TRACEPOINT_ENUM(net_network_header,
TP_ENUM_VALUES(
ctf_enum_value("_unknown", NH_NONE)
network_header_type, __get_network_header_type(skb))
ctf_custom_field(
ctf_custom_type(
- {
- .type = lttng_kernel_type_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,
- }
+ lttng_kernel_static_type_variant(ARRAY_SIZE(network_fields),
+ network_fields, "network_header_type", 0)
),
network_header,
ctf_custom_code(
)
#define LTTNG_MMAP_FLAGS_TYPE \
-{ \
- .name = "type", \
- .type = { \
- .type = lttng_kernel_type_enum_nestable, \
- .u = { \
- .enum_nestable = { \
- .desc = &__enum_lttng_mmap_flags_mapping_type, \
- .container_type = __LTTNG_COMPOUND_LITERAL( \
- struct lttng_type, __type_integer(uint32_t, \
- 4, 1, -1, __BYTE_ORDER, 16, none)), \
- }, \
- }, \
- }, \
-}
+ lttng_kernel_static_event_field("type", \
+ lttng_kernel_static_type_enum(&__enum_lttng_mmap_flags_mapping_type, \
+ lttng_kernel_static_type_integer(4, 1, 0, __BYTE_ORDER, 16)), \
+ false, false, false)
#define LTTNG_MMAP_FLAGS_OPTIONS \
-{ \
- .name = "options", \
- .type = { \
- .type = lttng_kernel_type_enum_nestable, \
- .u = { \
- .enum_nestable = { \
- .desc = &__enum_lttng_mmap_flags_options, \
- .container_type = __LTTNG_COMPOUND_LITERAL( \
- struct lttng_type, __type_integer(uint32_t, \
- 28, 1, -1, __BYTE_ORDER, 16, none)),\
- }, \
- }, \
- }, \
-}
+ lttng_kernel_static_event_field("options", \
+ lttng_kernel_static_type_enum(&__enum_lttng_mmap_flags_options, \
+ lttng_kernel_static_type_integer(28, 1, 0, __BYTE_ORDER, 16)), \
+ false, false, false)
#if (__BYTE_ORDER == __LITTLE_ENDIAN)
#define LTTNG_MMAP_FLAGS \
+lttng_kernel_static_event_field_array( \
[0] = LTTNG_MMAP_FLAGS_TYPE, \
- [1] = LTTNG_MMAP_FLAGS_OPTIONS,
-
+ [1] = LTTNG_MMAP_FLAGS_OPTIONS, \
+)
#else
#define LTTNG_MMAP_FLAGS \
+lttng_kernel_static_event_field_array( \
[0] = LTTNG_MMAP_FLAGS_OPTIONS, \
- [1] = LTTNG_MMAP_FLAGS_TYPE,
+ [1] = LTTNG_MMAP_FLAGS_TYPE, \
+)
#endif
/*
sc_in(
ctf_custom_field(
ctf_custom_type(
- {
- .type = lttng_kernel_type_struct_nestable,
- .u.struct_nestable.nr_fields = 2,
- .u.struct_nestable.fields =
- __LTTNG_COMPOUND_LITERAL(struct lttng_event_field,
- LTTNG_MMAP_FLAGS
- ),
- .u.struct_nestable.alignment = lttng_alignof(uint32_t) * CHAR_BIT,
- }
+ lttng_kernel_static_type_struct(2, LTTNG_MMAP_FLAGS, lttng_alignof(uint32_t) * CHAR_BIT)
),
flags,
ctf_custom_code(
)
#define LTTNG_CLONE_FLAGS_EXIT_SIGNAL \
-{ \
- .name = "exit_signal", \
- .type = { \
- .type = lttng_kernel_type_enum_nestable, \
- .u = { \
- .enum_nestable = { \
- .desc = &__enum_lttng_clone_exit_signal_flags, \
- .container_type = __LTTNG_COMPOUND_LITERAL( \
- struct lttng_type, __type_integer(unsigned long, \
- CLONE_EXIT_SIGNAL_FLAG_RESERVED_BITS, \
- 1, -1, __BYTE_ORDER, 16, none)), \
- }, \
- }, \
- }, \
-}
+ lttng_kernel_static_event_field("exit_signal", \
+ lttng_kernel_static_type_enum(&__enum_lttng_clone_exit_signal_flags, \
+ lttng_kernel_static_type_integer(CLONE_EXIT_SIGNAL_FLAG_RESERVED_BITS, \
+ 1, 0, __BYTE_ORDER, 16)), \
+ false, false, false)
#define LTTNG_CLONE_FLAGS_OPTIONS \
-{ \
- .name = "options", \
- .type = { \
- .type = lttng_kernel_type_enum_nestable, \
- .u = { \
- .enum_nestable = { \
- .desc = &__enum_lttng_clone_option_flags, \
- .container_type = __LTTNG_COMPOUND_LITERAL( \
- struct lttng_type, __type_integer(unsigned long,\
- sizeof(unsigned long) * CHAR_BIT - CLONE_EXIT_SIGNAL_FLAG_RESERVED_BITS, \
- 1, -1, __BYTE_ORDER, 16, none)), \
- }, \
- }, \
- }, \
-}
+ lttng_kernel_static_event_field("options", \
+ lttng_kernel_static_type_enum(&__enum_lttng_clone_option_flags, \
+ lttng_kernel_static_type_integer( \
+ sizeof(unsigned long) * CHAR_BIT - CLONE_EXIT_SIGNAL_FLAG_RESERVED_BITS, \
+ 1, 0, __BYTE_ORDER, 16)), \
+ false, false, false)
#if (__BYTE_ORDER == __LITTLE_ENDIAN)
#define LTTNG_CLONE_FLAGS \
+lttng_kernel_static_event_field_array( \
[0] = LTTNG_CLONE_FLAGS_EXIT_SIGNAL, \
- [1] = LTTNG_CLONE_FLAGS_OPTIONS,
-
+ [1] = LTTNG_CLONE_FLAGS_OPTIONS, \
+)
#else
#define LTTNG_CLONE_FLAGS \
+lttng_kernel_static_event_field_array( \
[0] = LTTNG_CLONE_FLAGS_OPTIONS, \
- [1] = LTTNG_CLONE_FLAGS_EXIT_SIGNAL,
+ [1] = LTTNG_CLONE_FLAGS_EXIT_SIGNAL, \
+)
#endif
sc_in(
ctf_custom_field(
ctf_custom_type(
- {
- .type = lttng_kernel_type_struct_nestable,
- .u.struct_nestable.nr_fields = 2,
- .u.struct_nestable.fields =
- __LTTNG_COMPOUND_LITERAL(struct lttng_event_field,
- LTTNG_CLONE_FLAGS
- ),
- .u.struct_nestable.alignment = lttng_alignof(unsigned long) * CHAR_BIT,
- }
+ lttng_kernel_static_type_struct(2, LTTNG_CLONE_FLAGS, lttng_alignof(unsigned long) * CHAR_BIT)
),
flags,
ctf_custom_code(
#define LTTNG_SYSCALL_SELECT_fds_field_LE(name, input) \
ctf_custom_field( \
ctf_custom_type( \
- __type_integer(uint8_t, 0, 0, 0, __BYTE_ORDER, 10, none) \
+ lttng_kernel_static_type_integer_from_type(uint8_t, __BYTE_ORDER, 10) \
), \
_ ## name ## _length, \
ctf_custom_code( \
) \
ctf_custom_field( \
ctf_custom_type( \
- { \
- .type = lttng_kernel_type_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, \
- } \
+ lttng_kernel_static_type_sequence( \
+ "_" #name "_length", \
+ lttng_kernel_static_type_integer_from_type(uint8_t, __BYTE_ORDER, 16), \
+ 0, \
+ none) \
), \
name, \
ctf_custom_code( \
#define LTTNG_SYSCALL_SELECT_fds_field_BE(name, input) \
ctf_custom_field( \
ctf_custom_type( \
- __type_integer(uint8_t, 0, 0, 0, __BYTE_ORDER, 10, none) \
+ lttng_kernel_static_type_integer_from_type(uint8_t, __BYTE_ORDER, 10) \
), \
_ ## name ## _length, \
ctf_custom_code( \
) \
ctf_custom_field( \
ctf_custom_type( \
- { \
- .type = lttng_kernel_type_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, \
- } \
+ lttng_kernel_static_type_sequence("_" #name "_length", \
+ lttng_kernel_static_type_integer_from_type(uint8_t, __BYTE_ORDER, 16), \
+ 0, \
+ none) \
), \
name, \
ctf_custom_code( \
/*
* Only extract the values specified by iBCS2 for now.
*/
-static struct lttng_event_field lttng_pollfd_flag_fields[] = {
- [ilog2(POLLIN)] = {
- .name = "POLLIN",
- .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none),
- },
- [ilog2(POLLPRI)] = {
- .name = "POLLPRI",
- .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none),
- },
- [ilog2(POLLOUT)] = {
- .name = "POLLOUT",
- .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none),
- },
- [ilog2(POLLERR)] = {
- .name = "POLLERR",
- .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none),
- },
- [ilog2(POLLHUP)] = {
- .name = "POLLHUP",
- .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none),
- },
- [ilog2(POLLNVAL)] = {
- .name = "POLLNVAL",
- .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none),
- },
- [ilog2(LTTNG_POLL_NRFLAGS)] = {
- .name = "padding",
- .type = __type_integer(int, POLL_FLAGS_PADDING_SIZE, 1, 0,
- __LITTLE_ENDIAN, 10, none),
- },
+static const struct lttng_kernel_event_field *lttng_pollfd_flag_fields[] = {
+ [ilog2(POLLIN)] = lttng_kernel_static_event_field("POLLIN",
+ lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10),
+ false, false, false),
+ [ilog2(POLLPRI)] = lttng_kernel_static_event_field("POLLPRI",
+ lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10),
+ false, false, false),
+ [ilog2(POLLOUT)] = lttng_kernel_static_event_field("POLLOUT",
+ lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10),
+ false, false, false),
+ [ilog2(POLLERR)] = lttng_kernel_static_event_field("POLLERR",
+ lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10),
+ false, false, false),
+ [ilog2(POLLHUP)] = lttng_kernel_static_event_field("POLLHUP",
+ lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10),
+ false, false, false),
+ [ilog2(POLLNVAL)] = lttng_kernel_static_event_field("POLLNVAL",
+ lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10),
+ false, false, false),
+ [ilog2(LTTNG_POLL_NRFLAGS)] = lttng_kernel_static_event_field("padding",
+ lttng_kernel_static_type_integer(POLL_FLAGS_PADDING_SIZE, 1, 0, __LITTLE_ENDIAN, 10),
+ false, false, false),
};
-static struct lttng_event_field lttng_pollfd_fields[] = {
- [0] = {
- .name = "fd",
- .type = __type_integer(int, 0, 0, 0, __BYTE_ORDER, 10, none),
- },
- [1] = {
- .name = "raw_events",
- .type = __type_integer(short, 0, 0, 0, __BYTE_ORDER, 16, none),
- },
- [2] = {
- .name = "events",
- .type = {
- .type = lttng_kernel_type_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 const struct lttng_kernel_event_field *lttng_pollfd_fields[] = {
+ [0] = lttng_kernel_static_event_field("fd", lttng_kernel_static_type_integer_from_type(int, __BYTE_ORDER, 10),
+ false, false, false),
+ [1] = lttng_kernel_static_event_field("raw_events", lttng_kernel_static_type_integer_from_type(uint16_t, __BYTE_ORDER, 16),
+ false, false, false),
+ [2] = lttng_kernel_static_event_field("events",
+ lttng_kernel_static_type_struct(ARRAY_SIZE(lttng_pollfd_flag_fields),
+ lttng_pollfd_flag_fields, 0),
+ false, false, false),
};
-static struct lttng_type lttng_pollfd_elem = {
- .type = lttng_kernel_type_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 */
#define LTTNG_SYSCALL_POLL_locvar \
sc_in( \
ctf_custom_field( \
ctf_custom_type( \
- { \
- .type = lttng_kernel_type_sequence_nestable, \
- .u.sequence_nestable.length_name = "fds_length", \
- .u.sequence_nestable.elem_type = <tng_pollfd_elem, \
- } \
+ lttng_kernel_static_type_sequence("fds_length", \
+ lttng_kernel_static_type_struct(ARRAY_SIZE(lttng_pollfd_fields), lttng_pollfd_fields, 0), \
+ 0, \
+ none) \
), \
fds, \
ctf_custom_code( \
sc_out( \
ctf_custom_field( \
ctf_custom_type( \
- { \
- .type = lttng_kernel_type_sequence_nestable, \
- .u.sequence_nestable.length_name = "fds_length", \
- .u.sequence_nestable.elem_type = <tng_pollfd_elem, \
- } \
+ lttng_kernel_static_type_sequence("fds_length", \
+ lttng_kernel_static_type_struct(ARRAY_SIZE(lttng_pollfd_fields), lttng_pollfd_fields, 0), \
+ 0, \
+ none) \
), \
fds, \
ctf_custom_code( \
/*
* Only extract the values specified by iBCS2 for now.
*/
-static struct lttng_event_field lttng_epoll_ctl_events_fields[] = {
+static const struct lttng_kernel_event_field *lttng_epoll_ctl_events_fields[] = {
/* 0x0001 */
- [ilog2(POLLIN)] = {
- .name = "EPOLLIN",
- .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none),
- },
+ [ilog2(POLLIN)] = lttng_kernel_static_event_field("EPOLLIN",
+ lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10),
+ false, false, false),
/* 0x0002 */
- [ilog2(POLLPRI)] = {
- .name = "EPOLLPRI",
- .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none),
- },
+ [ilog2(POLLPRI)] = lttng_kernel_static_event_field("EPOLLPRI",
+ lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10),
+ false, false, false),
/* 0x0004 */
- [ilog2(POLLOUT)] = {
- .name = "EPOLLOUT",
- .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none),
- },
+ [ilog2(POLLOUT)] = lttng_kernel_static_event_field("EPOLLOUT",
+ lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10),
+ false, false, false),
/* 0x0008 */
- [ilog2(POLLERR)] = {
- .name = "EPOLLERR",
- .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none),
- },
+ [ilog2(POLLERR)] = lttng_kernel_static_event_field("EPOLLERR",
+ lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10),
+ false, false, false),
/* 0x0010 */
- [ilog2(POLLHUP)] = {
- .name = "EPOLLHUP",
- .type = __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN, 10, none),
- },
- [ilog2(LTTNG_EPOLL_NRFLAGS)] = {
- .name = "padding",
- .type = __type_integer(int, EPOLL_FLAGS_PADDING_SIZE, 1, 0,
- __LITTLE_ENDIAN, 10, none),
- },
-
+ [ilog2(POLLHUP)] = lttng_kernel_static_event_field("EPOLLHUP",
+ lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10),
+ false, false, false),
+ [ilog2(LTTNG_EPOLL_NRFLAGS)] = lttng_kernel_static_event_field("padding",
+ lttng_kernel_static_type_integer(EPOLL_FLAGS_PADDING_SIZE, 1, 0, __LITTLE_ENDIAN, 10),
+ false, false, false),
};
-static struct lttng_event_field lttng_epoll_data_fields[] = {
- [0] = {
- .name = "u64",
- .type = __type_integer(uint64_t, 0, 0, 0, __BYTE_ORDER, 16, none),
- },
- [1] = {
- .name = "fd",
- .type = __type_integer(int, 0, 0, 0, __BYTE_ORDER, 10, none),
- },
+static const struct lttng_kernel_event_field *lttng_epoll_data_fields[] = {
+ [0] = lttng_kernel_static_event_field("u64",
+ lttng_kernel_static_type_integer_from_type(uint64_t, __BYTE_ORDER, 16),
+ false, false, false),
+ [1] = lttng_kernel_static_event_field("fd",
+ lttng_kernel_static_type_integer_from_type(int, __BYTE_ORDER, 10),
+ false, false, false),
};
-static struct lttng_event_field epoll_ctl_fields[] = {
- [0] = {
- .name = "data_union",
- .type = {
- .type = lttng_kernel_type_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] = {
- .name = "raw_events",
- .type = __type_integer(uint32_t, 0, 0, 0, __BYTE_ORDER, 16, none),
- },
- [2] = {
- .name = "events",
- .type = {
- .type = lttng_kernel_type_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 const struct lttng_kernel_event_field *epoll_ctl_fields[] = {
+ [0] = lttng_kernel_static_event_field("data_union",
+ lttng_kernel_static_type_struct(ARRAY_SIZE(lttng_epoll_data_fields),
+ lttng_epoll_data_fields,
+ 0),
+ false, false, false),
+ [1] = lttng_kernel_static_event_field("raw_events",
+ lttng_kernel_static_type_integer_from_type(uint32_t, __BYTE_ORDER, 16),
+ false, false, false),
+ [2] = lttng_kernel_static_event_field("events",
+ lttng_kernel_static_type_struct(ARRAY_SIZE(lttng_epoll_ctl_events_fields),
+ lttng_epoll_ctl_events_fields,
+ 0),
+ false, false, false),
};
#endif /* ONCE_LTTNG_TRACE_EPOLL_CTL_H */
sc_in(
ctf_custom_field(
ctf_custom_type(
- {
- .type = lttng_kernel_type_struct_nestable,
- .u.struct_nestable.nr_fields = ARRAY_SIZE(epoll_ctl_fields),
- .u.struct_nestable.fields = epoll_ctl_fields,
- .u.struct_nestable.alignment = 0,
- }
+ lttng_kernel_static_type_struct(ARRAY_SIZE(epoll_ctl_fields), epoll_ctl_fields, 0)
),
event,
ctf_custom_code(
#ifndef ONCE_LTTNG_TRACE_EPOLL_H
#define ONCE_LTTNG_TRACE_EPOLL_H
-static struct lttng_event_field lttng_epoll_wait_fields[] = {
- [0] = {
- .name = "data_union",
- .type = {
- .type = lttng_kernel_type_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] = {
- .name = "raw_events",
- .type = __type_integer(uint32_t, 0, 0, 0, __BYTE_ORDER, 16, none),
- },
- [2] = {
- .name = "events",
- .type = {
- .type = lttng_kernel_type_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 = {
- .type = lttng_kernel_type_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,
-};
+static const struct lttng_kernel_event_field *lttng_epoll_wait_fields[] = lttng_kernel_static_event_field_array(
+ [0] = lttng_kernel_static_event_field("data_union",
+ lttng_kernel_static_type_struct(ARRAY_SIZE(lttng_epoll_data_fields), lttng_epoll_data_fields, 0),
+ false, false, false),
+ [1] = lttng_kernel_static_event_field("raw_events", lttng_kernel_static_type_integer_from_type(uint32_t, __BYTE_ORDER, 16),
+ false, false, false),
+ [2] = lttng_kernel_static_event_field("events",
+ lttng_kernel_static_type_struct(ARRAY_SIZE(lttng_epoll_ctl_events_fields), lttng_epoll_ctl_events_fields, 0),
+ false, false, false),
+);
#endif /* ONCE_LTTNG_TRACE_EPOLL_H */
tp_locvar->fds_length = ret; \
} \
\
- tp_locvar->events = lttng_tp_mempool_alloc( \
+ tp_locvar->events = lttng_tp_mempool_alloc( \
maxalloc * sizeof(struct epoll_event)); \
if (!tp_locvar->events) { \
tp_locvar->fds_length = 0; \
#define LTTNG_SYSCALL_EPOLL_WAIT_fds_field \
ctf_custom_field( \
ctf_custom_type( \
- { \
- .type = lttng_kernel_type_sequence_nestable, \
- .u.sequence_nestable.length_name = \
- "fds_length", \
- .u.sequence_nestable.elem_type = \
- <tng_epoll_wait_elem, \
- } \
+ lttng_kernel_static_type_sequence("fds_length", \
+ lttng_kernel_static_type_struct(ARRAY_SIZE(lttng_epoll_wait_fields), lttng_epoll_wait_fields, 0), \
+ 0, \
+ none) \
), \
fds, \
ctf_custom_code( \
#ifndef _LTTNG_EVENTS_INTERNAL_H
#define _LTTNG_EVENTS_INTERNAL_H
+#include <lttng/events.h>
+
+static inline
+const struct lttng_kernel_type_integer *lttng_kernel_get_type_integer(const struct lttng_kernel_type_common *type)
+{
+ if (type->type != lttng_kernel_type_integer)
+ return NULL;
+ return container_of(type, const struct lttng_kernel_type_integer, parent);
+}
+
+static inline
+const struct lttng_kernel_type_string *lttng_kernel_get_type_string(const struct lttng_kernel_type_common *type)
+{
+ if (type->type != lttng_kernel_type_string)
+ return NULL;
+ return container_of(type, const struct lttng_kernel_type_string, parent);
+}
+
+static inline
+const struct lttng_kernel_type_enum *lttng_kernel_get_type_enum(const struct lttng_kernel_type_common *type)
+{
+ if (type->type != lttng_kernel_type_enum)
+ return NULL;
+ return container_of(type, const struct lttng_kernel_type_enum, parent);
+}
+
+static inline
+const struct lttng_kernel_type_array *lttng_kernel_get_type_array(const struct lttng_kernel_type_common *type)
+{
+ if (type->type != lttng_kernel_type_array)
+ return NULL;
+ return container_of(type, const struct lttng_kernel_type_array, parent);
+}
+
+static inline
+const struct lttng_kernel_type_sequence *lttng_kernel_get_type_sequence(const struct lttng_kernel_type_common *type)
+{
+ if (type->type != lttng_kernel_type_sequence)
+ return NULL;
+ return container_of(type, const struct lttng_kernel_type_sequence, parent);
+}
+
+static inline
+const struct lttng_kernel_type_struct *lttng_kernel_get_type_struct(const struct lttng_kernel_type_common *type)
+{
+ if (type->type != lttng_kernel_type_struct)
+ return NULL;
+ return container_of(type, const struct lttng_kernel_type_struct, parent);
+}
+
+static inline
+const struct lttng_kernel_type_variant *lttng_kernel_get_type_variant(const struct lttng_kernel_type_common *type)
+{
+ if (type->type != lttng_kernel_type_variant)
+ return NULL;
+ return container_of(type, const struct lttng_kernel_type_variant, parent);
+}
+
+static inline bool lttng_kernel_type_is_bytewise_integer(const struct lttng_kernel_type_common *type)
+{
+ const struct lttng_kernel_type_integer *type_integer = lttng_kernel_get_type_integer(type);
+
+ if (!type_integer)
+ return false;
+ switch (type_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_INTERNAL_H */
enum lttng_kernel_type {
lttng_kernel_type_integer,
lttng_kernel_type_string,
- lttng_kernel_type_enum_nestable,
- lttng_kernel_type_array_nestable,
- lttng_kernel_type_sequence_nestable,
- lttng_kernel_type_struct_nestable,
- lttng_kernel_type_variant_nestable,
+ lttng_kernel_type_enum,
+ lttng_kernel_type_array,
+ lttng_kernel_type_sequence,
+ lttng_kernel_type_struct,
+ lttng_kernel_type_variant,
NR_LTTNG_KERNEL_TYPES,
};
} options;
};
-#define __type_integer(_type, _size, _alignment, _signedness, \
- _byte_order, _base, _encoding) \
- { \
- .type = lttng_kernel_type_integer, \
- .u.integer = \
- { \
- .size = (_size) ? : sizeof(_type) * CHAR_BIT, \
- .alignment = (_alignment) ? : lttng_alignof(_type) * CHAR_BIT, \
- .signedness = (_signedness) >= 0 ? (_signedness) : lttng_is_signed_type(_type), \
- .reverse_byte_order = _byte_order != __BYTE_ORDER, \
- .base = _base, \
- .encoding = lttng_kernel_string_encoding_##_encoding, \
- }, \
- } \
-
-struct lttng_integer_type {
+/*
+ * struct lttng_kernel_type_common is fixed-size. Its children inherits
+ * from it by embedding struct lttng_kernel_type_common as its first field.
+ */
+struct lttng_kernel_type_common {
+ enum lttng_kernel_type type;
+};
+
+struct lttng_kernel_type_integer {
+ struct lttng_kernel_type_common parent;
unsigned int size; /* in bits */
unsigned short alignment; /* in bits */
unsigned int signedness:1,
reverse_byte_order:1;
unsigned int base; /* 2, 8, 10, 16, for pretty print */
+};
+
+struct lttng_kernel_type_string {
+ struct lttng_kernel_type_common parent;
enum lttng_kernel_string_encoding encoding;
};
-struct lttng_type {
- enum lttng_kernel_type type;
- union {
- struct lttng_integer_type integer;
- struct {
- enum lttng_kernel_string_encoding encoding;
- } string;
- struct {
- const struct lttng_kernel_enum_desc *desc; /* Enumeration mapping */
- const struct lttng_type *container_type;
- } enum_nestable;
- struct {
- const struct lttng_type *elem_type;
- unsigned int length; /* Num. elems. */
- unsigned int alignment;
- } array_nestable;
- struct {
- const char *length_name; /* Length field name. */
- const struct lttng_type *elem_type;
- unsigned int alignment; /* Alignment before elements. */
- } sequence_nestable;
- struct {
- unsigned int nr_fields;
- const struct lttng_event_field *fields; /* Array of fields. */
- unsigned int alignment;
- } struct_nestable;
- struct {
- const char *tag_name;
- const struct lttng_event_field *choices; /* Array of fields. */
- unsigned int nr_choices;
- unsigned int alignment;
- } variant_nestable;
- } u;
+struct lttng_kernel_type_enum {
+ struct lttng_kernel_type_common parent;
+ const struct lttng_kernel_enum_desc *desc; /* Enumeration mapping */
+ const struct lttng_kernel_type_common *container_type;
+};
+
+struct lttng_kernel_type_array {
+ struct lttng_kernel_type_common parent;
+ const struct lttng_kernel_type_common *elem_type;
+ unsigned int length; /* Num. elems. */
+ unsigned int alignment;
+ enum lttng_kernel_string_encoding encoding;
+};
+
+struct lttng_kernel_type_sequence {
+ struct lttng_kernel_type_common parent;
+ const char *length_name; /* Length field name. */
+ const struct lttng_kernel_type_common *elem_type;
+ unsigned int alignment; /* Alignment before elements. */
+ enum lttng_kernel_string_encoding encoding;
+};
+
+struct lttng_kernel_type_struct {
+ struct lttng_kernel_type_common parent;
+ unsigned int nr_fields;
+ const struct lttng_kernel_event_field **fields; /* Array of pointers to fields. */
+ unsigned int alignment;
+};
+
+struct lttng_kernel_type_variant {
+ struct lttng_kernel_type_common parent;
+ const char *tag_name;
+ const struct lttng_kernel_event_field **choices; /* Array of pointers to fields. */
+ unsigned int nr_choices;
+ unsigned int alignment;
};
struct lttng_kernel_enum_desc {
const char *name;
- const struct lttng_kernel_enum_entry *entries;
+ const struct lttng_kernel_enum_entry **entries;
unsigned int nr_entries;
};
/* Event field description */
-struct lttng_event_field {
+struct lttng_kernel_event_field {
const char *name;
- struct lttng_type type;
+ const struct lttng_kernel_type_common *type;
unsigned int nowrite:1, /* do not write into trace */
user:1, /* fetch from user-space */
nofilter:1; /* do not consider for filter */
};
+#define lttng_kernel_static_type_integer(_size, _alignment, _signedness, _byte_order, _base) \
+ ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_integer, { \
+ .parent = { \
+ .type = lttng_kernel_type_integer, \
+ }, \
+ .size = (_size), \
+ .alignment = (_alignment), \
+ .signedness = (_signedness), \
+ .reverse_byte_order = (_byte_order) != __BYTE_ORDER, \
+ .base = (_base), \
+ }))
+
+#define lttng_kernel_static_type_integer_from_type(_type, _byte_order, _base) \
+ lttng_kernel_static_type_integer(sizeof(_type) * CHAR_BIT, \
+ lttng_alignof(_type) * CHAR_BIT, \
+ lttng_is_signed_type(_type), \
+ _byte_order, \
+ _base)
+
+#define lttng_kernel_static_type_enum(_desc, _container_type) \
+ ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_enum, { \
+ .parent = { \
+ .type = lttng_kernel_type_enum, \
+ }, \
+ .desc = (_desc), \
+ .container_type = (_container_type), \
+ }))
+
+#define lttng_kernel_static_type_array(_length, _elem_type, _alignment, _encoding) \
+ ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_array, { \
+ .parent = { \
+ .type = lttng_kernel_type_array, \
+ }, \
+ .length = (_length), \
+ .alignment = (_alignment), \
+ .encoding = lttng_kernel_string_encoding_##_encoding, \
+ .elem_type = (_elem_type), \
+ }))
+
+#define lttng_kernel_static_type_array_text(_length) \
+ lttng_kernel_static_type_array(_length, \
+ lttng_kernel_static_type_integer(sizeof(char) * CHAR_BIT, \
+ lttng_alignof(char) * CHAR_BIT, lttng_is_signed_type(char), \
+ __BYTE_ORDER, 10), \
+ 0, UTF8)
+
+#define lttng_kernel_static_type_sequence(_length_name, _elem_type, _alignment, _encoding) \
+ ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_sequence, { \
+ .parent = { \
+ .type = lttng_kernel_type_sequence, \
+ }, \
+ .length_name = (_length_name), \
+ .alignment = (_alignment), \
+ .encoding = lttng_kernel_string_encoding_##_encoding, \
+ .elem_type = (_elem_type), \
+ }))
+
+#define lttng_kernel_static_type_string(_encoding) \
+ ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_string, { \
+ .parent = { \
+ .type = lttng_kernel_type_string, \
+ }, \
+ .encoding = lttng_kernel_string_encoding_##_encoding, \
+ }))
+
+#define lttng_kernel_static_type_struct(_nr_fields, _fields, _alignment) \
+ ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_struct, { \
+ .parent = { \
+ .type = lttng_kernel_type_struct, \
+ }, \
+ .nr_fields = (_nr_fields), \
+ .fields = _fields, \
+ .alignment = (_alignment), \
+ }))
+
+#define lttng_kernel_static_type_variant(_nr_choices, _choices, _tag_name, _alignment) \
+ ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_variant, { \
+ .parent = { \
+ .type = lttng_kernel_type_variant, \
+ }, \
+ .tag_name = (_tag_name), \
+ .choices = _choices, \
+ .nr_choices = (_nr_choices), \
+ .alignment = (_alignment), \
+ }))
+
+#define lttng_kernel_static_event_field(_name, _type, _nowrite, _user, _nofilter) \
+ __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_event_field, { \
+ .name = (_name), \
+ .type = (_type), \
+ .nowrite = (_nowrite), \
+ .user = (_user), \
+ .nofilter = (_nofilter), \
+ })
+
+#define lttng_kernel_static_event_field_array(_fields...) \
+ __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_event_field *, \
+ _fields \
+ )
+
+#define lttng_kernel_static_ctx_field(_event_field, _get_size, _get_size_arg, _record, _get_value, _destroy, _priv) \
+ __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_ctx_field, { \
+ .event_field = (_event_field), \
+ .get_size = (_get_size), \
+ .get_size_arg = (_get_size_arg), \
+ .record = (_record), \
+ .get_value = (_get_value), \
+ .destroy = (_destroy), \
+ .priv = (_priv), \
+ })
+
+#define lttng_kernel_static_enum_entry_value(_string, _value) \
+ __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_enum_entry, { \
+ .start = { \
+ .signedness = lttng_is_signed_type(__typeof__(_value)), \
+ .value = lttng_is_signed_type(__typeof__(_value)) ? \
+ (long long) (_value) : (_value), \
+ }, \
+ .end = { \
+ .signedness = lttng_is_signed_type(__typeof__(_value)), \
+ .value = lttng_is_signed_type(__typeof__(_value)) ? \
+ (long long) (_value) : (_value), \
+ }, \
+ .string = (_string), \
+ }),
+
+#define lttng_kernel_static_enum_entry_range(_string, _range_start, _range_end) \
+ __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_enum_entry, { \
+ .start = { \
+ .signedness = lttng_is_signed_type(__typeof__(_range_start)), \
+ .value = lttng_is_signed_type(__typeof__(_range_start)) ? \
+ (long long) (_range_start) : (_range_start), \
+ }, \
+ .end = { \
+ .signedness = lttng_is_signed_type(__typeof__(_range_end)), \
+ .value = lttng_is_signed_type(__typeof__(_range_end)) ? \
+ (long long) (_range_end) : (_range_end), \
+ }, \
+ .string = (_string), \
+ }),
+
+#define lttng_kernel_static_enum_entry_auto(_string) \
+ __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_enum_entry, { \
+ .start = { \
+ .signedness = -1, \
+ .value = -1, \
+ }, \
+ .end = { \
+ .signedness = -1, \
+ .value = -1, \
+ }, \
+ .string = (_string), \
+ .options = { \
+ .is_auto = 1, \
+ } \
+ }),
+
union lttng_ctx_value {
int64_t s64;
const char *str;
/*
* We need to keep this perf counter field separately from struct
- * lttng_ctx_field because cpu hotplug needs fixed-location addresses.
+ * lttng_kernel_ctx_field because cpu hotplug needs fixed-location addresses.
*/
struct lttng_perf_counter_field {
#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0))
#endif
struct perf_event_attr *attr;
struct perf_event **e; /* per-cpu array */
+ char *name;
+ struct lttng_kernel_event_field *event_field;
};
struct lttng_probe_ctx {
uint8_t interruptible;
};
-struct lttng_ctx_field {
- struct lttng_event_field event_field;
+struct lttng_kernel_ctx_field {
+ const struct lttng_kernel_event_field *event_field;
size_t (*get_size)(size_t offset);
- size_t (*get_size_arg)(size_t offset, struct lttng_ctx_field *field,
+ size_t (*get_size_arg)(size_t offset, struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan);
- void (*record)(struct lttng_ctx_field *field,
+ void (*record)(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan);
- void (*get_value)(struct lttng_ctx_field *field,
+ void (*get_value)(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value);
- union {
- struct lttng_perf_counter_field *perf_counter;
- } u;
- void (*destroy)(struct lttng_ctx_field *field);
- /*
- * Private data to keep state between get_size and record.
- * User must perform its own synchronization to protect against
- * concurrent and reentrant contexts.
- */
+ void (*destroy)(struct lttng_kernel_ctx_field *field);
void *priv;
};
-struct lttng_ctx {
- struct lttng_ctx_field *fields;
+struct lttng_kernel_ctx {
+ struct lttng_kernel_ctx_field *fields;
unsigned int nr_fields;
unsigned int allocated_fields;
size_t largest_align; /* in bytes */
};
-struct lttng_event_desc {
- const char *name; /* lttng-modules name */
- const char *kname; /* Linux kernel name (tracepoints) */
- void *probe_callback;
- const struct lttng_event_ctx *ctx; /* context */
- const struct lttng_event_field *fields; /* event payload */
+struct lttng_kernel_event_desc {
+ const char *event_name; /* lttng-modules name */
+ const char *event_kname; /* Linux kernel name (tracepoints) */
+ const struct lttng_kernel_probe_desc *probe_desc;
+ void (*probe_callback)(void);
+ const struct lttng_kernel_event_field **fields; /* event payload */
unsigned int nr_fields;
struct module *owner;
void *event_notifier_callback;
};
-struct lttng_probe_desc {
- const char *provider;
- const struct lttng_event_desc **event_desc;
+struct lttng_kernel_probe_desc {
+ const char *provider_name;
+ const struct lttng_kernel_event_desc **event_desc;
unsigned int nr_events;
struct list_head head; /* chain registered probes */
struct list_head lazy_init_head;
} interpreter_funcs;
int link_failed;
struct list_head node; /* list of bytecode runtime in event */
- struct lttng_ctx *ctx;
+ struct lttng_kernel_ctx *ctx;
};
/*
unsigned int id;
struct lttng_channel *chan;
int enabled;
- const struct lttng_event_desc *desc;
+ const struct lttng_kernel_event_desc *desc;
void *filter;
- struct lttng_ctx *ctx;
+ struct lttng_kernel_ctx *ctx;
enum lttng_kernel_instrumentation instrumentation;
union {
struct lttng_kprobe kprobe;
uint64_t error_counter_index;
int enabled;
int registered; /* has reg'd tracepoint probe */
- const struct lttng_event_desc *desc;
+ const struct lttng_kernel_event_desc *desc;
void *filter;
struct list_head list; /* event_notifier list in event_notifier group */
* Unused, but kept around to make it explicit that the tracer can do
* it.
*/
- struct lttng_ctx *ctx;
+ struct lttng_kernel_ctx *ctx;
};
struct lttng_event_notifier_enabler {
unsigned int id;
struct channel *chan; /* Channel buffers */
int enabled;
- struct lttng_ctx *ctx;
+ struct lttng_kernel_ctx *ctx;
/* Event ID management */
struct lttng_session *session;
struct file *file; /* File associated to channel */
struct list_head enablers_head; /* List of enablers */
struct list_head event_notifiers_head; /* List of event notifier */
struct lttng_event_notifier_ht event_notifiers_ht; /* Hash table of event notifiers */
- struct lttng_ctx *ctx; /* Contexts for filters. */
struct lttng_channel_ops *ops;
struct lttng_transport *transport;
struct channel *chan; /* Ring buffer channel for event notifier group. */
struct lttng_event *lttng_event_create(struct lttng_channel *chan,
struct lttng_kernel_event *event_param,
void *filter,
- const struct lttng_event_desc *event_desc,
+ const struct lttng_kernel_event_desc *event_desc,
enum lttng_kernel_instrumentation itype);
struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
struct lttng_kernel_event *event_param,
void *filter,
- const struct lttng_event_desc *event_desc,
+ const struct lttng_kernel_event_desc *event_desc,
enum lttng_kernel_instrumentation itype);
struct lttng_event *lttng_event_compat_old_create(struct lttng_channel *chan,
struct lttng_kernel_old_event *old_event_param,
void *filter,
- const struct lttng_event_desc *internal_desc);
+ const struct lttng_kernel_event_desc *internal_desc);
struct lttng_event_notifier *lttng_event_notifier_create(
- const struct lttng_event_desc *event_notifier_desc,
+ const struct lttng_kernel_event_desc *event_notifier_desc,
uint64_t id,
uint64_t error_counter_idx,
struct lttng_event_notifier_group *event_notifier_group,
void *filter,
enum lttng_kernel_instrumentation itype);
struct lttng_event_notifier *_lttng_event_notifier_create(
- const struct lttng_event_desc *event_notifier_desc,
+ const struct lttng_kernel_event_desc *event_notifier_desc,
uint64_t id,
uint64_t error_counter_idx,
struct lttng_event_notifier_group *event_notifier_group,
void lttng_abi_exit(void);
void lttng_abi_compat_old_exit(void);
-int lttng_probe_register(struct lttng_probe_desc *desc);
-void lttng_probe_unregister(struct lttng_probe_desc *desc);
-const struct lttng_event_desc *lttng_event_desc_get(const char *name);
-void lttng_event_desc_put(const struct lttng_event_desc *desc);
+int lttng_probe_register(struct lttng_kernel_probe_desc *desc);
+void lttng_probe_unregister(struct lttng_kernel_probe_desc *desc);
+const struct lttng_kernel_event_desc *lttng_event_desc_get(const char *name);
+void lttng_event_desc_put(const struct lttng_kernel_event_desc *desc);
int lttng_probes_init(void);
void lttng_probes_exit(void);
void lttng_clock_ref(void);
void lttng_clock_unref(void);
-int lttng_desc_match_enabler(const struct lttng_event_desc *desc,
+int lttng_desc_match_enabler(const struct lttng_kernel_event_desc *desc,
struct lttng_enabler *enabler);
#if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
struct lttng_event_notifier_enabler *event_notifier_enabler,
struct lttng_kernel_capture_bytecode __user *bytecode);
-void lttng_enabler_link_bytecode(const struct lttng_event_desc *event_desc,
- struct lttng_ctx *ctx,
+void lttng_enabler_link_bytecode(const struct lttng_kernel_event_desc *event_desc,
+ struct lttng_kernel_ctx *ctx,
struct list_head *instance_bytecode_runtime_head,
struct list_head *enabler_bytecode_runtime_head);
void lttng_free_event_filter_runtime(struct lttng_event *event);
int lttng_probes_init(void);
-extern struct lttng_ctx *lttng_static_ctx;
+extern struct lttng_kernel_ctx *lttng_static_ctx;
int lttng_context_init(void);
void lttng_context_exit(void);
-struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx);
-ssize_t lttng_append_context_index(struct lttng_ctx **ctx_p);
-struct lttng_ctx_field *lttng_get_context_field_from_index(struct lttng_ctx *ctx,
+int lttng_kernel_context_append(struct lttng_kernel_ctx **ctx_p,
+ const struct lttng_kernel_ctx_field *f);
+void lttng_kernel_context_remove_last(struct lttng_kernel_ctx **ctx_p);
+struct lttng_kernel_ctx_field *lttng_kernel_get_context_field_from_index(struct lttng_kernel_ctx *ctx,
size_t index);
-void lttng_context_update(struct lttng_ctx *ctx);
-int lttng_find_context(struct lttng_ctx *ctx, const char *name);
-int lttng_get_context_index(struct lttng_ctx *ctx, const char *name);
-void lttng_remove_context_field(struct lttng_ctx **ctx,
- struct lttng_ctx_field *field);
-void lttng_remove_context_field_index(struct lttng_ctx **ctx_p, size_t index);
-void lttng_destroy_context(struct lttng_ctx *ctx);
-int lttng_add_pid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_cpu_id_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_procname_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_prio_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_nice_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_tid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_ppid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_vppid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_hostname_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_interruptible_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_need_reschedule_to_ctx(struct lttng_ctx **ctx);
+int lttng_kernel_find_context(struct lttng_kernel_ctx *ctx, const char *name);
+int lttng_kernel_get_context_index(struct lttng_kernel_ctx *ctx, const char *name);
+void lttng_kernel_destroy_context(struct lttng_kernel_ctx *ctx);
+int lttng_add_pid_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_cpu_id_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_procname_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_prio_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_nice_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_vpid_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_tid_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_vtid_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_ppid_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_vppid_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_hostname_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_interruptible_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_need_reschedule_to_ctx(struct lttng_kernel_ctx **ctx);
#if defined(CONFIG_PREEMPT_RT_FULL) || defined(CONFIG_PREEMPT)
-int lttng_add_preemptible_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx **ctx);
#else
static inline
-int lttng_add_preemptible_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx **ctx)
{
return -ENOSYS;
}
#endif
#ifdef CONFIG_PREEMPT_RT_FULL
-int lttng_add_migratable_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx **ctx);
#else
static inline
-int lttng_add_migratable_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx **ctx)
{
return -ENOSYS;
}
#endif
-int lttng_add_callstack_to_ctx(struct lttng_ctx **ctx, int type);
+int lttng_add_callstack_to_ctx(struct lttng_kernel_ctx **ctx, int type);
#if defined(CONFIG_CGROUPS) && \
((LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0)) || \
LTTNG_UBUNTU_KERNEL_RANGE(4,4,0,0, 4,5,0,0))
-int lttng_add_cgroup_ns_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx **ctx);
#else
static inline
-int lttng_add_cgroup_ns_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx **ctx)
{
return -ENOSYS;
}
#if defined(CONFIG_IPC_NS) && \
(LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
-int lttng_add_ipc_ns_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx **ctx);
#else
static inline
-int lttng_add_ipc_ns_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx **ctx)
{
return -ENOSYS;
}
#if !defined(LTTNG_MNT_NS_MISSING_HEADER) && \
(LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
-int lttng_add_mnt_ns_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx **ctx);
#else
static inline
-int lttng_add_mnt_ns_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx **ctx)
{
return -ENOSYS;
}
#if defined(CONFIG_NET_NS) && \
(LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
-int lttng_add_net_ns_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx **ctx);
#else
static inline
-int lttng_add_net_ns_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx **ctx)
{
return -ENOSYS;
}
#if defined(CONFIG_PID_NS) && \
(LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
-int lttng_add_pid_ns_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx **ctx);
#else
static inline
-int lttng_add_pid_ns_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx **ctx)
{
return -ENOSYS;
}
#if defined(CONFIG_USER_NS) && \
(LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
-int lttng_add_user_ns_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx **ctx);
#else
static inline
-int lttng_add_user_ns_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx **ctx)
{
return -ENOSYS;
}
#if defined(CONFIG_UTS_NS) && \
(LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
-int lttng_add_uts_ns_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx **ctx);
#else
static inline
-int lttng_add_uts_ns_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx **ctx)
{
return -ENOSYS;
}
#if defined(CONFIG_TIME_NS) && \
(LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0))
-int lttng_add_time_ns_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx **ctx);
#else
static inline
-int lttng_add_time_ns_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx **ctx)
{
return -ENOSYS;
}
#endif
-int lttng_add_uid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_euid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_suid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_gid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_egid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_sgid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_vuid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_veuid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_vsuid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_vgid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_vegid_to_ctx(struct lttng_ctx **ctx);
-int lttng_add_vsgid_to_ctx(struct lttng_ctx **ctx);
+int lttng_add_uid_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_euid_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_suid_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_gid_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_egid_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_sgid_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_vuid_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_veuid_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_vsuid_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_vgid_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_vegid_to_ctx(struct lttng_kernel_ctx **ctx);
+int lttng_add_vsgid_to_ctx(struct lttng_kernel_ctx **ctx);
#if defined(CONFIG_PERF_EVENTS)
int lttng_add_perf_counter_to_ctx(uint32_t type,
uint64_t config,
const char *name,
- struct lttng_ctx **ctx);
+ struct lttng_kernel_ctx **ctx);
int lttng_cpuhp_perf_counter_online(unsigned int cpu,
struct lttng_cpuhp_node *node);
int lttng_cpuhp_perf_counter_dead(unsigned int cpu,
int lttng_add_perf_counter_to_ctx(uint32_t type,
uint64_t config,
const char *name,
- struct lttng_ctx **ctx)
+ struct lttng_kernel_ctx **ctx)
{
return -ENOSYS;
}
#define TRACEPOINT_HAS_DATA_ARG
-static inline bool lttng_is_bytewise_integer(const struct lttng_type *type)
-{
- if (type->type != lttng_kernel_type_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 */
* interpreter needs to find it from the event fields and types to
* support variants.
*/
- const struct lttng_event_field *field;
+ const struct lttng_kernel_event_field *field;
struct {
size_t len;
enum object_type type;
struct vstack_load {
enum load_type type;
enum object_type object_type;
- const struct lttng_event_field *field;
+ const struct lttng_kernel_event_field *field;
bool rev_bo; /* reverse byte order */
};
uint64_t u64;
double d;
} u;
- const struct lttng_event_field *field;
+ const struct lttng_kernel_event_field *field;
};
struct estack_entry {
size_t nr_elem;
/* Inner type. */
- const struct lttng_type *nested_type;
+ const struct lttng_kernel_type_common *nested_type;
} sequence;
} u;
};
void lttng_bytecode_filter_sync_state(struct lttng_bytecode_runtime *runtime);
void lttng_bytecode_capture_sync_state(struct lttng_bytecode_runtime *runtime);
int lttng_bytecode_validate(struct bytecode_runtime *bytecode);
-int lttng_bytecode_specialize(const struct lttng_event_desc *event_desc,
+int lttng_bytecode_specialize(const struct lttng_kernel_event_desc *event_desc,
struct bytecode_runtime *bytecode);
uint64_t lttng_bytecode_filter_interpret_false(void *filter_data,
/* Enumeration entry (single value) */
#undef ctf_enum_value
#define ctf_enum_value(_string, _value) \
- { \
- .start = { \
- .signedness = lttng_is_signed_type(__typeof__(_value)), \
- .value = lttng_is_signed_type(__typeof__(_value)) ? \
- (long long) (_value) : (_value), \
- }, \
- .end = { \
- .signedness = lttng_is_signed_type(__typeof__(_value)), \
- .value = lttng_is_signed_type(__typeof__(_value)) ? \
- (long long) (_value) : (_value), \
- }, \
- .string = (_string), \
- },
+ lttng_kernel_static_enum_entry_value(_string, _value)
/* Enumeration entry (range) */
#undef ctf_enum_range
#define ctf_enum_range(_string, _range_start, _range_end) \
- { \
- .start = { \
- .signedness = lttng_is_signed_type(__typeof__(_range_start)), \
- .value = lttng_is_signed_type(__typeof__(_range_start)) ? \
- (long long) (_range_start) : (_range_start), \
- }, \
- .end = { \
- .signedness = lttng_is_signed_type(__typeof__(_range_end)), \
- .value = lttng_is_signed_type(__typeof__(_range_end)) ? \
- (long long) (_range_end) : (_range_end), \
- }, \
- .string = (_string), \
- },
+ lttng_kernel_static_enum_entry_range(_string, _range_start, _range_end)
/* Enumeration entry (automatic value; follows the rules of CTF) */
#undef ctf_enum_auto
-#define ctf_enum_auto(_string) \
- { \
- .start = { \
- .signedness = -1, \
- .value = -1, \
- }, \
- .end = { \
- .signedness = -1, \
- .value = -1, \
- }, \
- .string = (_string), \
- .options = { \
- .is_auto = 1, \
- } \
- },
+#define ctf_enum_auto(_string) \
+ lttng_kernel_static_enum_entry_auto(_string)
#undef TP_ENUM_VALUES
#define TP_ENUM_VALUES(...) \
#undef LTTNG_TRACEPOINT_ENUM
#define LTTNG_TRACEPOINT_ENUM(_name, _values) \
- const struct lttng_kernel_enum_entry __enum_values__##_name[] = { \
+ static const struct lttng_kernel_enum_entry *__enum_values__##_name[] = { \
_values \
};
#include <lttng/events-nowrite.h>
#undef _ctf_integer_ext
-#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), \
- .nowrite = _nowrite, \
- .user = _user, \
- .nofilter = 0, \
- },
+#define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _user, _nowrite) \
+ lttng_kernel_static_event_field(#_item, \
+ lttng_kernel_static_type_integer_from_type(_type, _byte_order, _base), \
+ _nowrite, _user, 0),
#undef _ctf_array_encoded
#define _ctf_array_encoded(_type, _item, _src, _length, \
_encoding, _byte_order, _elem_type_base, _user, _nowrite) \
- { \
- .name = #_item, \
- .type = \
- { \
- .type = lttng_kernel_type_array_nestable, \
- .u = \
- { \
- .array_nestable = \
- { \
- .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, \
- },
+ lttng_kernel_static_event_field(#_item, \
+ lttng_kernel_static_type_array(_length, \
+ lttng_kernel_static_type_integer_from_type(_type, _byte_order, _elem_type_base), \
+ 0, \
+ _encoding), \
+ _nowrite, _user, 0),
#undef _ctf_array_bitfield
#define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
- { \
- .name = #_item, \
- .type = \
- { \
- .type = lttng_kernel_type_array_nestable, \
- .u = \
- { \
- .array_nestable = \
- { \
- .elem_type = __LTTNG_COMPOUND_LITERAL(struct lttng_type, \
- __type_integer(_type, 1, 1, 0, __LITTLE_ENDIAN, 10, none)), \
- .length = (_length) * sizeof(_type) * CHAR_BIT, \
- .alignment = lttng_alignof(_type), \
- } \
- } \
- }, \
- .nowrite = _nowrite, \
- .user = _user, \
- .nofilter = 0, \
- },
-
+ lttng_kernel_static_event_field(#_item, \
+ lttng_kernel_static_type_array((_length) * sizeof(_type) * CHAR_BIT, \
+ lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10), \
+ lttng_alignof(_type), \
+ none), \
+ _nowrite, _user, 0),
#undef _ctf_sequence_encoded
#define _ctf_sequence_encoded(_type, _item, _src, \
_length_type, _src_length, _encoding, \
_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 = \
- { \
- .type = lttng_kernel_type_sequence_nestable, \
- .u = \
- { \
- .sequence_nestable = \
- { \
- .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, \
- },
+ lttng_kernel_static_event_field("_" #_item "_length", \
+ lttng_kernel_static_type_integer_from_type(_length_type, __BYTE_ORDER, 10), \
+ _nowrite, 0, 1), \
+ lttng_kernel_static_event_field(#_item, \
+ lttng_kernel_static_type_sequence("_" #_item "_length", \
+ lttng_kernel_static_type_integer_from_type(_type, _byte_order, _elem_type_base), \
+ 0, \
+ _encoding), \
+ _nowrite, _user, 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 = \
- { \
- .type = lttng_kernel_type_sequence_nestable, \
- .u = \
- { \
- .sequence_nestable = \
- { \
- .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, \
- },
+ lttng_kernel_static_event_field("_" #_item "_length", \
+ lttng_kernel_static_type_integer_from_type(_length_type, __BYTE_ORDER, 10), \
+ _nowrite, 0, 1), \
+ lttng_kernel_static_event_field(#_item, \
+ lttng_kernel_static_type_sequence("_" #_item "_length", \
+ lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10), \
+ lttng_alignof(_type), \
+ none), \
+ _nowrite, _user, 0),
#undef _ctf_string
#define _ctf_string(_item, _src, _user, _nowrite) \
- { \
- .name = #_item, \
- .type = \
- { \
- .type = lttng_kernel_type_string, \
- .u = \
- { \
- .string = { .encoding = lttng_kernel_string_encoding_UTF8 }, \
- }, \
- }, \
- .nowrite = _nowrite, \
- .user = _user, \
- .nofilter = 0, \
- },
+ lttng_kernel_static_event_field(#_item, \
+ lttng_kernel_static_type_string(UTF8), \
+ _nowrite, _user, 0),
+
+#undef _ctf_unused
+#define _ctf_unused(_src)
#undef _ctf_enum
#define _ctf_enum(_name, _type, _item, _src, _user, _nowrite) \
- { \
- .name = #_item, \
- .type = { \
- .type = lttng_kernel_type_enum_nestable, \
- .u = { \
- .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, \
- },
+ lttng_kernel_static_event_field(#_item, \
+ lttng_kernel_static_type_enum(&__enum_##_name, \
+ lttng_kernel_static_type_integer_from_type(_type, __BYTE_ORDER, 10)), \
+ _nowrite, _user, 0),
#undef ctf_custom_field
#define ctf_custom_field(_type, _item, _code) \
- { \
- .name = #_item, \
- .type = _type, \
- .nowrite = 0, \
- .user = 0, \
- .nofilter = 1, \
- },
+ lttng_kernel_static_event_field(#_item, PARAMS(_type), 0, 0, 1),
#undef ctf_custom_type
#define ctf_custom_type(...) __VA_ARGS__
#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
- static const struct lttng_event_field __event_fields___##_name[] = { \
+ static const struct lttng_kernel_event_field *__event_fields___##_name[] = { \
_fields \
};
.nr_entries = ARRAY_SIZE(__enum_values__##_name), \
};
+#define LTTNG_CREATE_FIELD_METADATA
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
+#undef LTTNG_CREATE_FIELD_METADATA
/*
* Stage 3 of the trace events.
#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS
#define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \
-static const struct lttng_event_desc __event_desc___##_map = { \
+static const struct lttng_kernel_event_desc __event_desc___##_map = { \
+ .event_name = #_map, \
+ .event_kname = #_name, \
+ .probe_callback = (void *) TP_PROBE_CB(_template), \
.fields = __event_fields___##_template, \
- .name = #_map, \
- .kname = #_name, \
- .probe_callback = (void *) TP_PROBE_CB(_template), \
.nr_fields = ARRAY_SIZE(__event_fields___##_template), \
.owner = THIS_MODULE, \
- .event_notifier_callback = (void *) TP_EVENT_NOTIFIER_PROBE_CB(_template), \
+ .event_notifier_callback = (void *) TP_EVENT_NOTIFIER_PROBE_CB(_template), \
};
#undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP
#define TP_ID1(_token, _system) _token##_system
#define TP_ID(_token, _system) TP_ID1(_token, _system)
-static const struct lttng_event_desc *TP_ID(__event_desc___, TRACE_SYSTEM)[] = {
+static const struct lttng_kernel_event_desc *TP_ID(__event_desc___, TRACE_SYSTEM)[] = {
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
};
#define TP_ID(_token, _system) TP_ID1(_token, _system)
/* non-const because list head will be modified when registered. */
-static __used struct lttng_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = {
- .provider = __stringify(TRACE_SYSTEM),
+static __used struct lttng_kernel_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = {
+ .provider_name = __stringify(TRACE_SYSTEM),
.event_desc = TP_ID(__event_desc___, TRACE_SYSTEM),
.nr_events = ARRAY_SIZE(TP_ID(__event_desc___, TRACE_SYSTEM)),
.head = { NULL, NULL },
lttng-context-vsgid.o \
lttng-context-interruptible.o \
lttng-context-need-reschedule.o \
- lttng-context-callstack.o lttng-calibrate.o \
+ lttng-calibrate.o \
lttng-context-hostname.o \
+ lttng-context-callstack.o \
probes/lttng.o \
lttng-tracker-id.o \
lttng-bytecode.o lttng-bytecode-interpreter.o \
static
long lttng_abi_add_context(struct file *file,
struct lttng_kernel_context *context_param,
- struct lttng_ctx **ctx, struct lttng_session *session)
+ struct lttng_kernel_ctx **ctx, struct lttng_session *session)
{
if (session->been_active)
#include <lttng/lttng-bytecode.h>
#include <lttng/string-utils.h>
+#include <lttng/events-internal.h>
/*
* get_char should be called with page fault handler disabled if it is expected
uint32_t idx)
{
- struct lttng_ctx_field *ctx_field;
- struct lttng_event_field *field;
+ struct lttng_kernel_ctx_field *ctx_field;
+ const struct lttng_kernel_event_field *field;
union lttng_ctx_value v;
ctx_field = <tng_static_ctx->fields[idx];
- field = &ctx_field->event_field;
+ field = ctx_field->event_field;
ptr->type = LOAD_OBJECT;
/* field is only used for types nested within variants. */
ptr->field = NULL;
- switch (field->type.type) {
+ switch (field->type->type) {
case lttng_kernel_type_integer:
ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
- if (field->type.u.integer.signedness) {
+ if (lttng_kernel_get_type_integer(field->type)->signedness) {
ptr->object_type = OBJECT_TYPE_S64;
ptr->u.s64 = v.s64;
ptr->ptr = &ptr->u.s64;
ptr->ptr = &ptr->u.u64;
}
break;
- case lttng_kernel_type_enum_nestable:
+ case lttng_kernel_type_enum:
{
- const struct lttng_integer_type *itype =
- &field->type.u.enum_nestable.container_type->u.integer;
+ const struct lttng_kernel_type_enum *enum_type = lttng_kernel_get_type_enum(field->type);
+ const struct lttng_kernel_type_integer *integer_type = lttng_kernel_get_type_integer(enum_type->container_type);
ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
- if (itype->signedness) {
+ if (integer_type->signedness) {
ptr->object_type = OBJECT_TYPE_SIGNED_ENUM;
ptr->u.s64 = v.s64;
ptr->ptr = &ptr->u.s64;
}
break;
}
- case lttng_kernel_type_array_nestable:
- if (!lttng_is_bytewise_integer(field->type.u.array_nestable.elem_type)) {
+ case lttng_kernel_type_array:
+ {
+ const struct lttng_kernel_type_array *array_type = lttng_kernel_get_type_array(field->type);
+
+ if (!lttng_kernel_type_is_bytewise_integer(array_type->elem_type)) {
printk(KERN_WARNING "LTTng: bytecode: Array nesting only supports integer types.\n");
return -EINVAL;
}
- if (field->type.u.array_nestable.elem_type->u.integer.encoding == lttng_kernel_string_encoding_none) {
+ if (array_type->encoding == lttng_kernel_string_encoding_none) {
printk(KERN_WARNING "LTTng: bytecode: Only string arrays are supported for contexts.\n");
return -EINVAL;
}
ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
ptr->ptr = v.str;
break;
- case lttng_kernel_type_sequence_nestable:
- if (!lttng_is_bytewise_integer(field->type.u.sequence_nestable.elem_type)) {
+ }
+ case lttng_kernel_type_sequence:
+ {
+ const struct lttng_kernel_type_sequence *sequence_type = lttng_kernel_get_type_sequence(field->type);
+
+ if (!lttng_kernel_type_is_bytewise_integer(sequence_type->elem_type)) {
printk(KERN_WARNING "LTTng: bytecode: Sequence nesting only supports integer types.\n");
return -EINVAL;
}
- if (field->type.u.sequence_nestable.elem_type->u.integer.encoding == lttng_kernel_string_encoding_none) {
+ if (sequence_type->encoding == lttng_kernel_string_encoding_none) {
printk(KERN_WARNING "LTTng: bytecode: Only string sequences are supported for contexts.\n");
return -EINVAL;
}
ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
ptr->ptr = v.str;
break;
+ }
case lttng_kernel_type_string:
ptr->object_type = OBJECT_TYPE_STRING;
ctx_field->get_value(ctx_field, lttng_probe_ctx, &v);
ptr->ptr = v.str;
break;
- case lttng_kernel_type_struct_nestable:
+ case lttng_kernel_type_struct:
printk(KERN_WARNING "LTTng: bytecode: Structure type cannot be loaded.\n");
return -EINVAL;
- case lttng_kernel_type_variant_nestable:
+ case lttng_kernel_type_variant:
printk(KERN_WARNING "LTTng: bytecode: Variant type cannot be loaded.\n");
return -EINVAL;
default:
- printk(KERN_WARNING "LTTng: bytecode: Unknown type: %d", (int) field->type.type);
+ printk(KERN_WARNING "LTTng: bytecode: Unknown type: %d", (int) field->type->type);
return -EINVAL;
}
return 0;
stack_top->u.ptr.ptr = ptr;
stack_top->u.ptr.object_type = gid->elem.type;
stack_top->u.ptr.rev_bo = gid->elem.rev_bo;
- BUG_ON(stack_top->u.ptr.field->type.type != lttng_kernel_type_array_nestable);
+ BUG_ON(stack_top->u.ptr.field->type->type != lttng_kernel_type_array);
stack_top->u.ptr.field = NULL;
break;
}
stack_top->u.ptr.ptr = ptr;
stack_top->u.ptr.object_type = gid->elem.type;
stack_top->u.ptr.rev_bo = gid->elem.rev_bo;
- BUG_ON(stack_top->u.ptr.field->type.type != lttng_kernel_type_sequence_nestable);
+ BUG_ON(stack_top->u.ptr.field->type->type != lttng_kernel_type_sequence);
stack_top->u.ptr.field = NULL;
break;
}
output->type = LTTNG_INTERPRETER_TYPE_SEQUENCE;
output->u.sequence.ptr = *(const char **) (ax->u.ptr.ptr + sizeof(unsigned long));
output->u.sequence.nr_elem = *(unsigned long *) ax->u.ptr.ptr;
- output->u.sequence.nested_type = ax->u.ptr.field->type.u.sequence_nestable.elem_type;
+ output->u.sequence.nested_type = lttng_kernel_get_type_sequence(ax->u.ptr.field->type)->elem_type;
break;
case OBJECT_TYPE_ARRAY:
/* Skip count (unsigned long) */
output->type = LTTNG_INTERPRETER_TYPE_SEQUENCE;
output->u.sequence.ptr = *(const char **) (ax->u.ptr.ptr + sizeof(unsigned long));
- output->u.sequence.nr_elem = ax->u.ptr.field->type.u.array_nestable.length;
- output->u.sequence.nested_type = ax->u.ptr.field->type.u.array_nestable.elem_type;
+ output->u.sequence.nr_elem = lttng_kernel_get_type_array(ax->u.ptr.field->type)->length;
+ output->u.sequence.nested_type = lttng_kernel_get_type_array(ax->u.ptr.field->type)->elem_type;
break;
case OBJECT_TYPE_SIGNED_ENUM:
ret = dynamic_load_field(ax);
{
struct load_op *insn = (struct load_op *) pc;
struct field_ref *ref = (struct field_ref *) insn->data;
- struct lttng_ctx_field *ctx_field;
+ struct lttng_kernel_ctx_field *ctx_field;
union lttng_ctx_value v;
dbg_printk("get context ref offset %u type string\n",
{
struct load_op *insn = (struct load_op *) pc;
struct field_ref *ref = (struct field_ref *) insn->data;
- struct lttng_ctx_field *ctx_field;
+ struct lttng_kernel_ctx_field *ctx_field;
union lttng_ctx_value v;
dbg_printk("get context ref offset %u type s64\n",
#include <linux/slab.h>
#include <lttng/lttng-bytecode.h>
#include <lttng/align.h>
+#include <lttng/events-internal.h>
static ssize_t bytecode_reserve_data(struct bytecode_runtime *runtime,
size_t align, size_t len)
switch (stack_top->load.object_type) {
case OBJECT_TYPE_ARRAY:
{
- const struct lttng_integer_type *integer_type;
- const struct lttng_event_field *field;
+ const struct lttng_kernel_event_field *field;
+ const struct lttng_kernel_type_array *array_type;
+ const struct lttng_kernel_type_integer *integer_type;
uint32_t elem_len, num_elems;
int signedness;
field = stack_top->load.field;
- if (!lttng_is_bytewise_integer(field->type.u.array_nestable.elem_type)) {
+ array_type = lttng_kernel_get_type_array(field->type);
+ if (!lttng_kernel_type_is_bytewise_integer(array_type->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;
+ integer_type = lttng_kernel_get_type_integer(array_type->elem_type);
+ num_elems = array_type->length;
elem_len = integer_type->size;
signedness = integer_type->signedness;
if (index >= num_elems) {
}
case OBJECT_TYPE_SEQUENCE:
{
- const struct lttng_integer_type *integer_type;
- const struct lttng_event_field *field;
+ const struct lttng_kernel_event_field *field;
+ const struct lttng_kernel_type_sequence *sequence_type;
+ const struct lttng_kernel_type_integer *integer_type;
uint32_t elem_len;
int signedness;
field = stack_top->load.field;
- if (!lttng_is_bytewise_integer(field->type.u.sequence_nestable.elem_type)) {
+ sequence_type = lttng_kernel_get_type_sequence(field->type);
+ if (!lttng_kernel_type_is_bytewise_integer(sequence_type->elem_type)) {
ret = -EINVAL;
goto end;
}
- integer_type = &field->type.u.sequence_nestable.elem_type->u.integer;
+ integer_type = lttng_kernel_get_type_integer(sequence_type->elem_type);
elem_len = integer_type->size;
signedness = integer_type->signedness;
ret = specialize_get_index_object_type(&stack_top->load.object_type,
return ret;
}
-static int specialize_context_lookup_name(struct lttng_ctx *ctx,
+static int specialize_context_lookup_name(struct lttng_kernel_ctx *ctx,
struct bytecode_runtime *bytecode,
struct load_op *insn)
{
offset = ((struct get_symbol *) insn->data)->offset;
name = bytecode->p.bc->bc.data + bytecode->p.bc->bc.reloc_offset + offset;
- return lttng_get_context_index(ctx, name);
+ return lttng_kernel_get_context_index(ctx, name);
}
-static int specialize_load_object(const struct lttng_event_field *field,
+static int specialize_load_object(const struct lttng_kernel_event_field *field,
struct vstack_load *load, bool is_context)
{
load->type = LOAD_OBJECT;
- switch (field->type.type) {
+ switch (field->type->type) {
case lttng_kernel_type_integer:
- if (field->type.u.integer.signedness)
+ if (lttng_kernel_get_type_integer(field->type)->signedness)
load->object_type = OBJECT_TYPE_S64;
else
load->object_type = OBJECT_TYPE_U64;
load->rev_bo = false;
break;
- case lttng_kernel_type_enum_nestable:
+ case lttng_kernel_type_enum:
{
- const struct lttng_integer_type *itype =
- &field->type.u.enum_nestable.container_type->u.integer;
+ const struct lttng_kernel_type_enum *enum_type = lttng_kernel_get_type_enum(field->type);
+ const struct lttng_kernel_type_integer *integer_type = lttng_kernel_get_type_integer(enum_type->container_type);
- if (itype->signedness)
+ if (integer_type->signedness)
load->object_type = OBJECT_TYPE_SIGNED_ENUM;
else
load->object_type = OBJECT_TYPE_UNSIGNED_ENUM;
load->rev_bo = false;
break;
}
- case lttng_kernel_type_array_nestable:
- if (!lttng_is_bytewise_integer(field->type.u.array_nestable.elem_type)) {
+ case lttng_kernel_type_array:
+ {
+ const struct lttng_kernel_type_array *array_type = lttng_kernel_get_type_array(field->type);
+
+ if (!lttng_kernel_type_is_bytewise_integer(array_type->elem_type)) {
printk(KERN_WARNING "LTTng: bytecode: Array nesting only supports integer types.\n");
return -EINVAL;
}
if (is_context) {
load->object_type = OBJECT_TYPE_STRING;
} else {
- if (field->type.u.array_nestable.elem_type->u.integer.encoding == lttng_kernel_string_encoding_none) {
+ if (array_type->encoding == lttng_kernel_string_encoding_none) {
load->object_type = OBJECT_TYPE_ARRAY;
load->field = field;
} else {
}
}
break;
- case lttng_kernel_type_sequence_nestable:
- if (!lttng_is_bytewise_integer(field->type.u.sequence_nestable.elem_type)) {
+ }
+ case lttng_kernel_type_sequence:
+ {
+ const struct lttng_kernel_type_sequence *sequence_type = lttng_kernel_get_type_sequence(field->type);
+
+ if (!lttng_kernel_type_is_bytewise_integer(sequence_type->elem_type)) {
printk(KERN_WARNING "LTTng: bytecode: Sequence nesting only supports integer types.\n");
return -EINVAL;
}
if (is_context) {
load->object_type = OBJECT_TYPE_STRING;
} else {
- if (field->type.u.sequence_nestable.elem_type->u.integer.encoding == lttng_kernel_string_encoding_none) {
+ if (sequence_type->encoding == lttng_kernel_string_encoding_none) {
load->object_type = OBJECT_TYPE_SEQUENCE;
load->field = field;
} else {
}
}
break;
+ }
case lttng_kernel_type_string:
load->object_type = OBJECT_TYPE_STRING;
break;
- case lttng_kernel_type_struct_nestable:
+ case lttng_kernel_type_struct:
printk(KERN_WARNING "LTTng: bytecode: Structure type cannot be loaded.\n");
return -EINVAL;
- case lttng_kernel_type_variant_nestable:
+ case lttng_kernel_type_variant:
printk(KERN_WARNING "LTTng: bytecode: Variant type cannot be loaded.\n");
return -EINVAL;
default:
- printk(KERN_WARNING "LTTng: bytecode: Unknown type: %d", (int) field->type.type);
+ printk(KERN_WARNING "LTTng: bytecode: Unknown type: %d", (int) field->type->type);
return -EINVAL;
}
return 0;
}
-static int specialize_context_lookup(struct lttng_ctx *ctx,
+static int specialize_context_lookup(struct lttng_kernel_ctx *ctx,
struct bytecode_runtime *runtime,
struct load_op *insn,
struct vstack_load *load)
{
int idx, ret;
- struct lttng_ctx_field *ctx_field;
- struct lttng_event_field *field;
+ const struct lttng_kernel_ctx_field *ctx_field;
+ const struct lttng_kernel_event_field *field;
struct bytecode_get_index_data gid;
ssize_t data_offset;
return -ENOENT;
}
ctx_field = <tng_static_ctx->fields[idx];
- field = &ctx_field->event_field;
+ field = ctx_field->event_field;
ret = specialize_load_object(field, load, true);
if (ret)
return ret;
return 0;
}
-static int specialize_payload_lookup(const struct lttng_event_desc *event_desc,
+static int specialize_payload_lookup(const struct lttng_kernel_event_desc *event_desc,
struct bytecode_runtime *runtime,
struct load_op *insn,
struct vstack_load *load)
unsigned int i, nr_fields;
bool found = false;
uint32_t field_offset = 0;
- const struct lttng_event_field *field;
+ const struct lttng_kernel_event_field *field;
int ret;
struct bytecode_get_index_data gid;
ssize_t data_offset;
offset = ((struct get_symbol *) insn->data)->offset;
name = runtime->p.bc->bc.data + runtime->p.bc->bc.reloc_offset + offset;
for (i = 0; i < nr_fields; i++) {
- field = &event_desc->fields[i];
+ field = event_desc->fields[i];
if (field->nofilter) {
continue;
}
break;
}
/* compute field offset on stack */
- switch (field->type.type) {
+ switch (field->type->type) {
case lttng_kernel_type_integer:
- case lttng_kernel_type_enum_nestable:
+ case lttng_kernel_type_enum:
field_offset += sizeof(int64_t);
break;
- case lttng_kernel_type_array_nestable:
- case lttng_kernel_type_sequence_nestable:
+ case lttng_kernel_type_array:
+ case lttng_kernel_type_sequence:
field_offset += sizeof(unsigned long);
field_offset += sizeof(void *);
break;
return ret;
}
-int lttng_bytecode_specialize(const struct lttng_event_desc *event_desc,
+int lttng_bytecode_specialize(const struct lttng_kernel_event_desc *event_desc,
struct bytecode_runtime *bytecode)
{
void *pc, *next_pc, *start_pc;
int ret = -EINVAL;
struct vstack _stack;
struct vstack *stack = &_stack;
- struct lttng_ctx *ctx = bytecode->p.ctx;
+ struct lttng_kernel_ctx *ctx = bytecode->p.ctx;
vstack_init(stack);
#include <linux/slab.h>
#include <lttng/lttng-bytecode.h>
+#include <lttng/events-internal.h>
static const char *opnames[] = {
[ BYTECODE_OP_UNKNOWN ] = "UNKNOWN",
}
static
-int apply_field_reloc(const struct lttng_event_desc *event_desc,
+int apply_field_reloc(const struct lttng_kernel_event_desc *event_desc,
struct bytecode_runtime *runtime,
uint32_t runtime_len,
uint32_t reloc_offset,
const char *field_name,
enum bytecode_op bytecode_op)
{
- const struct lttng_event_field *fields, *field = NULL;
+ const struct lttng_kernel_event_field **fields, *field = NULL;
unsigned int nr_fields, i;
struct load_op *op;
uint32_t field_offset = 0;
return -EINVAL;
nr_fields = event_desc->nr_fields;
for (i = 0; i < nr_fields; i++) {
- if (fields[i].nofilter)
+ if (fields[i]->nofilter)
continue;
- if (!strcmp(fields[i].name, field_name)) {
- field = &fields[i];
+ if (!strcmp(fields[i]->name, field_name)) {
+ field = fields[i];
break;
}
/* compute field offset */
- switch (fields[i].type.type) {
+ switch (fields[i]->type->type) {
case lttng_kernel_type_integer:
- case lttng_kernel_type_enum_nestable:
+ case lttng_kernel_type_enum:
field_offset += sizeof(int64_t);
break;
- case lttng_kernel_type_array_nestable:
- if (!lttng_is_bytewise_integer(fields[i].type.u.array_nestable.elem_type))
+ case lttng_kernel_type_array:
+ if (!lttng_kernel_type_is_bytewise_integer(lttng_kernel_get_type_array(fields[i]->type)->elem_type))
return -EINVAL;
field_offset += sizeof(unsigned long);
field_offset += sizeof(void *);
break;
- case lttng_kernel_type_sequence_nestable:
- if (!lttng_is_bytewise_integer(fields[i].type.u.sequence_nestable.elem_type))
+ case lttng_kernel_type_sequence:
+ if (!lttng_kernel_type_is_bytewise_integer(lttng_kernel_get_type_sequence(fields[i]->type)->elem_type))
return -EINVAL;
field_offset += sizeof(unsigned long);
field_offset += sizeof(void *);
case lttng_kernel_type_string:
field_offset += sizeof(void *);
break;
- case lttng_kernel_type_struct_nestable: /* Unsupported. */
- case lttng_kernel_type_variant_nestable: /* Unsupported. */
+ case lttng_kernel_type_struct: /* Unsupported. */
+ case lttng_kernel_type_variant: /* Unsupported. */
default:
return -EINVAL;
}
struct field_ref *field_ref;
field_ref = (struct field_ref *) op->data;
- switch (field->type.type) {
+ switch (field->type->type) {
case lttng_kernel_type_integer:
- case lttng_kernel_type_enum_nestable:
+ case lttng_kernel_type_enum:
op->op = BYTECODE_OP_LOAD_FIELD_REF_S64;
break;
- case lttng_kernel_type_array_nestable:
+ case lttng_kernel_type_array:
{
- const struct lttng_type *elem_type = field->type.u.array_nestable.elem_type;
+ const struct lttng_kernel_type_array *array_type = lttng_kernel_get_type_array(field->type);
+ const struct lttng_kernel_type_common *elem_type = array_type->elem_type;
- if (!lttng_is_bytewise_integer(elem_type) || elem_type->u.integer.encoding == lttng_kernel_string_encoding_none)
+ if (!lttng_kernel_type_is_bytewise_integer(elem_type) || array_type->encoding == lttng_kernel_string_encoding_none)
return -EINVAL;
if (field->user)
op->op = BYTECODE_OP_LOAD_FIELD_REF_USER_SEQUENCE;
op->op = BYTECODE_OP_LOAD_FIELD_REF_SEQUENCE;
break;
}
- case lttng_kernel_type_sequence_nestable:
+ case lttng_kernel_type_sequence:
{
- const struct lttng_type *elem_type = field->type.u.sequence_nestable.elem_type;
+ const struct lttng_kernel_type_sequence *sequence_type = lttng_kernel_get_type_sequence(field->type);
+ const struct lttng_kernel_type_common *elem_type = sequence_type->elem_type;
- if (!lttng_is_bytewise_integer(elem_type) || elem_type->u.integer.encoding == lttng_kernel_string_encoding_none)
+ if (!lttng_kernel_type_is_bytewise_integer(elem_type) || sequence_type->encoding == lttng_kernel_string_encoding_none)
return -EINVAL;
if (field->user)
op->op = BYTECODE_OP_LOAD_FIELD_REF_USER_SEQUENCE;
else
op->op = BYTECODE_OP_LOAD_FIELD_REF_STRING;
break;
- case lttng_kernel_type_struct_nestable: /* Unsupported. */
- case lttng_kernel_type_variant_nestable: /* Unsupported. */
+ case lttng_kernel_type_struct: /* Unsupported. */
+ case lttng_kernel_type_variant: /* Unsupported. */
default:
return -EINVAL;
}
enum bytecode_op bytecode_op)
{
struct load_op *op;
- struct lttng_ctx_field *ctx_field;
+ struct lttng_kernel_ctx_field *ctx_field;
int idx;
dbg_printk("Apply context reloc: %u %s\n", reloc_offset, context_name);
/* Get context index */
- idx = lttng_get_context_index(lttng_static_ctx, context_name);
+ idx = lttng_kernel_get_context_index(lttng_static_ctx, context_name);
if (idx < 0)
return -ENOENT;
struct field_ref *field_ref;
field_ref = (struct field_ref *) op->data;
- switch (ctx_field->event_field.type.type) {
+ switch (ctx_field->event_field->type->type) {
case lttng_kernel_type_integer:
- case lttng_kernel_type_enum_nestable:
+ case lttng_kernel_type_enum:
op->op = BYTECODE_OP_GET_CONTEXT_REF_S64;
break;
/* Sequence and array supported as string */
case lttng_kernel_type_string:
- BUG_ON(ctx_field->event_field.user);
+ BUG_ON(ctx_field->event_field->user);
op->op = BYTECODE_OP_GET_CONTEXT_REF_STRING;
break;
- case lttng_kernel_type_array_nestable:
+ case lttng_kernel_type_array:
{
- const struct lttng_type *elem_type = ctx_field->event_field.type.u.array_nestable.elem_type;
+ const struct lttng_kernel_type_array *array_type = lttng_kernel_get_type_array(ctx_field->event_field->type);
+ const struct lttng_kernel_type_common *elem_type = array_type->elem_type;
- if (!lttng_is_bytewise_integer(elem_type) || elem_type->u.integer.encoding == lttng_kernel_string_encoding_none)
+ if (!lttng_kernel_type_is_bytewise_integer(elem_type) || array_type->encoding == lttng_kernel_string_encoding_none)
return -EINVAL;
- BUG_ON(ctx_field->event_field.user);
+ BUG_ON(ctx_field->event_field->user);
op->op = BYTECODE_OP_GET_CONTEXT_REF_STRING;
break;
}
- case lttng_kernel_type_sequence_nestable:
+ case lttng_kernel_type_sequence:
{
- const struct lttng_type *elem_type = ctx_field->event_field.type.u.sequence_nestable.elem_type;
+ const struct lttng_kernel_type_sequence *sequence_type = lttng_kernel_get_type_sequence(ctx_field->event_field->type);
+ const struct lttng_kernel_type_common *elem_type = sequence_type->elem_type;
- if (!lttng_is_bytewise_integer(elem_type) || elem_type->u.integer.encoding == lttng_kernel_string_encoding_none)
+ if (!lttng_kernel_type_is_bytewise_integer(elem_type) || sequence_type->encoding == lttng_kernel_string_encoding_none)
return -EINVAL;
- BUG_ON(ctx_field->event_field.user);
+ BUG_ON(ctx_field->event_field->user);
op->op = BYTECODE_OP_GET_CONTEXT_REF_STRING;
break;
}
- case lttng_kernel_type_struct_nestable: /* Unsupported. */
- case lttng_kernel_type_variant_nestable: /* Unsupported. */
+ case lttng_kernel_type_struct: /* Unsupported. */
+ case lttng_kernel_type_variant: /* Unsupported. */
default:
return -EINVAL;
}
}
static
-int apply_reloc(const struct lttng_event_desc *event_desc,
+int apply_reloc(const struct lttng_kernel_event_desc *event_desc,
struct bytecode_runtime *runtime,
uint32_t runtime_len,
uint32_t reloc_offset,
* bytecode runtime.
*/
static
-int link_bytecode(const struct lttng_event_desc *event_desc,
- struct lttng_ctx *ctx,
+int link_bytecode(const struct lttng_kernel_event_desc *event_desc,
+ struct lttng_kernel_ctx *ctx,
struct lttng_bytecode_node *bytecode,
struct list_head *bytecode_runtime_head,
struct list_head *insert_loc)
* This function is called after we confirmed that name enabler and the
* instance are matching names (or glob pattern matching).
*/
-void lttng_enabler_link_bytecode(const struct lttng_event_desc *event_desc,
- struct lttng_ctx *ctx,
+void lttng_enabler_link_bytecode(const struct lttng_kernel_event_desc *event_desc,
+ struct lttng_kernel_ctx *ctx,
struct list_head *instance_bytecode_head,
struct list_head *enabler_bytecode_head)
{
},
};
-static
-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)
{
DEFINE_PER_CPU(int, callstack_user_nesting);
static
-struct stack_trace *stack_trace_context(struct lttng_ctx_field *field,
+struct stack_trace *stack_trace_context(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx)
{
int buffer_nesting, cs_user_nesting;
}
static
-size_t lttng_callstack_length_get_size(size_t offset, struct lttng_ctx_field *field,
+size_t lttng_callstack_length_get_size(size_t offset, struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
* resulting callstack is saved to be accessed in the record step.
*/
static
-size_t lttng_callstack_sequence_get_size(size_t offset, struct lttng_ctx_field *field,
+size_t lttng_callstack_sequence_get_size(size_t offset, struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void lttng_callstack_length_record(struct lttng_ctx_field *field,
+void lttng_callstack_length_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
chan->ops->event_write(ctx, &nr_seq_entries, sizeof(unsigned int));
}
static
-void lttng_callstack_sequence_record(struct lttng_ctx_field *field,
+void lttng_callstack_sequence_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
static
unsigned int (*save_func_user)(unsigned long *store, unsigned int size);
-static
-const char *lttng_cs_ctx_mode_name(enum lttng_cs_ctx_modes mode)
-{
- switch (mode) {
- case CALLSTACK_KERNEL:
- return "callstack_kernel";
- case CALLSTACK_USER:
- return "callstack_user";
- default:
- return NULL;
- }
-}
-
-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)
{
DEFINE_PER_CPU(int, callstack_user_nesting);
static
-struct lttng_stack_trace *stack_trace_context(struct lttng_ctx_field *field,
+struct lttng_stack_trace *stack_trace_context(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx)
{
int buffer_nesting, cs_user_nesting;
}
static
-size_t lttng_callstack_length_get_size(size_t offset, struct lttng_ctx_field *field,
+size_t lttng_callstack_length_get_size(size_t offset, struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
* resulting callstack is saved to be accessed in the record step.
*/
static
-size_t lttng_callstack_sequence_get_size(size_t offset, struct lttng_ctx_field *field,
+size_t lttng_callstack_sequence_get_size(size_t offset, struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void lttng_callstack_length_record(struct lttng_ctx_field *field,
+void lttng_callstack_length_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void lttng_callstack_sequence_record(struct lttng_ctx_field *field,
+void lttng_callstack_sequence_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
#include "lttng-context-callstack-legacy-impl.h"
#endif
+#define NR_FIELDS 2
+
static
void field_data_free(struct field_data *fdata)
{
}
static
-void lttng_callstack_sequence_destroy(struct lttng_ctx_field *field)
+void lttng_callstack_sequence_destroy(struct lttng_kernel_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 const struct lttng_kernel_event_field *event_fields_kernel[NR_FIELDS] = {
+ lttng_kernel_static_event_field("_callstack_kernel_length",
+ lttng_kernel_static_type_integer_from_type(unsigned int, __BYTE_ORDER, 10),
+ false, false, false),
+ lttng_kernel_static_event_field("callstack_kernel",
+ lttng_kernel_static_type_sequence("_callstack_kernel_length",
+ lttng_kernel_static_type_integer_from_type(unsigned long, __BYTE_ORDER, 16),
+ 0, none),
+ false, false, false),
+};
+
+static const struct lttng_kernel_event_field *event_fields_user[NR_FIELDS] = {
+ lttng_kernel_static_event_field("_callstack_user_length",
+ lttng_kernel_static_type_integer_from_type(unsigned int, __BYTE_ORDER, 10),
+ false, false, false),
+ lttng_kernel_static_event_field("callstack_user",
+ lttng_kernel_static_type_sequence("_callstack_user_length",
+ lttng_kernel_static_type_integer_from_type(unsigned long, __BYTE_ORDER, 16),
+ 0, none),
+ false, false, false),
+};
+
+const struct lttng_kernel_event_field **lttng_cs_event_fields(enum lttng_cs_ctx_modes mode)
+{
+ switch (mode) {
+ case CALLSTACK_KERNEL:
+ return event_fields_kernel;
+ case CALLSTACK_USER:
+ return event_fields_user;
+ default:
+ return NULL;
+ }
+}
static
-int __lttng_add_callstack_generic(struct lttng_ctx **ctx,
+int __lttng_add_callstack_generic(struct lttng_kernel_ctx **ctx,
enum lttng_cs_ctx_modes mode)
{
- const char *ctx_name = lttng_cs_ctx_mode_name(mode);
- const char *ctx_length_name = lttng_cs_ctx_mode_length_name(mode);
- struct lttng_ctx_field *length_field, *sequence_field;
- ssize_t length_index, sequence_index;
- struct lttng_event_field *field;
+ const struct lttng_kernel_event_field **event_fields;
+ struct lttng_kernel_ctx_field ctx_field;
struct field_data *fdata;
- int ret;
+ int ret, i;
ret = init_type(mode);
if (ret)
return ret;
- if (lttng_find_context(*ctx, ctx_name))
- return -EEXIST;
- length_index = lttng_append_context_index(ctx);
- if (length_index < 0) {
- ret = -ENOMEM;
- goto error_length;
+ event_fields = lttng_cs_event_fields(mode);
+ if (!event_fields) {
+ return -EINVAL;
}
- sequence_index = lttng_append_context_index(ctx);
- if (sequence_index < 0) {
- ret = -ENOMEM;
- goto error_sequence;
+ for (i = 0; i < NR_FIELDS; i++) {
+ if (lttng_kernel_find_context(*ctx, event_fields[i]->name))
+ return -EEXIST;
}
- length_field = lttng_get_context_field_from_index(*ctx, length_index);
- WARN_ON_ONCE(!length_field);
- sequence_field = lttng_get_context_field_from_index(*ctx, sequence_index);
- WARN_ON_ONCE(!sequence_field);
fdata = field_data_create(mode);
if (!fdata) {
ret = -ENOMEM;
goto error_create;
}
+ memset(&ctx_field, 0, sizeof(ctx_field));
+ ctx_field.event_field = event_fields[0];
+ ctx_field.get_size_arg = lttng_callstack_length_get_size;
+ ctx_field.record = lttng_callstack_length_record;
+ ctx_field.priv = fdata;
+ ret = lttng_kernel_context_append(ctx, &ctx_field);
+ if (ret) {
+ ret = -ENOMEM;
+ goto error_append0;
+ }
- field = &length_field->event_field;
- field->name = ctx_length_name;
- field->type.type = lttng_kernel_type_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_kernel_string_encoding_none;
- length_field->get_size_arg = lttng_callstack_length_get_size;
- length_field->record = lttng_callstack_length_record;
- length_field->priv = fdata;
-
- field = &sequence_field->event_field;
- field->name = ctx_name;
- field->type.type = lttng_kernel_type_sequence_nestable;
- field->type.u.sequence_nestable.length_name = ctx_length_name;
- 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_mappings();
+ memset(&ctx_field, 0, sizeof(ctx_field));
+ ctx_field.event_field = event_fields[1];
+ ctx_field.get_size_arg = lttng_callstack_sequence_get_size;
+ ctx_field.record = lttng_callstack_sequence_record;
+ ctx_field.destroy = lttng_callstack_sequence_destroy;
+ ctx_field.priv = fdata;
+ ret = lttng_kernel_context_append(ctx, &ctx_field);
+ if (ret) {
+ ret = -ENOMEM;
+ goto error_append1;
+ }
return 0;
+error_append1:
+ lttng_kernel_context_remove_last(ctx);
+error_append0:
+ field_data_free(fdata);
error_create:
- lttng_remove_context_field_index(ctx, sequence_index);
-error_sequence:
- lttng_remove_context_field_index(ctx, length_index);
-error_length:
return ret;
}
*
* Return 0 for success, or error code.
*/
-int lttng_add_callstack_to_ctx(struct lttng_ctx **ctx, int type)
+int lttng_add_callstack_to_ctx(struct lttng_kernel_ctx **ctx, int type)
{
switch (type) {
case LTTNG_KERNEL_CONTEXT_CALLSTACK_KERNEL:
#include <linux/sched.h>
#include <linux/cgroup.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/namespace.h>
}
static
-void cgroup_ns_record(struct lttng_ctx_field *field,
+void cgroup_ns_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void cgroup_ns_get_value(struct lttng_ctx_field *field,
+void cgroup_ns_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = cgroup_ns_inum;
}
-int lttng_add_cgroup_ns_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("cgroup_ns",
+ lttng_kernel_static_type_integer_from_type(unsigned int, __BYTE_ORDER, 10),
+ false, false, false),
+ cgroup_ns_get_size,
+ NULL,
+ cgroup_ns_record,
+ cgroup_ns_get_value,
+ NULL, NULL);
+
+int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "cgroup_ns")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "cgroup_ns";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = cgroup_ns_get_size;
- field->record = cgroup_ns_record;
- field->get_value = cgroup_ns_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_cgroup_ns_to_ctx);
#include <linux/slab.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <lttng/tracer.h>
}
static
-void cpu_id_record(struct lttng_ctx_field *field,
+void cpu_id_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void cpu_id_get_value(struct lttng_ctx_field *field,
+void cpu_id_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = smp_processor_id();
}
-int lttng_add_cpu_id_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("cpu_id",
+ lttng_kernel_static_type_integer_from_type(int, __BYTE_ORDER, 10),
+ false, false, false),
+ cpu_id_get_size,
+ NULL,
+ cpu_id_record,
+ cpu_id_get_value,
+ NULL, NULL);
+
+int lttng_add_cpu_id_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "cpu_id")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "cpu_id";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = cpu_id_get_size;
- field->record = cpu_id_record;
- field->get_value = cpu_id_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_cpu_id_to_ctx);
#include <linux/module.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
}
static
-void egid_record(struct lttng_ctx_field *field,
+void egid_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void egid_get_value(struct lttng_ctx_field *field,
+void egid_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = lttng_current_egid();
}
-int lttng_add_egid_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("egid",
+ lttng_kernel_static_type_integer_from_type(gid_t, __BYTE_ORDER, 10),
+ false, false, false),
+ egid_get_size,
+ NULL,
+ egid_record,
+ egid_get_value,
+ NULL, NULL);
+
+int lttng_add_egid_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "egid")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "egid";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = egid_get_size;
- field->record = egid_record;
- field->get_value = egid_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_egid_to_ctx);
#include <linux/module.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
}
static
-void euid_record(struct lttng_ctx_field *field,
+void euid_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void euid_get_value(struct lttng_ctx_field *field,
+void euid_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = lttng_current_euid();
}
-int lttng_add_euid_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("euid",
+ lttng_kernel_static_type_integer_from_type(uid_t, __BYTE_ORDER, 10),
+ false, false, false),
+ euid_get_size,
+ NULL,
+ euid_record,
+ euid_get_value,
+ NULL, NULL);
+
+int lttng_add_euid_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "euid")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "euid";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = euid_get_size;
- field->record = euid_record;
- field->get_value = euid_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_euid_to_ctx);
#include <linux/module.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
}
static
-void gid_record(struct lttng_ctx_field *field,
+void gid_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void gid_get_value(struct lttng_ctx_field *field,
+void gid_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = lttng_current_gid();
}
-int lttng_add_gid_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("gid",
+ lttng_kernel_static_type_integer_from_type(gid_t, __BYTE_ORDER, 10),
+ false, false, false),
+ gid_get_size,
+ NULL,
+ gid_record,
+ gid_get_value,
+ NULL, NULL);
+
+int lttng_add_gid_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "gid")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "gid";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = gid_get_size;
- field->record = gid_record;
- field->get_value = gid_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_gid_to_ctx);
#include <linux/sched.h>
#include <linux/utsname.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <lttng/tracer.h>
}
static
-void hostname_record(struct lttng_ctx_field *field,
+void hostname_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void hostname_get_value(struct lttng_ctx_field *field,
+void hostname_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->str = hostname;
}
-static const struct lttng_type hostname_array_elem_type =
- __type_integer(char, 0, 0, -1, __BYTE_ORDER, 10, UTF8);
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("hostname",
+ lttng_kernel_static_type_array_text(LTTNG_HOSTNAME_CTX_LEN),
+ false, false, false),
+ hostname_get_size,
+ NULL,
+ hostname_record,
+ hostname_get_value,
+ NULL, NULL);
-int lttng_add_hostname_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_hostname_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "hostname")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "hostname";
- field->event_field.type.type = lttng_kernel_type_array_nestable;
- field->event_field.type.u.array_nestable.elem_type =
- &hostname_array_elem_type;
- field->event_field.type.u.array_nestable.length = LTTNG_HOSTNAME_CTX_LEN;
- field->event_field.type.u.array_nestable.alignment = 0;
-
- field->get_size = hostname_get_size;
- field->record = hostname_record;
- field->get_value = hostname_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_hostname_to_ctx);
#include <linux/sched.h>
#include <linux/irqflags.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <lttng/tracer.h>
}
static
-void interruptible_record(struct lttng_ctx_field *field,
+void interruptible_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void interruptible_get_value(struct lttng_ctx_field *field,
+void interruptible_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = interruptible;
}
-int lttng_add_interruptible_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("interruptible",
+ lttng_kernel_static_type_integer_from_type(int8_t, __BYTE_ORDER, 10),
+ false, false, false),
+ interruptible_get_size,
+ NULL,
+ interruptible_record,
+ interruptible_get_value,
+ NULL, NULL);
+
+int lttng_add_interruptible_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "interruptible")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "interruptible";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = interruptible_get_size;
- field->record = interruptible_record;
- field->get_value = interruptible_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_interruptible_to_ctx);
}
static
-void ipc_ns_record(struct lttng_ctx_field *field,
+void ipc_ns_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void ipc_ns_get_value(struct lttng_ctx_field *field,
+void ipc_ns_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = ipc_ns_inum;
}
-int lttng_add_ipc_ns_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("ipc_ns",
+ lttng_kernel_static_type_integer_from_type(unsigned int, __BYTE_ORDER, 10),
+ false, false, false),
+ ipc_ns_get_size,
+ NULL,
+ ipc_ns_record,
+ ipc_ns_get_value,
+ NULL, NULL);
+
+int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "ipc_ns")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "ipc_ns";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = ipc_ns_get_size;
- field->record = ipc_ns_record;
- field->get_value = ipc_ns_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_ipc_ns_to_ctx);
}
static
-void migratable_record(struct lttng_ctx_field *field,
+void migratable_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void migratable_get_value(struct lttng_ctx_field *field,
+void migratable_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = !current->migrate_disable;
}
-int lttng_add_migratable_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ struct lttng_kernel_ctx_field *field;
field = lttng_append_context(ctx);
if (!field)
#include <linux/slab.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <linux/nsproxy.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
}
static
-void mnt_ns_record(struct lttng_ctx_field *field,
+void mnt_ns_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void mnt_ns_get_value(struct lttng_ctx_field *field,
+void mnt_ns_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = mnt_ns_inum;
}
-int lttng_add_mnt_ns_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("mnt_ns",
+ lttng_kernel_static_type_integer_from_type(unsigned int, __BYTE_ORDER, 10),
+ false, false, false),
+ mnt_ns_get_size,
+ NULL,
+ mnt_ns_record,
+ mnt_ns_get_value,
+ NULL, NULL);
+
+int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "mnt_ns")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "mnt_ns";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = mnt_ns_get_size;
- field->record = mnt_ns_record;
- field->get_value = mnt_ns_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_mnt_ns_to_ctx);
#include <linux/sched.h>
#include <linux/irqflags.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <lttng/tracer.h>
}
static
-void need_reschedule_record(struct lttng_ctx_field *field,
+void need_reschedule_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void need_reschedule_get_value(struct lttng_ctx_field *field,
+void need_reschedule_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = test_tsk_need_resched(current);;
}
-int lttng_add_need_reschedule_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("need_reschedule",
+ lttng_kernel_static_type_integer_from_type(uint8_t, __BYTE_ORDER, 10),
+ false, false, false),
+ need_reschedule_get_size,
+ NULL,
+ need_reschedule_record,
+ need_reschedule_get_value,
+ NULL, NULL);
+
+int lttng_add_need_reschedule_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "need_reschedule")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "need_reschedule";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = need_reschedule_get_size;
- field->record = need_reschedule_record;
- field->get_value = need_reschedule_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_need_reschedule_to_ctx);
}
static
-void net_ns_record(struct lttng_ctx_field *field,
+void net_ns_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void net_ns_get_value(struct lttng_ctx_field *field,
+void net_ns_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = net_ns_inum;
}
-int lttng_add_net_ns_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("net_ns",
+ lttng_kernel_static_type_integer_from_type(unsigned int, __BYTE_ORDER, 10),
+ false, false, false),
+ net_ns_get_size,
+ NULL,
+ net_ns_record,
+ net_ns_get_value,
+ NULL, NULL);
+
+int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "net_ns")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "net_ns";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = net_ns_get_size;
- field->record = net_ns_record;
- field->get_value = net_ns_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_net_ns_to_ctx);
#include <linux/slab.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <lttng/tracer.h>
}
static
-void nice_record(struct lttng_ctx_field *field,
+void nice_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void nice_get_value(struct lttng_ctx_field *field,
+void nice_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = task_nice(current);
}
-int lttng_add_nice_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("nice",
+ lttng_kernel_static_type_integer_from_type(int, __BYTE_ORDER, 10),
+ false, false, false),
+ nice_get_size,
+ NULL,
+ nice_record,
+ nice_get_value,
+ NULL, NULL);
+
+int lttng_add_nice_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "nice")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "nice";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = nice_get_size;
- field->record = nice_record;
- field->get_value = nice_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_nice_to_ctx);
}
static
-void perf_counter_record(struct lttng_ctx_field *field,
+void perf_counter_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
+ struct lttng_perf_counter_field *perf_field = field->priv;
struct perf_event *event;
uint64_t value;
- event = field->u.perf_counter->e[ctx->cpu];
+ event = perf_field->e[ctx->cpu];
if (likely(event)) {
if (unlikely(event->state == PERF_EVENT_STATE_ERROR)) {
value = 0;
#endif
static
-void lttng_destroy_perf_counter_field(struct lttng_ctx_field *field)
+void lttng_destroy_perf_counter_ctx_field(struct lttng_kernel_ctx_field *field)
{
- struct perf_event **events = field->u.perf_counter->e;
+ struct lttng_perf_counter_field *perf_field = field->priv;
+ struct perf_event **events = perf_field->e;
#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0))
{
int ret;
ret = cpuhp_state_remove_instance(lttng_hp_online,
- &field->u.perf_counter->cpuhp_online.node);
+ &perf_field->cpuhp_online.node);
WARN_ON(ret);
ret = cpuhp_state_remove_instance(lttng_hp_prepare,
- &field->u.perf_counter->cpuhp_prepare.node);
+ &perf_field->cpuhp_prepare.node);
WARN_ON(ret);
}
#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
perf_event_release_kernel(events[cpu]);
put_online_cpus();
#ifdef CONFIG_HOTPLUG_CPU
- unregister_cpu_notifier(&field->u.perf_counter->nb);
+ unregister_cpu_notifier(&perf_field->nb);
#endif
}
#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
- kfree(field->event_field.name);
- kfree(field->u.perf_counter->attr);
+ kfree(perf_field->name);
+ kfree(perf_field->attr);
+ kfree(perf_field->event_field);
lttng_kvfree(events);
- kfree(field->u.perf_counter);
+ kfree(perf_field);
}
#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0))
#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
+static const struct lttng_kernel_type_common *field_type =
+ lttng_kernel_static_type_integer_from_type(uint64_t, __BYTE_ORDER, 10);
+
int lttng_add_perf_counter_to_ctx(uint32_t type,
uint64_t config,
const char *name,
- struct lttng_ctx **ctx)
+ struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ struct lttng_kernel_ctx_field ctx_field;
+ struct lttng_kernel_event_field *event_field;
struct lttng_perf_counter_field *perf_field;
struct perf_event **events;
struct perf_event_attr *attr;
int ret;
char *name_alloc;
+ if (lttng_kernel_find_context(*ctx, name))
+ return -EEXIST;
+ name_alloc = kstrdup(name, GFP_KERNEL);
+ if (!name_alloc) {
+ ret = -ENOMEM;
+ goto name_alloc_error;
+ }
+ event_field = kzalloc(sizeof(*event_field), GFP_KERNEL);
+ if (!event_field) {
+ ret = -ENOMEM;
+ goto event_field_alloc_error;
+ }
+ event_field->name = name_alloc;
+ event_field->type = field_type;
+
events = lttng_kvzalloc(num_possible_cpus() * sizeof(*events), GFP_KERNEL);
- if (!events)
- return -ENOMEM;
+ if (!events) {
+ ret = -ENOMEM;
+ goto event_alloc_error;
+ }
attr = kzalloc(sizeof(struct perf_event_attr), GFP_KERNEL);
if (!attr) {
}
perf_field->e = events;
perf_field->attr = attr;
+ perf_field->name = name_alloc;
+ perf_field->event_field = event_field;
- name_alloc = kstrdup(name, GFP_KERNEL);
- if (!name_alloc) {
- ret = -ENOMEM;
- goto name_alloc_error;
- }
-
- field = lttng_append_context(ctx);
- if (!field) {
- ret = -ENOMEM;
- goto append_context_error;
- }
- if (lttng_find_context(*ctx, name_alloc)) {
- ret = -EEXIST;
- goto find_error;
- }
+ ctx_field.event_field = event_field;
+ ctx_field.get_size = perf_counter_get_size;
+ ctx_field.record = perf_counter_record;
+ ctx_field.destroy = lttng_destroy_perf_counter_ctx_field;
+ ctx_field.priv = perf_field;
#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0))
}
#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
- field->destroy = lttng_destroy_perf_counter_field;
-
- field->event_field.name = name_alloc;
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = perf_counter_get_size;
- field->record = perf_counter_record;
- field->u.perf_counter = perf_field;
- lttng_context_update(*ctx);
-
- wrapper_vmalloc_sync_mappings();
+ ret = lttng_kernel_context_append(ctx, &ctx_field);
+ if (ret) {
+ ret = -ENOMEM;
+ goto append_context_error;
+ }
return 0;
+ /* Error handling. */
+append_context_error:
#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0))
cpuhp_online_error:
{
#endif
}
#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
-find_error:
- lttng_remove_context_field(ctx, field);
-append_context_error:
- kfree(name_alloc);
-name_alloc_error:
kfree(perf_field);
error_alloc_perf_field:
kfree(attr);
error_attr:
lttng_kvfree(events);
+event_alloc_error:
+ kfree(event_field);
+event_field_alloc_error:
+ kfree(name_alloc);
+name_alloc_error:
return ret;
}
#include <linux/sched.h>
#include <linux/pid_namespace.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/namespace.h>
}
static
-void pid_ns_record(struct lttng_ctx_field *field,
+void pid_ns_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void pid_ns_get_value(struct lttng_ctx_field *field,
+void pid_ns_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = pid_ns_inum;
}
-int lttng_add_pid_ns_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("pid_ns",
+ lttng_kernel_static_type_integer_from_type(unsigned int, __BYTE_ORDER, 10),
+ false, false, false),
+ pid_ns_get_size,
+ NULL,
+ pid_ns_record,
+ pid_ns_get_value,
+ NULL, NULL);
+
+int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "pid_ns")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "pid_ns";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = pid_ns_get_size;
- field->record = pid_ns_record;
- field->get_value = pid_ns_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_pid_ns_to_ctx);
#include <linux/slab.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <lttng/tracer.h>
}
static
-void pid_record(struct lttng_ctx_field *field,
+void pid_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void pid_get_value(struct lttng_ctx_field *field,
+void pid_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = task_tgid_nr(current);
}
-int lttng_add_pid_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("pid",
+ lttng_kernel_static_type_integer_from_type(pid_t, __BYTE_ORDER, 10),
+ false, false, false),
+ pid_get_size,
+ NULL,
+ pid_record,
+ pid_get_value,
+ NULL, NULL);
+
+int lttng_add_pid_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "pid")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "pid";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = pid_get_size;
- field->record = pid_record;
- field->get_value = pid_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_pid_to_ctx);
#include <linux/sched.h>
#include <linux/syscalls.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <lttng/tracer.h>
}
static
-void ppid_record(struct lttng_ctx_field *field,
+void ppid_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void ppid_get_value(struct lttng_ctx_field *field,
+void ppid_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = ppid;
}
-int lttng_add_ppid_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("ppid",
+ lttng_kernel_static_type_integer_from_type(pid_t, __BYTE_ORDER, 10),
+ false, false, false),
+ ppid_get_size,
+ NULL,
+ ppid_record,
+ ppid_get_value,
+ NULL, NULL);
+
+int lttng_add_ppid_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "ppid")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "ppid";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = ppid_get_size;
- field->record = ppid_record;
- field->get_value = ppid_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_ppid_to_ctx);
}
static
-void preemptible_record(struct lttng_ctx_field *field,
+void preemptible_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void preemptible_get_value(struct lttng_ctx_field *field,
+void preemptible_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = 0;
}
-int lttng_add_preemptible_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ struct lttng_kernel_ctx_field *field;
field = lttng_append_context(ctx);
if (!field)
#include <linux/slab.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/kallsyms.h>
}
static
-void prio_record(struct lttng_ctx_field *field,
+void prio_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void prio_get_value(struct lttng_ctx_field *field,
+void prio_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = wrapper_task_prio_sym(current);
}
-int lttng_add_prio_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("prio",
+ lttng_kernel_static_type_integer_from_type(int, __BYTE_ORDER, 10),
+ false, false, false),
+ prio_get_size,
+ NULL,
+ prio_record,
+ prio_get_value,
+ NULL, NULL);
+
+int lttng_add_prio_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
int ret;
- if (!wrapper_task_prio_sym) {
- ret = wrapper_task_prio_init();
- if (ret)
- return ret;
- }
-
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "prio")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "prio";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = prio_get_size;
- field->record = prio_record;
- field->get_value = prio_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_prio_to_ctx);
#include <linux/slab.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <lttng/tracer.h>
* could lead to crash in IRQ context and deadlock of the lockdep tracer.
*/
static
-void procname_record(struct lttng_ctx_field *field,
+void procname_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void procname_get_value(struct lttng_ctx_field *field,
+void procname_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->str = current->comm;
}
-static const struct lttng_type procname_array_elem_type =
- __type_integer(char, 0, 0, -1, __BYTE_ORDER, 10, UTF8);
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("procname",
+ lttng_kernel_static_type_array_text(sizeof(current->comm)),
+ false, false, false),
+ procname_get_size,
+ NULL,
+ procname_record,
+ procname_get_value,
+ NULL, NULL);
-int lttng_add_procname_to_ctx(struct lttng_ctx **ctx)
+int lttng_add_procname_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "procname")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "procname";
- field->event_field.type.type = lttng_kernel_type_array_nestable;
- field->event_field.type.u.array_nestable.elem_type = &procname_array_elem_type;
- field->event_field.type.u.array_nestable.length = sizeof(current->comm);
- field->event_field.type.u.array_nestable.alignment = 0;
-
- field->get_size = procname_get_size;
- field->record = procname_record;
- field->get_value = procname_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_procname_to_ctx);
#include <linux/module.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
}
static
-void sgid_record(struct lttng_ctx_field *field,
+void sgid_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void sgid_get_value(struct lttng_ctx_field *field,
+void sgid_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = lttng_current_sgid();
}
-int lttng_add_sgid_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("sgid",
+ lttng_kernel_static_type_integer_from_type(gid_t, __BYTE_ORDER, 10),
+ false, false, false),
+ sgid_get_size,
+ NULL,
+ sgid_record,
+ sgid_get_value,
+ NULL, NULL);
+
+int lttng_add_sgid_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "sgid")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "sgid";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = sgid_get_size;
- field->record = sgid_record;
- field->get_value = sgid_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_sgid_to_ctx);
#include <linux/module.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
}
static
-void suid_record(struct lttng_ctx_field *field,
+void suid_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void suid_get_value(struct lttng_ctx_field *field,
+void suid_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = lttng_current_suid();
}
-int lttng_add_suid_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("suid",
+ lttng_kernel_static_type_integer_from_type(uid_t, __BYTE_ORDER, 10),
+ false, false, false),
+ suid_get_size,
+ NULL,
+ suid_record,
+ suid_get_value,
+ NULL, NULL);
+
+int lttng_add_suid_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "suid")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "suid";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = suid_get_size;
- field->record = suid_record;
- field->get_value = suid_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_suid_to_ctx);
#include <linux/slab.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <lttng/tracer.h>
}
static
-void tid_record(struct lttng_ctx_field *field,
+void tid_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void tid_get_value(struct lttng_ctx_field *field,
+void tid_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = tid;
}
-int lttng_add_tid_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("tid",
+ lttng_kernel_static_type_integer_from_type(pid_t, __BYTE_ORDER, 10),
+ false, false, false),
+ tid_get_size,
+ NULL,
+ tid_record,
+ tid_get_value,
+ NULL, NULL);
+
+int lttng_add_tid_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "tid")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "tid";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = tid_get_size;
- field->record = tid_record;
- field->get_value = tid_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_tid_to_ctx);
#include <linux/nsproxy.h>
#include <linux/time_namespace.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/namespace.h>
}
static
-void time_ns_record(struct lttng_ctx_field *field,
+void time_ns_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void time_ns_get_value(struct lttng_ctx_field *field,
+void time_ns_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = time_ns_inum;
}
-int lttng_add_time_ns_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("time_ns",
+ lttng_kernel_static_type_integer_from_type(unsigned int, __BYTE_ORDER, 10),
+ false, false, false),
+ time_ns_get_size,
+ NULL,
+ time_ns_record,
+ time_ns_get_value,
+ NULL, NULL);
+
+int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "time_ns")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "time_ns";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = time_ns_get_size;
- field->record = time_ns_record;
- field->get_value = time_ns_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_time_ns_to_ctx);
#include <linux/module.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
}
static
-void uid_record(struct lttng_ctx_field *field,
+void uid_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void uid_get_value(struct lttng_ctx_field *field,
+void uid_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = lttng_current_uid();
}
-int lttng_add_uid_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("uid",
+ lttng_kernel_static_type_integer_from_type(uid_t, __BYTE_ORDER, 10),
+ false, false, false),
+ uid_get_size,
+ NULL,
+ uid_record,
+ uid_get_value,
+ NULL, NULL);
+
+int lttng_add_uid_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "uid")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "uid";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = uid_get_size;
- field->record = uid_record;
- field->get_value = uid_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_uid_to_ctx);
#include <linux/sched.h>
#include <linux/user_namespace.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/namespace.h>
}
static
-void user_ns_record(struct lttng_ctx_field *field,
+void user_ns_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void user_ns_get_value(struct lttng_ctx_field *field,
+void user_ns_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = user_ns_inum;
}
-int lttng_add_user_ns_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("user_ns",
+ lttng_kernel_static_type_integer_from_type(unsigned int, __BYTE_ORDER, 10),
+ false, false, false),
+ user_ns_get_size,
+ NULL,
+ user_ns_record,
+ user_ns_get_value,
+ NULL, NULL);
+
+int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "user_ns")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "user_ns";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = user_ns_get_size;
- field->record = user_ns_record;
- field->get_value = user_ns_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_user_ns_to_ctx);
#include <linux/sched.h>
#include <linux/utsname.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/namespace.h>
}
static
-void uts_ns_record(struct lttng_ctx_field *field,
+void uts_ns_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void uts_ns_get_value(struct lttng_ctx_field *field,
+void uts_ns_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = uts_ns_inum;
}
-int lttng_add_uts_ns_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("uts_ns",
+ lttng_kernel_static_type_integer_from_type(unsigned int, __BYTE_ORDER, 10),
+ false, false, false),
+ uts_ns_get_size,
+ NULL,
+ uts_ns_record,
+ uts_ns_get_value,
+ NULL, NULL);
+
+int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "uts_ns")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "uts_ns";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = uts_ns_get_size;
- field->record = uts_ns_record;
- field->get_value = uts_ns_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_uts_ns_to_ctx);
#include <linux/module.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
}
static
-void vegid_record(struct lttng_ctx_field *field,
+void vegid_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void vegid_get_value(struct lttng_ctx_field *field,
+void vegid_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = lttng_current_vegid();
}
-int lttng_add_vegid_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("vegid",
+ lttng_kernel_static_type_integer_from_type(gid_t, __BYTE_ORDER, 10),
+ false, false, false),
+ vegid_get_size,
+ NULL,
+ vegid_record,
+ vegid_get_value,
+ NULL, NULL);
+
+int lttng_add_vegid_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "vegid")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "vegid";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = vegid_get_size;
- field->record = vegid_record;
- field->get_value = vegid_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_vegid_to_ctx);
#include <linux/module.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
}
static
-void veuid_record(struct lttng_ctx_field *field,
+void veuid_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void veuid_get_value(struct lttng_ctx_field *field,
+void veuid_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = lttng_current_veuid();
}
-int lttng_add_veuid_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("veuid",
+ lttng_kernel_static_type_integer_from_type(uid_t, __BYTE_ORDER, 10),
+ false, false, false),
+ veuid_get_size,
+ NULL,
+ veuid_record,
+ veuid_get_value,
+ NULL, NULL);
+
+int lttng_add_veuid_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "veuid")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "veuid";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = veuid_get_size;
- field->record = veuid_record;
- field->get_value = veuid_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_veuid_to_ctx);
#include <linux/module.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
}
static
-void vgid_record(struct lttng_ctx_field *field,
+void vgid_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void vgid_get_value(struct lttng_ctx_field *field,
+void vgid_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = lttng_current_vgid();
}
-int lttng_add_vgid_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("vgid",
+ lttng_kernel_static_type_integer_from_type(gid_t, __BYTE_ORDER, 10),
+ false, false, false),
+ vgid_get_size,
+ NULL,
+ vgid_record,
+ vgid_get_value,
+ NULL, NULL);
+
+int lttng_add_vgid_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "vgid")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "vgid";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = vgid_get_size;
- field->record = vgid_record;
- field->get_value = vgid_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_vgid_to_ctx);
#include <linux/slab.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <lttng/tracer.h>
}
static
-void vpid_record(struct lttng_ctx_field *field,
+void vpid_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void vpid_get_value(struct lttng_ctx_field *field,
+void vpid_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = vpid;
}
-int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("vpid",
+ lttng_kernel_static_type_integer_from_type(pid_t, __BYTE_ORDER, 10),
+ false, false, false),
+ vpid_get_size,
+ NULL,
+ vpid_record,
+ vpid_get_value,
+ NULL, NULL);
+
+int lttng_add_vpid_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "vpid")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "vpid";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = vpid_get_size;
- field->record = vpid_record;
- field->get_value = vpid_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_vpid_to_ctx);
#include <linux/sched.h>
#include <linux/syscalls.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <lttng/tracer.h>
}
static
-void vppid_record(struct lttng_ctx_field *field,
+void vppid_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void vppid_get_value(struct lttng_ctx_field *field,
+void vppid_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = vppid;
}
-int lttng_add_vppid_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("vppid",
+ lttng_kernel_static_type_integer_from_type(pid_t, __BYTE_ORDER, 10),
+ false, false, false),
+ vppid_get_size,
+ NULL,
+ vppid_record,
+ vppid_get_value,
+ NULL, NULL);
+
+int lttng_add_vppid_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "vppid")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "vppid";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = vppid_get_size;
- field->record = vppid_record;
- field->get_value = vppid_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_vppid_to_ctx);
#include <linux/module.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
}
static
-void vsgid_record(struct lttng_ctx_field *field,
+void vsgid_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void vsgid_get_value(struct lttng_ctx_field *field,
+void vsgid_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = lttng_current_vsgid();
}
-int lttng_add_vsgid_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("vsgid",
+ lttng_kernel_static_type_integer_from_type(gid_t, __BYTE_ORDER, 10),
+ false, false, false),
+ vsgid_get_size,
+ NULL,
+ vsgid_record,
+ vsgid_get_value,
+ NULL, NULL);
+
+int lttng_add_vsgid_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "vsgid")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "vsgid";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = vsgid_get_size;
- field->record = vsgid_record;
- field->get_value = vsgid_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_vsgid_to_ctx);
#include <linux/module.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
}
static
-void vsuid_record(struct lttng_ctx_field *field,
+void vsuid_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void vsuid_get_value(struct lttng_ctx_field *field,
+void vsuid_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = lttng_current_vsuid();
}
-int lttng_add_vsuid_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("vsuid",
+ lttng_kernel_static_type_integer_from_type(uid_t, __BYTE_ORDER, 10),
+ false, false, false),
+ vsuid_get_size,
+ NULL,
+ vsuid_record,
+ vsuid_get_value,
+ NULL, NULL);
+
+int lttng_add_vsuid_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "vsuid")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "vsuid";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = vsuid_get_size;
- field->record = vsuid_record;
- field->get_value = vsuid_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_vsuid_to_ctx);
#include <linux/slab.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <lttng/tracer.h>
}
static
-void vtid_record(struct lttng_ctx_field *field,
+void vtid_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void vtid_get_value(struct lttng_ctx_field *field,
+void vtid_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = vtid;
}
-int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("vtid",
+ lttng_kernel_static_type_integer_from_type(pid_t, __BYTE_ORDER, 10),
+ false, false, false),
+ vtid_get_size,
+ NULL,
+ vtid_record,
+ vtid_get_value,
+ NULL, NULL);
+
+int lttng_add_vtid_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "vtid")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "vtid";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = vtid_get_size;
- field->record = vtid_record;
- field->get_value = vtid_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_vtid_to_ctx);
#include <linux/module.h>
#include <linux/sched.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <lttng/tracer.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
}
static
-void vuid_record(struct lttng_ctx_field *field,
+void vuid_record(struct lttng_kernel_ctx_field *field,
struct lib_ring_buffer_ctx *ctx,
struct lttng_channel *chan)
{
}
static
-void vuid_get_value(struct lttng_ctx_field *field,
+void vuid_get_value(struct lttng_kernel_ctx_field *field,
struct lttng_probe_ctx *lttng_probe_ctx,
union lttng_ctx_value *value)
{
value->s64 = lttng_current_vuid();
}
-int lttng_add_vuid_to_ctx(struct lttng_ctx **ctx)
+static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
+ lttng_kernel_static_event_field("vuid",
+ lttng_kernel_static_type_integer_from_type(uid_t, __BYTE_ORDER, 10),
+ false, false, false),
+ vuid_get_size,
+ NULL,
+ vuid_record,
+ vuid_get_value,
+ NULL, NULL);
+
+int lttng_add_vuid_to_ctx(struct lttng_kernel_ctx **ctx)
{
- struct lttng_ctx_field *field;
+ int ret;
- field = lttng_append_context(ctx);
- if (!field)
- return -ENOMEM;
- if (lttng_find_context(*ctx, "vuid")) {
- lttng_remove_context_field(ctx, field);
+ if (lttng_kernel_find_context(*ctx, ctx_field->event_field->name))
return -EEXIST;
- }
- field->event_field.name = "vuid";
- field->event_field.type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
- field->get_size = vuid_get_size;
- field->record = vuid_record;
- field->get_value = vuid_get_value;
- lttng_context_update(*ctx);
+ ret = lttng_kernel_context_append(ctx, ctx_field);
wrapper_vmalloc_sync_mappings();
- return 0;
+ return ret;
}
EXPORT_SYMBOL_GPL(lttng_add_vuid_to_ctx);
#include <linux/slab.h>
#include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_mappings() */
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <lttng/tracer.h>
/*
/*
* Static array of contexts, for $ctx filters.
*/
-struct lttng_ctx *lttng_static_ctx;
+struct lttng_kernel_ctx *lttng_static_ctx;
-int lttng_find_context(struct lttng_ctx *ctx, const char *name)
+int lttng_kernel_find_context(struct lttng_kernel_ctx *ctx, const char *name)
{
unsigned int i;
+ const char *subname;
if (!ctx)
return 0;
+ if (strncmp(name, "$ctx.", strlen("$ctx.")) == 0) {
+ subname = name + strlen("$ctx.");
+ } else {
+ subname = name;
+ }
for (i = 0; i < ctx->nr_fields; i++) {
/* Skip allocated (but non-initialized) contexts */
- if (!ctx->fields[i].event_field.name)
+ if (!ctx->fields[i].event_field->name)
continue;
- if (!strcmp(ctx->fields[i].event_field.name, name))
+ if (!strcmp(ctx->fields[i].event_field->name, subname))
return 1;
}
return 0;
}
-EXPORT_SYMBOL_GPL(lttng_find_context);
+EXPORT_SYMBOL_GPL(lttng_kernel_find_context);
-int lttng_get_context_index(struct lttng_ctx *ctx, const char *name)
+int lttng_kernel_get_context_index(struct lttng_kernel_ctx *ctx, const char *name)
{
unsigned int i;
const char *subname;
}
for (i = 0; i < ctx->nr_fields; i++) {
/* Skip allocated (but non-initialized) contexts */
- if (!ctx->fields[i].event_field.name)
+ if (!ctx->fields[i].event_field->name)
continue;
- if (!strcmp(ctx->fields[i].event_field.name, subname))
+ if (!strcmp(ctx->fields[i].event_field->name, subname))
return i;
}
return -1;
}
-EXPORT_SYMBOL_GPL(lttng_get_context_index);
+EXPORT_SYMBOL_GPL(lttng_kernel_get_context_index);
-struct lttng_ctx_field *lttng_get_context_field_from_index(struct lttng_ctx *ctx,
+struct lttng_kernel_ctx_field *lttng_kernel_get_context_field_from_index(struct lttng_kernel_ctx *ctx,
size_t index)
{
if (index >= ctx->nr_fields)
return NULL;
return &ctx->fields[index];
}
-EXPORT_SYMBOL_GPL(lttng_get_context_field_from_index);
+EXPORT_SYMBOL_GPL(lttng_kernel_get_context_field_from_index);
/*
* Note: as we append context information, the pointer location may change.
+ * lttng_kernel_context_add_field leaves the new last context initialized to NULL.
*/
-ssize_t lttng_append_context_index(struct lttng_ctx **ctx_p)
+static
+int lttng_kernel_context_add_field(struct lttng_kernel_ctx **ctx_p)
{
- struct lttng_ctx *ctx;
- ssize_t pos = -1;
+ struct lttng_kernel_ctx *ctx;
if (!*ctx_p) {
- *ctx_p = kzalloc(sizeof(struct lttng_ctx), GFP_KERNEL);
+ *ctx_p = kzalloc(sizeof(struct lttng_kernel_ctx), GFP_KERNEL);
if (!*ctx_p)
- goto end;
+ return -ENOMEM;
(*ctx_p)->largest_align = 1;
}
ctx = *ctx_p;
if (ctx->nr_fields + 1 > ctx->allocated_fields) {
- struct lttng_ctx_field *new_fields;
+ struct lttng_kernel_ctx_field *new_fields;
ctx->allocated_fields = max_t(size_t, 1, 2 * ctx->allocated_fields);
- new_fields = lttng_kvzalloc(ctx->allocated_fields * sizeof(struct lttng_ctx_field), GFP_KERNEL);
+ new_fields = lttng_kvzalloc(ctx->allocated_fields * sizeof(*new_fields), GFP_KERNEL);
if (!new_fields)
- goto end;
+ return -ENOMEM;
if (ctx->fields)
memcpy(new_fields, ctx->fields, sizeof(*ctx->fields) * ctx->nr_fields);
lttng_kvfree(ctx->fields);
ctx->fields = new_fields;
}
- pos = ctx->nr_fields++;
-end:
- return pos;
+ ctx->nr_fields++;
+ return 0;
}
-EXPORT_SYMBOL_GPL(lttng_append_context_index);
-/*
- * Note: as we append context information, the pointer location may change.
- */
-struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx_p)
+static size_t get_type_max_align(const struct lttng_kernel_type_common *type)
{
- ssize_t pos;
-
- pos = lttng_append_context_index(ctx_p);
- if (pos < 0)
- return NULL;
- return &(*ctx_p)->fields[pos];
+ switch (type->type) {
+ case lttng_kernel_type_integer:
+ return lttng_kernel_get_type_integer(type)->alignment;
+ case lttng_kernel_type_string:
+ return CHAR_BIT;
+ case lttng_kernel_type_enum:
+ return get_type_max_align(lttng_kernel_get_type_enum(type)->container_type);
+ case lttng_kernel_type_array:
+ return max_t(size_t, get_type_max_align(lttng_kernel_get_type_array(type)->elem_type),
+ lttng_kernel_get_type_array(type)->alignment);
+ case lttng_kernel_type_sequence:
+ return max_t(size_t, get_type_max_align(lttng_kernel_get_type_sequence(type)->elem_type),
+ lttng_kernel_get_type_sequence(type)->alignment);
+ case lttng_kernel_type_struct:
+ {
+ unsigned int i;
+ size_t field_align = 0;
+ const struct lttng_kernel_type_struct *struct_type = lttng_kernel_get_type_struct(type);
+
+ for (i = 0; i < struct_type->nr_fields; i++) {
+ field_align = max_t(size_t,
+ get_type_max_align(struct_type->fields[i]->type),
+ field_align);
+ }
+ return field_align;
+ }
+ case lttng_kernel_type_variant:
+ /* Variants are not accounted in the overall alignment of the type they are embedded in. */
+ return 0;
+ default:
+ WARN_ON_ONCE(1);
+ return 0;
+ }
}
-EXPORT_SYMBOL_GPL(lttng_append_context);
/*
* lttng_context_update() should be called at least once between context
* modification and trace start.
*/
-void lttng_context_update(struct lttng_ctx *ctx)
+static
+void lttng_context_update(struct lttng_kernel_ctx *ctx)
{
int i;
size_t largest_align = 8; /* in bits */
for (i = 0; i < ctx->nr_fields; i++) {
- struct lttng_type *type;
size_t field_align = 8;
- type = &ctx->fields[i].event_field.type;
- switch (type->type) {
- case lttng_kernel_type_integer:
- field_align = type->u.integer.alignment;
- break;
- case lttng_kernel_type_array_nestable:
- {
- const struct lttng_type *nested_type;
-
- nested_type = type->u.array_nestable.elem_type;
- switch (nested_type->type) {
- case lttng_kernel_type_integer:
- field_align = nested_type->u.integer.alignment;
- break;
- case lttng_kernel_type_string:
- break;
-
- case lttng_kernel_type_array_nestable:
- case lttng_kernel_type_sequence_nestable:
- case lttng_kernel_type_struct_nestable:
- case lttng_kernel_type_variant_nestable:
- default:
- WARN_ON_ONCE(1);
- break;
- }
- field_align = max_t(size_t, field_align,
- type->u.array_nestable.alignment);
- break;
- }
- case lttng_kernel_type_sequence_nestable:
- {
- const struct lttng_type *nested_type;
-
- nested_type = type->u.sequence_nestable.elem_type;
- switch (nested_type->type) {
- case lttng_kernel_type_integer:
- field_align = nested_type->u.integer.alignment;
- break;
-
- case lttng_kernel_type_string:
- break;
-
- case lttng_kernel_type_array_nestable:
- case lttng_kernel_type_sequence_nestable:
- case lttng_kernel_type_struct_nestable:
- case lttng_kernel_type_variant_nestable:
- default:
- WARN_ON_ONCE(1);
- break;
- }
- field_align = max_t(size_t, field_align,
- type->u.sequence_nestable.alignment);
- break;
- }
- case lttng_kernel_type_string:
- break;
-
- case lttng_kernel_type_struct_nestable:
- case lttng_kernel_type_variant_nestable:
- break;
-
- case lttng_kernel_type_enum_nestable:
- default:
- WARN_ON_ONCE(1);
- break;
- }
+ field_align = get_type_max_align(ctx->fields[i].event_field->type);
largest_align = max_t(size_t, largest_align, field_align);
}
ctx->largest_align = largest_align >> 3; /* bits to bytes */
}
-/* Keep same order. */
-void lttng_remove_context_field_index(struct lttng_ctx **ctx_p, size_t index)
+int lttng_kernel_context_append(struct lttng_kernel_ctx **ctx_p,
+ const struct lttng_kernel_ctx_field *f)
{
- struct lttng_ctx *ctx = *ctx_p;
+ int ret;
- WARN_ON_ONCE(ctx->nr_fields >= index);
- if (index != ctx->nr_fields - 1) {
- memmove(&ctx->fields[index], &ctx->fields[index + 1],
- (ctx->nr_fields - index - 1) * sizeof(struct lttng_ctx_field));
- }
- /* Clear last item. */
- memset(&ctx->fields[ctx->nr_fields - 1], 0, sizeof(struct lttng_ctx_field));
- ctx->nr_fields--;
+ ret = lttng_kernel_context_add_field(ctx_p);
+ if (ret)
+ return ret;
+ (*ctx_p)->fields[(*ctx_p)->nr_fields - 1] = *f;
+ lttng_context_update(*ctx_p);
+ return 0;
}
-EXPORT_SYMBOL_GPL(lttng_remove_context_field_index);
-/*
- * Remove last context field.
- */
-void lttng_remove_context_field(struct lttng_ctx **ctx_p,
- struct lttng_ctx_field *field)
+void lttng_kernel_context_remove_last(struct lttng_kernel_ctx **ctx_p)
{
- struct lttng_ctx *ctx;
+ struct lttng_kernel_ctx *ctx = *ctx_p;
- ctx = *ctx_p;
+ if (!ctx->nr_fields)
+ return;
+ memset(&ctx->fields[ctx->nr_fields - 1], 0, sizeof(struct lttng_kernel_ctx_field));
ctx->nr_fields--;
- WARN_ON_ONCE(&ctx->fields[ctx->nr_fields] != field);
- memset(&ctx->fields[ctx->nr_fields], 0, sizeof(struct lttng_ctx_field));
+ lttng_context_update(ctx);
}
-EXPORT_SYMBOL_GPL(lttng_remove_context_field);
-void lttng_destroy_context(struct lttng_ctx *ctx)
+void lttng_kernel_destroy_context(struct lttng_kernel_ctx *ctx)
{
int i;
void lttng_context_exit(void)
{
- lttng_destroy_context(lttng_static_ctx);
+ lttng_kernel_destroy_context(lttng_static_ctx);
lttng_static_ctx = NULL;
}
#include <lttng/events.h>
#include <lttng/msgpack.h>
#include <lttng/event-notifier-notification.h>
+#include <lttng/events-internal.h>
#include <wrapper/barrier.h>
/*
static
int64_t capture_sequence_element_signed(uint8_t *ptr,
- const struct lttng_integer_type *type)
+ const struct lttng_kernel_type_integer *type)
{
int64_t value = 0;
unsigned int size = type->size;
static
uint64_t capture_sequence_element_unsigned(uint8_t *ptr,
- const struct lttng_integer_type *type)
+ const struct lttng_kernel_type_integer *type)
{
uint64_t value = 0;
unsigned int size = type->size;
int capture_sequence(struct lttng_msgpack_writer *writer,
struct lttng_interpreter_output *output)
{
- const struct lttng_integer_type *integer_type = NULL;
- const struct lttng_type *nested_type;
+ const struct lttng_kernel_type_integer *integer_type = NULL;
+ const struct lttng_kernel_type_common *nested_type;
uint8_t *ptr;
bool signedness;
int ret, i;
nested_type = output->u.sequence.nested_type;
switch (nested_type->type) {
case lttng_kernel_type_integer:
- integer_type = &nested_type->u.integer;
+ integer_type = lttng_kernel_get_type_integer(nested_type);
break;
- case lttng_kernel_type_enum_nestable:
+ case lttng_kernel_type_enum:
/* Treat enumeration as an integer. */
- integer_type = &nested_type->u.enum_nestable.container_type->u.integer;
+ integer_type = lttng_kernel_get_type_integer(lttng_kernel_get_type_enum(nested_type)->container_type);
break;
default:
/* Capture of array of non-integer are not supported. */
void _lttng_metadata_channel_hangup(struct lttng_metadata_stream *stream);
static
int _lttng_type_statedump(struct lttng_session *session,
- const struct lttng_type *type,
+ const struct lttng_kernel_type_common *type,
+ enum lttng_kernel_string_encoding parent_encoding,
size_t nesting);
static
int _lttng_field_statedump(struct lttng_session *session,
- const struct lttng_event_field *field,
+ const struct lttng_kernel_event_field *field,
size_t nesting);
void synchronize_trace(void)
chan->ops->channel_destroy(chan->chan);
module_put(chan->transport->owner);
list_del(&chan->list);
- lttng_destroy_context(chan->ctx);
+ lttng_kernel_destroy_context(chan->ctx);
kfree(chan);
}
struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
struct lttng_kernel_event *event_param,
void *filter,
- const struct lttng_event_desc *event_desc,
+ const struct lttng_kernel_event_desc *event_desc,
enum lttng_kernel_instrumentation itype)
{
struct lttng_session *session = chan->session;
switch (itype) {
case LTTNG_KERNEL_TRACEPOINT:
- event_name = event_desc->name;
+ event_name = event_desc->event_name;
break;
case LTTNG_KERNEL_KPROBE: /* Fall-through */
LTTNG_EVENT_HT_SIZE, event_name);
lttng_hlist_for_each_entry(event, head, hlist) {
WARN_ON_ONCE(!event->desc);
- if (!strncmp(event->desc->name, event_name,
+ if (!strncmp(event->desc->event_name, event_name,
LTTNG_KERNEL_SYM_NAME_LEN - 1)
&& chan == event->chan) {
ret = -EEXIST;
}
struct lttng_event_notifier *_lttng_event_notifier_create(
- const struct lttng_event_desc *event_desc,
+ const struct lttng_kernel_event_desc *event_desc,
uint64_t token, uint64_t error_counter_index,
struct lttng_event_notifier_group *event_notifier_group,
struct lttng_kernel_event_notifier *event_notifier_param,
switch (itype) {
case LTTNG_KERNEL_TRACEPOINT:
- event_name = event_desc->name;
+ event_name = event_desc->event_name;
break;
case LTTNG_KERNEL_KPROBE: /* Fall-through */
LTTNG_EVENT_NOTIFIER_HT_SIZE, event_name);
lttng_hlist_for_each_entry(event_notifier, head, hlist) {
WARN_ON_ONCE(!event_notifier->desc);
- if (!strncmp(event_notifier->desc->name, event_name,
+ if (!strncmp(event_notifier->desc->event_name, event_name,
LTTNG_KERNEL_SYM_NAME_LEN - 1)
&& event_notifier_group == event_notifier->group
&& token == event_notifier->user_token) {
struct lttng_event *lttng_event_create(struct lttng_channel *chan,
struct lttng_kernel_event *event_param,
void *filter,
- const struct lttng_event_desc *event_desc,
+ const struct lttng_kernel_event_desc *event_desc,
enum lttng_kernel_instrumentation itype)
{
struct lttng_event *event;
}
struct lttng_event_notifier *lttng_event_notifier_create(
- const struct lttng_event_desc *event_desc,
+ const struct lttng_kernel_event_desc *event_desc,
uint64_t id, uint64_t error_counter_index,
struct lttng_event_notifier_group *event_notifier_group,
struct lttng_kernel_event_notifier *event_notifier_param,
static
void register_event(struct lttng_event *event)
{
- const struct lttng_event_desc *desc;
+ const struct lttng_kernel_event_desc *desc;
int ret = -EINVAL;
if (event->registered)
desc = event->desc;
switch (event->instrumentation) {
case LTTNG_KERNEL_TRACEPOINT:
- ret = lttng_wrapper_tracepoint_probe_register(desc->kname,
+ ret = lttng_wrapper_tracepoint_probe_register(desc->event_kname,
desc->probe_callback,
event);
break;
*/
int _lttng_event_unregister(struct lttng_event *event)
{
- const struct lttng_event_desc *desc;
+ const struct lttng_kernel_event_desc *desc;
int ret = -EINVAL;
if (!event->registered)
desc = event->desc;
switch (event->instrumentation) {
case LTTNG_KERNEL_TRACEPOINT:
- ret = lttng_wrapper_tracepoint_probe_unregister(event->desc->kname,
+ ret = lttng_wrapper_tracepoint_probe_unregister(event->desc->event_kname,
event->desc->probe_callback,
event);
break;
static
void register_event_notifier(struct lttng_event_notifier *event_notifier)
{
- const struct lttng_event_desc *desc;
+ const struct lttng_kernel_event_desc *desc;
int ret = -EINVAL;
if (event_notifier->registered)
desc = event_notifier->desc;
switch (event_notifier->instrumentation) {
case LTTNG_KERNEL_TRACEPOINT:
- ret = lttng_wrapper_tracepoint_probe_register(desc->kname,
+ ret = lttng_wrapper_tracepoint_probe_register(desc->event_kname,
desc->event_notifier_callback,
event_notifier);
break;
int _lttng_event_notifier_unregister(
struct lttng_event_notifier *event_notifier)
{
- const struct lttng_event_desc *desc;
+ const struct lttng_kernel_event_desc *desc;
int ret = -EINVAL;
if (!event_notifier->registered)
desc = event_notifier->desc;
switch (event_notifier->instrumentation) {
case LTTNG_KERNEL_TRACEPOINT:
- ret = lttng_wrapper_tracepoint_probe_unregister(event_notifier->desc->kname,
+ ret = lttng_wrapper_tracepoint_probe_unregister(event_notifier->desc->event_kname,
event_notifier->desc->event_notifier_callback,
event_notifier);
break;
WARN_ON_ONCE(1);
}
list_del(&event->list);
- lttng_destroy_context(event->ctx);
+ lttng_kernel_destroy_context(event->ctx);
lttng_free_event_filter_runtime(event);
/* Free event enabler refs */
list_for_each_entry_safe(enabler_ref, tmp_enabler_ref,
return 1;
}
-int lttng_desc_match_enabler(const struct lttng_event_desc *desc,
+int lttng_desc_match_enabler(const struct lttng_kernel_event_desc *desc,
struct lttng_enabler *enabler)
{
const char *desc_name, *enabler_name;
enabler_name = enabler->event_param.name;
switch (enabler->event_param.instrumentation) {
case LTTNG_KERNEL_TRACEPOINT:
- desc_name = desc->name;
+ desc_name = desc->event_name;
switch (enabler->format_type) {
case LTTNG_ENABLER_FORMAT_STAR_GLOB:
return lttng_match_enabler_star_glob(desc_name, enabler_name);
break;
case LTTNG_KERNEL_SYSCALL:
- desc_name = desc->name;
+ desc_name = desc->event_name;
if (!strncmp(desc_name, "compat_", strlen("compat_"))) {
desc_name += strlen("compat_");
compat = true;
void lttng_create_tracepoint_event_if_missing(struct lttng_event_enabler *event_enabler)
{
struct lttng_session *session = event_enabler->chan->session;
- struct lttng_probe_desc *probe_desc;
- const struct lttng_event_desc *desc;
+ struct lttng_kernel_probe_desc *probe_desc;
+ const struct lttng_kernel_event_desc *desc;
int i;
struct list_head *probe_list;
*/
head = utils_borrow_hash_table_bucket(
session->events_ht.table, LTTNG_EVENT_HT_SIZE,
- desc->name);
+ desc->event_name);
lttng_hlist_for_each_entry(event, head, hlist) {
if (event->desc == desc
&& event->chan == event_enabler->chan)
LTTNG_KERNEL_TRACEPOINT);
if (!event) {
printk(KERN_INFO "LTTng: Unable to create event %s\n",
- probe_desc->event_desc[i]->name);
+ probe_desc->event_desc[i]->event_name);
}
}
}
void lttng_create_tracepoint_event_notifier_if_missing(struct lttng_event_notifier_enabler *event_notifier_enabler)
{
struct lttng_event_notifier_group *event_notifier_group = event_notifier_enabler->group;
- struct lttng_probe_desc *probe_desc;
- const struct lttng_event_desc *desc;
+ struct lttng_kernel_probe_desc *probe_desc;
+ const struct lttng_kernel_event_desc *desc;
int i;
struct list_head *probe_list;
*/
head = utils_borrow_hash_table_bucket(
event_notifier_group->event_notifiers_ht.table,
- LTTNG_EVENT_NOTIFIER_HT_SIZE, desc->name);
+ LTTNG_EVENT_NOTIFIER_HT_SIZE, desc->event_name);
lttng_hlist_for_each_entry(event_notifier, head, hlist) {
if (event_notifier->desc == desc
&& event_notifier->user_token == event_notifier_enabler->base.user_token)
LTTNG_KERNEL_TRACEPOINT);
if (IS_ERR(event_notifier)) {
printk(KERN_INFO "Unable to create event_notifier %s\n",
- probe_desc->event_desc[i]->name);
+ probe_desc->event_desc[i]->event_name);
}
}
}
lttng_enabler_destroy(lttng_event_enabler_as_enabler(event_enabler));
/* Destroy contexts */
- lttng_destroy_context(event_enabler->ctx);
+ lttng_kernel_destroy_context(event_enabler->ctx);
list_del(&event_enabler->node);
kfree(event_enabler);
static
int lttng_field_name_statedump(struct lttng_session *session,
- const struct lttng_event_field *field,
+ const struct lttng_kernel_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,
+ const struct lttng_kernel_type_integer *type,
+ enum lttng_kernel_string_encoding parent_encoding,
size_t nesting)
{
int ret;
- WARN_ON_ONCE(type->type != lttng_kernel_type_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_kernel_string_encoding_none)
+ type->size,
+ type->alignment,
+ type->signedness,
+ (parent_encoding == lttng_kernel_string_encoding_none)
? "none"
- : (type->u.integer.encoding == lttng_kernel_string_encoding_UTF8)
+ : (parent_encoding == lttng_kernel_string_encoding_UTF8)
? "UTF8"
: "ASCII",
- type->u.integer.base,
+ type->base,
#if __BYTE_ORDER == __BIG_ENDIAN
- type->u.integer.reverse_byte_order ? " byte_order = le;" : ""
+ type->reverse_byte_order ? " byte_order = le;" : ""
#else
- type->u.integer.reverse_byte_order ? " byte_order = be;" : ""
+ type->reverse_byte_order ? " byte_order = be;" : ""
#endif
);
return ret;
*/
static
int _lttng_struct_type_statedump(struct lttng_session *session,
- const struct lttng_type *type,
+ const struct lttng_kernel_type_struct *type,
size_t nesting)
{
int ret;
uint32_t i, nr_fields;
unsigned int alignment;
- WARN_ON_ONCE(type->type != lttng_kernel_type_struct_nestable);
-
ret = print_tabs(session, nesting);
if (ret)
return ret;
"struct {\n");
if (ret)
return ret;
- nr_fields = type->u.struct_nestable.nr_fields;
+ nr_fields = type->nr_fields;
for (i = 0; i < nr_fields; i++) {
- const struct lttng_event_field *iter_field;
+ const struct lttng_kernel_event_field *iter_field;
- iter_field = &type->u.struct_nestable.fields[i];
+ iter_field = type->fields[i];
ret = _lttng_field_statedump(session, iter_field, nesting + 1);
if (ret)
return ret;
ret = print_tabs(session, nesting);
if (ret)
return ret;
- alignment = type->u.struct_nestable.alignment;
+ alignment = type->alignment;
if (alignment) {
ret = lttng_metadata_printf(session,
"} align(%u)",
*/
static
int _lttng_struct_field_statedump(struct lttng_session *session,
- const struct lttng_event_field *field,
+ const struct lttng_kernel_event_field *field,
size_t nesting)
{
int ret;
ret = _lttng_struct_type_statedump(session,
- &field->type, nesting);
+ lttng_kernel_get_type_struct(field->type), nesting);
if (ret)
return ret;
return lttng_field_name_statedump(session, field, nesting);
*/
static
int _lttng_variant_type_statedump(struct lttng_session *session,
- const struct lttng_type *type,
+ const struct lttng_kernel_type_variant *type,
size_t nesting)
{
int ret;
uint32_t i, nr_choices;
- WARN_ON_ONCE(type->type != lttng_kernel_type_variant_nestable);
/*
* CTF 1.8 does not allow expressing nonzero variant alignment in a nestable way.
*/
- if (type->u.variant_nestable.alignment != 0)
+ if (type->alignment != 0)
return -EINVAL;
ret = print_tabs(session, nesting);
if (ret)
return ret;
ret = lttng_metadata_printf(session,
"variant <_%s> {\n",
- type->u.variant_nestable.tag_name);
+ type->tag_name);
if (ret)
return ret;
- nr_choices = type->u.variant_nestable.nr_choices;
+ nr_choices = type->nr_choices;
for (i = 0; i < nr_choices; i++) {
- const struct lttng_event_field *iter_field;
+ const struct lttng_kernel_event_field *iter_field;
- iter_field = &type->u.variant_nestable.choices[i];
+ iter_field = type->choices[i];
ret = _lttng_field_statedump(session, iter_field, nesting + 1);
if (ret)
return ret;
*/
static
int _lttng_variant_field_statedump(struct lttng_session *session,
- const struct lttng_event_field *field,
+ const struct lttng_kernel_event_field *field,
size_t nesting)
{
int ret;
ret = _lttng_variant_type_statedump(session,
- &field->type, nesting);
+ lttng_kernel_get_type_variant(field->type), nesting);
if (ret)
return ret;
return lttng_field_name_statedump(session, field, nesting);
*/
static
int _lttng_array_field_statedump(struct lttng_session *session,
- const struct lttng_event_field *field,
+ const struct lttng_kernel_event_field *field,
size_t nesting)
{
int ret;
- const struct lttng_type *elem_type;
+ const struct lttng_kernel_type_array *array_type;
+ const struct lttng_kernel_type_common *elem_type;
- WARN_ON_ONCE(field->type.type != lttng_kernel_type_array_nestable);
+ array_type = lttng_kernel_get_type_array(field->type);
+ WARN_ON_ONCE(!array_type);
- if (field->type.u.array_nestable.alignment) {
+ if (array_type->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_nestable.alignment * CHAR_BIT,
+ array_type->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;
+ elem_type = array_type->elem_type;
switch (elem_type->type) {
case lttng_kernel_type_integer:
- case lttng_kernel_type_struct_nestable:
- case lttng_kernel_type_variant_nestable:
- ret = _lttng_type_statedump(session, elem_type, nesting);
+ case lttng_kernel_type_struct:
+ case lttng_kernel_type_variant:
+ ret = _lttng_type_statedump(session, elem_type,
+ array_type->encoding, nesting);
if (ret)
return ret;
break;
ret = lttng_metadata_printf(session,
" _%s[%u];\n",
field->name,
- field->type.u.array_nestable.length);
+ array_type->length);
return ret;
}
*/
static
int _lttng_sequence_field_statedump(struct lttng_session *session,
- const struct lttng_event_field *field,
+ const struct lttng_kernel_event_field *field,
size_t nesting)
{
int ret;
const char *length_name;
- const struct lttng_type *elem_type;
+ const struct lttng_kernel_type_sequence *sequence_type;
+ const struct lttng_kernel_type_common *elem_type;
- WARN_ON_ONCE(field->type.type != lttng_kernel_type_sequence_nestable);
+ sequence_type = lttng_kernel_get_type_sequence(field->type);
+ WARN_ON_ONCE(!sequence_type);
- length_name = field->type.u.sequence_nestable.length_name;
+ length_name = sequence_type->length_name;
- if (field->type.u.sequence_nestable.alignment) {
+ if (sequence_type->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_nestable.alignment * CHAR_BIT,
+ sequence_type->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;
+ elem_type = sequence_type->elem_type;
switch (elem_type->type) {
case lttng_kernel_type_integer:
- case lttng_kernel_type_struct_nestable:
- case lttng_kernel_type_variant_nestable:
- ret = _lttng_type_statedump(session, elem_type, nesting);
+ case lttng_kernel_type_struct:
+ case lttng_kernel_type_variant:
+ ret = _lttng_type_statedump(session, elem_type,
+ sequence_type->encoding, nesting);
if (ret)
return ret;
break;
ret = lttng_metadata_printf(session,
" _%s[ _%s ];\n",
field->name,
- field->type.u.sequence_nestable.length_name);
+ sequence_type->length_name);
return ret;
}
*/
static
int _lttng_enum_type_statedump(struct lttng_session *session,
- const struct lttng_type *type,
+ const struct lttng_kernel_type_enum *type,
size_t nesting)
{
const struct lttng_kernel_enum_desc *enum_desc;
- const struct lttng_type *container_type;
+ const struct lttng_kernel_type_common *container_type;
int ret;
unsigned int i, nr_entries;
- container_type = type->u.enum_nestable.container_type;
+ container_type = type->container_type;
if (container_type->type != lttng_kernel_type_integer) {
ret = -EINVAL;
goto end;
}
- enum_desc = type->u.enum_nestable.desc;
+ enum_desc = type->desc;
nr_entries = enum_desc->nr_entries;
ret = print_tabs(session, nesting);
ret = lttng_metadata_printf(session, "enum : ");
if (ret)
goto end;
- ret = _lttng_integer_type_statedump(session, container_type, 0);
+ ret = _lttng_integer_type_statedump(session, lttng_kernel_get_type_integer(container_type),
+ lttng_kernel_string_encoding_none, 0);
if (ret)
goto end;
ret = lttng_metadata_printf(session, " {\n");
goto end;
/* Dump all entries */
for (i = 0; i < nr_entries; i++) {
- const struct lttng_kernel_enum_entry *entry = &enum_desc->entries[i];
+ const struct lttng_kernel_enum_entry *entry = enum_desc->entries[i];
int j, len;
ret = print_tabs(session, nesting + 1);
*/
static
int _lttng_enum_field_statedump(struct lttng_session *session,
- const struct lttng_event_field *field,
+ const struct lttng_kernel_event_field *field,
size_t nesting)
{
int ret;
+ const struct lttng_kernel_type_enum *enum_type;
- ret = _lttng_enum_type_statedump(session, &field->type, nesting);
+ enum_type = lttng_kernel_get_type_enum(field->type);
+ WARN_ON_ONCE(!enum_type);
+ ret = _lttng_enum_type_statedump(session, enum_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,
+ const struct lttng_kernel_event_field *field,
size_t nesting)
{
int ret;
- ret = _lttng_integer_type_statedump(session, &field->type, nesting);
+ ret = _lttng_integer_type_statedump(session, lttng_kernel_get_type_integer(field->type),
+ lttng_kernel_string_encoding_none, 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,
+ const struct lttng_kernel_type_string *type,
size_t nesting)
{
int ret;
- WARN_ON_ONCE(type->type != lttng_kernel_type_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_kernel_string_encoding_ASCII ?
+ type->encoding == lttng_kernel_string_encoding_ASCII ?
" { encoding = ASCII; }" : "");
return ret;
}
static
int _lttng_string_field_statedump(struct lttng_session *session,
- const struct lttng_event_field *field,
+ const struct lttng_kernel_event_field *field,
size_t nesting)
{
+ const struct lttng_kernel_type_string *string_type;
int ret;
- WARN_ON_ONCE(field->type.type != lttng_kernel_type_string);
- ret = _lttng_string_type_statedump(session, &field->type, nesting);
+ string_type = lttng_kernel_get_type_string(field->type);
+ WARN_ON_ONCE(!string_type);
+ ret = _lttng_string_type_statedump(session, string_type, nesting);
if (ret)
return ret;
return lttng_field_name_statedump(session, field, nesting);
*/
static
int _lttng_type_statedump(struct lttng_session *session,
- const struct lttng_type *type,
+ const struct lttng_kernel_type_common *type,
+ enum lttng_kernel_string_encoding parent_encoding,
size_t nesting)
{
int ret = 0;
switch (type->type) {
case lttng_kernel_type_integer:
- ret = _lttng_integer_type_statedump(session, type, nesting);
+ ret = _lttng_integer_type_statedump(session,
+ lttng_kernel_get_type_integer(type),
+ parent_encoding, nesting);
break;
- case lttng_kernel_type_enum_nestable:
- ret = _lttng_enum_type_statedump(session, type, nesting);
+ case lttng_kernel_type_enum:
+ ret = _lttng_enum_type_statedump(session,
+ lttng_kernel_get_type_enum(type),
+ nesting);
break;
case lttng_kernel_type_string:
- ret = _lttng_string_type_statedump(session, type, nesting);
+ ret = _lttng_string_type_statedump(session,
+ lttng_kernel_get_type_string(type),
+ nesting);
break;
- case lttng_kernel_type_struct_nestable:
- ret = _lttng_struct_type_statedump(session, type, nesting);
+ case lttng_kernel_type_struct:
+ ret = _lttng_struct_type_statedump(session,
+ lttng_kernel_get_type_struct(type),
+ nesting);
break;
- case lttng_kernel_type_variant_nestable:
- ret = _lttng_variant_type_statedump(session, type, nesting);
+ case lttng_kernel_type_variant:
+ ret = _lttng_variant_type_statedump(session,
+ lttng_kernel_get_type_variant(type),
+ nesting);
break;
/* Nested arrays and sequences are not supported yet. */
- case lttng_kernel_type_array_nestable:
- case lttng_kernel_type_sequence_nestable:
+ case lttng_kernel_type_array:
+ case lttng_kernel_type_sequence:
default:
WARN_ON_ONCE(1);
return -EINVAL;
*/
static
int _lttng_field_statedump(struct lttng_session *session,
- const struct lttng_event_field *field,
+ const struct lttng_kernel_event_field *field,
size_t nesting)
{
int ret = 0;
- switch (field->type.type) {
+ switch (field->type->type) {
case lttng_kernel_type_integer:
ret = _lttng_integer_field_statedump(session, field, nesting);
break;
- case lttng_kernel_type_enum_nestable:
+ case lttng_kernel_type_enum:
ret = _lttng_enum_field_statedump(session, field, nesting);
break;
case lttng_kernel_type_string:
ret = _lttng_string_field_statedump(session, field, nesting);
break;
- case lttng_kernel_type_struct_nestable:
+ case lttng_kernel_type_struct:
ret = _lttng_struct_field_statedump(session, field, nesting);
break;
- case lttng_kernel_type_array_nestable:
+ case lttng_kernel_type_array:
ret = _lttng_array_field_statedump(session, field, nesting);
break;
- case lttng_kernel_type_sequence_nestable:
+ case lttng_kernel_type_sequence:
ret = _lttng_sequence_field_statedump(session, field, nesting);
break;
- case lttng_kernel_type_variant_nestable:
+ case lttng_kernel_type_variant:
ret = _lttng_variant_field_statedump(session, field, nesting);
break;
static
int _lttng_context_metadata_statedump(struct lttng_session *session,
- struct lttng_ctx *ctx)
+ struct lttng_kernel_ctx *ctx)
{
int ret = 0;
int i;
if (!ctx)
return 0;
for (i = 0; i < ctx->nr_fields; i++) {
- const struct lttng_ctx_field *field = &ctx->fields[i];
+ const struct lttng_kernel_ctx_field *field = &ctx->fields[i];
- ret = _lttng_field_statedump(session, &field->event_field, 2);
+ ret = _lttng_field_statedump(session, field->event_field, 2);
if (ret)
return ret;
}
int _lttng_fields_metadata_statedump(struct lttng_session *session,
struct lttng_event *event)
{
- const struct lttng_event_desc *desc = event->desc;
+ const struct lttng_kernel_event_desc *desc = event->desc;
int ret = 0;
int i;
for (i = 0; i < desc->nr_fields; i++) {
- const struct lttng_event_field *field = &desc->fields[i];
+ const struct lttng_kernel_event_field *field = desc->fields[i];
ret = _lttng_field_statedump(session, field, 2);
if (ret)
" name = \"%s\";\n"
" id = %u;\n"
" stream_id = %u;\n",
- event->desc->name,
+ event->desc->event_name,
event->id,
event->chan->id);
if (ret)
* Called under sessions lock.
*/
static
-int check_event_provider(struct lttng_probe_desc *desc)
+int check_event_provider(struct lttng_kernel_probe_desc *desc)
{
int i;
size_t provider_name_len;
- provider_name_len = strnlen(desc->provider,
+ provider_name_len = strnlen(desc->provider_name,
LTTNG_KERNEL_SYM_NAME_LEN - 1);
for (i = 0; i < desc->nr_events; i++) {
- if (strncmp(desc->event_desc[i]->name,
- desc->provider,
+ if (strncmp(desc->event_desc[i]->event_name,
+ desc->provider_name,
provider_name_len))
return 0; /* provider mismatch */
/*
* The event needs to contain at least provider name + _ +
* one or more letter.
*/
- if (strlen(desc->event_desc[i]->name) <= provider_name_len + 1)
+ if (strlen(desc->event_desc[i]->event_name) <= provider_name_len + 1)
return 0; /* provider mismatch */
- if (desc->event_desc[i]->name[provider_name_len] != '_')
+ if (desc->event_desc[i]->event_name[provider_name_len] != '_')
return 0; /* provider mismatch */
}
return 1;
* Called under sessions lock.
*/
static
-void lttng_lazy_probe_register(struct lttng_probe_desc *desc)
+void lttng_lazy_probe_register(struct lttng_kernel_probe_desc *desc)
{
- struct lttng_probe_desc *iter;
+ struct lttng_kernel_probe_desc *iter;
struct list_head *probe_list;
/*
*/
/*
- * We sort the providers by struct lttng_probe_desc pointer
+ * We sort the providers by struct lttng_kernel_probe_desc pointer
* address.
*/
probe_list = &_probe_list;
list_add(&desc->head, probe_list);
desc_added:
pr_debug("LTTng: just registered probe %s containing %u events\n",
- desc->provider, desc->nr_events);
+ desc->provider_name, desc->nr_events);
}
/*
static
void fixup_lazy_probes(void)
{
- struct lttng_probe_desc *iter, *tmp;
+ struct lttng_kernel_probe_desc *iter, *tmp;
int ret;
lazy_nesting++;
}
static
-const struct lttng_probe_desc *find_provider(const char *provider)
+const struct lttng_kernel_probe_desc *find_provider(const char *provider)
{
- struct lttng_probe_desc *iter;
+ struct lttng_kernel_probe_desc *iter;
struct list_head *probe_list;
probe_list = lttng_get_probe_list_head();
list_for_each_entry(iter, probe_list, head) {
- if (!strcmp(iter->provider, provider))
+ if (!strcmp(iter->provider_name, provider))
return iter;
}
return NULL;
}
-int lttng_probe_register(struct lttng_probe_desc *desc)
+int lttng_probe_register(struct lttng_kernel_probe_desc *desc)
{
int ret = 0;
/*
* Check if the provider has already been registered.
*/
- if (find_provider(desc->provider)) {
+ if (find_provider(desc->provider_name)) {
ret = -EEXIST;
goto end;
}
list_add(&desc->lazy_init_head, &lazy_probe_init);
desc->lazy = 1;
pr_debug("LTTng: adding probe %s containing %u events to lazy registration list\n",
- desc->provider, desc->nr_events);
+ desc->provider_name, desc->nr_events);
/*
* If there is at least one active session, we need to register
* the probe immediately, since we cannot delay event
}
EXPORT_SYMBOL_GPL(lttng_probe_register);
-void lttng_probe_unregister(struct lttng_probe_desc *desc)
+void lttng_probe_unregister(struct lttng_kernel_probe_desc *desc)
{
lttng_lock_sessions();
if (!desc->lazy)
list_del(&desc->head);
else
list_del(&desc->lazy_init_head);
- pr_debug("LTTng: just unregistered probe %s\n", desc->provider);
+ pr_debug("LTTng: just unregistered probe %s\n", desc->provider_name);
lttng_unlock_sessions();
}
EXPORT_SYMBOL_GPL(lttng_probe_unregister);
* Called with sessions lock held.
*/
static
-const struct lttng_event_desc *find_event_desc(const char *name)
+const struct lttng_kernel_event_desc *find_event_desc(const char *name)
{
- struct lttng_probe_desc *probe_desc;
+ struct lttng_kernel_probe_desc *probe_desc;
int i;
list_for_each_entry(probe_desc, &_probe_list, head) {
for (i = 0; i < probe_desc->nr_events; i++) {
- if (!strcmp(probe_desc->event_desc[i]->name, name))
+ if (!strcmp(probe_desc->event_desc[i]->event_name, name))
return probe_desc->event_desc[i];
}
}
/*
* Called with sessions lock held.
*/
-const struct lttng_event_desc *lttng_event_desc_get(const char *name)
+const struct lttng_kernel_event_desc *lttng_event_desc_get(const char *name)
{
- const struct lttng_event_desc *event_desc;
+ const struct lttng_kernel_event_desc *event_desc;
int ret;
event_desc = find_event_desc(name);
/*
* Called with sessions lock held.
*/
-void lttng_event_desc_put(const struct lttng_event_desc *event_desc)
+void lttng_event_desc_put(const struct lttng_kernel_event_desc *event_desc)
{
module_put(event_desc->owner);
}
static
void *tp_list_start(struct seq_file *m, loff_t *pos)
{
- struct lttng_probe_desc *probe_desc;
+ struct lttng_kernel_probe_desc *probe_desc;
struct list_head *probe_list;
int iter = 0, i;
static
void *tp_list_next(struct seq_file *m, void *p, loff_t *ppos)
{
- struct lttng_probe_desc *probe_desc;
+ struct lttng_kernel_probe_desc *probe_desc;
struct list_head *probe_list;
int iter = 0, i;
static
int tp_list_show(struct seq_file *m, void *p)
{
- const struct lttng_event_desc *probe_desc = p;
+ const struct lttng_kernel_event_desc *probe_desc = p;
seq_printf(m, "event { name = %s; };\n",
- probe_desc->name);
+ probe_desc->event_name);
return 0;
}
}
static inline
-size_t ctx_get_aligned_size(size_t offset, struct lttng_ctx *ctx,
+size_t ctx_get_aligned_size(size_t offset, struct lttng_kernel_ctx *ctx,
size_t ctx_len)
{
size_t orig_offset = offset;
}
static inline
-void ctx_get_struct_size(struct lttng_ctx *ctx, size_t *ctx_len,
+void ctx_get_struct_size(struct lttng_kernel_ctx *ctx, size_t *ctx_len,
struct lttng_channel *chan, struct lib_ring_buffer_ctx *bufctx)
{
int i;
static inline
void ctx_record(struct lib_ring_buffer_ctx *bufctx,
struct lttng_channel *chan,
- struct lttng_ctx *ctx)
+ struct lttng_kernel_ctx *ctx)
{
int i;
struct trace_syscall_entry {
void *event_func;
void *event_notifier_func;
- const struct lttng_event_desc *desc;
- const struct lttng_event_field *fields;
+ const struct lttng_kernel_event_desc *desc;
+ const struct lttng_kernel_event_field **fields;
unsigned int nrargs;
};
/* Allocate events for each syscall matching enabler, insert into table */
for (i = 0; i < table_len; i++) {
- const struct lttng_event_desc *desc = table[i].desc;
+ const struct lttng_kernel_event_desc *desc = table[i].desc;
struct lttng_kernel_event ev;
struct lttng_event *event;
struct hlist_head *head;
*/
head = utils_borrow_hash_table_bucket(
session->events_ht.table, LTTNG_EVENT_HT_SIZE,
- desc->name);
+ desc->event_name);
lttng_hlist_for_each_entry(event, head, hlist) {
if (event->desc == desc
&& event->chan == event_enabler->chan)
ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
break;
}
- strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN - 1);
+ strncpy(ev.name, desc->event_name, LTTNG_KERNEL_SYM_NAME_LEN - 1);
ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
ev.instrumentation = LTTNG_KERNEL_SYSCALL;
event = _lttng_event_create(chan, &ev, filter,
}
#endif
if (hlist_empty(&chan->sc_unknown)) {
- const struct lttng_event_desc *desc =
+ const struct lttng_kernel_event_desc *desc =
&__event_desc___syscall_entry_unknown;
struct lttng_event *event;
memset(&ev, 0, sizeof(ev));
- strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
+ strncpy(ev.name, desc->event_name, LTTNG_KERNEL_SYM_NAME_LEN);
ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
ev.instrumentation = LTTNG_KERNEL_SYSCALL;
ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
}
if (hlist_empty(&chan->sc_compat_unknown)) {
- const struct lttng_event_desc *desc =
+ const struct lttng_kernel_event_desc *desc =
&__event_desc___compat_syscall_entry_unknown;
struct lttng_event *event;
memset(&ev, 0, sizeof(ev));
- strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
+ strncpy(ev.name, desc->event_name, LTTNG_KERNEL_SYM_NAME_LEN);
ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
ev.instrumentation = LTTNG_KERNEL_SYSCALL;
ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
}
if (hlist_empty(&chan->compat_sc_exit_unknown)) {
- const struct lttng_event_desc *desc =
+ const struct lttng_kernel_event_desc *desc =
&__event_desc___compat_syscall_exit_unknown;
struct lttng_event *event;
memset(&ev, 0, sizeof(ev));
- strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
+ strncpy(ev.name, desc->event_name, LTTNG_KERNEL_SYM_NAME_LEN);
ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
ev.instrumentation = LTTNG_KERNEL_SYSCALL;
ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
}
if (hlist_empty(&chan->sc_exit_unknown)) {
- const struct lttng_event_desc *desc =
+ const struct lttng_kernel_event_desc *desc =
&__event_desc___syscall_exit_unknown;
struct lttng_event *event;
memset(&ev, 0, sizeof(ev));
- strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
+ strncpy(ev.name, desc->event_name, LTTNG_KERNEL_SYM_NAME_LEN);
ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
ev.instrumentation = LTTNG_KERNEL_SYSCALL;
ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
enum sc_type type)
{
struct lttng_event_notifier *notifier;
- const struct lttng_event_desc *desc;
+ const struct lttng_kernel_event_desc *desc;
struct lttng_event_notifier_group *group = event_notifier_enabler->group;
struct lttng_kernel_event_notifier event_notifier_param;
uint64_t user_token = event_notifier_enabler->base.user_token;
* Check if already created.
*/
head = utils_borrow_hash_table_bucket(group->event_notifiers_ht.table,
- LTTNG_EVENT_NOTIFIER_HT_SIZE, desc->name);
+ LTTNG_EVENT_NOTIFIER_HT_SIZE, desc->event_name);
lttng_hlist_for_each_entry(notifier, head, hlist) {
if (notifier->desc == desc &&
notifier->user_token == base_enabler->user_token)
goto end;
memset(&event_notifier_param, 0, sizeof(event_notifier_param));
- strncat(event_notifier_param.event.name, desc->name,
+ strncat(event_notifier_param.event.name, desc->event_name,
LTTNG_KERNEL_SYM_NAME_LEN - strlen(event_notifier_param.event.name) - 1);
event_notifier_param.event.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
event_notifier_param.event.instrumentation);
if (IS_ERR(notifier)) {
printk(KERN_INFO "Unable to create unknown notifier %s\n",
- desc->name);
+ desc->event_name);
ret = -ENOMEM;
goto end;
}
size_t table_len, enum sc_type type)
{
struct lttng_event_notifier_group *group = event_notifier_enabler->group;
- const struct lttng_event_desc *desc;
+ const struct lttng_kernel_event_desc *desc;
uint64_t user_token = event_notifier_enabler->base.user_token;
uint64_t error_counter_index = event_notifier_enabler->error_counter_index;
unsigned int i;
* Check if already created.
*/
head = utils_borrow_hash_table_bucket(group->event_notifiers_ht.table,
- LTTNG_EVENT_NOTIFIER_HT_SIZE, desc->name);
+ LTTNG_EVENT_NOTIFIER_HT_SIZE, desc->event_name);
lttng_hlist_for_each_entry(event_notifier, head, hlist) {
if (event_notifier->desc == desc
&& event_notifier->user_token == event_notifier_enabler->base.user_token)
event_notifier_param.event.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
break;
}
- strncat(event_notifier_param.event.name, desc->name,
+ strncat(event_notifier_param.event.name, desc->event_name,
LTTNG_KERNEL_SYM_NAME_LEN - strlen(event_notifier_param.event.name) - 1);
event_notifier_param.event.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
event_notifier_param.event.instrumentation = LTTNG_KERNEL_SYSCALL;
filter, event_notifier_param.event.instrumentation);
if (IS_ERR(event_notifier)) {
printk(KERN_INFO "Unable to create event_notifier %s\n",
- desc->name);
+ desc->event_name);
ret = -ENOMEM;
goto end;
}
entry = &sc_table[i];
if (!entry->desc)
continue;
- it_name = entry->desc->name;
+ it_name = entry->desc->event_name;
it_name += strlen(SYSCALL_ENTRY_STR);
if (!strcmp(syscall_name, it_name)) {
syscall_nr = i;
entry = &compat_sc_table[i];
if (!entry->desc)
continue;
- it_name = entry->desc->name;
+ it_name = entry->desc->event_name;
it_name += strlen(COMPAT_SYSCALL_ENTRY_STR);
if (!strcmp(syscall_name, it_name)) {
syscall_nr = i;
WARN_ON_ONCE(notifier->instrumentation != LTTNG_KERNEL_SYSCALL);
ret = lttng_syscall_filter_enable(group->sc_filter,
- notifier->desc->name, notifier->u.syscall.abi,
+ notifier->desc->event_name, notifier->u.syscall.abi,
notifier->u.syscall.entryexit);
if (ret) {
goto end;
WARN_ON_ONCE(event->instrumentation != LTTNG_KERNEL_SYSCALL);
return lttng_syscall_filter_enable(channel->sc_filter,
- event->desc->name, event->u.syscall.abi,
+ event->desc->event_name, event->u.syscall.abi,
event->u.syscall.entryexit);
}
WARN_ON_ONCE(notifier->instrumentation != LTTNG_KERNEL_SYSCALL);
ret = lttng_syscall_filter_disable(group->sc_filter,
- notifier->desc->name, notifier->u.syscall.abi,
+ notifier->desc->event_name, notifier->u.syscall.abi,
notifier->u.syscall.entryexit);
WARN_ON_ONCE(ret != 0);
struct lttng_event *event)
{
return lttng_syscall_filter_disable(channel->sc_filter,
- event->desc->name, event->u.syscall.abi,
+ event->desc->event_name, event->u.syscall.abi,
event->u.syscall.entryexit);
}
return 0;
if (table == sc_table) {
index = entry - table;
- name = &entry->desc->name[strlen(SYSCALL_ENTRY_STR)];
+ name = &entry->desc->event_name[strlen(SYSCALL_ENTRY_STR)];
} else {
index = (entry - table) + ARRAY_SIZE(sc_table);
- name = &entry->desc->name[strlen(COMPAT_SYSCALL_ENTRY_STR)];
+ name = &entry->desc->event_name[strlen(COMPAT_SYSCALL_ENTRY_STR)];
}
seq_printf(m, "syscall { index = %lu; name = %s; bitness = %u; };\n",
index, name, bitness);
return 0;
}
+static const struct lttng_kernel_type_common *event_type =
+ lttng_kernel_static_type_integer_from_type(unsigned long, __BYTE_ORDER, 16);
+
/*
* Create event description
*/
static
int lttng_create_kprobe_event(const char *name, struct lttng_event *event)
{
- struct lttng_event_field *field;
- struct lttng_event_desc *desc;
+ const struct lttng_kernel_event_field **fieldp_array;
+ struct lttng_kernel_event_field *field;
+ struct lttng_kernel_event_desc *desc;
int ret;
- desc = kzalloc(sizeof(*event->desc), GFP_KERNEL);
+ desc = kzalloc(sizeof(*desc), GFP_KERNEL);
if (!desc)
return -ENOMEM;
- desc->name = kstrdup(name, GFP_KERNEL);
- if (!desc->name) {
+ desc->event_name = kstrdup(name, GFP_KERNEL);
+ if (!desc->event_name) {
ret = -ENOMEM;
goto error_str;
}
desc->nr_fields = 1;
- desc->fields = field =
- kzalloc(1 * sizeof(struct lttng_event_field), GFP_KERNEL);
+ fieldp_array = kzalloc(1 * sizeof(struct lttng_kernel_event_field *), GFP_KERNEL);
+ if (!fieldp_array) {
+ ret = -ENOMEM;
+ goto error_fieldp_array;
+ }
+ desc->fields = fieldp_array;
+ desc->fields[0] = field =
+ kzalloc(sizeof(struct lttng_kernel_event_field), GFP_KERNEL);
if (!field) {
ret = -ENOMEM;
goto error_field;
}
field->name = "ip";
- field->type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
+ field->type = event_type;
desc->owner = THIS_MODULE;
event->desc = desc;
return 0;
error_field:
- kfree(desc->name);
+ kfree(fieldp_array);
+error_fieldp_array:
+ kfree(desc->event_name);
error_str:
kfree(desc);
return ret;
static
int lttng_create_kprobe_event_notifier(const char *name, struct lttng_event_notifier *event_notifier)
{
- struct lttng_event_desc *desc;
+ struct lttng_kernel_event_desc *desc;
int ret;
- desc = kzalloc(sizeof(*event_notifier->desc), GFP_KERNEL);
+ desc = kzalloc(sizeof(*desc), GFP_KERNEL);
if (!desc)
return -ENOMEM;
- desc->name = kstrdup(name, GFP_KERNEL);
- if (!desc->name) {
+ desc->event_name = kstrdup(name, GFP_KERNEL);
+ if (!desc->event_name) {
ret = -ENOMEM;
goto error_str;
}
register_error:
kfree(event->desc->fields);
- kfree(event->desc->name);
+ kfree(event->desc->event_name);
kfree(event->desc);
error:
return ret;
return 0;
register_error:
- kfree(event_notifier->desc->name);
+ kfree(event_notifier->desc->event_name);
kfree(event_notifier->desc);
error:
return ret;
void lttng_kprobes_destroy_event_private(struct lttng_event *event)
{
kfree(event->u.kprobe.symbol_name);
+ kfree(event->desc->fields[0]);
kfree(event->desc->fields);
- kfree(event->desc->name);
+ kfree(event->desc->event_name);
kfree(event->desc);
}
EXPORT_SYMBOL_GPL(lttng_kprobes_destroy_event_private);
void lttng_kprobes_destroy_event_notifier_private(struct lttng_event_notifier *event_notifier)
{
kfree(event_notifier->u.kprobe.symbol_name);
- kfree(event_notifier->desc->name);
+ kfree(event_notifier->desc->event_name);
kfree(event_notifier->desc);
}
EXPORT_SYMBOL_GPL(lttng_kprobes_destroy_event_notifier_private);
return _lttng_kretprobes_handler(krpi, regs, EVENT_EXIT);
}
+static const struct lttng_kernel_type_common *event_type =
+ lttng_kernel_static_type_integer_from_type(unsigned long, __BYTE_ORDER, 16);
+
/*
* Create event description
*/
int lttng_create_kprobe_event(const char *name, struct lttng_event *event,
enum lttng_kretprobe_type type)
{
- struct lttng_event_field *fields;
- struct lttng_event_desc *desc;
- int ret;
+ const struct lttng_kernel_event_field **fieldp_array;
+ struct lttng_kernel_event_field *field;
+ struct lttng_kernel_event_desc *desc;
char *alloc_name;
size_t name_len;
const char *suffix = NULL;
+ int ret;
- desc = kzalloc(sizeof(*event->desc), GFP_KERNEL);
+ desc = kzalloc(sizeof(*desc), GFP_KERNEL);
if (!desc)
return -ENOMEM;
name_len = strlen(name);
}
strcpy(alloc_name, name);
strcat(alloc_name, suffix);
- desc->name = alloc_name;
+ desc->event_name = alloc_name;
desc->nr_fields = 2;
- desc->fields = fields =
- kzalloc(2 * sizeof(struct lttng_event_field), GFP_KERNEL);
- if (!desc->fields) {
+ fieldp_array = kzalloc(desc->nr_fields * sizeof(struct lttng_kernel_event_field *), GFP_KERNEL);
+ if (!fieldp_array) {
+ ret = -ENOMEM;
+ goto error_fieldp_array;
+ }
+ desc->fields = fieldp_array;
+
+ field = kzalloc(sizeof(struct lttng_kernel_event_field), GFP_KERNEL);
+ if (!field) {
+ ret = -ENOMEM;
+ goto error_field0;
+ }
+ field->name = "ip";
+ field->type = event_type;
+ desc->fields[0] = field;
+
+ field = kzalloc(sizeof(struct lttng_kernel_event_field), GFP_KERNEL);
+ if (!field) {
ret = -ENOMEM;
- goto error_fields;
+ goto error_field1;
}
- fields[0].name = "ip";
- fields[0].type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
-
- fields[1].name = "parent_ip";
- fields[1].type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
+ field->name = "parent_ip";
+ field->type = event_type;
+ desc->fields[1] = field;
desc->owner = THIS_MODULE;
event->desc = desc;
return 0;
-error_fields:
- kfree(desc->name);
+error_field1:
+ kfree(desc->fields[0]);
+error_field0:
+ kfree(fieldp_array);
+error_fieldp_array:
+ kfree(desc->event_name);
error_str:
kfree(desc);
return ret;
name_error:
kfree(lttng_krp);
krp_error:
+ kfree(event_exit->desc->fields[0]);
+ kfree(event_exit->desc->fields[1]);
kfree(event_exit->desc->fields);
- kfree(event_exit->desc->name);
+ kfree(event_exit->desc->event_name);
kfree(event_exit->desc);
event_exit_error:
+ kfree(event_entry->desc->fields[0]);
+ kfree(event_entry->desc->fields[1]);
kfree(event_entry->desc->fields);
- kfree(event_entry->desc->name);
+ kfree(event_entry->desc->event_name);
kfree(event_entry->desc);
error:
return ret;
void lttng_kretprobes_destroy_private(struct lttng_event *event)
{
+ kfree(event->desc->fields[0]);
+ kfree(event->desc->fields[1]);
kfree(event->desc->fields);
- kfree(event->desc->name);
+ kfree(event->desc->event_name);
kfree(event->desc);
kref_put(&event->u.kretprobe.lttng_krp->kref_alloc,
_lttng_kretprobes_release);
return 0;
}
+static const struct lttng_kernel_type_common *event_type =
+ lttng_kernel_static_type_integer_from_type(unsigned long, __BYTE_ORDER, 16);
+
/*
* Create event description.
*/
static
int lttng_create_uprobe_event(const char *name, struct lttng_event *event)
{
- struct lttng_event_desc *desc;
- struct lttng_event_field *fields;
+ const struct lttng_kernel_event_field **fieldp_array;
+ struct lttng_kernel_event_field *field;
+ struct lttng_kernel_event_desc *desc;
int ret;
- desc = kzalloc(sizeof(*event->desc), GFP_KERNEL);
+ desc = kzalloc(sizeof(*desc), GFP_KERNEL);
if (!desc)
return -ENOMEM;
- desc->name = kstrdup(name, GFP_KERNEL);
- if (!desc->name) {
+ desc->event_name = kstrdup(name, GFP_KERNEL);
+ if (!desc->event_name) {
ret = -ENOMEM;
goto error_str;
}
-
desc->nr_fields = 1;
- desc->fields = fields =
- kzalloc(1 * sizeof(struct lttng_event_field), GFP_KERNEL);
-
- if (!desc->fields) {
+ fieldp_array = kzalloc(1 * sizeof(struct lttng_kernel_event_field *), GFP_KERNEL);
+ if (!fieldp_array) {
ret = -ENOMEM;
- goto error_fields;
+ goto error_fieldp_array;
}
- fields[0].name = "ip";
- fields[0].type.type = lttng_kernel_type_integer;
- 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_kernel_string_encoding_none;
-
+ desc->fields = fieldp_array;
+ desc->fields[0] = field =
+ kzalloc(sizeof(struct lttng_kernel_event_field), GFP_KERNEL);
+ if (!field) {
+ ret = -ENOMEM;
+ goto error_field;
+ }
+ field->name = "ip";
+ field->type = event_type;
desc->owner = THIS_MODULE;
event->desc = desc;
return 0;
-error_fields:
- kfree(desc->name);
+error_field:
+ kfree(fieldp_array);
+error_fieldp_array:
+ kfree(desc->event_name);
error_str:
kfree(desc);
return ret;
static
int lttng_create_uprobe_event_notifier(const char *name, struct lttng_event_notifier *event_notifier)
{
- struct lttng_event_desc *desc;
+ struct lttng_kernel_event_desc *desc;
int ret;
- desc = kzalloc(sizeof(*event_notifier->desc), GFP_KERNEL);
+ desc = kzalloc(sizeof(*desc), GFP_KERNEL);
if (!desc)
return -ENOMEM;
- desc->name = kstrdup(name, GFP_KERNEL);
- if (!desc->name) {
+ desc->event_name = kstrdup(name, GFP_KERNEL);
+ if (!desc->event_name) {
ret = -ENOMEM;
goto error_str;
}
return 0;
register_error:
- kfree(event->desc->name);
+ kfree(event->desc->event_name);
kfree(event->desc);
error:
return ret;
return 0;
register_error:
- kfree(event_notifier->desc->name);
+ kfree(event_notifier->desc->event_name);
kfree(event_notifier->desc);
error:
return ret;
void lttng_uprobes_destroy_event_private(struct lttng_event *event)
{
iput(event->u.uprobe.inode);
- kfree(event->desc->name);
+ kfree(event->desc->fields[0]);
+ kfree(event->desc->fields);
+ kfree(event->desc->event_name);
kfree(event->desc);
}
EXPORT_SYMBOL_GPL(lttng_uprobes_destroy_event_private);
void lttng_uprobes_destroy_event_notifier_private(struct lttng_event_notifier *event_notifier)
{
iput(event_notifier->u.uprobe.inode);
- kfree(event_notifier->desc->name);
+ kfree(event_notifier->desc->event_name);
kfree(event_notifier->desc);
}
EXPORT_SYMBOL_GPL(lttng_uprobes_destroy_event_notifier_private);