Class: Ext4::ExtentHeader

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(buf) ⇒ ExtentHeader

Returns a new instance of ExtentHeader.



19
20
21
22
23
24
25
26
27
28
# File 'lib/fs/ext4/extent_header.rb', line 19

def initialize(buf)
  raise "Ext4::ExtentHeader.initialize: Nil buffer" if buf.nil?
  @eh = EXTENT_HEADER.decode(buf)

  @magic      = @eh['magic']
  @entries    = @eh['entries']
  @max        = @eh['max']
  @depth      = @eh['depth']
  @generation = @eh['generation']
end

Instance Attribute Details

#depthObject (readonly)

Returns the value of attribute depth.



17
18
19
# File 'lib/fs/ext4/extent_header.rb', line 17

def depth
  @depth
end

#entriesObject (readonly)

Returns the value of attribute entries.



17
18
19
# File 'lib/fs/ext4/extent_header.rb', line 17

def entries
  @entries
end

#generationObject (readonly)

Returns the value of attribute generation.



17
18
19
# File 'lib/fs/ext4/extent_header.rb', line 17

def generation
  @generation
end

#magicObject (readonly)

Returns the value of attribute magic.



17
18
19
# File 'lib/fs/ext4/extent_header.rb', line 17

def magic
  @magic
end

#maxObject (readonly)

Returns the value of attribute max.



17
18
19
# File 'lib/fs/ext4/extent_header.rb', line 17

def max
  @max
end

Instance Method Details

#dumpObject



30
31
32
33
34
35
36
37
38
# File 'lib/fs/ext4/extent_header.rb', line 30

def dump
  out = "\#<#{self.class}:0x#{'%08x' % object_id}>\n"
  out += "Magic        : #{@magic}\n"
  out += "Entries      : #{@entries}\n"
  out += "Max          : #{@max}\n"
  out += "Depth        : #{@depth}\n"
  out += "Generation   : #{@generation}\n"
  out
end