From: Mathieu Desnoyers Date: Mon, 3 May 2021 14:39:32 +0000 (-0400) Subject: Move enabler APIs to internal header X-Git-Tag: v2.13.0-rc2~53 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=255a028a9c5879585331266633934835c1476d5f;p=lttng-modules.git Move enabler APIs to internal header Signed-off-by: Mathieu Desnoyers Change-Id: Idd0eee625ab10b17a412a6d0d777d64f71801582 --- diff --git a/include/lttng/events-internal.h b/include/lttng/events-internal.h index df70273a..a0d4fbc0 100644 --- a/include/lttng/events-internal.h +++ b/include/lttng/events-internal.h @@ -10,6 +10,19 @@ #include +enum lttng_enabler_format_type { + LTTNG_ENABLER_FORMAT_STAR_GLOB, + LTTNG_ENABLER_FORMAT_NAME, +}; + +/* + * Objects in a linked-list of enablers, owned by an event. + */ +struct lttng_enabler_ref { + struct list_head node; /* enabler ref list */ + struct lttng_enabler *ref; /* backward ref */ +}; + struct lttng_kernel_event_common_private { struct lttng_kernel_event_common *pub; /* Public event interface */ @@ -462,7 +475,123 @@ int lttng_cpuhp_perf_counter_dead(unsigned int cpu, } #endif +struct lttng_event_enabler *lttng_event_enabler_create( + enum lttng_enabler_format_type format_type, + struct lttng_kernel_abi_event *event_param, + struct lttng_channel *chan); + +int lttng_event_enabler_enable(struct lttng_event_enabler *event_enabler); +int lttng_event_enabler_disable(struct lttng_event_enabler *event_enabler); +struct lttng_event_notifier_enabler *lttng_event_notifier_enabler_create( + struct lttng_event_notifier_group *event_notifier_group, + enum lttng_enabler_format_type format_type, + struct lttng_kernel_abi_event_notifier *event_notifier_param); + +int lttng_event_notifier_enabler_enable( + struct lttng_event_notifier_enabler *event_notifier_enabler); +int lttng_event_notifier_enabler_disable( + struct lttng_event_notifier_enabler *event_notifier_enabler); + +int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler *event_enabler, + struct lttng_kernel_abi_filter_bytecode __user *bytecode); +int lttng_event_notifier_enabler_attach_filter_bytecode( + struct lttng_event_notifier_enabler *event_notifier_enabler, + struct lttng_kernel_abi_filter_bytecode __user *bytecode); +int lttng_event_notifier_enabler_attach_capture_bytecode( + struct lttng_event_notifier_enabler *event_notifier_enabler, + struct lttng_kernel_abi_capture_bytecode __user *bytecode); + +int lttng_desc_match_enabler(const struct lttng_kernel_event_desc *desc, + struct lttng_enabler *enabler); + +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); + +#if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS) +int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler); +int lttng_syscalls_unregister_channel(struct lttng_channel *chan); +int lttng_syscalls_destroy_event(struct lttng_channel *chan); +int lttng_syscall_filter_enable_event( + struct lttng_channel *chan, + struct lttng_kernel_event_recorder *event); +int lttng_syscall_filter_disable_event( + struct lttng_channel *chan, + struct lttng_kernel_event_recorder *event); + +long lttng_channel_syscall_mask(struct lttng_channel *channel, + struct lttng_kernel_abi_syscall_mask __user *usyscall_mask); + +int lttng_syscalls_register_event_notifier( + struct lttng_event_notifier_enabler *event_notifier_enabler); +int lttng_syscalls_create_matching_event_notifiers( + struct lttng_event_notifier_enabler *event_notifier_enabler); +int lttng_syscalls_unregister_event_notifier_group(struct lttng_event_notifier_group *group); +int lttng_syscall_filter_enable_event_notifier(struct lttng_kernel_event_notifier *event_notifier); +int lttng_syscall_filter_disable_event_notifier(struct lttng_kernel_event_notifier *event_notifier); +#else +static inline int lttng_syscalls_register_event( + struct lttng_event_enabler *event_enabler) +{ + return -ENOSYS; +} + +static inline int lttng_syscalls_unregister_channel(struct lttng_channel *chan) +{ + return 0; +} + +static inline int lttng_syscalls_destroy(struct lttng_channel *chan) +{ + return 0; +} + +static inline int lttng_syscall_filter_enable_event(struct lttng_channel *chan, + struct lttng_kernel_event_recorder *event); +{ + return -ENOSYS; +} + +static inline int lttng_syscall_filter_disable_event(struct lttng_channel *chan, + struct lttng_kernel_event_recorder *event); +{ + return -ENOSYS; +} + +static inline long lttng_channel_syscall_mask(struct lttng_channel *channel, + struct lttng_kernel_syscall_mask __user *usyscall_mask) +{ + return -ENOSYS; +} + +static inline int lttng_syscalls_register_event_notifier( + struct lttng_event_notifier_group *group) +{ + return -ENOSYS; +} + +static inline int lttng_syscalls_unregister_event_notifier_group( + struct lttng_event_notifier_group *group) +{ + return 0; +} + +static inline int lttng_syscall_filter_enable_event_notifier( + struct lttng_event_notifier_group *group, + const char *name) +{ + return -ENOSYS; +} + +static inline int lttng_syscall_filter_disable_event_notifier( + struct lttng_event_notifier_group *group, + const char *name) +{ + return -ENOSYS; +} +#endif #define lttng_kernel_static_ctx_field(_event_field, _get_size, _record, _get_value, _destroy, _priv) \ __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_ctx_field, { \ diff --git a/include/lttng/events.h b/include/lttng/events.h index 74e5f1bc..66c76d98 100644 --- a/include/lttng/events.h +++ b/include/lttng/events.h @@ -318,14 +318,6 @@ struct lttng_kernel_probe_desc { struct lttng_krp; /* Kretprobe handling */ -/* - * Objects in a linked-list of enablers, owned by an event. - */ -struct lttng_enabler_ref { - struct list_head node; /* enabler ref list */ - struct lttng_enabler *ref; /* backward ref */ -}; - struct lttng_uprobe_handler { struct lttng_kernel_event_common *event; loff_t offset; @@ -408,11 +400,6 @@ struct lttng_kernel_event_notifier { struct lttng_kernel_notification_ctx *notif_ctx); }; -enum lttng_enabler_format_type { - LTTNG_ENABLER_FORMAT_STAR_GLOB, - LTTNG_ENABLER_FORMAT_NAME, -}; - struct lttng_channel_ops { struct channel *(*channel_create)(const char *name, void *priv, @@ -701,22 +688,6 @@ void lttng_unlock_sessions(void); struct list_head *lttng_get_probe_list_head(void); -struct lttng_event_enabler *lttng_event_enabler_create( - enum lttng_enabler_format_type format_type, - struct lttng_kernel_abi_event *event_param, - struct lttng_channel *chan); - -int lttng_event_enabler_enable(struct lttng_event_enabler *event_enabler); -int lttng_event_enabler_disable(struct lttng_event_enabler *event_enabler); -struct lttng_event_notifier_enabler *lttng_event_notifier_enabler_create( - struct lttng_event_notifier_group *event_notifier_group, - enum lttng_enabler_format_type format_type, - struct lttng_kernel_abi_event_notifier *event_notifier_param); - -int lttng_event_notifier_enabler_enable( - struct lttng_event_notifier_enabler *event_notifier_enabler); -int lttng_event_notifier_enabler_disable( - struct lttng_event_notifier_enabler *event_notifier_enabler); int lttng_fix_pending_events(void); int lttng_fix_pending_event_notifiers(void); int lttng_session_active(void); @@ -836,106 +807,6 @@ int lttng_session_list_tracker_ids(struct lttng_session *session, void lttng_clock_ref(void); void lttng_clock_unref(void); -int lttng_desc_match_enabler(const struct lttng_kernel_event_desc *desc, - struct lttng_enabler *enabler); - -#if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS) -int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler); -int lttng_syscalls_unregister_channel(struct lttng_channel *chan); -int lttng_syscalls_destroy_event(struct lttng_channel *chan); -int lttng_syscall_filter_enable_event( - struct lttng_channel *chan, - struct lttng_kernel_event_recorder *event); -int lttng_syscall_filter_disable_event( - struct lttng_channel *chan, - struct lttng_kernel_event_recorder *event); - -long lttng_channel_syscall_mask(struct lttng_channel *channel, - struct lttng_kernel_abi_syscall_mask __user *usyscall_mask); - -int lttng_syscalls_register_event_notifier( - struct lttng_event_notifier_enabler *event_notifier_enabler); -int lttng_syscalls_create_matching_event_notifiers( - struct lttng_event_notifier_enabler *event_notifier_enabler); -int lttng_syscalls_unregister_event_notifier_group(struct lttng_event_notifier_group *group); -int lttng_syscall_filter_enable_event_notifier(struct lttng_kernel_event_notifier *event_notifier); -int lttng_syscall_filter_disable_event_notifier(struct lttng_kernel_event_notifier *event_notifier); -#else -static inline int lttng_syscalls_register_event( - struct lttng_event_enabler *event_enabler) -{ - return -ENOSYS; -} - -static inline int lttng_syscalls_unregister_channel(struct lttng_channel *chan) -{ - return 0; -} - -static inline int lttng_syscalls_destroy(struct lttng_channel *chan) -{ - return 0; -} - -static inline int lttng_syscall_filter_enable_event(struct lttng_channel *chan, - struct lttng_kernel_event_recorder *event); -{ - return -ENOSYS; -} - -static inline int lttng_syscall_filter_disable_event(struct lttng_channel *chan, - struct lttng_kernel_event_recorder *event); -{ - return -ENOSYS; -} - -static inline long lttng_channel_syscall_mask(struct lttng_channel *channel, - struct lttng_kernel_syscall_mask __user *usyscall_mask) -{ - return -ENOSYS; -} - -static inline int lttng_syscalls_register_event_notifier( - struct lttng_event_notifier_group *group) -{ - return -ENOSYS; -} - -static inline int lttng_syscalls_unregister_event_notifier_group( - struct lttng_event_notifier_group *group) -{ - return 0; -} - -static inline int lttng_syscall_filter_enable_event_notifier( - struct lttng_event_notifier_group *group, - const char *name) -{ - return -ENOSYS; -} - -static inline int lttng_syscall_filter_disable_event_notifier( - struct lttng_event_notifier_group *group, - const char *name) -{ - return -ENOSYS; -} - -#endif - -int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler *event_enabler, - struct lttng_kernel_abi_filter_bytecode __user *bytecode); -int lttng_event_notifier_enabler_attach_filter_bytecode( - struct lttng_event_notifier_enabler *event_notifier_enabler, - struct lttng_kernel_abi_filter_bytecode __user *bytecode); -int lttng_event_notifier_enabler_attach_capture_bytecode( - struct lttng_event_notifier_enabler *event_notifier_enabler, - struct lttng_kernel_abi_capture_bytecode __user *bytecode); - -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_kernel_event_common *event); int lttng_probes_init(void);