Sha256: 5b51a4eb7e120cb3a29873653227765430546e09e31e6b519403b1d20f515a17

Contents?: true

Size: 739 Bytes

Versions: 66

Compression:

Stored size: 739 Bytes

Contents

module Ext3
  class AllocBitmap
    def initialize(data)
      raise "Ext3::AllocBitmap.initialize: Nil data" if data.nil?
      @data = data
    end

    def isAllocated?(number)
      getStatus(number)
    end

    def [](number)
      getStatus(number)
    end

    def dump
      @data.hex_dump
    end

    private

    def getStatus(number)
      byte, mask = index(number)
      @data[byte] & mask == mask
    end

    def index(number)
      byte, bit = number.divmod(8)
      if byte > @data.size - 1
        msg = "AllocBitmap#index: "
        msg += "byte index #{byte} is out of range for data[0:#{@data.size - 1}]"
        raise msg
      end
      mask = 128 >> bit
      return byte, mask
    end
  end # class
end # module

Version data entries

66 entries across 66 versions & 1 rubygems

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