Class: FFI::VixDiskLib::DiskInfo
- Inherits:
-
Object
- Object
- FFI::VixDiskLib::DiskInfo
- Extended by:
- API
- Defined in:
- lib/ffi-vix_disk_lib/disk_info.rb
Constant Summary
Constants included from API
API::AdapterType, API::ConnectParams, API::CredType, API::DiskType, API::HWVERSION_CURRENT, API::HWVERSION_ESX30, API::HWVERSION_WORKSTATION_4, API::HWVERSION_WORKSTATION_5, API::HWVERSION_WORKSTATION_6, API::LOADED_LIBRARY, API::VERSION, API::VIXDISKLIB_FLAG_OPEN_READ_ONLY, API::VIXDISKLIB_FLAG_OPEN_SINGLE_LINK, API::VIXDISKLIB_FLAG_OPEN_UNBUFFERED, API::VIXDISKLIB_SECTOR_SIZE, API::VixErrorType
Instance Attribute Summary collapse
-
#info ⇒ Object
readonly
Returns the value of attribute info.
Instance Method Summary collapse
- #geometry_attribute(info, offset_value, attribute) ⇒ Object
-
#initialize(disk_handle) ⇒ DiskInfo
constructor
Initialize a hash with the disk info for the specified handle using the VixDiskLib_GetInfo method.
Methods included from API
ProgressFunc, attach, attach_function, check_repair, cleanup, clone, close, connect, connect_ex, create, create_child, defragment, disconnect, end_access, enum, evaluate_versioned_connect_params, exit, free_connect_params, free_error_text, get_connect_params, get_error_text, get_info, get_metadata_keys, get_transport_mode, grow, init, initEx, is_attach_possible, list_transport_modes, load_error, open, prepare_for_access, read, read_metadata, rename, shrink, space_needed_for_clone, unlink, vix_error_code, vix_failed?, vix_succeeded?, write, write_metadata
Constructor Details
#initialize(disk_handle) ⇒ DiskInfo
Initialize a hash with the disk info for the specified handle using the VixDiskLib_GetInfo method. This is a helper class for the VixDiskLib::Api::get_info method.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/ffi-vix_disk_lib/disk_info.rb', line 17 def initialize(disk_handle) ruby_info = {} info = FFI::MemoryPointer.new :pointer vix_error = API.get_info(disk_handle, info) ApiWrapper.check_error(vix_error, __method__) real_info = info.get_pointer(0) ruby_info[:biosGeo] = {} ruby_info[:physGeo] = {} bios_offset = API::Info.offset_of(:biosGeo) phys_offset = API::Info.offset_of(:biosGeo) ruby_info[:biosGeo][:cylinders] = geometry_attribute(real_info, bios_offset, :cylinders) ruby_info[:biosGeo][:heads] = geometry_attribute(real_info, bios_offset, :heads) ruby_info[:biosGeo][:sectors] = geometry_attribute(real_info, bios_offset, :sectors) ruby_info[:physGeo][:cylinders] = geometry_attribute(real_info, phys_offset, :cylinders) ruby_info[:physGeo][:heads] = geometry_attribute(real_info, phys_offset, :heads) ruby_info[:physGeo][:sectors] = geometry_attribute(real_info, phys_offset, :sectors) ruby_info[:capacity] = real_info.get_uint64(API::Info.offset_of(:capacity)) ruby_info[:adapterType] = real_info.get_int(API::Info.offset_of(:adapterType)) ruby_info[:numLinks] = real_info.get_int(API::Info.offset_of(:numLinks)) parent_info = real_info + API::Info.offset_of(:parentFileNameHint) parent_info_str = parent_info.read_pointer ruby_info[:parentFileNameHint] = parent_info_str.read_string unless parent_info_str.null? uuid_info_str = (real_info + API::Info.offset_of(:uuid)).read_pointer ruby_info[:uuid] = uuid_info_str.read_string unless uuid_info_str.null? @info = ruby_info end |
Instance Attribute Details
#info ⇒ Object (readonly)
Returns the value of attribute info.
6 7 8 |
# File 'lib/ffi-vix_disk_lib/disk_info.rb', line 6 def info @info end |