aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fsnotify.h
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2009-12-17 21:24:24 -0500
committerEric Paris <eparis@redhat.com>2010-07-28 09:58:53 -0400
commit72acc854427948efed7a83da27f7dc3239ac9afc (patch)
tree69a8f479a644701a52abe07d7bf2751cdf4cc159 /include/linux/fsnotify.h
parent098cf2fc77ee190c92bf9d08d69a13305f2487ec (diff)
fsnotify: kill FSNOTIFY_EVENT_FILE
Some fsnotify operations send a struct file. This is more information than we technically need. We instead send a struct path in all cases instead of sometimes a path and sometimes a file. Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'include/linux/fsnotify.h')
-rw-r--r--include/linux/fsnotify.h36
1 files changed, 19 insertions, 17 deletions
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 04ea03ea8090..06d296d85ebf 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -26,14 +26,12 @@ static inline void fsnotify_d_instantiate(struct dentry *entry,
26} 26}
27 27
28/* Notify this dentry's parent about a child's events. */ 28/* Notify this dentry's parent about a child's events. */
29static inline void fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask) 29static inline void fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask)
30{ 30{
31 BUG_ON(file && dentry); 31 if (!dentry)
32 dentry = path->dentry;
32 33
33 if (file) 34 __fsnotify_parent(path, dentry, mask);
34 dentry = file->f_path.dentry;
35
36 __fsnotify_parent(file, dentry, mask);
37} 35}
38 36
39/* 37/*
@@ -160,14 +158,15 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
160 */ 158 */
161static inline void fsnotify_access(struct file *file) 159static inline void fsnotify_access(struct file *file)
162{ 160{
163 struct inode *inode = file->f_path.dentry->d_inode; 161 struct path *path = &file->f_path;
162 struct inode *inode = path->dentry->d_inode;
164 __u32 mask = FS_ACCESS; 163 __u32 mask = FS_ACCESS;
165 164
166 if (S_ISDIR(inode->i_mode)) 165 if (S_ISDIR(inode->i_mode))
167 mask |= FS_IN_ISDIR; 166 mask |= FS_IN_ISDIR;
168 167
169 fsnotify_parent(file, NULL, mask); 168 fsnotify_parent(path, NULL, mask);
170 fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); 169 fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
171} 170}
172 171
173/* 172/*
@@ -175,14 +174,15 @@ static inline void fsnotify_access(struct file *file)
175 */ 174 */
176static inline void fsnotify_modify(struct file *file) 175static inline void fsnotify_modify(struct file *file)
177{ 176{
178 struct inode *inode = file->f_path.dentry->d_inode; 177 struct path *path = &file->f_path;
178 struct inode *inode = path->dentry->d_inode;
179 __u32 mask = FS_MODIFY; 179 __u32 mask = FS_MODIFY;
180 180
181 if (S_ISDIR(inode->i_mode)) 181 if (S_ISDIR(inode->i_mode))
182 mask |= FS_IN_ISDIR; 182 mask |= FS_IN_ISDIR;
183 183
184 fsnotify_parent(file, NULL, mask); 184 fsnotify_parent(path, NULL, mask);
185 fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); 185 fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
186} 186}
187 187
188/* 188/*
@@ -190,14 +190,15 @@ static inline void fsnotify_modify(struct file *file)
190 */ 190 */
191static inline void fsnotify_open(struct file *file) 191static inline void fsnotify_open(struct file *file)
192{ 192{
193 struct inode *inode = file->f_path.dentry->d_inode; 193 struct path *path = &file->f_path;
194 struct inode *inode = path->dentry->d_inode;
194 __u32 mask = FS_OPEN; 195 __u32 mask = FS_OPEN;
195 196
196 if (S_ISDIR(inode->i_mode)) 197 if (S_ISDIR(inode->i_mode))
197 mask |= FS_IN_ISDIR; 198 mask |= FS_IN_ISDIR;
198 199
199 fsnotify_parent(file, NULL, mask); 200 fsnotify_parent(path, NULL, mask);
200 fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); 201 fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
201} 202}
202 203
203/* 204/*
@@ -205,6 +206,7 @@ static inline void fsnotify_open(struct file *file)
205 */ 206 */
206static inline void fsnotify_close(struct file *file) 207static inline void fsnotify_close(struct file *file)
207{ 208{
209 struct path *path = &file->f_path;
208 struct inode *inode = file->f_path.dentry->d_inode; 210 struct inode *inode = file->f_path.dentry->d_inode;
209 fmode_t mode = file->f_mode; 211 fmode_t mode = file->f_mode;
210 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE; 212 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE;
@@ -212,8 +214,8 @@ static inline void fsnotify_close(struct file *file)
212 if (S_ISDIR(inode->i_mode)) 214 if (S_ISDIR(inode->i_mode))
213 mask |= FS_IN_ISDIR; 215 mask |= FS_IN_ISDIR;
214 216
215 fsnotify_parent(file, NULL, mask); 217 fsnotify_parent(path, NULL, mask);
216 fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); 218 fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
217} 219}
218 220
219/* 221/*