]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - repair/bmap.h
Merge branch 'master' of git://oss.sgi.com/xfs/cmds/xfsprogs
[thirdparty/xfsprogs-dev.git] / repair / bmap.h
1 /*
2 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #ifndef _XFS_REPAIR_BMAP_H
20 #define _XFS_REPAIR_BMAP_H
21
22 /*
23 * Extent descriptor.
24 */
25 typedef struct bmap_ext {
26 xfs_dfiloff_t startoff;
27 xfs_dfsbno_t startblock;
28 xfs_dfilblks_t blockcount;
29 } bmap_ext_t;
30
31 /*
32 * Block map.
33 */
34 typedef struct blkmap {
35 int naexts;
36 int nexts;
37 bmap_ext_t exts[1];
38 } blkmap_t;
39
40 #define BLKMAP_SIZE(n) \
41 (offsetof(blkmap_t, exts) + (sizeof(bmap_ext_t) * (n)))
42
43 blkmap_t *blkmap_alloc(xfs_extnum_t nex, int whichfork);
44 void blkmap_free(blkmap_t *blkmap);
45
46 void blkmap_set_ext(blkmap_t **blkmapp, xfs_dfiloff_t o,
47 xfs_dfsbno_t b, xfs_dfilblks_t c);
48
49 xfs_dfsbno_t blkmap_get(blkmap_t *blkmap, xfs_dfiloff_t o);
50 int blkmap_getn(blkmap_t *blkmap, xfs_dfiloff_t o,
51 xfs_dfilblks_t nb, bmap_ext_t **bmpp,
52 bmap_ext_t *bmpp_single);
53 xfs_dfiloff_t blkmap_last_off(blkmap_t *blkmap);
54 xfs_dfiloff_t blkmap_next_off(blkmap_t *blkmap, xfs_dfiloff_t o, int *t);
55
56 #endif /* _XFS_REPAIR_BMAP_H */