diff options
| author | Ingo Molnar <mingo@elte.hu> | 2008-08-23 17:46:59 +0200 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-08-23 17:46:59 +0200 |
| commit | 87ce786ae5f24e336195805a9fc7428a6f922478 (patch) | |
| tree | 4e756c5b49dadcd4b9cf46a1a0e3593ccadfb291 /lib/bitmap.c | |
| parent | 8067794bec1cc5de1431102cf0a6a1c7ce75cd85 (diff) | |
| parent | f1c5d30e1d79bbfb60eaf189db862d3cb2bcac92 (diff) | |
Merge branch 'x86/cpu' into x86/x2apic
Diffstat (limited to 'lib/bitmap.c')
| -rw-r--r-- | lib/bitmap.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c index 482df94ea21..06fb57c86de 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -316,6 +316,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. * @buflen: buffer size in bytes. If string is smaller than this |
