From: Eric Paris <eparis@redhat.com>
To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: viro@zeniv.linux.org.uk, hch@infradead.org, agruen@suse.de,
eparis@redhat.com
Subject: [PATCH 1/4] fanotify: create_fd cleanup
Date: Wed, 02 Dec 2009 09:14:52 -0500 [thread overview]
Message-ID: <20091202141452.12819.93536.stgit@paris.rdu.redhat.com> (raw)
From: Andreas Gruenbacher <agruen@suse.de>
Code cleanup which does the fd creation work seperately from the userspace
metadata creation. It fits better with the other code.
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Eric Paris <eparis@redhat.com>
---
fs/notify/fanotify/fanotify_user.c | 17 ++++++-----------
1 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index c5f59d8..7646111 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -44,17 +44,14 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
return fsnotify_remove_notify_event(group);
}
-static int create_and_fill_fd(struct fsnotify_group *group,
- struct fanotify_event_metadata *metadata,
- struct fsnotify_event *event)
+static int create_fd(struct fsnotify_group *group, struct fsnotify_event *event)
{
int client_fd, err;
struct dentry *dentry;
struct vfsmount *mnt;
struct file *new_file;
- pr_debug("%s: group=%p metadata=%p event=%p\n", __func__, group,
- metadata, event);
+ pr_debug("%s: group=%p event=%p\n", __func__, group, event);
client_fd = get_unused_fd();
if (client_fd < 0)
@@ -98,9 +95,7 @@ static int create_and_fill_fd(struct fsnotify_group *group,
fd_install(client_fd, new_file);
}
- metadata->fd = client_fd;
-
- return 0;
+ return client_fd;
}
static ssize_t fill_event_metadata(struct fsnotify_group *group,
@@ -113,9 +108,9 @@ static ssize_t fill_event_metadata(struct fsnotify_group *group,
metadata->event_len = FAN_EVENT_METADATA_LEN;
metadata->vers = FANOTIFY_METADATA_VERSION;
metadata->mask = fanotify_outgoing_mask(event->mask);
+ metadata->fd = create_fd(group, event);
- return create_and_fill_fd(group, metadata, event);
-
+ return metadata->fd;
}
static ssize_t copy_event_to_user(struct fsnotify_group *group,
@@ -128,7 +123,7 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
pr_debug("%s: group=%p event=%p\n", __func__, group, event);
ret = fill_event_metadata(group, &fanotify_event_metadata, event);
- if (ret)
+ if (ret < 0)
return ret;
if (copy_to_user(buf, &fanotify_event_metadata, FAN_EVENT_METADATA_LEN))
next reply other threads:[~2009-12-02 14:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-02 14:14 Eric Paris [this message]
2009-12-02 14:14 ` [PATCH 2/4] fanotify: Add pids to events Eric Paris
2010-01-15 4:41 ` Matthew Helsley
[not found] ` <6a12d2f31001142041j7f917b07l1e1a728790175321-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-15 15:12 ` Andreas Gruenbacher
2010-01-15 21:21 ` Matt Helsley
2010-01-16 22:53 ` Andreas Gruenbacher
2010-01-17 3:44 ` Matt Helsley
2009-12-02 14:15 ` [PATCH 3/4] fsnotify: split generic and inode specific mark code Eric Paris
2009-12-02 14:15 ` [PATCH 4/4] fsnotify: clear marks to 0 in fsnotify_init_mark Eric Paris
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=20091202141452.12819.93536.stgit@paris.rdu.redhat.com \
--to=eparis@redhat.com \
--cc=agruen@suse.de \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).