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:
@@ -311,7 +311,7 @@ ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
|
||||
else
|
||||
ret = do_sync_read(file, buf, count, pos);
|
||||
if (ret > 0) {
|
||||
fsnotify_access(file->f_path.dentry);
|
||||
fsnotify_access(file);
|
||||
add_rchar(current, ret);
|
||||
}
|
||||
inc_syscr(current);
|
||||
@@ -367,7 +367,7 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_
|
||||
else
|
||||
ret = do_sync_write(file, buf, count, pos);
|
||||
if (ret > 0) {
|
||||
fsnotify_modify(file->f_path.dentry);
|
||||
fsnotify_modify(file);
|
||||
add_wchar(current, ret);
|
||||
}
|
||||
inc_syscw(current);
|
||||
@@ -675,9 +675,9 @@ out:
|
||||
kfree(iov);
|
||||
if ((ret + (type == READ)) > 0) {
|
||||
if (type == READ)
|
||||
fsnotify_access(file->f_path.dentry);
|
||||
fsnotify_access(file);
|
||||
else
|
||||
fsnotify_modify(file->f_path.dentry);
|
||||
fsnotify_modify(file);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user