aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/seq_file.h
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2008-08-12 18:09:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-08-12 19:07:30 -0400
commit50ac2d694f2dd1658341cf97bcf2ffb836d772cb (patch)
treec4466ecb7c5211ee9423380783f00027411d5d5a /include/linux/seq_file.h
parentdd763460eb628b57814251a15a39f8d75c044d76 (diff)
seq_file: add seq_cpumask(), seq_nodemask()
Short enough reads from /proc/irq/*/smp_affinity return -EINVAL for no good reason. This became noticed with NR_CPUS=4096 patches, when length of printed representation of cpumask becase 1152, but cat(1) continued to read with 1024-byte chunks. bitmap_scnprintf() in good faith fills buffer, returns 1023, check returns -EINVAL. Fix it by switching to seq_file, so handler will just fill buffer and doesn't care about offsets, length, filling EOF and all this crap. For that add seq_bitmap(), and wrappers around it -- seq_cpumask() and seq_nodemask(). Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Reviewed-by: Paul Jackson <pj@sgi.com> Cc: Mike Travis <travis@sgi.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>
Diffstat (limited to 'include/linux/seq_file.h')
-rw-r--r--include/linux/seq_file.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index a66304a09955..a1783b229ef4 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -4,6 +4,8 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/string.h> 5#include <linux/string.h>
6#include <linux/mutex.h> 6#include <linux/mutex.h>
7#include <linux/cpumask.h>
8#include <linux/nodemask.h>
7 9
8struct seq_operations; 10struct seq_operations;
9struct file; 11struct file;
@@ -47,6 +49,16 @@ int seq_path(struct seq_file *, struct path *, char *);
47int seq_dentry(struct seq_file *, struct dentry *, char *); 49int seq_dentry(struct seq_file *, struct dentry *, char *);
48int seq_path_root(struct seq_file *m, struct path *path, struct path *root, 50int seq_path_root(struct seq_file *m, struct path *path, struct path *root,
49 char *esc); 51 char *esc);
52int seq_bitmap(struct seq_file *m, unsigned long *bits, unsigned int nr_bits);
53static inline int seq_cpumask(struct seq_file *m, cpumask_t *mask)
54{
55 return seq_bitmap(m, mask->bits, NR_CPUS);
56}
57
58static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask)
59{
60 return seq_bitmap(m, mask->bits, MAX_NUMNODES);
61}
50 62
51int single_open(struct file *, int (*)(struct seq_file *, void *), void *); 63int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
52int single_release(struct inode *, struct file *); 64int single_release(struct inode *, struct file *);