aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-09-29 19:08:21 -0400
committerSteven Rostedt <rostedt@goodmis.org>2014-10-29 20:26:06 -0400
commit1f33c41c03daece85a84b8dcea5733f3efe3e2b0 (patch)
treedc20bd3893f3756d30c9281c2aafc5c1170bdaee /Documentation/filesystems
parentf114040e3ea6e07372334ade75d1ee0775c355e1 (diff)
seq_file: Rename seq_overflow() to seq_has_overflowed() and make public
The return values of seq_printf/puts/putc are frequently misused. Start down a path to remove all the return value uses of these functions. Move the seq_overflow() to a global inlined function called seq_has_overflowed() that can be used by the users of seq_file() calls. Update the documentation to not show return types for seq_printf et al. Add a description of seq_has_overflowed(). Link: http://lkml.kernel.org/p/848ac7e3d1c31cddf638a8526fa3c59fa6fdeb8a.1412031505.git.joe@perches.com Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Joe Perches <joe@perches.com> [ Reworked the original patch from Joe ] Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'Documentation/filesystems')
-rw-r--r--Documentation/filesystems/seq_file.txt22
1 files changed, 13 insertions, 9 deletions
diff --git a/Documentation/filesystems/seq_file.txt b/Documentation/filesystems/seq_file.txt
index 8ea3e90ace07..b797ed38de46 100644
--- a/Documentation/filesystems/seq_file.txt
+++ b/Documentation/filesystems/seq_file.txt
@@ -180,23 +180,19 @@ output must be passed to the seq_file code. Some utility functions have
180been defined which make this task easy. 180been defined which make this task easy.
181 181
182Most code will simply use seq_printf(), which works pretty much like 182Most code will simply use seq_printf(), which works pretty much like
183printk(), but which requires the seq_file pointer as an argument. It is 183printk(), but which requires the seq_file pointer as an argument.
184common to ignore the return value from seq_printf(), but a function
185producing complicated output may want to check that value and quit if
186something non-zero is returned; an error return means that the seq_file
187buffer has been filled and further output will be discarded.
188 184
189For straight character output, the following functions may be used: 185For straight character output, the following functions may be used:
190 186
191 int seq_putc(struct seq_file *m, char c); 187 seq_putc(struct seq_file *m, char c);
192 int seq_puts(struct seq_file *m, const char *s); 188 seq_puts(struct seq_file *m, const char *s);
193 int seq_escape(struct seq_file *m, const char *s, const char *esc); 189 seq_escape(struct seq_file *m, const char *s, const char *esc);
194 190
195The first two output a single character and a string, just like one would 191The first two output a single character and a string, just like one would
196expect. seq_escape() is like seq_puts(), except that any character in s 192expect. seq_escape() is like seq_puts(), except that any character in s
197which is in the string esc will be represented in octal form in the output. 193which is in the string esc will be represented in octal form in the output.
198 194
199There is also a pair of functions for printing filenames: 195There are also a pair of functions for printing filenames:
200 196
201 int seq_path(struct seq_file *m, struct path *path, char *esc); 197 int seq_path(struct seq_file *m, struct path *path, char *esc);
202 int seq_path_root(struct seq_file *m, struct path *path, 198 int seq_path_root(struct seq_file *m, struct path *path,
@@ -209,6 +205,14 @@ root is desired, it can be used with seq_path_root(). Note that, if it
209turns out that path cannot be reached from root, the value of root will be 205turns out that path cannot be reached from root, the value of root will be
210changed in seq_file_root() to a root which *does* work. 206changed in seq_file_root() to a root which *does* work.
211 207
208A function producing complicated output may want to check
209 bool seq_has_overflowed(struct seq_file *m);
210and avoid further seq_<output> calls if true is returned.
211
212A true return from seq_has_overflowed means that the seq_file buffer will
213be discarded and the seq_show function will attempt to allocate a larger
214buffer and retry printing.
215
212 216
213Making it all work 217Making it all work
214 218