aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_leaf.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2011-07-08 14:35:53 +0200
committerChristoph Hellwig <hch@lst.de>2011-07-08 14:35:53 +0200
commit2282396d8157033503318fe4dee77ba82dc9d144 (patch)
tree5aab6f55e2e4c37c5cbd4036dab4b8b8c78daf82 /fs/xfs/xfs_dir2_leaf.h
parentxfs: cleanup the definition of struct xfs_dir2_data_entry (diff)
downloadlinux-dev-2282396d8157033503318fe4dee77ba82dc9d144.tar.xz
linux-dev-2282396d8157033503318fe4dee77ba82dc9d144.zip
xfs: cleanup struct xfs_dir2_leaf
Simplify the confusing xfs_dir2_leaf structure. It is supposed to describe an XFS dir2 leaf format btree block, but due to the variable sized nature of almost all elements in it it can't actuall do anything close to that job. Remove the members that are after the first variable sized array, given that they could only be used for sizeof expressions that can as well just use the underlying types directly, and make the ents array a real C99 variable sized array. Also factor out the xfs_dir2_leaf_size, to make the sizing of a leaf entry which already was convoluted somewhat readable after using the longer type names in the sizeof expressions. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Alex Elder <aelder@sgi.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_dir2_leaf.h')
-rw-r--r--fs/xfs/xfs_dir2_leaf.h37
1 files changed, 31 insertions, 6 deletions
diff --git a/fs/xfs/xfs_dir2_leaf.h b/fs/xfs/xfs_dir2_leaf.h
index bc620622c342..140281adc7e5 100644
--- a/fs/xfs/xfs_dir2_leaf.h
+++ b/fs/xfs/xfs_dir2_leaf.h
@@ -18,6 +18,36 @@
#ifndef __XFS_DIR2_LEAF_H__
#define __XFS_DIR2_LEAF_H__
+/*
+ * Directory format 2, leaf block structures.
+ *
+ * A pure data block looks like the following drawing on disk:
+ *
+ * +---------------------------+
+ * | xfs_dir2_leaf_hdr_t |
+ * +---------------------------+
+ * | xfs_dir2_leaf_entry_t |
+ * | xfs_dir2_leaf_entry_t |
+ * | xfs_dir2_leaf_entry_t |
+ * | xfs_dir2_leaf_entry_t |
+ * | ... |
+ * +---------------------------+
+ * | xfs_dir2_data_off_t |
+ * | xfs_dir2_data_off_t |
+ * | xfs_dir2_data_off_t |
+ * | ... |
+ * +---------------------------+
+ * | xfs_dir2_leaf_tail_t |
+ * +---------------------------+
+ *
+ * The bests (xfs_dir2_data_off_t members) and tail are at the end of the
+ * block for single-leaf only (magic = XFS_DIR2_LEAF1_MAGIC not
+ * XFS_DIR2_LEAFN_MAGIC).
+ *
+ * As all the entries are variable size structures the accessors in this
+ * file should be used to iterate over them.
+ */
+
struct uio;
struct xfs_dabuf;
struct xfs_da_args;
@@ -67,15 +97,10 @@ typedef struct xfs_dir2_leaf_tail {
/*
* Leaf block.
- * bests and tail are at the end of the block for single-leaf only
- * (magic = XFS_DIR2_LEAF1_MAGIC not XFS_DIR2_LEAFN_MAGIC).
*/
typedef struct xfs_dir2_leaf {
xfs_dir2_leaf_hdr_t hdr; /* leaf header */
- xfs_dir2_leaf_entry_t ents[1]; /* entries */
- /* ... */
- xfs_dir2_data_off_t bests[1]; /* best free counts */
- xfs_dir2_leaf_tail_t tail; /* leaf tail */
+ xfs_dir2_leaf_entry_t ents[]; /* entries */
} xfs_dir2_leaf_t;
/*