Class: FFI::VixDiskLib::SafeCreateParams

Inherits:
Object
  • Object
show all
Extended by:
Library, API
Defined in:
lib/ffi-vix_disk_lib/safe_create_params.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

Instance Method Summary collapse

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(in_create_parms) ⇒ SafeCreateParams

Read the contents of a CreateParams structure passed as an argument into FFI memory which will be allocated to be used when calling out to VixDiskLib



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ffi-vix_disk_lib/safe_create_params.rb', line 14

def initialize(in_create_parms)
  create_parms = FFI::MemoryPointer.new(VixDiskLib::CreateParams, 1, true)
  create_parms_start = create_parms
  disk_type = in_create_parms[:diskType]
  create_parms = create_parms_start + VixDiskLib::CreateParams.offset_of(:diskType)
  create_parms.write_int(DiskType[disk_type]) unless in_create_parms[:diskType].nil?
  adapter_type = in_create_parms[:adapterType]
  create_parms = create_parms_start + VixDiskLib::CreateParams.offset_of(:adapterType)
  create_parms.write_int(AdapterType[adapter_type]) unless in_create_parms[:adapterType].nil?
  create_parms = create_parms_start + VixDiskLib::CreateParams.offset_of(:hwVersion)
  create_parms.write_uint16(in_create_parms[:hwVersion]) unless in_create_parms[:hwVersion].nil?
  create_parms = create_parms_start + VixDiskLib::CreateParams.offset_of(:capacity)
  create_parms.write_uint64(in_create_parms[:capacity]) unless in_create_parms[:capacity].nil?
  @create_params = create_parms_start
end

Instance Attribute Details

#create_paramsObject (readonly)

Returns the value of attribute create_params.



7
8
9
# File 'lib/ffi-vix_disk_lib/safe_create_params.rb', line 7

def create_params
  @create_params
end