From 2a12a9d7814631e918dec93abad856e692d5286d Mon Sep 17 00:00:00 2001 From: Eric Paris Date: Thu, 17 Dec 2009 21:24:21 -0500 Subject: 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 --- include/linux/fsnotify.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'include/linux/fsnotify.h') 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) /* * fsnotify_access - file was read */ -static inline void fsnotify_access(struct dentry *dentry) +static inline void fsnotify_access(struct file *file) { + struct dentry *dentry = file->f_path.dentry; struct inode *inode = dentry->d_inode; __u32 mask = FS_ACCESS; @@ -162,14 +163,15 @@ static inline void fsnotify_access(struct dentry *dentry) mask |= FS_IN_ISDIR; fsnotify_parent(dentry, mask); - fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); + fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); } /* * fsnotify_modify - file was modified */ -static inline void fsnotify_modify(struct dentry *dentry) +static inline void fsnotify_modify(struct file *file) { + struct dentry *dentry = file->f_path.dentry; struct inode *inode = dentry->d_inode; __u32 mask = FS_MODIFY; @@ -177,14 +179,15 @@ static inline void fsnotify_modify(struct dentry *dentry) mask |= FS_IN_ISDIR; fsnotify_parent(dentry, mask); - fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); + fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); } /* * fsnotify_open - file was opened */ -static inline void fsnotify_open(struct dentry *dentry) +static inline void fsnotify_open(struct file *file) { + struct dentry *dentry = file->f_path.dentry; struct inode *inode = dentry->d_inode; __u32 mask = FS_OPEN; @@ -192,7 +195,7 @@ static inline void fsnotify_open(struct dentry *dentry) mask |= FS_IN_ISDIR; fsnotify_parent(dentry, mask); - fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); + fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); } /* -- cgit v1.2.2