]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - include/linux/fsnotify.h
Merge branch 'master' into csb1725
[mv-sheeva.git] / include / linux / fsnotify.h
index 59d0df43ff9d5ef649fd109228ded45f37579d84..b10bcdeaef768b2b0b123c4a6c862b3f5f6c0694 100644 (file)
@@ -26,12 +26,12 @@ static inline void fsnotify_d_instantiate(struct dentry *dentry,
 }
 
 /* Notify this dentry's parent about a child's events. */
-static inline void fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask)
+static inline int fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask)
 {
        if (!dentry)
                dentry = path->dentry;
 
-       __fsnotify_parent(path, dentry, mask);
+       return __fsnotify_parent(path, dentry, mask);
 }
 
 /* simple call site for access decisions */
@@ -40,6 +40,7 @@ static inline int fsnotify_perm(struct file *file, int mask)
        struct path *path = &file->f_path;
        struct inode *inode = path->dentry->d_inode;
        __u32 fsnotify_mask = 0;
+       int ret;
 
        if (file->f_mode & FMODE_NONOTIFY)
                return 0;
@@ -52,6 +53,10 @@ static inline int fsnotify_perm(struct file *file, int mask)
        else
                BUG();
 
+       ret = fsnotify_parent(path, NULL, fsnotify_mask);
+       if (ret)
+               return ret;
+
        return fsnotify(inode, fsnotify_mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
 }
 
@@ -93,8 +98,8 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
                old_dir_mask |= FS_DN_RENAME;
 
        if (isdir) {
-               old_dir_mask |= FS_IN_ISDIR;
-               new_dir_mask |= FS_IN_ISDIR;
+               old_dir_mask |= FS_ISDIR;
+               new_dir_mask |= FS_ISDIR;
        }
 
        fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie);
@@ -132,7 +137,7 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
        __u32 mask = FS_DELETE;
 
        if (isdir)
-               mask |= FS_IN_ISDIR;
+               mask |= FS_ISDIR;
 
        fsnotify_parent(NULL, dentry, mask);
 }
@@ -174,7 +179,7 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct
  */
 static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
 {
-       __u32 mask = (FS_CREATE | FS_IN_ISDIR);
+       __u32 mask = (FS_CREATE | FS_ISDIR);
        struct inode *d_inode = dentry->d_inode;
 
        audit_inode_child(dentry, inode);
@@ -192,7 +197,7 @@ static inline void fsnotify_access(struct file *file)
        __u32 mask = FS_ACCESS;
 
        if (S_ISDIR(inode->i_mode))
-               mask |= FS_IN_ISDIR;
+               mask |= FS_ISDIR;
 
        if (!(file->f_mode & FMODE_NONOTIFY)) {
                fsnotify_parent(path, NULL, mask);
@@ -210,7 +215,7 @@ static inline void fsnotify_modify(struct file *file)
        __u32 mask = FS_MODIFY;
 
        if (S_ISDIR(inode->i_mode))
-               mask |= FS_IN_ISDIR;
+               mask |= FS_ISDIR;
 
        if (!(file->f_mode & FMODE_NONOTIFY)) {
                fsnotify_parent(path, NULL, mask);
@@ -228,12 +233,10 @@ static inline void fsnotify_open(struct file *file)
        __u32 mask = FS_OPEN;
 
        if (S_ISDIR(inode->i_mode))
-               mask |= FS_IN_ISDIR;
+               mask |= FS_ISDIR;
 
-       if (!(file->f_mode & FMODE_NONOTIFY)) {
-               fsnotify_parent(path, NULL, mask);
-               fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
-       }
+       fsnotify_parent(path, NULL, mask);
+       fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
 }
 
 /*
@@ -247,7 +250,7 @@ static inline void fsnotify_close(struct file *file)
        __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE;
 
        if (S_ISDIR(inode->i_mode))
-               mask |= FS_IN_ISDIR;
+               mask |= FS_ISDIR;
 
        if (!(file->f_mode & FMODE_NONOTIFY)) {
                fsnotify_parent(path, NULL, mask);
@@ -264,7 +267,7 @@ static inline void fsnotify_xattr(struct dentry *dentry)
        __u32 mask = FS_ATTRIB;
 
        if (S_ISDIR(inode->i_mode))
-               mask |= FS_IN_ISDIR;
+               mask |= FS_ISDIR;
 
        fsnotify_parent(NULL, dentry, mask);
        fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
@@ -299,7 +302,7 @@ static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid)
 
        if (mask) {
                if (S_ISDIR(inode->i_mode))
-                       mask |= FS_IN_ISDIR;
+                       mask |= FS_ISDIR;
 
                fsnotify_parent(NULL, dentry, mask);
                fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);