aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2014-01-21 18:48:15 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-21 19:19:41 -0500
commit83c4c4b0a3aadc1ce7b5b2870ce1fc1f65498da0 (patch)
treea195ea785bb03a301773930f62d3fa45927be10d
parent7053aee26a3548ebaba046ae2e52396ccf56ac6c (diff)
fsnotify: remove .should_send_event callback
After removing event structure creation from the generic layer there is no reason for separate .should_send_event and .handle_event callbacks. So just remove the first one. Signed-off-by: Jan Kara <jack@suse.cz> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Eric Paris <eparis@parisplace.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/notify/dnotify/dnotify.c22
-rw-r--r--fs/notify/fanotify/fanotify.c18
-rw-r--r--fs/notify/fsnotify.c5
-rw-r--r--fs/notify/inotify/inotify_fsnotify.c24
-rw-r--r--include/linux/fsnotify_backend.h4
-rw-r--r--kernel/audit_tree.c12
-rw-r--r--kernel/audit_watch.c9
7 files changed, 22 insertions, 72 deletions
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c
index bfca53dbbf34..928688e3ee2f 100644
--- a/fs/notify/dnotify/dnotify.c
+++ b/fs/notify/dnotify/dnotify.c
@@ -94,6 +94,10 @@ static int dnotify_handle_event(struct fsnotify_group *group,
94 struct fown_struct *fown; 94 struct fown_struct *fown;
95 __u32 test_mask = mask & ~FS_EVENT_ON_CHILD; 95 __u32 test_mask = mask & ~FS_EVENT_ON_CHILD;
96 96
97 /* not a dir, dnotify doesn't care */
98 if (!S_ISDIR(inode->i_mode))
99 return 0;
100
97 BUG_ON(vfsmount_mark); 101 BUG_ON(vfsmount_mark);
98 102
99 dn_mark = container_of(inode_mark, struct dnotify_mark, fsn_mark); 103 dn_mark = container_of(inode_mark, struct dnotify_mark, fsn_mark);
@@ -121,23 +125,6 @@ static int dnotify_handle_event(struct fsnotify_group *group,
121 return 0; 125 return 0;
122} 126}
123 127
124/*
125 * Given an inode and mask determine if dnotify would be interested in sending
126 * userspace notification for that pair.
127 */
128static bool dnotify_should_send_event(struct fsnotify_group *group,
129 struct inode *inode,
130 struct fsnotify_mark *inode_mark,
131 struct fsnotify_mark *vfsmount_mark,
132 __u32 mask, void *data, int data_type)
133{
134 /* not a dir, dnotify doesn't care */
135 if (!S_ISDIR(inode->i_mode))
136 return false;
137
138 return true;
139}
140
141static void dnotify_free_mark(struct fsnotify_mark *fsn_mark) 128static void dnotify_free_mark(struct fsnotify_mark *fsn_mark)
142{ 129{
143 struct dnotify_mark *dn_mark = container_of(fsn_mark, 130 struct dnotify_mark *dn_mark = container_of(fsn_mark,
@@ -151,7 +138,6 @@ static void dnotify_free_mark(struct fsnotify_mark *fsn_mark)
151 138
152static struct fsnotify_ops dnotify_fsnotify_ops = { 139static struct fsnotify_ops dnotify_fsnotify_ops = {
153 .handle_event = dnotify_handle_event, 140 .handle_event = dnotify_handle_event,
154 .should_send_event = dnotify_should_send_event,
155 .free_group_priv = NULL, 141 .free_group_priv = NULL,
156 .freeing_mark = NULL, 142 .freeing_mark = NULL,
157 .free_event = NULL, 143 .free_event = NULL,
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index c26268d7bd9d..1f8f05220f8d 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -88,18 +88,17 @@ static int fanotify_get_response_from_access(struct fsnotify_group *group,
88} 88}
89#endif 89#endif
90 90
91static bool fanotify_should_send_event(struct fsnotify_group *group, 91static bool fanotify_should_send_event(struct fsnotify_mark *inode_mark,
92 struct inode *inode,
93 struct fsnotify_mark *inode_mark,
94 struct fsnotify_mark *vfsmnt_mark, 92 struct fsnotify_mark *vfsmnt_mark,
95 __u32 event_mask, void *data, int data_type) 93 u32 event_mask,
94 void *data, int data_type)
96{ 95{
97 __u32 marks_mask, marks_ignored_mask; 96 __u32 marks_mask, marks_ignored_mask;
98 struct path *path = data; 97 struct path *path = data;
99 98
100 pr_debug("%s: group=%p inode=%p inode_mark=%p vfsmnt_mark=%p " 99 pr_debug("%s: inode_mark=%p vfsmnt_mark=%p mask=%x data=%p"
101 "mask=%x data=%p data_type=%d\n", __func__, group, inode, 100 " data_type=%d\n", __func__, inode_mark, vfsmnt_mark,
102 inode_mark, vfsmnt_mark, event_mask, data, data_type); 101 event_mask, data, data_type);
103 102
104 /* if we don't have enough info to send an event to userspace say no */ 103 /* if we don't have enough info to send an event to userspace say no */
105 if (data_type != FSNOTIFY_EVENT_PATH) 104 if (data_type != FSNOTIFY_EVENT_PATH)
@@ -163,6 +162,10 @@ static int fanotify_handle_event(struct fsnotify_group *group,
163 BUILD_BUG_ON(FAN_ACCESS_PERM != FS_ACCESS_PERM); 162 BUILD_BUG_ON(FAN_ACCESS_PERM != FS_ACCESS_PERM);
164 BUILD_BUG_ON(FAN_ONDIR != FS_ISDIR); 163 BUILD_BUG_ON(FAN_ONDIR != FS_ISDIR);
165 164
165 if (!fanotify_should_send_event(inode_mark, fanotify_mark, mask, data,
166 data_type))
167 return 0;
168
166 pr_debug("%s: group=%p inode=%p mask=%x\n", __func__, group, inode, 169 pr_debug("%s: group=%p inode=%p mask=%x\n", __func__, group, inode,
167 mask); 170 mask);
168 171
@@ -225,7 +228,6 @@ static void fanotify_free_event(struct fsnotify_event *fsn_event)
225 228
226const struct fsnotify_ops fanotify_fsnotify_ops = { 229const struct fsnotify_ops fanotify_fsnotify_ops = {
227 .handle_event = fanotify_handle_event, 230 .handle_event = fanotify_handle_event,
228 .should_send_event = fanotify_should_send_event,
229 .free_group_priv = fanotify_free_group_priv, 231 .free_group_priv = fanotify_free_group_priv,
230 .free_event = fanotify_free_event, 232 .free_event = fanotify_free_event,
231 .freeing_mark = NULL, 233 .freeing_mark = NULL,
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
index 7c754c91c3f6..1d4e1ea2f37c 100644
--- a/fs/notify/fsnotify.c
+++ b/fs/notify/fsnotify.c
@@ -177,11 +177,6 @@ static int send_to_group(struct inode *to_tell,
177 if (!inode_test_mask && !vfsmount_test_mask) 177 if (!inode_test_mask && !vfsmount_test_mask)
178 return 0; 178 return 0;
179 179
180 if (group->ops->should_send_event(group, to_tell, inode_mark,
181 vfsmount_mark, mask, data,
182 data_is) == false)
183 return 0;
184
185 return group->ops->handle_event(group, to_tell, inode_mark, 180 return group->ops->handle_event(group, to_tell, inode_mark,
186 vfsmount_mark, mask, data, data_is, 181 vfsmount_mark, mask, data, data_is,
187 file_name); 182 file_name);
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index 6fabbd163d16..aad1a35e9af1 100644
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@ -81,6 +81,13 @@ int inotify_handle_event(struct fsnotify_group *group,
81 81
82 BUG_ON(vfsmount_mark); 82 BUG_ON(vfsmount_mark);
83 83
84 if ((inode_mark->mask & FS_EXCL_UNLINK) &&
85 (data_type == FSNOTIFY_EVENT_PATH)) {
86 struct path *path = data;
87
88 if (d_unlinked(path->dentry))
89 return 0;
90 }
84 if (file_name) { 91 if (file_name) {
85 len = strlen(file_name); 92 len = strlen(file_name);
86 alloc_len += len + 1; 93 alloc_len += len + 1;
@@ -122,22 +129,6 @@ static void inotify_freeing_mark(struct fsnotify_mark *fsn_mark, struct fsnotify
122 inotify_ignored_and_remove_idr(fsn_mark, group); 129 inotify_ignored_and_remove_idr(fsn_mark, group);
123} 130}
124 131
125static bool inotify_should_send_event(struct fsnotify_group *group, struct inode *inode,
126 struct fsnotify_mark *inode_mark,
127 struct fsnotify_mark *vfsmount_mark,
128 __u32 mask, void *data, int data_type)
129{
130 if ((inode_mark->mask & FS_EXCL_UNLINK) &&
131 (data_type == FSNOTIFY_EVENT_PATH)) {
132 struct path *path = data;
133
134 if (d_unlinked(path->dentry))
135 return false;
136 }
137
138 return true;
139}
140
141/* 132/*
142 * This is NEVER supposed to be called. Inotify marks should either have been 133 * This is NEVER supposed to be called. Inotify marks should either have been
143 * removed from the idr when the watch was removed or in the 134 * removed from the idr when the watch was removed or in the
@@ -189,7 +180,6 @@ static void inotify_free_event(struct fsnotify_event *fsn_event)
189 180
190const struct fsnotify_ops inotify_fsnotify_ops = { 181const struct fsnotify_ops inotify_fsnotify_ops = {
191 .handle_event = inotify_handle_event, 182 .handle_event = inotify_handle_event,
192 .should_send_event = inotify_should_send_event,
193 .free_group_priv = inotify_free_group_priv, 183 .free_group_priv = inotify_free_group_priv,
194 .free_event = inotify_free_event, 184 .free_event = inotify_free_event,
195 .freeing_mark = inotify_freeing_mark, 185 .freeing_mark = inotify_freeing_mark,
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index 7f3d7dcfcd00..7d8d5e608594 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -94,10 +94,6 @@ struct fsnotify_fname;
94 * userspace messages that marks have been removed. 94 * userspace messages that marks have been removed.
95 */ 95 */
96struct fsnotify_ops { 96struct fsnotify_ops {
97 bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode,
98 struct fsnotify_mark *inode_mark,
99 struct fsnotify_mark *vfsmount_mark,
100 __u32 mask, void *data, int data_type);
101 int (*handle_event)(struct fsnotify_group *group, 97 int (*handle_event)(struct fsnotify_group *group,
102 struct inode *inode, 98 struct inode *inode,
103 struct fsnotify_mark *inode_mark, 99 struct fsnotify_mark *inode_mark,
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index bcc0b1821227..ae8103b057fa 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -918,8 +918,7 @@ static int audit_tree_handle_event(struct fsnotify_group *group,
918 u32 mask, void *data, int data_type, 918 u32 mask, void *data, int data_type,
919 const unsigned char *file_name) 919 const unsigned char *file_name)
920{ 920{
921 BUG(); 921 return 0;
922 return -EOPNOTSUPP;
923} 922}
924 923
925static void audit_tree_freeing_mark(struct fsnotify_mark *entry, struct fsnotify_group *group) 924static void audit_tree_freeing_mark(struct fsnotify_mark *entry, struct fsnotify_group *group)
@@ -935,17 +934,8 @@ static void audit_tree_freeing_mark(struct fsnotify_mark *entry, struct fsnotify
935 BUG_ON(atomic_read(&entry->refcnt) < 1); 934 BUG_ON(atomic_read(&entry->refcnt) < 1);
936} 935}
937 936
938static bool audit_tree_send_event(struct fsnotify_group *group, struct inode *inode,
939 struct fsnotify_mark *inode_mark,
940 struct fsnotify_mark *vfsmount_mark,
941 __u32 mask, void *data, int data_type)
942{
943 return false;
944}
945
946static const struct fsnotify_ops audit_tree_ops = { 937static const struct fsnotify_ops audit_tree_ops = {
947 .handle_event = audit_tree_handle_event, 938 .handle_event = audit_tree_handle_event,
948 .should_send_event = audit_tree_send_event,
949 .free_group_priv = NULL, 939 .free_group_priv = NULL,
950 .free_event = NULL, 940 .free_event = NULL,
951 .freeing_mark = audit_tree_freeing_mark, 941 .freeing_mark = audit_tree_freeing_mark,
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c
index a760c32cb639..367ac9a79acc 100644
--- a/kernel/audit_watch.c
+++ b/kernel/audit_watch.c
@@ -465,14 +465,6 @@ void audit_remove_watch_rule(struct audit_krule *krule)
465 } 465 }
466} 466}
467 467
468static bool audit_watch_should_send_event(struct fsnotify_group *group, struct inode *inode,
469 struct fsnotify_mark *inode_mark,
470 struct fsnotify_mark *vfsmount_mark,
471 __u32 mask, void *data, int data_type)
472{
473 return true;
474}
475
476/* Update watch data in audit rules based on fsnotify events. */ 468/* Update watch data in audit rules based on fsnotify events. */
477static int audit_watch_handle_event(struct fsnotify_group *group, 469static int audit_watch_handle_event(struct fsnotify_group *group,
478 struct inode *to_tell, 470 struct inode *to_tell,
@@ -512,7 +504,6 @@ static int audit_watch_handle_event(struct fsnotify_group *group,
512} 504}
513 505
514static const struct fsnotify_ops audit_watch_fsnotify_ops = { 506static const struct fsnotify_ops audit_watch_fsnotify_ops = {
515 .should_send_event = audit_watch_should_send_event,
516 .handle_event = audit_watch_handle_event, 507 .handle_event = audit_watch_handle_event,
517 .free_group_priv = NULL, 508 .free_group_priv = NULL,
518 .freeing_mark = NULL, 509 .freeing_mark = NULL,