pyocf: move C wrappers to newly added "c" diretory

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski
2021-11-25 15:39:11 +01:00
parent f66eefb3bd
commit 978620f9e3
6 changed files with 4 additions and 3 deletions

View File

@@ -0,0 +1,14 @@
/*
* Copyright(c) 2021-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "ocf/ocf_io.h"
#include "ocf/ocf_core.h"
const struct ocf_volume_uuid *ocf_core_get_uuid_wrapper(ocf_core_t core)
{
return ocf_core_get_uuid(core);
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "ocf/ocf_io.h"
#include "ocf/ocf_core.h"
void ocf_io_set_cmpl_wrapper(struct ocf_io *io, void *context,
void *context2, ocf_end_io_t fn)
{
ocf_io_set_cmpl(io, context, context2, fn);
}
void ocf_io_set_start_wrapper(struct ocf_io *io, ocf_start_io_t fn)
{
ocf_io_set_start(io, fn);
}
void ocf_io_set_handle_wrapper(struct ocf_io *io, ocf_handle_io_t fn)
{
ocf_io_set_handle(io, fn);
}
void ocf_core_submit_io_wrapper(struct ocf_io *io)
{
ocf_core_submit_io(io);
}
void ocf_core_submit_flush_wrapper(struct ocf_io *io)
{
ocf_core_submit_flush(io);
}
void ocf_core_submit_discard_wrapper(struct ocf_io *io)
{
ocf_core_submit_discard(io);
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright(c) 2012-2021 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <ocf/ocf_types.h>
#include <ocf/ocf_logger.h>
#include <stdarg.h>
#include "ocf_env.h"
#define LOG_BUFFER_SIZE 4096
struct pyocf_logger_priv {
int (*pyocf_log)(void *pyocf_logger, ocf_logger_lvl_t lvl, char *msg);
};
int pyocf_printf_helper(ocf_logger_t logger, ocf_logger_lvl_t lvl,
const char *fmt, va_list args)
{
char *buffer = env_zalloc(LOG_BUFFER_SIZE, ENV_MEM_NORMAL);
struct pyocf_logger_priv *priv = ocf_logger_get_priv(logger);
int ret;
if (!buffer) {
ret = -ENOMEM;
goto out;
}
ret = vsnprintf(buffer, LOG_BUFFER_SIZE, fmt, args);
if (ret < 0) {
env_free(buffer);
goto out;
}
ret = priv->pyocf_log(logger, lvl, buffer);
env_free(buffer);
out:
return ret;
}

View File

@@ -0,0 +1,12 @@
/*
* Copyright(c) 2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "ocf/ocf_mngt.h"
void ocf_mngt_cache_config_set_default_wrapper(struct ocf_mngt_cache_config *cfg)
{
ocf_mngt_cache_config_set_default(cfg);
}

View File

@@ -0,0 +1,12 @@
/*
* Copyright(c) 2012-2021 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "ocf/ocf_io.h"
#include "ocf/ocf_volume.h"
const char *ocf_uuid_to_str_wrapper(const struct ocf_volume_uuid *uuid) {
return ocf_uuid_to_str(uuid);
}