diff options
author | Andreas Gruenbacher <agruen@suse.de> | 2009-12-17 21:24:24 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-07-28 09:58:53 -0400 |
commit | 72acc854427948efed7a83da27f7dc3239ac9afc (patch) | |
tree | 69a8f479a644701a52abe07d7bf2751cdf4cc159 /include/linux | |
parent | 098cf2fc77ee190c92bf9d08d69a13305f2487ec (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')
-rw-r--r-- | include/linux/fsnotify.h | 36 | ||||
-rw-r--r-- | include/linux/fsnotify_backend.h | 5 |
2 files changed, 21 insertions, 20 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. */ |
29 | static inline void fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask) | 29 | static 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 | */ |
161 | static inline void fsnotify_access(struct file *file) | 159 | static 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 | */ |
176 | static inline void fsnotify_modify(struct file *file) | 175 | static 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 | */ |
191 | static inline void fsnotify_open(struct file *file) | 191 | static 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 | */ |
206 | static inline void fsnotify_close(struct file *file) | 207 | static 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 | /* |
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index cf165857199b..7a6ba755acc3 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
@@ -214,7 +214,6 @@ struct fsnotify_event { | |||
214 | #define FSNOTIFY_EVENT_NONE 0 | 214 | #define FSNOTIFY_EVENT_NONE 0 |
215 | #define FSNOTIFY_EVENT_PATH 1 | 215 | #define FSNOTIFY_EVENT_PATH 1 |
216 | #define FSNOTIFY_EVENT_INODE 2 | 216 | #define FSNOTIFY_EVENT_INODE 2 |
217 | #define FSNOTIFY_EVENT_FILE 3 | ||
218 | int data_type; /* which of the above union we have */ | 217 | int data_type; /* which of the above union we have */ |
219 | atomic_t refcnt; /* how many groups still are using/need to send this event */ | 218 | atomic_t refcnt; /* how many groups still are using/need to send this event */ |
220 | __u32 mask; /* the type of access, bitwise OR for FS_* event types */ | 219 | __u32 mask; /* the type of access, bitwise OR for FS_* event types */ |
@@ -280,7 +279,7 @@ struct fsnotify_mark_entry { | |||
280 | /* main fsnotify call to send events */ | 279 | /* main fsnotify call to send events */ |
281 | extern void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, | 280 | extern void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, |
282 | const char *name, u32 cookie); | 281 | const char *name, u32 cookie); |
283 | extern void __fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask); | 282 | extern void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask); |
284 | extern void __fsnotify_inode_delete(struct inode *inode); | 283 | extern void __fsnotify_inode_delete(struct inode *inode); |
285 | extern u32 fsnotify_get_cookie(void); | 284 | extern u32 fsnotify_get_cookie(void); |
286 | 285 | ||
@@ -393,7 +392,7 @@ static inline void fsnotify(struct inode *to_tell, __u32 mask, void *data, int d | |||
393 | const char *name, u32 cookie) | 392 | const char *name, u32 cookie) |
394 | {} | 393 | {} |
395 | 394 | ||
396 | static inline void __fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask) | 395 | static inline void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask) |
397 | {} | 396 | {} |
398 | 397 | ||
399 | static inline void __fsnotify_inode_delete(struct inode *inode) | 398 | static inline void __fsnotify_inode_delete(struct inode *inode) |