All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yann Droneaud <ydroneaud@opteya.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yann Droneaud <ydroneaud@opteya.com>
Subject: [PATCH 3/3] fs: documents seq_open()'s usage of file->private_data
Date: Tue,  5 May 2015 00:19:15 +0200	[thread overview]
Message-ID: <e5908204510326710a9628469bbcfa1595823f64.1430777196.git.ydroneaud@opteya.com> (raw)
In-Reply-To: <cover.1430777196.git.ydroneaud@opteya.com>
In-Reply-To: <cover.1430777196.git.ydroneaud@opteya.com>

seq_open() stores its struct seq_file in file->private_data,
thus, it must not be modified by user of seq_file.

Link: http://lkml.kernel.org/r/cover.1430777196.git.ydroneaud@opteya.com
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
---
 fs/seq_file.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/seq_file.c b/fs/seq_file.c
index cb9c3dbd1a1e..69d13f62d885 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -48,6 +48,8 @@ static void *seq_buf_alloc(unsigned long size)
  *	ERR_PTR(error).  In the end of sequence they return %NULL. ->show()
  *	returns 0 in case of success and negative number in case of error.
  *	Returning SEQ_SKIP means "discard this element and move on".
+ *	Note: seq_open() will allocate a struct seq_file and store its
+ *	pointer in @file->private_data. This pointer should not be modified.
  */
 int seq_open(struct file *file, const struct seq_operations *op)
 {
-- 
2.1.0


      parent reply	other threads:[~2015-05-04 22:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-04 22:19 [PATCH 0/3] seq_file allocation in seq_open() Yann Droneaud
2015-05-04 22:19 ` [PATCH 1/3] fs: use seq_open_private() for proc_mounts Yann Droneaud
2015-05-04 22:19 ` [PATCH 2/3] fs: allocate structure unconditionally in seq_open() Yann Droneaud
2015-05-04 22:19 ` Yann Droneaud [this message]

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=e5908204510326710a9628469bbcfa1595823f64.1430777196.git.ydroneaud@opteya.com \
    --to=ydroneaud@opteya.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.