From: Christof Schmitt Date: Fri, 15 Jul 2016 19:15:15 +0000 (-0700) Subject: notify_inotify: Move mapping table to top of file X-Git-Tag: tdb-1.3.10~356 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f83432bf3f0adab7c470124777216fbfbbda784b;p=thirdparty%2Fsamba.git notify_inotify: Move mapping table to top of file Signed-off-by: Christof Schmitt Reviewed-by: Volker Lendecke --- diff --git a/source3/smbd/notify_inotify.c b/source3/smbd/notify_inotify.c index 88a54eca995..f7034f1f355 100644 --- a/source3/smbd/notify_inotify.c +++ b/source3/smbd/notify_inotify.c @@ -57,6 +57,36 @@ struct inotify_watch_context { }; +/* + map from a change notify mask to a inotify mask. Remove any bits + which we can handle +*/ +static const struct { + uint32_t notify_mask; + uint32_t inotify_mask; +} inotify_mapping[] = { + {FILE_NOTIFY_CHANGE_FILE_NAME, IN_CREATE|IN_DELETE|IN_MOVED_FROM|IN_MOVED_TO}, + {FILE_NOTIFY_CHANGE_DIR_NAME, IN_CREATE|IN_DELETE|IN_MOVED_FROM|IN_MOVED_TO}, + {FILE_NOTIFY_CHANGE_ATTRIBUTES, IN_ATTRIB|IN_MOVED_TO|IN_MOVED_FROM|IN_MODIFY}, + {FILE_NOTIFY_CHANGE_LAST_WRITE, IN_ATTRIB}, + {FILE_NOTIFY_CHANGE_LAST_ACCESS, IN_ATTRIB}, + {FILE_NOTIFY_CHANGE_EA, IN_ATTRIB}, + {FILE_NOTIFY_CHANGE_SECURITY, IN_ATTRIB} +}; + +static uint32_t inotify_map(uint32_t *filter) +{ + int i; + uint32_t out=0; + for (i=0;i