ocf_io_internal - update tests
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
parent
4d2d31ff76
commit
1454b75c0f
@ -37,8 +37,6 @@ class Io(Structure):
|
||||
|
||||
_instances_ = {}
|
||||
_fields_ = [
|
||||
("_volume", c_void_p),
|
||||
("_ops", POINTER(IoOps)),
|
||||
("_addr", c_uint64),
|
||||
("_flags", c_uint64),
|
||||
("_bytes", c_uint32),
|
||||
@ -110,7 +108,7 @@ class Io(Structure):
|
||||
|
||||
def set_data(self, data: Data, offset: int = 0):
|
||||
self.data = data
|
||||
OcfLib.getInstance().ocf_io_set_data_wrapper(byref(self), data, offset)
|
||||
OcfLib.getInstance().ocf_io_set_data(byref(self), data, offset)
|
||||
|
||||
def set_queue(self, queue: Queue):
|
||||
OcfLib.getInstance().ocf_io_set_queue_wrapper(byref(self), queue.handle)
|
||||
@ -137,7 +135,7 @@ lib.ocf_io_set_queue_wrapper.argtypes = [POINTER(Io), c_uint32]
|
||||
lib.ocf_core_new_io_wrapper.argtypes = [c_void_p]
|
||||
lib.ocf_core_new_io_wrapper.restype = c_void_p
|
||||
|
||||
lib.ocf_io_set_data_wrapper.argtypes = [POINTER(Io), c_void_p, c_uint32]
|
||||
lib.ocf_io_set_data_wrapper.restype = c_int
|
||||
lib.ocf_io_set_data.argtypes = [POINTER(Io), c_void_p, c_uint32]
|
||||
lib.ocf_io_set_data.restype = c_int
|
||||
|
||||
lib.ocf_io_set_queue_wrapper.argtypes = [POINTER(Io), c_void_p]
|
||||
|
@ -145,7 +145,9 @@ class Volume(Structure):
|
||||
@VolumeOps.SUBMIT_IO
|
||||
def _submit_io(io):
|
||||
io_structure = cast(io, POINTER(Io))
|
||||
volume = Volume.get_instance(io_structure.contents._volume)
|
||||
volume = Volume.get_instance(
|
||||
OcfLib.getInstance().ocf_io_get_volume(io_structure)
|
||||
)
|
||||
|
||||
volume.submit_io(io_structure)
|
||||
|
||||
@ -153,7 +155,9 @@ class Volume(Structure):
|
||||
@VolumeOps.SUBMIT_FLUSH
|
||||
def _submit_flush(flush):
|
||||
io_structure = cast(flush, POINTER(Io))
|
||||
volume = Volume.get_instance(io_structure.contents._volume)
|
||||
volume = Volume.get_instance(
|
||||
OcfLib.getInstance().ocf_io_get_volume(io_structure)
|
||||
)
|
||||
|
||||
volume.submit_flush(io_structure)
|
||||
|
||||
@ -166,7 +170,9 @@ class Volume(Structure):
|
||||
@VolumeOps.SUBMIT_DISCARD
|
||||
def _submit_discard(discard):
|
||||
io_structure = cast(discard, POINTER(Io))
|
||||
volume = Volume.get_instance(io_structure.contents._volume)
|
||||
volume = Volume.get_instance(
|
||||
OcfLib.getInstance().ocf_io_get_volume(io_structure)
|
||||
)
|
||||
|
||||
volume.submit_discard(io_structure)
|
||||
|
||||
@ -273,11 +279,11 @@ class Volume(Structure):
|
||||
offset = io_priv.contents._offset
|
||||
|
||||
if io.contents._dir == IoDir.WRITE:
|
||||
src_ptr = cast(io.contents._ops.contents._get_data(io), c_void_p)
|
||||
src_ptr = cast(OcfLib.getInstance().ocf_io_get_data(io), c_void_p)
|
||||
src = Data.get_instance(src_ptr.value).handle.value + offset
|
||||
dst = self._storage + io.contents._addr
|
||||
elif io.contents._dir == IoDir.READ:
|
||||
dst_ptr = cast(io.contents._ops.contents._get_data(io), c_void_p)
|
||||
dst_ptr = cast(OcfLib.getInstance().ocf_io_get_data(io), c_void_p)
|
||||
dst = Data.get_instance(dst_ptr.value).handle.value + offset
|
||||
src = self._storage + io.contents._addr
|
||||
|
||||
@ -342,3 +348,7 @@ class TraceDevice(Volume):
|
||||
|
||||
lib = OcfLib.getInstance()
|
||||
lib.ocf_io_get_priv.restype = POINTER(VolumeIoPriv)
|
||||
lib.ocf_io_get_volume.argtypes = [c_void_p]
|
||||
lib.ocf_io_get_volume.restype = c_void_p
|
||||
lib.ocf_io_get_data.argtypes = [c_void_p]
|
||||
lib.ocf_io_get_data.restype = c_void_p
|
||||
|
@ -33,17 +33,6 @@ void ocf_io_set_handle_wrapper(struct ocf_io *io, ocf_handle_io_t fn)
|
||||
ocf_io_set_handle(io, fn);
|
||||
}
|
||||
|
||||
int ocf_io_set_data_wrapper(struct ocf_io *io, ctx_data_t *data,
|
||||
uint32_t offset)
|
||||
{
|
||||
return ocf_io_set_data(io, data, offset);
|
||||
}
|
||||
|
||||
ctx_data_t *ocf_io_get_data_wrapper(struct ocf_io *io)
|
||||
{
|
||||
return ocf_io_get_data(io);
|
||||
}
|
||||
|
||||
void ocf_io_set_queue_wrapper(struct ocf_io *io, ocf_queue_t queue)
|
||||
{
|
||||
ocf_io_set_queue(io, queue);
|
||||
|
Loading…
Reference in New Issue
Block a user