@@ -463,6 +463,11 @@ static umf_result_t umfDefaultTrimMemory(void *provider,
463463 return UMF_RESULT_ERROR_NOT_SUPPORTED ;
464464}
465465
466+ static umf_result_t umfDefaultExtPostInitialize (void * pool ) {
467+ (void )pool ;
468+ return UMF_RESULT_SUCCESS ;
469+ }
470+
466471// logical sum (OR) of all umf_pool_create_flags_t flags
467472static const umf_pool_create_flags_t UMF_POOL_CREATE_FLAG_ALL =
468473 UMF_POOL_CREATE_FLAG_OWN_PROVIDER | UMF_POOL_CREATE_FLAG_DISABLE_TRACKING ;
@@ -495,7 +500,6 @@ static umf_result_t umfPoolCreateInternal(const umf_memory_pool_ops_t *ops,
495500 }
496501
497502 umf_result_t ret = UMF_RESULT_SUCCESS ;
498-
499503 umf_memory_pool_ops_t compatible_ops ;
500504 if (ops -> version != UMF_POOL_OPS_VERSION_CURRENT ) {
501505 LOG_WARN ("Memory Pool ops version \"%d\" is different than the current "
@@ -504,8 +508,8 @@ static umf_result_t umfPoolCreateInternal(const umf_memory_pool_ops_t *ops,
504508
505509 // Create a new ops compatible structure with the current version
506510 memset (& compatible_ops , 0 , sizeof (compatible_ops ));
507- if (UMF_MINOR_VERSION ( ops -> version ) == 0 ) {
508- LOG_INFO ("Detected 1.0 version of Memory Pool ops, "
511+ if (ops -> version < UMF_MAKE_VERSION ( 1 , 1 ) ) {
512+ LOG_INFO ("Detected 1.0 version or below of Memory Pool ops, "
509513 "upgrading to current version" );
510514 memcpy (& compatible_ops , ops ,
511515 offsetof(umf_memory_pool_ops_t , ext_trim_memory ));
@@ -547,13 +551,17 @@ static umf_result_t umfPoolCreateInternal(const umf_memory_pool_ops_t *ops,
547551 pool -> ops .ext_trim_memory = umfDefaultTrimMemory ;
548552 }
549553
554+ if (NULL == pool -> ops .ext_post_initialize ) {
555+ pool -> ops .ext_post_initialize = umfDefaultExtPostInitialize ;
556+ }
557+
550558 if (NULL == utils_mutex_init (& pool -> lock )) {
551559 LOG_ERR ("Failed to initialize mutex for pool" );
552560 ret = UMF_RESULT_ERROR_UNKNOWN ;
553561 goto err_lock_init ;
554562 }
555563
556- ret = ops -> initialize (pool -> provider , params , & pool -> pool_priv );
564+ ret = pool -> ops . initialize (pool -> provider , params , & pool -> pool_priv );
557565 if (ret != UMF_RESULT_SUCCESS ) {
558566 goto err_pool_init ;
559567 }
@@ -579,6 +587,12 @@ static umf_result_t umfPoolCreateInternal(const umf_memory_pool_ops_t *ops,
579587 }
580588 }
581589
590+ ret = pool -> ops .ext_post_initialize (pool -> pool_priv );
591+ if (ret != UMF_RESULT_SUCCESS ) {
592+ LOG_ERR ("Failed to post-initialize pool" );
593+ goto err_pool_init ;
594+ }
595+
582596 * hPool = pool ;
583597 pools_by_name_add (pool );
584598
0 commit comments