From fd1970572f83c92903f1f83cc0dd3bf3a7fc2928 Mon Sep 17 00:00:00 2001 From: Chris Hogan Date: Mon, 18 Nov 2019 14:07:03 -0600 Subject: Community-proposed fix --- src/H5Dint.c | 28 +++++++++++++++++++++------- src/H5Dpkg.h | 1 + 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index 772a150..bda4662 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") @@ -1686,7 +1700,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 */ @@ -3436,8 +3450,8 @@ H5D_get_access_plist(const H5D_t *dset) 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") + 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))) diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 723acf9..ff43880 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 */ -- cgit v0.12 From 0de8401d34675b927d22d1a642842f8eaaf5a10a Mon Sep 17 00:00:00 2001 From: Chris Hogan Date: Thu, 21 Nov 2019 16:21:06 -0600 Subject: Add two missing calls to H5I_dec_ref for new dapl_id --- src/H5Dint.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index bda4662..0dec9ac 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1334,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 */ @@ -1396,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); @@ -1982,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) -- cgit v0.12 From 3664cea5d6f87a7e8e708191f9cea36077424a80 Mon Sep 17 00:00:00 2001 From: Chris Hogan Date: Mon, 25 Nov 2019 16:28:51 -0600 Subject: Fix failing test and retain semantics for chunk cache properties in non-chunked datasets --- src/H5Dint.c | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index 0dec9ac..21447c0 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -3445,14 +3445,17 @@ 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 */ + /* 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) @@ -3460,7 +3463,8 @@ H5D_get_access_plist(const H5D_t *dset) 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") @@ -3470,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) -- cgit v0.12 From 874900d39561f97c0a41b7efc59686daa66df95e Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Mon, 2 Dec 2019 12:43:49 -0600 Subject: Add OAPL parameter to H5Rcreate_ APIs --- examples/h5_ref_extern.c | 2 +- src/H5R.c | 42 ++++++++++++++++++++++++---- src/H5Rdeprec.c | 1 + src/H5Rpublic.h | 6 ++-- test/objcopy_ref.c | 12 ++++---- test/trefer.c | 72 ++++++++++++++++++++++++------------------------ 6 files changed, 83 insertions(+), 52 deletions(-) diff --git a/examples/h5_ref_extern.c b/examples/h5_ref_extern.c index 4327a06..17082ba 100644 --- a/examples/h5_ref_extern.c +++ b/examples/h5_ref_extern.c @@ -56,7 +56,7 @@ main(void) { /* Create reference to dataset1 in "refer_extern1.h5" */ file1 = H5Fopen(H5FILE_NAME1, H5F_ACC_RDONLY, H5P_DEFAULT); - H5Rcreate_object(file1, "dataset1", &ref_buf[0]); + H5Rcreate_object(file1, "dataset1", H5P_DEFAULT, &ref_buf[0]); H5Fclose(file1); /* Store reference in dataset in separate file "refer_extern2.h5" */ diff --git a/src/H5R.c b/src/H5R.c index 31b2bcd..70d4749 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -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,6 +126,7 @@ 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 */ @@ -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,6 +219,7 @@ 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 */ @@ -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,6 +308,7 @@ 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 */ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 0636da9..63be3f8 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -258,6 +258,7 @@ 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 */ diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h index ce54ac4..585cb85 100644 --- a/src/H5Rpublic.h +++ b/src/H5Rpublic.h @@ -93,9 +93,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/test/objcopy_ref.c b/test/objcopy_ref.c index 721a7c6..a73e569 100644 --- a/test/objcopy_ref.c +++ b/test/objcopy_ref.c @@ -247,8 +247,8 @@ attach_ref_attr(hid_t file_id, hid_t loc_id) if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data2) < 0) TEST_ERROR /* create an attribute with two object references */ - if(H5Rcreate_object(file_id, dsetname1, &ref[0]) < 0) TEST_ERROR - if(H5Rcreate_object(file_id, dsetname2, &ref[1]) < 0) TEST_ERROR + if(H5Rcreate_object(file_id, dsetname1, H5P_DEFAULT, &ref[0]) < 0) TEST_ERROR + if(H5Rcreate_object(file_id, dsetname2, H5P_DEFAULT, &ref[1]) < 0) TEST_ERROR if((aid = H5Acreate2(loc_id, "obj_ref_attr", H5T_STD_REF, sid_ref, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Awrite(aid, H5T_STD_REF, ref) < 0) TEST_ERROR @@ -315,12 +315,12 @@ attach_reg_ref_attr(hid_t file_id, hid_t loc_id) /* create reg_ref of block selection */ if(H5Sselect_hyperslab(space_id,H5S_SELECT_SET,start,NULL,count,NULL) < 0) TEST_ERROR - if(H5Rcreate_region(file_id, dsetnamev, space_id, &ref[0]) < 0) TEST_ERROR + if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[0]) < 0) TEST_ERROR /* create reg_ref of point selection */ if(H5Sselect_none(space_id) < 0) TEST_ERROR if(H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t *)coord) < 0) TEST_ERROR - if(H5Rcreate_region(file_id, dsetnamev, space_id, &ref[1]) < 0) TEST_ERROR + if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[1]) < 0) TEST_ERROR /* create reg_ref attribute */ if((aid = H5Acreate2(loc_id, "reg_ref_attr", H5T_STD_REF, spacer_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -402,10 +402,10 @@ create_reg_ref_dataset(hid_t file_id, hid_t loc_id) count[0] = 2; count[1] = 3; if(H5Sselect_hyperslab(space_id,H5S_SELECT_SET,start,NULL,count,NULL) < 0) TEST_ERROR - if(H5Rcreate_region(file_id, dsetnamev, space_id, &ref[0]) < 0) TEST_ERROR + if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[0]) < 0) TEST_ERROR if(H5Sselect_none(space_id) < 0) TEST_ERROR if(H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t *)coord) < 0) TEST_ERROR - if(H5Rcreate_region(file_id, dsetnamev, space_id, &ref[1]) < 0) TEST_ERROR + if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[1]) < 0) TEST_ERROR if(H5Dwrite(dsetr_id, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT,ref) < 0) TEST_ERROR if(H5Dclose(dsetr_id) < 0) TEST_ERROR diff --git a/test/trefer.c b/test/trefer.c index 0f9e4f9..9fc6563 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -195,33 +195,33 @@ test_reference_params(void) CHECK(ret, H5I_INVALID_HID, "H5Dcreate2"); /* Test parameters to H5Rcreate_object */ - ret = H5Rcreate_object(fid1, "/Group1/Dataset1", NULL); + ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, NULL); VERIFY(ret, FAIL, "H5Rcreate_object ref"); - ret = H5Rcreate_object(H5I_INVALID_HID, "/Group1/Dataset1", &wbuf[0]); + ret = H5Rcreate_object(H5I_INVALID_HID, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_object loc_id"); - ret = H5Rcreate_object(fid1, NULL, &wbuf[0]); + ret = H5Rcreate_object(fid1, NULL, H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_object name"); - ret = H5Rcreate_object(fid1, "", &wbuf[0]); + ret = H5Rcreate_object(fid1, "", H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_object null name"); /* Test parameters to H5Rcreate_region */ - ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, NULL); + ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, NULL); VERIFY(ret, FAIL, "H5Rcreate_region ref"); - ret = H5Rcreate_region(H5I_INVALID_HID, "/Group1/Dataset1", sid1, &wbuf[0]); + ret = H5Rcreate_region(H5I_INVALID_HID, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_region loc_id"); - ret = H5Rcreate_region(fid1, NULL, sid1, &wbuf[0]); + ret = H5Rcreate_region(fid1, NULL, sid1, H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_region name"); - ret = H5Rcreate_region(fid1, "/Group1/Dataset1", H5I_INVALID_HID, &wbuf[0]); + ret = H5Rcreate_region(fid1, "/Group1/Dataset1", H5I_INVALID_HID, H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_region dataspace"); /* Test parameters to H5Rcreate_attr */ - ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", "Attr", NULL); + ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", "Attr", H5P_DEFAULT, NULL); VERIFY(ret, FAIL, "H5Rcreate_attr ref"); - ret = H5Rcreate_attr(H5I_INVALID_HID, "/Group1/Dataset2", "Attr", &wbuf[0]); + ret = H5Rcreate_attr(H5I_INVALID_HID, "/Group1/Dataset2", "Attr", H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_attr loc_id"); - ret = H5Rcreate_attr(fid1, NULL, "Attr", &wbuf[0]); + ret = H5Rcreate_attr(fid1, NULL, "Attr", H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_attr name"); - ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", NULL, &wbuf[0]); + ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", NULL, H5P_DEFAULT, &wbuf[0]); VERIFY(ret, FAIL, "H5Rcreate_attr attr_name"); /* Test parameters to H5Rdestroy */ @@ -403,28 +403,28 @@ test_reference_obj(void) CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); /* Create reference to dataset */ - ret = H5Rcreate_object(fid1, "/Group1/Dataset1", &wbuf[0]); + ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_object"); ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to dataset */ - ret = H5Rcreate_object(fid1, "/Group1/Dataset2", &wbuf[1]); + ret = H5Rcreate_object(fid1, "/Group1/Dataset2", H5P_DEFAULT, &wbuf[1]); CHECK(ret, FAIL, "H5Rcreate_object"); ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[1], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to group */ - ret = H5Rcreate_object(fid1, "/Group1", &wbuf[2]); + ret = H5Rcreate_object(fid1, "/Group1", H5P_DEFAULT, &wbuf[2]); CHECK(ret, FAIL, "H5Rcreate_object"); ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[2], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3"); /* Create reference to named datatype */ - ret = H5Rcreate_object(fid1, "/Group1/Datatype1", &wbuf[3]); + ret = H5Rcreate_object(fid1, "/Group1/Datatype1", H5P_DEFAULT, &wbuf[3]); CHECK(ret, FAIL, "H5Rcreate_object"); ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[3], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -645,7 +645,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(ret, 36, "H5Sget_select_npoints"); /* Store first dataset region */ - ret = H5Rcreate_region(fid1, "/Dataset2", sid2, &wbuf[0]); + ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_region"); ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -669,7 +669,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(ret, SPACE2_DIM2, "H5Sget_select_npoints"); /* Store second dataset region */ - ret = H5Rcreate_region(fid1, "/Dataset2", sid2, &wbuf[1]); + ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[1]); CHECK(ret, FAIL, "H5Rcreate_region"); /* Select unlimited hyperslab for third reference */ @@ -688,7 +688,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints"); /* Store third dataset region */ - ret = H5Rcreate_region(fid1, "/Dataset2", sid2, &wbuf[2]); + ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[2]); CHECK(ret, FAIL, "H5Rcreate_region"); ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[2], H5P_DEFAULT, &obj_type); @@ -696,7 +696,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Store fourth dataset region */ - ret = H5Rcreate_region(fid1, "/Dataset2", sid2, &wbuf[3]); + ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[3]); CHECK(ret, FAIL, "H5Rcreate_region"); /* Write selection to disk */ @@ -1068,7 +1068,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(ret, (block[0] * count[0]), "H5Sget_select_npoints"); /* Store first dataset region */ - ret = H5Rcreate_region(fid1, "/Dataset2", sid3, &wbuf[0]); + ret = H5Rcreate_region(fid1, "/Dataset2", sid3, H5P_DEFAULT, &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_region"); ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -1092,7 +1092,7 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high) VERIFY(ret, POINT1_NPOINTS, "H5Sget_select_npoints"); /* Store second dataset region */ - ret = H5Rcreate_region(fid1, "/Dataset2", sid3, &wbuf[1]); + ret = H5Rcreate_region(fid1, "/Dataset2", sid3, H5P_DEFAULT, &wbuf[1]); CHECK(ret, FAIL, "H5Rcreate_region"); /* Write selection to disk */ @@ -1311,7 +1311,7 @@ test_reference_obj_deleted(void) CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); /* Create reference to dataset */ - ret = H5Rcreate_object(fid1, "/Dataset1", &oref); + ret = H5Rcreate_object(fid1, "/Dataset1", H5P_DEFAULT, &oref); CHECK(ret, FAIL, "H5Rcreate_object"); ret = H5Rget_obj_type3((const H5R_ref_t *)&oref, H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -1469,7 +1469,7 @@ test_reference_group(void) CHECK(did, H5I_INVALID_HID, "H5Dcreate2"); /* Create reference to group */ - ret = H5Rcreate_object(fid, GROUPNAME, &wref); + ret = H5Rcreate_object(fid, GROUPNAME, H5P_DEFAULT, &wref); CHECK(ret, FAIL, "H5Rcreate_object"); /* Write reference to disk */ @@ -1678,28 +1678,28 @@ test_reference_attr(void) CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2"); /* Create reference to dataset1 attribute */ - ret = H5Rcreate_attr(fid, "/Group1/Dataset1", "Attr1", &ref_wbuf[0]); + ret = H5Rcreate_attr(fid, "/Group1/Dataset1", "Attr1", H5P_DEFAULT, &ref_wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_attr"); ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to dataset2 attribute */ - ret = H5Rcreate_attr(fid, "/Group1/Dataset2", "Attr1", &ref_wbuf[1]); + ret = H5Rcreate_attr(fid, "/Group1/Dataset2", "Attr1", H5P_DEFAULT, &ref_wbuf[1]); CHECK(ret, FAIL, "H5Rcreate_attr"); ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[1], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to group attribute */ - ret = H5Rcreate_attr(fid, "/Group1", "Attr2", &ref_wbuf[2]); + ret = H5Rcreate_attr(fid, "/Group1", "Attr2", H5P_DEFAULT, &ref_wbuf[2]); CHECK(ret, FAIL, "H5Rcreate_attr"); ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[2], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3"); /* Create reference to named datatype attribute */ - ret = H5Rcreate_attr(fid, "/Group1/Datatype1", "Attr3", &ref_wbuf[3]); + ret = H5Rcreate_attr(fid, "/Group1/Datatype1", "Attr3", H5P_DEFAULT, &ref_wbuf[3]); CHECK(ret, FAIL, "H5Rcreate_attr"); ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[3], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -1938,28 +1938,28 @@ test_reference_external(void) CHECK(ret, FAIL, "H5Gclose"); /* Create reference to dataset1 attribute */ - ret = H5Rcreate_attr(fid1, "/Group1/Dataset1", "Attr1", &ref_wbuf[0]); + ret = H5Rcreate_attr(fid1, "/Group1/Dataset1", "Attr1", H5P_DEFAULT, &ref_wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_attr"); ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to dataset2 attribute */ - ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", "Attr1", &ref_wbuf[1]); + ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", "Attr1", H5P_DEFAULT, &ref_wbuf[1]); CHECK(ret, FAIL, "H5Rcreate_attr"); ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[1], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3"); /* Create reference to group attribute */ - ret = H5Rcreate_attr(fid1, "/Group1", "Attr2", &ref_wbuf[2]); + ret = H5Rcreate_attr(fid1, "/Group1", "Attr2", H5P_DEFAULT, &ref_wbuf[2]); CHECK(ret, FAIL, "H5Rcreate_attr"); ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[2], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3"); /* Create reference to named datatype attribute */ - ret = H5Rcreate_attr(fid1, "/Group1/Datatype1", "Attr3", &ref_wbuf[3]); + ret = H5Rcreate_attr(fid1, "/Group1/Datatype1", "Attr3", H5P_DEFAULT, &ref_wbuf[3]); CHECK(ret, FAIL, "H5Rcreate_attr"); ret = H5Rget_obj_type3((const H5R_ref_t *)&ref_wbuf[3], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -2506,7 +2506,7 @@ test_reference_perf(void) t = 0; for(i = 0; i < MAX_ITER_CREATE; i++) { t1 = H5_get_time(); - ret = H5Rcreate_object(fid1, "/Group1/Dataset1", &wbuf[0]); + ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_object"); t2 = H5_get_time(); t += t2 - t1; @@ -2516,7 +2516,7 @@ test_reference_perf(void) HDprintf("--- Object reference create time: %lfs\n", t / MAX_ITER_CREATE); /* Create reference to dataset */ - ret = H5Rcreate_object(fid1, "/Group1/Dataset1", &wbuf[0]); + ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]); CHECK(ret, FAIL, "H5Rcreate_object"); ret = H5Rget_obj_type3((const H5R_ref_t *)&wbuf[0], H5P_DEFAULT, &obj_type); CHECK(ret, FAIL, "H5Rget_obj_type3"); @@ -2578,7 +2578,7 @@ test_reference_perf(void) for(i = 0; i < MAX_ITER_CREATE; i++) { t1 = H5_get_time(); /* Store first dataset region */ - ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, &wbuf_reg[0]); + ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf_reg[0]); CHECK(ret, FAIL, "H5Rcreate_region"); t2 = H5_get_time(); t += t2 - t1; @@ -2588,7 +2588,7 @@ test_reference_perf(void) HDprintf("--- Region reference create time: %lfs\n", t / MAX_ITER_CREATE); /* Store first dataset region */ - ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, &wbuf_reg[0]); + ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf_reg[0]); CHECK(ret, FAIL, "H5Rcreate_region"); t = 0; -- cgit v0.12