diff options
author | Amy Griffis <amy.griffis@hp.com> | 2006-06-01 16:11:01 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2006-06-20 05:25:18 -0400 |
commit | 7c29772288b7026504cfe75bfd90d40fbd1574bf (patch) | |
tree | dfc0cfef97c4c5fdbd87bbd9abdbf44bcd21c906 /include | |
parent | 2d9048e201bfb67ba21f05e647b1286b8a4a5667 (diff) |
[PATCH] inotify (2/5): add name's inode to event handler
When an inotify event includes a dentry name, also include the inode
associated with that name.
Signed-off-by: Amy Griffis <amy.griffis@hp.com>
Acked-by: Robert Love <rml@novell.com>
Acked-by: John McCutchan <john@johnmccutchan.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/fsnotify.h | 29 | ||||
-rw-r--r-- | include/linux/inotify.h | 7 |
2 files changed, 20 insertions, 16 deletions
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 11438eff4d44..a9d30442448f 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h | |||
@@ -54,16 +54,18 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, | |||
54 | 54 | ||
55 | if (isdir) | 55 | if (isdir) |
56 | isdir = IN_ISDIR; | 56 | isdir = IN_ISDIR; |
57 | inotify_inode_queue_event(old_dir, IN_MOVED_FROM|isdir,cookie,old_name); | 57 | inotify_inode_queue_event(old_dir, IN_MOVED_FROM|isdir,cookie,old_name, |
58 | inotify_inode_queue_event(new_dir, IN_MOVED_TO|isdir, cookie, new_name); | 58 | source); |
59 | inotify_inode_queue_event(new_dir, IN_MOVED_TO|isdir, cookie, new_name, | ||
60 | source); | ||
59 | 61 | ||
60 | if (target) { | 62 | if (target) { |
61 | inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL); | 63 | inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL, NULL); |
62 | inotify_inode_is_dead(target); | 64 | inotify_inode_is_dead(target); |
63 | } | 65 | } |
64 | 66 | ||
65 | if (source) { | 67 | if (source) { |
66 | inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL); | 68 | inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL); |
67 | } | 69 | } |
68 | audit_inode_child(old_name, source, old_dir->i_ino); | 70 | audit_inode_child(old_name, source, old_dir->i_ino); |
69 | audit_inode_child(new_name, target, new_dir->i_ino); | 71 | audit_inode_child(new_name, target, new_dir->i_ino); |
@@ -85,7 +87,7 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) | |||
85 | */ | 87 | */ |
86 | static inline void fsnotify_inoderemove(struct inode *inode) | 88 | static inline void fsnotify_inoderemove(struct inode *inode) |
87 | { | 89 | { |
88 | inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL); | 90 | inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL, NULL); |
89 | inotify_inode_is_dead(inode); | 91 | inotify_inode_is_dead(inode); |
90 | } | 92 | } |
91 | 93 | ||
@@ -95,7 +97,8 @@ static inline void fsnotify_inoderemove(struct inode *inode) | |||
95 | static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) | 97 | static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) |
96 | { | 98 | { |
97 | inode_dir_notify(inode, DN_CREATE); | 99 | inode_dir_notify(inode, DN_CREATE); |
98 | inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name); | 100 | inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name, |
101 | dentry->d_inode); | ||
99 | audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino); | 102 | audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino); |
100 | } | 103 | } |
101 | 104 | ||
@@ -106,7 +109,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) | |||
106 | { | 109 | { |
107 | inode_dir_notify(inode, DN_CREATE); | 110 | inode_dir_notify(inode, DN_CREATE); |
108 | inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0, | 111 | inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0, |
109 | dentry->d_name.name); | 112 | dentry->d_name.name, dentry->d_inode); |
110 | audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino); | 113 | audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino); |
111 | } | 114 | } |
112 | 115 | ||
@@ -123,7 +126,7 @@ static inline void fsnotify_access(struct dentry *dentry) | |||
123 | 126 | ||
124 | dnotify_parent(dentry, DN_ACCESS); | 127 | dnotify_parent(dentry, DN_ACCESS); |
125 | inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); | 128 | inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); |
126 | inotify_inode_queue_event(inode, mask, 0, NULL); | 129 | inotify_inode_queue_event(inode, mask, 0, NULL, NULL); |
127 | } | 130 | } |
128 | 131 | ||
129 | /* | 132 | /* |
@@ -139,7 +142,7 @@ static inline void fsnotify_modify(struct dentry *dentry) | |||
139 | 142 | ||
140 | dnotify_parent(dentry, DN_MODIFY); | 143 | dnotify_parent(dentry, DN_MODIFY); |
141 | inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); | 144 | inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); |
142 | inotify_inode_queue_event(inode, mask, 0, NULL); | 145 | inotify_inode_queue_event(inode, mask, 0, NULL, NULL); |
143 | } | 146 | } |
144 | 147 | ||
145 | /* | 148 | /* |
@@ -154,7 +157,7 @@ static inline void fsnotify_open(struct dentry *dentry) | |||
154 | mask |= IN_ISDIR; | 157 | mask |= IN_ISDIR; |
155 | 158 | ||
156 | inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); | 159 | inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); |
157 | inotify_inode_queue_event(inode, mask, 0, NULL); | 160 | inotify_inode_queue_event(inode, mask, 0, NULL, NULL); |
158 | } | 161 | } |
159 | 162 | ||
160 | /* | 163 | /* |
@@ -172,7 +175,7 @@ static inline void fsnotify_close(struct file *file) | |||
172 | mask |= IN_ISDIR; | 175 | mask |= IN_ISDIR; |
173 | 176 | ||
174 | inotify_dentry_parent_queue_event(dentry, mask, 0, name); | 177 | inotify_dentry_parent_queue_event(dentry, mask, 0, name); |
175 | inotify_inode_queue_event(inode, mask, 0, NULL); | 178 | inotify_inode_queue_event(inode, mask, 0, NULL, NULL); |
176 | } | 179 | } |
177 | 180 | ||
178 | /* | 181 | /* |
@@ -187,7 +190,7 @@ static inline void fsnotify_xattr(struct dentry *dentry) | |||
187 | mask |= IN_ISDIR; | 190 | mask |= IN_ISDIR; |
188 | 191 | ||
189 | inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); | 192 | inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); |
190 | inotify_inode_queue_event(inode, mask, 0, NULL); | 193 | inotify_inode_queue_event(inode, mask, 0, NULL, NULL); |
191 | } | 194 | } |
192 | 195 | ||
193 | /* | 196 | /* |
@@ -234,7 +237,7 @@ static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid) | |||
234 | if (in_mask) { | 237 | if (in_mask) { |
235 | if (S_ISDIR(inode->i_mode)) | 238 | if (S_ISDIR(inode->i_mode)) |
236 | in_mask |= IN_ISDIR; | 239 | in_mask |= IN_ISDIR; |
237 | inotify_inode_queue_event(inode, in_mask, 0, NULL); | 240 | inotify_inode_queue_event(inode, in_mask, 0, NULL, NULL); |
238 | inotify_dentry_parent_queue_event(dentry, in_mask, 0, | 241 | inotify_dentry_parent_queue_event(dentry, in_mask, 0, |
239 | dentry->d_name.name); | 242 | dentry->d_name.name); |
240 | } | 243 | } |
diff --git a/include/linux/inotify.h b/include/linux/inotify.h index 68b6e0127de4..e7899e7d83ad 100644 --- a/include/linux/inotify.h +++ b/include/linux/inotify.h | |||
@@ -91,7 +91,7 @@ struct inotify_watch { | |||
91 | 91 | ||
92 | struct inotify_operations { | 92 | struct inotify_operations { |
93 | void (*handle_event)(struct inotify_watch *, u32, u32, u32, | 93 | void (*handle_event)(struct inotify_watch *, u32, u32, u32, |
94 | const char *); | 94 | const char *, struct inode *); |
95 | void (*destroy_watch)(struct inotify_watch *); | 95 | void (*destroy_watch)(struct inotify_watch *); |
96 | }; | 96 | }; |
97 | 97 | ||
@@ -102,7 +102,7 @@ struct inotify_operations { | |||
102 | extern void inotify_d_instantiate(struct dentry *, struct inode *); | 102 | extern void inotify_d_instantiate(struct dentry *, struct inode *); |
103 | extern void inotify_d_move(struct dentry *); | 103 | extern void inotify_d_move(struct dentry *); |
104 | extern void inotify_inode_queue_event(struct inode *, __u32, __u32, | 104 | extern void inotify_inode_queue_event(struct inode *, __u32, __u32, |
105 | const char *); | 105 | const char *, struct inode *); |
106 | extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32, | 106 | extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32, |
107 | const char *); | 107 | const char *); |
108 | extern void inotify_unmount_inodes(struct list_head *); | 108 | extern void inotify_unmount_inodes(struct list_head *); |
@@ -134,7 +134,8 @@ static inline void inotify_d_move(struct dentry *dentry) | |||
134 | 134 | ||
135 | static inline void inotify_inode_queue_event(struct inode *inode, | 135 | static inline void inotify_inode_queue_event(struct inode *inode, |
136 | __u32 mask, __u32 cookie, | 136 | __u32 mask, __u32 cookie, |
137 | const char *filename) | 137 | const char *filename, |
138 | struct inode *n_inode) | ||
138 | { | 139 | { |
139 | } | 140 | } |
140 | 141 | ||