diff --git a/example/simple/src/main.c b/example/simple/src/main.c index cd503e7..1a0b07f 100644 --- a/example/simple/src/main.c +++ b/example/simple/src/main.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2021 Intel Corporation + * Copyright(c) 2019-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -260,11 +260,12 @@ int submit_io(ocf_core_t core, struct volume_data *data, uint64_t addr, uint64_t len, int dir, ocf_end_io_t cmpl) { ocf_cache_t cache = ocf_core_get_cache(core); + ocf_volume_t core_vol = ocf_core_get_front_volume(core); struct cache_priv *cache_priv = ocf_cache_get_priv(cache); struct ocf_io *io; /* Allocate new io */ - io = ocf_core_new_io(core, cache_priv->io_queue, addr, len, dir, 0, 0); + io = ocf_volume_new_io(core_vol, cache_priv->io_queue, addr, len, dir, 0, 0); if (!io) return -ENOMEM; diff --git a/inc/ocf_core.h b/inc/ocf_core.h index 04fff9b..e372369 100644 --- a/inc/ocf_core.h +++ b/inc/ocf_core.h @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -146,29 +146,6 @@ const char *ocf_core_get_name(ocf_core_t core); */ ocf_core_state_t ocf_core_get_state(ocf_core_t core); -/** - * @brief Allocate new ocf_io - * - * @param[in] core Core object - * @param[in] queue IO queue handle - * @param[in] addr OCF IO destination address - * @param[in] bytes OCF IO size in bytes - * @param[in] dir OCF IO direction - * @param[in] io_class OCF IO destination class - * @param[in] flags OCF IO flags - * - * @retval ocf_io object - */ -static inline struct ocf_io *ocf_core_new_io(ocf_core_t core, ocf_queue_t queue, - uint64_t addr, uint32_t bytes, uint32_t dir, - uint32_t io_class, uint64_t flags) -{ - ocf_volume_t volume = ocf_core_get_front_volume(core); - - return ocf_volume_new_io(volume, queue, addr, bytes, dir, - io_class, flags); -} - /** * @brief Submit ocf_io * diff --git a/tests/functional/pyocf/types/core.py b/tests/functional/pyocf/types/core.py index 8defc8f..c22a79f 100644 --- a/tests/functional/pyocf/types/core.py +++ b/tests/functional/pyocf/types/core.py @@ -99,40 +99,12 @@ class Core: def get_handle(self): return self.handle - def new_io( - self, queue: Queue, addr: int, length: int, direction: IoDir, - io_class: int, flags: int - ): - if not self.cache: - raise Exception("Core isn't attached to any cache") - - io = OcfLib.getInstance().ocf_core_new_io_wrapper( - self.handle, queue.handle, addr, length, direction, io_class, flags) - - if io is None: - raise Exception("Failed to create io!") - - return Io.from_pointer(io) - def get_front_volume(self): return Volume.get_instance(lib.ocf_core_get_front_volume(self.handle)) def get_volume(self): return Volume.get_instance(lib.ocf_core_get_volume(self.handle)) - def new_core_io( - self, - queue: Queue, - addr: int, - length: int, - direction: IoDir, - io_class: int, - flags: int, - ): - return self.get_volume().new_io( - queue, addr, length, direction, io_class, flags - ) - def get_default_queue(self): return self.cache.get_default_queue() @@ -250,13 +222,3 @@ lib.ocf_stats_collect_core.argtypes = [c_void_p, c_void_p, c_void_p, c_void_p, c lib.ocf_stats_collect_core.restype = c_int lib.ocf_core_get_info.argtypes = [c_void_p, c_void_p] lib.ocf_core_get_info.restype = c_int -lib.ocf_core_new_io_wrapper.argtypes = [ - c_void_p, - c_void_p, - c_uint64, - c_uint32, - c_uint32, - c_uint32, - c_uint64, -] -lib.ocf_core_new_io_wrapper.restype = c_void_p diff --git a/tests/functional/pyocf/types/io.py b/tests/functional/pyocf/types/io.py index 0bfea6d..e314a80 100644 --- a/tests/functional/pyocf/types/io.py +++ b/tests/functional/pyocf/types/io.py @@ -117,9 +117,6 @@ IoOps._fields_ = [("_set_data", IoOps.SET_DATA), ("_get_data", IoOps.GET_DATA)] lib = OcfLib.getInstance() lib.ocf_io_set_cmpl_wrapper.argtypes = [POINTER(Io), c_void_p, c_void_p, Io.END] -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.argtypes = [POINTER(Io), c_void_p, c_uint32] lib.ocf_io_set_data.restype = c_int diff --git a/tests/functional/pyocf/wrappers/ocf_io_wrappers.c b/tests/functional/pyocf/wrappers/ocf_io_wrappers.c index 7fe3f01..87e095d 100644 --- a/tests/functional/pyocf/wrappers/ocf_io_wrappers.c +++ b/tests/functional/pyocf/wrappers/ocf_io_wrappers.c @@ -6,13 +6,6 @@ #include "ocf/ocf_io.h" #include "ocf/ocf_core.h" -struct ocf_io *ocf_core_new_io_wrapper(ocf_core_t core, ocf_queue_t queue, - uint64_t addr, uint32_t bytes, uint32_t dir, - uint32_t io_class, uint64_t flags) -{ - return ocf_core_new_io(core, queue, addr, bytes, dir, io_class, flags); -} - void ocf_io_set_cmpl_wrapper(struct ocf_io *io, void *context, void *context2, ocf_end_io_t fn) {