mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 07:01:23 +00:00
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>
This commit is contained in:
parent
dd763460eb
commit
50ac2d694f
4 changed files with 38 additions and 0 deletions
11
lib/bitmap.c
11
lib/bitmap.c
|
@ -315,6 +315,17 @@ int bitmap_scnprintf(char *buf, unsigned int buflen,
|
|||
}
|
||||
EXPORT_SYMBOL(bitmap_scnprintf);
|
||||
|
||||
/**
|
||||
* bitmap_scnprintf_len - return buffer length needed to convert
|
||||
* bitmap to an ASCII hex string
|
||||
* @nr_bits: number of bits to be converted
|
||||
*/
|
||||
int bitmap_scnprintf_len(unsigned int nr_bits)
|
||||
{
|
||||
unsigned int nr_nibbles = ALIGN(nr_bits, 4) / 4;
|
||||
return nr_nibbles + ALIGN(nr_nibbles, CHUNKSZ / 4) / (CHUNKSZ / 4) - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* __bitmap_parse - convert an ASCII hex string into a bitmap.
|
||||
* @buf: pointer to buffer containing string.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue