1 #include <asm/bitops.h>
2 
3 /* Find string of zero bits in a bitmap */
4 unsigned long
find_next_zero_string(unsigned long * bitmap,long start,long nbits,int len)5 find_next_zero_string(unsigned long *bitmap, long start, long nbits, int len)
6 {
7 	unsigned long n, end, i;
8 
9  again:
10 	n = find_next_zero_bit(bitmap, nbits, start);
11 	if (n == -1)
12 		return -1;
13 
14 	/* could test bitsliced, but it's hardly worth it */
15 	end = n+len;
16 	if (end >= nbits)
17 		return -1;
18 	for (i = n+1; i < end; i++) {
19 		if (test_bit(i, bitmap)) {
20 			start = i+1;
21 			goto again;
22 		}
23 	}
24 	return n;
25 }
26