Class: Ext4::HashTreeEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/fs/ext4/hash_tree_entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(buf, first = false) ⇒ HashTreeEntry

Returns a new instance of HashTreeEntry.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/fs/ext4/hash_tree_entry.rb', line 25

def initialize(buf, first = false)
  raise "Ext4::HashTreeEntry.initialize: Nil buffer" if buf.nil?

  @first = first

  if first
    @hte             = HASH_TREE_ENTRY_FIRST.decode(buf)
    @max_descriptors = @hte['max_descriptors']
    @cur_descriptors = @hte['cur_descriptors']
    @node            = @hte['first_node']
  else
    @hte             = HASH_TREE_ENTRY_NEXT.decode(buf)
    @min_hash        = @hte['min_hash']
    @node            = @hte['next_node']
  end
end

Instance Attribute Details

#cur_descriptorsObject (readonly)

Returns the value of attribute cur_descriptors.



23
24
25
# File 'lib/fs/ext4/hash_tree_entry.rb', line 23

def cur_descriptors
  @cur_descriptors
end

#firstObject (readonly)

Returns the value of attribute first.



23
24
25
# File 'lib/fs/ext4/hash_tree_entry.rb', line 23

def first
  @first
end

#max_descriptorsObject (readonly)

Returns the value of attribute max_descriptors.



23
24
25
# File 'lib/fs/ext4/hash_tree_entry.rb', line 23

def max_descriptors
  @max_descriptors
end

#min_hashObject (readonly)

Returns the value of attribute min_hash.



23
24
25
# File 'lib/fs/ext4/hash_tree_entry.rb', line 23

def min_hash
  @min_hash
end

#nodeObject (readonly)

Returns the value of attribute node.



23
24
25
# File 'lib/fs/ext4/hash_tree_entry.rb', line 23

def node
  @node
end

Instance Method Details

#dumpObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/fs/ext4/hash_tree_entry.rb', line 42

def dump
  out = "\#<#{self.class}:0x#{'%08x' % object_id}>\n"
  if @first
    out += "First Node?     : true\n"
    out += "Max Descriptors : #{@max_descriptors}\n"
    out += "Cur Descriptors : #{@cur_descriptors}\n"
    out += "First Node      : #{@node}\n"
  else
    out += "First Node?     : false\n"
    out += "Min Hash        : #{@min_hash}\n"
    out += "Next Node       : #{@node}\n"
  end

  out
end