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.2.18 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.2.17 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.2.16 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.2.15 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.2.14 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.2.13 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.2.12 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.2.11 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.2.10 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.2.9 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.2.8 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.2.7 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.2.6 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.2.5 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.2.4 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.2.3 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.2.2 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.2.1 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.2.0 lib/fs/ext4/alloc_bitmap.rb
manageiq-smartstate-0.1.6 lib/fs/ext4/alloc_bitmap.rb