]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - include/linux/fsnotify.h
fsnotify: use unsigned char * for dentry->d_name.name
[net-next-2.6.git] / include / linux / fsnotify.h
index 845e57abfb86b3aeb621c36832dcebdd39838985..b8cf161f5a6de329acf3abac9a0a29e7f1d82234 100644 (file)
  * fsnotify_d_instantiate - instantiate a dentry for inode
  * Called with dcache_lock held.
  */
-static inline void fsnotify_d_instantiate(struct dentry *entry,
-                                               struct inode *inode)
+static inline void fsnotify_d_instantiate(struct dentry *dentry,
+                                         struct inode *inode)
 {
-       __fsnotify_d_instantiate(entry, inode);
+       __fsnotify_d_instantiate(dentry, inode);
 }
 
 /* Notify this dentry's parent about a child's events. */
-static inline void fsnotify_parent(struct dentry *dentry, __u32 mask)
+static inline void fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask)
 {
-       __fsnotify_parent(dentry, mask);
+       if (!dentry)
+               dentry = path->dentry;
+
+       __fsnotify_parent(path, dentry, mask);
 }
 
 /*
- * fsnotify_d_move - entry has been moved
- * Called with dcache_lock and entry->d_lock held.
+ * fsnotify_d_move - dentry has been moved
+ * Called with dcache_lock and dentry->d_lock held.
  */
-static inline void fsnotify_d_move(struct dentry *entry)
+static inline void fsnotify_d_move(struct dentry *dentry)
 {
        /*
-        * On move we need to update entry->d_flags to indicate if the new parent
-        * cares about events from this entry.
+        * On move we need to update dentry->d_flags to indicate if the new parent
+        * cares about events from this dentry.
         */
-       __fsnotify_update_dcache_flags(entry);
+       __fsnotify_update_dcache_flags(dentry);
 }
 
 /*
@@ -56,14 +59,14 @@ static inline void fsnotify_link_count(struct inode *inode)
  * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir
  */
 static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
-                                const char *old_name,
+                                const unsigned char *old_name,
                                 int isdir, struct inode *target, struct dentry *moved)
 {
        struct inode *source = moved->d_inode;
        u32 fs_cookie = fsnotify_get_cookie();
        __u32 old_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_FROM);
        __u32 new_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_TO);
-       const char *new_name = moved->d_name.name;
+       const unsigned char *new_name = moved->d_name.name;
 
        if (old_dir == new_dir)
                old_dir_mask |= FS_DN_RENAME;
@@ -92,6 +95,14 @@ static inline void fsnotify_inode_delete(struct inode *inode)
        __fsnotify_inode_delete(inode);
 }
 
+/*
+ * fsnotify_vfsmount_delete - a vfsmount is being destroyed, clean up is needed
+ */
+static inline void fsnotify_vfsmount_delete(struct vfsmount *mnt)
+{
+       __fsnotify_vfsmount_delete(mnt);
+}
+
 /*
  * fsnotify_nameremove - a filename was removed from a directory
  */
@@ -102,7 +113,7 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
        if (isdir)
                mask |= FS_IN_ISDIR;
 
-       fsnotify_parent(dentry, mask);
+       fsnotify_parent(NULL, dentry, mask);
 }
 
 /*
@@ -155,15 +166,17 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
  */
 static inline void fsnotify_access(struct file *file)
 {
-       struct dentry *dentry = file->f_path.dentry;
-       struct inode *inode = dentry->d_inode;
+       struct path *path = &file->f_path;
+       struct inode *inode = path->dentry->d_inode;
        __u32 mask = FS_ACCESS;
 
        if (S_ISDIR(inode->i_mode))
                mask |= FS_IN_ISDIR;
 
-       fsnotify_parent(dentry, mask);
-       fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0);
+       if (!(file->f_mode & FMODE_NONOTIFY)) {
+               fsnotify_parent(path, NULL, mask);
+               fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
+       }
 }
 
 /*
@@ -171,15 +184,17 @@ static inline void fsnotify_access(struct file *file)
  */
 static inline void fsnotify_modify(struct file *file)
 {
-       struct dentry *dentry = file->f_path.dentry;
-       struct inode *inode = dentry->d_inode;
+       struct path *path = &file->f_path;
+       struct inode *inode = path->dentry->d_inode;
        __u32 mask = FS_MODIFY;
 
        if (S_ISDIR(inode->i_mode))
                mask |= FS_IN_ISDIR;
 
-       fsnotify_parent(dentry, mask);
-       fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0);
+       if (!(file->f_mode & FMODE_NONOTIFY)) {
+               fsnotify_parent(path, NULL, mask);
+               fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
+       }
 }
 
 /*
@@ -187,15 +202,17 @@ static inline void fsnotify_modify(struct file *file)
  */
 static inline void fsnotify_open(struct file *file)
 {
-       struct dentry *dentry = file->f_path.dentry;
-       struct inode *inode = dentry->d_inode;
+       struct path *path = &file->f_path;
+       struct inode *inode = path->dentry->d_inode;
        __u32 mask = FS_OPEN;
 
        if (S_ISDIR(inode->i_mode))
                mask |= FS_IN_ISDIR;
 
-       fsnotify_parent(dentry, mask);
-       fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0);
+       if (!(file->f_mode & FMODE_NONOTIFY)) {
+               fsnotify_parent(path, NULL, mask);
+               fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
+       }
 }
 
 /*
@@ -203,16 +220,18 @@ static inline void fsnotify_open(struct file *file)
  */
 static inline void fsnotify_close(struct file *file)
 {
-       struct dentry *dentry = file->f_path.dentry;
-       struct inode *inode = dentry->d_inode;
+       struct path *path = &file->f_path;
+       struct inode *inode = file->f_path.dentry->d_inode;
        fmode_t mode = file->f_mode;
        __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE;
 
        if (S_ISDIR(inode->i_mode))
                mask |= FS_IN_ISDIR;
 
-       fsnotify_parent(dentry, mask);
-       fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0);
+       if (!(file->f_mode & FMODE_NONOTIFY)) {
+               fsnotify_parent(path, NULL, mask);
+               fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
+       }
 }
 
 /*
@@ -226,7 +245,7 @@ static inline void fsnotify_xattr(struct dentry *dentry)
        if (S_ISDIR(inode->i_mode))
                mask |= FS_IN_ISDIR;
 
-       fsnotify_parent(dentry, mask);
+       fsnotify_parent(NULL, dentry, mask);
        fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
 }
 
@@ -260,7 +279,8 @@ static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid)
        if (mask) {
                if (S_ISDIR(inode->i_mode))
                        mask |= FS_IN_ISDIR;
-               fsnotify_parent(dentry, mask);
+
+               fsnotify_parent(NULL, dentry, mask);
                fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
        }
 }
@@ -270,7 +290,7 @@ static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid)
 /*
  * fsnotify_oldname_init - save off the old filename before we change it
  */
-static inline const char *fsnotify_oldname_init(const char *name)
+static inline const unsigned char *fsnotify_oldname_init(const unsigned char *name)
 {
        return kstrdup(name, GFP_KERNEL);
 }
@@ -278,22 +298,22 @@ static inline const char *fsnotify_oldname_init(const char *name)
 /*
  * fsnotify_oldname_free - free the name we got from fsnotify_oldname_init
  */
-static inline void fsnotify_oldname_free(const char *old_name)
+static inline void fsnotify_oldname_free(const unsigned char *old_name)
 {
        kfree(old_name);
 }
 
-#else  /* CONFIG_INOTIFY || CONFIG_FSNOTIFY */
+#else  /* CONFIG_FSNOTIFY */
 
-static inline const char *fsnotify_oldname_init(const char *name)
+static inline const char *fsnotify_oldname_init(const unsigned char *name)
 {
        return NULL;
 }
 
-static inline void fsnotify_oldname_free(const char *old_name)
+static inline void fsnotify_oldname_free(const unsigned char *old_name)
 {
 }
 
-#endif /* ! CONFIG_INOTIFY */
+#endif /*  CONFIG_FSNOTIFY */
 
 #endif /* _LINUX_FS_NOTIFY_H */