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.1.5 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.1.4 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.1.3 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.1.2 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.1.1 lib/fs/ext4/extent_header.rb
manageiq-smartstate-0.1.0 lib/fs/ext4/extent_header.rb