]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
procfs: add ability to plug in auxiliary fdinfo providers
authorCyrill Gorcunov <gorcunov@openvz.org>
Thu, 29 Nov 2012 03:19:17 +0000 (14:19 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 5 Dec 2012 05:23:57 +0000 (16:23 +1100)
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>
fs/proc/fd.c
include/linux/fs.h

index f28a875f8779f8cd1fec3ff8869eb4b2d802764c..d7a4a28ef63024c66ef862594701d1e389e77a47 100644 (file)
@@ -50,6 +50,8 @@ static int seq_show(struct seq_file *m, void *v)
        if (!ret) {
                 seq_printf(m, "pos:\t%lli\nflags:\t0%o\n",
                           (long long)file->f_pos, f_flags);
+               if (file->f_op->show_fdinfo)
+                       ret = file->f_op->show_fdinfo(m, file);
                fput(file);
        }
 
index da068398664aaa32a5d0b01ef49d2af5ff00b31a..7d8d3ebcd3711a5668a260ce9e98f7d6746583ed 100644 (file)
@@ -44,6 +44,7 @@ struct vm_area_struct;
 struct vfsmount;
 struct cred;
 struct swap_info_struct;
+struct seq_file;
 
 extern void __init inode_init(void);
 extern void __init inode_init_early(void);
@@ -1543,6 +1544,7 @@ struct file_operations {
        int (*setlease)(struct file *, long, struct file_lock **);
        long (*fallocate)(struct file *file, int mode, loff_t offset,
                          loff_t len);
+       int (*show_fdinfo)(struct seq_file *m, struct file *f);
 };
 
 struct inode_operations {
@@ -1578,8 +1580,6 @@ struct inode_operations {
                           umode_t create_mode, int *opened);
 } ____cacheline_aligned;
 
-struct seq_file;
-
 ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
                              unsigned long nr_segs, unsigned long fast_segs,
                              struct iovec *fast_pointer,