mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
8112e2d6a7
commit
2a12a9d781
6 changed files with 20 additions and 18 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue