Sha256: 6ae7b5a894f709a77fa5492ddb0e25f2358c1a32aadaa05efeba0f9cfc51090e

Contents?: true

Size: 739 Bytes

Versions: 66

Compression:

Stored size: 739 Bytes

Contents

module Ext4
  class AllocBitmap
    def initialize(data)
      raise "Ext4::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/ext4/alloc_bitmap.rb
manageiq-smartstate-0.10.0 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.9.0 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.8.1 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.8.0 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.7.0 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.6.2 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.5.10 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.3.10 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.6.1 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.3.9 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.6.0 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.5.9 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.5.8 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.3.8 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.5.7 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.3.7 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.5.6 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.3.6 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.5.5 lib/fs/ext4/alloc_bitmap.rb