find.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef _ASM_GENERIC_BITOPS_FIND_H_
  2. #define _ASM_GENERIC_BITOPS_FIND_H_
  3. #ifndef find_next_bit
  4. /**
  5. * find_next_bit - find the next set bit in a memory region
  6. * @addr: The address to base the search on
  7. * @offset: The bitnumber to start searching at
  8. * @size: The bitmap size in bits
  9. *
  10. * Returns the bit number for the next set bit
  11. * If no bits are set, returns @size.
  12. */
  13. extern unsigned long find_next_bit(const unsigned long *addr, unsigned long
  14. size, unsigned long offset);
  15. #endif
  16. #ifndef find_next_zero_bit
  17. /**
  18. * find_next_zero_bit - find the next cleared bit in a memory region
  19. * @addr: The address to base the search on
  20. * @offset: The bitnumber to start searching at
  21. * @size: The bitmap size in bits
  22. *
  23. * Returns the bit number of the next zero bit
  24. * If no bits are zero, returns @size.
  25. */
  26. extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned
  27. long size, unsigned long offset);
  28. #endif
  29. #ifdef CONFIG_GENERIC_FIND_FIRST_BIT
  30. /**
  31. * find_first_bit - find the first set bit in a memory region
  32. * @addr: The address to start the search at
  33. * @size: The maximum number of bits to search
  34. *
  35. * Returns the bit number of the first set bit.
  36. * If no bits are set, returns @size.
  37. */
  38. extern unsigned long find_first_bit(const unsigned long *addr,
  39. unsigned long size);
  40. /**
  41. * find_first_zero_bit - find the first cleared bit in a memory region
  42. * @addr: The address to start the search at
  43. * @size: The maximum number of bits to search
  44. *
  45. * Returns the bit number of the first cleared bit.
  46. * If no bits are zero, returns @size.
  47. */
  48. extern unsigned long find_first_zero_bit(const unsigned long *addr,
  49. unsigned long size);
  50. #else /* CONFIG_GENERIC_FIND_FIRST_BIT */
  51. #define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
  52. #define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
  53. #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */
  54. #endif /*_ASM_GENERIC_BITOPS_FIND_H_ */