diff options
Diffstat (limited to 'include/linux/fsnotify.h')
-rw-r--r-- | include/linux/fsnotify.h | 68 |
1 files changed, 21 insertions, 47 deletions
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 6a662ed0bc8a..db12d9de3526 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h | |||
@@ -74,13 +74,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, | |||
74 | __u32 new_dir_mask = 0; | 74 | __u32 new_dir_mask = 0; |
75 | 75 | ||
76 | if (old_dir == new_dir) { | 76 | if (old_dir == new_dir) { |
77 | inode_dir_notify(old_dir, DN_RENAME); | ||
78 | old_dir_mask = FS_DN_RENAME; | 77 | old_dir_mask = FS_DN_RENAME; |
79 | } else { | ||
80 | inode_dir_notify(old_dir, DN_DELETE); | ||
81 | old_dir_mask = FS_DELETE; | ||
82 | inode_dir_notify(new_dir, DN_CREATE); | ||
83 | new_dir_mask = FS_CREATE; | ||
84 | } | 78 | } |
85 | 79 | ||
86 | if (isdir) { | 80 | if (isdir) { |
@@ -132,7 +126,6 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) | |||
132 | 126 | ||
133 | if (isdir) | 127 | if (isdir) |
134 | mask |= FS_IN_ISDIR; | 128 | mask |= FS_IN_ISDIR; |
135 | dnotify_parent(dentry, DN_DELETE); | ||
136 | 129 | ||
137 | fsnotify_parent(dentry, mask); | 130 | fsnotify_parent(dentry, mask); |
138 | } | 131 | } |
@@ -154,7 +147,6 @@ static inline void fsnotify_inoderemove(struct inode *inode) | |||
154 | */ | 147 | */ |
155 | static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) | 148 | static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) |
156 | { | 149 | { |
157 | inode_dir_notify(inode, DN_CREATE); | ||
158 | inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name, | 150 | inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name, |
159 | dentry->d_inode); | 151 | dentry->d_inode); |
160 | audit_inode_child(dentry->d_name.name, dentry, inode); | 152 | audit_inode_child(dentry->d_name.name, dentry, inode); |
@@ -169,7 +161,6 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) | |||
169 | */ | 161 | */ |
170 | static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry) | 162 | static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry) |
171 | { | 163 | { |
172 | inode_dir_notify(dir, DN_CREATE); | ||
173 | inotify_inode_queue_event(dir, IN_CREATE, 0, new_dentry->d_name.name, | 164 | inotify_inode_queue_event(dir, IN_CREATE, 0, new_dentry->d_name.name, |
174 | inode); | 165 | inode); |
175 | fsnotify_link_count(inode); | 166 | fsnotify_link_count(inode); |
@@ -186,7 +177,6 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) | |||
186 | __u32 mask = (FS_CREATE | FS_IN_ISDIR); | 177 | __u32 mask = (FS_CREATE | FS_IN_ISDIR); |
187 | struct inode *d_inode = dentry->d_inode; | 178 | struct inode *d_inode = dentry->d_inode; |
188 | 179 | ||
189 | inode_dir_notify(inode, DN_CREATE); | ||
190 | inotify_inode_queue_event(inode, mask, 0, dentry->d_name.name, d_inode); | 180 | inotify_inode_queue_event(inode, mask, 0, dentry->d_name.name, d_inode); |
191 | audit_inode_child(dentry->d_name.name, dentry, inode); | 181 | audit_inode_child(dentry->d_name.name, dentry, inode); |
192 | 182 | ||
@@ -204,7 +194,6 @@ static inline void fsnotify_access(struct dentry *dentry) | |||
204 | if (S_ISDIR(inode->i_mode)) | 194 | if (S_ISDIR(inode->i_mode)) |
205 | mask |= FS_IN_ISDIR; | 195 | mask |= FS_IN_ISDIR; |
206 | 196 | ||
207 | dnotify_parent(dentry, DN_ACCESS); | ||
208 | inotify_inode_queue_event(inode, mask, 0, NULL, NULL); | 197 | inotify_inode_queue_event(inode, mask, 0, NULL, NULL); |
209 | 198 | ||
210 | fsnotify_parent(dentry, mask); | 199 | fsnotify_parent(dentry, mask); |
@@ -222,7 +211,6 @@ static inline void fsnotify_modify(struct dentry *dentry) | |||
222 | if (S_ISDIR(inode->i_mode)) | 211 | if (S_ISDIR(inode->i_mode)) |
223 | mask |= FS_IN_ISDIR; | 212 | mask |= FS_IN_ISDIR; |
224 | 213 | ||
225 | dnotify_parent(dentry, DN_MODIFY); | ||
226 | inotify_inode_queue_event(inode, mask, 0, NULL, NULL); | 214 | inotify_inode_queue_event(inode, mask, 0, NULL, NULL); |
227 | 215 | ||
228 | fsnotify_parent(dentry, mask); | 216 | fsnotify_parent(dentry, mask); |
@@ -289,47 +277,33 @@ static inline void fsnotify_xattr(struct dentry *dentry) | |||
289 | static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid) | 277 | static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid) |
290 | { | 278 | { |
291 | struct inode *inode = dentry->d_inode; | 279 | struct inode *inode = dentry->d_inode; |
292 | int dn_mask = 0; | 280 | __u32 mask = 0; |
293 | __u32 in_mask = 0; | 281 | |
282 | if (ia_valid & ATTR_UID) | ||
283 | mask |= FS_ATTRIB; | ||
284 | if (ia_valid & ATTR_GID) | ||
285 | mask |= FS_ATTRIB; | ||
286 | if (ia_valid & ATTR_SIZE) | ||
287 | mask |= FS_MODIFY; | ||
294 | 288 | ||
295 | if (ia_valid & ATTR_UID) { | ||
296 | in_mask |= FS_ATTRIB; | ||
297 | dn_mask |= DN_ATTRIB; | ||
298 | } | ||
299 | if (ia_valid & ATTR_GID) { | ||
300 | in_mask |= FS_ATTRIB; | ||
301 | dn_mask |= DN_ATTRIB; | ||
302 | } | ||
303 | if (ia_valid & ATTR_SIZE) { | ||
304 | in_mask |= FS_MODIFY; | ||
305 | dn_mask |= DN_MODIFY; | ||
306 | } | ||
307 | /* both times implies a utime(s) call */ | 289 | /* both times implies a utime(s) call */ |
308 | if ((ia_valid & (ATTR_ATIME | ATTR_MTIME)) == (ATTR_ATIME | ATTR_MTIME)) | 290 | if ((ia_valid & (ATTR_ATIME | ATTR_MTIME)) == (ATTR_ATIME | ATTR_MTIME)) |
309 | { | 291 | mask |= FS_ATTRIB; |
310 | in_mask |= FS_ATTRIB; | 292 | else if (ia_valid & ATTR_ATIME) |
311 | dn_mask |= DN_ATTRIB; | 293 | mask |= FS_ACCESS; |
312 | } else if (ia_valid & ATTR_ATIME) { | 294 | else if (ia_valid & ATTR_MTIME) |
313 | in_mask |= FS_ACCESS; | 295 | mask |= FS_MODIFY; |
314 | dn_mask |= DN_ACCESS; | 296 | |
315 | } else if (ia_valid & ATTR_MTIME) { | 297 | if (ia_valid & ATTR_MODE) |
316 | in_mask |= FS_MODIFY; | 298 | mask |= FS_ATTRIB; |
317 | dn_mask |= DN_MODIFY; | ||
318 | } | ||
319 | if (ia_valid & ATTR_MODE) { | ||
320 | in_mask |= FS_ATTRIB; | ||
321 | dn_mask |= DN_ATTRIB; | ||
322 | } | ||
323 | 299 | ||
324 | if (dn_mask) | 300 | if (mask) { |
325 | dnotify_parent(dentry, dn_mask); | ||
326 | if (in_mask) { | ||
327 | if (S_ISDIR(inode->i_mode)) | 301 | if (S_ISDIR(inode->i_mode)) |
328 | in_mask |= FS_IN_ISDIR; | 302 | mask |= FS_IN_ISDIR; |
329 | inotify_inode_queue_event(inode, in_mask, 0, NULL, NULL); | 303 | inotify_inode_queue_event(inode, mask, 0, NULL, NULL); |
330 | 304 | ||
331 | fsnotify_parent(dentry, in_mask); | 305 | fsnotify_parent(dentry, mask); |
332 | fsnotify(inode, in_mask, inode, FSNOTIFY_EVENT_INODE); | 306 | fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE); |
333 | } | 307 | } |
334 | } | 308 | } |
335 | 309 | ||