Commit | Line | Data |
---|---|---|
92bc1e23 MD |
1 | /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) |
2 | * | |
3 | * lttng/events-internal.h | |
4 | * | |
5 | * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
6 | */ | |
7 | ||
8 | #ifndef _LTTNG_EVENTS_INTERNAL_H | |
9 | #define _LTTNG_EVENTS_INTERNAL_H | |
10 | ||
437d5aa5 MD |
11 | #include <lttng/events.h> |
12 | ||
a67ba386 MD |
13 | struct lttng_kernel_event_common_private { |
14 | struct lttng_kernel_event_common *pub; /* Public event interface */ | |
15 | ||
16 | const struct lttng_kernel_event_desc *desc; | |
17 | /* Backward references: list of lttng_enabler_ref (ref to enablers) */ | |
18 | struct list_head enablers_ref_head; | |
19 | int registered; /* has reg'd tracepoint probe */ | |
20 | uint64_t user_token; | |
21 | ||
22 | int has_enablers_without_filter_bytecode; | |
23 | /* list of struct lttng_kernel_bytecode_runtime, sorted by seqnum */ | |
24 | struct list_head filter_bytecode_runtime_head; | |
25 | enum lttng_kernel_abi_instrumentation instrumentation; | |
26 | /* Selected by instrumentation */ | |
27 | union { | |
28 | struct lttng_kprobe kprobe; | |
29 | struct lttng_uprobe uprobe; | |
30 | struct { | |
31 | struct lttng_krp *lttng_krp; | |
32 | char *symbol_name; | |
33 | } kretprobe; | |
34 | struct { | |
35 | enum lttng_syscall_entryexit entryexit; | |
36 | enum lttng_syscall_abi abi; | |
37 | struct hlist_node node; /* chain registered syscall event_notifier */ | |
38 | unsigned int syscall_id; | |
39 | } syscall; | |
40 | } u; | |
41 | }; | |
42 | ||
43 | struct lttng_kernel_event_recorder_private { | |
44 | struct lttng_kernel_event_common_private parent; | |
45 | ||
46 | struct lttng_kernel_event_recorder *pub; /* Public event interface */ | |
47 | struct list_head node; /* Event recorder list */ | |
48 | struct hlist_node hlist; /* Hash table of event recorders */ | |
49 | struct lttng_kernel_ctx *ctx; | |
50 | unsigned int id; | |
51 | unsigned int metadata_dumped:1; | |
52 | }; | |
53 | ||
54 | struct lttng_kernel_event_notifier_private { | |
55 | struct lttng_kernel_event_common_private parent; | |
56 | ||
57 | struct lttng_kernel_event_notifier *pub; /* Public event notifier interface */ | |
58 | struct lttng_event_notifier_group *group; /* weak ref */ | |
59 | size_t num_captures; /* Needed to allocate the msgpack array. */ | |
60 | uint64_t error_counter_index; | |
61 | struct list_head node; /* Event notifier list */ | |
62 | struct hlist_node hlist; /* Hash table of event notifiers */ | |
63 | struct list_head capture_bytecode_runtime_head; | |
64 | ||
65 | }; | |
66 | ||
437d5aa5 MD |
67 | static inline |
68 | const struct lttng_kernel_type_integer *lttng_kernel_get_type_integer(const struct lttng_kernel_type_common *type) | |
69 | { | |
70 | if (type->type != lttng_kernel_type_integer) | |
71 | return NULL; | |
72 | return container_of(type, const struct lttng_kernel_type_integer, parent); | |
73 | } | |
74 | ||
75 | static inline | |
76 | const struct lttng_kernel_type_string *lttng_kernel_get_type_string(const struct lttng_kernel_type_common *type) | |
77 | { | |
78 | if (type->type != lttng_kernel_type_string) | |
79 | return NULL; | |
80 | return container_of(type, const struct lttng_kernel_type_string, parent); | |
81 | } | |
82 | ||
83 | static inline | |
84 | const struct lttng_kernel_type_enum *lttng_kernel_get_type_enum(const struct lttng_kernel_type_common *type) | |
85 | { | |
86 | if (type->type != lttng_kernel_type_enum) | |
87 | return NULL; | |
88 | return container_of(type, const struct lttng_kernel_type_enum, parent); | |
89 | } | |
90 | ||
91 | static inline | |
92 | const struct lttng_kernel_type_array *lttng_kernel_get_type_array(const struct lttng_kernel_type_common *type) | |
93 | { | |
94 | if (type->type != lttng_kernel_type_array) | |
95 | return NULL; | |
96 | return container_of(type, const struct lttng_kernel_type_array, parent); | |
97 | } | |
98 | ||
99 | static inline | |
100 | const struct lttng_kernel_type_sequence *lttng_kernel_get_type_sequence(const struct lttng_kernel_type_common *type) | |
101 | { | |
102 | if (type->type != lttng_kernel_type_sequence) | |
103 | return NULL; | |
104 | return container_of(type, const struct lttng_kernel_type_sequence, parent); | |
105 | } | |
106 | ||
107 | static inline | |
108 | const struct lttng_kernel_type_struct *lttng_kernel_get_type_struct(const struct lttng_kernel_type_common *type) | |
109 | { | |
110 | if (type->type != lttng_kernel_type_struct) | |
111 | return NULL; | |
112 | return container_of(type, const struct lttng_kernel_type_struct, parent); | |
113 | } | |
114 | ||
115 | static inline | |
116 | const struct lttng_kernel_type_variant *lttng_kernel_get_type_variant(const struct lttng_kernel_type_common *type) | |
117 | { | |
118 | if (type->type != lttng_kernel_type_variant) | |
119 | return NULL; | |
120 | return container_of(type, const struct lttng_kernel_type_variant, parent); | |
121 | } | |
122 | ||
123 | static inline bool lttng_kernel_type_is_bytewise_integer(const struct lttng_kernel_type_common *type) | |
124 | { | |
125 | const struct lttng_kernel_type_integer *type_integer = lttng_kernel_get_type_integer(type); | |
126 | ||
127 | if (!type_integer) | |
128 | return false; | |
129 | switch (type_integer->size) { | |
130 | case 8: /* Fall-through. */ | |
131 | case 16: /* Fall-through. */ | |
132 | case 32: /* Fall-through. */ | |
133 | case 64: | |
134 | break; | |
135 | default: | |
136 | return false; | |
137 | } | |
138 | return true; | |
139 | } | |
140 | ||
92bc1e23 | 141 | #endif /* _LTTNG_EVENTS_INTERNAL_H */ |