X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-export.c;h=840bd9190331dc8a1f96289ed252c678eba23bad;hb=66df82496e8b5cf0e49e8fe4ddd57827bbd0e3c5;hp=19aab0cebff803d3df611dd5b97d74f73106665b;hpb=7682c2aacb3efd6abed3dee43f8a03d7646d8153;p=src%2Fapp-framework-binder.git diff --git a/src/afb-export.c b/src/afb-export.c index 19aab0ce..840bd919 100644 --- a/src/afb-export.c +++ b/src/afb-export.c @@ -153,8 +153,6 @@ static void old_vverbose_cb(void *closure, int level, const char *file, int line static struct afb_eventid *eventid_make_cb(void *closure, const char *name) { - size_t plen, nlen; - char *event; struct afb_export *export = closure; /* check daemon state */ @@ -164,22 +162,14 @@ static struct afb_eventid *eventid_make_cb(void *closure, const char *name) return NULL; } - /* makes the event name */ - plen = strlen(export->apiname); - nlen = strlen(name); - event = alloca(nlen + plen + 2); - memcpy(event, export->apiname, plen); - event[plen] = '/'; - memcpy(event + plen + 1, name, nlen + 1); - /* create the event */ - return afb_evt_eventid_create(event); + return afb_evt_eventid_create2(export->apiname, name); } static struct afb_event event_make_cb(void *closure, const char *name) { struct afb_eventid *eventid = eventid_make_cb(closure, name); - return (struct afb_event){ .itf = eventid ? eventid->itf : NULL, .closure = eventid }; + return afb_evt_event_from_evtid(afb_evt_eventid_to_evtid(eventid)); } static int event_broadcast_cb(void *closure, const char *name, struct json_object *object) @@ -241,7 +231,7 @@ static int rename_api_cb(void *closure, const char *name) errno = EINVAL; return -1; } - if (!afb_api_is_valid_name(name)) { + if (!afb_api_is_valid_name(name, 1)) { ERROR("[API %s] Can't rename to %s: bad API name", export->apiname, name); errno = EINVAL; return -1; @@ -255,11 +245,12 @@ static int api_new_api_cb( void *closure, const char *api, const char *info, + int noconcurrency, int (*preinit)(void*, struct afb_dynapi *), void *preinit_closure) { struct afb_export *export = closure; - return afb_api_dyn_add(export->apiset, api, info, preinit, preinit_closure); + return afb_api_dyn_add(export->apiset, api, info, noconcurrency, preinit, preinit_closure); } /********************************************** @@ -376,11 +367,12 @@ static int hooked_api_new_api_cb( void *closure, const char *api, const char *info, + int noconcurrency, int (*preinit)(void*, struct afb_dynapi *), void *preinit_closure) { /* TODO */ - return api_new_api_cb(closure, api, info, preinit, preinit_closure); + return api_new_api_cb(closure, api, info, noconcurrency, preinit, preinit_closure); } /********************************************** * vectors @@ -1070,7 +1062,7 @@ static struct afb_export *create(struct afb_apiset *apiset, const char *apiname, /* session shared with other exports */ if (common_session == NULL) { - common_session = afb_session_create (NULL, 0); + common_session = afb_session_create (0); if (common_session == NULL) return NULL; } @@ -1179,7 +1171,7 @@ struct afb_binding_interface_v1 *afb_export_get_interface_v1(struct afb_export * int afb_export_unshare_session(struct afb_export *export) { if (export->session == common_session) { - export->session = afb_session_create (NULL, 0); + export->session = afb_session_create (0); if (export->session) afb_session_unref(common_session); else {