Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752131Ab2KLKUv (ORCPT ); Mon, 12 Nov 2012 05:20:51 -0500 Received: from mail-la0-f46.google.com ([209.85.215.46]:45898 "EHLO mail-la0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750918Ab2KLKSv (ORCPT ); Mon, 12 Nov 2012 05:18:51 -0500 Message-Id: <20121112101845.678229459@openvz.org> User-Agent: quilt/0.48-1 Date: Mon, 12 Nov 2012 14:14:41 +0400 From: Cyrill Gorcunov To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: Al Viro , Alexey Dobriyan , Andrew Morton , Pavel Emelyanov , James Bottomley , Matthew Helsley , aneesh.kumar@linux.vnet.ibm.com, bfields@fieldses.org, Cyrill Gorcunov , Al Viro Subject: [patch 1/7] procfs: Add ability to plug in auxiliary fdinfo providers References: <20121112101440.665694060@openvz.org> Content-Disposition: inline; filename=seq-fdinfo-seq-ops-helpers-12 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2401 Lines: 66 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 CC: Pavel Emelyanov CC: Al Viro CC: Alexey Dobriyan CC: Andrew Morton CC: James Bottomley CC: "Aneesh Kumar K.V" CC: Alexey Dobriyan CC: Matthew Helsley CC: "J. Bruce Fields" CC: "Aneesh Kumar K.V" --- fs/proc/fd.c | 2 ++ include/linux/fs.h | 3 +++ 2 files changed, 5 insertions(+) Index: linux-2.6.git/fs/proc/fd.c =================================================================== --- linux-2.6.git.orig/fs/proc/fd.c +++ linux-2.6.git/fs/proc/fd.c @@ -50,6 +50,8 @@ static int seq_show(struct seq_file *m, 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: linux-2.6.git/include/linux/fs.h =================================================================== --- linux-2.6.git.orig/include/linux/fs.h +++ linux-2.6.git/include/linux/fs.h @@ -1517,6 +1517,8 @@ struct block_device_operations; #define HAVE_COMPAT_IOCTL 1 #define HAVE_UNLOCKED_IOCTL 1 +struct seq_file; + struct file_operations { struct module *owner; loff_t (*llseek) (struct file *, loff_t, int); @@ -1545,6 +1547,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 { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/