Commit 7b0a04fb authored by Eric Paris's avatar Eric Paris

fsnotify: provide the data type to should_send_event

fanotify is only interested in event types which contain enough information
to open the original file in the context of the fanotify listener.  Since
fanotify may not want to send events if that data isn't present we pass
the data type to the should_send_event function call so fanotify can express
its lack of interest.
Signed-off-by: default avatarEric Paris <eparis@redhat.com>
parent d7f0ce4e
...@@ -133,7 +133,8 @@ static int dnotify_handle_event(struct fsnotify_group *group, ...@@ -133,7 +133,8 @@ static int dnotify_handle_event(struct fsnotify_group *group,
* userspace notification for that pair. * userspace notification for that pair.
*/ */
static bool dnotify_should_send_event(struct fsnotify_group *group, static bool dnotify_should_send_event(struct fsnotify_group *group,
struct inode *inode, __u32 mask) struct inode *inode, __u32 mask,
int data_type)
{ {
struct fsnotify_mark_entry *entry; struct fsnotify_mark_entry *entry;
bool send; bool send;
......
...@@ -157,7 +157,7 @@ void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, const ...@@ -157,7 +157,7 @@ void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, const
idx = srcu_read_lock(&fsnotify_grp_srcu); idx = srcu_read_lock(&fsnotify_grp_srcu);
list_for_each_entry_rcu(group, &fsnotify_groups, group_list) { list_for_each_entry_rcu(group, &fsnotify_groups, group_list) {
if (test_mask & group->mask) { if (test_mask & group->mask) {
if (!group->ops->should_send_event(group, to_tell, mask)) if (!group->ops->should_send_event(group, to_tell, mask, data_is))
continue; continue;
if (!event) { if (!event) {
event = fsnotify_create_event(to_tell, mask, data, event = fsnotify_create_event(to_tell, mask, data,
......
...@@ -86,7 +86,8 @@ static void inotify_freeing_mark(struct fsnotify_mark_entry *entry, struct fsnot ...@@ -86,7 +86,8 @@ static void inotify_freeing_mark(struct fsnotify_mark_entry *entry, struct fsnot
inotify_ignored_and_remove_idr(entry, group); inotify_ignored_and_remove_idr(entry, group);
} }
static bool inotify_should_send_event(struct fsnotify_group *group, struct inode *inode, __u32 mask) static bool inotify_should_send_event(struct fsnotify_group *group, struct inode *inode,
__u32 mask, int data_type)
{ {
struct fsnotify_mark_entry *entry; struct fsnotify_mark_entry *entry;
bool send; bool send;
......
...@@ -84,7 +84,8 @@ struct fsnotify_event_private_data; ...@@ -84,7 +84,8 @@ struct fsnotify_event_private_data;
* valid group and inode to use to clean up. * valid group and inode to use to clean up.
*/ */
struct fsnotify_ops { struct fsnotify_ops {
bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode, __u32 mask); bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode,
__u32 mask, int data_type);
int (*handle_event)(struct fsnotify_group *group, struct fsnotify_event *event); int (*handle_event)(struct fsnotify_group *group, struct fsnotify_event *event);
void (*free_group_priv)(struct fsnotify_group *group); void (*free_group_priv)(struct fsnotify_group *group);
void (*freeing_mark)(struct fsnotify_mark_entry *entry, struct fsnotify_group *group); void (*freeing_mark)(struct fsnotify_mark_entry *entry, struct fsnotify_group *group);
......
...@@ -919,7 +919,8 @@ static void audit_tree_freeing_mark(struct fsnotify_mark_entry *entry, struct fs ...@@ -919,7 +919,8 @@ static void audit_tree_freeing_mark(struct fsnotify_mark_entry *entry, struct fs
fsnotify_put_mark(entry); fsnotify_put_mark(entry);
} }
static bool audit_tree_send_event(struct fsnotify_group *group, struct inode *inode, __u32 mask) static bool audit_tree_send_event(struct fsnotify_group *group, struct inode *inode,
__u32 mask, int data_type)
{ {
return 0; return 0;
} }
......
...@@ -505,7 +505,8 @@ void audit_remove_watch_rule(struct audit_krule *krule) ...@@ -505,7 +505,8 @@ void audit_remove_watch_rule(struct audit_krule *krule)
} }
} }
static bool audit_watch_should_send_event(struct fsnotify_group *group, struct inode *inode, __u32 mask) static bool audit_watch_should_send_event(struct fsnotify_group *group, struct inode *inode,
__u32 mask, int data_type)
{ {
struct fsnotify_mark_entry *entry; struct fsnotify_mark_entry *entry;
bool send; bool send;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment