fs: document seq_open()'s usage of file->private_data
authorYann Droneaud <ydroneaud@opteya.com>
Tue, 30 Jun 2015 21:57:36 +0000 (14:57 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 1 Jul 2015 02:44:57 +0000 (19:44 -0700)
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.1433193673.git.ydroneaud@opteya.com
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/seq_file.c

index 5f163c6c821cb3c5d4b0153ae1dbad7a129deb80..760e25dad9850b77a3a73568cbf109e2a88a9a7c 100644 (file)
@@ -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)
 {