Code Review
/
src
/
app-framework-binder.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
afb-config: Add traceses for tracing sessions
[src/app-framework-binder.git]
/
src
/
afb-export.c
diff --git
a/src/afb-export.c
b/src/afb-export.c
index
7fd475a
..
b932183
100644
(file)
--- a/
src/afb-export.c
+++ b/
src/afb-export.c
@@
-30,6
+30,7
@@
#include "afb-apiset.h"
#include "afb-api-dyn.h"
#include "afb-common.h"
#include "afb-apiset.h"
#include "afb-api-dyn.h"
#include "afb-common.h"
+#include "afb-systemd.h"
#include "afb-cred.h"
#include "afb-evt.h"
#include "afb-export.h"
#include "afb-cred.h"
#include "afb-evt.h"
#include "afb-export.h"
@@
-153,8
+154,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)
{
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 */
struct afb_export *export = closure;
/* check daemon state */
@@
-164,22
+163,14
@@
static struct afb_eventid *eventid_make_cb(void *closure, const char *name)
return NULL;
}
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 */
/* create the event */
- return afb_evt_
create_event(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);
}
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)
}
static int event_broadcast_cb(void *closure, const char *name, struct json_object *object)
@@
-241,7
+232,7
@@
static int rename_api_cb(void *closure, const char *name)
errno = EINVAL;
return -1;
}
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;
ERROR("[API %s] Can't rename to %s: bad API name", export->apiname, name);
errno = EINVAL;
return -1;
@@
-255,11
+246,12
@@
static int api_new_api_cb(
void *closure,
const char *api,
const char *info,
void *closure,
const char *api,
const char *info,
+ int noconcurrency,
int (*preinit)(void*, struct afb_dynapi *),
void *preinit_closure)
{
struct afb_export *export = closure;
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);
}
/**********************************************
}
/**********************************************
@@
-309,21
+301,21
@@
static int hooked_event_broadcast_cb(void *closure, const char *name, struct jso
static struct sd_event *hooked_get_event_loop(void *closure)
{
struct afb_export *export = closure;
static struct sd_event *hooked_get_event_loop(void *closure)
{
struct afb_export *export = closure;
- struct sd_event *r = afb_
common
_get_event_loop();
+ struct sd_event *r = afb_
systemd
_get_event_loop();
return afb_hook_ditf_get_event_loop(export, r);
}
static struct sd_bus *hooked_get_user_bus(void *closure)
{
struct afb_export *export = closure;
return afb_hook_ditf_get_event_loop(export, r);
}
static struct sd_bus *hooked_get_user_bus(void *closure)
{
struct afb_export *export = closure;
- struct sd_bus *r = afb_
common
_get_user_bus();
+ struct sd_bus *r = afb_
systemd
_get_user_bus();
return afb_hook_ditf_get_user_bus(export, r);
}
static struct sd_bus *hooked_get_system_bus(void *closure)
{
struct afb_export *export = closure;
return afb_hook_ditf_get_user_bus(export, r);
}
static struct sd_bus *hooked_get_system_bus(void *closure)
{
struct afb_export *export = closure;
- struct sd_bus *r = afb_
common
_get_system_bus();
+ struct sd_bus *r = afb_
systemd
_get_system_bus();
return afb_hook_ditf_get_system_bus(export, r);
}
return afb_hook_ditf_get_system_bus(export, r);
}
@@
-376,11
+368,12
@@
static int hooked_api_new_api_cb(
void *closure,
const char *api,
const char *info,
void *closure,
const char *api,
const char *info,
+ int noconcurrency,
int (*preinit)(void*, struct afb_dynapi *),
void *preinit_closure)
{
/* TODO */
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
}
/**********************************************
* vectors
@@
-390,9
+383,9
@@
static const struct afb_daemon_itf daemon_itf = {
.vverbose_v2 = vverbose_cb,
.event_make = event_make_cb,
.event_broadcast = event_broadcast_cb,
.vverbose_v2 = vverbose_cb,
.event_make = event_make_cb,
.event_broadcast = event_broadcast_cb,
- .get_event_loop = afb_
common
_get_event_loop,
- .get_user_bus = afb_
common
_get_user_bus,
- .get_system_bus = afb_
common
_get_system_bus,
+ .get_event_loop = afb_
systemd
_get_event_loop,
+ .get_user_bus = afb_
systemd
_get_user_bus,
+ .get_system_bus = afb_
systemd
_get_system_bus,
.rootdir_get_fd = afb_common_rootdir_get_fd,
.rootdir_open_locale = rootdir_open_locale_cb,
.queue_job = queue_job_cb,
.rootdir_get_fd = afb_common_rootdir_get_fd,
.rootdir_open_locale = rootdir_open_locale_cb,
.queue_job = queue_job_cb,
@@
-948,9
+941,9
@@
static const struct afb_dynapi_itf dynapi_itf = {
.vverbose = (void*)vverbose_cb,
.vverbose = (void*)vverbose_cb,
- .get_event_loop = afb_
common
_get_event_loop,
- .get_user_bus = afb_
common
_get_user_bus,
- .get_system_bus = afb_
common
_get_system_bus,
+ .get_event_loop = afb_
systemd
_get_event_loop,
+ .get_user_bus = afb_
systemd
_get_user_bus,
+ .get_system_bus = afb_
systemd
_get_system_bus,
.rootdir_get_fd = afb_common_rootdir_get_fd,
.rootdir_open_locale = rootdir_open_locale_cb,
.queue_job = queue_job_cb,
.rootdir_get_fd = afb_common_rootdir_get_fd,
.rootdir_open_locale = rootdir_open_locale_cb,
.queue_job = queue_job_cb,
@@
-1070,7
+1063,7
@@
static struct afb_export *create(struct afb_apiset *apiset, const char *apiname,
/* session shared with other exports */
if (common_session == NULL) {
/* 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;
}
if (common_session == NULL)
return NULL;
}
@@
-1179,7
+1172,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) {
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 {
if (export->session)
afb_session_unref(common_session);
else {