diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-12-10 01:45:43 +0100 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2014-12-11 13:45:16 -0500 |
commit | 11d61581aa4cb74f657fe252132d6f757a88d41f (patch) | |
tree | 9ca3c85950f36834e9f44040cbe8f15cc39ff5dc /src/shared/util.h | |
parent | 96ed47b845e22a730e3b7f567f60d552aa8981e6 (diff) |
core: unify how we iterate over inotify events
Let's add some syntactic sugar for iterating through inotify events, and
use it everywhere.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/shared/util.h')
-rw-r--r-- | src/shared/util.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/shared/util.h b/src/shared/util.h index cbfe787be2..21e977dc51 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -458,3 +458,10 @@ char *tempfn_xxxxxx(const char *p); int is_dir(const char *path, bool follow); int execute_command(const char *command, char *const argv[]); + +#define INOTIFY_EVENT_MAX (sizeof(struct inotify_event) + NAME_MAX + 1) + +#define FOREACH_INOTIFY_EVENT(e, buffer, sz) \ + for ((e) = (struct inotify_event*) (buffer); \ + (uint8_t*) (e) < (uint8_t*) (buffer) + (sz); \ + (e) = (struct inotify_event*) ((uint8_t*) (e) + sizeof(struct inotify_event) + (e)->len)) |