X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-hook.c;h=2f101bf51ddff94698e2660d6053866c8ed277f8;hb=5e0e2b32c2d97b12280026841489ee8057854689;hp=6a11341c2aa6bca005707ee32fa328ff96beb76b;hpb=6a325d7f101c986e7329ef912c0458719f95c096;p=src%2Fapp-framework-binder.git diff --git a/src/afb-hook.c b/src/afb-hook.c index 6a11341c..2f101bf5 100644 --- a/src/afb-hook.c +++ b/src/afb-hook.c @@ -27,7 +27,7 @@ #include -#include +#include #include #include "afb-context.h" @@ -271,6 +271,16 @@ static void hook_xreq_vverbose_default_cb(void * closure, const struct afb_xreq } } +static void hook_xreq_store_default_cb(void * closure, const struct afb_xreq *xreq, struct afb_stored_req *sreq) +{ + _hook_xreq_(xreq, "store() -> %p", sreq); +} + +static void hook_xreq_unstore_default_cb(void * closure, const struct afb_xreq *xreq) +{ + _hook_xreq_(xreq, "unstore()"); +} + static struct afb_hook_xreq_itf hook_xreq_default_itf = { .hook_xreq_begin = hook_xreq_begin_default_cb, .hook_xreq_end = hook_xreq_end_default_cb, @@ -290,7 +300,9 @@ static struct afb_hook_xreq_itf hook_xreq_default_itf = { .hook_xreq_subcall_result = hook_xreq_subcall_result_default_cb, .hook_xreq_subcallsync = hook_xreq_subcallsync_default_cb, .hook_xreq_subcallsync_result = hook_xreq_subcallsync_result_default_cb, - .hook_xreq_vverbose = hook_xreq_vverbose_default_cb + .hook_xreq_vverbose = hook_xreq_vverbose_default_cb, + .hook_xreq_store = hook_xreq_store_default_cb, + .hook_xreq_unstore = hook_xreq_unstore_default_cb }; /****************************************************************************** @@ -416,6 +428,16 @@ void afb_hook_xreq_vverbose(const struct afb_xreq *xreq, int level, const char * _HOOK_XREQ_(vverbose, xreq, level, file ?: "?", line, func ?: "?", fmt, args); } +void afb_hook_xreq_store(const struct afb_xreq *xreq, struct afb_stored_req *sreq) +{ + _HOOK_XREQ_(store, xreq, sreq); +} + +void afb_hook_xreq_unstore(const struct afb_xreq *xreq) +{ + _HOOK_XREQ_(unstore, xreq); +} + /****************************************************************************** * section: hooking xreqs *****************************************************************************/ @@ -615,11 +637,26 @@ static void hook_ditf_rootdir_open_locale_cb(void *closure, const struct afb_dit } } -static void hook_ditf_queue_job(void *closure, const struct afb_ditf *ditf, void (*callback)(int signum, void *arg), void *argument, void *group, int timeout, int result) +static void hook_ditf_queue_job_cb(void *closure, const struct afb_ditf *ditf, void (*callback)(int signum, void *arg), void *argument, void *group, int timeout, int result) { _hook_ditf_(ditf, "queue_job(%p, %p, %p, %d) -> %d", callback, argument, group, timeout, result); } +static void hook_ditf_unstore_req_cb(void * closure, const struct afb_ditf *ditf, struct afb_stored_req *sreq) +{ + _hook_ditf_(ditf, "unstore_req(%p)", sreq); +} + +static void hook_ditf_require_api_cb(void *closure, const struct afb_ditf *ditf, const char *name, int initialized) +{ + _hook_ditf_(ditf, "require_api(%s, %d)...", name, initialized); +} + +static void hook_ditf_require_api_result_cb(void *closure, const struct afb_ditf *ditf, const char *name, int initialized, int result) +{ + _hook_ditf_(ditf, "...require_api(%s, %d) -> %d", name, initialized, result); +} + static struct afb_hook_ditf_itf hook_ditf_default_itf = { .hook_ditf_event_broadcast_before = hook_ditf_event_broadcast_before_cb, .hook_ditf_event_broadcast_after = hook_ditf_event_broadcast_after_cb, @@ -630,7 +667,10 @@ static struct afb_hook_ditf_itf hook_ditf_default_itf = { .hook_ditf_event_make = hook_ditf_event_make_cb, .hook_ditf_rootdir_get_fd = hook_ditf_rootdir_get_fd_cb, .hook_ditf_rootdir_open_locale = hook_ditf_rootdir_open_locale_cb, - .hook_ditf_queue_job = hook_ditf_queue_job + .hook_ditf_queue_job = hook_ditf_queue_job_cb, + .hook_ditf_unstore_req = hook_ditf_unstore_req_cb, + .hook_ditf_require_api = hook_ditf_require_api_cb, + .hook_ditf_require_api_result = hook_ditf_require_api_result_cb }; /****************************************************************************** @@ -709,6 +749,22 @@ int afb_hook_ditf_queue_job(const struct afb_ditf *ditf, void (*callback)(int si return result; } +void afb_hook_ditf_unstore_req(const struct afb_ditf *ditf, struct afb_stored_req *sreq) +{ + _HOOK_DITF_(unstore_req, ditf, sreq); +} + +void afb_hook_ditf_require_api(const struct afb_ditf *ditf, const char *name, int initialized) +{ + _HOOK_DITF_(require_api, ditf, name, initialized); +} + +int afb_hook_ditf_require_api_result(const struct afb_ditf *ditf, const char *name, int initialized, int result) +{ + _HOOK_DITF_(require_api_result, ditf, name, initialized, result); + return result; +} + /****************************************************************************** * section: hooking ditf *****************************************************************************/