[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230918123217.932179-2-max.kellermann@ionos.com>
Date: Mon, 18 Sep 2023 14:32:15 +0200
From: Max Kellermann <max.kellermann@...os.com>
To: jack@...e.cz, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: amir73il@...il.com, max.kellermann@...os.com
Subject: [PATCH 2/4] inotify_user: move code to do_inotify_add_watch()
Preparing for inotify_add_watch_at().
To: Jan Kara <jack@...e.cz>
Cc: Amir Goldstein <amir73il@...il.com>
To: linux-fsdevel@...r.kernel.org
To: linux-kernel@...r.kernel.org
Signed-off-by: Max Kellermann <max.kellermann@...os.com>
---
fs/notify/inotify/inotify_user.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 1853439a24f6..b6e6f6ab21f8 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -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;
--
2.39.2
Powered by blists - more mailing lists