summaryrefslogtreecommitdiffstats
path: root/include/afb/afb-binding.h
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-08-31 14:13:54 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-08-31 14:13:54 +0200
commit7c7d610ccbd7e30204501622ebee6690aef5af0c (patch)
tree1fec77cfe24934610dd1393a957cd601ac73c260 /include/afb/afb-binding.h
parent335959621b8ffa33f66f55e0dea1c08aaea75775 (diff)
bindings: adds ability to use data of applications
The two new verbs 'afb_daemon_rootdir_get_fd' and 'afb_daemon_rootdir_open_locale' allow the bindings to retrieve its installed global data. Change-Id: I369997d9e59402a413a929aa650c48613f034183 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'include/afb/afb-binding.h')
-rw-r--r--include/afb/afb-binding.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/afb/afb-binding.h b/include/afb/afb-binding.h
index 7058b6d0..7d5da112 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);
};
/*
@@ -259,3 +261,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);
+}
+
+