* [PATCH] fanotify: fill in the metadata_len field on struct fanotify_event_metadata
@ 2010-12-07 20:34 Eric Paris
2010-12-08 13:31 ` Alexey Zaytsev
0 siblings, 1 reply; 2+ messages in thread
From: Eric Paris @ 2010-12-07 20:34 UTC (permalink / raw)
To: linux-fsdevel; +Cc: alexey.zaytsev, Eric Paris
The fanotify_event_metadata now has a field which is supposed to
indicate the length of the metadata portion of the event. Fill in that
field as well.
Based-in-part-on-patch-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
---
fs/notify/fanotify/fanotify_user.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index b2e8736..2d4925b 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -127,6 +127,7 @@ static int fill_event_metadata(struct fsnotify_group *group,
group, metadata, event);
metadata->event_len = FAN_EVENT_METADATA_LEN;
+ metadata->metadata_len = FAN_EVENT_METADATA_LEN;
metadata->vers = FANOTIFY_METADATA_VERSION;
metadata->mask = event->mask & FAN_ALL_OUTGOING_EVENTS;
metadata->pid = pid_vnr(event->tgid);
@@ -278,10 +279,11 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
goto out_close_fd;
ret = -EFAULT;
- if (copy_to_user(buf, &fanotify_event_metadata, FAN_EVENT_METADATA_LEN))
+ if (copy_to_user(buf, &fanotify_event_metadata,
+ fanotify_event_metadata.event_len))
goto out_kill_access_response;
- return FAN_EVENT_METADATA_LEN;
+ return fanotify_event_metadata.event_len;
out_kill_access_response:
remove_access_response(group, event, fd);
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fanotify: fill in the metadata_len field on struct fanotify_event_metadata
2010-12-07 20:34 [PATCH] fanotify: fill in the metadata_len field on struct fanotify_event_metadata Eric Paris
@ 2010-12-08 13:31 ` Alexey Zaytsev
0 siblings, 0 replies; 2+ messages in thread
From: Alexey Zaytsev @ 2010-12-08 13:31 UTC (permalink / raw)
To: Eric Paris; +Cc: linux-fsdevel
Looks ok. Sorry for being a bit slow.
Did you like the FOR_EACH{EVENT,OPTIN} macros? If so, can we include
FOR_EACH_EVENT in the .37 release, so people could use it regardless
of the kernel version?
On Tue, Dec 7, 2010 at 23:34, Eric Paris <eparis@redhat.com> wrote:
> The fanotify_event_metadata now has a field which is supposed to
> indicate the length of the metadata portion of the event. Fill in that
> field as well.
>
> Based-in-part-on-patch-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
> Signed-off-by: Eric Paris <eparis@redhat.com>
> ---
> fs/notify/fanotify/fanotify_user.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
> index b2e8736..2d4925b 100644
> --- a/fs/notify/fanotify/fanotify_user.c
> +++ b/fs/notify/fanotify/fanotify_user.c
> @@ -127,6 +127,7 @@ static int fill_event_metadata(struct fsnotify_group *group,
> group, metadata, event);
>
> metadata->event_len = FAN_EVENT_METADATA_LEN;
> + metadata->metadata_len = FAN_EVENT_METADATA_LEN;
> metadata->vers = FANOTIFY_METADATA_VERSION;
> metadata->mask = event->mask & FAN_ALL_OUTGOING_EVENTS;
> metadata->pid = pid_vnr(event->tgid);
> @@ -278,10 +279,11 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
> goto out_close_fd;
>
> ret = -EFAULT;
> - if (copy_to_user(buf, &fanotify_event_metadata, FAN_EVENT_METADATA_LEN))
> + if (copy_to_user(buf, &fanotify_event_metadata,
> + fanotify_event_metadata.event_len))
> goto out_kill_access_response;
>
> - return FAN_EVENT_METADATA_LEN;
> + return fanotify_event_metadata.event_len;
>
> out_kill_access_response:
> remove_access_response(group, event, fd);
> --
> 1.7.1
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-12-08 13:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-07 20:34 [PATCH] fanotify: fill in the metadata_len field on struct fanotify_event_metadata Eric Paris
2010-12-08 13:31 ` Alexey Zaytsev
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).