mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: cdahlin@redhat.com
To: linux-kernel@vger.kernel.org
Cc: Casey Dahlin <cdahlin@redhat.com>,
	John McCutchan <john@johnmccutchan.com>,
	Robert Love <rlove@rlove.org>, Eric Paris <eparis@parisplace.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	"Eric W. Biederman" <ebiederm@xmission.com>
Subject: [PATCH 1/3] Introduce inotify_add_watch_at system call
Date: Wed, 22 Sep 2010 01:16:56 -0400	[thread overview]
Message-ID: <1285132618-31573-2-git-send-email-cdahlin@redhat.com> (raw)
In-Reply-To: <1285132618-31573-1-git-send-email-cdahlin@redhat.com>

From: Casey Dahlin <cdahlin@redhat.com>

This adds inotify to the *at family of system calls (openat(2), unlinkat(2),
etc) and lets you specify a directory file descriptor as a root for the
pathname argument. It is otherwise the same as the inotify_add_watch system
call.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
---
 fs/notify/inotify/inotify_user.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index bf7f6d7..ed110ca 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -108,7 +108,7 @@ static inline u32 inotify_mask_to_arg(__u32 mask)
 		       IN_Q_OVERFLOW);
 }
 
-/* intofiy userspace file descriptor functions */
+/* inotfiy userspace file descriptor functions */
 static unsigned int inotify_poll(struct file *file, poll_table *wait)
 {
 	struct fsnotify_group *group = file->private_data;
@@ -350,11 +350,11 @@ static const struct file_operations inotify_fops = {
 /*
  * find_inode - resolve a user-given path to a specific inode
  */
-static int inotify_find_inode(const char __user *dirname, struct path *path, unsigned flags)
+static int inotify_find_inode(int dfd, const char __user *dirname, struct path *path, unsigned flags)
 {
 	int error;
 
-	error = user_path_at(AT_FDCWD, dirname, flags, path);
+	error = user_path_at(dfd, dirname, flags, path);
 	if (error)
 		return error;
 	/* you can only watch an inode if you have read permissions on it */
@@ -762,8 +762,8 @@ SYSCALL_DEFINE0(inotify_init)
 	return sys_inotify_init1(0);
 }
 
-SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
-		u32, mask)
+SYSCALL_DEFINE4(inotify_add_watch_at, int, fd, int, dfd, const char __user *,
+		pathname, u32, mask)
 {
 	struct fsnotify_group *group;
 	struct inode *inode;
@@ -787,7 +787,7 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
 	if (mask & IN_ONLYDIR)
 		flags |= LOOKUP_DIRECTORY;
 
-	ret = inotify_find_inode(pathname, &path, flags);
+	ret = inotify_find_inode(dfd, pathname, &path, flags);
 	if (ret)
 		goto fput_and_out;
 
@@ -803,6 +803,12 @@ fput_and_out:
 	return ret;
 }
 
+SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
+		u32, mask)
+{
+	return sys_inotify_add_watch_at(fd, AT_FDCWD, pathname, mask);
+}
+
 SYSCALL_DEFINE2(inotify_rm_watch, int, fd, __s32, wd)
 {
 	struct fsnotify_group *group;
-- 
1.7.2.3


  reply	other threads:[~2010-09-22  5:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-22  5:16 [PATCH 0/3] inotify_add_watch_at cdahlin
2010-09-22  5:16 ` cdahlin [this message]
2010-09-22  5:16 ` [PATCH 2/3] Add inotify_add_watch_at to asm-generic/unistd.h cdahlin
2010-09-22  5:16 ` [PATCH 3/3] hook up inotify_add_watch_at for x86 cdahlin
2010-09-23 21:37 ` [PATCH 0/3] inotify_add_watch_at Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1285132618-31573-2-git-send-email-cdahlin@redhat.com \
    --to=cdahlin@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=eparis@parisplace.org \
    --cc=john@johnmccutchan.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rlove@rlove.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®