aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bitmap.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-12-31 02:31:57 -0500
committerIngo Molnar <mingo@elte.hu>2008-12-31 02:31:57 -0500
commita9de18eb761f7c1c860964b2e5addc1a35c7e861 (patch)
tree886e75fdfd09690cd262ca69cb7f5d1d42b48602 /lib/bitmap.c
parentb2aaf8f74cdc84a9182f6cabf198b7763bcb9d40 (diff)
parent6a94cb73064c952255336cc57731904174b2c58f (diff)
Merge branch 'linus' into stackprotector
Conflicts: arch/x86/include/asm/pda.h kernel/fork.c
Diffstat (limited to 'lib/bitmap.c')
-rw-r--r--lib/bitmap.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 06fb57c86de0..1338469ac849 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -316,17 +316,6 @@ int bitmap_scnprintf(char *buf, unsigned int buflen,
316EXPORT_SYMBOL(bitmap_scnprintf); 316EXPORT_SYMBOL(bitmap_scnprintf);
317 317
318/** 318/**
319 * bitmap_scnprintf_len - return buffer length needed to convert
320 * bitmap to an ASCII hex string
321 * @nr_bits: number of bits to be converted
322 */
323int bitmap_scnprintf_len(unsigned int nr_bits)
324{
325 unsigned int nr_nibbles = ALIGN(nr_bits, 4) / 4;
326 return nr_nibbles + ALIGN(nr_nibbles, CHUNKSZ / 4) / (CHUNKSZ / 4) - 1;
327}
328
329/**
330 * __bitmap_parse - convert an ASCII hex string into a bitmap. 319 * __bitmap_parse - convert an ASCII hex string into a bitmap.
331 * @buf: pointer to buffer containing string. 320 * @buf: pointer to buffer containing string.
332 * @buflen: buffer size in bytes. If string is smaller than this 321 * @buflen: buffer size in bytes. If string is smaller than this
@@ -1007,3 +996,25 @@ int bitmap_allocate_region(unsigned long *bitmap, int pos, int order)
1007 return 0; 996 return 0;
1008} 997}
1009EXPORT_SYMBOL(bitmap_allocate_region); 998EXPORT_SYMBOL(bitmap_allocate_region);
999
1000/**
1001 * bitmap_copy_le - copy a bitmap, putting the bits into little-endian order.
1002 * @dst: destination buffer
1003 * @src: bitmap to copy
1004 * @nbits: number of bits in the bitmap
1005 *
1006 * Require nbits % BITS_PER_LONG == 0.
1007 */
1008void bitmap_copy_le(void *dst, const unsigned long *src, int nbits)
1009{
1010 unsigned long *d = dst;
1011 int i;
1012
1013 for (i = 0; i < nbits/BITS_PER_LONG; i++) {
1014 if (BITS_PER_LONG == 64)
1015 d[i] = cpu_to_le64(src[i]);
1016 else
1017 d[i] = cpu_to_le32(src[i]);
1018 }
1019}
1020EXPORT_SYMBOL(bitmap_copy_le);