fsb_bitmap.h 911 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Copyright (C) 2018-2023 Oracle. All Rights Reserved.
  4. * Author: Darrick J. Wong <djwong@kernel.org>
  5. */
  6. #ifndef __XFS_SCRUB_FSB_BITMAP_H__
  7. #define __XFS_SCRUB_FSB_BITMAP_H__
  8. /* Bitmaps, but for type-checked for xfs_fsblock_t */
  9. struct xfsb_bitmap {
  10. struct xbitmap64 fsbitmap;
  11. };
  12. static inline void xfsb_bitmap_init(struct xfsb_bitmap *bitmap)
  13. {
  14. xbitmap64_init(&bitmap->fsbitmap);
  15. }
  16. static inline void xfsb_bitmap_destroy(struct xfsb_bitmap *bitmap)
  17. {
  18. xbitmap64_destroy(&bitmap->fsbitmap);
  19. }
  20. static inline int xfsb_bitmap_set(struct xfsb_bitmap *bitmap,
  21. xfs_fsblock_t start, xfs_filblks_t len)
  22. {
  23. return xbitmap64_set(&bitmap->fsbitmap, start, len);
  24. }
  25. static inline int xfsb_bitmap_walk(struct xfsb_bitmap *bitmap,
  26. xbitmap64_walk_fn fn, void *priv)
  27. {
  28. return xbitmap64_walk(&bitmap->fsbitmap, fn, priv);
  29. }
  30. #endif /* __XFS_SCRUB_FSB_BITMAP_H__ */