diff --git a/include/crucible/btrfs-tree.h b/include/crucible/btrfs-tree.h index 44241da..1c67b25 100644 --- a/include/crucible/btrfs-tree.h +++ b/include/crucible/btrfs-tree.h @@ -64,11 +64,13 @@ namespace crucible { /// @{ Extent items (EXTENT_ITEM) uint64_t extent_begin() const; uint64_t extent_end() const; + uint64_t extent_flags() const; uint64_t extent_generation() const; /// @} /// @{ Root items uint64_t root_flags() const; + uint64_t root_refs() const; /// @} /// @{ Root backref items. diff --git a/lib/btrfs-tree.cc b/lib/btrfs-tree.cc index d597d68..14073cb 100644 --- a/lib/btrfs-tree.cc +++ b/lib/btrfs-tree.cc @@ -22,6 +22,13 @@ namespace crucible { return m_objectid + m_offset; } + uint64_t + BtrfsTreeItem::extent_flags() const + { + THROW_CHECK1(invalid_argument, btrfs_search_type_ntoa(m_type), m_type == BTRFS_EXTENT_ITEM_KEY); + return btrfs_get_member(&btrfs_extent_item::flags, m_data); + } + uint64_t BtrfsTreeItem::extent_generation() const { @@ -61,6 +68,13 @@ namespace crucible { return btrfs_get_member(&btrfs_root_item::flags, m_data); } + uint64_t + BtrfsTreeItem::root_refs() const + { + THROW_CHECK1(invalid_argument, btrfs_search_type_ntoa(m_type), m_type == BTRFS_ROOT_ITEM_KEY); + return btrfs_get_member(&btrfs_root_item::refs, m_data); + } + ostream & operator<<(ostream &os, const BtrfsTreeItem &bti) {