aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/fs/notify/fanotify/fanotify.h
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2019-01-10 19:04:35 +0200
committerJan Kara <jack@suse.cz>2019-02-07 16:38:35 +0100
commit5e469c830fdb5a1ebaa69b375b87f583326fd296 (patch)
tree0c3ca43d6626960107108b2db0c93a17300ee0d9 /fs/notify/fanotify/fanotify.h
parentfanotify: encode file identifier for FAN_REPORT_FID (diff)
downloadwireguard-linux-5e469c830fdb5a1ebaa69b375b87f583326fd296.tar.xz
wireguard-linux-5e469c830fdb5a1ebaa69b375b87f583326fd296.zip
fanotify: copy event fid info to user
If group requested FAN_REPORT_FID and event has file identifier, copy that information to user reading the event after event metadata. fid information is formatted as struct fanotify_event_info_fid that includes a generic header struct fanotify_event_info_header, so that other info types could be defined in the future using the same header. metadata->event_len includes the length of the fid information. The fid information includes the filesystem's fsid (see statfs(2)) followed by an NFS file handle of the file that could be passed as an argument to open_by_handle_at(2). Cc: <linux-api@vger.kernel.org> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify/fanotify/fanotify.h')
-rw-r--r--fs/notify/fanotify/fanotify.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/notify/fanotify/fanotify.h b/fs/notify/fanotify/fanotify.h
index 271482fb9611..4aafc7144c3d 100644
--- a/fs/notify/fanotify/fanotify.h
+++ b/fs/notify/fanotify/fanotify.h
@@ -95,6 +95,11 @@ static inline bool fanotify_event_has_ext_fh(struct fanotify_event *event)
event->fh_len > FANOTIFY_INLINE_FH_LEN;
}
+static inline void *fanotify_event_fh(struct fanotify_event *event)
+{
+ return fanotify_fid_fh(&event->fid, event->fh_len);
+}
+
/*
* Structure for permission fanotify events. It gets allocated and freed in
* fanotify_handle_event() since we wait there for user response. When the