summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorChris Mason2007-03-13 01:12:07 +0100
committerDavid Woodhouse2007-03-13 01:12:07 +0100
commit0783fcfc4dc19b8bb99bd51b7afa669ba4cbd377 (patch)
tree0d7d68c33e8ff954e7614395f05d01d47d107f05 /fs/btrfs/ctree.h
parentBtrfs: struct key endian fixes (diff)
downloadkernel-qcow2-linux-0783fcfc4dc19b8bb99bd51b7afa669ba4cbd377.tar.gz
kernel-qcow2-linux-0783fcfc4dc19b8bb99bd51b7afa669ba4cbd377.tar.xz
kernel-qcow2-linux-0783fcfc4dc19b8bb99bd51b7afa669ba4cbd377.zip
Btrfs: struct item endian fixes
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h34
1 files changed, 30 insertions, 4 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 58e03e90f23a..b03df154dcdb 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -98,10 +98,10 @@ struct ctree_super_block {
* the key flags parameter. offset and size tell us where to find
* the item in the leaf (relative to the start of the data area)
*/
-struct item {
+struct btrfs_item {
struct btrfs_disk_key key;
- u16 offset;
- u16 size;
+ __le16 offset;
+ __le16 size;
} __attribute__ ((__packed__));
/*
@@ -115,7 +115,8 @@ struct item {
struct leaf {
struct btrfs_header header;
union {
- struct item items[LEAF_DATA_SIZE/sizeof(struct item)];
+ struct btrfs_item items[LEAF_DATA_SIZE/
+ sizeof(struct btrfs_item)];
u8 data[CTREE_BLOCKSIZE-sizeof(struct btrfs_header)];
};
} __attribute__ ((__packed__));
@@ -152,6 +153,31 @@ struct ctree_path {
int slots[MAX_LEVEL];
};
+static inline u16 btrfs_item_offset(struct btrfs_item *item)
+{
+ return le16_to_cpu(item->offset);
+}
+
+static inline void btrfs_set_item_offset(struct btrfs_item *item, u16 val)
+{
+ item->offset = cpu_to_le16(val);
+}
+
+static inline u16 btrfs_item_end(struct btrfs_item *item)
+{
+ return le16_to_cpu(item->offset) + le16_to_cpu(item->size);
+}
+
+static inline u16 btrfs_item_size(struct btrfs_item *item)
+{
+ return le16_to_cpu(item->size);
+}
+
+static inline void btrfs_set_item_size(struct btrfs_item *item, u16 val)
+{
+ item->size = cpu_to_le16(val);
+}
+
static inline void btrfs_disk_key_to_cpu(struct btrfs_key *cpu,
struct btrfs_disk_key *disk)
{