lkml.org 
[lkml]   [2008]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH -v2 16/16] fanotify: send file f_flags along with notifications
Date
fanotify listeners may be interested in what flags the file associated with
a particular event were set. This sends f_flags along with the event
metadata.

Signed-off-by: Eric Paris <eparis@redhat.com>
---
fs/notify/fanotify.h | 1 +
fs/notify/notification.c | 2 ++
include/linux/fanotify.h | 1 +
3 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/fs/notify/fanotify.h b/fs/notify/fanotify.h
index b45c145..5f774bd 100644
--- a/fs/notify/fanotify.h
+++ b/fs/notify/fanotify.h
@@ -50,6 +50,7 @@ struct fanotify_event {
unsigned long cookie;
pid_t pid; /* pid of the original process */
pid_t tgid; /* tgid of the original process */
+ unsigned int f_flags; /* f_flags from the original file */
spinlock_t response_lock; /* protects response */
unsigned int response; /* userspace answer to question */
};
diff --git a/fs/notify/notification.c b/fs/notify/notification.c
index acd13b0..4d1d046 100644
--- a/fs/notify/notification.c
+++ b/fs/notify/notification.c
@@ -183,6 +183,7 @@ struct fanotify_event *create_event(struct file *file, unsigned int mask)

event->pid = current->pid;
event->tgid = current->tgid;
+ event->f_flags = file->f_flags;

WARN_ON(!event->path.dentry);
WARN_ON(!event->path.mnt);
@@ -250,6 +251,7 @@ int fanotify_create_event_fd(struct fanotify_group *group, struct fanotify_event
data->cookie = event->cookie;
data->pid = event->pid;
data->tgid = event->tgid;
+ data->f_flags = event->f_flags;

fanotify_put_event(event);

diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h
index 711efa6..cecac79 100644
--- a/include/linux/fanotify.h
+++ b/include/linux/fanotify.h
@@ -73,6 +73,7 @@ struct fanotify_event_metadata {
uint64_t cookie;
pid_t pid;
pid_t tgid;
+ uint32_t f_flags;
};

/* fanotify getsockopt optvals */


\
 
 \ /
  Last update: 2008-10-14 22:59    [from the cache]
©2003-2011 Jasper Spaans