aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_ialloc_btree.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-10-30 02:11:40 -0400
committerLachlan McIlroy <lachlan@sgi.com>2008-10-30 02:11:40 -0400
commit136341b41ad4883bd668120f727a52c42331fe8a (patch)
tree0cb1b220073948f2632911354a828606a9e276bb /fs/xfs/xfs_ialloc_btree.h
parent6c7699c047c50403149ad91331dd39de47dea070 (diff)
[XFS] cleanup btree record / key / ptr addressing macros.
Replace the generic record / key / ptr addressing macros that use cpp token pasting with simpler macros that do the job for just one given btree type. The new macros lose the cur argument and thus can be used outside the core btree code, but also gain an xfs_mount * argument to allow for checking the CRC flag in the near future. Note that many of these macros aren't actually used in the kernel code, but only in userspace (mostly in xfs_repair). SGI-PV: 988146 SGI-Modid: xfs-linux-melb:xfs-kern:32295a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Donald Douwsma <donaldd@sgi.com> Signed-off-by: David Chinner <david@fromorbit.com> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_ialloc_btree.h')
-rw-r--r--fs/xfs/xfs_ialloc_btree.h29
1 files changed, 20 insertions, 9 deletions
diff --git a/fs/xfs/xfs_ialloc_btree.h b/fs/xfs/xfs_ialloc_btree.h
index f0fc1e46e62b..fa12c85db340 100644
--- a/fs/xfs/xfs_ialloc_btree.h
+++ b/fs/xfs/xfs_ialloc_btree.h
@@ -97,16 +97,27 @@ typedef struct xfs_btree_sblock xfs_inobt_block_t;
97 97
98/* 98/*
99 * Record, key, and pointer address macros for btree blocks. 99 * Record, key, and pointer address macros for btree blocks.
100 *
101 * (note that some of these may appear unused, but they are used in userspace)
100 */ 102 */
101#define XFS_INOBT_REC_ADDR(bb,i,cur) \ 103#define XFS_INOBT_REC_ADDR(mp, block, index) \
102 (XFS_BTREE_REC_ADDR(xfs_inobt, bb, i)) 104 ((xfs_inobt_rec_t *) \
103 105 ((char *)(block) + \
104#define XFS_INOBT_KEY_ADDR(bb,i,cur) \ 106 sizeof(struct xfs_btree_sblock) + \
105 (XFS_BTREE_KEY_ADDR(xfs_inobt, bb, i)) 107 (((index) - 1) * sizeof(xfs_inobt_rec_t))))
106 108
107#define XFS_INOBT_PTR_ADDR(bb,i,cur) \ 109#define XFS_INOBT_KEY_ADDR(mp, block, index) \
108 (XFS_BTREE_PTR_ADDR(xfs_inobt, bb, \ 110 ((xfs_inobt_key_t *) \
109 i, XFS_INOBT_BLOCK_MAXRECS(1, cur))) 111 ((char *)(block) + \
112 sizeof(struct xfs_btree_sblock) + \
113 ((index) - 1) * sizeof(xfs_inobt_key_t)))
114
115#define XFS_INOBT_PTR_ADDR(mp, block, index, maxrecs) \
116 ((xfs_inobt_ptr_t *) \
117 ((char *)(block) + \
118 sizeof(struct xfs_btree_sblock) + \
119 (maxrecs) * sizeof(xfs_inobt_key_t) + \
120 ((index) - 1) * sizeof(xfs_inobt_ptr_t)))
110 121
111extern struct xfs_btree_cur *xfs_inobt_init_cursor(struct xfs_mount *, 122extern struct xfs_btree_cur *xfs_inobt_init_cursor(struct xfs_mount *,
112 struct xfs_trans *, struct xfs_buf *, xfs_agnumber_t); 123 struct xfs_trans *, struct xfs_buf *, xfs_agnumber_t);