]>
Commit | Line | Data |
---|---|---|
959ef981 | 1 | // SPDX-License-Identifier: GPL-2.0 |
2bd0ea18 | 2 | /* |
da23017d NS |
3 | * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. |
4 | * All Rights Reserved. | |
2bd0ea18 NS |
5 | */ |
6 | ||
610f3285 BN |
7 | #ifndef _XFS_REPAIR_BMAP_H |
8 | #define _XFS_REPAIR_BMAP_H | |
2bd0ea18 NS |
9 | |
10 | /* | |
610f3285 | 11 | * Extent descriptor. |
2bd0ea18 | 12 | */ |
610f3285 | 13 | typedef struct bmap_ext { |
5a35bf2c DC |
14 | xfs_fileoff_t startoff; |
15 | xfs_fsblock_t startblock; | |
16 | xfs_filblks_t blockcount; | |
610f3285 | 17 | } bmap_ext_t; |
2bd0ea18 NS |
18 | |
19 | /* | |
20 | * Block map. | |
21 | */ | |
22 | typedef struct blkmap { | |
610f3285 BN |
23 | int naexts; |
24 | int nexts; | |
25 | bmap_ext_t exts[1]; | |
2bd0ea18 | 26 | } blkmap_t; |
2bd0ea18 | 27 | |
610f3285 BN |
28 | #define BLKMAP_SIZE(n) \ |
29 | (offsetof(blkmap_t, exts) + (sizeof(bmap_ext_t) * (n))) | |
2bd0ea18 | 30 | |
52cb19dc CH |
31 | extern pthread_key_t dblkmap_key; |
32 | extern pthread_key_t ablkmap_key; | |
33 | ||
610f3285 | 34 | blkmap_t *blkmap_alloc(xfs_extnum_t nex, int whichfork); |
2bd0ea18 | 35 | void blkmap_free(blkmap_t *blkmap); |
bd758142 | 36 | void blkmap_free_final(void); |
610f3285 | 37 | |
5a35bf2c DC |
38 | int blkmap_set_ext(blkmap_t **blkmapp, xfs_fileoff_t o, |
39 | xfs_fsblock_t b, xfs_filblks_t c); | |
610f3285 | 40 | |
5a35bf2c DC |
41 | xfs_fsblock_t blkmap_get(blkmap_t *blkmap, xfs_fileoff_t o); |
42 | int blkmap_getn(blkmap_t *blkmap, xfs_fileoff_t o, | |
43 | xfs_filblks_t nb, bmap_ext_t **bmpp, | |
1e77098c | 44 | bmap_ext_t *bmpp_single); |
5a35bf2c DC |
45 | xfs_fileoff_t blkmap_last_off(blkmap_t *blkmap); |
46 | xfs_fileoff_t blkmap_next_off(blkmap_t *blkmap, xfs_fileoff_t o, int *t); | |
610f3285 BN |
47 | |
48 | #endif /* _XFS_REPAIR_BMAP_H */ |