pyocf: ocf_volume_new_io wrapper
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
parent
e0c762387c
commit
d60e48ee26
@ -121,14 +121,17 @@ class Core:
|
|||||||
return Volume.get_instance(lib.ocf_core_get_volume(self.handle))
|
return Volume.get_instance(lib.ocf_core_get_volume(self.handle))
|
||||||
|
|
||||||
def new_core_io(
|
def new_core_io(
|
||||||
self, queue: Queue, addr: int, length: int, direction: IoDir,
|
self,
|
||||||
io_class: int, flags: int
|
queue: Queue,
|
||||||
|
addr: int,
|
||||||
|
length: int,
|
||||||
|
direction: IoDir,
|
||||||
|
io_class: int,
|
||||||
|
flags: int,
|
||||||
):
|
):
|
||||||
lib = OcfLib.getInstance()
|
return self.get_volume().new_io(
|
||||||
volume = lib.ocf_core_get_volume(self.handle)
|
queue, addr, length, direction, io_class, flags
|
||||||
io = lib.ocf_volume_new_io(
|
)
|
||||||
volume, queue.handle, addr, length, direction, io_class, flags)
|
|
||||||
return Io.from_pointer(io)
|
|
||||||
|
|
||||||
def get_default_queue(self):
|
def get_default_queue(self):
|
||||||
return self.cache.get_default_queue()
|
return self.cache.get_default_queue()
|
||||||
@ -233,16 +236,6 @@ class Core:
|
|||||||
lib = OcfLib.getInstance()
|
lib = OcfLib.getInstance()
|
||||||
lib.ocf_core_get_uuid_wrapper.restype = POINTER(Uuid)
|
lib.ocf_core_get_uuid_wrapper.restype = POINTER(Uuid)
|
||||||
lib.ocf_core_get_uuid_wrapper.argtypes = [c_void_p]
|
lib.ocf_core_get_uuid_wrapper.argtypes = [c_void_p]
|
||||||
lib.ocf_volume_new_io.argtypes = [
|
|
||||||
c_void_p,
|
|
||||||
c_void_p,
|
|
||||||
c_uint64,
|
|
||||||
c_uint32,
|
|
||||||
c_uint32,
|
|
||||||
c_uint32,
|
|
||||||
c_uint64,
|
|
||||||
]
|
|
||||||
lib.ocf_volume_new_io.restype = c_void_p
|
|
||||||
lib.ocf_core_get_volume.argtypes = [c_void_p]
|
lib.ocf_core_get_volume.argtypes = [c_void_p]
|
||||||
lib.ocf_core_get_volume.restype = c_void_p
|
lib.ocf_core_get_volume.restype = c_void_p
|
||||||
lib.ocf_core_get_front_volume.argtypes = [c_void_p]
|
lib.ocf_core_get_front_volume.argtypes = [c_void_p]
|
||||||
|
@ -24,6 +24,7 @@ from hashlib import md5
|
|||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
from .io import Io, IoOps, IoDir
|
from .io import Io, IoOps, IoDir
|
||||||
|
from .queue import Queue
|
||||||
from .shared import OcfErrorCode, Uuid
|
from .shared import OcfErrorCode, Uuid
|
||||||
from ..ocf import OcfLib
|
from ..ocf import OcfLib
|
||||||
from ..utils import print_buffer, Size as S
|
from ..utils import print_buffer, Size as S
|
||||||
@ -139,6 +140,7 @@ class Volume:
|
|||||||
return -OcfErrorCode.OCF_ERR_NOT_OPEN_EXC
|
return -OcfErrorCode.OCF_ERR_NOT_OPEN_EXC
|
||||||
|
|
||||||
Volume._instances_[ref] = volume
|
Volume._instances_[ref] = volume
|
||||||
|
volume.handle = ref
|
||||||
|
|
||||||
return volume.do_open()
|
return volume.do_open()
|
||||||
|
|
||||||
@ -306,6 +308,21 @@ class Volume:
|
|||||||
else:
|
else:
|
||||||
self._reject_io(io)
|
self._reject_io(io)
|
||||||
|
|
||||||
|
def new_io(
|
||||||
|
self,
|
||||||
|
queue: Queue,
|
||||||
|
addr: int,
|
||||||
|
length: int,
|
||||||
|
direction: IoDir,
|
||||||
|
io_class: int,
|
||||||
|
flags: int,
|
||||||
|
):
|
||||||
|
lib = OcfLib.getInstance()
|
||||||
|
io = lib.ocf_volume_new_io(
|
||||||
|
self.handle, queue.handle, addr, length, direction, io_class, flags
|
||||||
|
)
|
||||||
|
return Io.from_pointer(io)
|
||||||
|
|
||||||
|
|
||||||
class RamVolume(Volume):
|
class RamVolume(Volume):
|
||||||
props = None
|
props = None
|
||||||
@ -451,3 +468,13 @@ lib.ocf_io_get_volume.argtypes = [c_void_p]
|
|||||||
lib.ocf_io_get_volume.restype = 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.argtypes = [c_void_p]
|
||||||
lib.ocf_io_get_data.restype = c_void_p
|
lib.ocf_io_get_data.restype = c_void_p
|
||||||
|
lib.ocf_volume_new_io.argtypes = [
|
||||||
|
c_void_p,
|
||||||
|
c_void_p,
|
||||||
|
c_uint64,
|
||||||
|
c_uint32,
|
||||||
|
c_uint32,
|
||||||
|
c_uint32,
|
||||||
|
c_uint64,
|
||||||
|
]
|
||||||
|
lib.ocf_volume_new_io.restype = c_void_p
|
||||||
|
Loading…
Reference in New Issue
Block a user