public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Jan Kara <jack@suse.cz>
Cc: Eric Van Hensbergen <ericvh@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: seq_file dangerous assumption?
Date: Sat, 9 Jun 2012 06:26:10 +0100	[thread overview]
Message-ID: <20120609052610.GX30000@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20120604200720.GI11010@quack.suse.cz>

On Mon, Jun 04, 2012 at 10:07:20PM +0200, Jan Kara wrote:

> Also we don't usually put magics into our data structure just to stop bad
> use of interfaces. I agree that in this particular case the interface is
> easy to get wrong - but that should be solved by changing the interface to
> a more robust one. Actually, I'm not sure if anyone actually passes
> ->private_data != NULL since seq_open_private() seems to be a standard way
> of associating some additional data with seq_file. So maybe
> BUG_ON(file->private_data) would be a good robustification of the interface
> :).

*cough* /proc/mounts *cough*

I've just thrown a cleanup of that shite into #for-next (and posted it
upthread).  The bottom line:
	* seq_open() is fine with ->private_data pointing to struct seq_file
embedded into something.
	* that's a supported use; just use container_of() to get to the
entire object by ->private_data (or similar container_of() by seq_file *
argument in seq_file methods).

  reply	other threads:[~2012-06-09  5:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-04 19:32 seq_file dangerous assumption? Eric Van Hensbergen
2012-06-04 20:07 ` Jan Kara
2012-06-09  5:26   ` Al Viro [this message]
2012-06-09  5:22 ` Al Viro

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=20120609052610.GX30000@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=ericvh@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    /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