summaryrefslogtreecommitdiff
path: root/src/journal/sd-journal.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-10 01:45:43 +0100
committerLennart Poettering <lennart@poettering.net>2014-12-10 01:48:39 +0100
commitf7c1ad4fd4190bee32db0aa26c8e9fe7e19d8816 (patch)
tree5a0ea84fa0c4a33eb9ff43f16f09024e1c595ef7 /src/journal/sd-journal.c
parentdf63dda6d4b4fc90f895cfd40d54e15928671624 (diff)
core: unify how we iterate over inotify events
Let's add some syntactic sugar for iterating through inotify events, and use it everywhere.
Diffstat (limited to 'src/journal/sd-journal.c')
-rw-r--r--src/journal/sd-journal.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 5e2da99126..23aad740dd 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -2320,7 +2320,6 @@ static int determine_change(sd_journal *j) {
}
_public_ int sd_journal_process(sd_journal *j) {
- uint8_t buffer[sizeof(struct inotify_event) + FILENAME_MAX] _alignas_(struct inotify_event);
bool got_something = false;
assert_return(j, -EINVAL);
@@ -2329,6 +2328,7 @@ _public_ int sd_journal_process(sd_journal *j) {
j->last_process_usec = now(CLOCK_MONOTONIC);
for (;;) {
+ uint8_t buffer[INOTIFY_EVENT_MAX] _alignas_(struct inotify_event);
struct inotify_event *e;
ssize_t l;
@@ -2342,18 +2342,8 @@ _public_ int sd_journal_process(sd_journal *j) {
got_something = true;
- e = (struct inotify_event*) buffer;
- while (l > 0) {
- size_t step;
-
+ FOREACH_INOTIFY_EVENT(e, buffer, l)
process_inotify_event(j, e);
-
- step = sizeof(struct inotify_event) + e->len;
- assert(step <= (size_t) l);
-
- e = (struct inotify_event*) ((uint8_t*) e + step);
- l -= step;
- }
}
}