| 1 |
// SPDX-License-Identifier: GPL-2.0-or-later |
| 2 |
/* |
| 3 |
* Copyright (c) 2020-2024 Oracle. All Rights Reserved. |
| 4 |
* Author: Darrick J. Wong <[email protected]> |
| 5 |
*/ |
| 6 |
#ifndef __XFS_SCRUB_RGB_BITMAP_H__ |
| 7 |
#define __XFS_SCRUB_RGB_BITMAP_H__ |
| 8 |
|
| 9 |
/* Bitmaps, but for type-checked for xfs_rgblock_t */ |
| 10 |
|
| 11 |
struct xrgb_bitmap { |
| 12 |
struct xbitmap32 rgbitmap; |
| 13 |
}; |
| 14 |
|
| 15 |
static inline void xrgb_bitmap_init(struct xrgb_bitmap *bitmap) |
| 16 |
{ |
| 17 |
xbitmap32_init(&bitmap->rgbitmap); |
| 18 |
} |
| 19 |
|
| 20 |
static inline void xrgb_bitmap_destroy(struct xrgb_bitmap *bitmap) |
| 21 |
{ |
| 22 |
xbitmap32_destroy(&bitmap->rgbitmap); |
| 23 |
} |
| 24 |
|
| 25 |
static inline int xrgb_bitmap_set(struct xrgb_bitmap *bitmap, |
| 26 |
xfs_rgblock_t start, xfs_extlen_t len) |
| 27 |
{ |
| 28 |
return xbitmap32_set(&bitmap->rgbitmap, start, len); |
| 29 |
} |
| 30 |
|
| 31 |
static inline int xrgb_bitmap_walk(struct xrgb_bitmap *bitmap, |
| 32 |
xbitmap32_walk_fn fn, void *priv) |
| 33 |
{ |
| 34 |
return xbitmap32_walk(&bitmap->rgbitmap, fn, priv); |
| 35 |
} |
| 36 |
|
| 37 |
#endif /* __XFS_SCRUB_RGB_BITMAP_H__ */ |