88 */
99
1010#include <assert.h>
11+ #include <stdarg.h>
1112#include <stdint.h>
1213#include <string.h>
13- #include <stdarg.h>
1414
1515#include <umf/base.h>
1616#include <umf/memory_pool.h>
1717#include <umf/memory_pool_ops.h>
1818
1919#include "base_alloc_global.h"
20- #include "ctl/ctl_internal.h"
2120#include "ctl/ctl_defaults.h"
21+ #include "ctl/ctl_internal.h"
2222#include "libumf.h"
2323#include "memory_pool_internal.h"
2424#include "memory_provider_internal.h"
@@ -167,7 +167,7 @@ static umf_result_t CTL_SUBTREE_HANDLER(CTL_NONAME, by_handle)(
167167 queryType , arg , size , args2 );
168168 va_end (args2 );
169169
170- if (ret == UMF_RESULT_ERROR_INVALID_ARGUMENT ) {
170+ if (ret == UMF_RESULT_ERROR_INVALID_CTL_PATH ) {
171171 // Node was not found in pool_ctl_root, try to query the specific pool
172172 ret = hPool -> ops .ext_ctl (hPool -> pool_priv , source , extra_name , arg ,
173173 size , queryType , args );
@@ -323,7 +323,7 @@ static umf_result_t CTL_SUBTREE_HANDLER(CTL_NONAME, by_name)(
323323 extra_name , queryType , arg , size , args2 );
324324 va_end (args2 );
325325
326- if (r == UMF_RESULT_ERROR_INVALID_ARGUMENT ) {
326+ if (r == UMF_RESULT_ERROR_INVALID_CTL_PATH ) {
327327 va_copy (args2 , args );
328328 r = it -> pool -> ops .ext_ctl (it -> pool -> pool_priv , source , extra_name ,
329329 arg , size , queryType , args2 );
@@ -363,7 +363,8 @@ umfDefaultCtlPoolHandle(void *hPool, umf_ctl_query_source_t operationType,
363363 (void )size ;
364364 (void )queryType ;
365365 (void )args ;
366- return UMF_RESULT_ERROR_NOT_SUPPORTED ;
366+ // if given path is not supported implementation should return UMF_RESULT_ERROR_INVALID_CTL_PATH
367+ return UMF_RESULT_ERROR_INVALID_CTL_PATH ;
367368}
368369
369370static umf_result_t umfDefaultTrimMemory (void * provider ,
@@ -377,13 +378,11 @@ static umf_result_t umfPoolPostInitialize(const umf_memory_pool_ops_t *ops,
377378 void * pool_priv , ...) {
378379 va_list args ;
379380 va_start (args , pool_priv );
380- umf_result_t ret = ops -> ext_ctl ( pool_priv , CTL_QUERY_PROGRAMMATIC ,
381- "post_initialize" , NULL , 0 ,
382- CTL_QUERY_RUNNABLE , args );
381+ umf_result_t ret =
382+ ops -> ext_ctl ( pool_priv , CTL_QUERY_PROGRAMMATIC , "post_initialize" , NULL ,
383+ 0 , CTL_QUERY_RUNNABLE , args );
383384 va_end (args );
384- if (ret == UMF_RESULT_ERROR_INVALID_ARGUMENT ) {
385- ret = UMF_RESULT_ERROR_NOT_SUPPORTED ;
386- }
385+
387386 return ret ;
388387}
389388
@@ -481,8 +480,8 @@ static umf_result_t umfPoolCreateInternal(const umf_memory_pool_ops_t *ops,
481480
482481 ctl_default_apply (pool_default_list , pname , ops -> ext_ctl , pool -> pool_priv );
483482
484- ret = umfPoolPostInitialize (ops , pool -> pool_priv );
485- if (ret != UMF_RESULT_SUCCESS && ret != UMF_RESULT_ERROR_NOT_SUPPORTED ) {
483+ ret = umfPoolPostInitialize (& pool -> ops , pool -> pool_priv );
484+ if (ret != UMF_RESULT_SUCCESS && ret != UMF_RESULT_ERROR_INVALID_CTL_PATH ) {
486485 LOG_ERR ("Failed to post-initialize pool" );
487486 goto err_pool_init ;
488487 }
0 commit comments