Class: Ext4::Extent

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(buf) ⇒ Extent

Returns a new instance of Extent.



18
19
20
21
22
23
24
25
# File 'lib/fs/ext4/extent.rb', line 18

def initialize(buf)
  raise "Ext4::Extent.initialize: Nil buffer" if buf.nil?
  @extent = EXTENT.decode(buf)

  @block      = @extent['block']
  @length     = @extent['length']
  @start      = (@extent['start_hi'] << 32) | @extent['start_lo']
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



16
17
18
# File 'lib/fs/ext4/extent.rb', line 16

def block
  @block
end

#lengthObject (readonly)

Returns the value of attribute length.



16
17
18
# File 'lib/fs/ext4/extent.rb', line 16

def length
  @length
end

#startObject (readonly)

Returns the value of attribute start.



16
17
18
# File 'lib/fs/ext4/extent.rb', line 16

def start
  @start
end

Instance Method Details

#dumpObject



27
28
29
30
31
32
33
# File 'lib/fs/ext4/extent.rb', line 27

def dump
  out = "\#<#{self.class}:0x#{'%08x' % object_id}>\n"
  out += "Block        : #{@block}\n"
  out += "Length       : #{@length}\n"
  out += "Start        : #{@start}\n"
  out
end