From: Mathieu Desnoyers Date: Mon, 3 May 2021 15:30:52 +0000 (-0400) Subject: Move event notifier and counter structures to private header X-Git-Tag: v2.13.0-rc2~44 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=e71f3cec81f72b5f575e2951b631ea2c09333f7a;p=lttng-modules.git Move event notifier and counter structures to private header Signed-off-by: Mathieu Desnoyers Change-Id: I119a948c39edbe42e22a12d59e8908029d6acad0 --- diff --git a/include/lttng/events-internal.h b/include/lttng/events-internal.h index 6b418977..097f5e97 100644 --- a/include/lttng/events-internal.h +++ b/include/lttng/events-internal.h @@ -295,6 +295,87 @@ struct lttng_kernel_channel_buffer_ops_private { uint64_t *id); }; +struct lttng_counter_ops { + struct lib_counter *(*counter_create)(size_t nr_dimensions, + const size_t *max_nr_elem, /* for each dimension */ + int64_t global_sum_step); + void (*counter_destroy)(struct lib_counter *counter); + int (*counter_add)(struct lib_counter *counter, const size_t *dimension_indexes, + int64_t v); + /* + * counter_read reads a specific cpu's counter if @cpu >= 0, or + * the global aggregation counter if @cpu == -1. + */ + int (*counter_read)(struct lib_counter *counter, const size_t *dimension_indexes, int cpu, + int64_t *value, bool *overflow, bool *underflow); + /* + * counter_aggregate returns the total sum of all per-cpu counters and + * the global aggregation counter. + */ + int (*counter_aggregate)(struct lib_counter *counter, const size_t *dimension_indexes, + int64_t *value, bool *overflow, bool *underflow); + int (*counter_clear)(struct lib_counter *counter, const size_t *dimension_indexes); +}; + +struct lttng_counter { + struct file *file; /* File associated to counter. */ + struct file *owner; + struct lttng_counter_transport *transport; + struct lib_counter *counter; + struct lttng_counter_ops *ops; +}; + +struct lttng_event_notifier_group { + struct file *file; /* File associated to event notifier group */ + struct file *notif_file; /* File used to expose notifications to userspace. */ + struct list_head node; /* event notifier group list */ + 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_kernel_channel_buffer_ops *ops; + struct lttng_transport *transport; + struct channel *chan; /* Ring buffer channel for event notifier group. */ + struct lib_ring_buffer *buf; /* Ring buffer for event notifier group. */ + wait_queue_head_t read_wait; + struct irq_work wakeup_pending; /* Pending wakeup irq work. */ + struct lttng_kernel_event_notifier *sc_unknown; /* for unknown syscalls */ + struct lttng_kernel_event_notifier *sc_compat_unknown; + + struct lttng_syscall_filter *sc_filter; + + struct hlist_head *event_notifier_syscall_dispatch; + struct hlist_head *event_notifier_compat_syscall_dispatch; + struct hlist_head *event_notifier_exit_syscall_dispatch; + struct hlist_head *event_notifier_exit_compat_syscall_dispatch; + + struct hlist_head event_notifier_unknown_syscall_dispatch; + struct hlist_head event_notifier_compat_unknown_syscall_dispatch; + struct hlist_head event_notifier_exit_unknown_syscall_dispatch; + struct hlist_head event_notifier_exit_compat_unknown_syscall_dispatch; + + int syscall_all_entry; + int syscall_all_exit; + + unsigned int sys_enter_registered:1, sys_exit_registered:1; + + struct lttng_counter *error_counter; + size_t error_counter_len; +}; + +struct lttng_transport { + char *name; + struct module *owner; + struct list_head node; + struct lttng_kernel_channel_buffer_ops ops; +}; + +struct lttng_counter_transport { + char *name; + struct module *owner; + struct list_head node; + struct lttng_counter_ops ops; +}; + extern struct lttng_kernel_ctx *lttng_static_ctx; static inline diff --git a/include/lttng/events.h b/include/lttng/events.h index f852676b..16dc08d8 100644 --- a/include/lttng/events.h +++ b/include/lttng/events.h @@ -388,42 +388,6 @@ struct lttng_kernel_channel_buffer_ops { const char __user *src, size_t len); }; -struct lttng_counter_ops { - struct lib_counter *(*counter_create)(size_t nr_dimensions, - const size_t *max_nr_elem, /* for each dimension */ - int64_t global_sum_step); - void (*counter_destroy)(struct lib_counter *counter); - int (*counter_add)(struct lib_counter *counter, const size_t *dimension_indexes, - int64_t v); - /* - * counter_read reads a specific cpu's counter if @cpu >= 0, or - * the global aggregation counter if @cpu == -1. - */ - int (*counter_read)(struct lib_counter *counter, const size_t *dimension_indexes, int cpu, - int64_t *value, bool *overflow, bool *underflow); - /* - * counter_aggregate returns the total sum of all per-cpu counters and - * the global aggregation counter. - */ - int (*counter_aggregate)(struct lib_counter *counter, const size_t *dimension_indexes, - int64_t *value, bool *overflow, bool *underflow); - int (*counter_clear)(struct lib_counter *counter, const size_t *dimension_indexes); -}; - -struct lttng_transport { - char *name; - struct module *owner; - struct list_head node; - struct lttng_kernel_channel_buffer_ops ops; -}; - -struct lttng_counter_transport { - char *name; - struct module *owner; - struct list_head node; - struct lttng_counter_ops ops; -}; - struct lttng_syscall_filter; #define LTTNG_EVENT_HT_BITS 12 @@ -552,51 +516,6 @@ struct lttng_session { char creation_time[LTTNG_KERNEL_ABI_SESSION_CREATION_TIME_ISO8601_LEN]; }; -struct lttng_counter { - struct file *file; /* File associated to counter. */ - struct file *owner; - struct lttng_counter_transport *transport; - struct lib_counter *counter; - struct lttng_counter_ops *ops; -}; - -struct lttng_event_notifier_group { - struct file *file; /* File associated to event notifier group */ - struct file *notif_file; /* File used to expose notifications to userspace. */ - struct list_head node; /* event notifier group list */ - 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_kernel_channel_buffer_ops *ops; - struct lttng_transport *transport; - struct channel *chan; /* Ring buffer channel for event notifier group. */ - struct lib_ring_buffer *buf; /* Ring buffer for event notifier group. */ - wait_queue_head_t read_wait; - struct irq_work wakeup_pending; /* Pending wakeup irq work. */ - struct lttng_kernel_event_notifier *sc_unknown; /* for unknown syscalls */ - struct lttng_kernel_event_notifier *sc_compat_unknown; - - struct lttng_syscall_filter *sc_filter; - - struct hlist_head *event_notifier_syscall_dispatch; - struct hlist_head *event_notifier_compat_syscall_dispatch; - struct hlist_head *event_notifier_exit_syscall_dispatch; - struct hlist_head *event_notifier_exit_compat_syscall_dispatch; - - struct hlist_head event_notifier_unknown_syscall_dispatch; - struct hlist_head event_notifier_compat_unknown_syscall_dispatch; - struct hlist_head event_notifier_exit_unknown_syscall_dispatch; - struct hlist_head event_notifier_exit_compat_unknown_syscall_dispatch; - - int syscall_all_entry; - int syscall_all_exit; - - unsigned int sys_enter_registered:1, sys_exit_registered:1; - - struct lttng_counter *error_counter; - size_t error_counter_len; -}; - int lttng_kernel_probe_register(struct lttng_kernel_probe_desc *desc); void lttng_kernel_probe_unregister(struct lttng_kernel_probe_desc *desc);