From 29e8d0e5543f2c11cbaff37e793ec651c035b4ee Mon Sep 17 00:00:00 2001 From: Cedric Koch-Hofer Date: Fri, 24 May 2024 06:40:59 +0000 Subject: [PATCH] DAOS-10250 control: Get enabled and disabled ranks with dmg pool query Fix reviewers comments: - Improve code readability Features: control dmg Required-githooks: true Signed-off-by: Cedric Koch-Hofer --- src/mgmt/tests/mocks.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/mgmt/tests/mocks.c b/src/mgmt/tests/mocks.c index fa3ebed0417..f0dd41296b6 100644 --- a/src/mgmt/tests/mocks.c +++ b/src/mgmt/tests/mocks.c @@ -293,22 +293,26 @@ ds_mgmt_pool_query(uuid_t pool_uuid, d_rank_list_t *svc_ranks, d_rank_list_t **e uuid_copy(ds_mgmt_pool_query_uuid, pool_uuid); ds_mgmt_pool_query_info_ptr = (void *)pool_info; - if (pool_info != NULL && (pool_info->pi_bits & DPI_ENGINES_ENABLED) != 0) { + + if (pool_info == NULL) + return ds_mgmt_pool_query_return; + + if ((pool_info->pi_bits & DPI_ENGINES_ENABLED) != 0) { D_ASSERT(enabled_ranks != NULL); *enabled_ranks = d_rank_list_alloc(8); /* 0-7 ; caller must free this */ ds_mgmt_pool_query_enabled_ranks_out = *enabled_ranks; } - if (pool_info != NULL && (pool_info->pi_bits & DPI_ENGINES_DISABLED) != 0) { + if ((pool_info->pi_bits & DPI_ENGINES_DISABLED) != 0) { D_ASSERT(disabled_ranks != NULL); *disabled_ranks = d_rank_list_alloc(4); /* 0-4 ; caller must free this */ ds_mgmt_pool_query_disabled_ranks_out = *disabled_ranks; } - if (pool_info != NULL) { - ds_mgmt_pool_query_info_in = *pool_info; - *pool_info = ds_mgmt_pool_query_info_out; - } + + ds_mgmt_pool_query_info_in = *pool_info; + *pool_info = ds_mgmt_pool_query_info_out; + return ds_mgmt_pool_query_return; /* 0 */ }