linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@openvz.org>
To: linux-kernel@vger.kernel.org
Cc: Cyrill Gorcunov <gorcunov@openvz.org>,
	Pavel Emelyanov <xemul@parallels.com>,
	Oleg Nesterov <oleg@redhat.com>, Andrey Vagin <avagin@openvz.org>,
	Al Viro <viro@ZenIV.linux.org.uk>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	James Bottomley <jbottomley@parallels.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	Matthew Helsley <matt.helsley@gmail.com>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	Tvrtko Ursulin <tvrtko.ursulin@onelan.co.uk>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [patch 3/6] eventfd: Use sequential fdinfo engine
Date: Wed, 30 Oct 2013 23:59:54 +0400	[thread overview]
Message-ID: <20131030202221.257009634@openvz.org> (raw)
In-Reply-To: 20131030195951.201688764@openvz.org

[-- Attachment #1: 0003-procfs-eventfd --]
[-- Type: text/plain, Size: 2005 bytes --]

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: 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>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 fs/eventfd.c |   30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

Index: linux-2.6.git/fs/eventfd.c
===================================================================
--- linux-2.6.git.orig/fs/eventfd.c
+++ linux-2.6.git/fs/eventfd.c
@@ -287,9 +287,26 @@ static ssize_t eventfd_write(struct file
 }
 
 #ifdef CONFIG_PROC_FS
-static int eventfd_show_fdinfo(struct seq_file *m, struct file *f)
+static void *seq_start(struct seq_file *m, loff_t *pos)
 {
-	struct eventfd_ctx *ctx = f->private_data;
+	if (*pos == 0)
+		return m->private;
+	return NULL;
+}
+
+static void seq_stop(struct seq_file *m, void *v)
+{
+}
+
+static void *seq_next(struct seq_file *m, void *p, loff_t *pos)
+{
+	++*pos;
+	return NULL;
+}
+
+static int seq_show(struct seq_file *m, void *v)
+{
+	struct eventfd_ctx *ctx = ((struct file *)v)->private_data;
 	int ret;
 
 	spin_lock_irq(&ctx->wqh.lock);
@@ -299,11 +316,18 @@ static int eventfd_show_fdinfo(struct se
 
 	return ret;
 }
+
+static struct seq_operations eventfd_fdinfo_ops = {
+	.start		= seq_start,
+	.next		= seq_next,
+	.stop		= seq_stop,
+	.show		= seq_show,
+};
 #endif
 
 static const struct file_operations eventfd_fops = {
 #ifdef CONFIG_PROC_FS
-	.show_fdinfo	= eventfd_show_fdinfo,
+	.fdinfo_ops	= &eventfd_fdinfo_ops,
 #endif
 	.release	= eventfd_release,
 	.poll		= eventfd_poll,


  parent reply	other threads:[~2013-10-30 20:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-30 19:59 [patch 0/6] Rework file::show_fdinfo method to use seq-files engine Cyrill Gorcunov
2013-10-30 19:59 ` [patch 1/6] procfs: Introduce sequential fdinfo engine Cyrill Gorcunov
2013-10-31 10:32   ` Alexey Dobriyan
2013-10-31 10:57     ` Cyrill Gorcunov
2013-10-31 12:12       ` Cyrill Gorcunov
2013-10-30 19:59 ` [patch 2/6] epoll: Use " Cyrill Gorcunov
2013-10-30 19:59 ` Cyrill Gorcunov [this message]
2013-10-30 19:59 ` [patch 4/6] signalfd: " Cyrill Gorcunov
2013-10-30 19:59 ` [patch 5/6] fsnotify: " Cyrill Gorcunov
2013-10-30 19:59 ` [patch 6/6] procfs: Drop legacy show_fdinfo file operation Cyrill Gorcunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131030202221.257009634@openvz.org \
    --to=gorcunov@openvz.org \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=avagin@openvz.org \
    --cc=bfields@fieldses.org \
    --cc=jbottomley@parallels.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.helsley@gmail.com \
    --cc=oleg@redhat.com \
    --cc=tvrtko.ursulin@onelan.co.uk \
    --cc=viro@ZenIV.linux.org.uk \
    --cc=xemul@parallels.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).