Skip to contentSkip to conversation

fanotify: fill in the metadata_len field on struct fanotify_event_metadata

PATCH In review Eric Paris 2 participants 2 messages Dec 7, 2010 – Dec 8, 2010

Subsystems (3)
lore
Share & tools
lore

Eric Paris

author
#0 lore raw

PATCH 1/1 fanotify: fill in the metadata_len field on struct fanotify_event_metadata

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.

---
 fs/notify/fanotify/fanotify_user.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
fs/notify/fanotify/fanotify_user.c +4 -2
index b2e8736..2d4925b 100644
@@ -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);
Signature · 1 line
1.7.1
#1 lore raw

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?

Quoted 34 lines · 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.

---
 fs/notify/fanotify/fanotify_user.c |    6 ++++--

 1 files changed, 4 insertions(+), 2 deletions(-)
fs/notify/fanotify/fanotify_user.c +4 -2
index b2e8736..2d4925b 100644
@@ -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;
 
Quoted 6 lines

 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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html