Sha256: fb9fb5578a986b24ee94c100fd147aa8e5f08126b3e8db2e9a73c5e5f35e31ad

Contents?: true

Size: 1.16 KB

Versions: 66

Compression:

Stored size: 1.16 KB

Contents

require 'binary_struct'

module Ext4
  # ////////////////////////////////////////////////////////////////////////////
  # // Data definitions.

  EXTENT_HEADER = BinaryStruct.new([
    'S',  'magic',      # Signature.
    'S',  'entries',    # Number of Valid Entries
    'S',  'max',        # Capacity of Store in Entries
    'S',  'depth',      # Has tree real underlying blocks?
    'L',  'generation', # Generation of the tree.
  ])
  SIZEOF_EXTENT_HEADER = EXTENT_HEADER.size

  class ExtentHeader
    attr_reader :magic, :entries, :max, :depth, :generation

    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

    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
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
manageiq-smartstate-0.10.1 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.10.0 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.9.0 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.8.1 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.8.0 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.7.0 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.6.2 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.5.10 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.3.10 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.6.1 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.3.9 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.6.0 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.5.9 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.5.8 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.3.8 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.5.7 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.3.7 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.5.6 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.3.6 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.5.5 lib/fs/ext4/extent_header.rb