/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the files COPYING and Copyright.html. COPYING can be found at the root * * of the source code distribution tree; Copyright.html can be found at the * * root level of an installed copy of the electronic HDF5 document set and * * is linked from the top-level documents page. It can also be found at * * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #define H5G_PACKAGE /*suppress error about including H5Gpkg */ #include "H5Gpkg.h" /* Groups */ #include "H5Sprivate.h" /* Dataspaces */ #include "H5WBprivate.h" /* Wrapped Buffers */ #include "H5VLiod_server.h" #ifdef H5_HAVE_EFF static H5I_type_t H5VL__iod_get_h5_obj_type(iod_obj_id_t oid, iod_handle_t coh, iod_trans_id_t rtid, uint32_t cs_scope); /* * Programmer: Mohamad Chaarawi * February, 2013 * * Purpose: The IOD plugin server utility routines. */ /*------------------------------------------------------------------------- * Function: H5VL_iod_server_traverse * * Purpose: * Function to Traverse the path in IOD KV objects given the * starting location ID, object handle, and path name. This walks * through the IOD KV objects to get to the last component in the * path. The last component is not opened. Usually this is called when * creating an object. The Function returns the iod ID and object * handle of the before to last component, and the last component * string, if the user requests it. * * Return: Success: SUCCEED * Failure: Negative * *------------------------------------------------------------------------- */ herr_t H5VL_iod_server_traverse(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t loc_handle, const char *path, iod_trans_id_t wtid, iod_trans_id_t rtid, hbool_t create_interm_grps, uint32_t cs_scope, /* out */char **last_comp, /* out */iod_obj_id_t *iod_id, /* out */iod_handles_t *iod_oh) { char comp_buf[1024]; /* Temporary buffer for path components */ char *comp; /* Pointer to buffer for path components */ H5WB_t *wb = NULL; /* Wrapped buffer for temporary buffer */ size_t nchars; /* component name length */ 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 */ assert(FALSE == create_interm_grps); cur_oh.rd_oh.cookie = loc_handle.rd_oh.cookie; cur_oh.wr_oh.cookie = loc_handle.wr_oh.cookie; cur_id = loc_id; /* open the current group */ if(cur_oh.rd_oh.cookie == IOD_OH_UNDEFINED) { if (iod_obj_open_read(coh, loc_id, wtid, NULL, &cur_oh.rd_oh, NULL) < 0) HGOTO_ERROR_FF(FAIL, "can't open current group"); } /* Wrap the local buffer for serialized header info */ if(NULL == (wb = H5WB_wrap(comp_buf, sizeof(comp_buf)))) HGOTO_ERROR_FF(FAIL, "can't wrap buffer") /* Get a pointer to a buffer that's large enough */ if(NULL == (comp = (char *)H5WB_actual(wb, (HDstrlen(path) + 1)))) HGOTO_ERROR_FF(FAIL, "can't get actual buffer") /* Traverse the path */ while((path = H5G__component(path, &nchars)) && *path) { const char *s; /* Temporary string pointer */ iod_size_t kv_size; H5VL_iod_link_t value; /* Copy the component path into a null-terminated buffer. */ HDmemcpy(comp, path, nchars); comp[nchars] = '\0'; /* * The special path `.' is a no-op. */ if('.' == comp[0] && !comp[1]) { path += nchars; continue; } /* end if */ /* Check if this is the last component of the path */ if(!((s = H5G__component(path + nchars, NULL)) && *s)) { if(last_comp) { *last_comp = HDstrdup(comp); } break; } kv_size = sizeof(H5VL_iod_link_t); prev_oh.cookie = cur_oh.rd_oh.cookie; /* lookup next object in the current group */ 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) { if('/' == *value.u.symbolic_name) { cur_id = ROOT_ID; } /* Traverse Path and open the target 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); } else cur_id = value.u.iod_id; /* Close previous read handle unless it is the original one */ if(loc_handle.rd_oh.cookie != prev_oh.cookie) { ret = iod_obj_close(prev_oh, NULL, NULL); if(ret < 0) HGOTO_ERROR_FF(ret, "failed to close IOD object"); } /* open the 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; } /* end while */ /* Release temporary component buffer */ if(wb && H5WB_unwrap(wb) < 0) HGOTO_ERROR_FF(FAIL, "can't release wrapped buffer"); *iod_id = cur_id; (*iod_oh).rd_oh.cookie = cur_oh.rd_oh.cookie; if(cur_id != loc_id || loc_handle.wr_oh.cookie == IOD_OH_UNDEFINED) { /* open a write handle on the ID. */ 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; done: return ret_value; } /*------------------------------------------------------------------------- * Function: H5VL_iod_server_open_path * * Purpose: Function to Traverse the path in IOD KV objects given the * starting location ID, object handle, and path name. This walks * through the IOD KV objects to get to the last component in the path * and opens the last component for read only, i.e. does not open the * wr_oh, but will set it to undefined. Usually this is called when * opening an object. * * Return: Success: SUCCEED * Failure: Negative * *------------------------------------------------------------------------- */ herr_t H5VL_iod_server_open_path(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t loc_handle, const char *path, iod_trans_id_t rtid, uint32_t cs_scope, /*out*/iod_obj_id_t *iod_id, /*out*/iod_handles_t *iod_oh) { char comp_buf[1024]; /* Temporary buffer for path components */ char *comp; /* Pointer to buffer for path components */ H5WB_t *wb = NULL; /* Wrapped buffer for temporary buffer */ size_t nchars; /* component name length */ 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; cur_oh.wr_oh.cookie = loc_handle.wr_oh.cookie; cur_id = loc_id; if(cur_oh.rd_oh.cookie == IOD_OH_UNDEFINED) { /* open the current group */ if (iod_obj_open_read(coh, loc_id, rtid, NULL, &cur_oh.rd_oh, NULL) < 0) HGOTO_ERROR_FF(FAIL, "can't open start location"); } /* Wrap the local buffer for serialized header info */ if(NULL == (wb = H5WB_wrap(comp_buf, sizeof(comp_buf)))) HGOTO_ERROR_FF(FAIL, "can't wrap buffer") /* Get a pointer to a buffer that's large enough */ if(NULL == (comp = (char *)H5WB_actual(wb, (HDstrlen(path) + 1)))) HGOTO_ERROR_FF(FAIL, "can't get actual buffer") /* Traverse the path */ while((path = H5G__component(path, &nchars)) && *path) { iod_size_t kv_size; H5VL_iod_link_t value; /* Copy the component path into a null-terminated buffer. */ HDmemcpy(comp, path, nchars); comp[nchars] = '\0'; /* * The special path `.' is a no-op. */ if('.' == comp[0] && !comp[1]) { path += nchars; continue; } /* end if */ kv_size = sizeof(H5VL_iod_link_t); prev_oh.cookie = cur_oh.rd_oh.cookie; /* lookup next object in the current group */ 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(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 */ if(H5L_TYPE_SOFT == value.link_type) { if('/' == *value.u.symbolic_name) { cur_id = ROOT_ID; } /* Traverse Path and open the target 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); } else cur_id = value.u.iod_id; /* 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"); /* open the 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; } /* end while */ /* Release temporary component buffer */ if(wb && H5WB_unwrap(wb) < 0) HGOTO_ERROR_FF(FAIL, "can't release wrapped buffer"); *iod_id = cur_id; (*iod_oh).rd_oh.cookie = cur_oh.rd_oh.cookie; (*iod_oh).wr_oh.cookie = IOD_OH_UNDEFINED; done: return ret_value; } /*------------------------------------------------------------------------- * Function: H5VL_iod_get_file_desc * * Purpose: * Function to generate IOD hyperslab objects from HDF5 * dataspace selections. If hslabs is NULL, a count of the number of * hslabs needed is returned in count. * * Return: Success: SUCCEED * Failure: Negative * *------------------------------------------------------------------------- */ herr_t H5VL_iod_get_file_desc(hid_t space_id, hssize_t *count, iod_hyperslab_t *hslabs) { hssize_t num_descriptors = 0, n; int ndims = 0, i; herr_t ret_value = SUCCEED; /* get the rank of this dataspace */ if((ndims = H5Sget_simple_extent_ndims(space_id)) < 0) HGOTO_ERROR_FF(FAIL, "unable to get dataspace dimesnsion"); switch(H5Sget_select_type(space_id)) { case H5S_SEL_NONE: /* nothing selected */ num_descriptors = 0; HGOTO_DONE_FF(SUCCEED); case H5S_SEL_ALL: /* The entire dataspace is selected, 1 large iod hyperslab is needed */ num_descriptors = 1; if(NULL != hslabs) { hsize_t dims[H5S_MAX_RANK]; /* get the dimensions sizes of the dataspace */ if(H5Sget_simple_extent_dims(space_id, dims, NULL) < 0) HGOTO_ERROR_FF(FAIL, "unable to get dataspace dimesnsion sizes"); /* populate the hyperslab */ for(i=0 ; ilink_type = *((H5L_type_t *)val_ptr); val_ptr += sizeof(H5L_type_t); switch(iod_link->link_type) { case H5L_TYPE_HARD: iod_link->u.iod_id = *((iod_obj_id_t *)val_ptr); break; case H5L_TYPE_SOFT: iod_link->u.symbolic_name = strdup((char *)val_ptr); break; case H5L_TYPE_ERROR: case H5L_TYPE_EXTERNAL: case H5L_TYPE_MAX: default: HGOTO_ERROR_FF(FAIL, "unsupported link type"); } break; } default: HGOTO_ERROR_FF(FAIL, "invalide metadata type"); } if(cs_scope & H5_CHECKSUM_IOD) { iod_checksum_t cs[2]; cs[0] = H5_checksum_crc64(key, key_size); cs[1] = H5_checksum_crc64(value, val_size); #if H5_EFF_DEBUG fprintf(stderr, "Key CS iod = %016lX computed = %016lX\n", iod_cs[0], cs[0]); fprintf(stderr, "Value CS iod = %016lX computed = %016lX\n", iod_cs[1], cs[1]); #endif if(iod_cs[0] != cs[0] || iod_cs[1] != cs[1]) HGOTO_ERROR_FF(FAIL, "Corruption detected when reading metadata from IOD"); } done: if(value) { free(value); value = NULL; } if(iod_cs) { free(iod_cs); iod_cs = NULL; } return ret_value; } /*------------------------------------------------------------------------- * Function: H5VL__iod_server_adjust_buffer * * Checks datatypes to see if type conversion is required, if * yes, the buffer is resized accordingly. * * Return: Success: SUCCEED * Failure: Negative * * Programmer: Mohamad Chaarawi * August, 2013 * *------------------------------------------------------------------------- */ herr_t H5VL__iod_server_adjust_buffer(hid_t mem_type_id, hid_t dset_type_id, size_t nelmts, hid_t UNUSED dxpl_id, na_bool_t is_coresident, size_t size, void **buf, hbool_t *is_vl_data, size_t *_buf_size) { herr_t ret_value = SUCCEED; if(H5VL__iod_server_type_is_vl(dset_type_id, is_vl_data) < 0) HGOTO_ERROR_FF(FAIL, "failed to check dataype"); if(!(*is_vl_data)) { hsize_t buf_size = 0; size_t mem_type_size, dset_type_size; /* retrieve source and destination datatype sizes for data conversion */ mem_type_size = H5Tget_size(mem_type_id); dset_type_size = H5Tget_size(dset_type_id); /* adjust buffer size for data conversion */ if(mem_type_size < dset_type_size) { buf_size = dset_type_size * nelmts; /* if we are coresident, and buffer extension is required, make a new buffer so we don't mess with the user buffer. */ if(is_coresident) { void *new_buf = NULL; if(NULL == (new_buf = malloc((size_t)buf_size))) HGOTO_ERROR_FF(FAIL, "Can't malloc new buffer for DT conversion"); memcpy(new_buf, *buf, size); *buf = new_buf; } else { if(NULL == (*buf = realloc(*buf, (size_t)buf_size))) HGOTO_ERROR_FF(FAIL, "Can't adjust buffer for DT conversion"); } #if H5_EFF_DEBUG fprintf(stderr, "Adjusted Buffer size for dt conversion from %zu to %lld\n", size, buf_size); #endif } else { buf_size = mem_type_size * nelmts; if(buf_size != size) HGOTO_ERROR_FF(FAIL, "Incoming data size is not equal to expected size"); } *_buf_size = buf_size; } else { *_buf_size = size; } done: return ret_value; } /* end H5VL__iod_server_adjust_buffer */ /*------------------------------------------------------------------------- * Function: H5VL__iod_server_type_is_vl * * Checks datatypes to see if it's Variable length. * * Return: Success: SUCCEED * Failure: Negative * * Programmer: Mohamad Chaarawi * August, 2013 * *------------------------------------------------------------------------- */ herr_t H5VL__iod_server_type_is_vl(hid_t type_id, hbool_t *is_vl_data) { herr_t ret_value = SUCCEED; switch(H5Tget_class(type_id)) { case H5T_STRING: if(H5Tis_variable_str(type_id)) { *is_vl_data = TRUE; break; } case H5T_INTEGER: case H5T_FLOAT: case H5T_TIME: case H5T_BITFIELD: case H5T_OPAQUE: case H5T_ENUM: case H5T_ARRAY: case H5T_NO_CLASS: case H5T_REFERENCE: case H5T_NCLASSES: case H5T_COMPOUND: *is_vl_data = FALSE; break; case H5T_VLEN: *is_vl_data = TRUE; break; default: HGOTO_ERROR_FF(FAIL, "unsupported datatype"); } done: return ret_value; } /* end H5VL__iod_server_type_is_vl */ /*------------------------------------------------------------------------- * Function: H5VL_iod_verify_scratch_pad * * Purpose: Function to insert the link count in an * IOD KV object. * * Return: Success: SUCCEED * Failure: Negative * *------------------------------------------------------------------------- */ herr_t H5VL_iod_verify_scratch_pad(scratch_pad *sp, iod_checksum_t iod_cs) { iod_checksum_t computed_cs = 0; herr_t ret_value = SUCCEED; computed_cs = H5_checksum_crc64(sp, sizeof(scratch_pad)); if(computed_cs != iod_cs) { fprintf(stderr, "Scratch pad integrity check failed. IOD cs = %"PRIu64", Computed cs = %"PRIu64"\n", iod_cs, computed_cs); ret_value = FAIL; } return ret_value; } /* end H5VL_iod_verify_scratch_pad() */ herr_t H5VL_iod_verify_kv_pair(void *key, iod_size_t key_size, void *value, iod_size_t val_size, iod_checksum_t *iod_cs) { iod_checksum_t cs[2]; herr_t ret_value = SUCCEED; cs[0] = H5_checksum_crc64(key, key_size); cs[1] = H5_checksum_crc64(value, val_size); #if H5_EFF_DEBUG fprintf(stderr, "Key CS iod = %016lX computed = %016lX\n", iod_cs[0], cs[0]); fprintf(stderr, "Value CS iod = %016lX computed = %016lX\n", iod_cs[1], cs[1]); #endif if(iod_cs[0] != cs[0] && iod_cs[1] != cs[1]) HGOTO_ERROR_FF(FAIL, "Corruption detected in IOD KV pair"); done: return ret_value; } /* H5VL_iod_verify_kv_pair */ /*------------------------------------------------------------------------- * Function: H5VL__iod_get_h5_obj_type * * Purpose: Function to retrieve the HDF5 object type of an IOD object. * * Return: Success: SUCCEED * Failure: Negative * *------------------------------------------------------------------------- */ static H5I_type_t H5VL__iod_get_h5_obj_type(iod_obj_id_t oid, iod_handle_t coh, iod_trans_id_t rtid, uint32_t cs_scope) { iod_handle_t mdkv_oh, oh; H5I_type_t obj_type; iod_obj_type_t iod_type; herr_t ret_value = -1; iod_type = IOD_OBJID_GETTYPE(oid); if(IOD_OBJ_ARRAY == iod_type) obj_type = H5I_DATASET; else if(IOD_OBJ_BLOB == iod_type) obj_type = H5I_DATATYPE; else { scratch_pad sp; iod_checksum_t sp_cs = 0; if (iod_obj_open_read(coh, oid, rtid, NULL /*hints*/, &oh, NULL) < 0) HGOTO_ERROR_FF(FAIL, "can't open object"); /* get scratch pad of the object */ if(iod_obj_get_scratch(oh, rtid, &sp, &sp_cs, NULL) < 0) HGOTO_ERROR_FF(FAIL, "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) HGOTO_ERROR_FF(FAIL, "Scratch Pad failed integrity check"); } /* 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(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(iod_obj_close(mdkv_oh, NULL, NULL) < 0) HGOTO_ERROR_FF(FAIL, "can't close current object handle"); if(iod_obj_close(oh, NULL, NULL) < 0) HGOTO_ERROR_FF(FAIL, "can't close current object handle"); } ret_value = obj_type; done: return ret_value; } /* end H5VL__iod_get_h5_obj_type() */ /*------------------------------------------------------------------------- * Function: H5VL_iod_server_iterate * * Purpose: * * Return: Success: SUCCEED * Failure: Negative * *------------------------------------------------------------------------- */ herr_t H5VL_iod_server_iterate(iod_handle_t coh, iod_obj_id_t obj_id, iod_trans_id_t rtid, H5I_type_t obj_type, const char *link_name, const char *attr_name, uint32_t cs_scope, H5VL_iterate_op_t op, void *op_data) { iod_handle_t obj_oh; herr_t ret; herr_t ret_value = SUCCEED; ret = (*op)(coh, obj_id, rtid, obj_type, link_name, attr_name, cs_scope, op_data); if(ret != 0) HGOTO_ERROR_FF(FAIL, "can't apply iterate callback on current object"); if (iod_obj_open_read(coh, obj_id, rtid, NULL, &obj_oh, NULL) < 0) HGOTO_ERROR_FF(FAIL, "can't open current group"); /* Get the object type, if it is not a group do not check for links */ if(H5I_GROUP == obj_type || H5I_FILE == obj_type) { int num_entries = 0; /* Get the object ID and iterate into every member in the group */ ret = iod_kv_get_num(obj_oh, rtid, &num_entries, NULL); if(ret != 0) HGOTO_ERROR_FF(FAIL, "can't get number of KV entries"); if(0 != num_entries) { iod_kv_params_t *kvs = NULL; iod_kv_t *kv = NULL; iod_checksum_t *oid_cs = NULL; iod_ret_t *oid_ret = NULL; int i; kvs = (iod_kv_params_t *)malloc(sizeof(iod_kv_params_t) * (size_t)num_entries); kv = (iod_kv_t *)malloc(sizeof(iod_kv_t) * (size_t)num_entries); oid_cs = (iod_checksum_t *)malloc(sizeof(iod_checksum_t) * (size_t)num_entries); oid_ret = (iod_ret_t *)malloc(sizeof(iod_ret_t) * (size_t)num_entries); for(i=0 ; ioid, obj_map->type); fprintf(stderr, "n_bb_loc %d:\n", obj_map->n_bb_loc); for (i = 0; i < obj_map->n_bb_loc ; i++) { iod_bb_loc_info_t *info = obj_map->bb_loc_infos[i]; int j; fprintf(stderr, "Shadow path: %s nrank = %d:\n", info->shadow_path, info->nrank); for(j=0 ; jnrank; j++) fprintf(stderr, "%d ", info->direct_ranks[j]); fprintf(stderr, "\n"); } fprintf(stderr, "n_central_loc %d:\n", obj_map->n_central_loc); for (i = 0; i < obj_map->n_central_loc ; i++) { iod_central_loc_info_t *info = obj_map->central_loc_infos[i]; int j; fprintf(stderr, "Shard ID: %u nrank = %d:\n", info->shard_id, info->nrank); for(j=0 ; jnrank; j++) fprintf(stderr, "%d ", info->nearest_ranks[j]); fprintf(stderr, "\n"); } switch(obj_map->type) { case IOD_OBJ_BLOB: { fprintf(stderr, "nranges = %d\n", obj_map->u_map.blob_map.n_range); for(u = 0; u < obj_map->u_map.blob_map.n_range ; u++) { fprintf(stderr, "offset: %"PRIu64" length: %zu location: %d index: %d nearest rank: %d\n", obj_map->u_map.blob_map.blob_range[u].offset, obj_map->u_map.blob_map.blob_range[u].len, obj_map->u_map.blob_map.blob_range[u].loc_type, obj_map->u_map.blob_map.blob_range[u].loc_index, obj_map->u_map.blob_map.blob_range[u].nearest_rank); } break; } case IOD_OBJ_ARRAY: { fprintf(stderr, "nranges = %d\n", obj_map->u_map.array_map.n_range); for(u = 0; u < obj_map->u_map.array_map.n_range ; u++) { fprintf(stderr, "location: %d index: %d nearest rank: %d\n", obj_map->u_map.array_map.array_range[u].loc_type, obj_map->u_map.array_map.array_range[u].loc_index, obj_map->u_map.array_map.array_range[u].nearest_rank); fprintf(stderr, "start [%"PRIu64"] end [%"PRIu64"]\n", obj_map->u_map.array_map.array_range[u].start_cell[0], obj_map->u_map.array_map.array_range[u].end_cell[0]); } break; } break; case IOD_OBJ_KV: case IOD_OBJ_INVALID: case IOD_OBJ_ANY: default: break; } } #if 0 herr_t H5VL_iod_map_type_convert(hid_t src_id, hid_t dst_id, void *buf, size_t buf_size) { H5T_class_t class; herr_t ret_value = SUCCEED; class = H5Tget_class(src_id); if(H5T_VLEN == class || (H5T_STRING == class && H5Tis_variable_str(src_id))) HGOTO_ERROR_FF(FAIL, "Can't convert VL or string types"); class = H5Tget_class(dset_id); if(H5T_VLEN == class || (H5T_STRING == class && H5Tis_variable_str(dst_id))) HGOTO_ERROR_FF(FAIL, "Can't convert VL or string types"); /* Check (and do) Type conversion on the Key */ src_size = H5Tget_size(src_id); dst_size = H5Tget_size(dst_id); /* adjust buffer size for datatype conversion */ if(src_size < dst_size) { new_size = dst_size; if(NULL == (*buf = realloc(*buf, new_size))) HGOTO_ERROR_FF(FAIL, "Can't adjust buffer for DT conversion"); } else { new_size = src_size; } if(NULL == (key_buf = malloc((size_t)key_size))) HGOTO_ERROR_FF(FAIL, "can't allocate buffer"); memcpy(key_buf, key.buf, src_size); if(H5Tconvert(src_id, dst_id, 1, key_buf, NULL, dxpl_id) < 0) HGOTO_ERROR_FF(FAIL, "data type conversion failed") done: return ret_value; } #endif #endif /* H5_HAVE_EFF */