]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - include/linux/fsnotify_backend.h
fsnotify: use unsigned char * for dentry->d_name.name
[net-next-2.6.git] / include / linux / fsnotify_backend.h
index ff654c1932f277b3eccd4d6cfccceb844b0772ba..efe9ba321cf22a1ff1ca4e8a8d8bd746c507b532 100644 (file)
@@ -140,6 +140,7 @@ struct fsnotify_group {
                                         * a group */
        struct list_head marks_list;    /* all inode marks for this group */
 
+       unsigned int priority;          /* order of this group compared to others */
        /* prevents double list_del of group_list.  protected by global fsnotify_grp_mutex */
        bool on_inode_group_list;
        bool on_vfsmount_group_list;
@@ -219,8 +220,9 @@ struct fsnotify_event {
        __u32 mask;             /* the type of access, bitwise OR for FS_* event types */
 
        u32 sync_cookie;        /* used to corrolate events, namely inotify mv events */
-       char *file_name;
+       const unsigned char *file_name;
        size_t name_len;
+       struct pid *tgid;
 
        struct list_head private_data_list;     /* groups can store private data here */
 };
@@ -265,9 +267,12 @@ struct fsnotify_mark {
                struct fsnotify_inode_mark i;
                struct fsnotify_vfsmount_mark m;
        };
+       __u32 ignored_mask;             /* events types to ignore */
        struct list_head free_g_list;   /* tmp list used when freeing this mark */
-#define FSNOTIFY_MARK_FLAG_INODE       0x01
-#define FSNOTIFY_MARK_FLAG_VFSMOUNT    0x02
+#define FSNOTIFY_MARK_FLAG_INODE               0x01
+#define FSNOTIFY_MARK_FLAG_VFSMOUNT            0x02
+#define FSNOTIFY_MARK_FLAG_OBJECT_PINNED       0x04
+#define FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY 0x08
        unsigned int flags;             /* vfsmount or inode mark? */
        void (*free_mark)(struct fsnotify_mark *mark); /* called on final put+free */
 };
@@ -278,9 +283,10 @@ struct fsnotify_mark {
 
 /* main fsnotify call to send events */
 extern void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
-                    const char *name, u32 cookie);
+                    const unsigned char *name, u32 cookie);
 extern void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask);
 extern void __fsnotify_inode_delete(struct inode *inode);
+extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt);
 extern u32 fsnotify_get_cookie(void);
 
 static inline int fsnotify_inode_watches_children(struct inode *inode)
@@ -349,7 +355,10 @@ extern struct fsnotify_event_private_data *fsnotify_remove_priv_from_event(struc
 extern int fsnotify_add_notify_event(struct fsnotify_group *group,
                                     struct fsnotify_event *event,
                                     struct fsnotify_event_private_data *priv,
-                                    int (*merge)(struct list_head *, struct fsnotify_event *));
+                                    int (*merge)(struct list_head *,
+                                                 struct fsnotify_event *,
+                                                 void **),
+                                    void **arg);
 /* true if the group notification queue is empty */
 extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group);
 /* return, but do not dequeue the first event on the notification queue */
@@ -359,17 +368,32 @@ extern struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group
 
 /* functions used to manipulate the marks attached to inodes */
 
+/* run all marks associated with a vfsmount and update mnt->mnt_fsnotify_mask */
+extern void fsnotify_recalc_vfsmount_mask(struct vfsmount *mnt);
 /* run all marks associated with an inode and update inode->i_fsnotify_mask */
 extern void fsnotify_recalc_inode_mask(struct inode *inode);
 extern void fsnotify_init_mark(struct fsnotify_mark *mark, void (*free_mark)(struct fsnotify_mark *mark));
 /* find (and take a reference) to a mark associated with group and inode */
-extern struct fsnotify_mark *fsnotify_find_mark(struct fsnotify_group *group, struct inode *inode);
+extern struct fsnotify_mark *fsnotify_find_inode_mark(struct fsnotify_group *group, struct inode *inode);
+/* find (and take a reference) to a mark associated with group and vfsmount */
+extern struct fsnotify_mark *fsnotify_find_vfsmount_mark(struct fsnotify_group *group, struct vfsmount *mnt);
 /* copy the values from old into new */
 extern void fsnotify_duplicate_mark(struct fsnotify_mark *new, struct fsnotify_mark *old);
+/* set the ignored_mask of a mark */
+extern void fsnotify_set_mark_ignored_mask_locked(struct fsnotify_mark *mark, __u32 mask);
+/* set the mask of a mark (might pin the object into memory */
+extern void fsnotify_set_mark_mask_locked(struct fsnotify_mark *mark, __u32 mask);
 /* attach the mark to both the group and the inode */
-extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group, struct inode *inode, int allow_dups);
+extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group,
+                            struct inode *inode, struct vfsmount *mnt, int allow_dups);
 /* given a mark, flag it to be freed when all references are dropped */
 extern void fsnotify_destroy_mark(struct fsnotify_mark *mark);
+/* run all the marks in a group, and clear all of the vfsmount marks */
+extern void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group);
+/* run all the marks in a group, and clear all of the inode marks */
+extern void fsnotify_clear_inode_marks_by_group(struct fsnotify_group *group);
+/* run all the marks in a group, and clear all of the marks where mark->flags & flags is true*/
+extern void fsnotify_clear_marks_by_group_flags(struct fsnotify_group *group, unsigned int flags);
 /* run all the marks in a group, and flag them to be freed */
 extern void fsnotify_clear_marks_by_group(struct fsnotify_group *group);
 extern void fsnotify_get_mark(struct fsnotify_mark *mark);
@@ -378,7 +402,8 @@ extern void fsnotify_unmount_inodes(struct list_head *list);
 
 /* put here because inotify does some weird stuff when destroying watches */
 extern struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask,
-                                                   void *data, int data_is, const char *name,
+                                                   void *data, int data_is,
+                                                   const unsigned char *name,
                                                    u32 cookie, gfp_t gfp);
 
 /* fanotify likes to change events after they are on lists... */
@@ -389,7 +414,7 @@ extern int fsnotify_replace_event(struct fsnotify_event_holder *old_holder,
 #else
 
 static inline void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
-                           const char *name, u32 cookie)
+                           const unsigned char *name, u32 cookie)
 {}
 
 static inline void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask)
@@ -398,6 +423,9 @@ static inline void __fsnotify_parent(struct path *path, struct dentry *dentry, _
 static inline void __fsnotify_inode_delete(struct inode *inode)
 {}
 
+static inline void __fsnotify_vfsmount_delete(struct vfsmount *mnt)
+{}
+
 static inline void __fsnotify_update_dcache_flags(struct dentry *dentry)
 {}