diff options
author | Cyrill Gorcunov <gorcunov@openvz.org> | 2012-12-17 19:04:55 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-17 20:15:27 -0500 |
commit | 55985dd72ab27b47530dcc8bdddd28b69f4abe8b (patch) | |
tree | 9117b3f9bc9d46fe89ee3eccc959bab9b0e9db7b | |
parent | 2bf1cbf1c616b4dd85a3a8a715af9c5701c16a91 (diff) |
procfs: add ability to plug in auxiliary fdinfo providers
This patch brings ability to print out auxiliary data associated with
file in procfs interface /proc/pid/fdinfo/fd.
In particular further patches make eventfd, evenpoll, signalfd and
fsnotify to print additional information complete enough to restore
these objects after checkpoint.
To simplify the code we add show_fdinfo callback inside struct
file_operations (as Al and Pavel are proposing).
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>
-rw-r--r-- | fs/proc/fd.c | 2 | ||||
-rw-r--r-- | include/linux/fs.h | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/fs/proc/fd.c b/fs/proc/fd.c index f28a875f877..d7a4a28ef63 100644 --- a/fs/proc/fd.c +++ b/fs/proc/fd.c | |||
@@ -50,6 +50,8 @@ static int seq_show(struct seq_file *m, void *v) | |||
50 | if (!ret) { | 50 | if (!ret) { |
51 | seq_printf(m, "pos:\t%lli\nflags:\t0%o\n", | 51 | seq_printf(m, "pos:\t%lli\nflags:\t0%o\n", |
52 | (long long)file->f_pos, f_flags); | 52 | (long long)file->f_pos, f_flags); |
53 | if (file->f_op->show_fdinfo) | ||
54 | ret = file->f_op->show_fdinfo(m, file); | ||
53 | fput(file); | 55 | fput(file); |
54 | } | 56 | } |
55 | 57 | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index 029552ff774..5abf703d06b 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -44,6 +44,7 @@ struct vm_area_struct; | |||
44 | struct vfsmount; | 44 | struct vfsmount; |
45 | struct cred; | 45 | struct cred; |
46 | struct swap_info_struct; | 46 | struct swap_info_struct; |
47 | struct seq_file; | ||
47 | 48 | ||
48 | extern void __init inode_init(void); | 49 | extern void __init inode_init(void); |
49 | extern void __init inode_init_early(void); | 50 | extern void __init inode_init_early(void); |
@@ -1543,6 +1544,7 @@ struct file_operations { | |||
1543 | int (*setlease)(struct file *, long, struct file_lock **); | 1544 | int (*setlease)(struct file *, long, struct file_lock **); |
1544 | long (*fallocate)(struct file *file, int mode, loff_t offset, | 1545 | long (*fallocate)(struct file *file, int mode, loff_t offset, |
1545 | loff_t len); | 1546 | loff_t len); |
1547 | int (*show_fdinfo)(struct seq_file *m, struct file *f); | ||
1546 | }; | 1548 | }; |
1547 | 1549 | ||
1548 | struct inode_operations { | 1550 | struct inode_operations { |
@@ -1578,8 +1580,6 @@ struct inode_operations { | |||
1578 | umode_t create_mode, int *opened); | 1580 | umode_t create_mode, int *opened); |
1579 | } ____cacheline_aligned; | 1581 | } ____cacheline_aligned; |
1580 | 1582 | ||
1581 | struct seq_file; | ||
1582 | |||
1583 | ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, | 1583 | ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, |
1584 | unsigned long nr_segs, unsigned long fast_segs, | 1584 | unsigned long nr_segs, unsigned long fast_segs, |
1585 | struct iovec *fast_pointer, | 1585 | struct iovec *fast_pointer, |