diff options
author | Cyrill Gorcunov <gorcunov@openvz.org> | 2012-12-17 19:05:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-17 20:15:28 -0500 |
commit | be77196b809cdce8603a5aadd5e3cfabd3cbef96 (patch) | |
tree | 9b0f464b4ab3521fc662f5af790c3dbd0c4f7453 /fs/notify/fdinfo.h | |
parent | 711c7bf9914060d7aaf3c1a15f38094a5d5e748f (diff) |
fs, notify: add procfs fdinfo helper
This allow us to print out fsnotify details such as watchee inode, device,
mask and optionally a file handle.
For inotify objects if kernel compiled with exportfs support the output
will be
| pos: 0
| flags: 02000000
| inotify wd:3 ino:9e7e sdev:800013 mask:800afce ignored_mask:0 fhandle-bytes:8 fhandle-type:1 f_handle:7e9e0000640d1b6d
| inotify wd:2 ino:a111 sdev:800013 mask:800afce ignored_mask:0 fhandle-bytes:8 fhandle-type:1 f_handle:11a1000020542153
| inotify wd:1 ino:6b149 sdev:800013 mask:800afce ignored_mask:0 fhandle-bytes:8 fhandle-type:1 f_handle:49b1060023552153
If kernel compiled without exportfs support, the file handle
won't be provided but inode and device only.
| pos: 0
| flags: 02000000
| inotify wd:3 ino:9e7e sdev:800013 mask:800afce ignored_mask:0
| inotify wd:2 ino:a111 sdev:800013 mask:800afce ignored_mask:0
| inotify wd:1 ino:6b149 sdev:800013 mask:800afce ignored_mask:0
For fanotify the output is like
| pos: 0
| flags: 04002
| fanotify flags:10 event-flags:0
| fanotify mnt_id:12 mask:3b ignored_mask:0
| fanotify ino:50205 sdev:800013 mask:3b ignored_mask:40000000 fhandle-bytes:8 fhandle-type:1 f_handle:05020500fb1d47e7
To minimize impact on general fsnotify code the new functionality
is gathered in fs/notify/fdinfo.c file.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andrey Vagin <avagin@openvz.org>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: James Bottomley <jbottomley@parallels.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Matthew Helsley <matt.helsley@gmail.com>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@onelan.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/notify/fdinfo.h')
-rw-r--r-- | fs/notify/fdinfo.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/fs/notify/fdinfo.h b/fs/notify/fdinfo.h new file mode 100644 index 000000000000..556afda990e9 --- /dev/null +++ b/fs/notify/fdinfo.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef __FSNOTIFY_FDINFO_H__ | ||
2 | #define __FSNOTIFY_FDINFO_H__ | ||
3 | |||
4 | #include <linux/errno.h> | ||
5 | #include <linux/proc_fs.h> | ||
6 | |||
7 | struct seq_file; | ||
8 | struct file; | ||
9 | |||
10 | #ifdef CONFIG_PROC_FS | ||
11 | |||
12 | #ifdef CONFIG_INOTIFY_USER | ||
13 | extern int inotify_show_fdinfo(struct seq_file *m, struct file *f); | ||
14 | #endif | ||
15 | |||
16 | #ifdef CONFIG_FANOTIFY | ||
17 | extern int fanotify_show_fdinfo(struct seq_file *m, struct file *f); | ||
18 | #endif | ||
19 | |||
20 | #else /* CONFIG_PROC_FS */ | ||
21 | |||
22 | #define inotify_show_fdinfo NULL | ||
23 | #define fanotify_show_fdinfo NULL | ||
24 | |||
25 | #endif /* CONFIG_PROC_FS */ | ||
26 | |||
27 | #endif /* __FSNOTIFY_FDINFO_H__ */ | ||