On Fri, Oct 05, 2018 at 16:49:03 +0100, Alex Bennée wrote:
(snip)
> +static int bind_to_tracepoints(GModule *g_module, GPtrArray *events)
> +{
> + int count = 0;
> + TraceEventIter iter;
> + TraceEvent *ev;
> +
> + trace_event_iter_init(&iter, "*");
> + while ((ev = trace_event_iter_next(&iter)) != NULL) {
> + const char *name = trace_event_get_name(ev);
> + gpointer fn;
> +
> + if (g_module_symbol(g_module, name, &fn)) {
> + ev->plugin = (uintptr_t) fn;
> + trace_event_set_state_dynamic(ev, true);
> + count++;
> + }
> + }
I'd rather have subscription functions exposed to the
plugins via an API, so that
- Plugins can turn on and off subscriptions to callbacks
as they see fit, instead of "being called from
the very beginning, and then disable forever"
- We can have compile-time failures when doing something
wrong with callback names :-)
Thanks,
E.