Make default io allocators part of internal API

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga 2022-05-13 20:13:57 +02:00 committed by Jan Musial
parent 16e824affd
commit 54b951fcdf
2 changed files with 17 additions and 6 deletions

View File

@ -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);
}

View File

@ -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);