8
8
*/
9
9
10
10
#include <assert.h>
11
+ #include <stdarg.h>
11
12
#include <stdint.h>
12
13
#include <string.h>
13
- #include <stdarg.h>
14
14
15
15
#include <umf/base.h>
16
16
#include <umf/memory_pool.h>
17
17
#include <umf/memory_pool_ops.h>
18
18
19
19
#include "base_alloc_global.h"
20
- #include "ctl/ctl_internal.h"
21
20
#include "ctl/ctl_defaults.h"
21
+ #include "ctl/ctl_internal.h"
22
22
#include "libumf.h"
23
23
#include "memory_pool_internal.h"
24
24
#include "memory_provider_internal.h"
@@ -167,7 +167,7 @@ static umf_result_t CTL_SUBTREE_HANDLER(CTL_NONAME, by_handle)(
167
167
queryType , arg , size , args2 );
168
168
va_end (args2 );
169
169
170
- if (ret == UMF_RESULT_ERROR_INVALID_ARGUMENT ) {
170
+ if (ret == UMF_RESULT_ERROR_INVALID_CTL_PATH ) {
171
171
// Node was not found in pool_ctl_root, try to query the specific pool
172
172
ret = hPool -> ops .ext_ctl (hPool -> pool_priv , source , extra_name , arg ,
173
173
size , queryType , args );
@@ -323,7 +323,7 @@ static umf_result_t CTL_SUBTREE_HANDLER(CTL_NONAME, by_name)(
323
323
extra_name , queryType , arg , size , args2 );
324
324
va_end (args2 );
325
325
326
- if (r == UMF_RESULT_ERROR_INVALID_ARGUMENT ) {
326
+ if (r == UMF_RESULT_ERROR_INVALID_CTL_PATH ) {
327
327
va_copy (args2 , args );
328
328
r = it -> pool -> ops .ext_ctl (it -> pool -> pool_priv , source , extra_name ,
329
329
arg , size , queryType , args2 );
@@ -363,7 +363,8 @@ umfDefaultCtlPoolHandle(void *hPool, umf_ctl_query_source_t operationType,
363
363
(void )size ;
364
364
(void )queryType ;
365
365
(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 ;
367
368
}
368
369
369
370
static umf_result_t umfDefaultTrimMemory (void * provider ,
@@ -377,13 +378,11 @@ static umf_result_t umfPoolPostInitialize(const umf_memory_pool_ops_t *ops,
377
378
void * pool_priv , ...) {
378
379
va_list args ;
379
380
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 );
383
384
va_end (args );
384
- if (ret == UMF_RESULT_ERROR_INVALID_ARGUMENT ) {
385
- ret = UMF_RESULT_ERROR_NOT_SUPPORTED ;
386
- }
385
+
387
386
return ret ;
388
387
}
389
388
@@ -481,8 +480,8 @@ static umf_result_t umfPoolCreateInternal(const umf_memory_pool_ops_t *ops,
481
480
482
481
ctl_default_apply (pool_default_list , pname , ops -> ext_ctl , pool -> pool_priv );
483
482
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 ) {
486
485
LOG_ERR ("Failed to post-initialize pool" );
487
486
goto err_pool_init ;
488
487
}
0 commit comments