From 54b951fcdf53a4da848461495fd22758ef66668e Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Fri, 13 May 2022 20:13:57 +0200 Subject: [PATCH] Make default io allocators part of internal API Signed-off-by: Robert Baldyga --- src/ocf_io.c | 10 +++++----- src/ocf_io_priv.h | 13 ++++++++++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/ocf_io.c b/src/ocf_io.c index 0610449..718ae24 100644 --- a/src/ocf_io.c +++ b/src/ocf_io.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -31,7 +31,7 @@ #define OCF_IO_TOTAL(priv_size) \ (sizeof(struct ocf_io_internal) + priv_size) -static int ocf_io_allocator_default_init(ocf_io_allocator_t allocator, +int ocf_io_allocator_default_init(ocf_io_allocator_t allocator, uint32_t priv_size, const char *name) { allocator->priv = env_allocator_create(OCF_IO_TOTAL(priv_size), name, @@ -42,20 +42,20 @@ static int ocf_io_allocator_default_init(ocf_io_allocator_t allocator, return 0; } -static void ocf_io_allocator_default_deinit(ocf_io_allocator_t allocator) +void ocf_io_allocator_default_deinit(ocf_io_allocator_t allocator) { env_allocator_destroy(allocator->priv); allocator->priv = NULL; } -static void *ocf_io_allocator_default_new(ocf_io_allocator_t allocator, +void *ocf_io_allocator_default_new(ocf_io_allocator_t allocator, ocf_volume_t volume, ocf_queue_t queue, uint64_t addr, uint32_t bytes, uint32_t dir) { return env_allocator_new(allocator->priv); } -static void ocf_io_allocator_default_del(ocf_io_allocator_t allocator, void *obj) +void ocf_io_allocator_default_del(ocf_io_allocator_t allocator, void *obj) { env_allocator_del(allocator->priv, obj); } diff --git a/src/ocf_io_priv.h b/src/ocf_io_priv.h index 0e219f7..b26d5dd 100644 --- a/src/ocf_io_priv.h +++ b/src/ocf_io_priv.h @@ -1,5 +1,5 @@ /* - * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2012-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -27,6 +27,17 @@ static inline struct ocf_io_internal *ocf_io_get_internal(struct ocf_io* io) return container_of(io, struct ocf_io_internal, io); } +int ocf_io_allocator_default_init(ocf_io_allocator_t allocator, + uint32_t priv_size, const char *name); + +void ocf_io_allocator_default_deinit(ocf_io_allocator_t allocator); + +void *ocf_io_allocator_default_new(ocf_io_allocator_t allocator, + ocf_volume_t volume, ocf_queue_t queue, + uint64_t addr, uint32_t bytes, uint32_t dir); + +void ocf_io_allocator_default_del(ocf_io_allocator_t allocator, void *obj); + int ocf_io_allocator_init(ocf_io_allocator_t allocator, ocf_io_allocator_type_t type, uint32_t priv_size, const char *name);