]> Pileus Git - ~andy/linux/blobdiff - fs/xfs/xfs_ialloc_btree.h
ALSA: sound/ali5451: typo: s/resouces/resources/
[~andy/linux] / fs / xfs / xfs_ialloc_btree.h
index f0fc1e46e62bb93b499136fb786c04afab82672c..5580e255ff06637e6b979f6671c21f3dd90d8029 100644 (file)
@@ -24,7 +24,6 @@
 
 struct xfs_buf;
 struct xfs_btree_cur;
-struct xfs_btree_sblock;
 struct xfs_mount;
 
 /*
@@ -37,7 +36,6 @@ typedef       __uint64_t      xfs_inofree_t;
 #define        XFS_INODES_PER_CHUNK_LOG        (XFS_NBBYLOG + 3)
 #define        XFS_INOBT_ALL_FREE      ((xfs_inofree_t)-1)
 
-#define        XFS_INOBT_MASKN(i,n)            xfs_inobt_maskn(i,n)
 static inline xfs_inofree_t xfs_inobt_maskn(int i, int n)
 {
        return (((n) >= XFS_INODES_PER_CHUNK ? \
@@ -70,11 +68,6 @@ typedef struct xfs_inobt_key {
 /* btree pointer type */
 typedef __be32 xfs_inobt_ptr_t;
 
-/* btree block header type */
-typedef        struct xfs_btree_sblock xfs_inobt_block_t;
-
-#define        XFS_BUF_TO_INOBT_BLOCK(bp)      ((xfs_inobt_block_t *)XFS_BUF_PTR(bp))
-
 /*
  * Bit manipulations for ir_free.
  */
@@ -96,17 +89,35 @@ typedef     struct xfs_btree_sblock xfs_inobt_block_t;
 #define        XFS_PREALLOC_BLOCKS(mp)         ((xfs_agblock_t)(XFS_IBT_BLOCK(mp) + 1))
 
 /*
- * Record, key, and pointer address macros for btree blocks.
+ * Btree block header size depends on a superblock flag.
+ *
+ * (not quite yet, but soon)
  */
-#define XFS_INOBT_REC_ADDR(bb,i,cur) \
-       (XFS_BTREE_REC_ADDR(xfs_inobt, bb, i))
-
-#define        XFS_INOBT_KEY_ADDR(bb,i,cur) \
-       (XFS_BTREE_KEY_ADDR(xfs_inobt, bb, i))
+#define XFS_INOBT_BLOCK_LEN(mp)        XFS_BTREE_SBLOCK_LEN
 
-#define        XFS_INOBT_PTR_ADDR(bb,i,cur) \
-       (XFS_BTREE_PTR_ADDR(xfs_inobt, bb, \
-                               i, XFS_INOBT_BLOCK_MAXRECS(1, cur)))
+/*
+ * Record, key, and pointer address macros for btree blocks.
+ *
+ * (note that some of these may appear unused, but they are used in userspace)
+ */
+#define XFS_INOBT_REC_ADDR(mp, block, index) \
+       ((xfs_inobt_rec_t *) \
+               ((char *)(block) + \
+                XFS_INOBT_BLOCK_LEN(mp) + \
+                (((index) - 1) * sizeof(xfs_inobt_rec_t))))
+
+#define XFS_INOBT_KEY_ADDR(mp, block, index) \
+       ((xfs_inobt_key_t *) \
+               ((char *)(block) + \
+                XFS_INOBT_BLOCK_LEN(mp) + \
+                ((index) - 1) * sizeof(xfs_inobt_key_t)))
+
+#define XFS_INOBT_PTR_ADDR(mp, block, index, maxrecs) \
+       ((xfs_inobt_ptr_t *) \
+               ((char *)(block) + \
+                XFS_INOBT_BLOCK_LEN(mp) + \
+                (maxrecs) * sizeof(xfs_inobt_key_t) + \
+                ((index) - 1) * sizeof(xfs_inobt_ptr_t)))
 
 extern struct xfs_btree_cur *xfs_inobt_init_cursor(struct xfs_mount *,
                struct xfs_trans *, struct xfs_buf *, xfs_agnumber_t);