diff --git a/benchmark/benchmark_umf.hpp b/benchmark/benchmark_umf.hpp index 526ae2eae..4b88dabd0 100644 --- a/benchmark/benchmark_umf.hpp +++ b/benchmark/benchmark_umf.hpp @@ -229,7 +229,7 @@ struct fixed_provider : public provider_interface { provider_interface::params_ptr getParams(::benchmark::State &state) override { umf_fixed_memory_provider_params_handle_t raw_params = nullptr; - umfFixedMemoryProviderParamsCreate(&raw_params, mem, size); + umfFixedMemoryProviderParamsCreate(mem, size, &raw_params); if (!raw_params) { state.SkipWithError("Failed to create fixed provider params"); return {nullptr, [](void *) {}}; @@ -351,8 +351,8 @@ struct disjoint_pool_stack : public disjoint_pool { pools.push_back(rootPool); // root pool umf_fixed_memory_provider_params_handle_t params_fixed = nullptr; - umf_result = umfFixedMemoryProviderParamsCreate( - ¶ms_fixed, (void *)0x1, 0x1); // dummy + umf_result = umfFixedMemoryProviderParamsCreate((void *)0x1, 0x1, + ¶ms_fixed); // dummy size_t poolSize = firstPoolSize; size_t level_start = 0; diff --git a/examples/dram_and_fsdax/dram_and_fsdax.c b/examples/dram_and_fsdax/dram_and_fsdax.c index 80c7ecc03..ad2d12392 100644 --- a/examples/dram_and_fsdax/dram_and_fsdax.c +++ b/examples/dram_and_fsdax/dram_and_fsdax.c @@ -53,7 +53,7 @@ static umf_memory_pool_handle_t create_fsdax_pool(const char *path) { umf_result_t umf_result; umf_file_memory_provider_params_handle_t params_fsdax = NULL; - umf_result = umfFileMemoryProviderParamsCreate(¶ms_fsdax, path); + umf_result = umfFileMemoryProviderParamsCreate(path, ¶ms_fsdax); if (umf_result != UMF_RESULT_SUCCESS) { fprintf(stderr, "Failed to create the File Memory Provider params"); return NULL; diff --git a/include/umf/providers/provider_devdax_memory.h b/include/umf/providers/provider_devdax_memory.h index 91678ef7f..f8557f9a3 100644 --- a/include/umf/providers/provider_devdax_memory.h +++ b/include/umf/providers/provider_devdax_memory.h @@ -8,7 +8,7 @@ #ifndef UMF_DEVDAX_MEMORY_PROVIDER_H #define UMF_DEVDAX_MEMORY_PROVIDER_H -#include +#include #ifdef __cplusplus extern "C" { @@ -24,13 +24,13 @@ typedef struct umf_devdax_memory_provider_params_t *umf_devdax_memory_provider_params_handle_t; /// @brief Create a struct to store parameters of the Devdax Memory Provider. -/// @param hParams [out] handle to the newly created parameters struct. /// @param path [in] path of the device DAX. /// @param size [in] size of the device DAX in bytes. +/// @param hParams [out] handle to the newly created parameters struct. /// @return UMF_RESULT_SUCCESS on success or appropriate error code on failure. umf_result_t umfDevDaxMemoryProviderParamsCreate( - umf_devdax_memory_provider_params_handle_t *hParams, const char *path, - size_t size); + const char *path, size_t size, + umf_devdax_memory_provider_params_handle_t *hParams); /// @brief Destroy parameters struct. /// @param hParams [in] handle to the parameters of the Devdax Memory Provider. diff --git a/include/umf/providers/provider_file_memory.h b/include/umf/providers/provider_file_memory.h index fed5147cc..5d0c6eb16 100644 --- a/include/umf/providers/provider_file_memory.h +++ b/include/umf/providers/provider_file_memory.h @@ -8,7 +8,7 @@ #ifndef UMF_FILE_MEMORY_PROVIDER_H #define UMF_FILE_MEMORY_PROVIDER_H -#include +#include #ifdef __cplusplus extern "C" { @@ -24,11 +24,11 @@ typedef struct umf_file_memory_provider_params_t *umf_file_memory_provider_params_handle_t; /// @brief Create a struct to store parameters of the File Memory Provider. -/// @param hParams [out] handle to the newly created parameters struct. /// @param path path to the file. +/// @param hParams [out] handle to the newly created parameters struct. /// @return UMF_RESULT_SUCCESS on success or appropriate error code on failure. umf_result_t umfFileMemoryProviderParamsCreate( - umf_file_memory_provider_params_handle_t *hParams, const char *path); + const char *path, umf_file_memory_provider_params_handle_t *hParams); /// @brief Destroy parameters struct. /// @param hParams handle to the parameters of the File Memory Provider. diff --git a/include/umf/providers/provider_fixed_memory.h b/include/umf/providers/provider_fixed_memory.h index 00273d565..7c4507a27 100644 --- a/include/umf/providers/provider_fixed_memory.h +++ b/include/umf/providers/provider_fixed_memory.h @@ -8,7 +8,7 @@ #ifndef UMF_FIXED_MEMORY_PROVIDER_H #define UMF_FIXED_MEMORY_PROVIDER_H -#include +#include #ifdef __cplusplus extern "C" { @@ -24,12 +24,12 @@ typedef struct umf_fixed_memory_provider_params_t *umf_fixed_memory_provider_params_handle_t; /// @brief Create a struct to store parameters of the Fixed Memory Provider. -/// @param hParams [out] handle to the newly created parameters struct. /// @param ptr [in] pointer to the memory region. /// @param size [in] size of the memory region in bytes. +/// @param hParams [out] handle to the newly created parameters struct. /// @return UMF_RESULT_SUCCESS on success or appropriate error code on failure. umf_result_t umfFixedMemoryProviderParamsCreate( - umf_fixed_memory_provider_params_handle_t *hParams, void *ptr, size_t size); + void *ptr, size_t size, umf_fixed_memory_provider_params_handle_t *hParams); /// @brief Set the memory region in params struct. Overwrites the previous value. /// It provides an ability to use the same instance of params to create multiple diff --git a/include/umf/providers/provider_os_memory.h b/include/umf/providers/provider_os_memory.h index 17bea65b0..262959609 100644 --- a/include/umf/providers/provider_os_memory.h +++ b/include/umf/providers/provider_os_memory.h @@ -10,7 +10,7 @@ #ifndef UMF_OS_MEMORY_PROVIDER_H #define UMF_OS_MEMORY_PROVIDER_H -#include "umf/memory_provider.h" +#include #ifdef __cplusplus extern "C" { diff --git a/src/provider/provider_devdax_memory.c b/src/provider/provider_devdax_memory.c index 617082524..995f50cf5 100644 --- a/src/provider/provider_devdax_memory.c +++ b/src/provider/provider_devdax_memory.c @@ -28,8 +28,8 @@ const umf_memory_provider_ops_t *umfDevDaxMemoryProviderOps(void) { } umf_result_t umfDevDaxMemoryProviderParamsCreate( - umf_devdax_memory_provider_params_handle_t *hParams, const char *path, - size_t size) { + const char *path, size_t size, + umf_devdax_memory_provider_params_handle_t *hParams) { (void)hParams; (void)path; (void)size; @@ -562,8 +562,8 @@ const umf_memory_provider_ops_t *umfDevDaxMemoryProviderOps(void) { } umf_result_t umfDevDaxMemoryProviderParamsCreate( - umf_devdax_memory_provider_params_handle_t *hParams, const char *path, - size_t size) { + const char *path, size_t size, + umf_devdax_memory_provider_params_handle_t *hParams) { libumfInit(); if (hParams == NULL) { LOG_ERR("DevDax Memory Provider params handle is NULL"); diff --git a/src/provider/provider_file_memory.c b/src/provider/provider_file_memory.c index 0c4b28613..78cfb2cc2 100644 --- a/src/provider/provider_file_memory.c +++ b/src/provider/provider_file_memory.c @@ -29,7 +29,7 @@ const umf_memory_provider_ops_t *umfFileMemoryProviderOps(void) { } umf_result_t umfFileMemoryProviderParamsCreate( - umf_file_memory_provider_params_handle_t *hParams, const char *path) { + const char *path, umf_file_memory_provider_params_handle_t *hParams) { (void)hParams; (void)path; LOG_ERR("File memory provider is disabled!"); @@ -889,7 +889,7 @@ const umf_memory_provider_ops_t *umfFileMemoryProviderOps(void) { } umf_result_t umfFileMemoryProviderParamsCreate( - umf_file_memory_provider_params_handle_t *hParams, const char *path) { + const char *path, umf_file_memory_provider_params_handle_t *hParams) { libumfInit(); if (hParams == NULL) { LOG_ERR("File Memory Provider params handle is NULL"); diff --git a/src/provider/provider_fixed_memory.c b/src/provider/provider_fixed_memory.c index bb63db46a..5f047442a 100644 --- a/src/provider/provider_fixed_memory.c +++ b/src/provider/provider_fixed_memory.c @@ -316,8 +316,8 @@ const umf_memory_provider_ops_t *umfFixedMemoryProviderOps(void) { } umf_result_t umfFixedMemoryProviderParamsCreate( - umf_fixed_memory_provider_params_handle_t *hParams, void *ptr, - size_t size) { + void *ptr, size_t size, + umf_fixed_memory_provider_params_handle_t *hParams) { libumfInit(); if (hParams == NULL) { LOG_ERR("Memory Provider params handle is NULL"); diff --git a/test/ctl/ctl_api.cpp b/test/ctl/ctl_api.cpp index 3c78ad1ea..dd0abbc5c 100644 --- a/test/ctl/ctl_api.cpp +++ b/test/ctl/ctl_api.cpp @@ -164,7 +164,7 @@ class Pool { data = malloc(1024 * 1024); int ret = - umfFixedMemoryProviderParamsCreate(¶ms, data, 1024 * 1024); + umfFixedMemoryProviderParamsCreate(data, 1024 * 1024, ¶ms); if (ret != UMF_RESULT_SUCCESS) { return 0; } diff --git a/test/disjoint_pool_file_prov.cpp b/test/disjoint_pool_file_prov.cpp index 08fad03e2..607d265e0 100644 --- a/test/disjoint_pool_file_prov.cpp +++ b/test/disjoint_pool_file_prov.cpp @@ -49,7 +49,7 @@ TEST_P(FileWithMemoryStrategyTest, disjointFileMallocPool_simple1) { ASSERT_NE(malloc_memory_provider, nullptr); umf_file_memory_provider_params_handle_t file_params = nullptr; - umf_result = umfFileMemoryProviderParamsCreate(&file_params, FILE_PATH); + umf_result = umfFileMemoryProviderParamsCreate(FILE_PATH, &file_params); ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS); ASSERT_NE(file_params, nullptr); @@ -147,7 +147,7 @@ TEST_P(FileWithMemoryStrategyTest, disjointFileMallocPool_simple2) { ASSERT_NE(malloc_memory_provider, nullptr); umf_file_memory_provider_params_handle_t file_params = nullptr; - umf_result = umfFileMemoryProviderParamsCreate(&file_params, FILE_PATH); + umf_result = umfFileMemoryProviderParamsCreate(FILE_PATH, &file_params); ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS); ASSERT_NE(file_params, nullptr); @@ -238,7 +238,7 @@ TEST_P(FileWithMemoryStrategyTest, disjointFileMMapPool_random) { const unsigned char alloc_check_val = 11; umf_file_memory_provider_params_handle_t file_params = nullptr; - umf_result = umfFileMemoryProviderParamsCreate(&file_params, FILE_PATH); + umf_result = umfFileMemoryProviderParamsCreate(FILE_PATH, &file_params); ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS); ASSERT_NE(file_params, nullptr); diff --git a/test/ipc_devdax_prov_consumer.c b/test/ipc_devdax_prov_consumer.c index 286b6de78..760d075c8 100644 --- a/test/ipc_devdax_prov_consumer.c +++ b/test/ipc_devdax_prov_consumer.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) { umf_devdax_memory_provider_params_handle_t devdax_params = NULL; umf_result_t umf_result = - umfDevDaxMemoryProviderParamsCreate(&devdax_params, path, atol(size)); + umfDevDaxMemoryProviderParamsCreate(path, atol(size), &devdax_params); if (umf_result != UMF_RESULT_SUCCESS) { fprintf(stderr, "[consumer] ERROR: creating DevDax Memory Provider " "params failed\n"); diff --git a/test/ipc_devdax_prov_producer.c b/test/ipc_devdax_prov_producer.c index 479c1f945..39d598599 100644 --- a/test/ipc_devdax_prov_producer.c +++ b/test/ipc_devdax_prov_producer.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) { umf_devdax_memory_provider_params_handle_t devdax_params = NULL; umf_result_t umf_result = - umfDevDaxMemoryProviderParamsCreate(&devdax_params, path, atol(size)); + umfDevDaxMemoryProviderParamsCreate(path, atol(size), &devdax_params); if (umf_result != UMF_RESULT_SUCCESS) { fprintf(stderr, "[producer] ERROR: creating DevDax Memory Provider " "params failed\n"); diff --git a/test/ipc_file_prov_consumer.c b/test/ipc_file_prov_consumer.c index 0c50991a9..e6e0eb259 100644 --- a/test/ipc_file_prov_consumer.c +++ b/test/ipc_file_prov_consumer.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -28,7 +28,7 @@ int main(int argc, char *argv[]) { umf_file_memory_provider_params_handle_t file_params = NULL; umf_result_t umf_result = - umfFileMemoryProviderParamsCreate(&file_params, file_name); + umfFileMemoryProviderParamsCreate(file_name, &file_params); if (umf_result != UMF_RESULT_SUCCESS) { fprintf( stderr, diff --git a/test/ipc_file_prov_producer.c b/test/ipc_file_prov_producer.c index c620437e0..11c399b70 100644 --- a/test/ipc_file_prov_producer.c +++ b/test/ipc_file_prov_producer.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -28,7 +28,7 @@ int main(int argc, char *argv[]) { umf_file_memory_provider_params_handle_t file_params = NULL; umf_result_t umf_result = - umfFileMemoryProviderParamsCreate(&file_params, file_name); + umfFileMemoryProviderParamsCreate(file_name, &file_params); if (umf_result != UMF_RESULT_SUCCESS) { fprintf( stderr, diff --git a/test/poolFixtures.hpp b/test/poolFixtures.hpp index 66351011c..e018b975c 100644 --- a/test/poolFixtures.hpp +++ b/test/poolFixtures.hpp @@ -610,8 +610,8 @@ TEST_P(umfPoolTest, pool_from_ptr_whole_size_success) { // Create provider parameters size_of_pool_from_ptr = size_of_first_alloc; // whole size umf_fixed_memory_provider_params_handle_t params = nullptr; - umf_result = umfFixedMemoryProviderParamsCreate(¶ms, ptr_for_pool, - size_of_pool_from_ptr); + umf_result = umfFixedMemoryProviderParamsCreate( + ptr_for_pool, size_of_pool_from_ptr, ¶ms); ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS); ASSERT_NE(params, nullptr); @@ -667,8 +667,8 @@ TEST_P(umfPoolTest, pool_from_ptr_half_size_success) { // Create provider parameters size_of_pool_from_ptr = size_of_first_alloc / 2; // half size umf_fixed_memory_provider_params_handle_t params = nullptr; - umf_result = umfFixedMemoryProviderParamsCreate(¶ms, ptr_for_pool, - size_of_pool_from_ptr); + umf_result = umfFixedMemoryProviderParamsCreate( + ptr_for_pool, size_of_pool_from_ptr, ¶ms); ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS); ASSERT_NE(params, nullptr); diff --git a/test/pools/jemalloc_coarse_devdax.cpp b/test/pools/jemalloc_coarse_devdax.cpp index 53d2a41b3..9ab31a101 100644 --- a/test/pools/jemalloc_coarse_devdax.cpp +++ b/test/pools/jemalloc_coarse_devdax.cpp @@ -23,7 +23,7 @@ void *createDevDaxParams() { umf_devdax_memory_provider_params_handle_t params = NULL; umf_result_t res = - umfDevDaxMemoryProviderParamsCreate(¶ms, path, atol(size)); + umfDevDaxMemoryProviderParamsCreate(path, atol(size), ¶ms); if (res != UMF_RESULT_SUCCESS) { throw std::runtime_error( "Failed to create DevDax Memory Provider params"); diff --git a/test/pools/jemalloc_coarse_file.cpp b/test/pools/jemalloc_coarse_file.cpp index dcd03898e..a658e849f 100644 --- a/test/pools/jemalloc_coarse_file.cpp +++ b/test/pools/jemalloc_coarse_file.cpp @@ -10,7 +10,7 @@ void *getFileParamsDefault() { umf_file_memory_provider_params_handle_t file_params = NULL; umf_result_t res = - umfFileMemoryProviderParamsCreate(&file_params, FILE_PATH); + umfFileMemoryProviderParamsCreate(FILE_PATH, &file_params); if (res != UMF_RESULT_SUCCESS) { throw std::runtime_error( "Failed to create File Memory Provider params"); diff --git a/test/pools/jemalloc_pool.cpp b/test/pools/jemalloc_pool.cpp index 69c4cf1a8..c0a17c641 100644 --- a/test/pools/jemalloc_pool.cpp +++ b/test/pools/jemalloc_pool.cpp @@ -40,8 +40,8 @@ void *createFixedMemoryProviderParams() { } umf_fixed_memory_provider_params_handle_t params = nullptr; - umf_result_t res = umfFixedMemoryProviderParamsCreate( - ¶ms, memory_buffer.get(), memory_size); + umf_result_t res = umfFixedMemoryProviderParamsCreate(memory_buffer.get(), + memory_size, ¶ms); if (res != UMF_RESULT_SUCCESS) { throw std::runtime_error( "Failed to create Fixed memory provider params"); diff --git a/test/pools/scalable_coarse_devdax.cpp b/test/pools/scalable_coarse_devdax.cpp index 86c580402..49870396c 100644 --- a/test/pools/scalable_coarse_devdax.cpp +++ b/test/pools/scalable_coarse_devdax.cpp @@ -23,7 +23,7 @@ void *createDevDaxParams() { umf_devdax_memory_provider_params_handle_t params = NULL; umf_result_t res = - umfDevDaxMemoryProviderParamsCreate(¶ms, path, atol(size)); + umfDevDaxMemoryProviderParamsCreate(path, atol(size), ¶ms); if (res != UMF_RESULT_SUCCESS) { throw std::runtime_error( "Failed to create DevDax Memory Provider params"); diff --git a/test/pools/scalable_coarse_file.cpp b/test/pools/scalable_coarse_file.cpp index a5fd5b46a..bfd8964c3 100644 --- a/test/pools/scalable_coarse_file.cpp +++ b/test/pools/scalable_coarse_file.cpp @@ -10,7 +10,7 @@ void *getFileParamsDefault() { umf_file_memory_provider_params_handle_t file_params = NULL; umf_result_t res = - umfFileMemoryProviderParamsCreate(&file_params, FILE_PATH); + umfFileMemoryProviderParamsCreate(FILE_PATH, &file_params); if (res != UMF_RESULT_SUCCESS) { throw std::runtime_error( "Failed to create File Memory Provider params"); diff --git a/test/provider_devdax_memory.cpp b/test/provider_devdax_memory.cpp index 0405bf678..a951ca08e 100644 --- a/test/provider_devdax_memory.cpp +++ b/test/provider_devdax_memory.cpp @@ -148,7 +148,7 @@ TEST_F(test, test_if_mapped_with_MAP_SYNC) { size_t size = atol(size_str); umf_devdax_memory_provider_params_handle_t params = NULL; - umf_result = umfDevDaxMemoryProviderParamsCreate(¶ms, path, size); + umf_result = umfDevDaxMemoryProviderParamsCreate(path, size, ¶ms); ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS); ASSERT_NE(params, nullptr); @@ -190,7 +190,7 @@ devdax_params_unique_handle_t create_devdax_params() { umf_devdax_memory_provider_params_handle_t params = NULL; umf_result_t res = - umfDevDaxMemoryProviderParamsCreate(¶ms, path, atol(size)); + umfDevDaxMemoryProviderParamsCreate(path, atol(size), ¶ms); if (res != UMF_RESULT_SUCCESS) { throw std::runtime_error( "Failed to create DevDax Memory Provider params"); @@ -343,7 +343,7 @@ TEST_P(umfProviderTest, purge_force_INVALID_POINTER) { TEST_F(test, params_protection_flag) { umf_devdax_memory_provider_params_handle_t params = nullptr; umf_result_t ret = - umfDevDaxMemoryProviderParamsCreate(¶ms, "/dev/dax0.0", 4096); + umfDevDaxMemoryProviderParamsCreate("/dev/dax0.0", 4096, ¶ms); ASSERT_EQ(ret, UMF_RESULT_SUCCESS); ASSERT_NE(params, nullptr); @@ -362,7 +362,7 @@ TEST_F(test, params_protection_flag) { TEST_F(test, params_invalid_protection_flag) { umf_devdax_memory_provider_params_handle_t params = nullptr; umf_result_t ret = - umfDevDaxMemoryProviderParamsCreate(¶ms, "/dev/dax0.0", 4096); + umfDevDaxMemoryProviderParamsCreate("/dev/dax0.0", 4096, ¶ms); ASSERT_EQ(ret, UMF_RESULT_SUCCESS); ASSERT_NE(params, nullptr); @@ -382,7 +382,7 @@ TEST_F(test, params_invalid_protection_flag) { TEST_F(test, params_null_handle) { auto ret = - umfDevDaxMemoryProviderParamsCreate(nullptr, "/dev/dax0.0", 4096); + umfDevDaxMemoryProviderParamsCreate("/dev/dax0.0", 4096, nullptr); ASSERT_EQ(ret, UMF_RESULT_ERROR_INVALID_ARGUMENT); ret = umfDevDaxMemoryProviderParamsDestroy(nullptr); @@ -399,7 +399,7 @@ TEST_F(test, params_null_handle) { TEST_F(test, create_empty_path) { const char *path = ""; umf_devdax_memory_provider_params_handle_t wrong_params = NULL; - auto ret = umfDevDaxMemoryProviderParamsCreate(&wrong_params, path, 4096); + auto ret = umfDevDaxMemoryProviderParamsCreate(path, 4096, &wrong_params); ASSERT_EQ(ret, UMF_RESULT_ERROR_INVALID_ARGUMENT); ASSERT_EQ(wrong_params, nullptr); } @@ -407,7 +407,7 @@ TEST_F(test, create_empty_path) { TEST_F(test, create_null_path) { const char *path = nullptr; umf_devdax_memory_provider_params_handle_t wrong_params = NULL; - auto ret = umfDevDaxMemoryProviderParamsCreate(&wrong_params, path, 4096); + auto ret = umfDevDaxMemoryProviderParamsCreate(path, 4096, &wrong_params); ASSERT_EQ(ret, UMF_RESULT_ERROR_INVALID_ARGUMENT); ASSERT_EQ(wrong_params, nullptr); } @@ -416,7 +416,7 @@ TEST_F(test, set_empty_path) { const char *path = "tmp"; const char *empty_path = ""; umf_devdax_memory_provider_params_handle_t params = NULL; - auto ret = umfDevDaxMemoryProviderParamsCreate(¶ms, path, 4096); + auto ret = umfDevDaxMemoryProviderParamsCreate(path, 4096, ¶ms); ASSERT_EQ(ret, UMF_RESULT_SUCCESS); ASSERT_NE(params, nullptr); @@ -431,7 +431,7 @@ TEST_F(test, set_null_path) { const char *path = "tmp"; const char *null_path = nullptr; umf_devdax_memory_provider_params_handle_t params = NULL; - auto ret = umfDevDaxMemoryProviderParamsCreate(¶ms, path, 4096); + auto ret = umfDevDaxMemoryProviderParamsCreate(path, 4096, ¶ms); ASSERT_EQ(ret, UMF_RESULT_SUCCESS); ASSERT_NE(params, nullptr); @@ -447,7 +447,7 @@ TEST_F(test, create_wrong_path) { const char *path = "/tmp/dev/dax0.0"; umf_devdax_memory_provider_params_handle_t wrong_params = nullptr; - auto ret = umfDevDaxMemoryProviderParamsCreate(&wrong_params, path, 4096); + auto ret = umfDevDaxMemoryProviderParamsCreate(path, 4096, &wrong_params); ASSERT_EQ(ret, UMF_RESULT_SUCCESS); ASSERT_NE(wrong_params, nullptr); @@ -465,7 +465,7 @@ TEST_F(test, create_wrong_path_not_exist) { const char *path = "/dev/dax1.1"; umf_devdax_memory_provider_params_handle_t wrong_params = nullptr; - auto ret = umfDevDaxMemoryProviderParamsCreate(&wrong_params, path, 4096); + auto ret = umfDevDaxMemoryProviderParamsCreate(path, 4096, &wrong_params); ASSERT_EQ(ret, UMF_RESULT_SUCCESS); ASSERT_NE(wrong_params, nullptr); @@ -483,7 +483,7 @@ TEST_F(test, create_wrong_size_0) { const char *path = "/dev/dax0.0"; umf_devdax_memory_provider_params_handle_t wrong_params = nullptr; - auto ret = umfDevDaxMemoryProviderParamsCreate(&wrong_params, path, 0); + auto ret = umfDevDaxMemoryProviderParamsCreate(path, 0, &wrong_params); ASSERT_EQ(ret, UMF_RESULT_SUCCESS); ASSERT_NE(wrong_params, nullptr); diff --git a/test/provider_devdax_memory_ipc.cpp b/test/provider_devdax_memory_ipc.cpp index 47b389c95..d88b1f005 100644 --- a/test/provider_devdax_memory_ipc.cpp +++ b/test/provider_devdax_memory_ipc.cpp @@ -34,7 +34,7 @@ void *defaultDevDaxParamsCreate() { umf_devdax_memory_provider_params_handle_t params = NULL; umf_result_t res = - umfDevDaxMemoryProviderParamsCreate(¶ms, path, atol(size)); + umfDevDaxMemoryProviderParamsCreate(path, atol(size), ¶ms); if (res != UMF_RESULT_SUCCESS) { throw std::runtime_error( "Failed to create DevDax Memory Provider params"); diff --git a/test/provider_devdax_memory_not_impl.cpp b/test/provider_devdax_memory_not_impl.cpp index 4687825d3..8924efc4e 100644 --- a/test/provider_devdax_memory_not_impl.cpp +++ b/test/provider_devdax_memory_not_impl.cpp @@ -11,7 +11,7 @@ using umf_test::test; TEST_F(test, devdax_provider_not_implemented) { umf_devdax_memory_provider_params_handle_t params = nullptr; umf_result_t umf_result = - umfDevDaxMemoryProviderParamsCreate(¶ms, "path", 4096); + umfDevDaxMemoryProviderParamsCreate("path", 4096, ¶ms); EXPECT_EQ(umf_result, UMF_RESULT_ERROR_NOT_SUPPORTED); EXPECT_EQ(params, nullptr); diff --git a/test/provider_file_memory.cpp b/test/provider_file_memory.cpp index 917f30a36..6252745c6 100644 --- a/test/provider_file_memory.cpp +++ b/test/provider_file_memory.cpp @@ -140,7 +140,7 @@ TEST_F(test, test_if_mapped_with_MAP_SYNC) { } umf_file_memory_provider_params_handle_t params = nullptr; - umf_result = umfFileMemoryProviderParamsCreate(¶ms, path); + umf_result = umfFileMemoryProviderParamsCreate(path, ¶ms); ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS); ASSERT_NE(params, nullptr); @@ -179,7 +179,7 @@ using file_params_unique_handle_t = file_params_unique_handle_t get_file_params_default(char *path) { umf_file_memory_provider_params_handle_t file_params = NULL; - umf_result_t res = umfFileMemoryProviderParamsCreate(&file_params, path); + umf_result_t res = umfFileMemoryProviderParamsCreate(path, &file_params); if (res != UMF_RESULT_SUCCESS) { throw std::runtime_error( "Failed to create File Memory Provider params"); @@ -194,7 +194,7 @@ file_params_unique_handle_t file_params_default = file_params_unique_handle_t get_file_params_shared(char *path) { umf_file_memory_provider_params_handle_t file_params = NULL; - umf_result_t res = umfFileMemoryProviderParamsCreate(&file_params, path); + umf_result_t res = umfFileMemoryProviderParamsCreate(path, &file_params); if (res != UMF_RESULT_SUCCESS) { throw std::runtime_error( "Failed to create File Memory Provider params"); @@ -384,7 +384,7 @@ TEST_P(FileProviderParamsDefault, free_NULL) { TEST_F(test, params_null_handle) { umf_result_t umf_result = - umfFileMemoryProviderParamsCreate(nullptr, FILE_PATH); + umfFileMemoryProviderParamsCreate(FILE_PATH, nullptr); ASSERT_EQ(umf_result, UMF_RESULT_ERROR_INVALID_ARGUMENT); umf_result = umfFileMemoryProviderParamsDestroy(nullptr); @@ -407,7 +407,7 @@ TEST_F(test, create_empty_path) { umf_file_memory_provider_params_handle_t wrong_params = nullptr; umf_result_t umf_result = - umfFileMemoryProviderParamsCreate(&wrong_params, path); + umfFileMemoryProviderParamsCreate(path, &wrong_params); ASSERT_EQ(umf_result, UMF_RESULT_ERROR_INVALID_ARGUMENT); ASSERT_EQ(wrong_params, nullptr); } @@ -417,7 +417,7 @@ TEST_F(test, create_null_path) { umf_file_memory_provider_params_handle_t wrong_params = nullptr; umf_result_t umf_result = - umfFileMemoryProviderParamsCreate(&wrong_params, path); + umfFileMemoryProviderParamsCreate(path, &wrong_params); ASSERT_EQ(umf_result, UMF_RESULT_ERROR_INVALID_ARGUMENT); ASSERT_EQ(wrong_params, nullptr); } @@ -427,7 +427,7 @@ TEST_F(test, set_empty_path) { umf_file_memory_provider_params_handle_t params = nullptr; umf_result_t umf_result = - umfFileMemoryProviderParamsCreate(¶ms, FILE_PATH); + umfFileMemoryProviderParamsCreate(FILE_PATH, ¶ms); ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS); umf_result = umfFileMemoryProviderParamsSetPath(params, empty_path); @@ -442,7 +442,7 @@ TEST_F(test, set_null_path) { umf_file_memory_provider_params_handle_t params = nullptr; umf_result_t umf_result = - umfFileMemoryProviderParamsCreate(¶ms, FILE_PATH); + umfFileMemoryProviderParamsCreate(FILE_PATH, ¶ms); ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS); umf_result = umfFileMemoryProviderParamsSetPath(params, null_path); diff --git a/test/provider_file_memory_ipc.cpp b/test/provider_file_memory_ipc.cpp index 0408b2fe2..b749772f4 100644 --- a/test/provider_file_memory_ipc.cpp +++ b/test/provider_file_memory_ipc.cpp @@ -20,7 +20,7 @@ using umf_test::test; void *createFileParamsShared() { umf_file_memory_provider_params_handle_t file_params = NULL; umf_result_t res = - umfFileMemoryProviderParamsCreate(&file_params, FILE_PATH); + umfFileMemoryProviderParamsCreate(FILE_PATH, &file_params); if (res != UMF_RESULT_SUCCESS) { throw std::runtime_error( "Failed to create File Memory Provider params"); @@ -45,7 +45,7 @@ umf_result_t destroyFileParamsShared(void *params) { void *createFileParamsFSDAX() { umf_file_memory_provider_params_handle_t file_params = NULL; umf_result_t res = umfFileMemoryProviderParamsCreate( - &file_params, getenv("UMF_TESTS_FSDAX_PATH")); + getenv("UMF_TESTS_FSDAX_PATH"), &file_params); if (res != UMF_RESULT_SUCCESS) { //test will be skipped. return nullptr; diff --git a/test/provider_file_memory_not_impl.cpp b/test/provider_file_memory_not_impl.cpp index c0bde74e2..84ae5ffdf 100644 --- a/test/provider_file_memory_not_impl.cpp +++ b/test/provider_file_memory_not_impl.cpp @@ -11,7 +11,7 @@ using umf_test::test; TEST_F(test, file_provider_not_implemented) { umf_file_memory_provider_params_handle_t params = nullptr; umf_result_t umf_result = - umfFileMemoryProviderParamsCreate(¶ms, "path"); + umfFileMemoryProviderParamsCreate("path", ¶ms); EXPECT_EQ(umf_result, UMF_RESULT_ERROR_NOT_SUPPORTED); EXPECT_EQ(params, nullptr); diff --git a/test/provider_fixed_memory.cpp b/test/provider_fixed_memory.cpp index f7befa0b6..bfdcd9fc2 100644 --- a/test/provider_fixed_memory.cpp +++ b/test/provider_fixed_memory.cpp @@ -69,7 +69,7 @@ struct FixedProviderTest // Create provider parameters umf_fixed_memory_provider_params_handle_t params = nullptr; umf_result_t res = umfFixedMemoryProviderParamsCreate( - ¶ms, memory_buffer, memory_size); + memory_buffer, memory_size, ¶ms); ASSERT_EQ(res, UMF_RESULT_SUCCESS); ASSERT_NE(params, nullptr); @@ -317,7 +317,7 @@ TEST_F(test, params_null_handle) { constexpr size_t memory_size = 100; char memory_buffer[memory_size]; umf_result_t umf_result = - umfFixedMemoryProviderParamsCreate(nullptr, memory_buffer, memory_size); + umfFixedMemoryProviderParamsCreate(memory_buffer, memory_size, nullptr); ASSERT_EQ(umf_result, UMF_RESULT_ERROR_INVALID_ARGUMENT); umf_result = umfFixedMemoryProviderParamsDestroy(nullptr); @@ -328,7 +328,7 @@ TEST_F(test, create_with_null_ptr) { constexpr size_t memory_size = 100; umf_fixed_memory_provider_params_handle_t wrong_params = nullptr; umf_result_t umf_result = - umfFixedMemoryProviderParamsCreate(&wrong_params, nullptr, memory_size); + umfFixedMemoryProviderParamsCreate(nullptr, memory_size, &wrong_params); ASSERT_EQ(umf_result, UMF_RESULT_ERROR_INVALID_ARGUMENT); ASSERT_EQ(wrong_params, nullptr); } @@ -338,7 +338,7 @@ TEST_F(test, create_with_zero_size) { char memory_buffer[memory_size]; umf_fixed_memory_provider_params_handle_t wrong_params = nullptr; umf_result_t umf_result = - umfFixedMemoryProviderParamsCreate(&wrong_params, memory_buffer, 0); + umfFixedMemoryProviderParamsCreate(memory_buffer, 0, &wrong_params); ASSERT_EQ(umf_result, UMF_RESULT_ERROR_INVALID_ARGUMENT); ASSERT_EQ(wrong_params, nullptr); } @@ -358,7 +358,7 @@ TEST_F(test, params_several_set_memory) { umf_fixed_memory_provider_params_handle_t params = nullptr; umf_result_t umf_result = umfFixedMemoryProviderParamsCreate( - ¶ms, memory_buffer1, memory_size1); + memory_buffer1, memory_size1, ¶ms); ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS); umf_result = umfMemoryProviderCreate(umfFixedMemoryProviderOps(), params, @@ -421,7 +421,7 @@ TEST_F(test, params_invalid_set_memory) { char memory_buffer[memory_size]; umf_fixed_memory_provider_params_handle_t valid_params = nullptr; umf_result_t umf_result = umfFixedMemoryProviderParamsCreate( - &valid_params, memory_buffer, memory_size); + memory_buffer, memory_size, &valid_params); ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS); umf_result = @@ -517,8 +517,8 @@ TEST_P(FixedProviderTest, pool_from_ptr_whole_size_success) { // Create provider parameters size_of_pool_from_ptr = size_of_first_alloc; // whole size umf_fixed_memory_provider_params_handle_t params = nullptr; - umf_result = umfFixedMemoryProviderParamsCreate(¶ms, ptr_for_pool, - size_of_pool_from_ptr); + umf_result = umfFixedMemoryProviderParamsCreate( + ptr_for_pool, size_of_pool_from_ptr, ¶ms); ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS); ASSERT_NE(params, nullptr); @@ -572,8 +572,8 @@ TEST_P(FixedProviderTest, pool_from_ptr_half_size_success) { // Create provider parameters size_of_pool_from_ptr = size_of_first_alloc / 2; // half size umf_fixed_memory_provider_params_handle_t params = nullptr; - umf_result = umfFixedMemoryProviderParamsCreate(¶ms, ptr_for_pool, - size_of_pool_from_ptr); + umf_result = umfFixedMemoryProviderParamsCreate( + ptr_for_pool, size_of_pool_from_ptr, ¶ms); ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS); ASSERT_NE(params, nullptr); diff --git a/test/provider_tracking.cpp b/test/provider_tracking.cpp index b41ff6012..db186e15f 100644 --- a/test/provider_tracking.cpp +++ b/test/provider_tracking.cpp @@ -50,7 +50,7 @@ struct TrackingProviderTest // Create provider parameters umf_fixed_memory_provider_params_handle_t params = nullptr; umf_result_t res = umfFixedMemoryProviderParamsCreate( - ¶ms, memory_buffer, memory_size); + memory_buffer, memory_size, ¶ms); ASSERT_EQ(res, UMF_RESULT_SUCCESS); ASSERT_NE(params, nullptr); @@ -96,7 +96,7 @@ createPoolFromAllocation(void *ptr0, size_t size1, // Create provider parameters umf_fixed_memory_provider_params_handle_t params = nullptr; - umf_result = umfFixedMemoryProviderParamsCreate(¶ms, ptr0, size1); + umf_result = umfFixedMemoryProviderParamsCreate(ptr0, size1, ¶ms); ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS); ASSERT_NE(params, nullptr); diff --git a/test/provider_tracking_fixture_tests.cpp b/test/provider_tracking_fixture_tests.cpp index 3da861073..51dbc07c1 100644 --- a/test/provider_tracking_fixture_tests.cpp +++ b/test/provider_tracking_fixture_tests.cpp @@ -56,7 +56,7 @@ umf_memory_provider_ops_t PROVIDER_FROM_POOL_OPS = static void *providerFromPoolParamsCreate(void) { umf_file_memory_provider_params_handle_t paramsFile = NULL; umf_result_t umf_result = - umfFileMemoryProviderParamsCreate(¶msFile, FILE_PATH); + umfFileMemoryProviderParamsCreate(FILE_PATH, ¶msFile); EXPECT_EQ(umf_result, UMF_RESULT_SUCCESS); EXPECT_NE(paramsFile, nullptr);