diff options
author | kmu <kmu@hdfgroup.org> | 2019-12-06 15:51:06 (GMT) |
---|---|---|
committer | kmu <kmu@hdfgroup.org> | 2019-12-06 15:51:06 (GMT) |
commit | 1f871e23b7c3fdec925004f2cd39d3a2cdd8decb (patch) | |
tree | 0f267b01ff7617ee44c904fc6ad7cbd4d13303f9 /src | |
parent | 463199464f2b5c9f798b23ffe3f1db139b68f4d2 (diff) | |
parent | 107bcbd3dfff51895c99ea3ff71afa0ce693a956 (diff) | |
download | hdf5-1f871e23b7c3fdec925004f2cd39d3a2cdd8decb.zip hdf5-1f871e23b7c3fdec925004f2cd39d3a2cdd8decb.tar.gz hdf5-1f871e23b7c3fdec925004f2cd39d3a2cdd8decb.tar.bz2 |
Merge branch 'develop' of https://git.hdfgroup.org/scm/hdffv/hdf5 into develop
Diffstat (limited to 'src')
-rw-r--r-- | src/H5D.c | 31 | ||||
-rw-r--r-- | src/H5Dint.c | 79 | ||||
-rw-r--r-- | src/H5Dpkg.h | 2 | ||||
-rw-r--r-- | src/H5FD.c | 4 | ||||
-rw-r--r-- | src/H5Fsuper.c | 2 | ||||
-rw-r--r-- | src/H5MF.c | 48 | ||||
-rw-r--r-- | src/H5MFdbg.c | 6 | ||||
-rw-r--r-- | src/H5Mpublic.h | 3 | ||||
-rw-r--r-- | src/H5O.c | 4 | ||||
-rw-r--r-- | src/H5Ocopy_ref.c | 8 | ||||
-rw-r--r-- | src/H5Ofsinfo.c | 10 | ||||
-rw-r--r-- | src/H5Pdcpl.c | 8 | ||||
-rw-r--r-- | src/H5R.c | 58 | ||||
-rw-r--r-- | src/H5Rdeprec.c | 13 | ||||
-rw-r--r-- | src/H5Rint.c | 20 | ||||
-rw-r--r-- | src/H5Rpublic.h | 14 | ||||
-rw-r--r-- | src/H5Shyper.c | 5 | ||||
-rw-r--r-- | src/H5Spkg.h | 7 | ||||
-rw-r--r-- | src/H5Sselect.c | 215 | ||||
-rw-r--r-- | src/H5T.c | 1 | ||||
-rw-r--r-- | src/H5VLconnector.h | 6 | ||||
-rw-r--r-- | src/H5VLnative_object.c | 2 | ||||
-rw-r--r-- | src/H5private.h | 7 | ||||
-rw-r--r-- | src/hdf5-lin.lnt | 3 | ||||
-rw-r--r-- | src/hdf5.lnt | 7 |
25 files changed, 350 insertions, 213 deletions
@@ -736,7 +736,7 @@ herr_t H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size) { - H5D_vlen_bufsize_t vlen_bufsize = {0, 0, 0, 0, 0, 0}; + H5D_vlen_bufsize_t vlen_bufsize = {NULL, H5I_INVALID_HID, H5I_INVALID_HID, NULL, NULL, 0, H5P_DATASET_XFER_DEFAULT}; H5VL_object_t *vol_obj; /* Dataset for this operation */ H5S_t *mspace = NULL; /* Memory dataspace */ char bogus; /* bogus value to pass to H5Diterate() */ @@ -763,8 +763,6 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, /* Save the dataset */ vlen_bufsize.dset_vol_obj = vol_obj; - vlen_bufsize.fspace_id = H5I_INVALID_HID; - vlen_bufsize.mspace_id = H5I_INVALID_HID; /* Get a copy of the dataset's dataspace */ if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0) @@ -786,6 +784,22 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, if(H5CX_set_vlen_alloc_info(H5D__vlen_get_buf_size_alloc, &vlen_bufsize, NULL, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine") + /* If we are not using the native VOL connector we must also set this + * property on the DXPL since the context is not visible to the connector + * and will be ignored if the connector re-enters the library */ + if(vol_obj->connector->cls->value != H5VL_NATIVE_VALUE) { + H5P_genplist_t *dxpl; + + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get default DXPL") + if((vlen_bufsize.dxpl_id = H5P_copy_plist(dxpl, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, H5I_INVALID_HID, "can't copy property list"); + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(vlen_bufsize.dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get copied DXPL") + if(H5P_set_vlen_mem_manager(dxpl, H5D__vlen_get_buf_size_alloc, &vlen_bufsize, NULL, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine on DXPL") + } /* end if */ + /* Set the initial number of bytes required */ vlen_bufsize.size = 0; @@ -805,14 +819,17 @@ done: if(mspace && H5S_close(mspace) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") - if(vlen_bufsize.fspace_id && H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id") - if(vlen_bufsize.mspace_id && H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id") + if(vlen_bufsize.fspace_id >= 0 && H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id") + if(vlen_bufsize.mspace_id >= 0 && H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id") if(vlen_bufsize.fl_tbuf != NULL) vlen_bufsize.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.fl_tbuf); if(vlen_bufsize.vl_tbuf != NULL) vlen_bufsize.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.vl_tbuf); + if(vlen_bufsize.dxpl_id != H5P_DATASET_XFER_DEFAULT) + if(H5I_dec_app_ref(vlen_bufsize.dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close property list") FUNC_LEAVE_API(ret_value) } /* end H5Dvlen_get_buf_size() */ diff --git a/src/H5Dint.c b/src/H5Dint.c index ee90db2..c3d4398 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -49,7 +49,7 @@ /********************/ /* General stuff */ -static H5D_shared_t *H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type); +static H5D_shared_t *H5D__new(hid_t dcpl_id, hid_t dapl, hbool_t creating, hbool_t vl_type); static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type); static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); @@ -465,7 +465,7 @@ done: *------------------------------------------------------------------------- */ static H5D_shared_t * -H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type) +H5D__new(hid_t dcpl_id, hid_t dapl_id, hbool_t creating, hbool_t vl_type) { H5D_shared_t *new_dset = NULL; /* New dataset object */ H5P_genplist_t *plist; /* Property list created */ @@ -496,6 +496,19 @@ H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type) new_dset->dcpl_id = H5P_copy_plist(plist, FALSE); } /* end else */ + if(!vl_type && creating && dapl_id == H5P_DATASET_ACCESS_DEFAULT) { + if(H5I_inc_ref(dapl_id, FALSE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't increment default DAPL ID") + new_dset->dapl_id = dapl_id; + } /* end if */ + else { + /* Get the property list */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list") + + new_dset->dapl_id = H5P_copy_plist(plist, FALSE); + } /* end else */ + /* Set return value */ ret_value = new_dset; @@ -504,6 +517,8 @@ done: if(new_dset != NULL) { if(new_dset->dcpl_id != 0 && H5I_dec_ref(new_dset->dcpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "can't decrement temporary datatype ID") + if(new_dset->dapl_id != 0 && H5I_dec_ref(new_dset->dapl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "can't decrement temporary datatype ID") new_dset = H5FL_FREE(H5D_shared_t, new_dset); } /* end if */ @@ -1225,9 +1240,8 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, H5G_loc_reset(&dset_loc); /* Initialize the shared dataset space */ - if(NULL == (new_dset->shared = H5D__new(dcpl_id, TRUE, has_vl_type))) + if(NULL == (new_dset->shared = H5D__new(dcpl_id, dapl_id, TRUE, has_vl_type))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - /* Copy & initialize datatype for dataset */ if(H5D__init_type(file, new_dset, type_id, type) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't copy datatype") @@ -1320,14 +1334,14 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to construct layout information") /* Update the dataset's object header info. */ - if(H5D__update_oh_info(file, new_dset, dapl_id) < 0) + if(H5D__update_oh_info(file, new_dset, new_dset->shared->dapl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't update the metadata cache") /* Indicate that the layout information was initialized */ layout_init = TRUE; /* Set up append flush parameters for the dataset */ - if(H5D__append_flush_setup(new_dset, dapl_id) < 0) + if(H5D__append_flush_setup(new_dset, new_dset->shared->dapl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set up flush append property") /* Set the external file prefix */ @@ -1382,6 +1396,8 @@ done: } /* end if */ if(new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list") + if(new_dset->shared->dapl_id != 0 && H5I_dec_ref(new_dset->shared->dapl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list") new_dset->shared->extfile_prefix = (char *)H5MM_xfree(new_dset->shared->extfile_prefix); new_dset->shared->vds_prefix = (char *)H5MM_xfree(new_dset->shared->vds_prefix); new_dset->shared = H5FL_FREE(H5D_shared_t, new_dset->shared); @@ -1686,7 +1702,7 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id) HDassert(dataset); /* (Set the 'vl_type' parameter to FALSE since it doesn't matter from here) */ - if(NULL == (dataset->shared = H5D__new(H5P_DATASET_CREATE_DEFAULT, FALSE, FALSE))) + if(NULL == (dataset->shared = H5D__new(H5P_DATASET_CREATE_DEFAULT, dapl_id, FALSE, FALSE))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Open the dataset object */ @@ -1968,12 +1984,13 @@ H5D_close(H5D_t *dataset) if(H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTUNCORK, FAIL, "unable to uncork an object") - /* Release datatype, dataspace and creation property list -- there isn't + /* Release datatype, dataspace and creation and access property lists -- there isn't * much we can do if one of these fails, so we just continue. */ free_failed |= (H5I_dec_ref(dataset->shared->type_id) < 0) || (H5S_close(dataset->shared->space) < 0) || - (H5I_dec_ref(dataset->shared->dcpl_id) < 0); + (H5I_dec_ref(dataset->shared->dcpl_id) < 0) || + (H5I_dec_ref(dataset->shared->dapl_id) < 0); /* Remove the dataset from the list of opened objects in the file */ if(H5FO_top_decr(dataset->oloc.file, dataset->oloc.addr) < 0) @@ -2622,7 +2639,7 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point") /* Read in the point (with the custom VL memory allocator) */ - if(H5VL_dataset_read(vol_obj, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, H5P_DATASET_XFER_DEFAULT, vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0) + if(H5VL_dataset_read(vol_obj, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, vlen_bufsize->dxpl_id, vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point") done: @@ -3428,22 +3445,26 @@ done: hid_t H5D_get_access_plist(const H5D_t *dset) { - H5P_genplist_t *old_plist; /* Default DAPL */ + H5P_genplist_t *old_plist; /* Stored DAPL from dset */ H5P_genplist_t *new_plist; /* New DAPL */ + H5P_genplist_t *def_fapl; /* Default FAPL */ + H5D_append_flush_t def_append_flush_info = {0}; /* Default append flush property */ + H5D_rdcc_t def_chunk_info; /* Default chunk cache property */ hid_t new_dapl_id = FAIL; hid_t ret_value = FAIL; FUNC_ENTER_NOAPI_NOINIT - /* Make a copy of the default dataset access property list */ - if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_ACCESS_ID_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + /* Make a copy of the dataset's dataset access property list */ + if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(dset->shared->dapl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list") if((new_dapl_id = H5P_copy_plist(old_plist, TRUE)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy dataset access property list") if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_dapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - /* If the dataset is chunked then copy the rdcc & append flush parameters */ + /* If the dataset is chunked then copy the rdcc & append flush parameters. + * Otherwise, use the default values. */ if(dset->shared->layout.type == H5D_CHUNKED) { if(H5P_set(new_plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &(dset->shared->cache.chunk.nslots)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache number of slots") @@ -3453,7 +3474,33 @@ H5D_get_access_plist(const H5D_t *dset) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set preempt read chunks") if(H5P_set(new_plist, H5D_ACS_APPEND_FLUSH_NAME, &dset->shared->append_flush) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set append flush property") - } /* end if */ + } else { + /* Get the default FAPL */ + if(NULL == (def_fapl = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g))) + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a property list") + + /* Set the data cache number of slots to the value of the default FAPL */ + if (H5P_get(def_fapl, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &def_chunk_info.nslots) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET,FAIL, "can't get data number of slots"); + if(H5P_set(new_plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &def_chunk_info.nslots) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set data cache number of slots") + + /* Set the data cache byte size to the value of the default FAPL */ + if (H5P_get(def_fapl, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &def_chunk_info.nbytes_max) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET,FAIL, "can't get data cache byte size"); + if(H5P_set(new_plist, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &def_chunk_info.nbytes_max) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set data cache byte size") + + /* Set the preempt read chunks property to the value of the default FAPL */ + if (H5P_get(def_fapl, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &def_chunk_info.w0) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET,FAIL, "can't get preempt read chunks"); + if(H5P_set(new_plist, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &def_chunk_info.w0) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set preempt read chunks") + + /* Set the append flush property to its default value */ + if(H5P_set(new_plist, H5D_ACS_APPEND_FLUSH_NAME, &def_append_flush_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set append flush property") + }/* end if-else */ /* Set the VDS view & printf gap options */ if(H5P_set(new_plist, H5D_ACS_VDS_VIEW_NAME, &(dset->shared->layout.storage.u.virt.view)) < 0) diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 723acf9..02121e6 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -443,6 +443,7 @@ struct H5D_shared_t { H5T_t *type; /* Datatype for this dataset */ H5S_t *space; /* Dataspace of this dataset */ hid_t dcpl_id; /* Dataset creation property id */ + hid_t dapl_id; /* Dataset access property id */ H5D_dcpl_cache_t dcpl_cache; /* Cached DCPL values */ H5O_layout_t layout; /* Data layout */ hbool_t checked_filters;/* TRUE if dataset passes can_apply check */ @@ -523,6 +524,7 @@ typedef struct { void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */ void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */ hsize_t size; /* Accumulated number of bytes for the selection */ + hid_t dxpl_id; /* Dataset transfer property list to pass to dataset read */ } H5D_vlen_bufsize_t; @@ -241,7 +241,7 @@ H5FDregister(const H5FD_class_t *cls) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'get_eof' method is not defined") if(!cls->read || !cls->write) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'read' and/or 'write' method is not defined") - for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,type)) + for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) if(cls->fl_map[type] < H5FD_MEM_NOLIST || cls->fl_map[type] >= H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid free-list mapping") @@ -286,7 +286,7 @@ H5FD_register(const void *_cls, size_t size, hbool_t app_ref) HDassert(cls->get_eoa && cls->set_eoa); HDassert(cls->get_eof); HDassert(cls->read && cls->write); - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) { HDassert(cls->fl_map[type] >= H5FD_MEM_NOLIST && cls->fl_map[type] < H5FD_MEM_NTYPES); } diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index f8e8f3f..e5d4cde 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -1394,7 +1394,7 @@ H5F__super_init(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set version of fsinfo") f->shared->fs_version = fsinfo.version; - for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF; if(H5O_msg_create(&ext_loc, H5O_FSINFO_ID, H5O_MSG_FLAG_DONTSHARE | H5O_MSG_FLAG_MARK_IF_UNKNOWN, H5O_UPDATE_TIME, &fsinfo) < 0) @@ -163,7 +163,7 @@ H5MF_init_merge_flags(H5F_shared_t *f_sh) * can merge with the metadata or small 'raw' data aggregator */ all_same = TRUE; - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) /* Check for any different type mappings */ if(f_sh->fs_type_map[type] != f_sh->fs_type_map[H5FD_MEM_DEFAULT]) { all_same = FALSE; @@ -187,7 +187,7 @@ H5MF_init_merge_flags(H5F_shared_t *f_sh) /* One or more allocation type don't map to the same free list type */ /* Check if all the metadata allocation types map to the same type */ all_metadata_same = TRUE; - for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) /* Skip checking raw data free list mapping */ /* (global heap is treated as raw data) */ if(type != H5FD_MEM_DRAW && type != H5FD_MEM_GHEAP) { @@ -1686,7 +1686,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Iterate over all the free space types that have managers and * get each free list's space */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) { + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f->shared, ptype)) needed_ring = H5AC_RING_MDFSM; @@ -1708,7 +1708,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Iterate over all the free space types that have managers and * get each free list's space */ - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type)) needed_ring = H5AC_RING_MDFSM; @@ -1807,9 +1807,9 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); * * In passing, verify that all the free space managers are closed. */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF; - for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) fsinfo.fs_addr[type-1] = f->shared->fs_addr[type]; fsinfo.strategy = f->shared->fs_strategy; fsinfo.persist = f->shared->fs_persist; @@ -1824,7 +1824,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); HGOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension") /* Close the free space managers */ - for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { + for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) { if(f->shared->fs_man[type]) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type)) @@ -1877,7 +1877,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); HDassert(H5F_NULL_FSM_ADDR(f) || final_eoa == f->shared->eoa_fsm_fsalloc); } /* end if */ else { /* super_vers can be 0, 1, 2 */ - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) if(H5MF__close_delete_fstype(f, (H5F_mem_page_t)type) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") } /* end else */ @@ -1958,7 +1958,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); fsinfo.eoa_pre_fsm_fsalloc = HADDR_UNDEF; fsinfo.version = f->shared->fs_version; - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF; if(f->shared->fs_persist) { @@ -1980,7 +1980,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); * file space for the self referential free space managers. Other * data was gathered above. */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) fsinfo.fs_addr[ptype-1] = f->shared->fs_addr[ptype]; fsinfo.eoa_pre_fsm_fsalloc = f->shared->eoa_fsm_fsalloc; @@ -1990,7 +1990,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Close the free space managers */ /* use H5MF__close_fstype() for this? */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) { + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) { if(f->shared->fs_man[ptype]) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f->shared, ptype)) @@ -2052,7 +2052,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Iterate over all the free space types that have managers * and get each free list's space */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) if(H5MF__close_delete_fstype(f, ptype) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close the free space manager") @@ -2125,7 +2125,7 @@ H5MF__close_shrink_eoa(H5F_t *f) if(H5F_PAGED_AGGR(f)) { /* Check the last section of each free-space manager */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) { + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) { if(f->shared->fs_man[ptype]) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f->shared, ptype)) @@ -2149,7 +2149,7 @@ H5MF__close_shrink_eoa(H5F_t *f) } /* end if */ else { /* Check the last section of each free-space manager */ - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) { if(f->shared->fs_man[type]) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type)) @@ -2245,7 +2245,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) end_type = (H5F_mem_page_t)H5FD_MEM_NTYPES; } /* end else */ - for(tt = H5FD_MEM_SUPER; tt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, tt)) + for(tt = H5FD_MEM_SUPER; tt < H5FD_MEM_NTYPES; tt++) if(HADDR_UNDEF == (fs_eoa[tt] = H5F_get_eoa(f, tt))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") @@ -2260,7 +2260,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) } /* end if */ /* Iterate over all the free space types that have managers and get each free list's space */ - for(type = start_type; type < end_type; H5_INC_ENUM(H5F_mem_page_t, type)) { + for(type = start_type; type < end_type; type++) { fs_started[type] = FALSE; /* Check if the free space for the file has been initialized */ @@ -2300,7 +2300,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) } /* end for */ /* Close the free-space managers if they were opened earlier in this routine */ - for(type = start_type; type < end_type; H5_INC_ENUM(H5F_mem_page_t, type)) { + for(type = start_type; type < end_type; type++) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type)) needed_ring = H5AC_RING_MDFSM; @@ -2387,7 +2387,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t if(H5F_PAGED_AGGR(f)) /* set to the corresponding LARGE free-space manager */ end_type = (H5F_mem_page_t)(end_type + H5FD_MEM_NTYPES); else - H5_INC_ENUM(H5F_mem_page_t, end_type); + end_type++; } /* end else */ /* Set up user data for section iteration */ @@ -2403,7 +2403,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t curr_ring = H5AC_RING_RDFSM; /* Iterate over memory types, retrieving the number of sections of each type */ - for(ty = start_type; ty < end_type; H5_INC_ENUM(H5F_mem_page_t, ty)) { + for(ty = start_type; ty < end_type; ty++) { hbool_t fs_started = FALSE; /* The free-space manager is opened or not */ size_t nums = 0; /* The number of free-space sections */ @@ -2733,7 +2733,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) else /* no need for a second pass */ break; - for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) { + for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; mem_type++) { H5MF__alloc_to_fs_type(f->shared, mem_type, alloc_size, &fsm_type); if(pass_count == 0) { /* this is the first pass */ @@ -2834,7 +2834,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) * those addresses are unknown. This is OK -- we will write the correct * values to the message at free space manager shutdown. */ - for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, fsm_type)) + for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; fsm_type++) fsinfo.fs_addr[fsm_type - 1] = HADDR_UNDEF; fsinfo.strategy = f->shared->fs_strategy; fsinfo.persist = f->shared->fs_persist; @@ -2867,7 +2867,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) */ /* Reinitialize fsm_visited */ - for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, fsm_type)) + for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; fsm_type++) fsm_visited[fsm_type] = FALSE; for(pass_count = 0; pass_count <= 1; pass_count++) { @@ -2878,7 +2878,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) else /* no need for a second pass */ break; - for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) { + for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; mem_type++) { H5MF__alloc_to_fs_type(f->shared, mem_type, alloc_size, &fsm_type); if(pass_count == 0) { /* this is the first pass */ @@ -2975,7 +2975,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) } /* end for */ /* verify that all opened FSMs were closed */ - for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, fsm_type)) + for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; fsm_type++) HDassert(!fsm_opened[fsm_type]); /* Indicate that the FSM was settled successfully */ diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index e11476b..7bb77e8 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -169,7 +169,7 @@ H5MF_sects_debug(H5F_t *f, haddr_t fs_addr, FILE *stream, int indent, int fwidth HDassert(indent >= 0); HDassert(fwidth >= 0); - for(type = H5F_MEM_PAGE_DEFAULT; type < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, type)) + for(type = H5F_MEM_PAGE_DEFAULT; type < H5F_MEM_PAGE_NTYPES; type++) if(H5F_addr_eq(f->shared->fs_addr[type], fs_addr)) { if(!f->shared->fs_man[type]) if(H5MF__open_fstype(f, type) < 0) @@ -243,7 +243,7 @@ HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa); if(H5F_PAGED_AGGR(f)) { /* File space paging */ H5F_mem_page_t ptype; /* Memory type for iteration -- page fs */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) { + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) { /* Print header for type */ HDfprintf(stream, "%*sFile Free Space Info for type = %u:\n", indent, "", (unsigned)ptype); @@ -289,7 +289,7 @@ HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, #endif /* H5MF_ALLOC_DEBUG */ /* Iterate over all the free space types that have managers and dump each free list's space */ - for(atype = H5FD_MEM_DEFAULT; atype < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, atype)) { + for(atype = H5FD_MEM_DEFAULT; atype < H5FD_MEM_NTYPES; atype++) { /* Print header for type */ HDfprintf(stream, "%*sFile Free Space Info for type = %u:\n", indent, "", (unsigned)atype); diff --git a/src/H5Mpublic.h b/src/H5Mpublic.h index 9cbdb32..524ab0f 100644 --- a/src/H5Mpublic.h +++ b/src/H5Mpublic.h @@ -40,7 +40,8 @@ #define H5VL_MAP_PUT 5 #define H5VL_MAP_GET 6 #define H5VL_MAP_SPECIFIC 7 -#define H5VL_MAP_CLOSE 8 +#define H5VL_MAP_OPTIONAL 8 +#define H5VL_MAP_CLOSE 9 /*******************/ @@ -290,11 +290,11 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL object") /* This is a native specific routine that requires serialization of the token */ - p = obj_token; + p = (uint8_t *)&obj_token; H5F_addr_encode(f, &p, addr); loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = vol_obj_type; /* Open the object */ diff --git a/src/H5Ocopy_ref.c b/src/H5Ocopy_ref.c index 20b8454..b835f8e 100644 --- a/src/H5Ocopy_ref.c +++ b/src/H5Ocopy_ref.c @@ -185,7 +185,7 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src, /* Set up for the object copy for the reference */ if(H5R__decode_token_obj_compat(src_buf, &buf_size, &tmp_token, token_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode src object address") - p = tmp_token; + p = (uint8_t *)&tmp_token; H5F_addr_decode(src_oloc->file, (const uint8_t **)&p, &src_oloc->addr); if(!H5F_addr_defined(src_oloc->addr) || src_oloc->addr == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "undefined reference pointer") @@ -196,7 +196,7 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src, HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") /* Set the object reference info for the destination file */ - p = tmp_token; + p = (uint8_t *)&tmp_token; H5F_addr_encode(dst_oloc->file, &p, dst_oloc->addr); if(H5R__encode_token_obj_compat((const H5VL_token_t *)&tmp_token, token_size, dst_buf, &buf_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to encode dst object address") @@ -371,7 +371,7 @@ H5O__copy_expand_ref_object2(H5O_loc_t *src_oloc, hid_t tid_src, H5T_t *dt_src, /* Get src object address */ if(H5R__get_obj_token(ref, &tmp_token, &token_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object token") - p = tmp_token; + p = (uint8_t *)&tmp_token; H5F_addr_decode(src_oloc->file, (const uint8_t **)&p, &src_oloc->addr); /* Attempt to copy object from source to destination file */ @@ -379,7 +379,7 @@ H5O__copy_expand_ref_object2(H5O_loc_t *src_oloc, hid_t tid_src, H5T_t *dt_src, HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") /* Set dst object address */ - p = tmp_token; + p = (uint8_t *)&tmp_token; H5F_addr_encode(dst_oloc->file, &p, dst_oloc->addr); if(H5R__set_obj_token(ref, (const H5VL_token_t *)&tmp_token, token_size) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set object token") diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index e5e6741..7e48b9e 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -112,7 +112,7 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, if(NULL == (fsinfo = H5FL_CALLOC(H5O_fsinfo_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) fsinfo->fs_addr[ptype - 1] = HADDR_UNDEF; /* Version of message */ @@ -141,7 +141,7 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, fsinfo->threshold = threshold; if(HADDR_UNDEF == (fsinfo->eoa_pre_fsm_fsalloc = H5F_get_eoa(f, H5FD_MEM_DEFAULT)) ) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file size") - for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) H5F_addr_decode(f, &p, &(fsinfo->fs_addr[type-1])); break; @@ -181,7 +181,7 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, /* Decode addresses of free space managers, if persisting */ if(fsinfo->persist) { - for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) H5F_addr_decode(f, &p, &(fsinfo->fs_addr[ptype - 1])); } /* end if */ @@ -235,7 +235,7 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c /* Store addresses of free-space managers, if persisting */ if(fsinfo->persist) { /* Addresses of free-space managers */ - for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) H5F_addr_encode(f, &p, fsinfo->fs_addr[ptype - 1]); } /* end if */ @@ -480,7 +480,7 @@ H5O__fsinfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE * stream, "eoa_pre_fsm_fsalloc:", fsinfo->eoa_pre_fsm_fsalloc); if(fsinfo->persist) { - for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Free space manager address:", fsinfo->fs_addr[ptype-1]); } /* end if */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 721ba89..b83e2cf 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -3324,19 +3324,19 @@ H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value/*out*/) */ if(H5T_get_size(type) >= H5T_get_size(fill.type)) { buf = value; - if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_malloc(H5T_get_size(type)))) + if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_calloc(H5T_get_size(type)))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion") } /* end if */ else { - if(NULL == (buf = H5MM_malloc(H5T_get_size(fill.type)))) + if(NULL == (buf = H5MM_calloc(H5T_get_size(fill.type)))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion") - if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_malloc(H5T_get_size(fill.type)))) + if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_calloc(H5T_get_size(fill.type)))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion") } /* end else */ H5MM_memcpy(buf, fill.buf, H5T_get_size(fill.type)); /* Do the conversion */ - if((dst_id = H5I_register(H5I_DATATYPE, H5T_copy(type, H5T_COPY_TRANSIENT), FALSE)) < 0) + if((dst_id = H5I_register(H5I_DATATYPE, H5T_copy(type, H5T_COPY_ALL), FALSE)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy/register datatype") if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, buf, bkg) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "datatype conversion failed") @@ -74,7 +74,7 @@ *------------------------------------------------------------------------- */ herr_t -H5Rcreate_object(hid_t loc_id, const char *name, H5R_ref_t *ref_ptr) +H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_ptr) { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5I_type_t obj_type; /* Object type of loc_id */ @@ -86,13 +86,22 @@ H5Rcreate_object(hid_t loc_id, const char *name, H5R_ref_t *ref_ptr) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "i*s*Rr", loc_id, name, ref_ptr); + H5TRACE4("e", "i*si*Rr", loc_id, name, oapl_id, ref_ptr); /* Check args */ if(ref_ptr == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") + if(oapl_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Get object access property list */ + if(H5P_DEFAULT == oapl_id) + oapl_id = H5P_LINK_ACCESS_DEFAULT; + else + if(TRUE != H5P_isa_class(oapl_id, H5P_LINK_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "oapl_id is not a link access property list ID") /* Get the VOL object */ if(NULL == (vol_obj = H5VL_vol_object(loc_id))) @@ -117,10 +126,11 @@ H5Rcreate_object(hid_t loc_id, const char *name, H5R_ref_t *ref_ptr) /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = oapl_id; loc_params.obj_type = obj_type; /* Get the object token */ - if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_token) < 0) + if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_token) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token") /* Create the reference (do not pass filename, since file_id is attached) */ @@ -152,7 +162,7 @@ done: */ herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, - H5R_ref_t *ref_ptr) + hid_t oapl_id, H5R_ref_t *ref_ptr) { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5I_type_t obj_type; /* Object type of loc_id */ @@ -165,7 +175,7 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*si*Rr", loc_id, name, space_id, ref_ptr); + H5TRACE5("e", "i*sii*Rr", loc_id, name, space_id, oapl_id, ref_ptr); /* Check args */ if(ref_ptr == NULL) @@ -176,6 +186,15 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid") if(NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + if(oapl_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Get object access property list */ + if(H5P_DEFAULT == oapl_id) + oapl_id = H5P_LINK_ACCESS_DEFAULT; + else + if(TRUE != H5P_isa_class(oapl_id, H5P_LINK_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "oapl_id is not a link access property list ID") /* Get the VOL object */ if(NULL == (vol_obj = H5VL_vol_object(loc_id))) @@ -200,10 +219,11 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = oapl_id; loc_params.obj_type = obj_type; /* Get the object token */ - if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_token) < 0) + if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_token) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token") /* Create the reference (do not pass filename, since file_id is attached) */ @@ -234,7 +254,7 @@ done: */ herr_t H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, - H5R_ref_t *ref_ptr) + hid_t oapl_id, H5R_ref_t *ref_ptr) { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5I_type_t obj_type; /* Object type of loc_id */ @@ -246,7 +266,7 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*s*s*Rr", loc_id, name, attr_name, ref_ptr); + H5TRACE5("e", "i*s*si*Rr", loc_id, name, attr_name, oapl_id, ref_ptr); /* Check args */ if(ref_ptr == NULL) @@ -255,6 +275,15 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name given") + if(oapl_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Get object access property list */ + if(H5P_DEFAULT == oapl_id) + oapl_id = H5P_LINK_ACCESS_DEFAULT; + else + if(TRUE != H5P_isa_class(oapl_id, H5P_LINK_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "oapl_id is not a link access property list ID") /* Get the VOL object */ if(NULL == (vol_obj = H5VL_vol_object(loc_id))) @@ -279,10 +308,11 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = oapl_id; loc_params.obj_type = obj_type; /* Get the object token */ - if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_token) < 0) + if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_token) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token") /* Create the reference (do not pass filename, since file_id is attached) */ @@ -481,7 +511,7 @@ H5Ropen_object(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id) /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = H5I_get_type(loc_id); /* Open object by token */ @@ -553,7 +583,7 @@ H5Ropen_region(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id) /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = H5I_get_type(loc_id); /* Open object by token */ @@ -645,7 +675,7 @@ H5Ropen_attr(const H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id) /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = H5I_get_type(loc_id); /* Open object by token */ @@ -735,7 +765,7 @@ H5Rget_obj_type3(const H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type) /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = H5I_get_type(loc_id); /* Retrieve object's type */ @@ -843,7 +873,7 @@ H5Rget_obj_name(const H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf, size_t size) /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = H5I_get_type(loc_id); /* Retrieve object's name */ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 0636da9..ad3c219 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -128,7 +128,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = vol_obj_type; /* Retrieve object's type */ @@ -188,7 +188,7 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref) /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = vol_obj_type; /* Dereference */ @@ -258,10 +258,11 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT; loc_params.obj_type = vol_obj_type; /* Get the object token */ - if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_token) < 0) + if(H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_token) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token") /* Get the file for the object */ @@ -356,7 +357,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = vol_obj_type; /* Retrieve object's type */ @@ -420,7 +421,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = vol_obj_type; /* Open object by token */ @@ -553,7 +554,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *ref, char *name, /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; - loc_params.loc_data.loc_by_token.token = obj_token; + loc_params.loc_data.loc_by_token.token = &obj_token; loc_params.obj_type = vol_obj_type; /* Retrieve object's name */ diff --git a/src/H5Rint.c b/src/H5Rint.c index 558c095..9879865 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -258,7 +258,7 @@ H5R__create_object(const H5VL_token_t *obj_token, size_t token_size, HDassert(ref); /* Create new reference */ - H5MM_memcpy(ref->ref.obj.token, obj_token, token_size); + H5MM_memcpy(&ref->ref.obj.token, obj_token, token_size); ref->ref.obj.filename = NULL; ref->loc_id = H5I_INVALID_HID; ref->type = (uint8_t)H5R_OBJECT2; @@ -300,7 +300,7 @@ H5R__create_region(const H5VL_token_t *obj_token, size_t token_size, HDassert(ref); /* Create new reference */ - H5MM_memcpy(ref->ref.obj.token, obj_token, token_size); + H5MM_memcpy(&ref->ref.obj.token, obj_token, token_size); ref->ref.obj.filename = NULL; if(NULL == (ref->ref.reg.space = H5S_copy(space, FALSE, TRUE))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy dataspace") @@ -355,7 +355,7 @@ H5R__create_attr(const H5VL_token_t *obj_token, size_t token_size, HGOTO_ERROR(H5E_REFERENCE, H5E_ARGS, FAIL, "attribute name too long (%d > %d)", (int)HDstrlen(attr_name), H5R_MAX_STRING_LEN) /* Create new reference */ - H5MM_memcpy(ref->ref.obj.token, obj_token, token_size); + H5MM_memcpy(&ref->ref.obj.token, obj_token, token_size); ref->ref.obj.filename = NULL; if(NULL == (ref->ref.attr.name = HDstrdup(attr_name))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy attribute name") @@ -602,7 +602,7 @@ H5R__equal(const H5R_ref_priv_t *ref1, const H5R_ref_priv_t *ref2) /* Compare object addresses */ if(ref1->token_size != ref2->token_size) HGOTO_DONE(FALSE); - if(0 != HDmemcmp(ref1->ref.obj.token, ref2->ref.obj.token, ref1->token_size)) + if(0 != HDmemcmp(&ref1->ref.obj.token, &ref2->ref.obj.token, ref1->token_size)) HGOTO_DONE(FALSE); /* Compare filenames */ @@ -659,7 +659,7 @@ H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref) HDassert((src_ref != NULL) && (dst_ref != NULL)); - H5MM_memcpy(dst_ref->ref.obj.token, src_ref->ref.obj.token, src_ref->token_size); + H5MM_memcpy(&dst_ref->ref.obj.token, &src_ref->ref.obj.token, src_ref->token_size); dst_ref->encode_size = src_ref->encode_size; dst_ref->type = src_ref->type; dst_ref->token_size = src_ref->token_size; @@ -729,7 +729,7 @@ H5R__get_obj_token(const H5R_ref_priv_t *ref, H5VL_token_t *obj_token, if(obj_token) { if(0 == ref->token_size) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "NULL token size") - H5MM_memcpy(obj_token, ref->ref.obj.token, ref->token_size); + H5MM_memcpy(obj_token, &ref->ref.obj.token, ref->token_size); } if(token_size) *token_size = ref->token_size; @@ -761,7 +761,7 @@ H5R__set_obj_token(H5R_ref_priv_t *ref, const H5VL_token_t *obj_token, HDassert(token_size); HDassert(token_size <= H5VL_MAX_TOKEN_SIZE); - H5MM_memcpy(ref->ref.obj.token, obj_token, ref->token_size); + H5MM_memcpy(&ref->ref.obj.token, obj_token, ref->token_size); ref->token_size = token_size; FUNC_LEAVE_NOAPI(ret_value) @@ -1702,13 +1702,13 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, /* Get object address */ p = (const uint8_t *)data; - H5MM_memcpy(token, p, token_size); + H5MM_memcpy(&token, p, token_size); p += token_size; if(space_ptr) { H5O_loc_t oloc; /* Object location */ H5S_t *space = NULL; - const uint8_t *q = token; + const uint8_t *q = (const uint8_t *)&token; /* Initialize the object location */ H5O_loc_reset(&oloc); @@ -1726,7 +1726,7 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, *space_ptr = space; } if(obj_token) - H5MM_memcpy(obj_token, token, token_size); + H5MM_memcpy(obj_token, &token, token_size); done: H5MM_free(data); diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h index ce54ac4..a13d54b 100644 --- a/src/H5Rpublic.h +++ b/src/H5Rpublic.h @@ -70,14 +70,18 @@ typedef haddr_t hobj_ref_t; * machine (8 bytes currently) plus an int. * Note! This type can only be used with the "native" HDF5 VOL connector. */ -typedef unsigned char hdset_reg_ref_t[H5R_DSET_REG_REF_BUF_SIZE]; +typedef struct { + char __data[H5R_DSET_REG_REF_BUF_SIZE]; +} hdset_reg_ref_t; /** * Opaque reference type. The same reference type is used for object, * dataset region and attribute references. This is the type that * should always be used with the current reference API. */ -typedef unsigned char H5R_ref_t[H5R_REF_BUF_SIZE]; +typedef struct { + char __data[H5R_REF_BUF_SIZE]; +} H5R_ref_t; /********************/ /* Public Variables */ @@ -93,9 +97,9 @@ extern "C" { #endif /* Constructors */ -H5_DLL herr_t H5Rcreate_object(hid_t loc_id, const char *name, H5R_ref_t *ref_ptr); -H5_DLL herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, H5R_ref_t *ref_ptr); -H5_DLL herr_t H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, H5R_ref_t *ref_ptr); +H5_DLL herr_t H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_ptr); +H5_DLL herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id, H5R_ref_t *ref_ptr); +H5_DLL herr_t H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, hid_t oapl_id, H5R_ref_t *ref_ptr); H5_DLL herr_t H5Rdestroy(H5R_ref_t *ref_ptr); /* Info */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index ab06eff..1e1538e 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -4265,6 +4265,9 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) /* Decode version */ UINT32DECODE(pp, version); + if(version < H5S_HYPER_VERSION_1 || version > H5S_HYPER_VERSION_LATEST) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for hyperslab selection") + if(version >= (uint32_t)H5S_HYPER_VERSION_2) { /* Decode flags */ flags = *(pp)++; @@ -11503,7 +11506,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, HDassert(src_intersect_space); HDassert(proj_space); - /* Assert that src_space and src_intersect_space have same extent and there + /* Assert that src_space and src_intersect_space have same rank and there * are no point selections */ HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space)); HDassert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space)); diff --git a/src/H5Spkg.h b/src/H5Spkg.h index ba60cbf..e139bce 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -41,9 +41,10 @@ #define H5S_SELECT_FLAG_BITS (H5S_HYPER_REGULAR) /* Versions for H5S_SEL_HYPER selection info */ -#define H5S_HYPER_VERSION_1 1 -#define H5S_HYPER_VERSION_2 2 -#define H5S_HYPER_VERSION_3 3 +#define H5S_HYPER_VERSION_1 1 +#define H5S_HYPER_VERSION_2 2 +#define H5S_HYPER_VERSION_3 3 +#define H5S_HYPER_VERSION_LATEST H5S_HYPER_VERSION_3 /* Versions for H5S_SEL_POINTS selection info */ #define H5S_POINT_VERSION_1 1 diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 664f4b5..6c8b898 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -2615,6 +2615,7 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, HDassert(src_intersect_space); HDassert(new_space_ptr); HDassert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space)); + HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space)); /* Create new space, using dst extent. Start with "all" selection. */ if(NULL == (new_space = H5S_create(H5S_SIMPLE))) @@ -2639,97 +2640,134 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space, HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") } /* end if */ else { - /* If the source intersect space is a point selection, convert it to a - * hyperslab (discarding ordering). We can get away with this because - * the order does not matter for the source intersect space */ - /* Maybe we should just leave it as a point selection for the point by - * point algorithm? The search through the selection in - * H5S_SELECT_INTERSECT_BLOCK will likely be O(N) either way. -NAF */ - if(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_POINTS) { - H5S_pnt_node_t *curr_pnt = src_intersect_space->select.sel_info.pnt_lst->head; - - /* Create dataspace and copy extent */ - if(NULL == (tmp_src_intersect_space = H5S_create(H5S_SIMPLE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create temporary source intersect dataspace") - if(H5S__extent_copy_real(&tmp_src_intersect_space->extent, &src_intersect_space->extent, FALSE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy source intersect space extent") - - /* Iterate over points */ - for(curr_pnt = src_intersect_space->select.sel_info.pnt_lst->head; curr_pnt; curr_pnt = curr_pnt->next) - /* Add point to hyperslab selection */ - if(H5S_hyper_add_span_element(tmp_src_intersect_space, src_intersect_space->extent.rank, curr_pnt->pnt) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't add point to temporary dataspace selection") - - /* Redirect local src_intersect_space pointer (will not affect - * calling function) */ - src_intersect_space = tmp_src_intersect_space; - } /* end for */ - - /* By this point, src_intersect_space must be a hyperslab selection */ - HDassert(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_HYPERSLABS); - - /* If either the source space or the destination space is a point - * selection, iterate element by element */ - if((H5S_GET_SELECT_TYPE(src_space) == H5S_SEL_POINTS) - || (H5S_GET_SELECT_TYPE(dst_space) == H5S_SEL_POINTS)) { - hsize_t coords[H5S_MAX_RANK]; + /* Handle scalar dataspaces. It should not be possible for the source + * intersect space or the source space to be scalar since scalar spaces + * only support all or none selections, and both of those cases are + * covered above, and the source intersect space must have the same + * rank, so it also cannot be scalar, as scalar dataspaces have a rank + * of 0. */ + HDassert(H5S_GET_EXTENT_TYPE(src_space) != H5S_SCALAR); + HDassert(H5S_GET_EXTENT_TYPE(src_intersect_space) != H5S_SCALAR); + + /* Check for scalar dst_space. In this case we simply check if the + * (single) point selected in src_space intersects src_intersect_space, + * if so select all in new_space, otherwise select none. */ + if(H5S_GET_EXTENT_TYPE(dst_space) == H5S_SCALAR) { + hsize_t coords_start[H5S_MAX_RANK]; + hsize_t coords_end[H5S_MAX_RANK]; htri_t intersect; - /* Start with "none" selection */ - if(H5S_select_none(new_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + /* Get source space bounds. Should be a single point. */ + if(H5S_SELECT_BOUNDS(src_space, coords_start, coords_end) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get source space bounds") + HDassert(0 == HDmemcmp(coords_start, coords_end, H5S_GET_EXTENT_NDIMS(src_space) * sizeof(coords_start[0]))); - /* Initialize iterators */ - if(H5S_select_iter_init(&ss_iter, src_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize source space selection iterator") - ss_iter_init = TRUE; - if(H5S_select_iter_init(&ds_iter, dst_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize destination space selection iterator") - ds_iter_init = TRUE; - - /* Iterate over points */ - do { - HDassert(ss_iter.elmt_left > 0); - HDassert(ss_iter.elmt_left > 0); - - /* Get SS coords */ - if(H5S_SELECT_ITER_COORDS(&ss_iter, coords) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get source selection coordinates") - - /* Check for intersection */ - if((intersect = H5S_SELECT_INTERSECT_BLOCK(src_intersect_space, coords, coords)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't check for intersection") - - /* Add point if it intersects */ - if(intersect) { - /* Get DS coords */ - if(H5S_SELECT_ITER_COORDS(&ds_iter, coords) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get destination selection coordinates") - - /* Add point to new_space */ - if(H5S_select_elements(new_space, H5S_SELECT_APPEND, 1, coords) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't add point to new selection") - } /* end if */ + /* Check for intersection */ + if((intersect = H5S_SELECT_INTERSECT_BLOCK(src_intersect_space, coords_start, coords_end)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't check for intersection") - /* Advance iterators */ - if(H5S_SELECT_ITER_NEXT(&ss_iter, 1) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne source selection iterator") - ss_iter.elmt_left--; - if(H5S_SELECT_ITER_NEXT(&ds_iter, 1) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne destination selection iterator") - ds_iter.elmt_left--; - } while(ss_iter.elmt_left > 0); - HDassert(H5S_SELECT_ITER_NELMTS(&ds_iter) == 0); + /* Select all or none as appropriate */ + if(intersect) { + if(H5S_select_all(new_space, TRUE) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't select all") + } /* end if */ + else + if(H5S_select_none(new_space) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") } /* end if */ else { - HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_NONE); - HDassert(H5S_GET_SELECT_TYPE(dst_space) != H5S_SEL_NONE); - - /* Source and destination selections are all or hyperslab, - * intersecting selection is hyperslab. Call the hyperslab routine - * to project to another hyperslab selection. */ - if(H5S__hyper_project_intersection(src_space, dst_space, src_intersect_space, new_space, share_selection) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't project hyperslab onto destination selection") + /* If the source intersect space is a point selection, convert it to a + * hyperslab (discarding ordering). We can get away with this because + * the order does not matter for the source intersect space */ + /* Maybe we should just leave it as a point selection for the point by + * point algorithm? The search through the selection in + * H5S_SELECT_INTERSECT_BLOCK will likely be O(N) either way. -NAF */ + if(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_POINTS) { + H5S_pnt_node_t *curr_pnt = src_intersect_space->select.sel_info.pnt_lst->head; + + /* Create dataspace and copy extent */ + if(NULL == (tmp_src_intersect_space = H5S_create(H5S_SIMPLE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create temporary source intersect dataspace") + if(H5S__extent_copy_real(&tmp_src_intersect_space->extent, &src_intersect_space->extent, FALSE) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy source intersect space extent") + + /* Iterate over points */ + for(curr_pnt = src_intersect_space->select.sel_info.pnt_lst->head; curr_pnt; curr_pnt = curr_pnt->next) + /* Add point to hyperslab selection */ + if(H5S_hyper_add_span_element(tmp_src_intersect_space, src_intersect_space->extent.rank, curr_pnt->pnt) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't add point to temporary dataspace selection") + + /* Redirect local src_intersect_space pointer (will not affect + * calling function) */ + src_intersect_space = tmp_src_intersect_space; + } /* end for */ + + /* By this point, src_intersect_space must be a hyperslab selection */ + HDassert(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_HYPERSLABS); + + /* If either the source space or the destination space is a point + * selection, iterate element by element */ + if((H5S_GET_SELECT_TYPE(src_space) == H5S_SEL_POINTS) + || (H5S_GET_SELECT_TYPE(dst_space) == H5S_SEL_POINTS)) { + hsize_t coords[H5S_MAX_RANK]; + htri_t intersect; + + /* Start with "none" selection */ + if(H5S_select_none(new_space) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + + /* Initialize iterators */ + if(H5S_select_iter_init(&ss_iter, src_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize source space selection iterator") + ss_iter_init = TRUE; + if(H5S_select_iter_init(&ds_iter, dst_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize destination space selection iterator") + ds_iter_init = TRUE; + + /* Iterate over points */ + do { + HDassert(ss_iter.elmt_left > 0); + HDassert(ss_iter.elmt_left > 0); + + /* Get SS coords */ + if(H5S_SELECT_ITER_COORDS(&ss_iter, coords) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get source selection coordinates") + + /* Check for intersection */ + if((intersect = H5S_SELECT_INTERSECT_BLOCK(src_intersect_space, coords, coords)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't check for intersection") + + /* Add point if it intersects */ + if(intersect) { + /* Get DS coords */ + if(H5S_SELECT_ITER_COORDS(&ds_iter, coords) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get destination selection coordinates") + + /* Add point to new_space */ + if(H5S_select_elements(new_space, H5S_SELECT_APPEND, 1, coords) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't add point to new selection") + } /* end if */ + + /* Advance iterators */ + if(H5S_SELECT_ITER_NEXT(&ss_iter, 1) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne source selection iterator") + ss_iter.elmt_left--; + if(H5S_SELECT_ITER_NEXT(&ds_iter, 1) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne destination selection iterator") + ds_iter.elmt_left--; + } while(ss_iter.elmt_left > 0); + HDassert(H5S_SELECT_ITER_NELMTS(&ds_iter) == 0); + } /* end if */ + else { + HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_NONE); + HDassert(H5S_GET_SELECT_TYPE(dst_space) != H5S_SEL_NONE); + + /* Source and destination selections are all or hyperslab, + * intersecting selection is hyperslab. Call the hyperslab routine + * to project to another hyperslab selection. */ + if(H5S__hyper_project_intersection(src_space, dst_space, src_intersect_space, new_space, share_selection) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't project hyperslab onto destination selection") + } /* end else */ } /* end else */ } /* end else */ @@ -2804,10 +2842,15 @@ H5Sselect_project_intersection(hid_t src_space_id, hid_t dst_space_id, if(NULL == (src_intersect_space = (H5S_t *)H5I_object_verify(src_intersect_space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") - /* Check numbbers of points selected matches in source and destination */ + /* Check numbers of points selected matches in source and destination */ if(H5S_GET_SELECT_NPOINTS(src_space) != H5S_GET_SELECT_NPOINTS(dst_space)) HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "number of points selected in source space does not match that in destination space") + /* Check numbers of dimensions matches in source and source intersect spaces + */ + if(H5S_GET_EXTENT_NDIMS(src_space) != H5S_GET_EXTENT_NDIMS(src_intersect_space)) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "rank of source space does not match rank of source intersect space") + /* Perform operation */ if(H5S_select_project_intersection(src_space, dst_space, src_intersect_space, &proj_space, FALSE) < 0) @@ -254,6 +254,7 @@ dt->shared->u.atomic.u.r.rtype = H5R_OBJECT2; \ dt->shared->u.atomic.u.r.opaque = TRUE; \ dt->shared->u.atomic.u.r.version = H5R_ENCODE_VERSION; \ + dt->shared->version = H5O_DTYPE_VERSION_4; \ } /* Define the code templates for the "SIZE_TMPL" in the H5T_INIT_TYPE macro */ diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h index f0925bf..373eb44 100644 --- a/src/H5VLconnector.h +++ b/src/H5VLconnector.h @@ -52,7 +52,9 @@ /* type for tokens. Token are unique and permanent identifiers that are * used to reference HDF5 objects. */ -typedef unsigned char H5VL_token_t[H5VL_MAX_TOKEN_SIZE]; +typedef struct { + char __data[H5VL_MAX_TOKEN_SIZE]; +} H5VL_token_t; /* types for attribute GET callback */ typedef enum H5VL_attr_get_t { @@ -213,7 +215,7 @@ typedef struct H5VL_loc_by_idx { } H5VL_loc_by_idx_t; typedef struct H5VL_loc_by_token { - void *token; + H5VL_token_t *token; } H5VL_loc_by_token_t; /* Structure to hold parameters for object locations. diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c index dfa4eab..6a22b05 100644 --- a/src/H5VLnative_object.c +++ b/src/H5VLnative_object.c @@ -287,7 +287,7 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5V /* Lookup object */ case H5VL_OBJECT_LOOKUP: { - void *token = va_arg(arguments, void *); + H5VL_token_t *token = va_arg(arguments, H5VL_token_t *); HDassert(token); diff --git a/src/H5private.h b/src/H5private.h index 2b35bd4..c39c946 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -521,13 +521,6 @@ # define H5_POSIX_CREATE_MODE_RW 0666 #endif -/* - * A macro to portably increment enumerated types. - */ -#ifndef H5_INC_ENUM -# define H5_INC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)+1)) -#endif - /* Represents an empty asynchronous request handle. * Used in the VOL code. */ diff --git a/src/hdf5-lin.lnt b/src/hdf5-lin.lnt index da20937..23ceed2 100644 --- a/src/hdf5-lin.lnt +++ b/src/hdf5-lin.lnt @@ -13,9 +13,6 @@ // Turn off warnings about not using the return value from these functions: -emacro(534,HDfflush,HDgetrusage,HDgettimeofday,HDputc) -// Turn off warnings about converting an enum to an int --emacro(641,H5_INC_ENUM,H5_DEC_ENUM) - // Suppress message about "Expression with side effects passed to repeated parameter 1 in macro 'assert'" -esym(666,assert) diff --git a/src/hdf5.lnt b/src/hdf5.lnt index 642698a..995e3f6 100644 --- a/src/hdf5.lnt +++ b/src/hdf5.lnt @@ -30,11 +30,6 @@ -esym(534, H5UC_decr) -esym(534, H5VM_array_fill) - -// Turn off warnings about "Expression-like macro not parenthesized" for -// enumerated type increment & decrement macros: --esym(773, H5_INC_ENUM, H5_DEC_ENUM) - /* So far, the following files have been linted with these options: H5.c H5A.c @@ -60,7 +55,7 @@ H5FO.c H5Tcommit.c - H5Tcompound.c + H5Tcompound.c H5Tcset.c H5Tenum.c |