Preparing for inotify_add_watch_at().
To: Jan Kara <jack@suse.cz>
Cc: Amir Goldstein <amir73il@gmail.com>
To: linux-fsdevel@vger.kernel.org
To: linux-kernel@vger.kernel.org
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
fs/notify/inotify/inotify_user.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
@@ -727,8 +727,8 @@ SYSCALL_DEFINE0(inotify_init)
return do_inotify_init(0);
}
-SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
- u32, mask)
+static int do_inotify_add_watch(int fd, int dfd, const char __user *pathname,
+ u32 mask)
{
struct fsnotify_group *group;
struct inode *inode;
@@ -774,7 +774,7 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
if (mask & IN_ONLYDIR)
flags |= LOOKUP_DIRECTORY;
- ret = inotify_find_inode(AT_FDCWD, pathname, &path, flags,
+ ret = inotify_find_inode(dfd, pathname, &path, flags,
(mask & IN_ALL_EVENTS));
if (ret)
goto fput_and_out;
@@ -791,6 +791,12 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
return ret;
}
+SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
+ u32, mask)
+{
+ return do_inotify_add_watch(fd, AT_FDCWD, pathname, mask);
+}
+
SYSCALL_DEFINE2(inotify_rm_watch, int, fd, __s32, wd)
{
struct fsnotify_group *group;