mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul@parallels.com>
To: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	James Bottomley <jbottomley@parallels.com>,
	Matthew Helsley <matt.helsley@gmail.com>
Subject: Re: [patch 3/7] procfs: Add ability to plug in auxiliary fdinfo providers
Date: Fri, 27 Jul 2012 10:08:38 +0400	[thread overview]
Message-ID: <50123066.20909@parallels.com> (raw)
In-Reply-To: <20120727060009.GB21246@moon>

>>> +static void *seq_next(struct seq_file *m, void *p, loff_t *pos)
>>> +{
>>> +	struct proc_fdinfo_extra *extra = m->private;
>>> +	void *v = NULL;
>>> +
>>> +	if (extra->driver) {
>>> +		int ret = 0;
>>> +
>>> +		if (*pos == 0) {
>>> +			v = extra->driver->ops->start(m, pos);
>>> +			if (v) {
>>> +				ret = extra->driver->ops->show(m, v);
>>
>> Why is it necessary to call ->show here? The logic should be
>>
>> seq_start = (pos == 0 ? nop : extra->start)
>> seq_next  = (pos == 0 ? extra->start : extra->next)
>> seq_stop  = (pos == 0 ? nop : extra->stop)
>> seq_show  = (pos == 0 ? proc_show : extra->show)
>>
>> Or I'm missing something?
> 
> Well, I thought about it as two sequences -- first is procfs
> seq-file, which prints out a general header, and second
> is extra fdinfo provider.
> 
> Everything starts with printing procfs header
> 
> seq_start -> seq_show (prints "pos:\t%lli\nflags:\t0%o\n") ->
> seq_next -> (if have extra driver we do extra's start/show at first,

Why show? The generic seq_file.c will call ->next (which will result in
extra->start), then ->show (which _should_ result in extra->show) thus
providing correct output.

> then next and etc). In other words general header should be
> shown always even if extra's start() fails.
> 
> 	Cyrill
> .
> 


  reply	other threads:[~2012-07-27  6:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-25  9:47 [patch 0/7] procfs fdinfo extension, new round Cyrill Gorcunov
2012-07-25  9:47 ` [patch 1/7] procfs: Move /proc/pid/fd[info] handling code to fd.[ch] Cyrill Gorcunov
2012-07-25  9:47 ` [patch 2/7] procfs: Convert /proc/pid/fdinfo/ handling routines to seq-file Cyrill Gorcunov
2012-07-26 10:43   ` Pavel Emelyanov
2012-07-26 10:49     ` Cyrill Gorcunov
2012-07-25  9:47 ` [patch 3/7] procfs: Add ability to plug in auxiliary fdinfo providers Cyrill Gorcunov
2012-07-27  3:48   ` Pavel Emelyanov
2012-07-27  6:00     ` Cyrill Gorcunov
2012-07-27  6:08       ` Pavel Emelyanov [this message]
2012-07-27  6:23         ` Cyrill Gorcunov
2012-07-25  9:47 ` [patch 4/7] fs, eventfd: Add procfs fdinfo helper Cyrill Gorcunov
2012-07-25  9:47 ` [patch 5/7] fs, epoll: Add procfs fdinfo helper v2 Cyrill Gorcunov
2012-07-25  9:47 ` [patch 6/7] fs, exportfs: Add export_encode_inode_fh helper Cyrill Gorcunov
2012-07-25  9:47 ` [patch 7/7] fs, notify: Add procfs fdinfo helper v3 Cyrill Gorcunov
2012-08-16 16:34 [patch 0/7] procfs, fdinfo reworked, attempts N-th Cyrill Gorcunov
2012-08-16 16:34 ` [patch 3/7] procfs: Add ability to plug in auxiliary fdinfo providers 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=50123066.20909@parallels.com \
    --to=xemul@parallels.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=gorcunov@openvz.org \
    --cc=jbottomley@parallels.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.helsley@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /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

Powered by JetHome