diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Eprivate.h | 5 | ||||
-rw-r--r-- | src/H5VLiod_analysis.c | 230 | ||||
-rw-r--r-- | src/H5VLiod_attr.c | 454 | ||||
-rw-r--r-- | src/H5VLiod_dset.c | 318 | ||||
-rw-r--r-- | src/H5VLiod_dtype.c | 163 | ||||
-rw-r--r-- | src/H5VLiod_file.c | 268 | ||||
-rw-r--r-- | src/H5VLiod_group.c | 140 | ||||
-rw-r--r-- | src/H5VLiod_index.c | 78 | ||||
-rw-r--r-- | src/H5VLiod_link.c | 340 | ||||
-rw-r--r-- | src/H5VLiod_map.c | 258 | ||||
-rw-r--r-- | src/H5VLiod_obj.c | 379 | ||||
-rw-r--r-- | src/H5VLiod_server.c | 2 | ||||
-rw-r--r-- | src/H5VLiod_server.h | 13 | ||||
-rw-r--r-- | src/H5VLiod_trans.c | 83 | ||||
-rw-r--r-- | src/H5VLiod_util.c | 202 |
15 files changed, 1697 insertions, 1236 deletions
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 75b4f83..0e6def6 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -69,11 +69,6 @@ typedef struct H5E_t H5E_t; HGOTO_DONE(ret_val) \ } -#define HGOTO_ERROR_FF(ret_val, string) { \ - fprintf(stderr, "%s\n", string); \ - HGOTO_DONE(ret_val) \ -} - /* * HGOTO_ERROR_TAG macro, used like HGOTO_ERROR between H5_BEGIN_TAG and * H5_END_TAG statements. Resets the metadata tag before leaving the function. diff --git a/src/H5VLiod_analysis.c b/src/H5VLiod_analysis.c index 3d088c3..b716046 100644 --- a/src/H5VLiod_analysis.c +++ b/src/H5VLiod_analysis.c @@ -130,19 +130,31 @@ H5VL__iod_load_script(const char *script, const char *func_name) */ /* Get reference to main */ - if(NULL == (po_main = PyImport_AddModule("__main__"))) - HGOTO_ERROR_FF(NULL, "can't get reference to main module"); + if(NULL == (po_main = PyImport_AddModule("__main__"))) { + fprintf(stderr, "can't get reference to main module\n"); + ret_value = NULL; + goto done; + } - if(NULL == (po_main_dict = PyModule_GetDict(po_main))) - HGOTO_ERROR_FF(NULL, "can't get dictionary from main module"); + if(NULL == (po_main_dict = PyModule_GetDict(po_main))) { + fprintf(stderr, "can't get dictionary from main module\n"); + ret_value = NULL; + goto done; + } /* Load script */ - if(NULL == (po_rstring = PyRun_String(script, Py_file_input, po_main_dict, po_main_dict))) - HGOTO_ERROR_FF(NULL, "can't load script into main module"); + if(NULL == (po_rstring = PyRun_String(script, Py_file_input, po_main_dict, po_main_dict))) { + fprintf(stderr, "can't load script into main module\n"); + ret_value = NULL; + goto done; + } /* Get reference to function name */ - if(NULL == (po_func = PyObject_GetAttrString(po_main, func_name))) - HGOTO_ERROR_FF(NULL, "can't get reference to function"); + if(NULL == (po_func = PyObject_GetAttrString(po_main, func_name))) { + fprintf(stderr, "can't get reference to function\n"); + ret_value = NULL; + goto done; + } ret_value = po_func; @@ -273,8 +285,11 @@ H5VL__iod_create_numpy_array(size_t num_elmts, hid_t data_type_id, void *data) HDassert(data); /* Convert data_type to numpy type */ - if(FAIL == H5VL__iod_translate_h5_type(data_type_id, &npy_type)) - HGOTO_ERROR_FF(NULL, "unable to translate datatype to NPY type"); + if(FAIL == H5VL__iod_translate_h5_type(data_type_id, &npy_type)) { + fprintf(stderr, "unable to translate datatype to NPY type\n"); + ret_value = NULL; + goto done; + } ret_value = PyArray_SimpleNewFromData(1, dim, npy_type, data); @@ -488,6 +503,7 @@ H5VL__iod_request_container_open(const char *file_name, iod_handle_t **cohs) herr_t ret_value = SUCCEED; /* Return value */ hg_request_t *hg_reqs = NULL; iod_handle_t *temp_cohs = NULL; + iod_ret_t ret; int i; if(NULL == (hg_reqs = (hg_request_t *)malloc(sizeof(hg_request_t) * (unsigned int) num_ions_g))) @@ -505,8 +521,9 @@ H5VL__iod_request_container_open(const char *file_name, iod_handle_t **cohs) /* open the container */ printf("(%d) Calling iod_container_open on %s\n", my_rank_g, file_name); - if(iod_container_open(file_name, NULL, IOD_CONT_R, &temp_cohs[0], NULL)) - HGOTO_ERROR_FF(FAIL, "can't open file"); + ret = iod_container_open(file_name, NULL, IOD_CONT_R, &temp_cohs[0], NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open file"); for(i = 1; i < num_ions_g; i++) { if(HG_Wait(hg_reqs[i], HG_MAX_IDLE_TIME, HG_STATUS_IGNORE) < 0) @@ -539,6 +556,7 @@ H5VL__iod_request_container_close(iod_handle_t *cohs) { herr_t ret_value = SUCCEED; /* Return value */ hg_request_t *hg_reqs = NULL; + iod_ret_t ret; int i; if(NULL == (hg_reqs = (hg_request_t *)malloc(sizeof(hg_request_t) * (unsigned int) num_ions_g))) @@ -552,8 +570,9 @@ H5VL__iod_request_container_close(iod_handle_t *cohs) } /* close the container */ - if(iod_container_close(cohs[0], NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close container"); + ret = iod_container_close(cohs[0], NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close container"); for(i = 1; i < num_ions_g; i++) { if(HG_Wait(hg_reqs[i], HG_MAX_IDLE_TIME, HG_STATUS_IGNORE) < 0) @@ -769,103 +788,123 @@ H5VL_iod_server_analysis_execute_cb(AXE_engine_t UNUSED axe_engine, /* ****************** TEMP THING (as IOD requires collective container open) */ - if(FAIL == H5VL__iod_request_container_open(file_name, &cohs)) - HGOTO_ERROR_FF(FAIL, "can't request container open"); + ret = H5VL__iod_request_container_open(file_name, &cohs); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "can't request container open"); /* ***************** END TEMP THING */ - if(iod_query_cont_trans_stat(cohs[0], &tids, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get container tids status"); + ret = iod_query_cont_trans_stat(cohs[0], &tids, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get container tids status"); rtid = tids->latest_rdable; - if(iod_free_cont_trans_stat(cohs[0], tids) < 0) - HGOTO_ERROR_FF(FAIL, "can't free container transaction status object"); + ret = iod_free_cont_trans_stat(cohs[0], tids); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't free container transaction status object"); - if(iod_trans_start(cohs[0], &rtid, NULL, 0, IOD_TRANS_R, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't start transaction"); + ret = iod_trans_start(cohs[0], &rtid, NULL, 0, IOD_TRANS_R, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't start transaction"); root_handle.rd_oh.cookie = IOD_OH_UNDEFINED; root_handle.wr_oh.cookie = IOD_OH_UNDEFINED; /* Traverse Path to retrieve object ID, and open object */ - if(H5VL_iod_server_open_path(cohs[0], ROOT_ID, root_handle, obj_name, - rtid, 7, &obj_id, &obj_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't open object"); - - printf("(%d) coh %"PRIu64" objoh %"PRIu64" objid %"PRIx64" rtid %"PRIu64"\n", - my_rank_g, cohs[0].cookie, obj_oh.rd_oh.cookie, obj_id, rtid); + ret = H5VL_iod_server_open_path(cohs[0], ROOT_ID, root_handle, obj_name, + rtid, 7, &obj_id, &obj_oh); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "can't open object"); + +#if H5_EFF_DEBUG + fprintf(stderr, "(%d) coh %"PRIu64" objoh %"PRIu64" objid %"PRIx64" rtid %"PRIu64"\n", + my_rank_g, cohs[0].cookie, obj_oh.rd_oh.cookie, obj_id, rtid); + fprintf(stderr, "Calling iod_obj_query_map\n"); +#endif - printf("Calling iod_obj_query_map\n"); ret = iod_obj_query_map(obj_oh.rd_oh, rtid, &obj_map, NULL); - if (ret != 0) { - printf("iod_obj_query_map failed, ret: %d (%s).\n", ret, strerror(-ret)); - assert(0); - } + if (ret != 0) + HGOTO_ERROR_FF(ret, "iod_obj_query_map failed"); + +#if H5_EFF_DEBUG + fprintf(stderr, "(%d) %-10d\n", my_rank_g, obj_map->u_map.array_map.n_range); +#endif - printf("(%d) %-10d\n", my_rank_g, obj_map->u_map.array_map.n_range); for (i = 0; i < obj_map->u_map.array_map.n_range; i++) { - printf("(%d) range: %d, start: %zu %zu, " - "end: %zu %zu, n_cell: %zu, " - "loc: %s\n", my_rank_g, i, - obj_map->u_map.array_map.array_range[i].start_cell[0], - obj_map->u_map.array_map.array_range[i].start_cell[1], - obj_map->u_map.array_map.array_range[i].end_cell[0], - obj_map->u_map.array_map.array_range[i].end_cell[1], - obj_map->u_map.array_map.array_range[i].n_cell, - obj_map->u_map.array_map.array_range[i].loc); +#if H5_EFF_DEBUG + fprintf(stderr, "(%d) range: %d, start: %zu %zu, " + "end: %zu %zu, n_cell: %zu, " + "loc: %s\n", my_rank_g, i, + obj_map->u_map.array_map.array_range[i].start_cell[0], + obj_map->u_map.array_map.array_range[i].start_cell[1], + obj_map->u_map.array_map.array_range[i].end_cell[0], + obj_map->u_map.array_map.array_range[i].end_cell[1], + obj_map->u_map.array_map.array_range[i].n_cell, + obj_map->u_map.array_map.array_range[i].loc); +#endif } /* get scratch pad */ - if(iod_obj_get_scratch(obj_oh.rd_oh, rtid, (char *) &sp, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + ret = iod_obj_get_scratch(obj_oh.rd_oh, rtid, (char *) &sp, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); /* retrieve datatype and dataspace */ /* MSC - This applies only to DATASETS for Q6 */ /* open the metadata scratch pad */ - if (iod_obj_open_read(cohs[0], sp[0], rtid, NULL, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); - - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, - H5VL_IOD_KEY_OBJ_DATATYPE, - 7, NULL, &type_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve datatype"); - - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, - H5VL_IOD_KEY_OBJ_DATASPACE, - 7, NULL, &space_id) < 0) + ret = iod_obj_open_read(cohs[0], sp[0], rtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); + + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, + H5VL_IOD_KEY_OBJ_DATATYPE, 7, NULL, &type_id); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "failed to retrieve datatype"); + + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, + H5VL_IOD_KEY_OBJ_DATASPACE, 7, NULL, &space_id); + if(SUCCEED != ret) HGOTO_ERROR_FF(FAIL, "failed to retrieve dataspace"); /*******************************************/ /* Farm work */ - if(FAIL == H5VL__iod_farm_work(obj_map, cohs, obj_id, rtid, space_id, type_id, - query_id, split_script, combine_script)) - HGOTO_ERROR_FF(FAIL, "can't farm work"); + ret = H5VL__iod_farm_work(obj_map, cohs, obj_id, rtid, space_id, type_id, + query_id, split_script, combine_script); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "can't farm work"); /********************************************/ - iod_obj_free_map(obj_oh.rd_oh, obj_map); + ret = iod_obj_free_map(obj_oh.rd_oh, obj_map); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't free IOD map"); - /* close the metadata scratch pad */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); - /* close object */ - if(iod_obj_close(obj_oh.rd_oh, NULL, NULL) < 0) - HDONE_ERROR_FF(FAIL, "can't close Array object"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); - if(iod_trans_finish(cohs[0], rtid, NULL, 0, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't finish transaction 0"); + ret = iod_obj_close(obj_oh.rd_oh, NULL, NULL); + if(ret < 0) + HDONE_ERROR_FF(ret, "can't close Array object"); + + ret = iod_trans_finish(cohs[0], rtid, NULL, 0, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't finish transaction 0"); /* ****************** TEMP THING (as IOD requires collective container open) */ - printf("Closing container\n"); - if(FAIL == H5VL__iod_request_container_close(cohs)) - HGOTO_ERROR_FF(FAIL, "can't request container close"); + ret = H5VL__iod_request_container_close(cohs); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "can't request container close"); /* ***************** END TEMP THING */ - printf("Analysis DONE\n"); +#if H5_EFF_DEBUG + fprintf(stderr, "Analysis DONE\n"); +#endif + /* set output, and return to AS client */ output.ret = ret_value; HG_Handler_start_output(op_data->hg_handle, &output); @@ -913,7 +952,10 @@ H5VL__iod_farm_split(iod_handle_t coh, iod_obj_id_t obj_id, iod_trans_id_t rtid, type_id, &num_elmts, &data) < 0) HGOTO_ERROR_FF(FAIL, "can't read local data"); - printf("(%d) Applying split on data\n", my_rank_g); +#if H5_EFF_DEBUG + fprintf(stderr, "(%d) Applying split on data\n", my_rank_g); +#endif + /* Apply split python script on data from query */ #ifdef H5_HAVE_PYTHON if(FAIL == H5VL__iod_split(split_script, data, num_elmts, type_id, @@ -965,9 +1007,9 @@ H5VL_iod_server_analysis_farm_cb(AXE_engine_t UNUSED axe_engine, hid_t split_type_id; herr_t ret_value = SUCCEED; - if(FAIL == H5VL__iod_farm_split(coh, obj_id, rtid, space_id, coords, num_cells, - type_id, query_id, split_script, - &split_data, &split_num_elmts, &split_type_id)) + if(H5VL__iod_farm_split(coh, obj_id, rtid, space_id, coords, num_cells, + type_id, query_id, split_script, + &split_data, &split_num_elmts, &split_type_id) < 0) HGOTO_ERROR_FF(FAIL, "can't split in farmed job"); /* allocate output struct */ @@ -1087,7 +1129,7 @@ H5VL__iod_get_space_layout(coords_t coords, iod_size_t num_cells, hid_t space_id count[i] = 1; } - if(H5Sselect_hyperslab(space_layout, H5S_SELECT_SET, start, NULL, count, block)) + if(H5Sselect_hyperslab(space_layout, H5S_SELECT_SET, start, NULL, count, block) < 0) HGOTO_ERROR_FF(FAIL, "unable to add point to selection"); ret_value = space_layout; @@ -1125,9 +1167,11 @@ H5VL__iod_get_query_data_cb(void *elem, hid_t type_id, unsigned ndim, /* If element satisfies query, add it to the selection */ if (result) { /* TODO remove that after demo */ - printf("(%d) Element |%d| matches query\n", my_rank_g, *((int *) elem)); +#if H5_EFF_DEBUG + fprintf(stderr, "(%d) Element |%d| matches query\n", my_rank_g, *((int *) elem)); +#endif udata->num_elmts ++; - if(H5Sselect_elements(udata->space_query, H5S_SELECT_APPEND, 1, point)) + if(H5Sselect_elements(udata->space_query, H5S_SELECT_APPEND, 1, point) < 0) HGOTO_ERROR_FF(FAIL, "unable to add point to selection") } @@ -1158,6 +1202,7 @@ H5VL__iod_get_query_data(iod_handle_t coh, iod_obj_id_t dset_id, H5VL__iod_get_query_data_t udata; void *buf = NULL; hid_t space_query = FAIL, mem_space = FAIL; + iod_ret_t ret; herr_t ret_value = SUCCEED; nelmts = (size_t) H5Sget_select_npoints(space_id); @@ -1169,8 +1214,9 @@ H5VL__iod_get_query_data(iod_handle_t coh, iod_obj_id_t dset_id, HGOTO_ERROR_FF(FAIL, "can't allocate read buffer"); /* read the data local on the ION specified in the layout selection */ - if(H5VL__iod_read_selection(coh, dset_id, rtid, space_id, type_id, buf) < 0) - HGOTO_ERROR_FF(FAIL, "can't read local data"); + ret = H5VL__iod_read_selection(coh, dset_id, rtid, space_id, type_id, buf); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "can't read local data"); dims[0] = (hsize_t)nelmts; /* create a 1-D selection to describe the data read in memory */ @@ -1231,24 +1277,28 @@ H5VL__iod_read_selection(iod_handle_t coh, iod_obj_id_t obj_id, iod_handle_t obj_oh; size_t buf_size=0; size_t elmt_size; + iod_ret_t ret; herr_t ret_value = SUCCEED; /* open the array object */ - if (iod_obj_open_read(coh, obj_id, rtid, NULL, &obj_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open array object fo read"); + ret = iod_obj_open_read(coh, obj_id, rtid, NULL, &obj_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open array object fo read"); /* read the data selection from IOD. */ /* MSC - will need to do it in pieces, not it one shot. */ elmt_size = H5Tget_size(type_id); - if(H5VL__iod_server_final_io(obj_oh, space_id, elmt_size, FALSE, - buf, buf_size, (uint64_t)0, 0, rtid) < 0) - HGOTO_ERROR_FF(FAIL, "can't read from array object"); + ret = H5VL__iod_server_final_io(obj_oh, space_id, elmt_size, FALSE, + buf, buf_size, (uint64_t)0, 0, rtid); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "can't read from array object"); done: - if(obj_oh.cookie != IOD_OH_UNDEFINED && - iod_obj_close(obj_oh, NULL, NULL) < 0) - HDONE_ERROR_FF(FAIL, "can't close Array object"); - + if(obj_oh.cookie != IOD_OH_UNDEFINED) { + ret = iod_obj_close(obj_oh, NULL, NULL); + if(ret < 0) + HDONE_ERROR_FF(ret, "can't close Array object"); + } return ret_value; } /* end H5VL__iod_read_selection() */ diff --git a/src/H5VLiod_attr.c b/src/H5VLiod_attr.c index 83b86fe..130c36b 100644 --- a/src/H5VLiod_attr.c +++ b/src/H5VLiod_attr.c @@ -68,6 +68,7 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, iod_size_t array_dims[H5S_MAX_RANK], current_dims[H5S_MAX_RANK]; iod_hint_list_t *obj_create_hint = NULL; hbool_t opened_locally = FALSE; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -88,15 +89,17 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, if(loc_handle.rd_oh.cookie == IOD_OH_UNDEFINED) { /* Try and open the starting location */ - if (iod_obj_open_read(coh, loc_id, wtid, NULL, &loc_handle.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open start location"); + ret = iod_obj_open_read(coh, loc_id, wtid, NULL, &loc_handle.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open start location"); opened_locally = TRUE; } /* Open the object where the attribute needs to be created. */ - if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name, rtid, - cs_scope, &obj_id, &obj_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't open object"); + ret = H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name, rtid, + cs_scope, &obj_id, &obj_oh); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open object"); /* Set the IOD array creation parameters */ array.cell_size = (uint32_t)H5Tget_size(input->type_id); @@ -118,18 +121,22 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, array.chunk_dims = NULL; /* create the attribute */ - if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_ARRAY, NULL, - &array, &attr_id, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't create Attribute"); - - if (iod_obj_open_read(coh, attr_id, wtid, NULL, &attr_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open attribute"); - if (iod_obj_open_write(coh, attr_id, wtid, NULL, &attr_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open attribute"); + ret = iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_ARRAY, NULL, + &array, &attr_id, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't create Attribute"); + + ret = iod_obj_open_read(coh, attr_id, wtid, NULL, &attr_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open attribute"); + ret = iod_obj_open_write(coh, attr_id, wtid, NULL, &attr_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open attribute"); /* create the metadata KV object for the attribute */ - if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, NULL, NULL, &mdkv_id, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't create metadata KV object"); + ret = iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, NULL, NULL, &mdkv_id, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't create metadata KV object"); /* set values for the scratch pad object */ sp[0] = mdkv_id; @@ -140,40 +147,47 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, /* set scratch pad in attribute */ if(cs_scope & H5_CHECKSUM_IOD) { sp_cs = H5_checksum_crc64(&sp, sizeof(sp)); - if (iod_obj_set_scratch(attr_oh.wr_oh, wtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set scratch pad"); + ret = iod_obj_set_scratch(attr_oh.wr_oh, wtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set scratch pad"); } else { - if (iod_obj_set_scratch(attr_oh.wr_oh, wtid, &sp, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set scratch pad"); + ret = iod_obj_set_scratch(attr_oh.wr_oh, wtid, &sp, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set scratch pad"); } /* Open Metadata KV object for write */ - if (iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't create scratch pad"); + ret = iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't create scratch pad"); /* insert object type metadata */ - if(H5VL_iod_insert_object_type(mdkv_oh, wtid, H5I_ATTR, cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_object_type(mdkv_oh, wtid, H5I_ATTR, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* MSC - need to check size of datatype if it fits in entry otherwise create a BLOB */ /* insert datatype metadata */ - if(H5VL_iod_insert_datatype(mdkv_oh, wtid, input->type_id, cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_datatype(mdkv_oh, wtid, input->type_id, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* insert dataspace metadata */ - if(H5VL_iod_insert_dataspace(mdkv_oh, wtid, input->space_id, cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_dataspace(mdkv_oh, wtid, input->space_id, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* if the starting location is not the last component, need to read the attrkv_id of the last object where attribute needs to be created */ if(loc_id != obj_id || loc_attrkv_id == IOD_OBJ_INVALID) { /* get scratch pad of the parent */ - if(iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + ret = iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -182,19 +196,22 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, } /* open the attribute KV in scratch pad */ - if (iod_obj_open_write(coh, sp[1], wtid, NULL /*hints*/, &attr_kv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + ret = iod_obj_open_write(coh, sp[1], wtid, NULL /*hints*/, &attr_kv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); } else { /* open the attribute KV */ - if (iod_obj_open_write(coh, loc_attrkv_id, wtid, NULL /*hints*/, &attr_kv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + ret = iod_obj_open_write(coh, loc_attrkv_id, wtid, NULL, &attr_kv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); } /* insert new attribute in scratch pad of current object */ - if(H5VL_iod_insert_new_link(attr_kv_oh, wtid, attr_name, - H5L_TYPE_HARD, &attr_id, cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_new_link(attr_kv_oh, wtid, attr_name, + H5L_TYPE_HARD, &attr_id, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); output.iod_oh.rd_oh.cookie = attr_oh.rd_oh.cookie; output.iod_oh.wr_oh.cookie = attr_oh.wr_oh.cookie; @@ -237,18 +254,6 @@ done: obj_create_hint = NULL; } -#if 0 - /* close the Metadata KV object */ - if(mdkv_oh.cookie != IOD_OH_UNDEFINED && - iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HDONE_ERROR_FF(FAIL, "can't close object"); - - /* close the Attribute KV object */ - if(attr_kv_oh.cookie != IOD_OH_UNDEFINED && - iod_obj_close(attr_kv_oh, NULL, NULL) < 0) - HDONE_ERROR_FF(FAIL, "can't close object"); -#endif - input = (attr_create_in_t *)H5MM_xfree(input); op_data = (op_data_t *)H5MM_xfree(op_data); @@ -292,6 +297,7 @@ H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine, scratch_pad sp; iod_checksum_t sp_cs = 0; H5VL_iod_link_t iod_link; + iod_ret_t ret; herr_t ret_value = SUCCEED; @@ -301,9 +307,10 @@ H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine, #endif /* Open the object where the attribute needs to be opened. */ - if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name, - rtid, cs_scope, &obj_id, &obj_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't open object"); + ret = H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name, + rtid, cs_scope, &obj_id, &obj_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't open object"); #if H5_EFF_DEBUG fprintf(stderr, "Attribute is on object (OH %"PRIu64" ID %"PRIx64")\n", @@ -315,8 +322,9 @@ H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine, to be created */ if(loc_id != obj_id || loc_attrkv_id == IOD_OBJ_INVALID) { /* get scratch pad of the object */ - if(iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + ret = iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -329,19 +337,22 @@ H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR_FF(FAIL, "Object has no attributes"); /* open the attribute KV in scratch pad */ - if (iod_obj_open_read(coh, sp[1], rtid, NULL /*hints*/, &attr_kv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + ret = iod_obj_open_read(coh, sp[1], rtid, NULL, &attr_kv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); } else { /* open the attribute KV */ - if (iod_obj_open_read(coh, loc_attrkv_id, rtid, NULL /*hints*/, &attr_kv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + ret = iod_obj_open_read(coh, loc_attrkv_id, rtid, NULL, &attr_kv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); } /* get attribute ID */ - if(H5VL_iod_get_metadata(attr_kv_oh, rtid, H5VL_IOD_LINK, - attr_name, cs_scope, NULL, &iod_link) < 0) - HGOTO_ERROR_FF(FAIL, "can't retrieve Attribute ID from parent KV store"); + ret = H5VL_iod_get_metadata(attr_kv_oh, rtid, H5VL_IOD_LINK, + attr_name, cs_scope, NULL, &iod_link); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't retrieve Attribute ID from parent KV store"); HDassert(iod_link.link_type == H5L_TYPE_HARD); attr_id = iod_link.u.iod_id; @@ -349,20 +360,28 @@ H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine, /* close parent group if it is not the location we started the traversal into */ if(loc_handle.rd_oh.cookie != obj_oh.rd_oh.cookie) { - iod_obj_close(obj_oh.rd_oh, NULL, NULL); + ret = iod_obj_close(obj_oh.rd_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close IOD object"); } + /* close the attribute KV holder */ - iod_obj_close(attr_kv_oh, NULL, NULL); + ret = iod_obj_close(attr_kv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close IOD object"); /* open the attribute */ - if (iod_obj_open_read(coh, attr_id, rtid, NULL /*hints*/, &attr_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); - if (iod_obj_open_write(coh, attr_id, rtid, NULL /*hints*/, &attr_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_read(coh, attr_id, rtid, NULL, &attr_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); + ret = iod_obj_open_write(coh, attr_id, rtid, NULL, &attr_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); /* get scratch pad of the attribute */ - if(iod_obj_get_scratch(attr_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + ret = iod_obj_get_scratch(attr_oh.rd_oh, rtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -371,22 +390,26 @@ H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad of the attribute */ - if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); - - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, - H5VL_IOD_KEY_OBJ_DATATYPE, - cs_scope, NULL, &output.type_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve datatype"); - - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, - H5VL_IOD_KEY_OBJ_DATASPACE, - cs_scope, NULL, &output.space_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve dataspace"); + ret = iod_obj_open_read(coh, sp[0], rtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); + + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, + H5VL_IOD_KEY_OBJ_DATATYPE, + cs_scope, NULL, &output.type_id); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "failed to retrieve datatype"); + + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, + H5VL_IOD_KEY_OBJ_DATASPACE, + cs_scope, NULL, &output.space_id); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "failed to retrieve dataspace"); /* close the metadata scratch pad */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); output.iod_id = attr_id; output.mdkv_id = sp[0]; @@ -463,8 +486,9 @@ H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine, /* open the attribute if we don't have the handle yet */ if(iod_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_read(coh, iod_id, rtid, NULL /*hints*/, &iod_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_read(coh, iod_id, rtid, NULL, &iod_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); opened_locally = TRUE; } @@ -481,17 +505,20 @@ H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine, /* Get dataspace if it is not available */ if(H5I_UNINIT == space_id) { /* open the metadata scratch pad of the attribute */ - if (iod_obj_open_read(coh, mdkv_id, rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + ret = iod_obj_open_read(coh, mdkv_id, rtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, - H5VL_IOD_KEY_OBJ_DATASPACE, - cs_scope, NULL, &space_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve dataspace"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, + H5VL_IOD_KEY_OBJ_DATASPACE, + cs_scope, NULL, &space_id); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "failed to retrieve dataspace"); /* close the metadata scratch pad */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); } /* set the memory descriptor */ @@ -539,10 +566,8 @@ H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine, if(cs_scope & H5_CHECKSUM_IOD) { ret = iod_array_read(iod_oh, rtid, NULL, mem_desc, &file_desc, &iod_cs, NULL); - if(ret < 0) { - fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't read from array object"); - } + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't read from array object"); attr_cs = H5_checksum_crc64(buf, size); @@ -551,10 +576,8 @@ H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine, } else { ret = iod_array_read(iod_oh, rtid, NULL, mem_desc, &file_desc, NULL, NULL); - if(ret < 0) { - fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't read from array object"); - } + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't read from array object"); } /* Create a new block handle to write the data */ @@ -592,10 +615,10 @@ done: /* close the attribute if we opened it in this routine */ if(opened_locally) { - if(iod_obj_close(iod_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close Array object"); + ret = iod_obj_close(iod_oh, NULL, NULL); + if(ret < 0) + HDONE_ERROR_FF(ret, "can't close Array object"); } - } /* end H5VL_iod_server_attr_read_cb() */ @@ -643,12 +666,14 @@ H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine, hssize_t num_descriptors = 0; /* number of IOD file descriptors needed to describe filespace selection*/ na_addr_t source = HG_Handler_get_addr(op_data->hg_handle); /* source address to pull data from */ hbool_t opened_locally = FALSE; /* flag to indicate whether we opened the attribute here or if it was already opened */ + iod_ret_t ret; herr_t ret_value = SUCCEED; /* open the attribute if we don't have the handle yet */ if(iod_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_write(coh, iod_id, wtid, NULL /*hints*/, &iod_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_write(coh, iod_id, wtid, NULL /*hints*/, &iod_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); opened_locally = TRUE; } @@ -678,16 +703,19 @@ H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine, /* Get dataspace if it is not available */ if(H5I_UNINIT == space_id) { /* open the metadata scratch pad of the attribute */ - if (iod_obj_open_read(coh, mdkv_id, wtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + ret = iod_obj_open_read(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, H5VL_IOD_KEY_OBJ_DATASPACE, - cs_scope, NULL, &space_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve dataspace"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, H5VL_IOD_KEY_OBJ_DATASPACE, + cs_scope, NULL, &space_id); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "failed to retrieve dataspace"); /* close the metadata scratch pad */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); } /* set the memory descriptor */ @@ -734,13 +762,15 @@ H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine, if(cs_scope & H5_CHECKSUM_IOD) { attr_cs = H5_checksum_crc64(buf, size); /* write from array object */ - if(iod_array_write(iod_oh, wtid, NULL, mem_desc, &file_desc, &attr_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't write to array object"); + ret = iod_array_write(iod_oh, wtid, NULL, mem_desc, &file_desc, &attr_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't write to array object"); } else { /* write from array object */ - if(iod_array_write(iod_oh, wtid, NULL, mem_desc, &file_desc, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't write to array object"); + ret = iod_array_write(iod_oh, wtid, NULL, mem_desc, &file_desc, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't write to array object"); } done: @@ -766,8 +796,9 @@ done: /* close the attribute if we opened it in this routine */ if(opened_locally) { - if(iod_obj_close(iod_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close Array object"); + ret = iod_obj_close(iod_oh, NULL, NULL); + if(ret < 0) + HDONE_ERROR_FF(ret, "can't close Array object"); } } /* end H5VL_iod_server_attr_write_cb() */ @@ -807,6 +838,7 @@ H5VL_iod_server_attr_exists_cb(AXE_engine_t UNUSED axe_engine, iod_checksum_t sp_cs = 0; iod_size_t kv_size = 0; htri_t ret = -1; + iod_ret_t iod_ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -814,14 +846,16 @@ H5VL_iod_server_attr_exists_cb(AXE_engine_t UNUSED axe_engine, #endif /* Open the object where the attribute needs to be checked. */ - if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name, rtid, - cs_scope, &obj_id, &obj_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't open object"); + iod_ret = H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name, rtid, + cs_scope, &obj_id, &obj_oh); + if(SUCCEED != iod_ret) + HGOTO_ERROR_FF(iod_ret, "can't open object"); if(loc_id != obj_id || IOD_OBJ_INVALID == input->loc_attrkv_id) { /* get scratch pad of the parent */ - if(iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + iod_ret = iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL); + if(iod_ret < 0) + HGOTO_ERROR_FF(iod_ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -836,19 +870,23 @@ H5VL_iod_server_attr_exists_cb(AXE_engine_t UNUSED axe_engine, } /* open the attribute KV in scratch pad */ - if (iod_obj_open_read(coh, sp[1], rtid, NULL, &attr_kv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + iod_ret = iod_obj_open_read(coh, sp[1], rtid, NULL, &attr_kv_oh, NULL); + if(iod_ret < 0) + HGOTO_ERROR_FF(iod_ret, "can't open scratch pad"); } else { /* open the attribute KV */ - if (iod_obj_open_read(coh, input->loc_attrkv_id, rtid, NULL, &attr_kv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + iod_ret = iod_obj_open_read(coh, input->loc_attrkv_id, rtid, NULL, &attr_kv_oh, NULL); + if(iod_ret < 0) + HGOTO_ERROR_FF(iod_ret, "can't open scratch pad"); } /* close parent group if it is not the location we started the traversal into */ if(loc_handle.rd_oh.cookie != obj_oh.rd_oh.cookie) { - iod_obj_close(obj_oh.rd_oh, NULL, NULL); + iod_ret = iod_obj_close(obj_oh.rd_oh, NULL, NULL); + if(iod_ret < 0) + HGOTO_ERROR_FF(iod_ret, "can't close group"); } /* get attribute ID */ @@ -860,7 +898,9 @@ H5VL_iod_server_attr_exists_cb(AXE_engine_t UNUSED axe_engine, ret = TRUE; } - iod_obj_close(attr_kv_oh, NULL, NULL); + iod_ret = iod_obj_close(attr_kv_oh, NULL, NULL); + if(iod_ret < 0) + HGOTO_ERROR_FF(iod_ret, "can't close group"); done: #if H5_EFF_DEBUG @@ -922,14 +962,16 @@ H5VL_iod_server_attr_rename_cb(AXE_engine_t UNUSED axe_engine, #endif /* Open the object where the attribute needs to be checked. */ - if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name, - rtid, cs_scope, &obj_id, &obj_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't open object"); + ret = H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name, + rtid, cs_scope, &obj_id, &obj_oh); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "can't open object"); if(loc_id != obj_id || IOD_OBJ_INVALID == input->loc_attrkv_id) { /* get scratch pad of the parent */ - if(iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + ret = iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -942,29 +984,36 @@ H5VL_iod_server_attr_rename_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR_FF(FAIL, "Object has no attributes"); /* open the attribute KV in scratch pad */ - if (iod_obj_open_read(coh, sp[1], wtid, NULL /*hints*/, &attr_kv_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); - if (iod_obj_open_write(coh, sp[1], wtid, NULL /*hints*/, &attr_kv_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + ret = iod_obj_open_read(coh, sp[1], wtid, NULL, &attr_kv_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open iod object"); + ret = iod_obj_open_write(coh, sp[1], wtid, NULL, &attr_kv_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open iod object"); } else { /* open the attribute KV */ - if (iod_obj_open_read(coh, input->loc_attrkv_id, wtid, NULL /*hints*/, &attr_kv_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); - if (iod_obj_open_write(coh, input->loc_attrkv_id, wtid, NULL /*hints*/, &attr_kv_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + ret = iod_obj_open_read(coh, input->loc_attrkv_id, wtid, NULL, &attr_kv_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); + ret = iod_obj_open_write(coh, input->loc_attrkv_id, wtid, NULL, &attr_kv_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); } /* close parent group if it is not the location we started the traversal into */ if(loc_handle.rd_oh.cookie != obj_oh.rd_oh.cookie) { - iod_obj_close(obj_oh.rd_oh, NULL, NULL); + ret = iod_obj_close(obj_oh.rd_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); } /* get attribute ID */ - if(H5VL_iod_get_metadata(attr_kv_oh.rd_oh, rtid, H5VL_IOD_LINK, - old_name, cs_scope, NULL, &iod_link) < 0) - HGOTO_ERROR_FF(FAIL, "can't retrieve Attribute ID from parent KV store"); + ret = H5VL_iod_get_metadata(attr_kv_oh.rd_oh, rtid, H5VL_IOD_LINK, + old_name, cs_scope, NULL, &iod_link); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "can't retrieve Attribute ID from parent KV store"); HDassert(iod_link.link_type == H5L_TYPE_HARD); attr_id = iod_link.u.iod_id; @@ -975,19 +1024,23 @@ H5VL_iod_server_attr_rename_cb(AXE_engine_t UNUSED axe_engine, kvs.kv = &kv; kvs.cs = NULL; kvs.ret = &ret; - if(iod_kv_unlink_keys(attr_kv_oh.wr_oh, wtid, NULL, 1, &kvs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "Unable to unlink KV pair"); + ret = iod_kv_unlink_keys(attr_kv_oh.wr_oh, wtid, NULL, 1, &kvs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "Unable to unlink KV pair"); /* insert attribute with new name */ - if(H5VL_iod_insert_new_link(attr_kv_oh.wr_oh, wtid, new_name, - H5L_TYPE_HARD, &attr_id, cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_new_link(attr_kv_oh.wr_oh, wtid, new_name, + H5L_TYPE_HARD, &attr_id, cs_scope, NULL, NULL); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* close the Attribute KV object */ - if(iod_obj_close(attr_kv_oh.rd_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); - if(iod_obj_close(attr_kv_oh.wr_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(attr_kv_oh.rd_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); + ret = iod_obj_close(attr_kv_oh.wr_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); done: @@ -1051,14 +1104,16 @@ H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine, #endif /* Open the object where the attribute needs to be removed. */ - if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name, rtid, - cs_scope, &obj_id, &obj_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't open object"); + ret = H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name, rtid, + cs_scope, &obj_id, &obj_oh); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "can't open object"); if(loc_id != obj_id) { /* get scratch pad of the parent */ - if(iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + ret = iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -1071,42 +1126,51 @@ H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR_FF(FAIL, "Object has no attributes"); /* open the attribute KV in scratch pad */ - if (iod_obj_open_read(coh, sp[1], wtid, NULL /*hints*/, &attr_kv_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); - if (iod_obj_open_write(coh, sp[1], wtid, NULL /*hints*/, &attr_kv_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + ret = iod_obj_open_read(coh, sp[1], wtid, NULL, &attr_kv_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open iod object"); + ret = iod_obj_open_write(coh, sp[1], wtid, NULL, &attr_kv_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open iod object"); } else { /* open the attribute KV */ - if (iod_obj_open_read(coh, input->loc_attrkv_id, wtid, NULL /*hints*/, &attr_kv_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); - if (iod_obj_open_write(coh, input->loc_attrkv_id, wtid, NULL /*hints*/, &attr_kv_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + ret = iod_obj_open_read(coh, input->loc_attrkv_id, wtid, NULL, &attr_kv_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open iod object"); + ret = iod_obj_open_write(coh, input->loc_attrkv_id, wtid, NULL, &attr_kv_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open iod object"); } step ++; /* get attribute ID */ - if(H5VL_iod_get_metadata(attr_kv_oh.rd_oh, rtid, H5VL_IOD_LINK, - attr_name, cs_scope, NULL, &iod_link) < 0) - HGOTO_ERROR_FF(FAIL, "can't retrieve Attribute ID from parent KV store"); + ret = H5VL_iod_get_metadata(attr_kv_oh.rd_oh, rtid, H5VL_IOD_LINK, + attr_name, cs_scope, NULL, &iod_link); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "can't retrieve Attribute ID from parent KV store"); HDassert(iod_link.link_type == H5L_TYPE_HARD); attr_id = iod_link.u.iod_id; /* remove metadata KV of attribute */ /* open the attribute */ - if (iod_obj_open_read(coh, attr_id, wtid, NULL /*hints*/, &attr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_read(coh, attr_id, wtid, NULL, &attr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); step ++; /* get scratch pad of the attribute */ - if(iod_obj_get_scratch(attr_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + ret = iod_obj_get_scratch(attr_oh, rtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); /* close the attribute oh */ - iod_obj_close(attr_oh, NULL, NULL); + ret = iod_obj_close(attr_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); step --; @@ -1117,10 +1181,8 @@ H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine, } ret = iod_obj_unlink(coh, sp[0], wtid, NULL); - if(ret < 0) { - fprintf(stderr, "ret %d error %s\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "Unable to unlink MDKV of attribute object"); - } + if(ret < 0) + HGOTO_ERROR_FF(ret, "Unable to unlink MDKV of attribute object"); /* remove attribute */ kv.key = (void *)attr_name; @@ -1128,20 +1190,23 @@ H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine, kvs.kv = &kv; kvs.cs = NULL; kvs.ret = &ret; - if(iod_kv_unlink_keys(attr_kv_oh.wr_oh, wtid, NULL, 1, &kvs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "Unable to unlink KV pair"); + ret = iod_kv_unlink_keys(attr_kv_oh.wr_oh, wtid, NULL, 1, &kvs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "Unable to unlink KV pair"); /* close the Attribute KV object */ - iod_obj_close(attr_kv_oh.rd_oh, NULL, NULL); - iod_obj_close(attr_kv_oh.wr_oh, NULL, NULL); + ret = iod_obj_close(attr_kv_oh.rd_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); + ret = iod_obj_close(attr_kv_oh.wr_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); step --; ret = iod_obj_unlink(coh, attr_id, wtid, NULL); - if(ret != 0) { - fprintf(stderr, "ret %d error %s\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "Unable to unlink object"); - } + if(ret != 0) + HGOTO_ERROR_FF(ret, "Unable to unlink object"); done: #if H5_EFF_DEBUG @@ -1170,7 +1235,6 @@ done: input = (attr_op_in_t *)H5MM_xfree(input); op_data = (op_data_t *)H5MM_xfree(op_data); - } /* end H5VL_iod_server_attr_remove_cb() */ @@ -1196,6 +1260,7 @@ H5VL_iod_server_attr_close_cb(AXE_engine_t UNUSED axe_engine, op_data_t *op_data = (op_data_t *)_op_data; attr_close_in_t *input = (attr_close_in_t *)op_data->input; iod_handles_t iod_oh = input->iod_oh; /* iod handle to close */ + iod_ret_t ret; //iod_obj_id_t iod_id = input->iod_id; /* iod id of object to close */ herr_t ret_value = SUCCEED; @@ -1204,10 +1269,13 @@ H5VL_iod_server_attr_close_cb(AXE_engine_t UNUSED axe_engine, iod_oh.rd_oh.cookie, iod_oh.wr_oh.cookie); #endif - if((iod_obj_close(iod_oh.rd_oh, NULL, NULL)) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); - if((iod_obj_close(iod_oh.wr_oh, NULL, NULL)) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(iod_oh.rd_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); + + ret = iod_obj_close(iod_oh.wr_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); done: #if H5_EFF_DEBUG diff --git a/src/H5VLiod_dset.c b/src/H5VLiod_dset.c index 2650570..135027b 100644 --- a/src/H5VLiod_dset.c +++ b/src/H5VLiod_dset.c @@ -163,9 +163,10 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, /* the traversal will retrieve the location where the dataset needs to be created. The traversal will fail if an intermediate group does not exist. */ - if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, wtid, rtid, FALSE, - cs_scope, &last_comp, &cur_id, &cur_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't traverse path"); + ret = H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, wtid, rtid, FALSE, + cs_scope, &last_comp, &cur_id, &cur_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't traverse path"); } else { /* this is an anon dataset.. no link information */ @@ -233,25 +234,28 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, /* create the dataset */ ret = iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_ARRAY, NULL, &array, &dset_id, NULL); - if(ret != 0) { - fprintf(stderr, "ret: %d error: %s\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't create Array object"); - } + if(ret != 0) + HGOTO_ERROR_FF(ret, "can't create Array object"); + + ret = iod_obj_open_write(coh, dset_id, wtid, NULL, &dset_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open Dataset for Write"); - if (iod_obj_open_write(coh, dset_id, wtid, NULL, &dset_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open Dataset for Write"); - if (iod_obj_open_read(coh, dset_id, wtid, NULL, &dset_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open Dataset for Read"); + ret = iod_obj_open_read(coh, dset_id, wtid, NULL, &dset_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open Dataset for Read"); step ++; /* create the attribute KV object for the dataset */ - if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, NULL, NULL, &attrkv_id, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't create attribute KV object"); + ret = iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, NULL, NULL, &attrkv_id, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't create attribute KV object"); /* create the metadata KV object for the dataset */ - if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, NULL, NULL, &mdkv_id, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't create metadata KV object"); + ret = iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, NULL, NULL, &mdkv_id, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't create metadata KV object"); /* set values for the scratch pad object */ sp[0] = mdkv_id; @@ -265,59 +269,64 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, sp_cs = H5_checksum_crc64(&sp, sizeof(sp)); - if (iod_obj_set_scratch(dset_oh.wr_oh, wtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set scratch pad"); + ret = iod_obj_set_scratch(dset_oh.wr_oh, wtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set scratch pad"); } else { - if (iod_obj_set_scratch(dset_oh.wr_oh, wtid, &sp, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set scratch pad"); + ret = iod_obj_set_scratch(dset_oh.wr_oh, wtid, &sp, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set scratch pad"); } /* Open Metadata KV object for write */ - if (iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't create scratch pad"); + ret = iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't create scratch pad"); step ++; /* insert plist metadata */ - if(H5VL_iod_insert_plist(mdkv_oh, wtid, dcpl_id, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_plist(mdkv_oh, wtid, dcpl_id, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* insert link count metadata */ - if(H5VL_iod_insert_link_count(mdkv_oh, wtid, (uint64_t)1, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_link_count(mdkv_oh, wtid, (uint64_t)1, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* insert object type metadata */ - if(H5VL_iod_insert_object_type(mdkv_oh, wtid, H5I_DATASET, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_object_type(mdkv_oh, wtid, H5I_DATASET, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* MSC - need to check size of datatype if it fits in entry otherwise create a BLOB*/ /* insert datatype metadata */ - if(H5VL_iod_insert_datatype(mdkv_oh, wtid, input->type_id, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_datatype(mdkv_oh, wtid, input->type_id, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* insert dataspace metadata */ - if(H5VL_iod_insert_dataspace(mdkv_oh, wtid, space_id, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_dataspace(mdkv_oh, wtid, space_id, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* close the Metadata KV object */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); step --; /* If dataset is not anonymous, add link in parent group to current object */ if(name) { - if(H5VL_iod_insert_new_link(cur_oh.wr_oh, wtid, last_comp, - H5L_TYPE_HARD, &dset_id, cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_new_link(cur_oh.wr_oh, wtid, last_comp, + H5L_TYPE_HARD, &dset_id, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); } output.iod_oh.rd_oh.cookie = dset_oh.rd_oh.cookie; @@ -403,6 +412,7 @@ H5VL_iod_server_dset_open_cb(AXE_engine_t UNUSED axe_engine, scratch_pad sp; iod_checksum_t sp_cs = 0; int step = 0; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -411,18 +421,21 @@ H5VL_iod_server_dset_open_cb(AXE_engine_t UNUSED axe_engine, #endif /* Traverse Path and open dset */ - if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, name, rtid, - cs_scope, &dset_id, &dset_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't open object"); + ret = H5VL_iod_server_open_path(coh, loc_id, loc_handle, name, rtid, + cs_scope, &dset_id, &dset_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't open object"); /* open a write handle on the ID. */ - if (iod_obj_open_write(coh, dset_id, rtid, NULL, &dset_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current dset"); + ret = iod_obj_open_write(coh, dset_id, rtid, NULL, &dset_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current dset"); step ++; /* get scratch pad of the dataset */ - if(iod_obj_get_scratch(dset_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + ret = iod_obj_get_scratch(dset_oh.rd_oh, rtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -431,25 +444,30 @@ H5VL_iod_server_dset_open_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad */ - if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + ret = iod_obj_open_read(coh, sp[0], rtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); step ++; - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, - cs_scope, NULL, &output.dcpl_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve dcpl"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, + cs_scope, NULL, &output.dcpl_id); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve dcpl"); - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, H5VL_IOD_KEY_OBJ_DATATYPE, - cs_scope, NULL, &output.type_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve datatype"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, H5VL_IOD_KEY_OBJ_DATATYPE, + cs_scope, NULL, &output.type_id); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve datatype"); - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, H5VL_IOD_KEY_OBJ_DATASPACE, - cs_scope, NULL, &output.space_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve dataspace"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, H5VL_IOD_KEY_OBJ_DATASPACE, + cs_scope, NULL, &output.space_id); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve dataspace"); /* close the metadata scratch pad */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); step --; output.iod_id = dset_id; @@ -533,13 +551,15 @@ H5VL_iod_server_dset_read_cb(AXE_engine_t axe_engine, hbool_t is_vl_data; size_t nelmts; /* number of elements selected to read */ na_addr_t dest = HG_Handler_get_addr(op_data->hg_handle); /* destination address to push data to */ + iod_ret_t ret; hbool_t opened_locally = FALSE; /* flag to indicate whether we opened the dset here or if it was already open */ herr_t ret_value = SUCCEED; /* open the dataset if we don't have the handle yet */ if(iod_oh.rd_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_read(coh, iod_id, rtid, NULL /*hints*/, &iod_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_read(coh, iod_id, rtid, NULL, &iod_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); opened_locally = TRUE; } @@ -569,11 +589,8 @@ H5VL_iod_server_dset_read_cb(AXE_engine_t axe_engine, elements are of variable length, just return that they are in is_vl_data for special processing */ if(H5VL__iod_server_adjust_buffer(dst_id, src_id, nelmts, dxpl_id, - size, &buf, &is_vl_data, &buf_size) < 0) { - fprintf(stderr, "failed to setup write operation"); - ret_value = FAIL; - goto done; - } + size, &buf, &is_vl_data, &buf_size) < 0) + HGOTO_ERROR_FF(FAIL, "failed to setup write operation"); if(!is_vl_data) { size_t elmt_size; @@ -592,12 +609,10 @@ H5VL_iod_server_dset_read_cb(AXE_engine_t axe_engine, /* If the data is not VL, we can read the data from the array the normal way */ elmt_size = H5Tget_size(src_id); - if(H5VL__iod_server_final_io(iod_oh.rd_oh, space_id, elmt_size, FALSE, - buf, buf_size, (uint64_t)0, raw_cs_scope, read_tid) < 0) { - fprintf(stderr, "can't read from array object\n"); - ret_value = FAIL; - goto done; - } + ret = H5VL__iod_server_final_io(iod_oh.rd_oh, space_id, elmt_size, FALSE, + buf, buf_size, (uint64_t)0, raw_cs_scope, read_tid); + if(ret != SUCCEED) + HGOTO_ERROR_FF(FAIL, "failed to read from array object"); { hbool_t flag = FALSE; @@ -626,9 +641,10 @@ H5VL_iod_server_dset_read_cb(AXE_engine_t axe_engine, } else { /* If the data is of variable length, special access is required */ - if(H5VL__iod_server_vl_data_read(coh, axe_engine, input->axe_id, nelmts, - buf, dxpl_id, rtid) < 0) - HGOTO_ERROR_FF(FAIL, "can't read from array object"); + ret = H5VL__iod_server_vl_data_read(coh, axe_engine, input->axe_id, nelmts, + buf, dxpl_id, rtid); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't read from array object"); } /* Create a new block handle to write the data */ @@ -715,12 +731,14 @@ H5VL_iod_server_dset_get_vl_size_cb(AXE_engine_t UNUSED axe_engine, uint8_t *buf_ptr = NULL; na_addr_t dest = HG_Handler_get_addr(op_data->hg_handle); /* destination address to push data to */ hbool_t opened_locally = FALSE; /* flag to indicate whether we opened the dset here or if it was already open */ + iod_ret_t ret; herr_t ret_value = SUCCEED; /* open the dataset if we don't have the handle yet */ if(iod_oh.rd_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_write(coh, iod_id, rtid, NULL /*hints*/, &iod_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_write(coh, iod_id, rtid, NULL, &iod_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); opened_locally = TRUE; } @@ -737,9 +755,10 @@ H5VL_iod_server_dset_get_vl_size_cb(AXE_engine_t UNUSED axe_engine, buf_size = nelmts * 8;//sizeof(size_t); /* read the array values containing the BLOB IDs and lengths */ - if(H5VL__iod_server_final_io(iod_oh.rd_oh, space_id, elmt_size, FALSE, - buf, buf_size, (uint64_t)0, cs_scope, rtid) < 0) - HGOTO_ERROR_FF(FAIL, "can't read from array object"); + ret = H5VL__iod_server_final_io(iod_oh.rd_oh, space_id, elmt_size, FALSE, + buf, buf_size, (uint64_t)0, cs_scope, rtid); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't read from array object"); /* MSC - create a bulk block handle. Mercury does not support segmented handles yet, so we need a temporrary buffer. */ @@ -878,12 +897,14 @@ H5VL_iod_server_dset_write_cb(AXE_engine_t UNUSED axe_engine, hbool_t flag = FALSE; /* temp flag to indicate whether corruption will be inserted */ na_addr_t source = HG_Handler_get_addr(op_data->hg_handle); /* source address to pull data from */ hbool_t opened_locally = FALSE; /* flag to indicate whether we opened the dset here or if it was already open */ + iod_ret_t ret; herr_t ret_value = SUCCEED; /* open the dataset if we don't have the handle yet */ if(iod_oh.wr_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_write(coh, iod_id, wtid, NULL /*hints*/, &iod_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open dataset for write"); + ret = iod_obj_open_write(coh, iod_id, wtid, NULL, &iod_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open dataset for write"); opened_locally = TRUE; } @@ -945,10 +966,11 @@ H5VL_iod_server_dset_write_cb(AXE_engine_t UNUSED axe_engine, assert(segments); #if 1 - if(H5VL__iod_server_vl_data_write(coh, iod_id, iod_oh, space_id, src_id, dst_id, type_info, - nelmts, num_segments, segments, dxpl_id, wtid, rtid, - source, bulk_handle, raw_cs_scope) < 0) - HGOTO_ERROR_FF(FAIL, "can't write VL data to array object"); + ret = H5VL__iod_server_vl_data_write(coh, iod_id, iod_oh, space_id, src_id, dst_id, type_info, + nelmts, num_segments, segments, dxpl_id, wtid, rtid, + source, bulk_handle, raw_cs_scope); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't write VL data to array object"); #else { @@ -1077,11 +1099,8 @@ H5VL_iod_server_dset_write_cb(AXE_engine_t UNUSED axe_engine, elements are of variable length, just return that they are in is_vl_data for special processing */ if(H5VL__iod_server_adjust_buffer(src_id, dst_id, nelmts, dxpl_id, - size, &buf, &is_vl_data, &buf_size) < 0) { - fprintf(stderr, "failed to setup write operation"); - ret_value = FAIL; - goto done; - } + size, &buf, &is_vl_data, &buf_size) < 0) + HGOTO_ERROR_FF(FAIL, "failed to setup write operation"); /* convert data if needed */ if(H5Tconvert(src_id, dst_id, nelmts, buf, NULL, dxpl_id) < 0) @@ -1099,9 +1118,10 @@ H5VL_iod_server_dset_write_cb(AXE_engine_t UNUSED axe_engine, #endif elmt_size = H5Tget_size(dst_id); - if(H5VL__iod_server_final_io(iod_oh.wr_oh, space_id, elmt_size, TRUE, - buf, buf_size, cs, raw_cs_scope, wtid) < 0) - HGOTO_ERROR_FF(FAIL, "can't write to array object"); + ret = H5VL__iod_server_final_io(iod_oh.wr_oh, space_id, elmt_size, TRUE, + buf, buf_size, cs, raw_cs_scope, wtid); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't write to array object"); } #if H5_EFF_DEBUG @@ -1164,6 +1184,7 @@ H5VL_iod_server_dset_set_extent_cb(AXE_engine_t UNUSED axe_engine, uint32_t cs_scope = input->cs_scope; iod_obj_id_t mdkv_id = input->mdkv_id; /* The ID of the metadata KV object */ /* int rank = input->dims.rank; rank of dataset */ + iod_ret_t ret; hbool_t opened_locally = FALSE; herr_t ret_value = SUCCEED; @@ -1174,14 +1195,16 @@ H5VL_iod_server_dset_set_extent_cb(AXE_engine_t UNUSED axe_engine, /* open the dataset if we don't have the handle yet */ if(iod_oh.wr_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_write(coh, iod_id, wtid, NULL /*hints*/, &iod_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_write(coh, iod_id, wtid, NULL, &iod_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); opened_locally = TRUE; } /* extend along the first dimension only */ - if(iod_array_extend(iod_oh.wr_oh, wtid, (iod_size_t)input->dims.size[0], NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't extend dataset"); + ret = iod_array_extend(iod_oh.wr_oh, wtid, (iod_size_t)input->dims.size[0], NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't extend dataset"); /* modify the dataspace of the dataset */ { @@ -1191,13 +1214,15 @@ H5VL_iod_server_dset_set_extent_cb(AXE_engine_t UNUSED axe_engine, iod_size_t array_dims[H5S_MAX_RANK], current_dims[H5S_MAX_RANK]; /* open the metadata scratch pad */ - if (iod_obj_open_write(coh, mdkv_id, wtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + ret = iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); /* get the stored dataset dataspace */ - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, H5VL_IOD_KEY_OBJ_DATASPACE, - cs_scope, NULL, &space_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve dataspace"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, H5VL_IOD_KEY_OBJ_DATASPACE, + cs_scope, NULL, &space_id); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve dataspace"); if((rank = H5Sget_simple_extent_dims(space_id, current_dims, array_dims)) < 0) HGOTO_ERROR_FF(FAIL, "can't get dimentions' sizes"); @@ -1207,13 +1232,15 @@ H5VL_iod_server_dset_set_extent_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR_FF(FAIL, "unable to modify size of data space"); /* insert dataspace metadata */ - if(H5VL_iod_insert_dataspace(mdkv_oh, wtid, space_id, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_dataspace(mdkv_oh, wtid, space_id, + cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* close the metadata scratch pad */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); } done: @@ -1228,10 +1255,10 @@ done: /* close the dataset if we opened it in this routine */ if(opened_locally) { - if(iod_obj_close(iod_oh.wr_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close Array object"); + ret = iod_obj_close(iod_oh.wr_oh, NULL, NULL); + if(ret < 0) + HDONE_ERROR_FF(ret, "can't close IOD object"); } - } /* end H5VL_iod_server_dset_set_extent_cb() */ @@ -1258,6 +1285,7 @@ H5VL_iod_server_dset_close_cb(AXE_engine_t UNUSED axe_engine, dset_close_in_t *input = (dset_close_in_t *)op_data->input; iod_handles_t iod_oh = input->iod_oh; //iod_obj_id_t iod_id = input->iod_id; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -1265,10 +1293,12 @@ H5VL_iod_server_dset_close_cb(AXE_engine_t UNUSED axe_engine, iod_oh.rd_oh.cookie, iod_oh.wr_oh.cookie); #endif - if(iod_obj_close(iod_oh.rd_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close Read Array object"); - if(iod_obj_close(iod_oh.wr_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close Write Array object"); + ret = iod_obj_close(iod_oh.rd_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close Read Array object"); + ret = iod_obj_close(iod_oh.wr_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close Write Array object"); done: #if H5_EFF_DEBUG @@ -1406,18 +1436,14 @@ H5VL__iod_server_final_io(iod_handle_t iod_oh, hid_t space_id, size_t elmt_size, if(write_op) { /* write to array */ ret = iod_array_write(iod_oh, tid, NULL, mem_desc, file_desc, cs_list, NULL); - if(ret != 0) { - fprintf(stderr, "ret: %d error: %s\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't write to array object"); - } + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't write to array object"); } else { /* Read from array */ ret = iod_array_read(iod_oh, tid, NULL, mem_desc, file_desc, cs_list, NULL); - if(ret != 0) { - fprintf(stderr, "ret: %d error: %s\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't read from array object"); - } + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't read from array object"); } /* If this is a read operation, compute checksum for each IOD @@ -1508,6 +1534,7 @@ H5VL__iod_server_vl_data_read(iod_handle_t coh, AXE_engine_t axe_engine, AXE_tas iod_ret_t *ret_list = NULL; iod_handle_t *blob_oh; size_t u, elmt_size; + iod_ret_t ret; herr_t ret_value = SUCCEED; /* retrieve the buffer that contains the blob IDs and their sizes @@ -1552,8 +1579,9 @@ H5VL__iod_server_vl_data_read(iod_handle_t coh, AXE_engine_t axe_engine, AXE_tas u, blob_id, blob_size); #endif - if(iod_obj_open_read(coh, blob_id, rtid, NULL, &blob_oh[u], NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open BLOB for Read"); + ret = iod_obj_open_read(coh, blob_id, rtid, NULL, &blob_oh[u], NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open BLOB for Read"); /* create memory descriptor for reading */ mem_desc = (iod_mem_desc_t *)malloc(sizeof(iod_mem_desc_t) + sizeof(iod_mem_frag_t)); @@ -1580,8 +1608,9 @@ H5VL__iod_server_vl_data_read(iod_handle_t coh, AXE_engine_t axe_engine, AXE_tas } /* Read list IO */ - if(iod_blob_read_list(coh, rtid, (int)nelmts, io_blob, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't read from blob objects"); + ret = iod_blob_read_list(coh, rtid, (int)nelmts, io_blob, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't read from blob objects"); for(u=0 ; u<nelmts; u++) { if(ret_list[u] < 0) @@ -1590,8 +1619,9 @@ H5VL__iod_server_vl_data_read(iod_handle_t coh, AXE_engine_t axe_engine, AXE_tas free(io_blob[u].mem_desc); free(io_blob[u].io_desc); - if(iod_obj_close(blob_oh[u], NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(blob_oh[u], NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); } done: @@ -1650,6 +1680,7 @@ H5VL__iod_server_vl_data_write(iod_handle_t coh, iod_obj_id_t iod_id, iod_handle hg_bulk_request_t bulk_request; size_t buf_size = 0, u; void *buf = NULL; + iod_ret_t ret; herr_t ret_value = SUCCEED; /* Print VL length DATA */ @@ -1779,13 +1810,11 @@ H5VL__iod_server_vl_data_write_cb(void UNUSED *elem, hid_t type_id, unsigned ndi created = TRUE; } ret = iod_obj_open_write(coh, blob_id, wtid, NULL, &blob_oh, NULL); - if(ret != 0) { - fprintf(stderr, "ret: %d error: %s %"PRIx64"\n", ret, strerror(-ret), blob_id); - HGOTO_ERROR_FF(FAIL, "Failed to open BLOB object"); - } + if(ret != 0) + HGOTO_ERROR_FF(ret, "Failed to open BLOB object"); } else - HGOTO_ERROR_FF(FAIL, "Failed to create BLOB object"); + HGOTO_ERROR_FF(ret, "Failed to create BLOB object"); } buf_size = udata->segments[udata->cur_seg].size; @@ -1806,8 +1835,9 @@ H5VL__iod_server_vl_data_write_cb(void UNUSED *elem, hid_t type_id, unsigned ndi blob_desc->frag[0].len = (iod_size_t)buf_size; /* write the VL data to the blob */ - if(iod_blob_write(blob_oh, wtid, NULL, mem_desc, blob_desc, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "unable to write BLOB object"); + ret = iod_blob_write(blob_oh, wtid, NULL, mem_desc, blob_desc, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "unable to write BLOB object"); free(mem_desc); mem_desc = NULL; @@ -1815,8 +1845,9 @@ H5VL__iod_server_vl_data_write_cb(void UNUSED *elem, hid_t type_id, unsigned ndi blob_desc = NULL; /* close BLOB */ - if(iod_obj_close(blob_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(blob_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); if(created) { /* update the array element with the blob_id and sequence length */ @@ -1844,9 +1875,10 @@ H5VL__iod_server_vl_data_write_cb(void UNUSED *elem, hid_t type_id, unsigned ndi #endif /* write the blob ID & size to the array element */ - if(iod_array_write(iod_oh.wr_oh, wtid, NULL, - mem_desc, &file_desc, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't read from array object"); + ret = iod_array_write(iod_oh.wr_oh, wtid, NULL, + mem_desc, &file_desc, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't read from array object"); free(mem_desc); mem_desc = NULL; diff --git a/src/H5VLiod_dtype.c b/src/H5VLiod_dtype.c index ce9315a..ea47d26 100644 --- a/src/H5VLiod_dtype.c +++ b/src/H5VLiod_dtype.c @@ -70,6 +70,7 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, int step = 0; iod_hint_list_t *obj_create_hint = NULL; hbool_t enable_checksum = FALSE; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -93,9 +94,10 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, /* the traversal will retrieve the location where the datatype needs to be created. The traversal will fail if an intermediate group does not exist. */ - if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, wtid, rtid, FALSE, - cs_scope, &last_comp, &cur_id, &cur_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't traverse path"); + ret = H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, wtid, rtid, FALSE, + cs_scope, &last_comp, &cur_id, &cur_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't traverse path"); #if H5_EFF_DEBUG fprintf(stderr, "Creating Datatype ID %"PRIx64" (CV %"PRIu64", TR %"PRIu64") ", @@ -108,26 +110,31 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, #endif /* create the datatype */ - if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_BLOB, - NULL, NULL, &dtype_id, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't create BLOB"); - - if (iod_obj_open_read(coh, dtype_id, wtid, NULL, &dtype_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open BLOB"); - if (iod_obj_open_write(coh, dtype_id, wtid, NULL, &dtype_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open BLOB"); + ret = iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_BLOB, + NULL, NULL, &dtype_id, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't create BLOB"); + + ret = iod_obj_open_read(coh, dtype_id, wtid, NULL, &dtype_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open BLOB"); + ret = iod_obj_open_write(coh, dtype_id, wtid, NULL, &dtype_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open BLOB"); step ++; /* create the metadata KV object for the datatype */ - if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, - NULL, NULL, &mdkv_id, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't create metadata KV object"); + ret = iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &mdkv_id, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't create metadata KV object"); /* create the attribute KV object for the datatype */ - if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, - NULL, NULL, &attr_id, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't create attribute KV object"); + ret = iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &attr_id, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't create attribute KV object"); /* set values for the scratch pad object */ sp[0] = mdkv_id; @@ -140,17 +147,20 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, iod_checksum_t sp_cs; sp_cs = H5_checksum_crc64(&sp, sizeof(sp)); - if (iod_obj_set_scratch(dtype_oh.wr_oh, wtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set scratch pad"); + ret = iod_obj_set_scratch(dtype_oh.wr_oh, wtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set scratch pad"); } else { - if (iod_obj_set_scratch(dtype_oh.wr_oh, wtid, &sp, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set scratch pad"); + ret = iod_obj_set_scratch(dtype_oh.wr_oh, wtid, &sp, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set scratch pad"); } /* Store Metadata in scratch pad */ - if (iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open metadata KV object"); + ret = iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open metadata KV object"); step ++; @@ -184,30 +194,35 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, dt_cs = H5_checksum_crc64(buf, buf_size); /* write the serialized type value to the BLOB object */ - if(iod_blob_write(dtype_oh.wr_oh, wtid, NULL, mem_desc, file_desc, - &dt_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "unable to write BLOB object"); + ret = iod_blob_write(dtype_oh.wr_oh, wtid, NULL, mem_desc, file_desc, + &dt_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "unable to write BLOB object"); } else { /* write the serialized type value to the BLOB object */ - if(iod_blob_write(dtype_oh.wr_oh, wtid, NULL, mem_desc, file_desc, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "unable to write BLOB object"); + ret = iod_blob_write(dtype_oh.wr_oh, wtid, NULL, mem_desc, file_desc, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "unable to write BLOB object"); } free(mem_desc); free(file_desc); /* insert plist metadata */ - if(H5VL_iod_insert_plist(mdkv_oh, wtid, tcpl_id, cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_plist(mdkv_oh, wtid, tcpl_id, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* insert link count metadata */ - if(H5VL_iod_insert_link_count(mdkv_oh, wtid, (uint64_t)1, cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_link_count(mdkv_oh, wtid, (uint64_t)1, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* insert object type metadata */ - if(H5VL_iod_insert_object_type(mdkv_oh, wtid, H5I_DATATYPE, cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_object_type(mdkv_oh, wtid, H5I_DATATYPE, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* store the datatype size */ { @@ -223,26 +238,30 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, cs[0] = H5_checksum_crc64(kv.key, kv.key_len); cs[1] = H5_checksum_crc64(kv.value, kv.value_len); - if (iod_kv_set(mdkv_oh, wtid, NULL, &kv, cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(mdkv_oh, wtid, NULL, &kv, cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } else { - if (iod_kv_set(mdkv_oh, wtid, NULL, &kv, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(mdkv_oh, wtid, NULL, &kv, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } } /* close the Metadata KV object */ - if(iod_obj_close(mdkv_oh, NULL, NULL)) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); step --; /* add link in parent group to current object */ - if(H5VL_iod_insert_new_link(cur_oh.wr_oh, wtid, last_comp, - H5L_TYPE_HARD, &dtype_id, cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_new_link(cur_oh.wr_oh, wtid, last_comp, + H5L_TYPE_HARD, &dtype_id, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); output.iod_oh.rd_oh.cookie = dtype_oh.rd_oh.cookie; output.iod_oh.wr_oh.cookie = dtype_oh.wr_oh.cookie; @@ -332,6 +351,7 @@ H5VL_iod_server_dtype_open_cb(AXE_engine_t UNUSED axe_engine, iod_size_t key_size=0, val_size=0; iod_checksum_t iod_cs[2]; int step = 0; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -340,18 +360,21 @@ H5VL_iod_server_dtype_open_cb(AXE_engine_t UNUSED axe_engine, #endif /* Traverse Path and open dtype */ - if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, name, rtid, - cs_scope, &dtype_id, &dtype_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't open object"); + ret = H5VL_iod_server_open_path(coh, loc_id, loc_handle, name, rtid, + cs_scope, &dtype_id, &dtype_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't open object"); /* open a write handle on the ID. */ - if (iod_obj_open_write(coh, dtype_id, rtid, NULL, &dtype_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current datatype"); + ret = iod_obj_open_write(coh, dtype_id, rtid, NULL, &dtype_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current datatype"); step ++; /* get scratch pad of the datatype */ - if(iod_obj_get_scratch(dtype_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + ret = iod_obj_get_scratch(dtype_oh.rd_oh, rtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -360,21 +383,24 @@ H5VL_iod_server_dtype_open_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad */ - if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + ret = iod_obj_open_read(coh, sp[0], rtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); step ++; - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, - cs_scope, NULL, &output.tcpl_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve tcpl"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, + cs_scope, NULL, &output.tcpl_id); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve tcpl"); val_size = sizeof(iod_size_t); key_size = strlen(H5VL_IOD_KEY_DTYPE_SIZE); /* retrieve blob size metadata from scratch pad */ - if(iod_kv_get_value(mdkv_oh, rtid, H5VL_IOD_KEY_DTYPE_SIZE, key_size, - &buf_size, &val_size, iod_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "datatype size lookup failed"); + ret = iod_kv_get_value(mdkv_oh, rtid, H5VL_IOD_KEY_DTYPE_SIZE, key_size, + &buf_size, &val_size, iod_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "datatype size lookup failed"); if(cs_scope & H5_CHECKSUM_IOD) { if(H5VL_iod_verify_kv_pair(H5VL_IOD_KEY_DTYPE_SIZE, key_size, @@ -386,8 +412,9 @@ H5VL_iod_server_dtype_open_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR_FF(FAIL, "can't allocate BLOB read buffer"); /* close the metadata scratch pad */ - if(iod_obj_close(mdkv_oh, NULL, NULL)) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); step --; /* create memory descriptor for writing */ @@ -404,8 +431,9 @@ H5VL_iod_server_dtype_open_cb(AXE_engine_t UNUSED axe_engine, file_desc->frag[0].len = (iod_size_t)buf_size; /* read the serialized type value from the BLOB object */ - if(iod_blob_read(dtype_oh.rd_oh, rtid, NULL, mem_desc, file_desc, &blob_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "unable to read from BLOB object"); + ret = iod_blob_read(dtype_oh.rd_oh, rtid, NULL, mem_desc, file_desc, &blob_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "unable to read from BLOB object"); if(blob_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* calculate a checksum for the datatype */ @@ -489,6 +517,7 @@ H5VL_iod_server_dtype_close_cb(AXE_engine_t UNUSED axe_engine, dtype_close_in_t *input = (dtype_close_in_t *)op_data->input; iod_handles_t iod_oh = input->iod_oh; //iod_obj_id_t iod_id = input->iod_id; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -500,10 +529,12 @@ H5VL_iod_server_dtype_close_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR_FF(FAIL, "can't close object with invalid handle"); } - if((iod_obj_close(iod_oh.rd_oh, NULL, NULL)) < 0) - HGOTO_ERROR_FF(FAIL, "can't close Read OH"); - if((iod_obj_close(iod_oh.wr_oh, NULL, NULL)) < 0) - HGOTO_ERROR_FF(FAIL, "can't close Write OH"); + ret = iod_obj_close(iod_oh.rd_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close Read OH"); + ret = iod_obj_close(iod_oh.wr_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close Write OH"); #if H5_EFF_DEBUG fprintf(stderr, "Done with dtype close, sending response to client\n"); diff --git a/src/H5VLiod_file.c b/src/H5VLiod_file.c index 09e2094..5724a6d 100644 --- a/src/H5VLiod_file.c +++ b/src/H5VLiod_file.c @@ -104,24 +104,24 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, /* Create the Container */ ret = iod_container_open(input->name, con_open_hint, mode, &coh, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't create container"); + HGOTO_ERROR_FF(ret, "can't create container"); /* MSC - skip transaction 0 since it can't be persisted */ ret = iod_trans_start(coh, &first_tid, NULL, num_peers, IOD_TRANS_W, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't start transaction 0"); + HGOTO_ERROR_FF(ret, "can't start transaction 0"); /* Finish the transaction */ ret = iod_trans_finish(coh, first_tid, NULL, 0, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't finish transaction 0"); + HGOTO_ERROR_FF(ret, "can't finish transaction 0"); first_tid = 1; /* Take transaction 1 to create root group */ ret = iod_trans_start(coh, &first_tid, NULL, num_peers, IOD_TRANS_W, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't start transaction 1"); + HGOTO_ERROR_FF(ret, "can't start transaction 1"); /* create the root group */ root_ret = iod_obj_create(coh, first_tid, obj_create_hint, IOD_OBJ_KV, @@ -130,13 +130,13 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, /* root group has been created, open it */ ret = iod_obj_open_write(coh, root_id, first_tid, NULL, &root_oh.wr_oh, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't open root group for write"); + HGOTO_ERROR_FF(ret, "can't open root group for write"); ret = iod_obj_open_read(coh, root_id, first_tid, NULL, &root_oh.rd_oh, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't open root group for read"); + HGOTO_ERROR_FF(ret, "can't open root group for read"); } else { - HGOTO_ERROR_FF(FAIL, "can't create root group"); + HGOTO_ERROR_FF(root_ret, "can't create root group"); } /* for the process that succeeded in creating the group, create @@ -150,19 +150,19 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, ret = iod_obj_create(coh, first_tid, obj_create_hint, IOD_OBJ_KV, NULL, NULL, &mdkv_id, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't create metadata KV object"); + HGOTO_ERROR_FF(ret, "can't create metadata KV object"); /* create the attribute KV object for the root group */ ret = iod_obj_create(coh, first_tid, obj_create_hint, IOD_OBJ_KV, NULL, NULL, &attrkv_id, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't create attribute KV object"); + HGOTO_ERROR_FF(ret, "can't create attribute KV object"); /* create the KV object to hold each client's indexes for object OIDs after each trans_finish and file_close */ ret = iod_obj_create(coh, first_tid, NULL, IOD_OBJ_KV, NULL, NULL, &oidkv_id, NULL); if(ret != 0) - HGOTO_ERROR_FF(FAIL, "can't create array for OID indexes"); + HGOTO_ERROR_FF(ret, "can't create array for OID indexes"); /* set values for the scratch pad object */ sp[0] = mdkv_id; @@ -178,22 +178,23 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, /* set scratch pad in root group */ ret = iod_obj_set_scratch(root_oh.wr_oh, first_tid, &sp, &sp_cs, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't set scratch pad"); + HGOTO_ERROR_FF(ret, "can't set scratch pad"); } else { ret = iod_obj_set_scratch(root_oh.wr_oh, first_tid, &sp, NULL, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't set scratch pad"); + HGOTO_ERROR_FF(ret, "can't set scratch pad"); } /* Store Metadata in scratch pad */ ret = iod_obj_open_write(coh, input->mdkv_id, first_tid, NULL, &mdkv_oh, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't open metadata KV"); + HGOTO_ERROR_FF(ret, "can't open metadata KV"); /* insert plist metadata */ - if(H5VL_iod_insert_plist(mdkv_oh, first_tid, fcpl_id, cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert link count KV value"); + ret = H5VL_iod_insert_plist(mdkv_oh, first_tid, fcpl_id, cs_scope, NULL, NULL); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "can't insert link count KV value"); kv.value = &value; kv.value_len = sizeof(uint64_t); @@ -207,12 +208,12 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, cs[1] = H5_checksum_crc64(kv.value, kv.value_len); ret = iod_kv_set(mdkv_oh, first_tid, NULL, &kv, cs, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } else { ret = iod_kv_set(mdkv_oh, first_tid, NULL, &kv, NULL, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } kv.key = (void *)H5VL_IOD_KEY_ARRAY_IDS_INDEX; @@ -224,12 +225,12 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, cs[1] = H5_checksum_crc64(kv.value, kv.value_len); ret = iod_kv_set(mdkv_oh, first_tid, NULL, &kv, cs, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } else { ret = iod_kv_set(mdkv_oh, first_tid, NULL, &kv, NULL, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } kv.key = (void *)H5VL_IOD_KEY_BLOB_IDS_INDEX; @@ -241,23 +242,23 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, cs[1] = H5_checksum_crc64(kv.value, kv.value_len); ret = iod_kv_set(mdkv_oh, first_tid, NULL, &kv, cs, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } else { ret = iod_kv_set(mdkv_oh, first_tid, NULL, &kv, NULL, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } ret = iod_obj_close(mdkv_oh, NULL, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't close root object handle"); + HGOTO_ERROR_FF(ret, "can't close root object handle"); } /* Finish the transaction */ ret = iod_trans_finish(coh, first_tid, NULL, 0, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "can't finish transaction 1"); + HGOTO_ERROR_FF(ret, "can't finish transaction 1"); output.coh.cookie = coh.cookie; output.root_oh.rd_oh = root_oh.rd_oh; @@ -356,35 +357,33 @@ H5VL_iod_server_file_open_cb(AXE_engine_t UNUSED axe_engine, } /* open the container */ - if(iod_container_open(input->name, con_open_hint, mode, &coh, NULL /*event*/)) - HGOTO_ERROR_FF(FAIL, "can't open file"); + ret = iod_container_open(input->name, con_open_hint, mode, &coh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open file"); - if(iod_query_cont_trans_stat(coh, &tids, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get container tids status"); + ret = iod_query_cont_trans_stat(coh, &tids, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get container tids status"); rtid = tids->latest_rdable; - if(iod_free_cont_trans_stat(coh, tids) < 0) - HGOTO_ERROR_FF(FAIL, "can't free container transaction status object"); + ret = iod_free_cont_trans_stat(coh, tids); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't free container transaction status object"); - if(iod_trans_start(coh, &rtid, NULL, num_peers, IOD_TRANS_R, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't start transaction"); + ret = iod_trans_start(coh, &rtid, NULL, num_peers, IOD_TRANS_R, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't start transaction"); /* open the root group */ - if ((ret = iod_obj_open_read(coh, ROOT_ID, rtid, NULL, &root_oh.rd_oh, NULL)) < 0) { - fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't open root object for read"); - } - if ((ret = iod_obj_open_write(coh, ROOT_ID, rtid, NULL, &root_oh.wr_oh, NULL)) < 0) { - fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't open root object for write"); - } + if ((ret = iod_obj_open_read(coh, ROOT_ID, rtid, NULL, &root_oh.rd_oh, NULL)) < 0) + HGOTO_ERROR_FF(ret, "can't open root object for read"); + if ((ret = iod_obj_open_write(coh, ROOT_ID, rtid, NULL, &root_oh.wr_oh, NULL)) < 0) + HGOTO_ERROR_FF(ret, "can't open root object for write"); /* get scratch pad of root group */ - if((ret = iod_obj_get_scratch(root_oh.rd_oh, rtid, &sp, &sp_cs, NULL)) < 0) { - fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for root object"); - } + if((ret = iod_obj_get_scratch(root_oh.rd_oh, rtid, &sp, &sp_cs, NULL)) < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for root object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -393,21 +392,24 @@ H5VL_iod_server_file_open_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata KV object */ - if (iod_obj_open_read(coh, sp[0], rtid, NULL, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open MD KV"); + ret = iod_obj_open_read(coh, sp[0], rtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open MD KV"); /* retrieve all metadata from scratch pad */ - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, - cs_scope, NULL, &output.fcpl_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve fcpl"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, + cs_scope, NULL, &output.fcpl_id); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "failed to retrieve fcpl"); /* open the OID indexes KV object */ - if (iod_obj_open_read(coh, sp[2], rtid, NULL, &oidkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open OID KV"); + ret = iod_obj_open_read(coh, sp[2], rtid, NULL, &oidkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open OID KV"); ret = iod_kv_get_num(oidkv_oh, rtid, &num_entries, NULL); if(ret != 0) - HGOTO_ERROR_FF(FAIL, "can't get number of KV entries"); + HGOTO_ERROR_FF(ret, "can't get number of KV entries"); val_size = sizeof(uint64_t); @@ -437,7 +439,7 @@ H5VL_iod_server_file_open_cb(AXE_engine_t UNUSED axe_engine, ret = iod_kv_get_list(oidkv_oh, rtid, NULL, 0, &num_entries, kvs, NULL); if(ret != 0) - HGOTO_ERROR_FF(FAIL, "can't get KV list from OID KV"); + HGOTO_ERROR_FF(ret, "can't get KV list from OID KV"); for(i=0 ; i<num_entries ; i++) { uint64_t *oid_index = (uint64_t *)kv[i].value; @@ -470,9 +472,10 @@ H5VL_iod_server_file_open_cb(AXE_engine_t UNUSED axe_engine, } key_size = strlen(H5VL_IOD_KEY_KV_IDS_INDEX); - if(iod_kv_get_value(mdkv_oh, rtid, H5VL_IOD_KEY_KV_IDS_INDEX, key_size, - &output.kv_oid_index, &val_size, iod_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "KV index lookup failed"); + ret = iod_kv_get_value(mdkv_oh, rtid, H5VL_IOD_KEY_KV_IDS_INDEX, key_size, + &output.kv_oid_index, &val_size, iod_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "KV index lookup failed"); if(cs_scope & H5_CHECKSUM_IOD) { if(H5VL_iod_verify_kv_pair(H5VL_IOD_KEY_KV_IDS_INDEX, key_size, &output.kv_oid_index, val_size, iod_cs) < 0) @@ -480,9 +483,10 @@ H5VL_iod_server_file_open_cb(AXE_engine_t UNUSED axe_engine, } key_size = strlen(H5VL_IOD_KEY_ARRAY_IDS_INDEX); - if(iod_kv_get_value(mdkv_oh, rtid, H5VL_IOD_KEY_ARRAY_IDS_INDEX, key_size, - &output.array_oid_index, &val_size, iod_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "Array index lookup failed"); + ret = iod_kv_get_value(mdkv_oh, rtid, H5VL_IOD_KEY_ARRAY_IDS_INDEX, key_size, + &output.array_oid_index, &val_size, iod_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "Array index lookup failed"); if(cs_scope & H5_CHECKSUM_IOD) { if(H5VL_iod_verify_kv_pair(H5VL_IOD_KEY_ARRAY_IDS_INDEX, key_size, &output.array_oid_index, val_size, iod_cs) < 0) @@ -490,9 +494,10 @@ H5VL_iod_server_file_open_cb(AXE_engine_t UNUSED axe_engine, } key_size = strlen(H5VL_IOD_KEY_BLOB_IDS_INDEX); - if(iod_kv_get_value(mdkv_oh, rtid, H5VL_IOD_KEY_BLOB_IDS_INDEX, key_size, - &output.blob_oid_index, &val_size, iod_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "BLOB index lookup failed"); + ret = iod_kv_get_value(mdkv_oh, rtid, H5VL_IOD_KEY_BLOB_IDS_INDEX, key_size, + &output.blob_oid_index, &val_size, iod_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "BLOB index lookup failed"); if(cs_scope & H5_CHECKSUM_IOD) { if(H5VL_iod_verify_kv_pair(H5VL_IOD_KEY_BLOB_IDS_INDEX, key_size, &output.blob_oid_index, val_size, iod_cs) < 0) @@ -506,11 +511,13 @@ H5VL_iod_server_file_open_cb(AXE_engine_t UNUSED axe_engine, } /* close the oid KV */ - if(iod_obj_close(oidkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close OID KV"); + ret = iod_obj_close(oidkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close OID KV"); /* close the metadata KV */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close MD KV"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close MD KV"); output.coh.cookie = coh.cookie; output.root_id = ROOT_ID; @@ -524,8 +531,9 @@ H5VL_iod_server_file_open_cb(AXE_engine_t UNUSED axe_engine, /* If the user did not ask to acquire the latest readable version, finish it here */ if(TRUE != acquire) { output.c_version = IOD_TID_UNKNOWN; - if(iod_trans_finish(coh, rtid, NULL, 0, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't finish transaction 0"); + ret = iod_trans_finish(coh, rtid, NULL, 0, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't finish transaction 0"); } #if H5_EFF_DEBUG @@ -601,35 +609,31 @@ H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t mdkv_oh; /* metadata object handle for KV to store file's metadata */ uint32_t cs_scope = input->cs_scope; - if(iod_query_cont_trans_stat(coh, &tids, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get container tids status"); + ret = iod_query_cont_trans_stat(coh, &tids, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get container tids status"); trans_num = tids->latest_wrting + 1; rtid = tids->latest_rdable; - if(iod_free_cont_trans_stat(coh, tids) < 0) - HGOTO_ERROR_FF(FAIL, "can't free container transaction status object"); + ret = iod_free_cont_trans_stat(coh, tids); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't free container transaction status object"); #if H5_EFF_DEBUG fprintf(stderr, "File Close starting transaction %"PRIu64" rcxt %"PRIu64"\n", trans_num, rtid); #endif - if((ret = iod_trans_start(coh, &rtid, NULL, 1, IOD_TRANS_R, NULL)) < 0) { - fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't start READ transaction"); - } + if((ret = iod_trans_start(coh, &rtid, NULL, 1, IOD_TRANS_R, NULL)) < 0) + HGOTO_ERROR_FF(ret, "can't start READ transaction"); - if((ret = iod_trans_start(coh, &trans_num, NULL, 1, IOD_TRANS_W, NULL)) < 0) { - fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't start WRITE transaction"); - } + if((ret = iod_trans_start(coh, &trans_num, NULL, 1, IOD_TRANS_W, NULL)) < 0) + HGOTO_ERROR_FF(ret, "can't start WRITE transaction"); /* get scratch pad of root group */ - if((ret = iod_obj_get_scratch(root_oh.rd_oh, rtid, &sp, &sp_cs, NULL)) < 0) { - fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for root object"); - } + if((ret = iod_obj_get_scratch(root_oh.rd_oh, rtid, &sp, &sp_cs, NULL)) < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for root object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -638,8 +642,9 @@ H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata KV object */ - if (iod_obj_open_write(coh, sp[0], trans_num, NULL, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open metadata KV"); + ret = iod_obj_open_write(coh, sp[0], trans_num, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open metadata KV"); /* insert current indexes in the metadata KV object */ kv.value = &input->max_kv_index; @@ -652,12 +657,14 @@ H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine, cs[0] = H5_checksum_crc64(kv.key, kv.key_len); cs[1] = H5_checksum_crc64(kv.value, kv.value_len); - if (iod_kv_set(mdkv_oh, trans_num, NULL, &kv, cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(mdkv_oh, trans_num, NULL, &kv, cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } else { - if (iod_kv_set(mdkv_oh, trans_num, NULL, &kv, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(mdkv_oh, trans_num, NULL, &kv, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } @@ -671,12 +678,14 @@ H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine, cs[0] = H5_checksum_crc64(kv.key, kv.key_len); cs[1] = H5_checksum_crc64(kv.value, kv.value_len); - if (iod_kv_set(mdkv_oh, trans_num, NULL, &kv, cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(mdkv_oh, trans_num, NULL, &kv, cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } else { - if (iod_kv_set(mdkv_oh, trans_num, NULL, &kv, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(mdkv_oh, trans_num, NULL, &kv, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } kv.value = &input->max_blob_index; @@ -689,16 +698,19 @@ H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine, cs[0] = H5_checksum_crc64(kv.key, kv.key_len); cs[1] = H5_checksum_crc64(kv.value, kv.value_len); - if (iod_kv_set(mdkv_oh, trans_num, NULL, &kv, cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(mdkv_oh, trans_num, NULL, &kv, cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } else { - if (iod_kv_set(mdkv_oh, trans_num, NULL, &kv, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(mdkv_oh, trans_num, NULL, &kv, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close root object handle"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close root object handle"); /* open the OID kv object and remove all entries since this is a clean shutdown and the summary is stored in the metadata @@ -711,14 +723,16 @@ H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine, iod_checksum_t *oid_cs = NULL; iod_ret_t *oid_ret = NULL; - if (iod_obj_open_write(coh, sp[2], trans_num, NULL, &oidkv_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open oid KV"); - if (iod_obj_open_read(coh, sp[2], rtid, NULL, &oidkv_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open oid KV"); + ret = iod_obj_open_write(coh, sp[2], trans_num, NULL, &oidkv_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open oid KV"); + ret = iod_obj_open_read(coh, sp[2], rtid, NULL, &oidkv_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open oid KV"); ret = iod_kv_get_num(oidkv_oh.rd_oh, rtid, &num_entries, NULL); if(ret != 0) - HGOTO_ERROR_FF(FAIL, "can't get number of KV entries"); + HGOTO_ERROR_FF(ret, "can't get number of KV entries"); #if H5_EFF_DEBUG fprintf(stderr, "NUM entries in OID index KV = %d\n", num_entries); @@ -740,11 +754,11 @@ H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine, ret = iod_kv_list_key(oidkv_oh.rd_oh, rtid, NULL, 0, &num_entries, kvs, NULL); if(ret != 0) - HGOTO_ERROR_FF(FAIL, "can't get list of keys"); + HGOTO_ERROR_FF(ret, "can't get list of keys"); ret = iod_kv_unlink_keys(oidkv_oh.wr_oh, trans_num, NULL, num_entries, kvs, NULL); if(ret != 0) - HGOTO_ERROR_FF(FAIL, "can't unlink keys in OID index KV"); + HGOTO_ERROR_FF(ret, "can't unlink keys in OID index KV"); for(i=0 ; i<num_entries ; i++) free(oid_kv[i].key); @@ -754,29 +768,31 @@ H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine, free(kvs); } - if(iod_obj_close(oidkv_oh.rd_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object handle"); - if(iod_obj_close(oidkv_oh.wr_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object handle"); + ret = iod_obj_close(oidkv_oh.rd_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object handle"); + ret = iod_obj_close(oidkv_oh.wr_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object handle"); } /* finish the transaction */ - if(iod_trans_finish(coh, rtid, NULL, 0, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't finish transaction"); + ret = iod_trans_finish(coh, rtid, NULL, 0, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't finish transaction"); /* finish the transaction */ - if(iod_trans_finish(coh, trans_num, NULL, 0, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't finish transaction"); + ret = iod_trans_finish(coh, trans_num, NULL, 0, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't finish transaction"); if(TRUE == input->persist_on_close) { #if H5_EFF_DEBUG fprintf(stderr, "Persisting Last TID (%"PRIu64") before closing\n", trans_num); #endif /* persist the last transaction */ - if((ret = iod_trans_persist(coh, trans_num, NULL, NULL)) < 0) { - fprintf(stderr, "iod_trans_persist failed. %d (%s).\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't persist before closing container"); - } + if((ret = iod_trans_persist(coh, trans_num, NULL, NULL)) < 0) + HGOTO_ERROR_FF(ret, "can't persist before closing container"); } } @@ -786,20 +802,20 @@ H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine, #endif /* close the root group */ - if(iod_obj_close(root_oh.rd_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close root object handle"); - if(iod_obj_close(root_oh.wr_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close root object handle"); + ret = iod_obj_close(root_oh.rd_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close root object handle"); + ret = iod_obj_close(root_oh.wr_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close root object handle"); #if H5_EFF_DEBUG fprintf(stderr, "Closing Container: %"PRIu64"\n", coh.cookie); #endif /* close the container */ - if((ret = iod_container_close(coh, NULL, NULL)) < 0) { - fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't close container"); - } + if((ret = iod_container_close(coh, NULL, NULL)) < 0) + HGOTO_ERROR_FF(ret, "can't close container"); done: #if H5_EFF_DEBUG diff --git a/src/H5VLiod_group.c b/src/H5VLiod_group.c index 0a85c0a..875b585 100644 --- a/src/H5VLiod_group.c +++ b/src/H5VLiod_group.c @@ -90,9 +90,10 @@ H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine, /* the traversal will retrieve the location where the group needs to be created. The traversal will fail if an intermediate group does not exist. */ - if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, wtid, rtid, FALSE, cs_scope, - &last_comp, &cur_id, &cur_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't traverse path"); + ret = H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, wtid, rtid, FALSE, cs_scope, + &last_comp, &cur_id, &cur_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't traverse path"); #if H5_EFF_DEBUG fprintf(stderr, "Creating Group ID %"PRIx64" (CV %"PRIu64", TR %"PRIu64") ", @@ -105,30 +106,31 @@ H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine, #endif /* create the group */ - if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, - NULL, NULL, &grp_id, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't create Group"); - - if((ret = iod_obj_open_read(coh, grp_id, wtid, NULL, &grp_oh.rd_oh, NULL)) < 0) { - fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't open Group for read"); - } - if((ret = iod_obj_open_write(coh, grp_id, wtid, NULL, &grp_oh.wr_oh, NULL)) < 0) { - fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't open Group for write"); - } + ret = iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &grp_id, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't create Group"); + + ret = iod_obj_open_read(coh, grp_id, wtid, NULL, &grp_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open Group for read"); + ret = iod_obj_open_write(coh, grp_id, wtid, NULL, &grp_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open Group for write"); step += 1; /* create the metadata KV object for the group */ - if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, - NULL, NULL, &mdkv_id, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't create metadata KV object"); + ret = iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &mdkv_id, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't create metadata KV object"); /* create the attribute KV object for the group */ - if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, - NULL, NULL, &attrkv_id, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't create metadata KV object"); + ret = iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &attrkv_id, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't create metadata KV object"); /* set values for the scratch pad object */ sp[0] = mdkv_id; @@ -141,46 +143,51 @@ H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine, iod_checksum_t sp_cs; sp_cs = H5_checksum_crc64(&sp, sizeof(sp)); - if (iod_obj_set_scratch(grp_oh.wr_oh, wtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set scratch pad"); + ret = iod_obj_set_scratch(grp_oh.wr_oh, wtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set scratch pad"); } else { - if (iod_obj_set_scratch(grp_oh.wr_oh, wtid, &sp, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set scratch pad"); + ret = iod_obj_set_scratch(grp_oh.wr_oh, wtid, &sp, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set scratch pad"); } /* store metadata */ /* Open Metadata KV object for write */ - if (iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't create scratch pad"); + ret = iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't create scratch pad"); step ++; /* insert plist metadata */ - if(H5VL_iod_insert_plist(mdkv_oh, wtid, gcpl_id, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_plist(mdkv_oh, wtid, gcpl_id, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* insert link count metadata */ - if(H5VL_iod_insert_link_count(mdkv_oh, wtid, (uint64_t)1, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_link_count(mdkv_oh, wtid, (uint64_t)1,cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* insert object type metadata */ - if(H5VL_iod_insert_object_type(mdkv_oh, wtid, H5I_GROUP, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_object_type(mdkv_oh, wtid, H5I_GROUP, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* close Metadata KV object */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); step --; /* add link in parent group to current object */ - if(H5VL_iod_insert_new_link(cur_oh.wr_oh, wtid, last_comp, H5L_TYPE_HARD, - &grp_id, cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_new_link(cur_oh.wr_oh, wtid, last_comp, H5L_TYPE_HARD, + &grp_id, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); #if H5_EFF_DEBUG fprintf(stderr, "Done with group create, sending response to client\n"); @@ -269,6 +276,7 @@ H5VL_iod_server_group_open_cb(AXE_engine_t UNUSED axe_engine, scratch_pad sp; iod_checksum_t sp_cs = 0; int step = 0; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -280,24 +288,28 @@ H5VL_iod_server_group_open_cb(AXE_engine_t UNUSED axe_engine, if(0 == strcmp(name, "/")) { grp_id = ROOT_ID; /* open a write handle on the ID. */ - if(iod_obj_open_read(coh, grp_id, rtid, NULL, &grp_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_read(coh, grp_id, rtid, NULL, &grp_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); } else { /* Traverse Path and open group */ - if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, name, rtid, - cs_scope, &grp_id, &grp_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't open object"); + ret = H5VL_iod_server_open_path(coh, loc_id, loc_handle, name, rtid, + cs_scope, &grp_id, &grp_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't open object"); } /* open a write handle on the ID. */ - if(iod_obj_open_write(coh, grp_id, rtid, NULL, &grp_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_write(coh, grp_id, rtid, NULL, &grp_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); step ++; /* get scratch pad of group */ - if(iod_obj_get_scratch(grp_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + ret = iod_obj_get_scratch(grp_oh.rd_oh, rtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -306,17 +318,20 @@ H5VL_iod_server_group_open_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad */ - if (iod_obj_open_read(coh, sp[0], rtid, NULL, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + ret = iod_obj_open_read(coh, sp[0], rtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); step ++; - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, - cs_scope, NULL, &output.gcpl_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve gcpl"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, + cs_scope, NULL, &output.gcpl_id); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve gcpl"); /* close the metadata scratch pad */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close meta data KV handle"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close meta data KV handle"); step --; output.iod_id = grp_id; @@ -378,6 +393,7 @@ H5VL_iod_server_group_close_cb(AXE_engine_t UNUSED axe_engine, op_data_t *op_data = (op_data_t *)_op_data; group_close_in_t *input = (group_close_in_t *)op_data->input; iod_handles_t iod_oh = input->iod_oh; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -389,10 +405,12 @@ H5VL_iod_server_group_close_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR_FF(FAIL, "can't close object with invalid handle"); } - if((iod_obj_close(iod_oh.rd_oh, NULL, NULL)) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); - if((iod_obj_close(iod_oh.wr_oh, NULL, NULL)) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(iod_oh.rd_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); + ret = iod_obj_close(iod_oh.wr_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); done: #if H5_EFF_DEBUG diff --git a/src/H5VLiod_index.c b/src/H5VLiod_index.c index f9ae1af..63c8f6a 100644 --- a/src/H5VLiod_index.c +++ b/src/H5VLiod_index.c @@ -53,6 +53,7 @@ H5VL_iod_server_dset_set_index_info_cb(AXE_engine_t UNUSED axe_engine, uint32_t cs_scope = input->cs_scope; iod_handle_t mdkv_oh; iod_kv_t kv; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -60,8 +61,9 @@ H5VL_iod_server_dset_set_index_info_cb(AXE_engine_t UNUSED axe_engine, #endif /* Open Metadata KV object for write */ - if (iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open MDKV object"); + ret = iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open MDKV object"); kv.key = H5VL_IOD_IDX_PLUGIN_ID; kv.key_len = (iod_size_t)strlen(H5VL_IOD_IDX_PLUGIN_ID); @@ -73,12 +75,14 @@ H5VL_iod_server_dset_set_index_info_cb(AXE_engine_t UNUSED axe_engine, cs[0] = H5_checksum_crc64(kv.key, kv.key_len); cs[1] = H5_checksum_crc64(kv.value, kv.value_len); - if (iod_kv_set(mdkv_oh, wtid, NULL, &kv, cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(mdkv_oh, wtid, NULL, &kv, cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } else { - if (iod_kv_set(mdkv_oh, wtid, NULL, &kv, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(mdkv_oh, wtid, NULL, &kv, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } kv.key = H5VL_IOD_IDX_PLUGIN_MD; @@ -91,12 +95,14 @@ H5VL_iod_server_dset_set_index_info_cb(AXE_engine_t UNUSED axe_engine, cs[0] = H5_checksum_crc64(kv.key, kv.key_len); cs[1] = H5_checksum_crc64(kv.value, kv.value_len); - if (iod_kv_set(mdkv_oh, wtid, NULL, &kv, cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(mdkv_oh, wtid, NULL, &kv, cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } else { - if (iod_kv_set(mdkv_oh, wtid, NULL, &kv, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(mdkv_oh, wtid, NULL, &kv, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } #if H5_EFF_DEBUG @@ -108,8 +114,9 @@ done: HDONE_ERROR_FF(FAIL, "can't send result of write to client"); /* close the Metadata KV object */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HDONE_ERROR_FF(ret, "can't close object"); input = (dset_set_index_info_in_t *)H5MM_xfree(input); op_data = (op_data_t *)H5MM_xfree(op_data); @@ -156,8 +163,9 @@ H5VL_iod_server_dset_get_index_info_cb(AXE_engine_t UNUSED axe_engine, #endif /* Open Metadata KV object for write */ - if (iod_obj_open_read(coh, mdkv_id, rtid, NULL, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open MDKV object"); + ret = iod_obj_open_read(coh, mdkv_id, rtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open MDKV object"); if(cs_scope & H5_CHECKSUM_IOD) { iod_cs = (iod_checksum_t *)malloc(sizeof(iod_checksum_t) * 2); @@ -180,8 +188,7 @@ H5VL_iod_server_dset_get_index_info_cb(AXE_engine_t UNUSED axe_engine, HG_Handler_start_output(op_data->hg_handle, &output); HGOTO_DONE(SUCCEED); } - fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "lookup failed"); + HGOTO_ERROR_FF(ret, "lookup failed"); } if(cs_scope & H5_CHECKSUM_IOD) { iod_checksum_t cs[2]; @@ -198,16 +205,18 @@ H5VL_iod_server_dset_get_index_info_cb(AXE_engine_t UNUSED axe_engine, key_size = strlen(key); val_size = 0; - if(iod_kv_get_value(mdkv_oh, rtid, key, key_size, NULL, - &val_size, iod_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "lookup failed"); + ret = iod_kv_get_value(mdkv_oh, rtid, key, key_size, NULL, + &val_size, iod_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "lookup failed"); output.idx_metadata.buf_size = val_size; output.idx_metadata.buf = malloc(val_size); - if(iod_kv_get_value(mdkv_oh, rtid, key, key_size, (char *)output.idx_metadata.buf, - &val_size, iod_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "lookup failed"); + ret = iod_kv_get_value(mdkv_oh, rtid, key, key_size, (char *)output.idx_metadata.buf, + &val_size, iod_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "lookup failed"); if(cs_scope & H5_CHECKSUM_IOD) { iod_checksum_t cs[2]; @@ -246,8 +255,9 @@ done: } /* close the Metadata KV object */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HDONE_ERROR_FF(ret, "can't close object"); input = (dset_get_index_info_in_t *)H5MM_xfree(input); op_data = (op_data_t *)H5MM_xfree(op_data); @@ -291,24 +301,27 @@ H5VL_iod_server_dset_remove_index_info_cb(AXE_engine_t UNUSED axe_engine, #endif /* Open Metadata KV object for write */ - if (iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open MDKV object"); + ret = iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open MDKV object"); kv.key = H5VL_IOD_IDX_PLUGIN_ID; kv.key_len = (iod_size_t)strlen(H5VL_IOD_IDX_PLUGIN_ID); kvs.kv = &kv; kvs.cs = NULL; kvs.ret = &ret; - if(iod_kv_unlink_keys(mdkv_oh, wtid, NULL, 1, &kvs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "Unable to unlink KV pair"); + ret = iod_kv_unlink_keys(mdkv_oh, wtid, NULL, 1, &kvs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "Unable to unlink KV pair"); kv.key = H5VL_IOD_IDX_PLUGIN_MD; kv.key_len = (iod_size_t)strlen(H5VL_IOD_IDX_PLUGIN_MD); kvs.kv = &kv; kvs.cs = NULL; kvs.ret = &ret; - if(iod_kv_unlink_keys(mdkv_oh, wtid, NULL, 1, &kvs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "Unable to unlink KV pair"); + ret = iod_kv_unlink_keys(mdkv_oh, wtid, NULL, 1, &kvs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "Unable to unlink KV pair"); #if H5_EFF_DEBUG fprintf(stderr, "Done with dataset rm_index_info, sending response to client\n"); @@ -319,8 +332,9 @@ done: HDONE_ERROR_FF(FAIL, "can't send result of write to client"); /* close the Metadata KV object */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HDONE_ERROR_FF(ret, "can't close object"); input = (dset_rm_index_info_in_t *)H5MM_xfree(input); op_data = (op_data_t *)H5MM_xfree(op_data); diff --git a/src/H5VLiod_link.c b/src/H5VLiod_link.c index 4495ae7..4b519c1 100644 --- a/src/H5VLiod_link.c +++ b/src/H5VLiod_link.c @@ -56,6 +56,7 @@ H5VL_iod_server_link_create_cb(AXE_engine_t UNUSED axe_engine, iod_handles_t target_oh; iod_obj_id_t target_id; /* The ID of the target object where link is created*/ char *src_last_comp = NULL, *dst_last_comp = NULL; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -65,9 +66,10 @@ H5VL_iod_server_link_create_cb(AXE_engine_t UNUSED axe_engine, /* the traversal will retrieve the location where the link needs to be created from. The traversal will fail if an intermediate group does not exist. */ - if(H5VL_iod_server_traverse(coh, input->loc_id, input->loc_oh, input->loc_name, - wtid, rtid, FALSE, cs_scope, &src_last_comp, &src_id, &src_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't traverse path"); + ret = H5VL_iod_server_traverse(coh, input->loc_id, input->loc_oh, input->loc_name, + wtid, rtid, FALSE, cs_scope, &src_last_comp, &src_id, &src_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't traverse path"); #if H5_EFF_DEBUG fprintf(stderr, "new link name = %s\n", src_last_comp); @@ -82,25 +84,29 @@ H5VL_iod_server_link_create_cb(AXE_engine_t UNUSED axe_engine, if(input->target_loc_oh.rd_oh.cookie == IOD_OH_UNDEFINED) { /* Try and open the starting location */ - if (iod_obj_open_read(coh, input->target_loc_id, wtid, NULL, - &input->target_loc_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open start location"); + ret = iod_obj_open_read(coh, input->target_loc_id, wtid, NULL, + &input->target_loc_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open start location"); opened_locally = TRUE; } /* Traverse Path and open the target object */ - if(H5VL_iod_server_open_path(coh, input->target_loc_id, input->target_loc_oh, - input->target_name, rtid, cs_scope, &target_id, &target_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't open object"); + ret = H5VL_iod_server_open_path(coh, input->target_loc_id, input->target_loc_oh, + input->target_name, rtid, cs_scope, &target_id, &target_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't open object"); /* add link in parent group to current object */ - if(H5VL_iod_insert_new_link(src_oh.wr_oh, wtid, src_last_comp, - H5L_TYPE_HARD, &target_id, cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_new_link(src_oh.wr_oh, wtid, src_last_comp, + H5L_TYPE_HARD, &target_id, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); if(input->target_loc_id != target_id) { /* get scratch pad */ - if(iod_obj_get_scratch(target_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + ret = iod_obj_get_scratch(target_oh.rd_oh, rtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -109,50 +115,60 @@ H5VL_iod_server_link_create_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata KV */ - if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); - if (iod_obj_open_write(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + ret = iod_obj_open_read(coh, sp[0], rtid, NULL, &mdkv_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); + ret = iod_obj_open_write(coh, sp[0], rtid, NULL, &mdkv_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); } else { /* open the metadata KV */ - if (iod_obj_open_read(coh, input->target_mdkv_id, rtid, NULL, &mdkv_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); - if (iod_obj_open_write(coh, input->target_mdkv_id, rtid, NULL, &mdkv_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + ret = iod_obj_open_read(coh, input->target_mdkv_id, rtid, NULL, &mdkv_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); + ret = iod_obj_open_write(coh, input->target_mdkv_id, rtid, NULL, &mdkv_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); } - if(H5VL_iod_get_metadata(mdkv_oh.rd_oh, rtid, H5VL_IOD_LINK_COUNT, - H5VL_IOD_KEY_OBJ_LINK_COUNT, - cs_scope, NULL, &link_count) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve link count"); + ret = H5VL_iod_get_metadata(mdkv_oh.rd_oh, rtid, H5VL_IOD_LINK_COUNT, + H5VL_IOD_KEY_OBJ_LINK_COUNT, + cs_scope, NULL, &link_count); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve link count"); link_count ++; /* insert link count metadata */ - if(H5VL_iod_insert_link_count(mdkv_oh.wr_oh, wtid, link_count, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_link_count(mdkv_oh.wr_oh, wtid, link_count, + cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* close the metadata scratch pad */ - if(iod_obj_close(mdkv_oh.rd_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); - if(iod_obj_close(mdkv_oh.wr_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh.rd_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); + ret = iod_obj_close(mdkv_oh.wr_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); /* close the target location */ if(TRUE == opened_locally || input->target_loc_oh.rd_oh.cookie != target_oh.rd_oh.cookie) { - if(iod_obj_close(target_oh.rd_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(target_oh.rd_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); } } else if(H5VL_LINK_CREATE_SOFT == create_type) { /* add link in parent group to the source location */ - if(H5VL_iod_insert_new_link(src_oh.wr_oh, wtid, src_last_comp, - H5L_TYPE_SOFT, input->link_value, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_new_link(src_oh.wr_oh, wtid, src_last_comp, + H5L_TYPE_SOFT, input->link_value, + cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); #if H5_EFF_DEBUG fprintf(stderr, "Soft link Value = %s\n", input->link_value); @@ -163,12 +179,14 @@ H5VL_iod_server_link_create_cb(AXE_engine_t UNUSED axe_engine, /* close the source location */ if(input->loc_oh.rd_oh.cookie != src_oh.rd_oh.cookie) { - if(iod_obj_close(src_oh.rd_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(src_oh.rd_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); } if(input->loc_oh.wr_oh.cookie != src_oh.wr_oh.cookie) { - if(iod_obj_close(src_oh.wr_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(src_oh.wr_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); } done: @@ -219,6 +237,7 @@ H5VL_iod_server_link_move_cb(AXE_engine_t UNUSED axe_engine, iod_obj_id_t dst_id; /* The ID of the dst object where link is created*/ char *src_last_comp = NULL, *dst_last_comp = NULL; iod_kv_t kv; + iod_ret_t ret; H5VL_iod_link_t iod_link; herr_t ret_value = SUCCEED; @@ -232,36 +251,41 @@ H5VL_iod_server_link_move_cb(AXE_engine_t UNUSED axe_engine, /* the traversal will retrieve the location where the link needs to be moved/copied from. The traversal will fail if an intermediate group does not exist. */ - if(H5VL_iod_server_traverse(coh, input->src_loc_id, input->src_loc_oh, - input->src_loc_name, wtid, rtid, FALSE, cs_scope, - &src_last_comp, &src_id, &src_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't traverse path"); + ret = H5VL_iod_server_traverse(coh, input->src_loc_id, input->src_loc_oh, + input->src_loc_name, wtid, rtid, FALSE, cs_scope, + &src_last_comp, &src_id, &src_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't traverse path"); /* the traversal will retrieve the location where the link needs to be moved/copied to. The traversal will fail if an intermediate group does not exist. */ - if(H5VL_iod_server_traverse(coh, input->dst_loc_id, input->dst_loc_oh, - input->dst_loc_name, wtid, rtid, FALSE, cs_scope, - &dst_last_comp, &dst_id, &dst_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't traverse path"); + ret = H5VL_iod_server_traverse(coh, input->dst_loc_id, input->dst_loc_oh, + input->dst_loc_name, wtid, rtid, FALSE, cs_scope, + &dst_last_comp, &dst_id, &dst_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't traverse path"); /* get the link value */ - if(H5VL_iod_get_metadata(src_oh.rd_oh, rtid, H5VL_IOD_LINK, - src_last_comp, cs_scope, NULL, &iod_link) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve link value"); + ret = H5VL_iod_get_metadata(src_oh.rd_oh, rtid, H5VL_IOD_LINK, + src_last_comp, cs_scope, NULL, &iod_link); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve link value"); /* Insert object in the destination path */ if(H5L_TYPE_HARD == iod_link.link_type) { - if(H5VL_iod_insert_new_link(dst_oh.wr_oh, wtid, dst_last_comp, - iod_link.link_type, &iod_link.u.iod_id, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_new_link(dst_oh.wr_oh, wtid, dst_last_comp, + iod_link.link_type, &iod_link.u.iod_id, + cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); } else if(H5L_TYPE_SOFT == iod_link.link_type) { - if(H5VL_iod_insert_new_link(dst_oh.wr_oh, wtid, dst_last_comp, - iod_link.link_type, &iod_link.u.symbolic_name, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_new_link(dst_oh.wr_oh, wtid, dst_last_comp, + iod_link.link_type, &iod_link.u.symbolic_name, + cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); } /* if the operation type is a Move, remove the KV pair from the source object */ @@ -277,8 +301,9 @@ H5VL_iod_server_link_move_cb(AXE_engine_t UNUSED axe_engine, kvs.ret = &ret; /* remove link from source object */ - if(iod_kv_unlink_keys(src_oh.wr_oh, wtid, NULL, 1, &kvs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "Unable to unlink KV pair"); + ret = iod_kv_unlink_keys(src_oh.wr_oh, wtid, NULL, 1, &kvs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "Unable to unlink KV pair"); } /* adjust link count on target object */ @@ -290,12 +315,14 @@ H5VL_iod_server_link_move_cb(AXE_engine_t UNUSED axe_engine, uint64_t link_count = 0; /* open the current group */ - if (iod_obj_open_read(coh, iod_link.u.iod_id, rtid, NULL, &target_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_read(coh, iod_link.u.iod_id, rtid, NULL, &target_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); /* get scratch pad */ - if(iod_obj_get_scratch(target_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + ret = iod_obj_get_scratch(target_oh, rtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) @@ -303,50 +330,65 @@ H5VL_iod_server_link_move_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad */ - if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); - if (iod_obj_open_write(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); - - if(H5VL_iod_get_metadata(mdkv_oh.rd_oh, rtid, H5VL_IOD_LINK_COUNT, - H5VL_IOD_KEY_OBJ_LINK_COUNT, - cs_scope, NULL, &link_count) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve link count"); + ret = iod_obj_open_read(coh, sp[0], rtid, NULL, &mdkv_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); + ret = iod_obj_open_write(coh, sp[0], rtid, NULL, &mdkv_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); + + ret = H5VL_iod_get_metadata(mdkv_oh.rd_oh, rtid, H5VL_IOD_LINK_COUNT, + H5VL_IOD_KEY_OBJ_LINK_COUNT, + cs_scope, NULL, &link_count); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve link count"); link_count ++; /* insert link count metadata */ - if(H5VL_iod_insert_link_count(mdkv_oh.wr_oh, wtid, link_count, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_link_count(mdkv_oh.wr_oh, wtid, link_count, + cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* close the metadata scratch pad */ - if(iod_obj_close(mdkv_oh.rd_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); - if(iod_obj_close(mdkv_oh.wr_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh.rd_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); + ret = iod_obj_close(mdkv_oh.wr_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); /* close the target location */ - if(iod_obj_close(target_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(target_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); } /* close source group if it is not the location we started the traversal into */ if(input->src_loc_oh.rd_oh.cookie != src_oh.rd_oh.cookie) { - iod_obj_close(src_oh.rd_oh, NULL, NULL); + ret = iod_obj_close(src_oh.rd_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); } if(input->src_loc_oh.wr_oh.cookie != src_oh.wr_oh.cookie) { - iod_obj_close(src_oh.wr_oh, NULL, NULL); + ret = iod_obj_close(src_oh.wr_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); } /* close parent group if it is not the location we started the traversal into */ if(input->dst_loc_oh.rd_oh.cookie != dst_oh.rd_oh.cookie) { - iod_obj_close(dst_oh.rd_oh, NULL, NULL); + ret = iod_obj_close(dst_oh.rd_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); } if(input->dst_loc_oh.wr_oh.cookie != dst_oh.wr_oh.cookie) { - iod_obj_close(dst_oh.wr_oh, NULL, NULL); + ret = iod_obj_close(dst_oh.wr_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); } done: @@ -401,6 +443,7 @@ H5VL_iod_server_link_exists_cb(AXE_engine_t UNUSED axe_engine, uint32_t cs_scope = input->cs_scope; char *last_comp = NULL; htri_t ret = -1; + iod_ret_t iod_ret; iod_size_t val_size = 0; herr_t ret_value = SUCCEED; @@ -435,8 +478,9 @@ H5VL_iod_server_link_exists_cb(AXE_engine_t UNUSED axe_engine, ret = FALSE; } else { - if(iod_obj_close(rd_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close current object handle"); + iod_ret = iod_obj_close(rd_oh, NULL, NULL); + if(iod_ret < 0) + HGOTO_ERROR_FF(iod_ret, "can't close current object handle"); ret = TRUE; } } @@ -498,22 +542,25 @@ H5VL_iod_server_link_get_info_cb(AXE_engine_t UNUSED axe_engine, uint32_t cs_scope = input->cs_scope; char *last_comp = NULL; H5VL_iod_link_t iod_link; + iod_ret_t ret; herr_t ret_value = SUCCEED; /* the traversal will retrieve the location where the link needs to be checked */ - if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name, rtid, rtid, FALSE, - cs_scope, &last_comp, &cur_id, &cur_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't traverse path"); + ret = H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name, rtid, rtid, FALSE, + cs_scope, &last_comp, &cur_id, &cur_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't traverse path"); #if H5_EFF_DEBUG fprintf(stderr, "Link Get_Info on link %s\n", last_comp); #endif /* lookup link information in the current location */ - if(H5VL_iod_get_metadata(cur_oh.rd_oh, rtid, H5VL_IOD_LINK, - last_comp, cs_scope, NULL, &iod_link) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve link value"); + ret = H5VL_iod_get_metadata(cur_oh.rd_oh, rtid, H5VL_IOD_LINK, + last_comp, cs_scope, NULL, &iod_link); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve link value"); /* setup link info */ linfo.type = iod_link.link_type; @@ -600,22 +647,25 @@ H5VL_iod_server_link_get_val_cb(AXE_engine_t UNUSED axe_engine, const char *loc_name = input->path; char *last_comp = NULL; H5VL_iod_link_t iod_link; + iod_ret_t ret; herr_t ret_value = SUCCEED; /* the traversal will retrieve the location where the link needs to be checked */ - if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name, rtid, rtid, FALSE, - cs_scope, &last_comp, &cur_id, &cur_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't traverse path"); + ret = H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name, rtid, rtid, FALSE, + cs_scope, &last_comp, &cur_id, &cur_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't traverse path"); #if H5_EFF_DEBUG fprintf(stderr, "Link Get_val on link %s\n", last_comp); #endif /* lookup link information in the current location */ - if(H5VL_iod_get_metadata(cur_oh.rd_oh, rtid, H5VL_IOD_LINK, - last_comp, cs_scope, NULL, &iod_link) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve link value"); + ret = H5VL_iod_get_metadata(cur_oh.rd_oh, rtid, H5VL_IOD_LINK, + last_comp, cs_scope, NULL, &iod_link); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve link value"); if(H5L_TYPE_SOFT != iod_link.link_type) HGOTO_ERROR_FF(FAIL, "link is not SOFT"); @@ -718,14 +768,16 @@ H5VL_iod_server_link_remove_cb(AXE_engine_t UNUSED axe_engine, /* the traversal will retrieve the location where the link needs to be removed. The traversal will fail if an intermediate group does not exist. */ - if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name, wtid, rtid, - FALSE, cs_scope, &last_comp, &cur_id, &cur_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't traverse path"); + ret = H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name, wtid, rtid, + FALSE, cs_scope, &last_comp, &cur_id, &cur_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't traverse path"); /* lookup object ID in the current location */ - if(H5VL_iod_get_metadata(cur_oh.rd_oh, rtid, H5VL_IOD_LINK, - last_comp, cs_scope, NULL, &iod_link) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve link value"); + ret = H5VL_iod_get_metadata(cur_oh.rd_oh, rtid, H5VL_IOD_LINK, + last_comp, cs_scope, NULL, &iod_link); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve link value"); /* unlink object from conainer */ kv.key = last_comp; @@ -733,8 +785,9 @@ H5VL_iod_server_link_remove_cb(AXE_engine_t UNUSED axe_engine, kvs.kv = &kv; kvs.cs = &cs; kvs.ret = &ret; - if(iod_kv_unlink_keys(cur_oh.wr_oh, wtid, NULL, 1, &kvs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "Unable to unlink KV pair"); + ret = iod_kv_unlink_keys(cur_oh.wr_oh, wtid, NULL, 1, &kvs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "Unable to unlink KV pair"); /* check the metadata information for the object and remove it from the container if this is the last link to it */ @@ -747,14 +800,16 @@ H5VL_iod_server_link_remove_cb(AXE_engine_t UNUSED axe_engine, obj_id = iod_link.u.iod_id; /* open the current group */ - if (iod_obj_open_read(coh, obj_id, rtid, NULL, &obj_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_read(coh, obj_id, rtid, NULL, &obj_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); step ++; /* get scratch pad */ - if(iod_obj_get_scratch(obj_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + ret = iod_obj_get_scratch(obj_oh, rtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -763,45 +818,58 @@ H5VL_iod_server_link_remove_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad */ - if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); - if (iod_obj_open_write(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + ret = iod_obj_open_read(coh, sp[0], rtid, NULL, &mdkv_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); + ret = iod_obj_open_write(coh, sp[0], rtid, NULL, &mdkv_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); step ++; - if(H5VL_iod_get_metadata(mdkv_oh.rd_oh, rtid, H5VL_IOD_LINK_COUNT, - H5VL_IOD_KEY_OBJ_LINK_COUNT, - cs_scope, NULL, &link_count) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve link count"); + ret = H5VL_iod_get_metadata(mdkv_oh.rd_oh, rtid, H5VL_IOD_LINK_COUNT, + H5VL_IOD_KEY_OBJ_LINK_COUNT, + cs_scope, NULL, &link_count); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve link count"); link_count --; /* if this is not the only link to the object, update the link count */ if(0 != link_count) { /* insert link count metadata */ - if(H5VL_iod_insert_link_count(mdkv_oh.wr_oh, wtid, link_count, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_link_count(mdkv_oh.wr_oh, wtid, link_count, + cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); } - iod_obj_close(mdkv_oh.rd_oh, NULL, NULL); - iod_obj_close(mdkv_oh.wr_oh, NULL, NULL); + ret = iod_obj_close(mdkv_oh.rd_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close IOD object"); + ret = iod_obj_close(mdkv_oh.wr_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close IOD object"); step --; - iod_obj_close(obj_oh, NULL, NULL); + ret = iod_obj_close(obj_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close IOD object"); step --; /* If this was the only link to the object, remove the object */ if(0 == link_count) { - if(iod_obj_unlink(coh, obj_id, wtid, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "Unable to unlink object"); - if(iod_obj_unlink(coh, sp[0], wtid, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "Unable to unlink MDKV object"); - if(iod_obj_unlink(coh, sp[1], wtid, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "Unable to unlink ATTRKV object"); + ret = iod_obj_unlink(coh, obj_id, wtid, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "Unable to unlink object"); + ret = iod_obj_unlink(coh, sp[0], wtid, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "Unable to unlink MDKV object"); + ret = iod_obj_unlink(coh, sp[1], wtid, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "Unable to unlink ATTRKV object"); } } diff --git a/src/H5VLiod_map.c b/src/H5VLiod_map.c index e026401..36af132 100644 --- a/src/H5VLiod_map.c +++ b/src/H5VLiod_map.c @@ -71,6 +71,7 @@ H5VL_iod_server_map_create_cb(AXE_engine_t UNUSED axe_engine, hbool_t enable_checksum = FALSE; int step = 0; scratch_pad sp; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -95,9 +96,10 @@ H5VL_iod_server_map_create_cb(AXE_engine_t UNUSED axe_engine, /* the traversal will retrieve the location where the map needs to be created. The traversal will fail if an intermediate group does not exist. */ - if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, wtid, rtid, FALSE, - cs_scope, &last_comp, &cur_id, &cur_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't traverse path"); + ret = H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, wtid, rtid, FALSE, + cs_scope, &last_comp, &cur_id, &cur_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't traverse path"); #if H5_EFF_DEBUG fprintf(stderr, "Creating Map ID %"PRIx64" (CV %"PRIu64", TR %"PRIu64") ", @@ -110,26 +112,31 @@ H5VL_iod_server_map_create_cb(AXE_engine_t UNUSED axe_engine, #endif /* create the map */ - if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, - NULL, NULL, &map_id, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't create Map"); + ret = iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &map_id, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't create Map"); - if (iod_obj_open_read(coh, map_id, wtid, NULL, &map_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open Map"); - if (iod_obj_open_write(coh, map_id, wtid, NULL, &map_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open Map"); + ret = iod_obj_open_read(coh, map_id, wtid, NULL, &map_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open Map"); + ret = iod_obj_open_write(coh, map_id, wtid, NULL, &map_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open Map"); step ++; /* create the metadata KV object for the map */ - if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, - NULL, NULL, &mdkv_id, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't create metadata KV object"); + ret = iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &mdkv_id, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't create metadata KV object"); /* create the attribute KV object for the root group */ - if(iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, - NULL, NULL, &attr_id, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't create metadata KV object"); + ret = iod_obj_create(coh, wtid, obj_create_hint, IOD_OBJ_KV, + NULL, NULL, &attr_id, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't create metadata KV object"); /* set values for the scratch pad object */ sp[0] = mdkv_id; @@ -142,55 +149,62 @@ H5VL_iod_server_map_create_cb(AXE_engine_t UNUSED axe_engine, iod_checksum_t sp_cs; sp_cs = H5_checksum_crc64(&sp, sizeof(sp)); - if (iod_obj_set_scratch(map_oh.wr_oh, wtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set scratch pad"); + ret = iod_obj_set_scratch(map_oh.wr_oh, wtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set scratch pad"); } else { - if (iod_obj_set_scratch(map_oh.wr_oh, wtid, &sp, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set scratch pad"); + ret = iod_obj_set_scratch(map_oh.wr_oh, wtid, &sp, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set scratch pad"); } /* Open Metadata KV object for write */ - if (iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't create scratch pad"); + ret = iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't create scratch pad"); step ++; /* insert plist metadata */ - if(H5VL_iod_insert_plist(mdkv_oh, wtid, mcpl_id, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_plist(mdkv_oh, wtid, mcpl_id, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* insert link count metadata */ - if(H5VL_iod_insert_link_count(mdkv_oh, wtid, (uint64_t)1, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_link_count(mdkv_oh, wtid, (uint64_t)1, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* insert object type metadata */ - if(H5VL_iod_insert_object_type(mdkv_oh, wtid, H5I_MAP, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_object_type(mdkv_oh, wtid, H5I_MAP, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* insert Key datatype metadata */ - if(H5VL_iod_insert_datatype_with_key(mdkv_oh, wtid, keytype, H5VL_IOD_KEY_MAP_KEY_TYPE, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_datatype_with_key(mdkv_oh, wtid, keytype, H5VL_IOD_KEY_MAP_KEY_TYPE, + cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* insert Value datatype metadata */ - if(H5VL_iod_insert_datatype_with_key(mdkv_oh, wtid, valtype, H5VL_IOD_KEY_MAP_VALUE_TYPE, - cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_datatype_with_key(mdkv_oh, wtid, valtype, H5VL_IOD_KEY_MAP_VALUE_TYPE, + cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* close MD KV object */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); step --; /* add link in parent group to current object */ - if(H5VL_iod_insert_new_link(cur_oh.wr_oh, wtid, last_comp, - H5L_TYPE_HARD, &map_id, cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + ret = H5VL_iod_insert_new_link(cur_oh.wr_oh, wtid, last_comp, + H5L_TYPE_HARD, &map_id, cs_scope, NULL, NULL); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't insert KV value"); #if H5_EFF_DEBUG fprintf(stderr, "Done with map create, sending response to client\n"); @@ -275,6 +289,7 @@ H5VL_iod_server_map_open_cb(AXE_engine_t UNUSED axe_engine, scratch_pad sp; iod_checksum_t sp_cs = 0; int step = 0; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -286,18 +301,21 @@ H5VL_iod_server_map_open_cb(AXE_engine_t UNUSED axe_engine, output.valtype_id = -1; /* Traverse Path and open map */ - if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, name, rtid, - cs_scope, &map_id, &map_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't open object"); + ret = H5VL_iod_server_open_path(coh, loc_id, loc_handle, name, rtid, + cs_scope, &map_id, &map_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't open object"); /* open a write handle on the ID. */ - if (iod_obj_open_write(coh, map_id, rtid, NULL, &map_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current map"); + ret = iod_obj_open_write(coh, map_id, rtid, NULL, &map_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current map"); step ++; /* get scratch pad of map */ - if(iod_obj_get_scratch(map_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + ret = iod_obj_get_scratch(map_oh.rd_oh, rtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -306,27 +324,32 @@ H5VL_iod_server_map_open_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad */ - if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open scratch pad"); + ret = iod_obj_open_read(coh, sp[0], rtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open scratch pad"); step ++; - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, - H5VL_IOD_KEY_OBJ_CPL, cs_scope, NULL, &output.mcpl_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve gcpl"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, + H5VL_IOD_KEY_OBJ_CPL, cs_scope, NULL, &output.mcpl_id); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve gcpl"); - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, - H5VL_IOD_KEY_MAP_KEY_TYPE, - cs_scope, NULL, &output.keytype_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve link count"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, + H5VL_IOD_KEY_MAP_KEY_TYPE, + cs_scope, NULL, &output.keytype_id); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve link count"); - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, - H5VL_IOD_KEY_MAP_VALUE_TYPE, - cs_scope, NULL, &output.valtype_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve link count"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, + H5VL_IOD_KEY_MAP_VALUE_TYPE, + cs_scope, NULL, &output.valtype_id); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve link count"); /* close the metadata scratch pad */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close meta data KV handle"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close meta data KV handle"); step --; output.iod_id = map_id; @@ -412,6 +435,7 @@ H5VL_iod_server_map_set_cb(AXE_engine_t UNUSED axe_engine, uint32_t raw_cs_scope; hbool_t opened_locally = FALSE; hbool_t val_is_vl_data = FALSE, key_is_vl_data = FALSE; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -421,8 +445,9 @@ H5VL_iod_server_map_set_cb(AXE_engine_t UNUSED axe_engine, /* open the map if we don't have the handle yet */ if(iod_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_write(coh, iod_id, wtid, NULL /*hints*/, &iod_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_write(coh, iod_id, wtid, NULL, &iod_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); opened_locally = TRUE; } @@ -530,12 +555,14 @@ H5VL_iod_server_map_set_cb(AXE_engine_t UNUSED axe_engine, cs[0] = H5_checksum_crc64(kv.key, kv.key_len); cs[1] = H5_checksum_crc64(kv.value, kv.value_len); - if (iod_kv_set(iod_oh, wtid, NULL, &kv, cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in Map"); + ret = iod_kv_set(iod_oh, wtid, NULL, &kv, cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set KV pair in Map"); } else { - if (iod_kv_set(iod_oh, wtid, NULL, &kv, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in Map"); + ret = iod_kv_set(iod_oh, wtid, NULL, &kv, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set KV pair in Map"); } done: @@ -551,8 +578,9 @@ done: /* close the map if we opened it in this routine */ if(opened_locally) { - if(iod_obj_close(iod_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close Array object"); + ret = iod_obj_close(iod_oh, NULL, NULL); + if(ret < 0) + HDONE_ERROR_FF(ret, "can't close Array object"); } #if H5_EFF_DEBUG @@ -608,6 +636,7 @@ H5VL_iod_server_map_get_cb(AXE_engine_t UNUSED axe_engine, na_addr_t dest = HG_Handler_get_addr(op_data->hg_handle); /* destination address to push data to */ hbool_t opened_locally = FALSE; iod_checksum_t kv_cs[2]; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -617,8 +646,9 @@ H5VL_iod_server_map_get_cb(AXE_engine_t UNUSED axe_engine, /* open the map if we don't have the handle yet */ if(iod_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_read(coh, iod_id, rtid, NULL /*hints*/, &iod_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_read(coh, iod_id, rtid, NULL, &iod_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); opened_locally = TRUE; } @@ -648,9 +678,10 @@ H5VL_iod_server_map_get_cb(AXE_engine_t UNUSED axe_engine, key.buf_size, &key.buf, &key_is_vl, &key_size) < 0) HGOTO_ERROR_FF(FAIL, "data type conversion failed"); - if(iod_kv_get_value(iod_oh, rtid, key.buf, (iod_size_t)key.buf_size, NULL, - &src_size, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't retrieve value size from parent KV store"); + ret = iod_kv_get_value(iod_oh, rtid, key.buf, (iod_size_t)key.buf_size, NULL, + &src_size, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't retrieve value size from parent KV store"); if(val_is_vl) { output.ret = ret_value; @@ -660,9 +691,10 @@ H5VL_iod_server_map_get_cb(AXE_engine_t UNUSED axe_engine, if(NULL == (val_buf = malloc((size_t)src_size))) HGOTO_ERROR_FF(FAIL, "can't allocate buffer"); - if(iod_kv_get_value(iod_oh, rtid, key.buf, (iod_size_t)key.buf_size, val_buf, - &src_size, kv_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't retrieve value from parent KV store"); + ret = iod_kv_get_value(iod_oh, rtid, key.buf, (iod_size_t)key.buf_size, val_buf, + &src_size, kv_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't retrieve value from parent KV store"); if(raw_cs_scope) { iod_checksum_t cs[2]; @@ -704,9 +736,10 @@ H5VL_iod_server_map_get_cb(AXE_engine_t UNUSED axe_engine, if(NULL == (val_buf = malloc((size_t)src_size))) HGOTO_ERROR_FF(FAIL, "can't allocate buffer"); - if(iod_kv_get_value(iod_oh, rtid, key.buf, (iod_size_t)key.buf_size, val_buf, - &src_size, kv_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't retrieve value from parent KV store"); + ret = iod_kv_get_value(iod_oh, rtid, key.buf, (iod_size_t)key.buf_size, val_buf, + &src_size, kv_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't retrieve value from parent KV store"); if(raw_cs_scope) { iod_checksum_t cs[2]; @@ -783,8 +816,9 @@ done: /* close the map if we opened it in this routine */ if(opened_locally) { - if(iod_obj_close(iod_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close Array object"); + ret = iod_obj_close(iod_oh, NULL, NULL); + if(ret < 0) + HDONE_ERROR_FF(ret, "can't close Array object"); } } /* end H5VL_iod_server_map_get_cb() */ @@ -817,6 +851,7 @@ H5VL_iod_server_map_get_count_cb(AXE_engine_t UNUSED axe_engine, iod_trans_id_t rtid = input->rcxt_num; uint32_t cs_scope = input->cs_scope; int num; + iod_ret_t ret; hsize_t output; hbool_t opened_locally = FALSE; herr_t ret_value = SUCCEED; @@ -827,13 +862,15 @@ H5VL_iod_server_map_get_count_cb(AXE_engine_t UNUSED axe_engine, /* open the map if we don't have the handle yet */ if(iod_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_read(coh, iod_id, rtid, NULL /*hints*/, &iod_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_read(coh, iod_id, rtid, NULL, &iod_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); opened_locally = TRUE; } - if(iod_kv_get_num(iod_oh, rtid, &num, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't retrieve Number of KV pairs in MAP"); + ret = iod_kv_get_num(iod_oh, rtid, &num, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't retrieve Number of KV pairs in MAP"); output = (hsize_t)num; @@ -857,8 +894,9 @@ done: /* close the map if we opened it in this routine */ if(opened_locally) { - if(iod_obj_close(iod_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close Array object"); + ret = iod_obj_close(iod_oh, NULL, NULL); + if(ret < 0) + HDONE_ERROR_FF(ret, "can't close Array object"); } } /* end H5VL_iod_server_map_get_count_cb() */ @@ -898,6 +936,7 @@ H5VL_iod_server_map_exists_cb(AXE_engine_t UNUSED axe_engine, hbool_t opened_locally = FALSE; htri_t exists; hbool_t is_vl_data = FALSE; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -906,8 +945,9 @@ H5VL_iod_server_map_exists_cb(AXE_engine_t UNUSED axe_engine, /* open the map if we don't have the handle yet */ if(iod_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_read(coh, iod_id, rtid, NULL /*hints*/, &iod_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_read(coh, iod_id, rtid, NULL, &iod_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); opened_locally = TRUE; } @@ -944,8 +984,9 @@ done: /* close the map if we opened it in this routine */ if(opened_locally) { - if(iod_obj_close(iod_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close Array object"); + ret = iod_obj_close(iod_oh, NULL, NULL); + if(ret < 0) + HDONE_ERROR_FF(ret, "can't close Array object"); } } /* end H5VL_iod_server_map_exists_cb() */ @@ -993,8 +1034,9 @@ H5VL_iod_server_map_delete_cb(AXE_engine_t UNUSED axe_engine, /* open the map if we don't have the handle yet */ if(iod_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_write(coh, iod_id, rtid, NULL /*hints*/, &iod_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_write(coh, iod_id, rtid, NULL, &iod_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); opened_locally = TRUE; } @@ -1009,11 +1051,9 @@ H5VL_iod_server_map_delete_cb(AXE_engine_t UNUSED axe_engine, kvs.cs = &cs; kvs.ret = &ret; - if(iod_kv_unlink_keys(iod_oh, wtid, NULL, 1, &kvs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "Unable to unlink KV pair"); - + ret = iod_kv_unlink_keys(iod_oh, wtid, NULL, 1, &kvs, NULL); if(ret < 0) - HGOTO_ERROR_FF(FAIL, "Unable to unlink KV pair"); + HGOTO_ERROR_FF(ret, "Unable to unlink KV pair"); done: #if H5_EFF_DEBUG @@ -1028,8 +1068,9 @@ done: /* close the map if we opened it in this routine */ if(opened_locally) { - if(iod_obj_close(iod_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close Array object"); + ret = iod_obj_close(iod_oh, NULL, NULL); + if(ret < 0) + HDONE_ERROR_FF(ret, "can't close Array object"); } } /* end H5VL_iod_server_map_delete_cb() */ @@ -1057,6 +1098,7 @@ H5VL_iod_server_map_close_cb(AXE_engine_t UNUSED axe_engine, op_data_t *op_data = (op_data_t *)_op_data; map_close_in_t *input = (map_close_in_t *)op_data->input; iod_handles_t iod_oh = input->iod_oh; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -1064,10 +1106,12 @@ H5VL_iod_server_map_close_cb(AXE_engine_t UNUSED axe_engine, iod_oh.rd_oh.cookie, iod_oh.wr_oh.cookie); #endif - if((iod_obj_close(iod_oh.rd_oh, NULL, NULL)) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); - if((iod_obj_close(iod_oh.wr_oh, NULL, NULL)) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(iod_oh.rd_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); + ret = iod_obj_close(iod_oh.wr_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); done: #if H5_EFF_DEBUG diff --git a/src/H5VLiod_obj.c b/src/H5VLiod_obj.c index 4b42bbe..ac1c3d3 100644 --- a/src/H5VLiod_obj.c +++ b/src/H5VLiod_obj.c @@ -51,16 +51,19 @@ H5VL_iod_server_object_open_by_token_cb(AXE_engine_t UNUSED axe_engine, iod_trans_id_t tid = input->trans_num; //uint32_t cs_scope = input->cs_scope; iod_handles_t obj_oh; /* The handle for object */ + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG fprintf(stderr, "Start Object Open by token = %"PRIx64"\n", obj_id); #endif - if (iod_obj_open_read(coh, obj_id, tid, NULL /*hints*/, &obj_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); - if (iod_obj_open_write(coh, obj_id, tid, NULL /*hints*/, &obj_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_read(coh, obj_id, tid, NULL, &obj_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); + ret = iod_obj_open_write(coh, obj_id, tid, NULL, &obj_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); #if H5_EFF_DEBUG fprintf(stderr, "Done with object open by token, sending response to client\n"); @@ -111,6 +114,7 @@ H5VL_iod_server_object_open_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t mdkv_oh; scratch_pad sp; iod_checksum_t sp_cs = 0; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -119,17 +123,20 @@ H5VL_iod_server_object_open_cb(AXE_engine_t UNUSED axe_engine, #endif /* Traverse Path and open object */ - if(H5VL_iod_server_open_path(coh, input->loc_id, input->loc_oh, input->loc_name, - rtid, cs_scope, &obj_id, &obj_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't open object"); + ret = H5VL_iod_server_open_path(coh, input->loc_id, input->loc_oh, input->loc_name, + rtid, cs_scope, &obj_id, &obj_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't open object"); - if (iod_obj_open_write(coh, obj_id, rtid, NULL, &obj_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_write(coh, obj_id, rtid, NULL, &obj_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open current group"); if(obj_id != input->loc_id) { /* get scratch pad of the object */ - if(iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + ret = iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -138,54 +145,64 @@ H5VL_iod_server_object_open_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata KV */ - if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open MDKV"); + ret = iod_obj_open_read(coh, sp[0], rtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open MDKV"); } else { /* open the metadata KV */ - if (iod_obj_open_read(coh, input->loc_mdkv_id, rtid, NULL, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open MDKV"); + ret = iod_obj_open_read(coh, input->loc_mdkv_id, rtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open MDKV"); } - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_OBJECT_TYPE, H5VL_IOD_KEY_OBJ_TYPE, - cs_scope, NULL, &output.obj_type) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve link count"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_OBJECT_TYPE, H5VL_IOD_KEY_OBJ_TYPE, + cs_scope, NULL, &output.obj_type); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve link count"); switch(output.obj_type) { case H5I_MAP: - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, - cs_scope, NULL, &output.cpl_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve mcpl"); - - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, - H5VL_IOD_KEY_MAP_KEY_TYPE, - cs_scope, NULL, &output.id1) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve link count"); - - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, - H5VL_IOD_KEY_MAP_VALUE_TYPE, - cs_scope, NULL, &output.id2) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve link count"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, + cs_scope, NULL, &output.cpl_id); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve mcpl"); + + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, + H5VL_IOD_KEY_MAP_KEY_TYPE, + cs_scope, NULL, &output.id1); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve link count"); + + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, + H5VL_IOD_KEY_MAP_VALUE_TYPE, + cs_scope, NULL, &output.id2); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve link count"); break; case H5I_GROUP: - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, - cs_scope, NULL, &output.cpl_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve dcpl"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, + cs_scope, NULL, &output.cpl_id); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve dcpl"); output.id1 = FAIL; output.id2 = FAIL; break; case H5I_DATASET: - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, - cs_scope, NULL, &output.cpl_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve dcpl"); - - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, H5VL_IOD_KEY_OBJ_DATATYPE, - cs_scope, NULL, &output.id1) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve datatype"); - - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, H5VL_IOD_KEY_OBJ_DATASPACE, - cs_scope, NULL, &output.id2) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve dataspace"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, + cs_scope, NULL, &output.cpl_id); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve dcpl"); + + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, H5VL_IOD_KEY_OBJ_DATATYPE, + cs_scope, NULL, &output.id1); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve datatype"); + + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, H5VL_IOD_KEY_OBJ_DATASPACE, + cs_scope, NULL, &output.id2); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve dataspace"); break; case H5I_DATATYPE: { @@ -200,14 +217,16 @@ H5VL_iod_server_object_open_cb(AXE_engine_t UNUSED axe_engine, key_size = strlen(H5VL_IOD_KEY_DTYPE_SIZE); val_size = sizeof(iod_size_t); - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, - cs_scope, NULL, &output.cpl_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve dcpl"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, + cs_scope, NULL, &output.cpl_id); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve dcpl"); /* retrieve blob size metadata from scratch pad */ - if(iod_kv_get_value(mdkv_oh, rtid, H5VL_IOD_KEY_DTYPE_SIZE, key_size, - &buf_size, &val_size, iod_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "datatype size lookup failed"); + ret = iod_kv_get_value(mdkv_oh, rtid, H5VL_IOD_KEY_DTYPE_SIZE, key_size, + &buf_size, &val_size, iod_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "datatype size lookup failed"); if(cs_scope & H5_CHECKSUM_IOD) { if(H5VL_iod_verify_kv_pair(H5VL_IOD_KEY_DTYPE_SIZE, key_size, @@ -233,9 +252,10 @@ H5VL_iod_server_object_open_cb(AXE_engine_t UNUSED axe_engine, file_desc->frag[0].len = (iod_size_t)buf_size; /* read the serialized type value from the BLOB object */ - if(iod_blob_read(obj_oh.rd_oh, rtid, NULL, mem_desc, file_desc, - &blob_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "unable to read BLOB object"); + ret = iod_blob_read(obj_oh.rd_oh, rtid, NULL, mem_desc, file_desc, + &blob_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "unable to read BLOB object"); if(blob_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* calculate a checksum for the datatype */ @@ -261,8 +281,9 @@ H5VL_iod_server_object_open_cb(AXE_engine_t UNUSED axe_engine, } /* close the metadata scratch pad */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); output.iod_id = obj_id; output.mdkv_id = sp[0]; @@ -342,18 +363,21 @@ H5VL_iod_server_object_copy_cb(AXE_engine_t UNUSED axe_engine, /* Traverse Path and open object */ if(H5VL_iod_server_open_path(coh, input->src_loc_id, input->src_loc_oh, input->src_loc_name, rtid, cs_scope, &obj_id, &obj_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't open object"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open object"); /* the traversal will retrieve the location where the objects needs to be copied to. The traversal will fail if an intermediate group does not exist. */ if(H5VL_iod_server_traverse(coh, input->dst_loc_id, input->dst_loc_oh, input->dst_loc_name, FALSE, rtid, &new_name, &dst_id, &dst_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't traverse path"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't traverse path"); /* get scratch pad of the object */ if(iod_obj_get_scratch(obj_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -363,35 +387,42 @@ H5VL_iod_server_object_copy_cb(AXE_engine_t UNUSED axe_engine, /* open the metadata scratch pad */ if (iod_obj_open_write(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open MDKV"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open MDKV"); if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_OBJECT_TYPE, H5VL_IOD_KEY_OBJ_TYPE, cs_scope, NULL, &obj_type) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve link count"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to retrieve link count"); switch(obj_type) { case H5I_MAP: if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, cs_scope, NULL, &output.cpl_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve mcpl"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to retrieve mcpl"); break; case H5I_GROUP: if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, cs_scope, NULL, &output.cpl_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve gcpl"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to retrieve gcpl"); break; case H5I_DATASET: if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, cs_scope, NULL, &output.cpl_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve dcpl"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to retrieve dcpl"); if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, H5VL_IOD_KEY_OBJ_DATATYPE, cs_scope, NULL, &output.type_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve datatype"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to retrieve datatype"); if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, H5VL_IOD_KEY_OBJ_DATASPACE, cs_scope, NULL, &output.space_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve dataspace"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to retrieve dataspace"); break; case H5I_DATATYPE: { @@ -405,7 +436,8 @@ H5VL_iod_server_object_copy_cb(AXE_engine_t UNUSED axe_engine, /* retrieve blob size metadata from scratch pad */ if(iod_kv_get_value(mdkv_oh, rtid, H5VL_IOD_KEY_DTYPE_SIZE, key_size, &buf_size, &val_size, iod_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "datatype size lookup failed"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "datatype size lookup failed"); if(cs_scope & H5_CHECKSUM_IOD) { if(H5VL_iod_verify_kv_pair(H5VL_IOD_KEY_DTYPE_SIZE, key_size, @@ -429,7 +461,8 @@ H5VL_iod_server_object_copy_cb(AXE_engine_t UNUSED axe_engine, /* read the serialized type value from the BLOB object */ if(iod_blob_read(obj_oh, rtid, NULL, &mem_desc, &file_desc, NULL, &blob_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "unable to write BLOB object"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "unable to write BLOB object"); if(blob_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* calculate a checksum for the datatype */ @@ -455,16 +488,19 @@ H5VL_iod_server_object_copy_cb(AXE_engine_t UNUSED axe_engine, /* close the metadata scratch pad */ if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); /* close the object handle */ if(input->src_loc_oh.cookie != obj_oh.cookie && iod_obj_close(obj_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); /* Insert object in the destination path */ if(H5VL_iod_insert_new_link(dst_oh, wtid, new_name, H5L_TYPE_HARD, &obj_id, cs_scope, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't insert KV value"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't insert KV value"); /* close dst group if it is not the location we started the traversal into */ @@ -519,6 +555,7 @@ H5VL_iod_server_object_exists_cb(AXE_engine_t UNUSED axe_engine, iod_obj_id_t obj_id; const char *loc_name = input->loc_name; htri_t ret = -1; + iod_ret_t iod_ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -592,6 +629,7 @@ H5VL_iod_server_object_get_info_cb(AXE_engine_t UNUSED axe_engine, int num_attrs = 0; const char *loc_name = input->loc_name; uint64_t link_count = 0; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -600,16 +638,18 @@ H5VL_iod_server_object_get_info_cb(AXE_engine_t UNUSED axe_engine, #endif /* Traverse Path and open object */ - if(H5VL_iod_server_open_path(coh, loc_id, loc_oh, loc_name, - rtid, cs_scope, &obj_id, &obj_oh) < 0) - HGOTO_ERROR_FF(FAIL, "object does not exist"); + ret = H5VL_iod_server_open_path(coh, loc_id, loc_oh, loc_name, + rtid, cs_scope, &obj_id, &obj_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "object does not exist"); oinfo.addr = obj_id; if(obj_id != loc_id || input->loc_mdkv_id == IOD_OBJ_INVALID) { /* get scratch pad of the object */ - if(iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + ret = iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -618,25 +658,30 @@ H5VL_iod_server_object_get_info_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata KV */ - if (iod_obj_open_read(coh, sp[0], rtid, NULL, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open MDKV"); + ret = iod_obj_open_read(coh, sp[0], rtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open MDKV"); /* open the attribute KV */ - if (iod_obj_open_read(coh, sp[1], rtid, NULL, &attrkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open ATTRKV"); + ret = iod_obj_open_read(coh, sp[1], rtid, NULL, &attrkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open ATTRKV"); } else { /* open the metadata KV */ - if (iod_obj_open_read(coh, input->loc_mdkv_id, rtid, NULL, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open MDKV"); + ret = iod_obj_open_read(coh, input->loc_mdkv_id, rtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open MDKV"); /* open the attribute KV */ - if (iod_obj_open_read(coh, input->loc_attrkv_id, rtid, NULL, &attrkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open MDKV"); + ret = iod_obj_open_read(coh, input->loc_attrkv_id, rtid, NULL, &attrkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open MDKV"); } - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_OBJECT_TYPE, - H5VL_IOD_KEY_OBJ_TYPE, - cs_scope, NULL, &obj_type) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve object type"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_OBJECT_TYPE, + H5VL_IOD_KEY_OBJ_TYPE, + cs_scope, NULL, &obj_type); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve object type"); switch(obj_type) { case H5I_GROUP: @@ -656,24 +701,28 @@ H5VL_iod_server_object_get_info_cb(AXE_engine_t UNUSED axe_engine, "unsupported object type for H5Oget_info"); } - if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_LINK_COUNT, - H5VL_IOD_KEY_OBJ_LINK_COUNT, - cs_scope, NULL, &link_count) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve link count"); + ret = H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_LINK_COUNT, + H5VL_IOD_KEY_OBJ_LINK_COUNT, + cs_scope, NULL, &link_count); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "failed to retrieve link count"); oinfo.rc = (unsigned) link_count; - if(iod_kv_get_num(attrkv_oh, rtid, &num_attrs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve attribute count"); + ret = iod_kv_get_num(attrkv_oh, rtid, &num_attrs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to retrieve attribute count"); oinfo.num_attrs = (hsize_t)num_attrs; /* close the metadata KV */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); /* close the attribute KV */ - if(iod_obj_close(attrkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(attrkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); if(loc_oh.rd_oh.cookie != obj_oh.rd_oh.cookie && iod_obj_close(obj_oh.rd_oh, NULL, NULL) < 0) @@ -734,6 +783,7 @@ H5VL_iod_server_object_set_comment_cb(AXE_engine_t UNUSED axe_engine, const char *comment = input->comment; scratch_pad sp; iod_checksum_t sp_cs = 0; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -742,14 +792,16 @@ H5VL_iod_server_object_set_comment_cb(AXE_engine_t UNUSED axe_engine, #endif /* Traverse Path and open object */ - if(H5VL_iod_server_open_path(coh, loc_id, loc_oh, loc_name, rtid, - cs_scope, &obj_id, &obj_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't open object"); + ret = H5VL_iod_server_open_path(coh, loc_id, loc_oh, loc_name, rtid, + cs_scope, &obj_id, &obj_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't open object"); if(loc_id != obj_id || input->loc_mdkv_id == IOD_OBJ_INVALID) { /* get scratch pad of the object */ - if(iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + ret = iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -758,13 +810,15 @@ H5VL_iod_server_object_set_comment_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad */ - if (iod_obj_open_write(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open MDKV"); + ret = iod_obj_open_write(coh, sp[0], rtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open MDKV"); } else { /* open the metadata KV */ - if (iod_obj_open_write(coh, input->loc_mdkv_id, rtid, NULL, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open MDKV"); + ret = iod_obj_open_write(coh, input->loc_mdkv_id, rtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open MDKV"); } { @@ -780,19 +834,22 @@ H5VL_iod_server_object_set_comment_cb(AXE_engine_t UNUSED axe_engine, cs[0] = H5_checksum_crc64(kv.key, kv.key_len); cs[1] = H5_checksum_crc64(kv.value, kv.value_len); - if (iod_kv_set(mdkv_oh, wtid, NULL, &kv, cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(mdkv_oh, wtid, NULL, &kv, cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } else { - if (iod_kv_set(mdkv_oh, wtid, NULL, &kv, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set comment in MDKV"); + ret = iod_kv_set(mdkv_oh, wtid, NULL, &kv, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set comment in MDKV"); } } /* close metadata KV and object */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); if(loc_oh.rd_oh.cookie != obj_oh.rd_oh.cookie && iod_obj_close(obj_oh.rd_oh, NULL, NULL) < 0) @@ -850,6 +907,7 @@ H5VL_iod_server_object_get_comment_cb(AXE_engine_t UNUSED axe_engine, iod_size_t key_size, val_size = 0; void *value = NULL; iod_checksum_t *iod_cs = NULL; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -858,14 +916,16 @@ H5VL_iod_server_object_get_comment_cb(AXE_engine_t UNUSED axe_engine, #endif /* Traverse Path and open object */ - if(H5VL_iod_server_open_path(coh, loc_id, loc_oh, loc_name, - rtid, cs_scope, &obj_id, &obj_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't open object"); + ret = H5VL_iod_server_open_path(coh, loc_id, loc_oh, loc_name, + rtid, cs_scope, &obj_id, &obj_oh); + if(ret != SUCCEED) + HGOTO_ERROR_FF(ret, "can't open object"); if(loc_id != obj_id || input->loc_mdkv_id == IOD_OBJ_INVALID) { /* get scratch pad of the object */ - if(iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + ret = iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -874,13 +934,15 @@ H5VL_iod_server_object_get_comment_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata KV */ - if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open MDKV"); + ret = iod_obj_open_read(coh, sp[0], rtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open MDKV"); } else { /* open the metadata KV */ - if (iod_obj_open_read(coh, input->loc_mdkv_id, rtid, NULL, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open MDKV"); + ret = iod_obj_open_read(coh, input->loc_mdkv_id, rtid, NULL, &mdkv_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open MDKV"); } comment.value_size = (ssize_t *)malloc(sizeof(ssize_t)); @@ -893,16 +955,18 @@ H5VL_iod_server_object_get_comment_cb(AXE_engine_t UNUSED axe_engine, iod_cs = (iod_checksum_t *)malloc(sizeof(iod_checksum_t) * 2); } - if(iod_kv_get_value(mdkv_oh, rtid, H5VL_IOD_KEY_OBJ_COMMENT, key_size, - NULL, &val_size, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "comment size lookup failed"); + ret = iod_kv_get_value(mdkv_oh, rtid, H5VL_IOD_KEY_OBJ_COMMENT, key_size, + NULL, &val_size, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "comment size lookup failed"); if(NULL == (value = malloc ((size_t)val_size))) HGOTO_ERROR_FF(FAIL, "can't allocate value buffer"); - if(iod_kv_get_value(mdkv_oh, rtid, H5VL_IOD_KEY_OBJ_COMMENT, key_size, - value, &val_size, iod_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "comment value lookup failed"); + ret = iod_kv_get_value(mdkv_oh, rtid, H5VL_IOD_KEY_OBJ_COMMENT, key_size, + value, &val_size, iod_cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "comment value lookup failed"); if(cs_scope & H5_CHECKSUM_IOD) { if(H5VL_iod_verify_kv_pair(H5VL_IOD_KEY_OBJ_COMMENT, key_size, @@ -919,8 +983,9 @@ H5VL_iod_server_object_get_comment_cb(AXE_engine_t UNUSED axe_engine, free(value); /* close metadata KV and object */ - if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + ret = iod_obj_close(mdkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); if(loc_oh.rd_oh.cookie != obj_oh.rd_oh.cookie && iod_obj_close(obj_oh.rd_oh, NULL, NULL) < 0) @@ -997,13 +1062,16 @@ H5VL_iod_server_object_open_by_addr_cb(AXE_engine_t UNUSED axe_engine, #endif if (iod_obj_open_read(coh, obj_id, rtid, NULL, &obj_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't opeb obejct for read"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't opeb obejct for read"); if (iod_obj_open_write(coh, obj_id, rtid, NULL, &obj_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open object for write"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open object for write"); /* get scratch pad of the object */ if(iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get scratch pad for object"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get scratch pad for object"); if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* verify scratch pad integrity */ @@ -1013,56 +1081,67 @@ H5VL_iod_server_object_open_by_addr_cb(AXE_engine_t UNUSED axe_engine, /* open the metadata KV */ if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open MDKV"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open MDKV"); if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_OBJECT_TYPE, H5VL_IOD_KEY_OBJ_TYPE, cs_scope, NULL, &output.obj_type) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve link count"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to retrieve link count"); switch(output.obj_type) { case H5I_MAP: if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, cs_scope, NULL, &output.cpl_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve mcpl"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to retrieve mcpl"); if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, H5VL_IOD_KEY_MAP_KEY_TYPE, cs_scope, NULL, &output.id1) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve link count"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to retrieve link count"); if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, H5VL_IOD_KEY_MAP_VALUE_TYPE, cs_scope, NULL, &output.id2) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve link count"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to retrieve link count"); break; case H5I_GROUP: if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, cs_scope, NULL, &output.cpl_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve dcpl"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to retrieve dcpl"); output.id1 = FAIL; output.id2 = FAIL; break; case H5I_DATASET: if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, cs_scope, NULL, &output.cpl_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve dcpl"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to retrieve dcpl"); if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, H5VL_IOD_KEY_OBJ_DATATYPE, cs_scope, NULL, &output.id1) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve datatype"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to retrieve datatype"); if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, H5VL_IOD_KEY_OBJ_DATASPACE, cs_scope, NULL, &output.id2) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve dataspace"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to retrieve dataspace"); break; case H5I_ATTR: if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, H5VL_IOD_KEY_OBJ_DATATYPE, cs_scope, NULL, &output.id1) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve datatype"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to retrieve datatype"); if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, H5VL_IOD_KEY_OBJ_DATASPACE, cs_scope, NULL, &output.id2) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve dataspace"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to retrieve dataspace"); break; case H5I_DATATYPE: { @@ -1079,12 +1158,14 @@ H5VL_iod_server_object_open_by_addr_cb(AXE_engine_t UNUSED axe_engine, if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, cs_scope, NULL, &output.cpl_id) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve dcpl"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to retrieve dcpl"); /* retrieve blob size metadata from scratch pad */ if(iod_kv_get_value(mdkv_oh, rtid, H5VL_IOD_KEY_DTYPE_SIZE, key_size, &buf_size, &val_size, iod_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "datatype size lookup failed"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "datatype size lookup failed"); if(cs_scope & H5_CHECKSUM_IOD) { if(H5VL_iod_verify_kv_pair(H5VL_IOD_KEY_DTYPE_SIZE, key_size, @@ -1112,7 +1193,8 @@ H5VL_iod_server_object_open_by_addr_cb(AXE_engine_t UNUSED axe_engine, /* read the serialized type value from the BLOB object */ if(iod_blob_read(obj_oh.rd_oh, rtid, NULL, mem_desc, file_desc, &blob_cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "unable to read BLOB object"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "unable to read BLOB object"); if(blob_cs && (cs_scope & H5_CHECKSUM_IOD)) { /* calculate a checksum for the datatype */ @@ -1139,7 +1221,8 @@ H5VL_iod_server_object_open_by_addr_cb(AXE_engine_t UNUSED axe_engine, /* close the metadata scratch pad */ if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object"); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object"); output.iod_id = obj_id; output.mdkv_id = sp[0]; diff --git a/src/H5VLiod_server.c b/src/H5VLiod_server.c index 2360101..63a78b1 100644 --- a/src/H5VLiod_server.c +++ b/src/H5VLiod_server.c @@ -2261,7 +2261,6 @@ H5VL_iod_server_link_iterate(hg_handle_t UNUSED handle) op_data->input = (void *)input; #endif -done: return ret_value; } /* end H5VL_iod_server_link_iterate() */ @@ -2650,7 +2649,6 @@ H5VL_iod_server_object_visit(hg_handle_t UNUSED handle) //op_data_t *op_data = NULL; int ret_value = HG_SUCCESS; -done: return ret_value; } /* end H5VL_iod_server_object_visit() */ diff --git a/src/H5VLiod_server.h b/src/H5VLiod_server.h index 347828d..71a3ce2 100644 --- a/src/H5VLiod_server.h +++ b/src/H5VLiod_server.h @@ -46,14 +46,15 @@ #define H5VL_IOD_IDX_PLUGIN_MD "index_plugin_metadata" -#define HGOTO_ERROR_FF(ret_val, string) { \ - fprintf(stderr, "%s\n", string); \ - HGOTO_DONE_FF(ret_val) \ +#define HGOTO_ERROR_FF(ret_val, string) { \ + fprintf(stderr, "%d (%s). --- %s\n", ret_value, strerror(-ret_value), string); \ + fprintf(stderr, "%s\n", string); \ + HGOTO_DONE_FF(ret_val) \ } -#define HDONE_ERROR_FF(ret_val, string) { \ - fprintf(stderr, "%s\n", string); \ - ret_value = ret_val; \ +#define HDONE_ERROR_FF(ret_val, string) { \ + fprintf(stderr, "%d (%s). --- %s\n", ret_val, strerror(-ret_val), string); \ + ret_value = ret_val; \ } #define HGOTO_DONE_FF(ret_val) {ret_value = ret_val; goto done;} diff --git a/src/H5VLiod_trans.c b/src/H5VLiod_trans.c index 33f5590..145f95c 100644 --- a/src/H5VLiod_trans.c +++ b/src/H5VLiod_trans.c @@ -76,8 +76,7 @@ H5VL_iod_server_rcxt_acquire_cb(AXE_engine_t UNUSED axe_engine, fprintf(stderr, "Exact Acquire Read Context %"PRIu64"\n", input->c_version); #endif if((ret = iod_trans_start(coh, &c_version, NULL, 0, IOD_TRANS_R, NULL)) < 0) { - fprintf(stderr, "can't acquire read context. %d (%s).\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't acquire read context"); + HGOTO_ERROR_FF(ret, "can't acquire read context"); } acquired_version = c_version; break; @@ -86,8 +85,8 @@ H5VL_iod_server_rcxt_acquire_cb(AXE_engine_t UNUSED axe_engine, fprintf(stderr, "Acquire LAST Read Context\n"); #endif c_version = IOD_TID_UNKNOWN; - if(iod_trans_start(coh, &c_version, NULL, 0, IOD_TRANS_R, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't acquire read context"); + if((ret = iod_trans_start(coh, &c_version, NULL, 0, IOD_TRANS_R, NULL)) < 0) + HGOTO_ERROR_FF(ret, "can't acquire read context"); acquired_version = c_version; break; case H5RC_NEXT: @@ -98,8 +97,9 @@ H5VL_iod_server_rcxt_acquire_cb(AXE_engine_t UNUSED axe_engine, #if H5_EFF_DEBUG fprintf(stderr, "Next Acquire Read Context %"PRIu64"\n", input->c_version); #endif - if(iod_query_cont_trans_stat(coh, &tids, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't get container tids status"); + ret = iod_query_cont_trans_stat(coh, &tids, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't get container tids status"); acquired_version = IOD_TID_UNKNOWN; @@ -132,8 +132,9 @@ H5VL_iod_server_rcxt_acquire_cb(AXE_engine_t UNUSED axe_engine, if(c_version >= tids->latest_rdable) { acquired_version = tids->latest_rdable; - if(iod_trans_start(coh, &acquired_version, NULL, 0, IOD_TRANS_R, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't acquire read context"); + ret = iod_trans_start(coh, &acquired_version, NULL, 0, IOD_TRANS_R, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't acquire read context"); break; } @@ -207,14 +208,16 @@ H5VL_iod_server_rcxt_release_cb(AXE_engine_t UNUSED axe_engine, op_data_t *op_data = (op_data_t *)_op_data; rc_release_in_t *input = (rc_release_in_t *)op_data->input; iod_handle_t coh = input->coh; /* the container handle */ + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG fprintf(stderr, "Release Read Context %"PRIu64"\n", input->c_version); #endif - if(iod_trans_finish(coh, input->c_version, NULL, 0, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't release Read Context"); + ret = iod_trans_finish(coh, input->c_version, NULL, 0, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't release Read Context"); done: if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &ret_value)) @@ -305,7 +308,7 @@ H5VL_iod_server_rcxt_persist_cb(AXE_engine_t UNUSED axe_engine, } if(ret != 0) { - HGOTO_ERROR_FF(FAIL, "can't persist read context"); + HGOTO_ERROR_FF(ret, "can't persist read context"); } #if H5_HAVE_IOD_CORRUPT_TOOL @@ -357,6 +360,7 @@ H5VL_iod_server_rcxt_snapshot_cb(AXE_engine_t UNUSED axe_engine, rc_snapshot_in_t *input = (rc_snapshot_in_t *)op_data->input; iod_handle_t coh = input->coh; /* the container handle */ iod_trans_id_t tid = input->c_version; + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -364,8 +368,9 @@ H5VL_iod_server_rcxt_snapshot_cb(AXE_engine_t UNUSED axe_engine, #endif /* MSC - can only snapshot latest version */ - if(iod_container_snapshot(coh, tid, input->snapshot_name, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't snapshot Read Context"); + ret = iod_container_snapshot(coh, tid, input->snapshot_name, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't snapshot Read Context"); done: if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &ret_value)) @@ -402,6 +407,7 @@ H5VL_iod_server_trans_start_cb(AXE_engine_t UNUSED axe_engine, hid_t trspl_id; iod_trans_id_t trans_num = input->trans_num; unsigned num_peers; /* the number of peers starting this transaction */ + iod_ret_t ret; herr_t ret_value = SUCCEED; #if H5_EFF_DEBUG @@ -415,8 +421,9 @@ H5VL_iod_server_trans_start_cb(AXE_engine_t UNUSED axe_engine, if(H5Pget_trspl_num_peers(trspl_id, &num_peers) < 0) HGOTO_ERROR_FF(FAIL, "can't get acquire request property"); - if(iod_trans_start(coh, &trans_num, NULL, num_peers, IOD_TRANS_W, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't start transaction"); + ret = iod_trans_start(coh, &trans_num, NULL, num_peers, IOD_TRANS_W, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't start transaction"); #if H5_EFF_DEBUG fprintf(stderr, "Done with Transaction Start\n"); @@ -477,7 +484,7 @@ H5VL_iod_server_trans_finish_cb(AXE_engine_t UNUSED axe_engine, ret = iod_obj_open_write(coh, oidkv_id, trans_num, NULL, &oidkv_oh, NULL); if(ret != 0) - HGOTO_ERROR_FF(FAIL, "can't open oid KV"); + HGOTO_ERROR_FF(ret, "can't open oid KV"); step ++; @@ -491,24 +498,25 @@ H5VL_iod_server_trans_finish_cb(AXE_engine_t UNUSED axe_engine, cs[0] = H5_checksum_crc64(kv.key, kv.key_len); cs[1] = H5_checksum_crc64(kv.value, kv.value_len); - if (iod_kv_set(oidkv_oh, trans_num, NULL, &kv, cs, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(oidkv_oh, trans_num, NULL, &kv, cs, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set KV pair in parent"); } else { - if (iod_kv_set(oidkv_oh, trans_num, NULL, &kv, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in oid KV"); + ret = iod_kv_set(oidkv_oh, trans_num, NULL, &kv, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't set KV pair in oid KV"); } - if(iod_obj_close(oidkv_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close object handle"); + ret = iod_obj_close(oidkv_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't close object handle"); step --; /* Finish the transaction */ - if((ret = iod_trans_finish(coh, trans_num, NULL, 0, NULL)) < 0) { - fprintf(stderr, "can't finish transaction %d (%s).\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't finish transaction"); - } + if((ret = iod_trans_finish(coh, trans_num, NULL, 0, NULL)) < 0) + HGOTO_ERROR_FF(ret, "can't finish transaction"); #if H5_HAVE_IOD_CORRUPT_TOOL if(0 == client_rank) @@ -521,8 +529,9 @@ H5VL_iod_server_trans_finish_cb(AXE_engine_t UNUSED axe_engine, fprintf(stderr, "Transaction Acquire after Finish %"PRIu64"\n", trans_num); #endif - if(iod_trans_start(coh, &trans_num, NULL, 0, IOD_TRANS_R, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't acquire read context"); + ret = iod_trans_start(coh, &trans_num, NULL, 0, IOD_TRANS_R, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't acquire read context"); } #if H5_EFF_DEBUG @@ -675,10 +684,8 @@ H5VL_iod_server_trans_abort_cb(AXE_engine_t UNUSED axe_engine, ret = iod_trans_finish(coh, trans_num, NULL, IOD_TRANS_ABORT_DEPENDENT, NULL); if(ret == -IOD_EC_TRANS_DISCARDED) fprintf(stderr, "Transaction %"PRIu64" already discarded\n", input->trans_num); - else if(ret < 0) { - fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't abort transaction"); - } + else if(ret < 0) + HGOTO_ERROR_FF(ret, "can't abort transaction"); #if H5_EFF_DEBUG fprintf(stderr, "Done with Transaction Abort\n"); @@ -731,10 +738,8 @@ H5VL_iod_server_prefetch_cb(AXE_engine_t UNUSED axe_engine, #endif ret = iod_obj_fetch(iod_oh.rd_oh, tid, NULL, NULL, NULL, &replica_id, NULL); - if(ret != 0) { - fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't prefetch object"); - } + if(ret != 0) + HGOTO_ERROR_FF(ret, "can't prefetch object"); #if H5_EFF_DEBUG fprintf(stderr, "Done with Prefetch\n"); @@ -795,10 +800,8 @@ H5VL_iod_server_evict_cb(AXE_engine_t UNUSED axe_engine, ret = iod_obj_purge(iod_oh.rd_oh, tid, NULL, NULL); } - if(ret < 0) { - fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); - HGOTO_ERROR_FF(FAIL, "can't evict object"); - } + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't evict object"); #if H5_EFF_DEBUG fprintf(stderr, "Done with Evict\n"); diff --git a/src/H5VLiod_util.c b/src/H5VLiod_util.c index ea5cd7d..28a081b 100644 --- a/src/H5VLiod_util.c +++ b/src/H5VLiod_util.c @@ -64,6 +64,7 @@ H5VL_iod_server_traverse(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t lo iod_handles_t cur_oh; iod_handle_t prev_oh; iod_obj_id_t cur_id; + iod_ret_t ret; herr_t ret_value = SUCCEED; /* Creating intermediate groups is not supported for now */ @@ -117,9 +118,10 @@ H5VL_iod_server_traverse(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t lo prev_oh.cookie = cur_oh.rd_oh.cookie; /* lookup next object in the current group */ - if(H5VL_iod_get_metadata(cur_oh.rd_oh, rtid, H5VL_IOD_LINK, - comp, cs_scope, NULL, &value) < 0) - HGOTO_ERROR_FF(FAIL, "failed to retrieve link value"); + ret = H5VL_iod_get_metadata(cur_oh.rd_oh, rtid, H5VL_IOD_LINK, + comp, cs_scope, NULL, &value); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "failed to get link value"); /* if this a soft link, traverse the link value if the ID is undefined */ if(H5L_TYPE_SOFT == value.link_type) { @@ -128,9 +130,10 @@ H5VL_iod_server_traverse(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t lo } /* Traverse Path and open the target object */ - if(H5VL_iod_server_open_path(coh, cur_id, cur_oh, value.u.symbolic_name, - rtid, cs_scope, &cur_id, &cur_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't open object"); + ret = H5VL_iod_server_open_path(coh, cur_id, cur_oh, value.u.symbolic_name, + rtid, cs_scope, &cur_id, &cur_oh); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "failed to traverse object path"); free(value.u.symbolic_name); } @@ -139,13 +142,15 @@ H5VL_iod_server_traverse(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t lo /* Close previous read handle unless it is the original one */ if(loc_handle.rd_oh.cookie != prev_oh.cookie) { - if(iod_obj_close(prev_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close current object handle"); + ret = iod_obj_close(prev_oh, NULL, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to close IOD object"); } /* open the current group */ - if (iod_obj_open_read(coh, cur_id, rtid, NULL, &cur_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_read(coh, cur_id, rtid, NULL, &cur_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to open IOD object"); /* Advance to next component in string */ path += nchars; @@ -161,8 +166,9 @@ H5VL_iod_server_traverse(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t lo if(cur_id != loc_id || loc_handle.wr_oh.cookie == IOD_OH_UNDEFINED) { /* open a write handle on the ID. */ - if (iod_obj_open_write(coh, cur_id, wtid, NULL, &cur_oh.wr_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current group"); + ret = iod_obj_open_write(coh, cur_id, wtid, NULL, &cur_oh.wr_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "can't open IOD object"); } (*iod_oh).wr_oh.cookie = cur_oh.wr_oh.cookie; @@ -199,6 +205,7 @@ H5VL_iod_server_open_path(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t l iod_handles_t cur_oh; iod_handle_t prev_oh; iod_obj_id_t cur_id; + iod_ret_t ret; herr_t ret_value = SUCCEED; cur_oh.rd_oh.cookie = loc_handle.rd_oh.cookie; @@ -240,13 +247,14 @@ H5VL_iod_server_open_path(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t l prev_oh.cookie = cur_oh.rd_oh.cookie; /* lookup next object in the current group */ - if(H5VL_iod_get_metadata(cur_oh.rd_oh, rtid, H5VL_IOD_LINK, - comp, cs_scope, NULL, &value) < 0) { + ret = H5VL_iod_get_metadata(cur_oh.rd_oh, rtid, H5VL_IOD_LINK, + comp, cs_scope, NULL, &value); + if(SUCCEED != ret) { /* Close previous handle unless it is the original one */ if(loc_handle.rd_oh.cookie != prev_oh.cookie && iod_obj_close(prev_oh, NULL, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't close current object handle"); - HGOTO_ERROR_FF(FAIL, "failed to retrieve link value"); + HGOTO_ERROR_FF(ret, "can't close current object handle"); + HGOTO_ERROR_FF(ret, "failed to retrieve link value"); } /* if this a soft link, traverse the link value if the ID is undefined */ @@ -256,9 +264,10 @@ H5VL_iod_server_open_path(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t l } /* Traverse Path and open the target object */ - if(H5VL_iod_server_open_path(coh, cur_id, cur_oh, value.u.symbolic_name, - rtid, cs_scope, &cur_id, &cur_oh) < 0) - HGOTO_ERROR_FF(FAIL, "can't open object"); + ret = H5VL_iod_server_open_path(coh, cur_id, cur_oh, value.u.symbolic_name, + rtid, cs_scope, &cur_id, &cur_oh); + if(SUCCEED != ret) + HGOTO_ERROR_FF(ret, "failed to traverse object path"); free(value.u.symbolic_name); } @@ -271,8 +280,9 @@ H5VL_iod_server_open_path(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t l HGOTO_ERROR_FF(FAIL, "can't close current object handle"); /* open the current group */ - if (iod_obj_open_read(coh, cur_id, rtid, NULL, &cur_oh.rd_oh, NULL) < 0) - HGOTO_ERROR_FF(FAIL, "can't open current object"); + ret = iod_obj_open_read(coh, cur_id, rtid, NULL, &cur_oh.rd_oh, NULL); + if(ret < 0) + HGOTO_ERROR_FF(ret, "failed to open IOD object"); /* Advance to next component in string */ path += nchars; @@ -443,9 +453,9 @@ H5VL_iod_get_file_desc(hid_t space_id, hssize_t *count, iod_hyperslab_t *hslabs) *count = num_descriptors; - done: +done: return ret_value; - } +} /*------------------------------------------------------------------------- @@ -467,6 +477,7 @@ H5VL_iod_insert_plist(iod_handle_t oh, iod_trans_id_t tid, hid_t plist_id, void *value = NULL; iod_kv_t kv; size_t buf_size; + iod_ret_t ret; herr_t ret_value = SUCCEED; /* insert group creation properties in Metadata KV */ @@ -496,12 +507,14 @@ H5VL_iod_insert_plist(iod_handle_t oh, iod_trans_id_t tid, hid_t plist_id, fprintf(stderr, "PLIST Checksums key = %016lX value = %016lX\n", cs[0], cs[1]); #endif - if (iod_kv_set(oh, tid, hints, &kv, cs, event) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(oh, tid, hints, &kv, cs, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "can't set KV pair for plist"); } else { - if (iod_kv_set(oh, tid, hints, &kv, NULL, event) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(oh, tid, hints, &kv, NULL, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "can't set KV pair for plist"); } done: @@ -535,6 +548,7 @@ H5VL_iod_insert_link_count(iod_handle_t oh, iod_trans_id_t tid, uint64_t count, { char *key = NULL; iod_kv_t kv; + iod_ret_t ret; herr_t ret_value = SUCCEED; key = strdup(H5VL_IOD_KEY_OBJ_LINK_COUNT); @@ -554,12 +568,14 @@ H5VL_iod_insert_link_count(iod_handle_t oh, iod_trans_id_t tid, uint64_t count, fprintf(stderr, "Link Count Checksums key = %016lX value = %016lX\n", cs[0], cs[1]); #endif - if (iod_kv_set(oh, tid, hints, &kv, cs, event) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(oh, tid, hints, &kv, cs, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "can't set KV pair for link count"); } else { - if (iod_kv_set(oh, tid, hints, &kv, NULL, event) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(oh, tid, hints, &kv, NULL, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "can't set KV pair for link count"); } done: @@ -588,6 +604,7 @@ H5VL_iod_insert_object_type(iod_handle_t oh, iod_trans_id_t tid, H5I_type_t obj_ { char *key = NULL; iod_kv_t kv; + iod_ret_t ret; herr_t ret_value = SUCCEED; key = strdup(H5VL_IOD_KEY_OBJ_TYPE); @@ -607,12 +624,14 @@ H5VL_iod_insert_object_type(iod_handle_t oh, iod_trans_id_t tid, H5I_type_t obj_ fprintf(stderr, "Object Type Checksums key = %016lX value = %016lX\n", cs[0], cs[1]); #endif - if (iod_kv_set(oh, tid, hints, &kv, cs, event) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(oh, tid, hints, &kv, cs, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "can't set KV pair for object type"); } else { - if (iod_kv_set(oh, tid, hints, &kv, NULL, event) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(oh, tid, hints, &kv, NULL, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "can't set KV pair for object type"); } done: @@ -643,6 +662,7 @@ H5VL_iod_insert_datatype(iod_handle_t oh, iod_trans_id_t tid, hid_t type_id, void *value = NULL; iod_kv_t kv; size_t buf_size; + iod_ret_t ret; herr_t ret_value = SUCCEED; /* insert group creation properties in Metadata KV */ @@ -672,12 +692,14 @@ H5VL_iod_insert_datatype(iod_handle_t oh, iod_trans_id_t tid, hid_t type_id, fprintf(stderr, "Datatype Checksums key = %016lX value = %016lX\n", cs[0], cs[1]); #endif - if (iod_kv_set(oh, tid, hints, &kv, cs, event) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(oh, tid, hints, &kv, cs, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "can't set KV pair for datatype"); } else { - if (iod_kv_set(oh, tid, hints, &kv, NULL, event) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(oh, tid, hints, &kv, NULL, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "can't set KV pair for datatype"); } done: @@ -713,6 +735,7 @@ H5VL_iod_insert_datatype_with_key(iod_handle_t oh, iod_trans_id_t tid, hid_t typ void *value = NULL; iod_kv_t kv; size_t buf_size; + iod_ret_t ret; herr_t ret_value = SUCCEED; /* determine the buffer size needed to store the encoded type */ @@ -739,12 +762,14 @@ H5VL_iod_insert_datatype_with_key(iod_handle_t oh, iod_trans_id_t tid, hid_t typ fprintf(stderr, "Map Datatype Checksums key = %016lX value = %016lX\n", cs[0], cs[1]); #endif - if (iod_kv_set(oh, tid, hints, &kv, cs, event) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(oh, tid, hints, &kv, cs, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "can't set KV pair for datatype"); } else { - if (iod_kv_set(oh, tid, hints, &kv, NULL, event) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(oh, tid, hints, &kv, NULL, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "can't set KV pair for datatype"); } done: @@ -776,6 +801,7 @@ H5VL_iod_insert_dataspace(iod_handle_t oh, iod_trans_id_t tid, hid_t space_id, void *value = NULL; iod_kv_t kv; size_t buf_size; + iod_ret_t ret; herr_t ret_value = SUCCEED; /* insert group creation properties in Metadata KV */ @@ -805,12 +831,14 @@ H5VL_iod_insert_dataspace(iod_handle_t oh, iod_trans_id_t tid, hid_t space_id, fprintf(stderr, "Dataspace Checksums key = %016lX value = %016lX\n", cs[0], cs[1]); #endif - if (iod_kv_set(oh, tid, hints, &kv, cs, event) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(oh, tid, hints, &kv, cs, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "can't set KV pair for dataspace"); } else { - if (iod_kv_set(oh, tid, hints, &kv, NULL, event) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(oh, tid, hints, &kv, NULL, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "can't set KV pair for dataspace"); } done: @@ -847,6 +875,7 @@ H5VL_iod_insert_new_link(iod_handle_t oh, iod_trans_id_t tid, const char *link_n void *value = NULL; uint8_t *val_ptr = NULL; size_t value_len; + iod_ret_t ret; herr_t ret_value = SUCCEED; switch(link_type) { @@ -896,12 +925,14 @@ H5VL_iod_insert_new_link(iod_handle_t oh, iod_trans_id_t tid, const char *link_n fprintf(stderr, "Link Type Checksums key = %016lX value = %016lX\n", cs[0], cs[1]); #endif - if (iod_kv_set(oh, tid, hints, &kv, cs, event) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(oh, tid, hints, &kv, cs, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "can't set KV pair for link"); } else { - if (iod_kv_set(oh, tid, hints, &kv, NULL, event) < 0) - HGOTO_ERROR_FF(FAIL, "can't set KV pair in parent"); + ret = iod_kv_set(oh, tid, hints, &kv, NULL, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "can't set KV pair for link"); } done: @@ -926,12 +957,13 @@ done: */ herr_t H5VL_iod_get_metadata(iod_handle_t oh, iod_trans_id_t tid, H5VL_iod_metadata_t md_type, - const char *key, uint32_t cs_scope, iod_event_t *event, void *ret) + const char *key, uint32_t cs_scope, iod_event_t *event, void *md_value) { iod_size_t key_size = strlen(key); iod_size_t val_size = 0; void *value = NULL; iod_checksum_t *iod_cs = NULL; + iod_ret_t ret; herr_t ret_value = SUCCEED; if(cs_scope & H5_CHECKSUM_IOD) { @@ -943,19 +975,21 @@ H5VL_iod_get_metadata(iod_handle_t oh, iod_trans_id_t tid, H5VL_iod_metadata_t m { hid_t plist_id; - if(iod_kv_get_value(oh, tid, key, key_size, NULL, &val_size, NULL, event) < 0) - HGOTO_ERROR_FF(FAIL, "lookup failed"); + ret = iod_kv_get_value(oh, tid, key, key_size, NULL, &val_size, NULL, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "plist lookup failed"); if(NULL == (value = malloc((size_t)val_size))) HGOTO_ERROR_FF(FAIL, "can't allocate value buffer"); - if(iod_kv_get_value(oh, tid, key, key_size, (char *)value, &val_size, iod_cs, event) < 0) - HGOTO_ERROR_FF(FAIL, "lookup failed"); + ret = iod_kv_get_value(oh, tid, key, key_size, (char *)value, &val_size, iod_cs, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "plist lookup failed"); if((plist_id = H5Pdecode(value)) < 0) HGOTO_ERROR_FF(FAIL, "failed to decode cpl"); - *((hid_t *)ret) = plist_id; + *((hid_t *)md_value) = plist_id; break; } case H5VL_IOD_LINK_COUNT: @@ -963,47 +997,52 @@ H5VL_iod_get_metadata(iod_handle_t oh, iod_trans_id_t tid, H5VL_iod_metadata_t m if(NULL == (value = malloc((size_t)val_size))) HGOTO_ERROR_FF(FAIL, "can't allocate value buffer"); - if(iod_kv_get_value(oh, tid, key, key_size, (char *)value, &val_size, iod_cs, event) < 0) - HGOTO_ERROR_FF(FAIL, "link_count lookup failed"); + ret = iod_kv_get_value(oh, tid, key, key_size, (char *)value, &val_size, iod_cs, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "link_count lookup failed"); - memcpy(ret, value, val_size); + memcpy(md_value, value, val_size); break; case H5VL_IOD_DATATYPE: { hid_t type_id; - if(iod_kv_get_value(oh, tid, key, key_size, NULL, &val_size, NULL, event) < 0) - HGOTO_ERROR_FF(FAIL, "lookup failed"); + ret = iod_kv_get_value(oh, tid, key, key_size, NULL, &val_size, NULL, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "datatype lookup failed"); if(NULL == (value = malloc((size_t)val_size))) HGOTO_ERROR_FF(FAIL, "can't allocate value buffer"); - if(iod_kv_get_value(oh, tid, key, key_size, (char *)value, &val_size, iod_cs, event) < 0) - HGOTO_ERROR_FF(FAIL, "lookup failed"); + ret = iod_kv_get_value(oh, tid, key, key_size, (char *)value, &val_size, iod_cs, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "datatype lookup failed"); if((type_id = H5Tdecode(value)) < 0) HGOTO_ERROR_FF(FAIL, "failed to decode datatype"); - *((hid_t *)ret) = type_id; + *((hid_t *)md_value) = type_id; break; } case H5VL_IOD_DATASPACE: { hid_t space_id; - if(iod_kv_get_value(oh, tid, key, key_size, NULL, &val_size, NULL, event) < 0) - HGOTO_ERROR_FF(FAIL, "lookup failed"); + ret = iod_kv_get_value(oh, tid, key, key_size, NULL, &val_size, NULL, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "dataspace lookup failed"); if(NULL == (value = malloc((size_t)val_size))) HGOTO_ERROR_FF(FAIL, "can't allocate value buffer"); - if(iod_kv_get_value(oh, tid, key, key_size, (char *)value, &val_size, iod_cs, event) < 0) - HGOTO_ERROR_FF(FAIL, "lookup failed"); + ret = iod_kv_get_value(oh, tid, key, key_size, (char *)value, &val_size, iod_cs, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "dataspace lookup failed"); if((space_id = H5Sdecode(value)) < 0) HGOTO_ERROR_FF(FAIL, "failed to decode dataspace"); - *((hid_t *)ret) = space_id; + *((hid_t *)md_value) = space_id; break; } case H5VL_IOD_OBJECT_TYPE: @@ -1011,26 +1050,27 @@ H5VL_iod_get_metadata(iod_handle_t oh, iod_trans_id_t tid, H5VL_iod_metadata_t m if(NULL == (value = malloc((size_t)val_size))) HGOTO_ERROR_FF(FAIL, "can't allocate value buffer"); - if(iod_kv_get_value(oh, tid, key, key_size, (char *)value, &val_size, iod_cs, event) < 0) - HGOTO_ERROR_FF(FAIL, "link_count lookup failed"); + ret = iod_kv_get_value(oh, tid, key, key_size, (char *)value, &val_size, iod_cs, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "object type lookup failed"); - memcpy(ret, value, val_size); + memcpy(md_value, value, val_size); break; case H5VL_IOD_LINK: { - H5VL_iod_link_t *iod_link = (H5VL_iod_link_t *)ret; + H5VL_iod_link_t *iod_link = (H5VL_iod_link_t *)md_value; uint8_t *val_ptr; - iod_ret_t iod_ret; - if((iod_ret = iod_kv_get_value(oh, tid, key, key_size, NULL, &val_size, NULL, event)) < 0) { - fprintf(stderr, "%d (%s).\n", iod_ret, strerror(-iod_ret)); - HGOTO_ERROR_FF(FAIL, "lookup failed"); - } + ret = iod_kv_get_value(oh, tid, key, key_size, NULL, &val_size, NULL, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "link lookup failed"); + if(NULL == (value = malloc((size_t)val_size))) HGOTO_ERROR_FF(FAIL, "can't allocate value buffer"); - if(iod_kv_get_value(oh, tid, key, key_size, (char *)value, &val_size, iod_cs, event) < 0) - HGOTO_ERROR_FF(FAIL, "lookup failed"); + ret = iod_kv_get_value(oh, tid, key, key_size, (char *)value, &val_size, iod_cs, event); + if(ret != 0) + HGOTO_ERROR_FF(ret, "link lookup failed"); val_ptr = (uint8_t *)value; |