diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2019-03-19 16:52:19 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2019-03-19 16:52:19 (GMT) |
commit | 23a23d785844e4a15582ac5fe4f0609749f56450 (patch) | |
tree | 6139c3acd73f9c7aabc7bb6acfda6209f2741728 | |
parent | 35c4b78dac4313f0fd2ac5cd146ec2ed868733d3 (diff) | |
download | hdf5-23a23d785844e4a15582ac5fe4f0609749f56450.zip hdf5-23a23d785844e4a15582ac5fe4f0609749f56450.tar.gz hdf5-23a23d785844e4a15582ac5fe4f0609749f56450.tar.bz2 |
Hacked up the RADOS VOL connector code to use the latest VOL changes.
-rw-r--r-- | src/H5Pfapl.c | 32 | ||||
-rw-r--r-- | src/H5Pprivate.h | 1 | ||||
-rw-r--r-- | src/H5VLrados.c | 598 | ||||
-rw-r--r-- | src/H5VLrados_public.h | 4 |
4 files changed, 106 insertions, 529 deletions
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 57b20d7..7b2aa10 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -5012,6 +5012,34 @@ H5Pget_vol_info(hid_t plist_id, void **vol_info) if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + /* Call the internal function */ + if(H5P_get_vol_info(plist, vol_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector info") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_vol_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_get_vol_info + * + * Purpose: Private version of H5Pget_vol_info(). + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5P_get_vol_info(H5P_genplist_t *plist, void **vol_info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(plist); + /* Get the current VOL info */ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { void *new_connector_info = NULL; /* Copy of connector info */ @@ -5041,8 +5069,8 @@ H5Pget_vol_info(hid_t plist_id, void **vol_info) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pget_vol_info() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_get_vol_info() */ /*------------------------------------------------------------------------- diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 866f088..afda66e 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -169,6 +169,7 @@ H5_DLL herr_t H5P_remove(H5P_genplist_t *plist, const char *name); H5_DLL htri_t H5P_exist_plist(const H5P_genplist_t *plist, const char *name); H5_DLL htri_t H5P_class_isa(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2); H5_DLL char *H5P_get_class_name(H5P_genclass_t *pclass); +H5_DLL herr_t H5P_get_vol_info(H5P_genplist_t *plist, void **vol_info); /* Internal helper routines */ H5_DLL herr_t H5P_get_nprops_pclass(const H5P_genclass_t *pclass, size_t *nprops, diff --git a/src/H5VLrados.c b/src/H5VLrados.c index 0ee5c92..74defdb 100644 --- a/src/H5VLrados.c +++ b/src/H5VLrados.c @@ -50,7 +50,6 @@ hid_t H5VL_RADOS_g = -1; /* Definitions for building oids */ #define H5VL_RADOS_IDX_MASK 0x3fffffffffffffffull -#define H5VL_RADOS_TYPE_MASK 0xc000000000000000ull #define H5VL_RADOS_TYPE_GRP 0x0000000000000000ull #define H5VL_RADOS_TYPE_DSET 0x4000000000000000ull #define H5VL_RADOS_TYPE_DTYPE 0x8000000000000000ull @@ -81,25 +80,6 @@ typedef struct H5VL_rados_scatter_cb_ud_t { size_t len; } H5VL_rados_scatter_cb_ud_t; -#if 0 -/* Udata type for memory space H5Diterate callback */ -typedef struct { - daos_iod_t *iods; - daos_sg_list_t *sgls; - daos_iov_t *sg_iovs; - hbool_t is_vl_str; - size_t base_type_size; - uint64_t offset; - uint64_t idx; -} H5VL_rados_vl_mem_ud_t; - -/* Udata type for file space H5Diterate callback */ -typedef struct { - uint8_t **akeys; - daos_iod_t *iods; - uint64_t idx; -} H5VL_rados_vl_file_ud_t; -#endif /* Information about a singular selected chunk during a Dataset read/write */ typedef struct H5VL_rados_select_chunk_info_t { @@ -115,39 +95,32 @@ typedef struct H5VL_rados_select_chunk_info_t { */ static void *H5VL_rados_fapl_copy(const void *_old_fa); static herr_t H5VL_rados_fapl_free(void *_fa); -static herr_t H5VL_rados_term(hid_t vtpl_id); +static herr_t H5VL_rados_term(void); /* File callbacks */ static void *H5VL_rados_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); static void *H5VL_rados_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); -//static herr_t H5VL_iod_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_rados_file_specific(void *_item, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_rados_file_close(void *_file, hid_t dxpl_id, void **req); /* Link callbacks */ -/*static herr_t H5VL_rados_link_create(H5VL_link_create_type_t create_type, - void *_item, H5VL_loc_params_t loc_params, hid_t lcpl_id, hid_t lapl_id, - hid_t dxpl_id, void **req); -static herr_t H5VL_rados_link_specific(void *_item, - H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments);*/ /* Group callbacks */ -static void *H5VL_rados_group_create(void *_item, H5VL_loc_params_t loc_params, +static void *H5VL_rados_group_create(void *_item, const H5VL_loc_params_t *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); -static void *H5VL_rados_group_open(void *_item, H5VL_loc_params_t loc_params, +static void *H5VL_rados_group_open(void *_item, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); static herr_t H5VL_rados_group_close(void *_grp, hid_t dxpl_id, void **req); /* Dataset callbacks */ static void *H5VL_rados_dataset_create(void *_item, - H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, + const H5VL_loc_params_t *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -static void *H5VL_rados_dataset_open(void *_item, H5VL_loc_params_t loc_params, +static void *H5VL_rados_dataset_open(void *_item, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); static herr_t H5VL_rados_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf, @@ -155,44 +128,15 @@ static herr_t H5VL_rados_dataset_read(void *_dset, hid_t mem_type_id, static herr_t H5VL_rados_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req); -/*static herr_t H5VL_rados_dataset_specific(void *_dset, H5VL_dataset_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments);*/ static herr_t H5VL_rados_dataset_get(void *_dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL_rados_dataset_close(void *_dset, hid_t dxpl_id, void **req); /* Datatype callbacks */ -/*static void *H5VL_rados_datatype_commit(void *obj, H5VL_loc_params_t loc_params, - const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, - hid_t tapl_id, hid_t dxpl_id, void **req); -static void *H5VL_rados_datatype_open(void *_item, H5VL_loc_params_t loc_params, - const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_rados_datatype_get(void *obj, H5VL_datatype_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments);*/ /* Object callbacks */ -/*static void *H5VL_rados_object_open(void *_item, H5VL_loc_params_t loc_params, - H5I_type_t *opened_type, hid_t dxpl_id, void **req); -static herr_t H5VL_rados_object_optional(void *_item, hid_t dxpl_id, void **req, - va_list arguments);*/ /* Attribute callbacks */ -/*static void *H5VL_rados_attribute_create(void *_obj, - H5VL_loc_params_t loc_params, const char *name, hid_t acpl_id, - hid_t aapl_id, hid_t dxpl_id, void **req); -static void *H5VL_rados_attribute_open(void *_obj, H5VL_loc_params_t loc_params, - const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_rados_attribute_read(void *_attr, hid_t mem_type_id, - void *buf, hid_t dxpl_id, void **req); -static herr_t H5VL_rados_attribute_write(void *_attr, hid_t mem_type_id, - const void *buf, hid_t dxpl_id, void **req); -static herr_t H5VL_rados_attribute_get(void *_item, H5VL_attr_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_rados_attribute_specific(void *_item, - H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_rados_attribute_close(void *_attr, hid_t dxpl_id, - void **req);*/ /* Helper routines */ static herr_t H5VL_rados_write_max_oid(H5VL_rados_file_t *file); @@ -248,35 +192,34 @@ static herr_t H5VL_rados_build_io_op_contig(H5S_t *file_space, size_t type_size, rados_write_op_t write_op); static herr_t H5VL_rados_scatter_cb(const void **src_buf, size_t *src_buf_bytes_used, void *_udata); -/*static herr_t H5VL_rados_dataset_mem_vl_rd_cb(void *_elem, hid_t type_id, - unsigned ndim, const hsize_t *point, void *_udata); -static herr_t H5VL_rados_dataset_file_vl_cb(void *_elem, hid_t type_id, - unsigned ndim, const hsize_t *point, void *_udata); -static herr_t H5VL_rados_dataset_mem_vl_wr_cb(void *_elem, hid_t type_id, - unsigned ndim, const hsize_t *point, void *_udata); - -static herr_t H5VL_rados_datatype_close(void *_dtype, hid_t dxpl_id, - void **req); - -static herr_t H5VL_rados_object_close(void *_obj, hid_t dxpl_id, void **req);*/ /* Free list definitions */ H5FL_DEFINE(H5VL_rados_file_t); H5FL_DEFINE(H5VL_rados_group_t); H5FL_DEFINE(H5VL_rados_dset_t); -/*H5FL_DEFINE(H5VL_rados_dtype_t); -H5FL_DEFINE(H5VL_rados_attr_t);*/ /* The RADOS VOL plugin struct */ static H5VL_class_t H5VL_rados_g = { - HDF5_VOL_RADOS_VERSION_1, /* Version number */ - H5_VOL_RADOS, /* Plugin value */ - "rados", /* name */ + H5VL_RADOS_VERSION, /* version */ + H5VL_RADOS_VALUE, /* value */ + H5VL_RADOS_NAME, /* name */ + 0, /* capability flags */ NULL, /* initialize */ H5VL_rados_term, /* terminate */ - sizeof(H5VL_rados_fapl_t), /*fapl_size */ - H5VL_rados_fapl_copy, /*fapl_copy */ - H5VL_rados_fapl_free, /*fapl_free */ + { /* info_cls - may need more here (DER) */ + sizeof(H5VL_rados_fapl_t), /* info size */ + H5VL_rados_fapl_copy, /* info copy */ + NULL, /* info compare */ + H5VL_rados_fapl_free, /* info free */ + NULL, /* info to str */ + NULL /* str to info */ + }, + { /* wrap_cls */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* wrap_object */ + NULL /* free_wrap_ctx */ + }, { /* attribute_cls */ NULL,//H5VL_rados_attribute_create, /* create */ NULL,//H5VL_rados_attribute_open, /* open */ @@ -336,12 +279,15 @@ static H5VL_class_t H5VL_rados_g = { NULL,//H5VL_iod_object_specific, /* specific */ NULL,//H5VL_rados_object_optional /* optional */ }, - { - NULL,//H5VL_iod_cancel, - NULL,//H5VL_iod_test, - NULL,//H5VL_iod_wait + { /* request_cls */ + NULL, /* wait */ + NULL, /* notify */ + NULL, /* cancel */ + NULL, /* specific */ + NULL, /* optional */ + NULL /* free */ }, - NULL + NULL /* optional */ }; /* The RADOS cluster */ @@ -692,6 +638,7 @@ H5VLrados_init(rados_t rados_cluster, const char *rados_pool) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) + H5TRACE2("e", "x*s", rados_cluster, rados_pool); /* Check if already initialized */ if(H5VL_RADOS_g >= 0) @@ -742,8 +689,6 @@ H5VL_rados_init(void) /* Register interfaces that might not be initialized in time (for example if * we open an object without knowing its type first, H5Oopen will not * initialize that type) */ - if(H5G_init() < 0) - HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize group interface") if(H5D_init() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize dataset interface") if(H5T_init() < 0) @@ -751,8 +696,7 @@ H5VL_rados_init(void) /* Register the RADOS VOL, if it isn't already */ if(NULL == H5I_object_verify(H5VL_RADOS_g, H5I_VOL)) { - if((H5VL_RADOS_g = H5VL_register((const H5VL_class_t *)&H5VL_rados_g, - sizeof(H5VL_class_t), TRUE)) < 0) + if((H5VL_RADOS_g = H5VL_register_connector((const H5VL_class_t *)&H5VL_rados_g, TRUE, H5P_DEFAULT)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, FAIL, "can't create ID for RADOS plugin") } /* end if */ @@ -782,7 +726,7 @@ H5VLrados_term(void) H5TRACE0("e",""); /* Terminate the plugin */ - if(H5VL_rados_term(-1) < 0) + if(H5VL_rados_term() < 0) HGOTO_ERROR(H5E_VOL, H5E_CLOSEERROR, FAIL, "can't close RADOS VOL plugin") done: @@ -800,7 +744,7 @@ done: *--------------------------------------------------------------------------- */ static herr_t -H5VL_rados_term(hid_t H5_ATTR_UNUSED vtpl_id) +H5VL_rados_term(void) { herr_t ret_value = SUCCEED; @@ -996,7 +940,7 @@ H5VL_rados_file_create(const char *name, unsigned flags, hid_t fcpl_id, /* Get information from the FAPL */ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(NULL == (fa = (H5VL_rados_fapl_t *)H5P_get_vol_info(plist))) + if(H5P_get_vol_info(plist, (void **)&fa) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get RADOS info struct") /* allocate the file object that is returned to the user */ @@ -1094,7 +1038,7 @@ H5VL_rados_file_open(const char *name, unsigned flags, hid_t fapl_id, /* Get information from the FAPL */ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(NULL == (fa = (H5VL_rados_fapl_t *)H5P_get_vol_info(plist))) + if(H5P_get_vol_info(plist, (void **)&fa) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "can't get RADOS info struct") /* allocate the file object that is returned to the user */ @@ -1331,6 +1275,7 @@ H5VL_rados_file_specific(void *item, H5VL_file_specific_t specific_type, case H5VL_FILE_UNMOUNT: /* H5Fis_accessible */ case H5VL_FILE_IS_ACCESSIBLE: + case H5VL_FILE_REOPEN: default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid or unsupported specific operation") } /* end switch */ @@ -1364,7 +1309,7 @@ H5VL_rados_file_close_helper(H5VL_rados_file_t *file, hid_t dxpl_id, void **req) /* Free file data structures */ if(file->file_name) HDfree(file->file_name); - file->glob_md_oid = H5MM_xfree(file->glob_md_oid); + file->glob_md_oid = (char *)(char *)(char *)(char *)(char *)(char *)(char *)(char *)(char *)H5MM_xfree(file->glob_md_oid); if(file->comm || file->info) if(H5FD_mpi_comm_info_free(&file->comm, &file->info) < 0) HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "Communicator/Info free failed") @@ -1612,7 +1557,7 @@ H5VL_rados_link_write(H5VL_rados_group_t *grp, const char *name, /* Allocate larger buffer for soft link if necessary */ val_len = HDstrlen(val->target.soft) + 1; if(val_len > sizeof(val_buf_static)) { - if(NULL == (val_buf_dyn = H5MM_malloc(val_len))) + if(NULL == (val_buf_dyn = (uint8_t *)H5MM_malloc(val_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate link value buffer") val_buf = val_buf_dyn; } /* end if */ @@ -2000,7 +1945,7 @@ H5VL_rados_group_create_helper(H5VL_rados_file_t *file, hid_t gcpl_id, HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, NULL, "can't serialize gcpl") /* Write internal metadata to group */ - if((ret = H5VL_rados_write_full(ioctx_g, grp->obj.oid, gcpl_buf, gcpl_size)) < 0) + if((ret = H5VL_rados_write_full(ioctx_g, grp->obj.oid, (char *)gcpl_buf, gcpl_size)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "can't write metadata to group: %s", strerror(-ret)) /* Mark max OID as dirty */ @@ -2056,7 +2001,7 @@ done: */ static void * H5VL_rados_group_create(void *_item, - H5VL_loc_params_t H5_ATTR_UNUSED loc_params, const char *name, + const H5VL_loc_params_t H5_ATTR_UNUSED *loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) { H5VL_rados_item_t *item = (H5VL_rados_item_t *)_item; @@ -2156,7 +2101,7 @@ H5VL_rados_group_open_helper(H5VL_rados_file_t *file, uint64_t oid, HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate buffer for serialized gcpl") /* Read internal metadata from group */ - if((ret = H5VL_rados_read(ioctx_g, grp->obj.oid, gcpl_buf, gcpl_len, 0)) < 0) + if((ret = H5VL_rados_read(ioctx_g, grp->obj.oid, (char *)gcpl_buf, gcpl_len, 0)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, NULL, "can't read metadata from group: %s", strerror(-ret)) /* Decode GCPL */ @@ -2263,7 +2208,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_rados_group_open(void *_item, H5VL_loc_params_t loc_params, +H5VL_rados_group_open(void *_item, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) { H5VL_rados_item_t *item = (H5VL_rados_item_t *)_item; @@ -2293,9 +2238,9 @@ H5VL_rados_group_open(void *_item, H5VL_loc_params_t loc_params, must_bcast = TRUE; /* Check for open by address */ - if(H5VL_OBJECT_BY_ADDR == loc_params.type) { + if(H5VL_OBJECT_BY_ADDR == loc_params->type) { /* Generate oid from address */ - oid = (uint64_t)loc_params.loc_data.loc_by_addr.addr; + oid = (uint64_t)loc_params->loc_data.loc_by_addr.addr; /* Open group */ if(NULL == (grp = (H5VL_rados_group_t *)H5VL_rados_group_open_helper(item->file, oid, gapl_id, dxpl_id, req, (collective && (item->file->num_procs > 1)) ? (void **)&gcpl_buf : NULL, &gcpl_len))) @@ -2462,7 +2407,7 @@ H5VL_rados_group_close(void *_grp, hid_t H5_ATTR_UNUSED dxpl_id, if(--grp->obj.item.rc == 0) { /* Free group data structures */ - grp->obj.oid = H5MM_xfree(grp->obj.oid); + grp->obj.oid = (char *)H5MM_xfree(grp->obj.oid); if(grp->gcpl_id != FAIL && H5I_dec_app_ref(grp->gcpl_id) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "failed to close plist") if(grp->gapl_id != FAIL && H5I_dec_app_ref(grp->gapl_id) < 0) @@ -2749,7 +2694,7 @@ done: */ static void * H5VL_rados_dataset_create(void *_item, - H5VL_loc_params_t H5_ATTR_UNUSED loc_params, const char *name, + const H5VL_loc_params_t H5_ATTR_UNUSED *loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { H5VL_rados_item_t *item = (H5VL_rados_item_t *)_item; @@ -2816,9 +2761,6 @@ H5VL_rados_dataset_create(void *_item, HGOTO_ERROR(H5E_DATASET, H5E_BADITER, NULL, "can't traverse path") /* Create dataset */ - /* Write max OID */ - /*if(H5VL_daosm_write_max_oid(item->file) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't write max OID")*/ /* Determine buffer sizes */ if(H5Tencode(type_id, NULL, &type_size) < 0) @@ -2830,7 +2772,7 @@ H5VL_rados_dataset_create(void *_item, md_size = (3 * sizeof(uint64_t)) + type_size + space_size + dcpl_size; /* Allocate metadata buffer */ - if(NULL == (md_buf = H5MM_malloc(md_size))) + if(NULL == (md_buf = (uint8_t *)H5MM_malloc(md_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate buffer for constant metadata") /* Encode info lengths */ @@ -2893,7 +2835,7 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "can't close dataset") /* Free memory */ - md_buf = H5MM_xfree(md_buf); + md_buf = (uint8_t *)H5MM_xfree(md_buf); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_rados_dataset_create() */ @@ -2914,7 +2856,7 @@ done: */ static void * H5VL_rados_dataset_open(void *_item, - H5VL_loc_params_t H5_ATTR_UNUSED loc_params, const char *name, + const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) { H5VL_rados_item_t *item = (H5VL_rados_item_t *)_item; @@ -2961,9 +2903,9 @@ H5VL_rados_dataset_open(void *_item, must_bcast = TRUE; /* Check for open by address */ - if(H5VL_OBJECT_BY_ADDR == loc_params.type) { + if(H5VL_OBJECT_BY_ADDR == loc_params->type) { /* Generate oid from address */ - dset->obj.bin_oid = (uint64_t)loc_params.loc_data.loc_by_addr.addr; + dset->obj.bin_oid = (uint64_t)loc_params->loc_data.loc_by_addr.addr; if(H5VL_rados_oid_create_string(item->file, dset->obj.bin_oid, &dset->obj.oid) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't encode string oid") } /* end if */ @@ -2992,7 +2934,7 @@ H5VL_rados_dataset_open(void *_item, /* Allocate dynamic buffer if necessary */ if(md_len + sizeof(uint64_t) > sizeof(dinfo_buf_static)) { - if(NULL == (dinfo_buf_dyn = H5MM_malloc(md_len + sizeof(uint64_t)))) + if(NULL == (dinfo_buf_dyn = (uint8_t *)H5MM_malloc(md_len + sizeof(uint64_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate buffer for constant dataset metadata") dinfo_buf = dinfo_buf_dyn; } /* end if */ @@ -3637,149 +3579,6 @@ H5VL_rados_scatter_cb(const void **src_buf, size_t *src_buf_bytes_used, FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5VL_rados_scatter_cb() */ -#if 0 - -/*------------------------------------------------------------------------- - * Function: H5VL_daosm_dataset_mem_vl_rd_cb - * - * Purpose: H5Diterate callback for iterating over the memory space - * before reading vl data. Allocates vl read buffers, - * up scatter gather lists (sgls), and reshapes iods if - * necessary to skip empty elements. - * - * Return: Success: 0 - * Failure: -1, dataset not written. - * - * Programmer: Neil Fortner - * May, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5VL_daosm_dataset_mem_vl_rd_cb(void *_elem, hid_t H5_ATTR_UNUSED type_id, - unsigned H5_ATTR_UNUSED ndim, const hsize_t H5_ATTR_UNUSED *point, - void *_udata) -{ - H5VL_daosm_vl_mem_ud_t *udata = (H5VL_daosm_vl_mem_ud_t *)_udata; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - /* Set up constant sgl info */ - udata->sgls[udata->idx].sg_nr.num = 1; - udata->sgls[udata->idx].sg_nr.num_out = 0; - udata->sgls[udata->idx].sg_iovs = &udata->sg_iovs[udata->idx]; - - /* Check for empty element */ - if(udata->iods[udata->idx].iod_size == 0) { - /* Increment offset, slide down following elements */ - udata->offset++; - - /* Zero out read buffer */ - if(udata->is_vl_str) - *(char **)_elem = NULL; - else - HDmemset(_elem, 0, sizeof(hvl_t)); - } /* end if */ - else { - HDassert(udata->idx >= udata->offset); - - /* Check for vlen string */ - if(udata->is_vl_str) { - char *elem = NULL; - - /* Allocate buffer for this vl element */ - if(NULL == (elem = (char *)HDmalloc((size_t)udata->iods[udata->idx].iod_size + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate vl data buffer") - *(char **)_elem = elem; - - /* Add null terminator */ - elem[udata->iods[udata->idx].iod_size] = '\0'; - - /* Set buffer location in sgl */ - daos_iov_set(&udata->sg_iovs[udata->idx - udata->offset], elem, udata->iods[udata->idx].iod_size); - } /* end if */ - else { - /* Standard vlen, find hvl_t struct for this element */ - hvl_t *elem = (hvl_t *)_elem; - - HDassert(udata->base_type_size > 0); - - /* Allocate buffer for this vl element and set size */ - elem->len = (size_t)udata->iods[udata->idx].iod_size / udata->base_type_size; - if(NULL == (elem->p = HDmalloc((size_t)udata->iods[udata->idx].iod_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate vl data buffer") - - /* Set buffer location in sgl */ - daos_iov_set(&udata->sg_iovs[udata->idx - udata->offset], elem->p, udata->iods[udata->idx].iod_size); - } /* end if */ - - /* Slide down iod if necessary */ - if(udata->offset) - udata->iods[udata->idx - udata->offset] = udata->iods[udata->idx]; - } /* end else */ - - /* Advance idx */ - udata->idx++; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_daosm_dataset_mem_vl_rd_cb() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_daosm_dataset_file_vl_cb - * - * Purpose: H5Diterate callback for iterating over the file space - * before vl data I/O. Sets up akeys and iods (except for - * iod record sizes). - * - * Return: Success: 0 - * Failure: -1, dataset not written. - * - * Programmer: Neil Fortner - * May, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5VL_daosm_dataset_file_vl_cb(void H5_ATTR_UNUSED *_elem, - hid_t H5_ATTR_UNUSED type_id, unsigned ndim, const hsize_t *point, - void *_udata) -{ - H5VL_daosm_vl_file_ud_t *udata = (H5VL_daosm_vl_file_ud_t *)_udata; - size_t akey_len = ndim * sizeof(uint64_t); - uint64_t coordu64; - uint8_t *p; - unsigned i; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - /* Create akey for this element */ - if(NULL == (udata->akeys[udata->idx] = (uint8_t *)H5MM_malloc(akey_len))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for akey") - p = udata->akeys[udata->idx]; - for(i = 0; i < ndim; i++) { - coordu64 = (uint64_t)point[i]; - UINT64ENCODE(p, coordu64) - } /* end for */ - - /* Set up iod, size was set in memory callback or initialized in main read - * function. Use "single" records of varying size. */ - daos_iov_set(&udata->iods[udata->idx].iod_name, (void *)udata->akeys[udata->idx], (daos_size_t)akey_len); - daos_csum_set(&udata->iods[udata->idx].iod_kcsum, NULL, 0); - udata->iods[udata->idx].iod_nr = 1u; - udata->iods[udata->idx].iod_type = DAOS_IOD_SINGLE; - - /* Advance idx */ - udata->idx++; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_daosm_dataset_file_vl_cb() */ -#endif - /*------------------------------------------------------------------------- * Function: H5VL_rados_dataset_read @@ -3817,15 +3616,10 @@ H5VL_rados_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, hbool_t types_equal = TRUE; hbool_t need_bkg = FALSE; hbool_t fill_bkg = FALSE; - //hid_t base_type_id = FAIL; - //size_t base_type_size = 0; void *tmp_tconv_buf = NULL; void *tmp_bkg_buf = NULL; void *tconv_buf; void *bkg_buf; - //H5T_class_t type_class; - //hbool_t is_vl = FALSE; - //htri_t is_vl_str = FALSE; hbool_t close_spaces = FALSE; H5VL_rados_tconv_reuse_t reuse = H5VL_RADOS_TCONV_REUSE_NONE; int ret; @@ -3870,33 +3664,9 @@ H5VL_rados_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, if(num_elem == 0) HGOTO_DONE(SUCCEED) -#if 0 - /* Check for vlen */ - if(H5T_NO_CLASS == (type_class = H5Tget_class(mem_type_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype class") - if(type_class == H5T_VLEN) { - is_vl = TRUE; - - /* Calculate base type size */ - if((base_type_id = H5Tget_super(mem_type_id)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype base type") - if(0 == (base_type_size = H5Tget_size(base_type_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype base type size") - } /* end if */ - else if(type_class == H5T_STRING) { - /* check for vlen string */ - if((is_vl_str = H5Tis_variable_str(mem_type_id)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check for variable length string") - if(is_vl_str) - is_vl = TRUE; - } /* end if */ - else -#endif - { - /* Initialize type conversion */ - if(H5VL_rados_tconv_init(dset->type_id, &file_type_size, mem_type_id, &mem_type_size, &types_equal, &reuse, &need_bkg, &fill_bkg) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize type conversion") - } /* end else */ + /* Initialize type conversion */ + if(H5VL_rados_tconv_init(dset->type_id, &file_type_size, mem_type_id, &mem_type_size, &types_equal, &reuse, &need_bkg, &fill_bkg) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize type conversion") /* Check if the dataset actually has a chunked storage layout. If it does not, simply * set up the dataset as a single "chunk". @@ -3916,9 +3686,6 @@ H5VL_rados_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, break; case H5D_CHUNKED: -// if(is_vl) -// HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "vlen types are currently unsupported with chunking") - /* Get the coordinates of the currently selected chunks in the file, setting up memory and file dataspaces for them */ if(H5VL_rados_get_selected_chunk_info(dset->dcpl_id, real_file_space_id, real_mem_space_id, &chunk_info, &chunk_info_len) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get selected chunk info") @@ -3926,6 +3693,9 @@ H5VL_rados_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, close_spaces = TRUE; break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: + case H5D_VIRTUAL: default: HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "invalid, unknown or unsupported dataset storage layout type") } /* end switch */ @@ -3948,73 +3718,8 @@ H5VL_rados_dataset_read(void *_dset, hid_t mem_type_id, hid_t mem_space_id, /* Get number of elements in selection */ if((num_elem = H5Sget_select_npoints(chunk_info[i].mspace_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of points in selection") -#if 0 - /* Check for variable length */ - if(is_vl) { - H5VL_daosm_vl_mem_ud_t mem_ud; - H5VL_daosm_vl_file_ud_t file_ud; - - /* Get number of elements in selection */ - if((num_elem = H5Sget_select_npoints(real_mem_space_id)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of points in selection") - - /* Allocate array of akey pointers */ - if(NULL == (akeys = (uint8_t **)H5MM_calloc((size_t)num_elem * sizeof(uint8_t *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for akey array") - - /* Allocate array of iods */ - if(NULL == (iods = (daos_iod_t *)H5MM_calloc((size_t)num_elem * sizeof(daos_iod_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for I/O descriptor array") - - /* Fill in size fields of iod as DAOS_REC_ANY so we can read the vl - * sizes */ - for(i = 0; i < (uint64_t)num_elem; i++) - iods[i].iod_size = DAOS_REC_ANY; - - /* Iterate over file selection. Note the bogus buffer and type_id, - * these don't matter since the "elem" parameter of the callback is not - * used. */ - file_ud.akeys = akeys; - file_ud.iods = iods; - file_ud.idx = 0; - if(H5Diterate((void *)buf, mem_type_id, real_file_space_id, H5VL_daosm_dataset_file_vl_cb, &file_ud) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "file selection iteration failed") - HDassert(file_ud.idx == (uint64_t)num_elem); - - /* Read vl sizes from dataset */ - /* Note cast to unsigned reduces width to 32 bits. Should eventually - * check for overflow and iterate over 2^32 size blocks */ - if(0 != (ret = daos_obj_fetch(dset->obj.obj_oh, dset->obj.item.file->epoch, &dkey, (unsigned)num_elem, iods, NULL, NULL /*maps*/, NULL /*event*/))) - HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "can't read vl data sizes from dataset: %d", ret) - - /* Allocate array of sg_iovs */ - if(NULL == (sg_iovs = (daos_iov_t *)H5MM_malloc((size_t)num_elem * sizeof(daos_iov_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for scatter gather list") - - /* Allocate array of sgls */ - if(NULL == (sgls = (daos_sg_list_t *)H5MM_malloc((size_t)num_elem * sizeof(daos_sg_list_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for scatter gather list array") - - /* Iterate over memory selection */ - mem_ud.iods = iods; - mem_ud.sgls = sgls; - mem_ud.sg_iovs = sg_iovs; - mem_ud.is_vl_str = is_vl_str; - mem_ud.base_type_size = base_type_size; - mem_ud.offset = 0; - mem_ud.idx = 0; - if(H5Diterate((void *)buf, mem_type_id, real_mem_space_id, H5VL_daosm_dataset_mem_vl_rd_cb, &mem_ud) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "memory selection iteration failed") - HDassert(mem_ud.idx == (uint64_t)num_elem); - - /* Read data from dataset */ - /* Note cast to unsigned reduces width to 32 bits. Should eventually - * check for overflow and iterate over 2^32 size blocks */ - if(0 != (ret = daos_obj_fetch(dset->obj.obj_oh, dset->obj.item.file->epoch, &dkey, (unsigned)((uint64_t)num_elem - mem_ud.offset), iods, sgls, NULL /*maps*/, NULL /*event*/))) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data from dataset: %d", ret) - } /* end if */ - else -#endif + + /* There was a former if block here... */ { H5S_t *chunk_fspace = NULL; H5S_t *chunk_mspace = NULL; @@ -4159,10 +3864,6 @@ done: H5MM_xfree(tmp_tconv_buf); H5MM_xfree(tmp_bkg_buf); - /*if(base_type_id != FAIL) - if(H5I_dec_app_ref(base_type_id) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close base type id")*/ - if(chunk_info) { if(close_spaces) { for(i = 0; i < chunk_info_len; i++) { @@ -4183,82 +3884,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_rados_dataset_read() */ -#if 0 - -/*------------------------------------------------------------------------- - * Function: H5VL_daosm_dataset_mem_vl_wr_cb - * - * Purpose: H5Diterate callback for iterating over the memory space - * before writing vl data. Sets up scatter gather lists - * (sgls) and sets the record sizes in iods. - * - * Return: Success: 0 - * Failure: -1, dataset not written. - * - * Programmer: Neil Fortner - * May, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5VL_daosm_dataset_mem_vl_wr_cb(void *_elem, hid_t H5_ATTR_UNUSED type_id, - unsigned H5_ATTR_UNUSED ndim, const hsize_t H5_ATTR_UNUSED *point, - void *_udata) -{ - H5VL_daosm_vl_mem_ud_t *udata = (H5VL_daosm_vl_mem_ud_t *)_udata; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Set up constant sgl info */ - udata->sgls[udata->idx].sg_nr.num = 1; - udata->sgls[udata->idx].sg_nr.num_out = 0; - udata->sgls[udata->idx].sg_iovs = &udata->sg_iovs[udata->idx]; - - /* Check for vlen string */ - if(udata->is_vl_str) { - /* Find string for this element */ - char *elem = *(char **)_elem; - - /* Set string length in iod and buffer location in sgl. If we are - * writing an empty string ("\0"), increase the size by one to - * differentiate it from NULL strings. Note that this will cause the - * read buffer to be one byte longer than it needs to be in this case. - * This should not cause any ill effects. */ - if(elem) { - udata->iods[udata->idx].iod_size = (daos_size_t)HDstrlen(elem); - if(udata->iods[udata->idx].iod_size == 0) - udata->iods[udata->idx].iod_size = 1; - daos_iov_set(&udata->sg_iovs[udata->idx], (void *)elem, udata->iods[udata->idx].iod_size); - } /* end if */ - else { - udata->iods[udata->idx].iod_size = 0; - daos_iov_set(&udata->sg_iovs[udata->idx], NULL, 0); - } /* end else */ - } /* end if */ - else { - /* Standard vlen, find hvl_t struct for this element */ - hvl_t *elem = (hvl_t *)_elem; - - HDassert(udata->base_type_size > 0); - - /* Set buffer length in iod and buffer location in sgl */ - if(elem->len > 0) { - udata->iods[udata->idx].iod_size = (daos_size_t)(elem->len * udata->base_type_size); - daos_iov_set(&udata->sg_iovs[udata->idx], (void *)elem->p, udata->iods[udata->idx].iod_size); - } /* end if */ - else { - udata->iods[udata->idx].iod_size = 0; - daos_iov_set(&udata->sg_iovs[udata->idx], NULL, 0); - } /* end else */ - } /* end else */ - - /* Advance idx */ - udata->idx++; - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5VL_daosm_dataset_mem_vl_wr_cb() */ -#endif - /*------------------------------------------------------------------------- * Function: H5VL_rados_dataset_write @@ -4297,13 +3922,8 @@ H5VL_rados_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, hbool_t types_equal = TRUE; hbool_t need_bkg = FALSE; hbool_t fill_bkg = FALSE; - //hid_t base_type_id = FAIL; - //size_t base_type_size = 0; void *tconv_buf = NULL; void *bkg_buf = NULL; - //H5T_class_t type_class; - //hbool_t is_vl = FALSE; - //uhtri_t is_vl_str = FALSE; hbool_t close_spaces = FALSE; H5VL_rados_tconv_reuse_t reuse = H5VL_RADOS_TCONV_REUSE_NONE; int ret; @@ -4351,33 +3971,10 @@ H5VL_rados_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, /* Check for no selection */ if(num_elem == 0) HGOTO_DONE(SUCCEED) -#if 0 - /* Check for vlen */ - if(H5T_NO_CLASS == (type_class = H5Tget_class(mem_type_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype class") - if(type_class == H5T_VLEN) { - is_vl = TRUE; - - /* Calculate base type size */ - if((base_type_id = H5Tget_super(mem_type_id)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype base type") - if(0 == (base_type_size = H5Tget_size(base_type_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype base type size") - } /* end if */ - else if(type_class == H5T_STRING) { - /* check for vlen string */ - if((is_vl_str = H5Tis_variable_str(mem_type_id)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check for variable length string") - if(is_vl_str) - is_vl = TRUE; - } /* end if */ - else -#endif - { - /* Initialize type conversion */ - if(H5VL_rados_tconv_init(dset->type_id, &file_type_size, mem_type_id, &mem_type_size, &types_equal, &reuse, &need_bkg, &fill_bkg) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize type conversion") - } /* end else */ + + /* Initialize type conversion */ + if(H5VL_rados_tconv_init(dset->type_id, &file_type_size, mem_type_id, &mem_type_size, &types_equal, &reuse, &need_bkg, &fill_bkg) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize type conversion") /* Check if the dataset actually has a chunked storage layout. If it does not, simply * set up the dataset as a single "chunk". @@ -4397,9 +3994,6 @@ H5VL_rados_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, break; case H5D_CHUNKED: -// if(is_vl) -// HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "vlen types are currently unsupported with chunking") - /* Get the coordinates of the currently selected chunks in the file, setting up memory and file dataspaces for them */ if(H5VL_rados_get_selected_chunk_info(dset->dcpl_id, real_file_space_id, real_mem_space_id, &chunk_info, &chunk_info_len) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get selected chunk info") @@ -4407,6 +4001,9 @@ H5VL_rados_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, close_spaces = TRUE; break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: + case H5D_VIRTUAL: default: HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "invalid, unknown or unsupported dataset storage layout type") } /* end switch */ @@ -4442,57 +4039,8 @@ H5VL_rados_dataset_write(void *_dset, hid_t mem_type_id, hid_t mem_space_id, /* Get number of elements in selection */ if((num_elem = H5Sget_select_npoints(chunk_info[i].mspace_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of points in selection") -#if 0 - /* Check for variable length */ - if(is_vl) { - H5VL_daosm_vl_mem_ud_t mem_ud; - H5VL_daosm_vl_file_ud_t file_ud; - - /* Allocate array of akey pointers */ - if(NULL == (akeys = (uint8_t **)H5MM_calloc((size_t)num_elem * sizeof(uint8_t *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for akey array") - - /* Allocate array of iods */ - if(NULL == (iods = (daos_iod_t *)H5MM_calloc((size_t)num_elem * sizeof(daos_iod_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for I/O descriptor array") - - /* Allocate array of sg_iovs */ - if(NULL == (sg_iovs = (daos_iov_t *)H5MM_malloc((size_t)num_elem * sizeof(daos_iov_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for scatter gather list") - - /* Allocate array of sgls */ - if(NULL == (sgls = (daos_sg_list_t *)H5MM_malloc((size_t)num_elem * sizeof(daos_sg_list_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for scatter gather list array") - - /* Iterate over memory selection */ - mem_ud.iods = iods; - mem_ud.sgls = sgls; - mem_ud.sg_iovs = sg_iovs; - mem_ud.is_vl_str = is_vl_str; - mem_ud.base_type_size = base_type_size; - mem_ud.idx = 0; - if(H5Diterate((void *)buf, mem_type_id, real_mem_space_id, H5VL_daosm_dataset_mem_vl_wr_cb, &mem_ud) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "memory selection iteration failed") - HDassert(mem_ud.idx == (uint64_t)num_elem); - - /* Iterate over file selection. Note the bogus buffer and type_id, - * these don't matter since the "elem" parameter of the callback is not - * used. */ - file_ud.akeys = akeys; - file_ud.iods = iods; - file_ud.idx = 0; - if(H5Diterate((void *)buf, mem_type_id, real_file_space_id, H5VL_daosm_dataset_file_vl_cb, &file_ud) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "file selection iteration failed") - HDassert(file_ud.idx == (uint64_t)num_elem); - /* Write data to dataset */ - /* Note cast to unsigned reduces width to 32 bits. Should eventually - * check for overflow and iterate over 2^32 size blocks */ - if(0 != (ret = daos_obj_update(dset->obj.obj_oh, dset->obj.item.file->epoch, &dkey, (unsigned)num_elem, iods, sgls, NULL /*event*/))) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data to dataset: %d", ret) - } /* end if */ - else -#endif + /* Former if block here... */ { H5S_t *chunk_fspace = NULL; H5S_t *chunk_mspace = NULL; @@ -4587,10 +4135,6 @@ done: tconv_buf = H5MM_xfree(tconv_buf); bkg_buf = H5MM_xfree(bkg_buf); - /*if(base_type_id != FAIL) - if(H5I_dec_app_ref(base_type_id) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close base type id")*/ - if(chunk_info) { if(close_spaces) { for(i = 0; i < chunk_info_len; i++) { @@ -4714,7 +4258,7 @@ H5VL_rados_dataset_close(void *_dset, hid_t H5_ATTR_UNUSED dxpl_id, if(--dset->obj.item.rc == 0) { /* Free dataset data structures */ - dset->obj.oid = H5MM_xfree(dset->obj.oid); + dset->obj.oid = (char *)H5MM_xfree(dset->obj.oid); if(dset->type_id != FAIL && H5I_dec_app_ref(dset->type_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "failed to close datatype") if(dset->space_id != FAIL && H5I_dec_app_ref(dset->space_id) < 0) diff --git a/src/H5VLrados_public.h b/src/H5VLrados_public.h index e49339b..1a9e448 100644 --- a/src/H5VLrados_public.h +++ b/src/H5VLrados_public.h @@ -35,6 +35,10 @@ #include "H5public.h" #include "H5Ipublic.h" +#define H5VL_RADOS_VERSION 1 +#define H5VL_RADOS_VALUE 268 +#define H5VL_RADOS_NAME "rados_vol_connector" + #ifdef __cplusplus extern "C" { #endif |