From: ebiederm@xmission.com (Eric W. Biederman)
To: Rob Jones <rob.jones@codethink.co.uk>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kernel@lists.codethink.co.uk,
ian.molton@codethink.co.uk
Subject: Re: [PATCH] seq_file: Allow private data to be supplied on seq_open
Date: Wed, 06 Aug 2014 12:14:51 -0700 [thread overview]
Message-ID: <87sil9sa50.fsf@x220.int.ebiederm.org> (raw)
In-Reply-To: <53E254F1.30605@codethink.co.uk> (Rob Jones's message of "Wed, 06 Aug 2014 17:16:49 +0100")
Rob Jones <rob.jones@codethink.co.uk> writes:
> On 06/08/14 17:02, Al Viro wrote:
>> On Tue, Jul 29, 2014 at 06:39:53PM +0100, Rob Jones wrote:
>>
>>> At the moment these consumers have to obtain the struct seq_file pointer
>>> (stored by seq_open() in file->private_data) and then store a pointer to
>>> their own data in the private field of the struct seq_file so that it
>>> can be accessed by the iterator functions.
>>>
>>> Although this is not a long piece of code it is unneccessary boilerplate.
>>
>> How many of those do we actually have?
>
> A quick grep (I didn't examine them all) showed what looked like at
> least 80 instances of the work around.
I took a quick look as well and what I saw was that if we were to
implement the helpers: seq_open_PDE_DATA, and seq_open_i_private. That
would cover essentially all of seq_open that set seq_file->private. So
my gut feel is that a seq_open_priv is the wrong helper.
In the vast majority of the cases either seq_open is good enough,
we want seq_open_private, or seq_file->private is set to PDE_DATA
or i_private.
I think there may be 5 cases in the kernel that do something different,
and those cases probably need a code audit.
>>> seq_open() remains in place and its behaviour remains unchanged so no
>>> existing code should be broken by this patch.
>>
>> I have no objections against such helper, but I's rather have it
>> implemented via seq_open() (and as a static inline, not an export),
>> not the other way round. Oh, and conversion of at least some users would
>> be nice to have as well...
I have no significant objection but having both seq_open_private
and seq_open_priv seems confusing name wise.
Eric
next prev parent reply other threads:[~2014-08-06 19:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-29 17:39 [PATCH] seq_file: Allow private data to be supplied on seq_open Rob Jones
2014-08-06 15:56 ` Rob Jones
2014-08-06 16:02 ` Al Viro
2014-08-06 16:16 ` Rob Jones
2014-08-06 19:14 ` Eric W. Biederman [this message]
2014-08-07 12:58 ` Rob Jones
2014-08-07 13:32 ` Steven Whitehouse
2014-08-07 14:09 ` Rob Jones
2014-08-07 14:16 ` [Linux-kernel] " Rob Jones
2014-08-07 14:22 ` Steven Whitehouse
2014-08-07 14:30 ` Rob Jones
2014-08-06 19:53 ` Al Viro
2014-08-07 1:03 ` Eric W. Biederman
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=87sil9sa50.fsf@x220.int.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=ian.molton@codethink.co.uk \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@lists.codethink.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=rob.jones@codethink.co.uk \
--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