class Resilience::MBR

Constants

PARTITION_ADDRESSES
SIG
SIG_ADDRESS

Public Instance Methods

detected?() click to toggle source
# File lib/resilience/tables/boot.rb, line 33
def detected?
  image.seek SIG_ADDRESS
  sig = image.read(2)
  sig == SIG
end
fs_offsets() click to toggle source
# File lib/resilience/tables/boot.rb, line 39
def fs_offsets
  offsets = []
  PARTITION_ADDRESSES.each do |address|
    image.seek address
    address = image.read(4).unpack('V').first
    offsets << address * SECTOR_SIZE unless address == 0
  end
  offsets
end
gpt_offset() click to toggle source
# File lib/resilience/tables/boot.rb, line 59
def gpt_offset
  gpt_offsets.first
end
gpt_offsets() click to toggle source
# File lib/resilience/tables/boot.rb, line 49
def gpt_offsets
  offsets = []
  fs_offsets.each do |address|
    image.seek address
    sig = image.read(GPT::SIG.size).unpack('C*')
    offsets << address if sig == GPT::SIG
  end
  offsets
end