Refactoring: add back constness of public API structures
Probes defining type, enumeration label, enumeration description,
event, and probe structures should be able to define them as "const",
because those are indeed const data which never need to be changed by
the tracer.
In order to allow struct lttng_ust_probe_desc definition to be constant,
move the "head", "lazy_init_head" and "lazy" fields to an internal
structure, "struct lttng_ust_registered_probe". It is opaque from the
point of view of the probe provider, but its pointer is now used as a
cookie between registration and unregistration. Moving the list heads
into an internal structure is an overall cleanup hiding private data
from the public API.
Use a similar scheme for registration of the context provider:
internalize the "hlist" field into an internal registration structure
(opaque from the point of view of the public API), which is now used as
a cookie between registration and unregistration.
This allows to fix an issue which was introduced by a prior refactoring
of the code dealing with contexts: the RCU update of context callbacks
was broken because the context fields were shared between the old and
the new array of contexts, thus leading to non-atomic update of the 3
callback pointers. This is fixed by making struct lttng_ust_ctx private,
and changing the array of pointers to context fields to an array of
context fields.
The functions lttng_ust_context_set_session_provider,
lttng_ust_add_app_context_to_ctx_rcu, and
lttng_ust_context_set_provider_rcu are now private.
For all contexts except the "perf" context fields, define the context
field as a static const variable rather than use memory allocation. This
means freeing the event field and type is not required anymore, and the
perf context field is handled through a destroy callback using the
private data pointer.
Move struct lttng_ust_ctx_field to an internal header. The only reason
why it was public is because the callbacks expected it as an argument.
Change the callbacks to receive a private data pointer instead to
achieve the same goal without exposing our internal structures.
The internal helpers lttng_ust_create_type_integer,
lttng_ust_create_type_array_text and lttng_ust_destroy_type are removed,
and replaced by internal macro helpers lttng_ust_static_type_integer,
lttng_ust_static_type_array_text, lttng_ust_static_event_field, and
lttng_ust_static_ctx_field, to facilitate static definitions in context
code.
Because there is no need to embed list and hlist nodes in the probe
descriptor nor the context provider, there is no need to include those
list headers from public APIs anymore.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I556e00d1d99a956b6f981dd2f5eae53589303f9d
45 files changed:
This page took 0.029048 seconds and 4 git commands to generate.