class VirtDisk::BlockFile

Attributes

path[RW]

Public Class Methods

new(path) click to toggle source
# File lib/virt_disk/block_file.rb, line 5
def initialize(path)
  @path = path
  @file = defined?(VirtFS) ? VirtFS::VFile.open(path) : File.open(path)
end

Public Instance Methods

block_size() click to toggle source
# File lib/virt_disk/block_file.rb, line 10
def block_size
  1
end
close() click to toggle source
# File lib/virt_disk/block_file.rb, line 18
def close
  @file.close
end
raw_read(start, len) click to toggle source
# File lib/virt_disk/block_file.rb, line 22
def raw_read(start, len)
  @file.seek start
  @file.read len
end
raw_write(buf, start, len) click to toggle source
# File lib/virt_disk/block_file.rb, line 27
def raw_write(buf, start, len)
  @file.seek start
  @file.write buf, len
end
size() click to toggle source
# File lib/virt_disk/block_file.rb, line 14
def size
  @file.size
end