diff options
author | Eric Paris <eparis@redhat.com> | 2009-12-17 21:24:21 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-07-28 09:58:32 -0400 |
commit | 2a12a9d7814631e918dec93abad856e692d5286d (patch) | |
tree | 12817004ae9667bf83f869606f38050636edeb61 /include/linux/fsnotify.h | |
parent | 8112e2d6a7356e8c3ff1f7f3c86f375ed0305705 (diff) |
fsnotify: pass a file instead of an inode to open, read, and write
fanotify, the upcoming notification system actually needs a struct path so it can
do opens in the context of listeners, and it needs a file so it can get f_flags
from the original process. Close was the only operation that already was passing
a struct file to the notification hook. This patch passes a file for access,
modify, and open as well as they are easily available to these hooks.
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'include/linux/fsnotify.h')
-rw-r--r-- | include/linux/fsnotify.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index f958e93feb97..845e57abfb86 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h | |||
@@ -153,8 +153,9 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) | |||
153 | /* | 153 | /* |
154 | * fsnotify_access - file was read | 154 | * fsnotify_access - file was read |
155 | */ | 155 | */ |
156 | static inline void fsnotify_access(struct dentry *dentry) | 156 | static inline void fsnotify_access(struct file *file) |
157 | { | 157 | { |
158 | struct dentry *dentry = file->f_path.dentry; | ||
158 | struct inode *inode = dentry->d_inode; | 159 | struct inode *inode = dentry->d_inode; |
159 | __u32 mask = FS_ACCESS; | 160 | __u32 mask = FS_ACCESS; |
160 | 161 | ||
@@ -162,14 +163,15 @@ static inline void fsnotify_access(struct dentry *dentry) | |||
162 | mask |= FS_IN_ISDIR; | 163 | mask |= FS_IN_ISDIR; |
163 | 164 | ||
164 | fsnotify_parent(dentry, mask); | 165 | fsnotify_parent(dentry, mask); |
165 | fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); | 166 | fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); |
166 | } | 167 | } |
167 | 168 | ||
168 | /* | 169 | /* |
169 | * fsnotify_modify - file was modified | 170 | * fsnotify_modify - file was modified |
170 | */ | 171 | */ |
171 | static inline void fsnotify_modify(struct dentry *dentry) | 172 | static inline void fsnotify_modify(struct file *file) |
172 | { | 173 | { |
174 | struct dentry *dentry = file->f_path.dentry; | ||
173 | struct inode *inode = dentry->d_inode; | 175 | struct inode *inode = dentry->d_inode; |
174 | __u32 mask = FS_MODIFY; | 176 | __u32 mask = FS_MODIFY; |
175 | 177 | ||
@@ -177,14 +179,15 @@ static inline void fsnotify_modify(struct dentry *dentry) | |||
177 | mask |= FS_IN_ISDIR; | 179 | mask |= FS_IN_ISDIR; |
178 | 180 | ||
179 | fsnotify_parent(dentry, mask); | 181 | fsnotify_parent(dentry, mask); |
180 | fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); | 182 | fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); |
181 | } | 183 | } |
182 | 184 | ||
183 | /* | 185 | /* |
184 | * fsnotify_open - file was opened | 186 | * fsnotify_open - file was opened |
185 | */ | 187 | */ |
186 | static inline void fsnotify_open(struct dentry *dentry) | 188 | static inline void fsnotify_open(struct file *file) |
187 | { | 189 | { |
190 | struct dentry *dentry = file->f_path.dentry; | ||
188 | struct inode *inode = dentry->d_inode; | 191 | struct inode *inode = dentry->d_inode; |
189 | __u32 mask = FS_OPEN; | 192 | __u32 mask = FS_OPEN; |
190 | 193 | ||
@@ -192,7 +195,7 @@ static inline void fsnotify_open(struct dentry *dentry) | |||
192 | mask |= FS_IN_ISDIR; | 195 | mask |= FS_IN_ISDIR; |
193 | 196 | ||
194 | fsnotify_parent(dentry, mask); | 197 | fsnotify_parent(dentry, mask); |
195 | fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); | 198 | fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); |
196 | } | 199 | } |
197 | 200 | ||
198 | /* | 201 | /* |