diff options
author | David Sterba <dsterba@suse.com> | 2016-05-03 16:00:05 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-05-11 15:53:16 +0200 |
commit | 64a4800875956162b8dec799ac70e89cd7502ce8 (patch) | |
tree | 1072c8735a073e4cde6c1e9ee08d4bba46c83e69 /ctree.h | |
parent | a6ffadee7b42e067546cac70c3462404faac9a56 (diff) |
btrfs-progs: add getters for ioctl search_header
The search header is usually accessed in an unaligned way, we could
trigger errors (SIGBUS) on architectures that do not support that.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'ctree.h')
-rw-r--r-- | ctree.h | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -2201,6 +2201,32 @@ static inline u32 btrfs_file_extent_inline_item_len(struct extent_buffer *eb, return btrfs_item_size(eb, e) - offset; } +/* struct btrfs_ioctl_search_header */ +static inline u64 btrfs_search_header_transid(struct btrfs_ioctl_search_header *sh) +{ + return get_unaligned_64(&sh->transid); +} + +static inline u64 btrfs_search_header_objectid(struct btrfs_ioctl_search_header *sh) +{ + return get_unaligned_64(&sh->objectid); +} + +static inline u64 btrfs_search_header_offset(struct btrfs_ioctl_search_header *sh) +{ + return get_unaligned_64(&sh->offset); +} + +static inline u32 btrfs_search_header_type(struct btrfs_ioctl_search_header *sh) +{ + return get_unaligned_32(&sh->type); +} + +static inline u32 btrfs_search_header_len(struct btrfs_ioctl_search_header *sh) +{ + return get_unaligned_32(&sh->len); +} + /* this returns the number of file bytes represented by the inline item. * If an item is compressed, this is the uncompressed size */ |