summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap_btree.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@sgi.com>2005-11-02 15:11:25 +1100
committerNathan Scott <nathans@sgi.com>2005-11-02 15:11:25 +1100
commit16259e7d952e26e949cc2c8c68b74f34b293935d (patch)
treea016791ecb67761236d32b9915efa9a92f6f3767 /fs/xfs/xfs_bmap_btree.h
parente2ed81fbbb7c76e0a1b3e2f1b5a7414f4d66a559 (diff)
downloadlinux-16259e7d952e26e949cc2c8c68b74f34b293935d.tar.bz2
[XFS] Endianess annotations for various allocator data structures
SGI-PV: 943272 SGI-Modid: xfs-linux:xfs-kern:201006a Signed-off-by: Christoph Hellwig <hch@sgi.com> Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_bmap_btree.h')
-rw-r--r--fs/xfs/xfs_bmap_btree.h44
1 files changed, 21 insertions, 23 deletions
diff --git a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h
index 7478b1b1aa2b..e095a2d344ae 100644
--- a/fs/xfs/xfs_bmap_btree.h
+++ b/fs/xfs/xfs_bmap_btree.h
@@ -28,10 +28,9 @@ struct xfs_inode;
/*
* Bmap root header, on-disk form only.
*/
-typedef struct xfs_bmdr_block
-{
- __uint16_t bb_level; /* 0 is a leaf */
- __uint16_t bb_numrecs; /* current # of data records */
+typedef struct xfs_bmdr_block {
+ __be16 bb_level; /* 0 is a leaf */
+ __be16 bb_numrecs; /* current # of data records */
} xfs_bmdr_block_t;
/*
@@ -212,36 +211,36 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
#define XFS_BMAP_REC_DADDR(bb,i,cur) \
(XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_DSIZE( \
- INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
+ be16_to_cpu((bb)->bb_level), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
- INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
+ be16_to_cpu((bb)->bb_level), cur)))
#define XFS_BMAP_REC_IADDR(bb,i,cur) \
(XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_ISIZE( \
- INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
+ be16_to_cpu((bb)->bb_level), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
- INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
+ be16_to_cpu((bb)->bb_level), cur)))
#define XFS_BMAP_KEY_DADDR(bb,i,cur) \
(XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_DSIZE( \
- INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
+ be16_to_cpu((bb)->bb_level), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
- INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
+ be16_to_cpu((bb)->bb_level), cur)))
#define XFS_BMAP_KEY_IADDR(bb,i,cur) \
(XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_ISIZE( \
- INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
+ be16_to_cpu((bb)->bb_level), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
- INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
+ be16_to_cpu((bb)->bb_level), cur)))
#define XFS_BMAP_PTR_DADDR(bb,i,cur) \
(XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_DSIZE( \
- INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
+ be16_to_cpu((bb)->bb_level), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
- INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
+ be16_to_cpu((bb)->bb_level), cur)))
#define XFS_BMAP_PTR_IADDR(bb,i,cur) \
(XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_ISIZE( \
- INT_GET((bb)->bb_level, ARCH_CONVERT), cur), \
+ be16_to_cpu((bb)->bb_level), cur), \
xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
- INT_GET((bb)->bb_level, ARCH_CONVERT), cur)))
+ be16_to_cpu((bb)->bb_level), cur)))
/*
* These are to be used when we know the size of the block and
@@ -254,7 +253,7 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
#define XFS_BMAP_BROOT_PTR_ADDR(bb,i,sz) \
(XFS_BTREE_PTR_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)))
-#define XFS_BMAP_BROOT_NUMRECS(bb) INT_GET((bb)->bb_numrecs, ARCH_CONVERT)
+#define XFS_BMAP_BROOT_NUMRECS(bb) be16_to_cpu((bb)->bb_numrecs)
#define XFS_BMAP_BROOT_MAXRECS(sz) XFS_BTREE_BLOCK_MAXRECS(sz,xfs_bmbt,0)
#define XFS_BMAP_BROOT_SPACE_CALC(nrecs) \
@@ -262,7 +261,7 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))
#define XFS_BMAP_BROOT_SPACE(bb) \
- (XFS_BMAP_BROOT_SPACE_CALC(INT_GET((bb)->bb_numrecs, ARCH_CONVERT)))
+ (XFS_BMAP_BROOT_SPACE_CALC(be16_to_cpu((bb)->bb_numrecs)))
#define XFS_BMDR_SPACE_CALC(nrecs) \
(int)(sizeof(xfs_bmdr_block_t) + \
((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))
@@ -273,11 +272,10 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
#define XFS_BM_MAXLEVELS(mp,w) ((mp)->m_bm_maxlevels[(w)])
#define XFS_BMAP_SANITY_CHECK(mp,bb,level) \
- (INT_GET((bb)->bb_magic, ARCH_CONVERT) == XFS_BMAP_MAGIC && \
- INT_GET((bb)->bb_level, ARCH_CONVERT) == level && \
- INT_GET((bb)->bb_numrecs, ARCH_CONVERT) > 0 && \
- INT_GET((bb)->bb_numrecs, ARCH_CONVERT) <= \
- (mp)->m_bmap_dmxr[(level) != 0])
+ (be32_to_cpu((bb)->bb_magic) == XFS_BMAP_MAGIC && \
+ be16_to_cpu((bb)->bb_level) == level && \
+ be16_to_cpu((bb)->bb_numrecs) > 0 && \
+ be16_to_cpu((bb)->bb_numrecs) <= (mp)->m_bmap_dmxr[(level) != 0])
#ifdef __KERNEL__