diff options
author | Volker Lendecke <vl@samba.org> | 2014-10-26 09:13:41 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-12-09 04:12:08 +0100 |
commit | 18b682250457e60ae75d4352c7f0b88686eb1dd8 (patch) | |
tree | ad978d645a83b94fc1a2460351d934a585315cd8 | |
parent | 8a4948593840db0823c8f7c0ba4b60f7e07c3340 (diff) | |
download | samba-18b682250457e60ae75d4352c7f0b88686eb1dd8.tar.gz samba-18b682250457e60ae75d4352c7f0b88686eb1dd8.tar.xz samba-18b682250457e60ae75d4352c7f0b88686eb1dd8.zip |
notify_inotify: Simplify filter_match
Early returns make code simpler
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | source3/smbd/notify_inotify.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/source3/smbd/notify_inotify.c b/source3/smbd/notify_inotify.c index 554277cabe..2425bb4a5b 100644 --- a/source3/smbd/notify_inotify.c +++ b/source3/smbd/notify_inotify.c @@ -75,6 +75,8 @@ static int inotify_destructor(struct inotify_private *in) static bool filter_match(struct inotify_watch_context *w, struct inotify_event *e) { + bool ok; + DEBUG(10, ("filter_match: e->mask=%x, w->mask=%x, w->filter=%x\n", e->mask, w->mask, w->filter)); @@ -86,28 +88,25 @@ static bool filter_match(struct inotify_watch_context *w, /* SMB separates the filters for files and directories */ if (e->mask & IN_ISDIR) { - if ((w->filter & FILE_NOTIFY_CHANGE_DIR_NAME) == 0) { - return False; - } - } else { - if ((e->mask & IN_ATTRIB) && - (w->filter & (FILE_NOTIFY_CHANGE_ATTRIBUTES| - FILE_NOTIFY_CHANGE_LAST_WRITE| - FILE_NOTIFY_CHANGE_LAST_ACCESS| - FILE_NOTIFY_CHANGE_EA| - FILE_NOTIFY_CHANGE_SECURITY))) { - return True; - } - if ((e->mask & IN_MODIFY) && - (w->filter & FILE_NOTIFY_CHANGE_ATTRIBUTES)) { - return True; - } - if ((w->filter & FILE_NOTIFY_CHANGE_FILE_NAME) == 0) { - return False; - } + ok = ((w->filter & FILE_NOTIFY_CHANGE_DIR_NAME) != 0); + return ok; + } + + if ((e->mask & IN_ATTRIB) && + (w->filter & (FILE_NOTIFY_CHANGE_ATTRIBUTES| + FILE_NOTIFY_CHANGE_LAST_WRITE| + FILE_NOTIFY_CHANGE_LAST_ACCESS| + FILE_NOTIFY_CHANGE_EA| + FILE_NOTIFY_CHANGE_SECURITY))) { + return True; + } + if ((e->mask & IN_MODIFY) && + (w->filter & FILE_NOTIFY_CHANGE_ATTRIBUTES)) { + return True; } - return True; + ok = ((w->filter & FILE_NOTIFY_CHANGE_FILE_NAME) != 0); + return ok; } |