Class: XFS::BmapBTreeBlock
- Inherits:
-
Object
- Object
- XFS::BmapBTreeBlock
- Defined in:
- lib/fs/xfs/bmap_btree_block.rb
Overview
//////////////////////////////////////////////////////////////////////////// // Class.
Constant Summary collapse
- XFS_BTREE_LONG_PTRS =
1- XFS_BMAP_MAGIC =
0x424d4150- XFS_BMAP_CRC_MAGIC =
0x424d4133
Instance Attribute Summary collapse
-
#buffer ⇒ Object
readonly
// initialize.
-
#header_size ⇒ Object
readonly
// initialize.
-
#left_sibling ⇒ Object
readonly
// initialize.
-
#level ⇒ Object
readonly
// initialize.
-
#number_records ⇒ Object
readonly
// initialize.
-
#right_sibling ⇒ Object
readonly
// initialize.
Instance Method Summary collapse
- #btree_block_length ⇒ Object
-
#initialize(buffer, sb) ⇒ BmapBTreeBlock
constructor
A new instance of BmapBTreeBlock.
Constructor Details
#initialize(buffer, sb) ⇒ BmapBTreeBlock
Returns a new instance of BmapBTreeBlock.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/fs/xfs/bmap_btree_block.rb', line 83 def initialize(buffer, sb) @sb = sb if defined? XFS_BTREE_LONG_PTRS if @sb.version_has_crc? @btree_block = BTREE_BLOCK_LONG.decode(buffer) else @btree_block = BTREE_BLOCK_LONG_NOCRC.decode(buffer) end else if sb.version_has_crc? @btree_block = BTREE_BLOCK_SHORT.decode(buffer) else @btree_block = BTREE_BLOCK_SHORT_NOCRC.decode(buffer) end end @header_size = btree_block_length @number_records = @btree_block['num_recs'] @level = @btree_block['level'] raise "Invalid BTreeBlock" unless (@btree_block['magic_num'] == XFS_BMAP_MAGIC) || (@btree_block['magic_num'] == XFS_BMAP_CRC_MAGIC) @left_sibling = @btree_block['left_sibling'] @right_sibling = @btree_block['right_sibling'] @buffer = buffer end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
// initialize
81 82 83 |
# File 'lib/fs/xfs/bmap_btree_block.rb', line 81 def buffer @buffer end |
#header_size ⇒ Object (readonly)
// initialize
81 82 83 |
# File 'lib/fs/xfs/bmap_btree_block.rb', line 81 def header_size @header_size end |
#left_sibling ⇒ Object (readonly)
// initialize
81 82 83 |
# File 'lib/fs/xfs/bmap_btree_block.rb', line 81 def left_sibling @left_sibling end |
#level ⇒ Object (readonly)
// initialize
81 82 83 |
# File 'lib/fs/xfs/bmap_btree_block.rb', line 81 def level @level end |
#number_records ⇒ Object (readonly)
// initialize
81 82 83 |
# File 'lib/fs/xfs/bmap_btree_block.rb', line 81 def number_records @number_records end |
#right_sibling ⇒ Object (readonly)
// initialize
81 82 83 |
# File 'lib/fs/xfs/bmap_btree_block.rb', line 81 def right_sibling @right_sibling end |
Instance Method Details
#btree_block_length ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/fs/xfs/bmap_btree_block.rb', line 108 def btree_block_length if defined? XFS_BTREE_LONG_PTRS if @sb.version_has_crc? len = SIZEOF_BTREE_BLOCK_LONG else len = SIZEOF_BTREE_BLOCK_LONG_NOCRC end else if @sb.version_has_crc? len = SIZEOF_BTREE_BLOCK_SHORT else len = SIZEOF_BTREE_BLOCK_SHORT_NOCRC end end len end |