X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=include%2Flttng%2Fevents.h;h=1eda3aca197fa5c69c197f09616e50198572a65a;hb=f7d06400be7d046205c20277a03f3f31bf5b1703;hp=b7267cd587a730d4b7e72b717a6eb97544414414;hpb=9190fb5679c4626e322a4819471e6e76858e063c;p=lttng-modules.git diff --git a/include/lttng/events.h b/include/lttng/events.h index b7267cd5..1eda3aca 100644 --- a/include/lttng/events.h +++ b/include/lttng/events.h @@ -25,7 +25,7 @@ #define lttng_is_signed_type(type) (((type) -1) < (type) 1) -struct lttng_channel; +struct lttng_kernel_channel_buffer; struct lttng_kernel_session; struct lttng_kernel_ring_buffer_ctx; @@ -49,11 +49,6 @@ enum lttng_kernel_string_encoding { NR_LTTNG_KERNEL_STRING_ENCODING, }; -enum channel_type { - PER_CPU_CHANNEL, - METADATA_CHANNEL, -}; - struct lttng_kernel_enum_value { unsigned long long value; unsigned int signedness:1; @@ -130,6 +125,7 @@ struct lttng_kernel_enum_desc { const char *name; const struct lttng_kernel_enum_entry **entries; unsigned int nr_entries; + const struct lttng_kernel_probe_desc *probe_desc; }; /* Event field description */ @@ -142,6 +138,10 @@ struct lttng_kernel_event_field { nofilter:1; /* do not consider for filter */ }; +#ifndef PARAMS +#define PARAMS(args...) args +#endif + #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 = { \ @@ -207,15 +207,20 @@ struct lttng_kernel_event_field { .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, { \ +#define lttng_kernel_static_type_struct_init(_nr_fields, _fields, _alignment) \ + { \ .parent = { \ .type = lttng_kernel_type_struct, \ }, \ .nr_fields = (_nr_fields), \ .fields = _fields, \ .alignment = (_alignment), \ - })) + } + +#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, \ + lttng_kernel_static_type_struct_init(_nr_fields, PARAMS(_fields), _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, { \ @@ -293,13 +298,18 @@ struct lttng_kernel_probe_ctx { uint8_t interruptible; }; +struct lttng_kernel_tracepoint_class { + void (*probe_callback)(void); + const struct lttng_kernel_event_field **fields; /* event payload */ + unsigned int nr_fields; + const struct lttng_kernel_probe_desc *probe_desc; +}; + 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; + const struct lttng_kernel_tracepoint_class *tp_class; struct module *owner; }; @@ -347,7 +357,7 @@ struct lttng_kernel_event_recorder { struct lttng_kernel_event_common parent; struct lttng_kernel_event_recorder_private *priv; /* Private event record interface */ - struct lttng_channel *chan; + struct lttng_kernel_channel_buffer *chan; }; struct lttng_kernel_notification_ctx { @@ -382,37 +392,32 @@ struct lttng_kernel_channel_buffer_ops { size_t len); void (*event_strcpy_from_user)(struct lttng_kernel_ring_buffer_ctx *ctx, const char __user *src, size_t len); + void (*lost_event_too_big)(struct lttng_kernel_channel_buffer *lttng_channel); }; -struct lttng_channel { - unsigned int id; - struct channel *chan; /* Channel buffers */ +enum lttng_kernel_channel_type { + LTTNG_KERNEL_CHANNEL_TYPE_BUFFER = 0, +}; + +struct lttng_kernel_channel_common_private; + +/* Use container_of() to get child. */ +struct lttng_kernel_channel_common { + struct lttng_kernel_channel_common_private *priv; /* Private channel interface. */ + + enum lttng_kernel_channel_type type; + int enabled; - struct lttng_kernel_ctx *ctx; - /* Event ID management */ struct lttng_kernel_session *session; - struct file *file; /* File associated to channel */ - unsigned int free_event_id; /* Next event ID to allocate */ - struct list_head list; /* Channel list */ +}; + +struct lttng_kernel_channel_buffer_private; + +struct lttng_kernel_channel_buffer { + struct lttng_kernel_channel_common parent; + struct lttng_kernel_channel_buffer_private *priv; + struct lttng_kernel_channel_buffer_ops *ops; - struct lttng_transport *transport; - struct hlist_head *sc_table; /* for syscall tracing */ - struct hlist_head *compat_sc_table; - struct hlist_head *sc_exit_table; /* for syscall exit tracing */ - struct hlist_head *compat_sc_exit_table; - struct hlist_head sc_unknown; /* for unknown syscalls */ - struct hlist_head sc_compat_unknown; - struct hlist_head sc_exit_unknown; - struct hlist_head compat_sc_exit_unknown; - struct lttng_syscall_filter *sc_filter; - int header_type; /* 0: unset, 1: compact, 2: large */ - enum channel_type channel_type; - int syscall_all_entry; - int syscall_all_exit; - unsigned int metadata_dumped:1, - sys_enter_registered:1, - sys_exit_registered:1, - tstate:1; /* Transient enable state */ }; #define LTTNG_DYNAMIC_LEN_STACK_SIZE 128