]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - libxfs/xfs_ialloc_btree.h
xfs: convert to SPDX license tags
[thirdparty/xfsprogs-dev.git] / libxfs / xfs_ialloc_btree.h
CommitLineData
37b3b4d6 1// SPDX-License-Identifier: GPL-2.0
2bd0ea18 2/*
f302e9e4
NS
3 * Copyright (c) 2000,2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
2bd0ea18
NS
5 */
6#ifndef __XFS_IALLOC_BTREE_H__
dfc130f3 7#define __XFS_IALLOC_BTREE_H__
2bd0ea18
NS
8
9/*
10 * Inode map on-disk structures
11 */
12
13struct xfs_buf;
14struct xfs_btree_cur;
2bd0ea18
NS
15struct xfs_mount;
16
2bd0ea18 17/*
b3563c19 18 * Btree block header size depends on a superblock flag.
2bd0ea18 19 */
5dfa5cd2
DC
20#define XFS_INOBT_BLOCK_LEN(mp) \
21 (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
79737cd9 22 XFS_BTREE_SBLOCK_CRC_LEN : XFS_BTREE_SBLOCK_LEN)
2bd0ea18 23
b3563c19
BN
24/*
25 * Record, key, and pointer address macros for btree blocks.
26 *
27 * (note that some of these may appear unused, but they are used in userspace)
28 */
29#define XFS_INOBT_REC_ADDR(mp, block, index) \
30 ((xfs_inobt_rec_t *) \
31 ((char *)(block) + \
32 XFS_INOBT_BLOCK_LEN(mp) + \
33 (((index) - 1) * sizeof(xfs_inobt_rec_t))))
34
35#define XFS_INOBT_KEY_ADDR(mp, block, index) \
36 ((xfs_inobt_key_t *) \
37 ((char *)(block) + \
38 XFS_INOBT_BLOCK_LEN(mp) + \
39 ((index) - 1) * sizeof(xfs_inobt_key_t)))
40
41#define XFS_INOBT_PTR_ADDR(mp, block, index, maxrecs) \
42 ((xfs_inobt_ptr_t *) \
43 ((char *)(block) + \
44 XFS_INOBT_BLOCK_LEN(mp) + \
45 (maxrecs) * sizeof(xfs_inobt_key_t) + \
46 ((index) - 1) * sizeof(xfs_inobt_ptr_t)))
2bd0ea18 47
b194c7d8 48extern struct xfs_btree_cur *xfs_inobt_init_cursor(struct xfs_mount *,
70eb7337
BF
49 struct xfs_trans *, struct xfs_buf *, xfs_agnumber_t,
50 xfs_btnum_t);
b3563c19 51extern int xfs_inobt_maxrecs(struct xfs_mount *, int, int);
2bd0ea18 52
2cf87710
BF
53/* ir_holemask to inode allocation bitmap conversion */
54uint64_t xfs_inobt_irec_to_allocmask(struct xfs_inobt_rec_incore *);
55
6f4c54a4
BF
56#if defined(DEBUG) || defined(XFS_WARN)
57int xfs_inobt_rec_check_count(struct xfs_mount *,
58 struct xfs_inobt_rec_incore *);
59#else
60#define xfs_inobt_rec_check_count(mp, rec) 0
61#endif /* DEBUG */
62
74e502ac
CH
63int xfs_finobt_calc_reserves(struct xfs_mount *mp, xfs_agnumber_t agno,
64 xfs_extlen_t *ask, xfs_extlen_t *used);
5f728383
DW
65extern xfs_extlen_t xfs_iallocbt_calc_size(struct xfs_mount *mp,
66 unsigned long long len);
74e502ac 67
2bd0ea18 68#endif /* __XFS_IALLOC_BTREE_H__ */