From 7760171904ef007f19e8f46aa240a00e382d5b74 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 27 Oct 2015 14:58:05 +0100 Subject: util-lib: move inotify-related definitions to fs-util.[ch] --- src/basic/fs-util.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/basic/fs-util.h') diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h index 0e1906ba3f..b94873e65b 100644 --- a/src/basic/fs-util.h +++ b/src/basic/fs-util.h @@ -21,9 +21,11 @@ along with systemd; If not, see . ***/ -#include #include +#include +#include #include +#include #include "time-util.h" @@ -58,3 +60,15 @@ int mknod_atomic(const char *path, mode_t mode, dev_t dev); int mkfifo_atomic(const char *path, mode_t mode); int get_files_in_directory(const char *path, char ***list); + +#define INOTIFY_EVENT_MAX (sizeof(struct inotify_event) + NAME_MAX + 1) + +#define FOREACH_INOTIFY_EVENT(e, buffer, sz) \ + for ((e) = &buffer.ev; \ + (uint8_t*) (e) < (uint8_t*) (buffer.raw) + (sz); \ + (e) = (struct inotify_event*) ((uint8_t*) (e) + sizeof(struct inotify_event) + (e)->len)) + +union inotify_event_buffer { + struct inotify_event ev; + uint8_t raw[INOTIFY_EVENT_MAX]; +}; -- cgit v1.2.3-54-g00ecf