aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-09-21 11:52:50 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-10-09 14:08:32 +0200
commit34fa1fb6de1c449b81b9a19fda21c2963eb57f3f (patch)
tree0240f382b01fc629146d4d6a282f50adbbb81f4b
parentbb73f5b6fb216b4badb94767558e83e60cf08fd0 (diff)
afb-trace: Use the fresh afb_eventid internals
Change-Id: Ia9c840fb768bc058e74c32028b8a4817463177e4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/afb-trace.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/afb-trace.c b/src/afb-trace.c
index 0de501a9..25fa5301 100644
--- a/src/afb-trace.c
+++ b/src/afb-trace.c
@@ -71,7 +71,7 @@ struct tag {
/* struct for events */
struct event {
struct event *next; /* link to the next event */
- struct afb_event event; /* the event */
+ struct afb_evtid *evtid; /* the event */
};
/* struct for sessions */
@@ -206,7 +206,7 @@ static void emit(void *closure, const struct afb_hookid *hookid, const char *typ
type, data1,
"data", data2);
- afb_evt_unhooked_push(hook->event->event, data);
+ afb_evt_evtid_push(hook->event->evtid, data);
}
/*******************************************************************************/
@@ -727,16 +727,16 @@ static void hook_svc_start_after(void *closure, const struct afb_hookid *hookid,
hook_svc(closure, hookid, export, "start_after", "{si}", "result", status);
}
-static void hook_svc_on_event_before(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, const char *event, int eventid, struct json_object *object)
+static void hook_svc_on_event_before(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, const char *event, int evtid, struct json_object *object)
{
hook_svc(closure, hookid, export, "on_event_before", "{ss si sO*}",
- "event", event, "id", eventid, "data", object);
+ "event", event, "id", evtid, "data", object);
}
-static void hook_svc_on_event_after(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, const char *event, int eventid, struct json_object *object)
+static void hook_svc_on_event_after(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, const char *event, int evtid, struct json_object *object)
{
hook_svc(closure, hookid, export, "on_event_after", "{ss si sO*}",
- "event", event, "id", eventid, "data", object);
+ "event", event, "id", evtid, "data", object);
}
static void hook_svc_call(void *closure, const struct afb_hookid *hookid, const struct afb_export *export, const char *api, const char *verb, struct json_object *args)
@@ -1045,7 +1045,7 @@ static void trace_cleanup(struct afb_trace *trace)
pevent = &event->next;
else {
*pevent = event->next;
- afb_event_drop(event->event);
+ afb_evt_evtid_unref(event->evtid);
free(event);
}
}
@@ -1099,14 +1099,14 @@ static struct event *trace_get_event(struct afb_trace *trace, const char *name,
/* search the event */
event = trace->events;
- while (event && strcmp(afb_event_name(event->event), name))
+ while (event && strcmp(afb_evt_evtid_name(event->evtid), name))
event = event->next;
if (!event && alloc) {
event = malloc(sizeof * event);
if (event) {
- event->event = trace->daemon->itf->event_make(trace->daemon->closure, name);
- if (afb_event_is_valid(event->event)) {
+ event->evtid = afb_evt_to_evtid(trace->daemon->itf->event_make(trace->daemon->closure, name));
+ if (event->evtid) {
event->next = trace->events;
trace->events = event;
} else {
@@ -1271,7 +1271,7 @@ static void addhook(struct desc *desc, enum trace_type type)
}
/* attach and activate the hook */
- afb_req_subscribe(desc->context->req, hook->event->event);
+ afb_req_subscribe(desc->context->req, afb_evt_from_evtid(hook->event->evtid));
trace_attach_hook(trace, hook, type);
}