From: Yann Droneaud <ydroneaud@opteya.com>
To: Al Viro <viro@zeniv.linux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Yann Droneaud <ydroneaud@opteya.com>
Subject: [PATCH v1 3/3] fs: documents seq_open()'s usage of file->private_data
Date: Mon, 1 Jun 2015 23:32:15 +0200 [thread overview]
Message-ID: <4840cc5370d9b4e4cc9344da47ed3e1fb67e9a0a.1433193673.git.ydroneaud@opteya.com> (raw)
In-Reply-To: <cover.1433193673.git.ydroneaud@opteya.com>
In-Reply-To: <cover.1433193673.git.ydroneaud@opteya.com>
seq_open() store 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.1433193673.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 a909f12dad4d..e48ef5682bfa 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.4.2
prev parent reply other threads:[~2015-06-01 21:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-01 21:32 [PATCH v1 0/3] No more seq_file pre-allocation Yann Droneaud
2015-06-01 21:32 ` [PATCH v1 1/3] fs: use seq_open_private() for proc_mounts Yann Droneaud
2015-06-01 21:32 ` [PATCH v1 2/3] fs: allocate structure unconditionally in seq_open() Yann Droneaud
2015-06-01 21:32 ` 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=4840cc5370d9b4e4cc9344da47ed3e1fb67e9a0a.1433193673.git.ydroneaud@opteya.com \
--to=ydroneaud@opteya.com \
--cc=akpm@linux-foundation.org \
--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 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).