X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=include%2Fafb%2Fafb-binding.h;h=43075df1c6502a64403621dc78f497ee1f5a8cdb;hb=3066dda4e4e4be70335ca2dfbc74a20f4ff0dede;hp=1705271df6f8b06dfe400ca2c1e6b7f99d68848c;hpb=1d0f869ce3379089b4f4c5285e3d30e971e5b93d;p=src%2Fapp-framework-binder.git diff --git a/include/afb/afb-binding.h b/include/afb/afb-binding.h index 1705271d..43075df1 100644 --- a/include/afb/afb-binding.h +++ b/include/afb/afb-binding.h @@ -147,6 +147,8 @@ struct afb_daemon_itf { struct sd_bus *(*get_system_bus)(void *closure); /* gets the common systemd's system d-bus */ void (*vverbose)(void*closure, int level, const char *file, int line, const char *fmt, va_list args); struct afb_event (*event_make)(void *closure, const char *name); /* creates an event of 'name' */ + int (*rootdir_get_fd)(void *closure); + int (*rootdir_open_locale)(void *closure, const char *filename, int flags, const char *locale); }; /* @@ -170,6 +172,23 @@ struct afb_binding_interface /* * Function for registering the binding + * + * A binding V1 MUST have a function of this name and signature. + * This function is called during loading of the binding. It + * receives an 'interface' that should be recorded for later access to + * functions provided by the framework. + * + * This function MUST return the address of a structure that describes + * the binding and its implemented verbs. + * + * In case of initialisation error, NULL must be returned. + * + * Be aware that the given 'interface' is not fully functionnal + * because no provision is given to the name and description + * of the binding. Check the function 'afbBindingV1ServiceInit' + * defined in the file because when + * the function 'afbBindingV1ServiceInit' is called, the 'interface' + * is fully functionnal. */ extern const struct afb_binding *afbBindingV1Register (const struct afb_binding_interface *interface); @@ -236,7 +255,7 @@ static inline void afb_daemon_verbose(struct afb_daemon daemon, int level, const { va_list args; va_start(args, fmt); - return daemon.itf->vverbose(daemon.closure, level, file, line, fmt, args); + daemon.itf->vverbose(daemon.closure, level, file, line, fmt, args); va_end(args); } @@ -259,3 +278,23 @@ static inline void afb_daemon_verbose(struct afb_daemon daemon, int level, const # endif #endif +/* + * Get the root directory file descriptor. This file descriptor can + * be used with functions 'openat', 'fstatat', ... + */ +static inline int afb_daemon_rootdir_get_fd(struct afb_daemon daemon) +{ + return daemon.itf->rootdir_get_fd(daemon.closure); +} + +/* + * Opens 'filename' within the root directory with 'flags' (see function openat) + * using the 'locale' definition (example: "jp,en-US") that can be NULL. + * Returns the file descriptor or -1 in case of error. + */ +static inline int afb_daemon_rootdir_open_locale(struct afb_daemon daemon, const char *filename, int flags, const char *locale) +{ + return daemon.itf->rootdir_open_locale(daemon.closure, filename, flags, locale); +} + +