From e6bc326ec0c417ef7b003da535b2e071442d2067 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Tue, 24 Apr 2018 15:10:13 -0500 Subject: Fix for HDFFV-10180 Performance issues with H5Oget_info. --- MANIFEST | 1 + c++/src/H5Location.cpp | 6 +- c++/src/H5Object.cpp | 4 +- fortran/src/H5Af.c | 3 +- fortran/src/H5Gf.c | 3 +- fortran/src/H5Of.c | 21 +- hl/src/H5DS.c | 28 +- src/CMakeLists.txt | 1 + src/H5Gdeprec.c | 2 +- src/H5Gloc.c | 8 +- src/H5Gnode.c | 3 +- src/H5Gprivate.h | 2 +- src/H5O.c | 143 ++++++---- src/H5Odeprec.c | 332 ++++++++++++++++++++++ src/H5Oint.c | 153 ++++++----- src/H5Opkg.h | 6 +- src/H5Oprivate.h | 3 +- src/H5Opublic.h | 42 ++- src/H5vers.txt | 5 + src/Makefile.am | 2 +- test/cache_tagging.c | 8 +- test/cork.c | 40 +-- test/dsets.c | 14 +- test/dtypes.c | 8 +- test/flushrefresh.c | 8 +- test/genall5.c | 6 +- test/getname.c | 2 +- test/h5test.c | 4 +- test/links.c | 114 ++++---- test/mount.c | 64 ++--- test/mtime.c | 8 +- test/objcopy.c | 166 +++++------ test/ohdr.c | 2 +- test/stab.c | 4 +- test/tattr.c | 50 ++-- test/tfile.c | 16 +- test/th5o.c | 380 ++++++++++++++++++++++++-- test/titerate.c | 10 +- test/tmisc.c | 24 +- test/trefer.c | 2 +- test/tsohm.c | 4 +- test/unlink.c | 12 +- test/vds.c | 2 +- tools/lib/h5diff.c | 12 +- tools/lib/h5diff_array.c | 4 +- tools/lib/h5diff_attr.c | 4 +- tools/lib/h5tools.c | 8 +- tools/lib/h5tools_dump.c | 2 +- tools/lib/h5tools_ref.c | 4 +- tools/lib/h5tools_str.c | 2 +- tools/lib/h5tools_utils.c | 6 +- tools/lib/h5trav.c | 22 +- tools/lib/h5trav.h | 2 +- tools/src/h5dump/h5dump.c | 3 +- tools/src/h5dump/h5dump_ddl.c | 12 +- tools/src/h5dump/h5dump_xml.c | 10 +- tools/src/h5format_convert/h5format_convert.c | 2 +- tools/src/h5ls/h5ls.c | 6 +- tools/src/h5repack/h5repack.c | 4 +- tools/src/h5repack/h5repack_refs.c | 4 +- tools/src/h5stat/h5stat.c | 4 +- 61 files changed, 1284 insertions(+), 543 deletions(-) create mode 100644 src/H5Odeprec.c diff --git a/MANIFEST b/MANIFEST index 01edd91..fdc5124 100644 --- a/MANIFEST +++ b/MANIFEST @@ -751,6 +751,7 @@ ./src/H5Ocont.c ./src/H5Ocopy.c ./src/H5Odbg.c +./src/H5Odeprec.c ./src/H5Odrvinfo.c ./src/H5Odtype.c ./src/H5Oefl.c diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 2dceb6e..5e01a74 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -1827,7 +1827,7 @@ H5O_type_t H5Location::childObjType(const char* objname) const H5O_type_t objtype = H5O_TYPE_UNKNOWN; // Use C API to get information of the object - herr_t ret_value = H5Oget_info_by_name(getId(), objname, &objinfo, H5P_DEFAULT); + herr_t ret_value = H5Oget_info_by_name2(getId(), objname, &objinfo, 0, H5P_DEFAULT); // Throw exception if C API returns failure if (ret_value < 0) @@ -1902,7 +1902,7 @@ H5O_type_t H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_ite H5O_type_t objtype = H5O_TYPE_UNKNOWN; // Use C API to get information of the object - ret_value = H5Oget_info_by_idx(getId(), objname, index_type, order, index, &objinfo, H5P_DEFAULT); + ret_value = H5Oget_info_by_idx2(getId(), objname, index_type, order, index, &objinfo, 0, H5P_DEFAULT); // Throw exception if C API returns failure if (ret_value < 0) @@ -1944,7 +1944,7 @@ unsigned H5Location::childObjVersion(const char* objname) const unsigned version = 0; // Use C API to get information of the object - herr_t ret_value = H5Oget_info_by_name(getId(), objname, &objinfo, H5P_DEFAULT); + herr_t ret_value = H5Oget_info_by_name2(getId(), objname, &objinfo, H5O_INFO_HDR, H5P_DEFAULT); // Throw exception if C API returns failure if (ret_value < 0) diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 5d102d7..b95e222 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -244,7 +244,7 @@ unsigned H5Object::objVersion() const unsigned version = 0; // Use C API to get information of the object - herr_t ret_value = H5Oget_info(getId(), &objinfo); + herr_t ret_value = H5Oget_info2(getId(), &objinfo, H5O_INFO_HDR); // Throw exception if C API returns failure if (ret_value < 0) @@ -270,7 +270,7 @@ int H5Object::getNumAttrs() const { H5O_info_t oinfo; /* Object info */ - if(H5Oget_info(getId(), &oinfo) < 0) + if(H5Oget_info2(getId(), &oinfo, H5O_INFO_NUM_ATTRS) < 0) throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed"); else return(static_cast(oinfo.num_attrs)); diff --git a/fortran/src/H5Af.c b/fortran/src/H5Af.c index 23dd936..c75f19e 100644 --- a/fortran/src/H5Af.c +++ b/fortran/src/H5Af.c @@ -143,7 +143,8 @@ h5aget_num_attrs_c (hid_t_f *obj_id, int_f *attr_num) /* * Call H5Oget_info function. */ - if(H5Oget_info((hid_t)*obj_id, &oinfo) < 0) + /* TO DO: See H5Opublic.h: #define H5O_INFO_NUM_ATTRS 0x0002u Fill in the num_attrs field */ + if(H5Oget_info2((hid_t)*obj_id, &oinfo, (unsigned)2) < 0) HGOTO_DONE(FAIL); /* Set number of attributes */ diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c index b829b20..4ce7970 100644 --- a/fortran/src/H5Gf.c +++ b/fortran/src/H5Gf.c @@ -200,7 +200,8 @@ h5gget_obj_info_idx_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, /* Query the object's information */ if(H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, c_obj_name, c_obj_namelen, H5P_DEFAULT) < 0) goto DONE; - if(H5Oget_info_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, &oinfo, H5P_DEFAULT) < 0) + /* TO DO: See flags for H5Oget_info in H5Opublic.h */ + if(H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, &oinfo, 0, H5P_DEFAULT) < 0) goto DONE; /* XXX: Switch from using H5Gget_objtype_by_idx() means that this routine won't diff --git a/fortran/src/H5Of.c b/fortran/src/H5Of.c index 7d065a5..63d0084 100644 --- a/fortran/src/H5Of.c +++ b/fortran/src/H5Of.c @@ -250,7 +250,8 @@ h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, /* * Call H5Ovisit */ - func_ret_value = H5Ovisit( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, op, op_data); + /* TO DO: See H5Opublic.h: #define H5O_INFO_ALL (H5O_INFO_TIME|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR|H5O_INFO_META_SIZE) */ + func_ret_value = H5Ovisit( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, op, op_data, (unsigned)15); ret_value = (int_f)func_ret_value; @@ -330,8 +331,9 @@ h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *l /* * Call H5Oinfo_by_name function. */ - if(H5Oget_info_by_name((hid_t)*loc_id, c_name, - &Oinfo, (hid_t)*lapl_id) < 0) + /* TO DO: See H5Opublic.h: #define H5O_INFO_ALL (H5O_INFO_TIME|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR|H5O_INFO_META_SIZE) */ + if(H5Oget_info_by_name2((hid_t)*loc_id, c_name, + &Oinfo, (unsigned)15, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); ret_value = fill_h5o_info_t_f(Oinfo,object_info); @@ -385,8 +387,9 @@ h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, /* * Call H5Oinfo_by_idx function. */ - if(H5Oget_info_by_idx((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, - &Oinfo, (hid_t)*lapl_id) < 0) + /* TO DO: See H5Opublic.h: #define H5O_INFO_ALL (H5O_INFO_TIME|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR|H5O_INFO_META_SIZE) */ + if(H5Oget_info_by_idx2((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, + &Oinfo, (unsigned)15, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); ret_value = fill_h5o_info_t_f(Oinfo,object_info); @@ -424,7 +427,8 @@ h5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info) /* * Call H5Oinfo_by_name function. */ - if(H5Oget_info((hid_t)*object_id, &Oinfo) < 0) + /* TO DO: See H5Opublic.h: #define H5O_INFO_ALL (H5O_INFO_TIME|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR|H5O_INFO_META_SIZE) */ + if(H5Oget_info2((hid_t)*object_id, &Oinfo, (unsigned)15) < 0) HGOTO_DONE(FAIL); ret_value = fill_h5o_info_t_f(Oinfo,object_info); @@ -532,8 +536,9 @@ h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f /* * Call H5Ovisit */ - func_ret_value = H5Ovisit_by_name( (hid_t)*loc_id, c_object_name, (H5_index_t)*index_type, (H5_iter_order_t)*order, - op, op_data, (hid_t)*lapl_id); + /* TO DO: See H5Opublic.h: #define H5O_INFO_ALL (H5O_INFO_TIME|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR|H5O_INFO_META_SIZE) */ + func_ret_value = H5Ovisit_by_name2( (hid_t)*loc_id, c_object_name, (H5_index_t)*index_type, (H5_iter_order_t)*order, + op, op_data, (unsigned)15, (hid_t)*lapl_id); ret_value = (int_f)func_ret_value; done: diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 527c92b..78fb59d 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -160,11 +160,11 @@ herr_t H5DSattach_scale(hid_t did, return FAIL; /* get info for the dataset in the parameter list */ - if(H5Oget_info(did, &oi1) < 0) + if(H5Oget_info2(did, &oi1, 0) < 0) return FAIL; /* get info for the scale in the parameter list */ - if(H5Oget_info(dsid, &oi2) < 0) + if(H5Oget_info2(dsid, &oi2, 0) < 0) return FAIL; /* same object, not valid */ @@ -324,11 +324,11 @@ herr_t H5DSattach_scale(hid_t did, goto out; /* get info for DS in the parameter list */ - if(H5Oget_info(dsid, &oi1) < 0) + if(H5Oget_info2(dsid, &oi1, 0) < 0) goto out; /* get info for this DS */ - if(H5Oget_info(dsid_j, &oi2) < 0) + if(H5Oget_info2(dsid_j, &oi2, 0) < 0) goto out; /* same object, so this DS scale is already in this DIM IDX */ @@ -609,11 +609,11 @@ herr_t H5DSdetach_scale(hid_t did, return FAIL; /* get info for the dataset in the parameter list */ - if(H5Oget_info(did, &did_oi) < 0) + if(H5Oget_info2(did, &did_oi, 0) < 0) return FAIL; /* get info for the scale in the parameter list */ - if(H5Oget_info(dsid, &dsid_oi) < 0) + if(H5Oget_info2(dsid, &dsid_oi, 0) < 0) return FAIL; /* same object, not valid */ @@ -696,7 +696,7 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* get info for this DS */ - if(H5Oget_info(dsid_j, &tmp_oi) < 0) + if(H5Oget_info2(dsid_j, &tmp_oi, 0) < 0) goto out; /* Close the dereferenced dataset */ @@ -806,7 +806,7 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* get info for this dataset */ - if(H5Oget_info(did_i, &tmp_oi) < 0) + if(H5Oget_info2(did_i, &tmp_oi, 0) < 0) goto out; /* close the dereferenced dataset */ @@ -973,11 +973,11 @@ htri_t H5DSis_attached(hid_t did, return FAIL; /* get info for the dataset in the parameter list */ - if(H5Oget_info(did, &oi1) < 0) + if(H5Oget_info2(did, &oi1, 0) < 0) return FAIL; /* get info for the scale in the parameter list */ - if(H5Oget_info(dsid, &oi2) < 0) + if(H5Oget_info2(dsid, &oi2, 0) < 0) return FAIL; /* same object, not valid */ @@ -1054,11 +1054,11 @@ htri_t H5DSis_attached(hid_t did, goto out; /* get info for DS in the parameter list */ - if(H5Oget_info(dsid, &oi1) < 0) + if(H5Oget_info2(dsid, &oi1, 0) < 0) goto out; /* get info for this DS */ - if(H5Oget_info(dsid_j, &oi2) < 0) + if(H5Oget_info2(dsid_j, &oi2, 0) < 0) goto out; /* same object */ @@ -1144,11 +1144,11 @@ htri_t H5DSis_attached(hid_t did, goto out; /* get info for dataset in the parameter list */ - if(H5Oget_info(did, &oi3) < 0) + if(H5Oget_info2(did, &oi3, 0) < 0) goto out; /* get info for this dataset */ - if(H5Oget_info(did_i, &oi4) < 0) + if(H5Oget_info2(did_i, &oi4, 0) < 0) goto out; /* same object */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 435fe9a..c236b21 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -455,6 +455,7 @@ set (H5O_SOURCES ${HDF5_SRC_DIR}/H5Ocont.c ${HDF5_SRC_DIR}/H5Ocopy.c ${HDF5_SRC_DIR}/H5Odbg.c + ${HDF5_SRC_DIR}/H5Odeprec.c ${HDF5_SRC_DIR}/H5Odrvinfo.c ${HDF5_SRC_DIR}/H5Odtype.c ${HDF5_SRC_DIR}/H5Oefl.c diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index fc346f8..bd1b0ec 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -1118,7 +1118,7 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c /* Go retrieve the object information */ /* (don't need index & heap info) */ HDassert(obj_loc); - if(H5O_get_info(obj_loc->oloc, FALSE, &oinfo) < 0) + if(H5O_get_info(obj_loc->oloc, &oinfo, H5O_INFO_TIME | H5O_INFO_HDR) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info") /* Get mapped object type */ diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 7273a89..f5a14a1 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -76,7 +76,7 @@ typedef struct { /* User data for getting an object's info in a group */ typedef struct { /* downward */ - hbool_t want_ih_info; /* Whether to retrieve the index & heap info */ + unsigned fields; /* which fields in H5O_info_t struct to fill in */ /* upward */ H5O_info_t *oinfo; /* Object information to retrieve */ @@ -684,7 +684,7 @@ H5G_loc_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUS HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist") /* Query object information */ - if(H5O_get_info(obj_loc->oloc, udata->want_ih_info, udata->oinfo) < 0) + if(H5O_get_info(obj_loc->oloc, udata->oinfo, udata->fields) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object info") done: @@ -710,7 +710,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_loc_info(const H5G_loc_t *loc, const char *name, hbool_t want_ih_info, H5O_info_t *oinfo/*out*/) +H5G_loc_info(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo/*out*/, unsigned fields) { H5G_loc_info_t udata; /* User data for traversal callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -723,7 +723,7 @@ H5G_loc_info(const H5G_loc_t *loc, const char *name, hbool_t want_ih_info, H5O_i HDassert(oinfo); /* Set up user data for locating object */ - udata.want_ih_info = want_ih_info; + udata.fields = fields; udata.oinfo = oinfo; /* Traverse group hierarchy to locate object */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 2ae3d538..bf77833 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -1274,7 +1274,8 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get link name") /* Check if the object pointed by the soft link exists in the source file */ - if(H5G_loc_info(&grp_loc, link_name, FALSE, &oinfo) >= 0) { + /* Only basic information is needed therefore pass in "0" for field selection */ + if(H5G_loc_info(&grp_loc, link_name, &oinfo, 0) >= 0) { tmp_src_ent.header = oinfo.addr; src_ent = &tmp_src_ent; } /* end if */ diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 427f14b..95dfef5 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -277,7 +277,7 @@ H5_DLL herr_t H5G_loc_find_by_idx(const H5G_loc_t *loc, const char *group_name, H5G_loc_t *obj_loc/*out*/); H5_DLL htri_t H5G_loc_exists(const H5G_loc_t *loc, const char *name); H5_DLL herr_t H5G_loc_info(const H5G_loc_t *loc, const char *name, - hbool_t want_ih_info, H5O_info_t *oinfo/*out*/); + H5O_info_t *oinfo/*out*/, unsigned fields); H5_DLL herr_t H5G_loc_set_comment(const H5G_loc_t *loc, const char *name, const char *comment); H5_DLL ssize_t H5G_loc_get_comment(const H5G_loc_t *loc, const char *name, diff --git a/src/H5O.c b/src/H5O.c index f700ac9..c5db814 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -435,63 +435,70 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oget_info + * Function: H5Oget_info2 * - * Purpose: Retrieve information about an object. + * Purpose: Retrieve information about an object. * - * Return: Success: Non-negative - * Failure: Negative + * NOTE: Add a parameter "fields" to indicate selection of object info. * - * Programmer: Quincey Koziol - * November 21 2006 + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * July 7 2010 * *------------------------------------------------------------------------- */ herr_t -H5Oget_info(hid_t loc_id, H5O_info_t *oinfo) +H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) { - H5G_loc_t loc; /* Location of group */ + H5G_loc_t loc; /* Location of group */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*x", loc_id, oinfo); + H5TRACE3("e", "i*xIu", loc_id, oinfo, fields); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + if(fields & ~H5O_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") /* Retrieve the object's information */ - if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/) < 0) + if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: FUNC_LEAVE_API(ret_value) -} /* end H5Oget_info() */ +} /* end H5Oget_info2() */ -/*------------------------------------------------------------------------- - * Function: H5Oget_info_by_name - * - * Purpose: Retrieve information about an object. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * November 21 2006 - * - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * Function: H5Oget_info_by_name2 + * + * Purpose: Retrieve information about an object. + * + * NOTE: Add a parameter "fields" to indicate selection of object info. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * July 7 2010 + * + *------------------------------------------------------------------------- + */ herr_t -H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id) +H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, + unsigned fields, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*s*xi", loc_id, name, oinfo, lapl_id); + H5TRACE5("e", "i*s*xIui", loc_id, name, oinfo, fields, lapl_id); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) @@ -500,44 +507,48 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if(!oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + if(fields & ~H5O_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the object's information */ - if(H5O__get_info_by_name(&loc, name, oinfo/*out*/) < 0) + if(H5O__get_info_by_name(&loc, name, oinfo/*out*/, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: FUNC_LEAVE_API(ret_value) -} /* end H5Oget_info_by_name() */ +} /* end H5Oget_info_by_name2() */ /*------------------------------------------------------------------------- - * Function: H5Oget_info_by_idx + * Function: H5Oget_info_by_idx2 * - * Purpose: Retrieve information about an object, according to the order + * Purpose: Retrieve information about an object, according to the order * of an index. * - * Return: Success: Non-negative - * Failure: Negative + * NOTE: Add a parameter "fields" to indicate selection of object info. + * + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol - * November 26 2006 + * November 26 2006 * *------------------------------------------------------------------------- */ herr_t -H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, hid_t lapl_id) +H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, oinfo, - lapl_id); + H5TRACE8("e", "i*sIiIoh*xIui", loc_id, group_name, idx_type, order, n, oinfo, + fields, lapl_id); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) @@ -550,18 +561,20 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + if(fields & ~H5O_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the object's information */ - if(H5O__get_info_by_idx(&loc, group_name, idx_type, order, n, oinfo) < 0) + if(H5O__get_info_by_idx(&loc, group_name, idx_type, order, n, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: FUNC_LEAVE_API(ret_value) -} /* end H5Oget_info_by_idx() */ +} /* end H5Oget_info_by_idx2() */ /*------------------------------------------------------------------------- @@ -737,9 +750,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Ovisit + * Function: H5Ovisit2 * - * Purpose: Recursively visit an object and all the objects reachable + * Purpose: Recursively visit an object and all the objects reachable * from it. If the starting object is a group, all the objects * linked to from that group will be visited. Links within * each group are visited according to the order within the @@ -755,27 +768,30 @@ done: * iteration index and iteration order given) will be used to in * the callback about the object. * - * Return: Success: The return value of the first operator that + * NOTE: Add a a parameter "fields" to indicate selection of + * object info to be retrieved to the callback "op". + * + * Return: Success: The return value of the first operator that * returns non-zero, or zero if all members were * processed with no operator returning non-zero. * - * Failure: Negative if something goes wrong within the + * Failure: Negative if something goes wrong within the * library, or the negative value returned by one * of the operators. * * Programmer: Quincey Koziol - * November 25 2007 + * November 25 2007 * *------------------------------------------------------------------------- */ herr_t -H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, - H5O_iterate_t op, void *op_data) +H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, + H5O_iterate_t op, void *op_data, unsigned fields) { herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE5("e", "iIiIox*x", obj_id, idx_type, order, op, op_data); + H5TRACE6("e", "iIiIox*xIu", obj_id, idx_type, order, op, op_data, fields); /* Check args */ if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) @@ -784,20 +800,22 @@ H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + if(fields & ~H5O_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") /* Call internal object visitation routine */ - if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data)) < 0) + if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: FUNC_LEAVE_API(ret_value) -} /* end H5Ovisit() */ +} /* end H5Ovisit2() */ /*------------------------------------------------------------------------- - * Function: H5Ovisit_by_name + * Function: H5Ovisit_by_name2 * - * Purpose: Recursively visit an object and all the objects reachable + * Purpose: Recursively visit an object and all the objects reachable * from it. If the starting object is a group, all the objects * linked to from that group will be visited. Links within * each group are visited according to the order within the @@ -813,28 +831,31 @@ done: * iteration index and iteration order given) will be used to in * the callback about the object. * - * Return: Success: The return value of the first operator that + * NOTE: Add a a parameter "fields" to indicate selection of + * object info to be retrieved to the callback "op". + * + * Return: Success: The return value of the first operator that * returns non-zero, or zero if all members were * processed with no operator returning non-zero. * - * Failure: Negative if something goes wrong within the + * Failure: Negative if something goes wrong within the * library, or the negative value returned by one * of the operators. * * Programmer: Quincey Koziol - * November 24 2007 + * November 24 2007 * *------------------------------------------------------------------------- */ herr_t -H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, - H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id) +H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, + H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields, hid_t lapl_id) { herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "i*sIiIox*xi", loc_id, obj_name, idx_type, order, op, op_data, - lapl_id); + H5TRACE8("e", "i*sIiIox*xIui", loc_id, obj_name, idx_type, order, op, op_data, + fields, lapl_id); /* Check args */ if(!obj_name || !*obj_name) @@ -845,18 +866,20 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + if(fields & ~H5O_INFO_ALL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Call internal object visitation routine */ - if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data)) < 0) + if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: FUNC_LEAVE_API(ret_value) -} /* end H5Ovisit_by_name() */ +} /* end H5Ovisit_by_name2() */ /*------------------------------------------------------------------------- diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c new file mode 100644 index 0000000..876579d --- /dev/null +++ b/src/H5Odeprec.c @@ -0,0 +1,332 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Purpose: Deprecated functions from the H5O interface. These + * functions are here for compatibility purposes and may be + * removed in the future. Applications should switch to the + * newer APIs. + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Opkg.h" /* Object headers */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + +#ifndef H5_NO_DEPRECATED_SYMBOLS + + +/*------------------------------------------------------------------------- + * Function: H5Oget_info1 + * + * Purpose: Retrieve information about an object. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) +{ + H5G_loc_t loc; /* Location of group */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*x", loc_id, oinfo); + + /* Check args */ + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!oinfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + + /* Retrieve the object's information */ + if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_info1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oget_info_by_name1 + * + * Purpose: Retrieve information about an object. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id) +{ + H5G_loc_t loc; /* Location of group */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "i*s*xi", loc_id, name, oinfo, lapl_id); + + /* Check args */ + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!name || !*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(!oinfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + + /* Retrieve the object's information */ + if(H5O__get_info_by_name(&loc, name, oinfo/*out*/, H5O_INFO_ALL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_info_by_name1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oget_info_by_idx1 + * + * Purpose: Retrieve information about an object, according to the order + * of an index. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * November 26 2006 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, hid_t lapl_id) +{ + H5G_loc_t loc; /* Location of group */ + H5G_loc_t obj_loc; /* Location used to open group */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ + hbool_t loc_found = FALSE; /* Entry at 'name' found */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, oinfo, + lapl_id); + + /* Check args */ + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!group_name || !*group_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!oinfo) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + + /* Retrieve the object's information */ + if(H5O__get_info_by_idx(&loc, group_name, idx_type, order, n, oinfo, H5O_INFO_ALL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") + +done: + /* Release the object location */ + if(loc_found && H5G_loc_free(&obj_loc) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + + FUNC_LEAVE_API(ret_value) +} /* end H5Oget_info_by_idx1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Ovisit1 + * + * Purpose: Recursively visit an object and all the objects reachable + * from it. If the starting object is a group, all the objects + * linked to from that group will be visited. Links within + * each group are visited according to the order within the + * specified index (unless the specified index does not exist for + * a particular group, then the "name" index is used). + * + * NOTE: Soft links and user-defined links are ignored during + * this operation. + * + * NOTE: Each _object_ reachable from the initial group will only + * be visited once. If multiple hard links point to the same + * object, the first link to the object's path (according to the + * iteration index and iteration order given) will be used to in + * the callback about the object. + * + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. + * + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. + * + * Programmer: Quincey Koziol + * November 25 2007 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, + H5O_iterate_t op, void *op_data) +{ + herr_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "iIiIox*x", obj_id, idx_type, order, op, op_data); + + /* Check args */ + if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + + /* Call internal object visitation routine */ + if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Ovisit1() */ + + +/*------------------------------------------------------------------------- + * Function: H5Ovisit_by_name1 + * + * Purpose: Recursively visit an object and all the objects reachable + * from it. If the starting object is a group, all the objects + * linked to from that group will be visited. Links within + * each group are visited according to the order within the + * specified index (unless the specified index does not exist for + * a particular group, then the "name" index is used). + * + * NOTE: Soft links and user-defined links are ignored during + * this operation. + * + * NOTE: Each _object_ reachable from the initial group will only + * be visited once. If multiple hard links point to the same + * object, the first link to the object's path (according to the + * iteration index and iteration order given) will be used to in + * the callback about the object. + * + * Return: Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. + * + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. + * + * Programmer: Quincey Koziol + * November 24 2007 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, + H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id) +{ + herr_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "i*sIiIox*xi", loc_id, obj_name, idx_type, order, op, op_data, + lapl_id); + + /* Check args */ + if(!obj_name || !*obj_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + if(!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + + /* Call internal object visitation routine */ + if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Ovisit_by_name1() */ + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + diff --git a/src/H5Oint.c b/src/H5Oint.c index c9e82c0..7c5977f 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -61,6 +61,7 @@ typedef struct { H5SL_t *visited; /* Skip list for tracking visited nodes */ H5O_iterate_t op; /* Application callback */ void *op_data; /* Application's op data */ + unsigned fields; /* Selection of object info */ } H5O_iter_visit_ud_t; @@ -2211,20 +2212,22 @@ H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr) /*------------------------------------------------------------------------- - * Function: H5O_get_info + * Function: H5O_get_info * - * Purpose: Retrieve the information for an object + * Purpose: Retrieve the information for an object * - * Return: Success: Non-negative - * Failure: Negative + * Note: Add a parameter "fields" to indicate selection of object info. + * + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * November 21 2006 + * Programmer: Quincey Koziol + * November 21 2006 * *------------------------------------------------------------------------- */ herr_t -H5O_get_info(const H5O_loc_t *loc, hbool_t want_ih_info, H5O_info_t *oinfo) +H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields) { const H5O_obj_class_t *obj_class; /* Class of object for header */ H5O_t *oh = NULL; /* Object header */ @@ -2259,57 +2262,61 @@ H5O_get_info(const H5O_loc_t *loc, hbool_t want_ih_info, H5O_info_t *oinfo) /* Set the object's reference count */ oinfo->rc = oh->nlink; - /* Get modification time for object */ - if(oh->version > H5O_VERSION_1) { - oinfo->atime = oh->atime; - oinfo->mtime = oh->mtime; - oinfo->ctime = oh->ctime; - oinfo->btime = oh->btime; - } /* end if */ - else { - htri_t exists; /* Flag if header message of interest exists */ - - /* No information for access & modification fields */ - /* (we stopped updating the "modification time" header message for - * raw data changes, so the "modification time" header message - * is closest to the 'change time', in POSIX terms - QAK) - */ - oinfo->atime = 0; - oinfo->mtime = 0; - oinfo->btime = 0; - - /* Might be information for modification time */ - if((exists = H5O_msg_exists_oh(oh, H5O_MTIME_ID)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME message") - if(exists > 0) { - /* Get "old style" modification time info */ - if(NULL == H5O_msg_read_oh(loc->file, oh, H5O_MTIME_ID, &oinfo->ctime)) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME message") + /* Get time information, if requested */ + if(fields & H5O_INFO_TIME) { + if(oh->version > H5O_VERSION_1) { + oinfo->atime = oh->atime; + oinfo->mtime = oh->mtime; + oinfo->ctime = oh->ctime; + oinfo->btime = oh->btime; } /* end if */ else { - /* Check for "new style" modification time info */ - if((exists = H5O_msg_exists_oh(oh, H5O_MTIME_NEW_ID)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME_NEW message") - if(exists > 0) { - /* Get "new style" modification time info */ - if(NULL == H5O_msg_read_oh(loc->file, oh, H5O_MTIME_NEW_ID, &oinfo->ctime)) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME_NEW message") + htri_t exists; /* Flag if header message of interest exists */ + + /* No information for access & modification fields */ + /* (we stopped updating the "modification time" header message for + * raw data changes, so the "modification time" header message + * is closest to the 'change time', in POSIX terms - QAK) + */ + oinfo->atime = 0; + oinfo->mtime = 0; + oinfo->btime = 0; + + /* Might be information for modification time */ + if((exists = H5O_msg_exists_oh(oh, H5O_MTIME_ID)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME message") + if(exists > 0) { + /* Get "old style" modification time info */ + if(NULL == H5O_msg_read_oh(loc->file, oh, H5O_MTIME_ID, &oinfo->ctime)) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME message") } /* end if */ - else - oinfo->ctime = 0; - } /* end else */ - } /* end else */ + else { + /* Check for "new style" modification time info */ + if((exists = H5O_msg_exists_oh(oh, H5O_MTIME_NEW_ID)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME_NEW message") + if(exists > 0) { + /* Get "new style" modification time info */ + if(NULL == H5O_msg_read_oh(loc->file, oh, H5O_MTIME_NEW_ID, &oinfo->ctime)) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME_NEW message") + } /* end if */ + else + oinfo->ctime = 0; + } /* end else */ + } /* end else */ + } /* end if */ - /* Get the information for the object header */ - if(H5O__get_hdr_info_real(oh, &oinfo->hdr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info") + /* Get the information for the object header, if requested */ + if(fields & H5O_INFO_HDR) + if(H5O__get_hdr_info_real(oh, &oinfo->hdr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info") /* Retrieve # of attributes */ - if(H5O_attr_count_real(loc->file, oh, &oinfo->num_attrs) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count") + if(fields & H5O_INFO_NUM_ATTRS) + if(H5O_attr_count_real(loc->file, oh, &oinfo->num_attrs) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count") /* Get B-tree & heap metadata storage size, if requested */ - if(want_ih_info) { + if(fields & H5O_INFO_META_SIZE) { /* Check for 'bh_info' callback for this type of object */ if(obj_class->bh_info) /* Call the object's class 'bh_info' routine */ @@ -2317,9 +2324,10 @@ H5O_get_info(const H5O_loc_t *loc, hbool_t want_ih_info, H5O_info_t *oinfo) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object's btree & heap info") /* Get B-tree & heap info for any attributes */ - if(oinfo->num_attrs > 0) + if(!(fields & H5O_INFO_NUM_ATTRS) || oinfo->num_attrs > 0) { if(H5O__attr_bh_info(loc->file, oh, &oinfo->meta_size.attr) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info") + } /* end if */ } /* end if */ done: @@ -2338,16 +2346,18 @@ done: * Note: This routine is needed so that there's a non-API routine * that can set up VOL / SWMR info (which need a DXPL). * - * Return: Success: Non-negative - * Failure: Negative + * Note: Add a parameter "fields" to indicate selection of object info. + * + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol - * December 28, 2017 + * December 28, 2017 * *------------------------------------------------------------------------- */ herr_t -H5O__get_info_by_name(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo) +H5O__get_info_by_name(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo, unsigned fields) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2359,7 +2369,7 @@ H5O__get_info_by_name(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo) HDassert(oinfo); /* Retrieve the object's information */ - if(H5G_loc_info(loc, name, TRUE, oinfo/*out*/) < 0) + if(H5G_loc_info(loc, name, oinfo/*out*/, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") done: @@ -2376,17 +2386,19 @@ done: * Note: This routine is needed so that there's a non-API routine * that can set up VOL / SWMR info (which need a DXPL). * - * Return: Success: Non-negative - * Failure: Negative + * Note: Add a parameter "fields" to indicate selection of object info. * - * Programmer: Quincey Koziol - * December 28, 2017 + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * December 28, 2017 * *------------------------------------------------------------------------- */ herr_t H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo) + H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields) { H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ @@ -2412,7 +2424,7 @@ H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id loc_found = TRUE; /* Retrieve the object's information */ - if(H5O_get_info(obj_loc.oloc, TRUE, oinfo) < 0) + if(H5O_get_info(obj_loc.oloc, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") done: @@ -2793,7 +2805,7 @@ H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t *li H5O_info_t oinfo; /* Object info */ /* Get the object's info */ - if(H5O_get_info(&obj_oloc, TRUE, &oinfo) < 0) + if(H5O_get_info(&obj_oloc, &oinfo, udata->fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get object info") /* Make the application callback */ @@ -2833,7 +2845,7 @@ done: /*------------------------------------------------------------------------- * Function: H5O__visit * - * Purpose: Recursively visit an object and all the objects reachable + * Purpose: Recursively visit an object and all the objects reachable * from it. If the starting object is a group, all the objects * linked to from that group will be visited. Links within * each group are visited according to the order within the @@ -2849,22 +2861,24 @@ done: * iteration index and iteration order given) will be used to in * the callback about the object. * - * Return: Success: The return value of the first operator that + * Note: Add a parameter "fields" to indicate selection of object info. + * + * Return: Success: The return value of the first operator that * returns non-zero, or zero if all members were * processed with no operator returning non-zero. * - * Failure: Negative if something goes wrong within the + * Failure: Negative if something goes wrong within the * library, or the negative value returned by one * of the operators. * * Programmer: Quincey Koziol - * November 24 2007 + * November 24 2007 * *------------------------------------------------------------------------- */ herr_t H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, - H5_iter_order_t order, H5O_iterate_t op, void *op_data) + H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields) { H5O_iter_visit_ud_t udata; /* User data for callback */ H5G_loc_t loc; /* Location of reference object */ @@ -2896,7 +2910,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_found = TRUE; /* Get the object's info */ - if(H5O_get_info(&obj_oloc, TRUE, &oinfo) < 0) + if(H5O_get_info(&obj_oloc, &oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info") /* Open the object */ @@ -2925,6 +2939,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, udata.start_loc = &start_loc; udata.op = op; udata.op_data = op_data; + udata.fields = fields; /* Create skip list to store visited object information */ if((udata.visited = H5SL_create(H5SL_TYPE_OBJ, NULL)) == NULL) diff --git a/src/H5Opkg.h b/src/H5Opkg.h index f535e50..616f96b 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -567,15 +567,15 @@ H5_DLL int H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted); H5_DLL herr_t H5O__link(const H5O_loc_t *loc, int adjust); H5_DLL htri_t H5O__exists_by_name(const H5G_loc_t *loc, const char *name); H5_DLL herr_t H5O__get_info_by_name(const H5G_loc_t *loc, const char *name, - H5O_info_t *oinfo); + H5O_info_t *oinfo, unsigned fields); H5_DLL herr_t H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo); + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields); H5_DLL herr_t H5O__set_comment_by_name(const H5G_loc_t *loc, const char *name, const char *comment); H5_DLL ssize_t H5O__get_comment_by_name(const H5G_loc_t *loc, const char *name, char *comment, size_t bufsize); H5_DLL herr_t H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, - H5_iter_order_t order, H5O_iterate_t op, void *op_data); + H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields); H5_DLL herr_t H5O__inc_rc(H5O_t *oh); H5_DLL herr_t H5O__dec_rc(H5O_t *oh); H5_DLL herr_t H5O__free(H5O_t *oh); diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 696fd38..10063d5 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -881,8 +881,7 @@ H5_DLL herr_t H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned mesg_id, unsigned mesg_ #endif /* H5O_ENABLE_BOGUS */ H5_DLL herr_t H5O_delete(H5F_t *f, haddr_t addr); H5_DLL herr_t H5O_get_hdr_info(const H5O_loc_t *oloc, H5O_hdr_info_t *hdr); -H5_DLL herr_t H5O_get_info(const H5O_loc_t *oloc, hbool_t want_ih_info, - H5O_info_t *oinfo); +H5_DLL herr_t H5O_get_info(const H5O_loc_t *oloc, H5O_info_t *oinfo, unsigned fields); H5_DLL herr_t H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type); H5_DLL herr_t H5O_get_create_plist(const H5O_loc_t *loc, struct H5P_genplist_t *oc_plist); H5_DLL hid_t H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_ref); diff --git a/src/H5Opublic.h b/src/H5Opublic.h index 8d6dda4..54869bc 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -73,6 +73,19 @@ #define H5O_SHMESG_MAX_NINDEXES 8 #define H5O_SHMESG_MAX_LIST_SIZE 5000 +/* Flags for H5Oget_info. + * Theses flags determine which fields will be filled in in the H5O_info_t + * struct. Some fields are always filled in because there is no performance + * penalty. + * A value of 0 returns basic information: fileno, addr, type, rc and will be + * returned regardless. + */ +#define H5O_INFO_TIME 0x0001u /* Fill in the atime, mtime, ctime, and btime fields */ +#define H5O_INFO_NUM_ATTRS 0x0002u /* Fill in the num_attrs field */ +#define H5O_INFO_HDR 0x0004u /* Fill in the hdr field */ +#define H5O_INFO_META_SIZE 0x0008u /* Fill in the meta_size field */ +#define H5O_INFO_ALL (H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE) + /*******************/ /* Public Typedefs */ /*******************/ @@ -156,12 +169,12 @@ H5_DLL hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr); H5_DLL hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id); H5_DLL htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id); -H5_DLL herr_t H5Oget_info(hid_t loc_id, H5O_info_t *oinfo); -H5_DLL herr_t H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, - hid_t lapl_id); -H5_DLL herr_t H5Oget_info_by_idx(hid_t loc_id, const char *group_name, +H5_DLL herr_t H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields); +H5_DLL herr_t H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, + unsigned fields, hid_t lapl_id); +H5_DLL herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, - hid_t lapl_id); + unsigned fields, hid_t lapl_id); H5_DLL herr_t H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id); H5_DLL herr_t H5Oincr_refcount(hid_t object_id); @@ -174,11 +187,11 @@ H5_DLL herr_t H5Oset_comment_by_name(hid_t loc_id, const char *name, H5_DLL ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize); H5_DLL ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t bufsize, hid_t lapl_id); -H5_DLL herr_t H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, - H5O_iterate_t op, void *op_data); -H5_DLL herr_t H5Ovisit_by_name(hid_t loc_id, const char *obj_name, +H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, + H5O_iterate_t op, void *op_data, unsigned fields); +H5_DLL herr_t H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, - void *op_data, hid_t lapl_id); + void *op_data, unsigned fields, hid_t lapl_id); H5_DLL herr_t H5Oclose(hid_t object_id); H5_DLL herr_t H5Oflush(hid_t obj_id); H5_DLL herr_t H5Orefresh(hid_t oid); @@ -205,7 +218,18 @@ typedef struct H5O_stat_t { } H5O_stat_t; /* Function prototypes */ +H5_DLL herr_t H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo); +H5_DLL herr_t H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, + hid_t lapl_id); +H5_DLL herr_t H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, + H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, + hid_t lapl_id); +H5_DLL herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, + H5O_iterate_t op, void *op_data); +H5_DLL herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, + H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, + void *op_data, hid_t lapl_id); #endif /* H5_NO_DEPRECATED_SYMBOLS */ #ifdef __cplusplus diff --git a/src/H5vers.txt b/src/H5vers.txt index 0303bf5..914c30e 100644 --- a/src/H5vers.txt +++ b/src/H5vers.txt @@ -56,6 +56,11 @@ FUNCTION: H5Ewalk; H5E_walk, H5E_error; v10, v18 FUNCTION: H5Fget_info; H5F_info; v18, v110 FUNCTION: H5Gcreate; ; v10, v18 FUNCTION: H5Gopen; ; v10, v18 +FUNCTION: H5Oget_info; ; v18, v112 +FUNCTION: H5Oget_info_by_name; ; v18, v112 +FUNCTION: H5Oget_info_by_idx; ; v18, v112 +FUNCTION: H5Ovisit; ; v18, v112 +FUNCTION: H5Ovisit_by_name; ; v18, v112 FUNCTION: H5Pget_filter; ; v10, v18 FUNCTION: H5Pget_filter_by_id; ; v16, v18 FUNCTION: H5Pinsert; ; v14, v18 diff --git a/src/Makefile.am b/src/Makefile.am index 21f3966..a0defad 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -80,7 +80,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5HP.c H5I.c H5Itest.c H5L.c H5Lexternal.c H5lib_settings.c \ H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \ H5MM.c H5MP.c H5MPtest.c \ - H5O.c H5Oainfo.c H5Oalloc.c H5Oattr.c \ + H5O.c H5Odeprec.c H5Oainfo.c H5Oalloc.c H5Oattr.c \ H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c H5Ocache_image.c \ H5Ochunk.c \ H5Ocont.c H5Ocopy.c H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c \ diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 7a2bb49..55afa68 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -377,7 +377,7 @@ get_object_header_tag(hid_t loc_id, haddr_t *tag) H5O_info_t oinfo; /* Object info */ /* Retrieve the info for the object */ - if(H5Oget_info(loc_id, &oinfo) < 0) + if(H5Oget_info2(loc_id, &oinfo, 0) < 0) TEST_ERROR; /* Set the tag to return */ @@ -2937,7 +2937,7 @@ check_object_info_tags(void) /* Get information on an object by name */ /* ===================================== */ - if ( H5Oget_info_by_name(fid, GROUPNAME, &oinfo, H5P_DEFAULT) < 0 ) TEST_ERROR; + if ( H5Oget_info_by_name2(fid, GROUPNAME, &oinfo, 0, H5P_DEFAULT) < 0 ) TEST_ERROR; /* =================================== */ /* Verification of Metadata Tag Values */ @@ -2956,8 +2956,6 @@ check_object_info_tags(void) /* Verify dataset's tagged metadata */ if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR; - if ( verify_tag(fid, H5AC_BT_ID, g_tag) < 0 ) TEST_ERROR; - if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, g_tag) < 0 ) TEST_ERROR; /* verify no other entries present */ if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; @@ -3585,8 +3583,6 @@ check_external_link_open_tags(void) /* verify tag value of linked group's object header */ if ( verify_tag(fid2, H5AC_OHDR_ID, link_tag) < 0 ) TEST_ERROR; - if ( verify_tag(fid2, H5AC_LHEAP_PRFX_ID, link_tag) < 0 ) TEST_ERROR; - if ( verify_tag(fid2, H5AC_BT_ID, link_tag) < 0 ) TEST_ERROR; /* verify no other entries present */ if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; diff --git a/test/cork.c b/test/cork.c index 8c685ee..7487a9e 100644 --- a/test/cork.c +++ b/test/cork.c @@ -126,7 +126,7 @@ verify_old_dset_cork(void) TEST_ERROR /* Get dataset object header address: DSET_BT1 */ - if(H5Oget_info(did, &oinfo) < 0) + if(H5Oget_info2(did, &oinfo, 0) < 0) TEST_ERROR /* Cork the dataset: DSET_BT1 */ @@ -163,7 +163,7 @@ verify_old_dset_cork(void) FAIL_STACK_ERROR /* Get dataset object address */ - if(H5Oget_info(did2, &oinfo2) < 0) + if(H5Oget_info2(did2, &oinfo2, 0) < 0) TEST_ERROR /* Cork the dataset: DSET_COMPACT */ @@ -216,7 +216,7 @@ verify_old_dset_cork(void) FAIL_STACK_ERROR /* Get dataset object address: DSET_CONTIG */ - if(H5Oget_info(did3, &oinfo3) < 0) + if(H5Oget_info2(did3, &oinfo3, 0) < 0) TEST_ERROR /* Cork the dataset: DSET_CONTIG */ @@ -329,7 +329,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Get dataset object header address */ - if(H5Oget_info(did, &oinfo) < 0) + if(H5Oget_info2(did, &oinfo, 0) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ @@ -372,7 +372,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Get dataset object header address */ - if(H5Oget_info(did2, &oinfo2) < 0) + if(H5Oget_info2(did2, &oinfo2, 0) < 0) TEST_ERROR /* Cork the dataset: DSET_NONE */ @@ -546,7 +546,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Get dataset object header address: DSET_EA */ - if(H5Oget_info(did, &oinfo) < 0) + if(H5Oget_info2(did, &oinfo, 0) < 0) TEST_ERROR /* Cork the dataset: DSET_EA */ @@ -564,7 +564,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Get dataset object header address: DSET_FA */ - if(H5Oget_info(did2, &oinfo2) < 0) + if(H5Oget_info2(did2, &oinfo2, 0) < 0) TEST_ERROR /* Cork the dataset: DSET_FA */ @@ -591,7 +591,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Get dataset object header address: DSET_BT2 */ - if(H5Oget_info(did3, &oinfo3) < 0) + if(H5Oget_info2(did3, &oinfo3, 0) < 0) TEST_ERROR /* Cork the dataset: DSET_BT2 */ @@ -770,11 +770,11 @@ verify_group_cork(hbool_t swmr) TEST_ERROR /* Get group object header addresses */ - if(H5Oget_info(gid, &oinfo) < 0) + if(H5Oget_info2(gid, &oinfo, 0) < 0) TEST_ERROR - if(H5Oget_info(gid2, &oinfo2) < 0) + if(H5Oget_info2(gid2, &oinfo2, 0) < 0) TEST_ERROR - if(H5Oget_info(gid3, &oinfo3) < 0) + if(H5Oget_info2(gid3, &oinfo3, 0) < 0) TEST_ERROR /* Verify cork status of the groups */ @@ -959,11 +959,11 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Get named datatype object header addresses */ - if(H5Oget_info(tid, &oinfo) < 0) + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR - if(H5Oget_info(tid2, &oinfo2) < 0) + if(H5Oget_info2(tid2, &oinfo2, 0) < 0) TEST_ERROR - if(H5Oget_info(tid3, &oinfo3) < 0) + if(H5Oget_info2(tid3, &oinfo3, 0) < 0) TEST_ERROR /* Verify cork status of the named datatypes */ @@ -1063,7 +1063,7 @@ verify_named_cork(hbool_t swmr) FAIL_STACK_ERROR /* Get dataset object header address */ - if(H5Oget_info(did, &oinfo4) < 0) + if(H5Oget_info2(did, &oinfo4, 0) < 0) TEST_ERROR /* Cork the dataset: DSET */ @@ -1277,7 +1277,7 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the group: gid2 */ - if(H5Oget_info(gid2, &oinfo1) < 0) + if(H5Oget_info2(gid2, &oinfo1, 0) < 0) TEST_ERROR if(H5C__verify_cork_tag_test(fid2, oinfo1.addr, TRUE) < 0) TEST_ERROR @@ -1305,7 +1305,7 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: did1 */ - if(H5Oget_info(did1, &oinfo2) < 0) + if(H5Oget_info2(did1, &oinfo2, 0) < 0) TEST_ERROR if(H5C__verify_cork_tag_test(fid1, oinfo2.addr, TRUE) < 0) TEST_ERROR @@ -1333,7 +1333,7 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the datatype: tid2 */ - if(H5Oget_info(tid2, &oinfo3) < 0) + if(H5Oget_info2(tid2, &oinfo3, 0) < 0) TEST_ERROR if(H5C__verify_cork_tag_test(fid2, oinfo3.addr, TRUE) < 0) TEST_ERROR @@ -1349,7 +1349,7 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the group: gid1 */ - if(H5Oget_info(gid1, &oinfo1) < 0) + if(H5Oget_info2(gid1, &oinfo1, 0) < 0) TEST_ERROR if(H5C__verify_cork_tag_test(fid1, oinfo1.addr, FALSE) < 0) TEST_ERROR @@ -1383,7 +1383,7 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: did2 */ - if(H5Oget_info(did2, &oinfo2) < 0) + if(H5Oget_info2(did2, &oinfo2, 0) < 0) TEST_ERROR if(H5C__verify_cork_tag_test(fid2, oinfo2.addr, FALSE) < 0) TEST_ERROR diff --git a/test/dsets.c b/test/dsets.c index ca1e3d5..ebe7f68 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -10719,9 +10719,9 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR; /* The second call triggered a bug in the library (JIRA issue: SWMR-95) */ - if(H5Oget_info_by_name(fid, DSET_EARRAY_HDR_FD, &info, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(fid, DSET_EARRAY_HDR_FD, &info, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; - if(H5Oget_info_by_name(fid, DSET_EARRAY_HDR_FD, &info, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(fid, DSET_EARRAY_HDR_FD, &info, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if(H5Pclose(fapl) < 0) @@ -10839,9 +10839,9 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR; /* The second call triggered a bug in the library (JIRA issue: SWMR-95) */ - if(H5Oget_info_by_name(fid, DSET_FARRAY_HDR_FD, &info, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(fid, DSET_FARRAY_HDR_FD, &info, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; - if(H5Oget_info_by_name(fid, DSET_FARRAY_HDR_FD, &info, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(fid, DSET_FARRAY_HDR_FD, &info, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if(H5Pclose(fapl) < 0) @@ -10959,9 +10959,9 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR; /* The second call triggered a bug in the library (JIRA issue: SWMR-95) */ - if(H5Oget_info_by_name(fid, DSET_BT2_HDR_FD, &info, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(fid, DSET_BT2_HDR_FD, &info, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; - if(H5Oget_info_by_name(fid, DSET_BT2_HDR_FD, &info, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(fid, DSET_BT2_HDR_FD, &info, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if(H5Pclose(fapl) < 0) @@ -12680,7 +12680,7 @@ dls_01_read_stuff( hid_t fid ) { did = H5Dopen2( fid, DLS_01_DATASET, H5P_DEFAULT ); if ( did <= 0 ) TEST_ERROR - status = H5Oget_info( did, &info ); + status = H5Oget_info2( did, &info, 0 ); if ( status != 0 ) TEST_ERROR status = H5Dclose( did ); diff --git a/test/dtypes.c b/test/dtypes.c index 1a27634..3253d6c 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -5897,7 +5897,7 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Oget_info_by_name(file, compnd_type, &oi, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0) FAIL_STACK_ERROR old_dtype_oh_size = oi.hdr.space.total; @@ -5922,7 +5922,7 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Oget_info_by_name(file, compnd_type, &oi, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check that the object header info is still the same */ @@ -5958,7 +5958,7 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Oget_info_by_name(file, compnd_type, &oi, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0) FAIL_STACK_ERROR new_dtype_oh_size = oi.hdr.space.total; @@ -5987,7 +5987,7 @@ test_latest(void) FAIL_STACK_ERROR /* Get information about datatype on disk */ - if(H5Oget_info_by_name(file, compnd_type, &oi, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check that the object header info is still the same */ diff --git a/test/flushrefresh.c b/test/flushrefresh.c index 0775dee..9348a10 100644 --- a/test/flushrefresh.c +++ b/test/flushrefresh.c @@ -848,7 +848,7 @@ herr_t flush_verification(const char * obj_pathname, const char * expected) H5E_BEGIN_TRY { fid = H5Fopen(FILENAME, H5F_ACC_SWMR_READ, H5P_DEFAULT); oid = H5Oopen(fid, obj_pathname, H5P_DEFAULT); - status = H5Oget_info(oid, &oinfo); + status = H5Oget_info2(oid, &oinfo, 0); } H5E_END_TRY; /* Compare to expected result */ @@ -989,7 +989,7 @@ herr_t refresh_verification(const char * obj_pathname) if((oid = H5Oopen(fid, obj_pathname, H5P_DEFAULT)) < 0) PROCESS_ERROR; /* Get Object info */ - if((status = H5Oget_info(oid, &flushed_oinfo)) < 0) PROCESS_ERROR; + if((status = H5Oget_info2(oid, &flushed_oinfo, H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; /* Make sure there are no attributes on the object. This is just a sanity check to ensure we didn't erroneously flush the attribute before @@ -1008,7 +1008,7 @@ herr_t refresh_verification(const char * obj_pathname) /* Get object info again. This will NOT reflect what's on disk, only what's in the cache. Thus, all values will be unchanged from above, despite newer information being on disk. */ - if((status = H5Oget_info(oid, &refreshed_oinfo)) < 0) PROCESS_ERROR; + if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; /* Verify that before doing a refresh, getting the object info returns stale information. (i.e., unchanged from above, despite new info on disk). */ @@ -1046,7 +1046,7 @@ herr_t refresh_verification(const char * obj_pathname) } /* end else */ /* Get object info. This should now accurately reflect the refreshed object on disk. */ - if((status = H5Oget_info(oid, &refreshed_oinfo)) < 0) PROCESS_ERROR; + if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; /* Confirm following (first 4) attributes are the same: */ /* Confirm following (last 4) attributes are different */ diff --git a/test/genall5.c b/test/genall5.c index e3a9c96..69ff964 100644 --- a/test/genall5.c +++ b/test/genall5.c @@ -650,7 +650,7 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) HDassert(H5L_TYPE_HARD == lnk_info.type); memset(&root_oinfo, 0, sizeof(root_oinfo)); - ret = H5Oget_info(fid, &root_oinfo); + ret = H5Oget_info2(fid, &root_oinfo, 0); if ( ret < 0 ) { @@ -1130,7 +1130,7 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) HDassert(H5L_TYPE_HARD == lnk_info.type); memset(&root_oinfo, 0, sizeof(root_oinfo)); - ret = H5Oget_info(fid, &root_oinfo); + ret = H5Oget_info2(fid, &root_oinfo, 0); if ( ret < 0 ) { pass = FALSE; @@ -1825,7 +1825,7 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) HDassert(H5L_TYPE_HARD == lnk_info.type); memset(&root_oinfo, 0, sizeof(root_oinfo)); - ret = H5Oget_info(fid, &root_oinfo); + ret = H5Oget_info2(fid, &root_oinfo, 0); if ( ret < 0 ) { diff --git a/test/getname.c b/test/getname.c index c3f3c54..a6ef2d1 100644 --- a/test/getname.c +++ b/test/getname.c @@ -2390,7 +2390,7 @@ test_main(hid_t file_id, hid_t fapl) if((size = H5Iget_name(dtype_anon, NULL,0)) != 0) TEST_ERROR /* Store the address of the datatype for later use */ - if(H5Oget_info(dtype_anon, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(dtype_anon, &oinfo, 0) < 0) TEST_ERROR /* Update the reference count to dtype_anon to preserve the datatype */ if(H5Oincr_refcount(dtype_anon) < 0) TEST_ERROR diff --git a/test/h5test.c b/test/h5test.c index bbdd58b..5d944ee 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1694,8 +1694,8 @@ h5_verify_cached_stabs(const char *base_name[], hid_t fapl) continue; } /* end if */ - if(H5Ovisit(file, H5_INDEX_NAME, H5_ITER_NATIVE, - h5_verify_cached_stabs_cb, NULL) < 0) + if(H5Ovisit2(file, H5_INDEX_NAME, H5_ITER_NATIVE, + h5_verify_cached_stabs_cb, NULL, 0) < 0) goto error; if(H5Fclose(file) < 0) diff --git a/test/links.c b/test/links.c index 4e88af5..80f9481 100644 --- a/test/links.c +++ b/test/links.c @@ -541,8 +541,8 @@ cklinks(hid_t fapl, hbool_t new_format) if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Hard link */ - if(H5Oget_info_by_name(file, "d1", &oinfo1, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name(file, "grp1/hard", &oinfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file, "d1", &oinfo1, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { H5_FAILED(); printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); @@ -577,7 +577,7 @@ cklinks(hid_t fapl, hbool_t new_format) } /* end if */ /* Symbolic link */ - if(H5Oget_info_by_name(file, "grp1/soft", &oinfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { H5_FAILED(); printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); @@ -599,7 +599,7 @@ cklinks(hid_t fapl, hbool_t new_format) /* Dangling link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name(file, "grp1/dangle", &oinfo2, H5P_DEFAULT); + status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, 0, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -626,7 +626,7 @@ cklinks(hid_t fapl, hbool_t new_format) /* Recursive link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name(file, "grp1/recursive", &oinfo2, H5P_DEFAULT); + status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, 0, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -696,11 +696,11 @@ ck_new_links(hid_t fapl, hbool_t new_format) if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Get hard link info */ - if(H5Oget_info_by_name(file, "/grp1/dataset2", &oi_dset, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, 0, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name(file, "/grp1/hard1", &oi_hard1, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, 0, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name(file, "/grp2/hard2", &oi_hard2, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, 0, H5P_DEFAULT) < 0) TEST_ERROR /* Check hard links */ @@ -1504,7 +1504,7 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) /* Get the group's link's information */ if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name(file_id, "group", &oinfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR old_cset = linfo.cset; if(old_cset != H5T_CSET_UTF8) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR @@ -1523,7 +1523,7 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) /* Get the link's character set & modification time . They should be unchanged */ if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name(file_id, "group", &oinfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR if(old_cset != linfo.cset) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR @@ -1531,7 +1531,7 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) /* Create a new link to the group. It should have a different creation order value but the same modification time */ if(H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name(file_id, "group2", &oinfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR if(H5Lget_info(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(old_corder == linfo.corder) TEST_ERROR @@ -1544,7 +1544,7 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) * should not change. */ if(H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name(file_id, "group_copied", &oinfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR if(H5Lget_info(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR @@ -1555,7 +1555,7 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) /* Move the link with the default property list. */ if(H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name(file_id, "group_copied2", &oinfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR if(H5Lget_info(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR @@ -1565,7 +1565,7 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR /* Check that the original link is unchanged */ - if(H5Oget_info_by_name(file_id, "group", &oinfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR @@ -1576,7 +1576,7 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) * Its creation order value will change, but modification time should not * change. */ if(H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name(file_id, "group_moved", &oinfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR if(H5Lget_info(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR @@ -1587,7 +1587,7 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) /* Move the link again using the default property list. */ if(H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name(file_id, "group_moved_again", &oinfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR if(old_modification_time != oinfo.mtime) TEST_ERROR if(H5Lget_info(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR if(linfo.corder_valid != TRUE) TEST_ERROR @@ -5377,7 +5377,7 @@ external_link_query(hid_t fapl, hbool_t new_format) if(HDstrcmp(object_name, "/dst")) TEST_ERROR /* Query information about object that external link points to */ - if(H5Oget_info_by_name(fid, "src", &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(fid, "src", &oi, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_GROUP != oi.type) { H5_FAILED(); HDputs(" Unexpected object type - should have been a group"); @@ -6110,8 +6110,8 @@ external_link_closing(hid_t fapl, hbool_t new_format) /* Test that getting info works */ if(H5Lget_info(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR if(H5Lget_info(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name(fid1, "elink/elink/elink/type1", &oi, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name(fid1, "elink/elink/elink", &oi, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink/elink/type1", &oi, 0, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink/elink", &oi, 0, H5P_DEFAULT) < 0) TEST_ERROR /* Test move */ if(H5Lmove(fid1, "elink/elink/elink/group1", fid1, @@ -6198,7 +6198,7 @@ external_link_closing(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Oget_info_by_name(fid1, "elink/elink2/group2/group3/group4", &oi, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink2/group2/group3/group4", &oi, 0, H5P_DEFAULT) < 0) TEST_ERROR /* Add a few regular groups and a soft link in file2 using intermediate group creation */ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR @@ -9608,13 +9608,13 @@ obj_visit(hid_t fapl, hbool_t new_format) /* Visit all the objects reachable from the root group (with file ID) */ udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata) < 0) FAIL_STACK_ERROR + if(H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0) < 0) FAIL_STACK_ERROR /* Visit all the objects reachable from the root group (with group ID) */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata) < 0) FAIL_STACK_ERROR + if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR @@ -9622,13 +9622,13 @@ obj_visit(hid_t fapl, hbool_t new_format) if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; - if(H5Ovisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata) < 0) FAIL_STACK_ERROR + if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; - if(H5Ovisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata) < 0) FAIL_STACK_ERROR + if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR @@ -9678,36 +9678,36 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) /* Visit all the objects reachable from the root group (with file ID) */ udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit_by_name(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Visit all the objects reachable from the root group (with group ID) */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Visit all the objects reachable from each internal group */ udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; - if(H5Ovisit_by_name(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name2(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; - if(H5Ovisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; - if(H5Ovisit_by_name(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name2(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; - if(H5Ovisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR @@ -9784,15 +9784,15 @@ obj_visit_stop(hid_t fapl, hbool_t new_format) * returns H5_ITER_STOP */ nvisited = 0; - if((ret = H5Ovisit(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited)) < 0) + if((ret = H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited, 0)) < 0) FAIL_STACK_ERROR if(ret != H5_ITER_STOP) TEST_ERROR if(nvisited != 1) TEST_ERROR /* Same test with H5Ovisit_by_name */ nvisited = 0; - if((ret = H5Ovisit_by_name(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, - &nvisited, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((ret = H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, + &nvisited, 0, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(ret != H5_ITER_STOP) TEST_ERROR if(nvisited != 1) TEST_ERROR @@ -11596,7 +11596,7 @@ link_info_by_idx_old(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info(group_id2, &oi) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oi, 0) < 0) TEST_ERROR objno[u] = oi.addr; /* Close group */ @@ -12095,7 +12095,7 @@ delete_by_idx_old(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info(group_id2, &oi) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oi, 0) < 0) TEST_ERROR objno[u] = oi.addr; /* Close group */ @@ -12168,7 +12168,7 @@ delete_by_idx_old(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info(group_id2, &oi) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oi, 0) < 0) TEST_ERROR objno[u] = oi.addr; /* Close group */ @@ -13163,7 +13163,7 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, if((obj_id = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT)) < 0) TEST_ERROR /* Get the object's information */ - if(H5Oget_info(obj_id, &oi) < 0) TEST_ERROR + if(H5Oget_info2(obj_id, &oi, 0) < 0) TEST_ERROR /* Check that the object is the correct one */ if(order == H5_ITER_INC) { @@ -13189,7 +13189,7 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, */ /* Get the address of the root group in the file to mount */ - if(H5Oget_info(mount_file_id, &oi) < 0) TEST_ERROR + if(H5Oget_info2(mount_file_id, &oi, 0) < 0) TEST_ERROR mnt_root_addr = oi.addr; /* Mount a file over a group in main group */ @@ -13201,7 +13201,7 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, if((obj_id = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)mnt_idx, H5P_DEFAULT)) < 0) TEST_ERROR /* Get the object's information */ - if(H5Oget_info(obj_id, &oi) < 0) TEST_ERROR + if(H5Oget_info2(obj_id, &oi, 0) < 0) TEST_ERROR /* Check that the object is the root of the mounted file and not in the previous file */ if(H5F_addr_ne(oi.addr, mnt_root_addr)) TEST_ERROR @@ -13352,7 +13352,7 @@ open_by_idx(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info(group_id2, &oi) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oi, 0) < 0) TEST_ERROR objno[u] = oi.addr; /* Close group created */ @@ -13387,7 +13387,7 @@ open_by_idx(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info(group_id2, &oi) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oi, 0) < 0) TEST_ERROR objno[u] = oi.addr; /* Close group created */ @@ -13529,7 +13529,7 @@ open_by_idx_old(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info(group_id2, &oi) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oi, 0) < 0) TEST_ERROR objno[u] = oi.addr; /* Close group created */ @@ -13623,14 +13623,14 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, sprintf(objname, "filler %02u", u); /* Query the object's information, by name */ - if(H5Oget_info_by_name(group_id, objname, &oinfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(group_id, objname, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR /* Check that the object is the correct one */ if(H5F_addr_ne(oinfo.addr, objno[u])) TEST_ERROR if(H5F_addr_ne(oinfo.num_attrs, u)) TEST_ERROR /* Query the object's information, by index */ - if(H5Oget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR /* Check that the object is the correct one */ if(order == H5_ITER_INC) { @@ -13772,7 +13772,7 @@ object_info(hid_t fapl) /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, 0, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -13788,7 +13788,7 @@ object_info(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info(group_id2, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oinfo, 0) < 0) TEST_ERROR objno[u] = oinfo.addr; /* Create attributes on new object */ @@ -13816,7 +13816,7 @@ object_info(hid_t fapl) /* Check for out of bound query by index */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, 0, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -13836,7 +13836,7 @@ object_info(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info(group_id2, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oinfo, 0) < 0) TEST_ERROR objno[u] = oinfo.addr; /* Create attributes on new object */ @@ -13864,7 +13864,7 @@ object_info(hid_t fapl) /* Check for out of bound query by index */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, 0, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -13969,7 +13969,7 @@ object_info_old(hid_t fapl) /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, 0, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -13985,7 +13985,7 @@ object_info_old(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info(group_id2, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oinfo, 0) < 0) TEST_ERROR objno[u] = oinfo.addr; /* Create attributes on new object */ @@ -14013,13 +14013,13 @@ object_info_old(hid_t fapl) /* Check for out of bound query by index */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, 0, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR /* Check for creation order index query */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), &oinfo, 0, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -14779,8 +14779,8 @@ timestamps(hid_t fapl) if(track_times != TRUE) TEST_ERROR /* Query the object information for each group */ - if(H5Oget_info(group_id, &oinfo) < 0) TEST_ERROR - if(H5Oget_info(group_id2, &oinfo2) < 0) TEST_ERROR + if(H5Oget_info2(group_id, &oinfo, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oinfo2, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR /* Sanity check object information for each group */ if(oinfo.atime != 0) TEST_ERROR @@ -14826,8 +14826,8 @@ timestamps(hid_t fapl) if(track_times != TRUE) TEST_ERROR /* Query the object information for each group */ - if(H5Oget_info(group_id, &oinfo) < 0) TEST_ERROR - if(H5Oget_info(group_id2, &oinfo2) < 0) TEST_ERROR + if(H5Oget_info2(group_id, &oinfo, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oinfo2, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR /* Sanity check object information for each group */ if(oinfo.atime != 0) TEST_ERROR diff --git a/test/mount.c b/test/mount.c index d2c0d21..dad780a 100644 --- a/test/mount.c +++ b/test/mount.c @@ -412,7 +412,7 @@ test_hide(hid_t fapl) FAIL_STACK_ERROR /* Get information about file1:/mnt1/file1 for later */ - if(H5Oget_info_by_name(file1, "/mnt1/file1", &oi1, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/mnt1/file1", &oi1, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Build the virtual file */ if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -431,7 +431,7 @@ test_hide(hid_t fapl) * The original objects under file1:/mnt1 are still accessible by their * other names. This is a rather stupid test but demonstrates a point. */ - if(H5Oget_info_by_name(file1, "/file1", &oi2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/file1", &oi2, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { H5_FAILED(); puts(" Hard link failed for hidden object."); @@ -490,7 +490,7 @@ test_assoc(hid_t fapl) FAIL_STACK_ERROR /* Get information about the root of file2 */ - if(H5Oget_info(file2, &oi1) < 0) FAIL_STACK_ERROR + if(H5Oget_info2(file2, &oi1, 0) < 0) FAIL_STACK_ERROR /* Create the virtual file */ if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -499,7 +499,7 @@ test_assoc(hid_t fapl) * Get info about the mount point -- should be the same as the root group * of file2. */ - if(H5Oget_info_by_name(file1, "/mnt1", &oi2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/mnt1", &oi2, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { H5_FAILED(); @@ -688,7 +688,7 @@ test_preopen(hid_t fapl) if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Now access the thing we previously opened */ - if(H5Oget_info(grp, &oinfo) < 0) FAIL_STACK_ERROR + if(H5Oget_info2(grp, &oinfo, 0) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -752,10 +752,10 @@ test_postopen(hid_t fapl) if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR /* Now access the thing we previously opened */ - if(H5Oget_info(grp, &oinfo) < 0) FAIL_STACK_ERROR + if(H5Oget_info2(grp, &oinfo, 0) < 0) FAIL_STACK_ERROR /* Try accessing it from the file */ - if(H5Oget_info_by_name(file2, "/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file2, "/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Gclose(grp) < 0) FAIL_STACK_ERROR @@ -825,12 +825,12 @@ test_unlink(hid_t fapl) * before the H5Fmount() and thus refers to the mount point itself rather * than the group mounted there. */ - if(H5Oget_info_by_name(file1, "/mnt_unlink/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name(mnt, "/mnt_unlink/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name(root, "/mnt_unlink/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name(root, "file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/mnt_unlink/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(mnt, "/mnt_unlink/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(root, "/mnt_unlink/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(root, "file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Oget_info_by_name(mnt, "file2", &oinfo, H5P_DEFAULT); + status = H5Oget_info_by_name2(mnt, "file2", &oinfo, 0, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -845,9 +845,9 @@ test_unlink(hid_t fapl) * We should still be able to get to "/file2" of file2 by starting at * `root' which is still open, but not by name. */ - if(H5Oget_info_by_name(root, "file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(root, "file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Oget_info_by_name(mnt, "file2", &oinfo, H5P_DEFAULT); + status = H5Oget_info_by_name2(mnt, "file2", &oinfo, 0, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -855,7 +855,7 @@ test_unlink(hid_t fapl) TEST_ERROR } /* end if */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name(file2, "/mnt_unlink/file2", &oinfo, H5P_DEFAULT); + status = H5Oget_info_by_name2(file2, "/mnt_unlink/file2", &oinfo, 0, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -943,7 +943,7 @@ test_mvmpt(hid_t fapl) if(H5Lmove(file1, "/mnt_move_a", H5L_SAME_LOC, "/mnt_move_b", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access something under the new name */ - if(H5Oget_info_by_name(file1, "/mnt_move_b/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/mnt_move_b/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Funmount(file1, "/mnt_move_b") < 0) FAIL_STACK_ERROR @@ -1102,18 +1102,18 @@ test_uniformity(hid_t fapl) if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access some things from the file1 handle */ - if(H5Oget_info_by_name(file1, "/", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name(file1, "/mnt1", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name(file1, "mnt1", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name(file1, "/mnt1/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name(file1, "mnt1/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/mnt1", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "mnt1", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/mnt1/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "mnt1/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access the same things from the file2 handle */ - if(H5Oget_info_by_name(file2, "/", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name(file2, "/mnt1", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name(file2, "mnt1", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name(file2, "/mnt1/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name(file2, "mnt1/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file2, "/", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file2, "mnt1", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file2, "/mnt1/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file2, "mnt1/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -1170,7 +1170,7 @@ test_close(hid_t fapl) * still accessible through the file2 handle. */ if(H5Fclose(file1) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name(file2, "/mnt1", &oinfo, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, 0, H5P_DEFAULT) < 0) { H5_FAILED(); puts(" File1 contents are not accessible!"); TEST_ERROR @@ -1191,7 +1191,7 @@ test_close(hid_t fapl) * Close file2. It is not actually closed because it's a child of file1. */ if(H5Fclose(file2) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name(file1, "/mnt1/file2", &oinfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/mnt1/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Fclose(file1) < 0) FAIL_STACK_ERROR /* Check that all file IDs have been closed */ @@ -2495,9 +2495,9 @@ test_fcdegree_strong(hid_t fapl) TEST_ERROR /* Check that objects are still open */ - if(H5Oget_info(gidA, &oinfo) < 0) + if(H5Oget_info2(gidA, &oinfo, 0) < 0) TEST_ERROR - if(H5Oget_info(gidAM, &oinfo) < 0) + if(H5Oget_info2(gidAM, &oinfo, 0) < 0) TEST_ERROR /* Close file #2 (should close open objects also) */ @@ -2506,12 +2506,12 @@ test_fcdegree_strong(hid_t fapl) /* Check that objects are closed */ H5E_BEGIN_TRY { - ret = H5Oget_info(gidA, &oinfo); + ret = H5Oget_info2(gidA, &oinfo, 0); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Oget_info(gidAM, &oinfo); + ret = H5Oget_info2(gidAM, &oinfo, 0); } H5E_END_TRY; if(ret >= 0) TEST_ERROR diff --git a/test/mtime.c b/test/mtime.c index 38e3960..59457d4 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -90,9 +90,9 @@ main(void) */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR; - if(H5Oget_info_by_name(file, "dset", &oi1, H5P_DEFAULT) < 0) TEST_ERROR; + if(H5Oget_info_by_name2(file, "dset", &oi1, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR; if((dset = H5Dopen2(file, "dset", H5P_DEFAULT)) < 0) TEST_ERROR; - if(H5Oget_info(dset, &oi2) < 0) TEST_ERROR; + if(H5Oget_info2(dset, &oi2, H5O_INFO_TIME) < 0) TEST_ERROR; if(H5Dclose(dset) < 0) TEST_ERROR; if(H5Fclose(file) < 0) TEST_ERROR; @@ -134,7 +134,7 @@ main(void) file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); if(file >= 0){ - if(H5Oget_info_by_name(file, "/Dataset1", &oi1, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(file, "/Dataset1", &oi1, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR; if(oi1.ctime != MTIME1) { H5_FAILED(); @@ -164,7 +164,7 @@ main(void) file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); if(file >= 0){ - if(H5Oget_info_by_name(file, "/Dataset1", &oi2, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(file, "/Dataset1", &oi2, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR; if(oi2.ctime != MTIME2) { H5_FAILED(); diff --git a/test/objcopy.c b/test/objcopy.c index 3fbb7b8..7e57a56 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -877,10 +877,10 @@ compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid) cpy_flags = 0; /* Check the number of attributes on source dataset */ - if(H5Oget_info(oid, &oinfo1) < 0) TEST_ERROR + if(H5Oget_info2(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR /* Check the number of attributes on destination dataset */ - if(H5Oget_info(oid2, &oinfo2) < 0) TEST_ERROR + if(H5Oget_info2(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR if(cpy_flags & H5O_COPY_WITHOUT_ATTR_FLAG) { /* Check that the destination has no attributes */ @@ -1071,8 +1071,8 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, if(obj_owner > 0) { H5O_info_t oinfo1, oinfo2; - if(H5Oget_info(obj_owner, &oinfo1) < 0) TEST_ERROR - if(H5Oget_info(obj1_id, &oinfo2) < 0) TEST_ERROR + if(H5Oget_info2(obj_owner, &oinfo1, 0) < 0) TEST_ERROR + if(H5Oget_info2(obj1_id, &oinfo2, 0) < 0) TEST_ERROR if(H5F_addr_eq(oinfo1.addr, oinfo2.addr)) { if(H5Oclose(obj1_id) < 0) TEST_ERROR if(H5Oclose(obj2_id) < 0) TEST_ERROR @@ -1129,8 +1129,8 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, if(obj_owner > 0) { H5O_info_t oinfo1, oinfo2; - if(H5Oget_info(obj_owner, &oinfo1) < 0) TEST_ERROR - if(H5Oget_info(obj1_id, &oinfo2) < 0) TEST_ERROR + if(H5Oget_info2(obj_owner, &oinfo1, 0) < 0) TEST_ERROR + if(H5Oget_info2(obj1_id, &oinfo2, 0) < 0) TEST_ERROR if(H5F_addr_eq(oinfo1.addr, oinfo2.addr)) { if(H5Oclose(obj1_id) < 0) TEST_ERROR if(H5Oclose(obj2_id) < 0) TEST_ERROR @@ -1423,8 +1423,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) H5O_info_t oinfo, oinfo2; /* Object info */ /* Compare some pieces of the object info */ - if(H5Oget_info_by_name(gid, objname, &oinfo, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name(gid2, objname2, &oinfo2, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(gid, objname, &oinfo, H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(gid2, objname2, &oinfo2, H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR if(oinfo.type != oinfo2.type) TEST_ERROR if(oinfo.rc != oinfo2.rc) TEST_ERROR @@ -1949,8 +1949,8 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap if(H5Tcommitted(tid) != TRUE) TEST_ERROR /* verify that the addresses of the datatypes are the same */ - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR - if(H5Oget_info(tid2, &oinfo2) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid2, &oinfo2, 0) < 0) TEST_ERROR if(oinfo.fileno != oinfo2.fileno || oinfo.addr != oinfo2.addr) FAIL_PUTS_ERROR("destination attribute does not use the same committed datatype") @@ -10331,28 +10331,28 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* Open SRC1 committed dtype, get address */ if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open SRC1 dset dtype, check address */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR /* Open SRC2 committed dtype, check address */ if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* Open SRC2 dset dtype, check address */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10385,7 +10385,7 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* Open SRC1 dset dtype, get address */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10393,7 +10393,7 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* Open SRC2 dset dtype, check address */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10565,28 +10565,28 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* Open group 1 source committed dtype, get address */ if((tid = H5Topen2(fid, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open group 1 source dset dtype, check address */ if((did = H5Dopen2(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR /* Open group 1 committed dtype, check address */ if((tid = H5Topen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* Open group 1 dset dtype, check address */ if((did = H5Dopen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10594,7 +10594,7 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* Open group 2 source committed dtype, get address and make sure it is * different from group 1 source committed dtype */ if((tid = H5Topen2(fid, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr == exp_addr) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR @@ -10602,21 +10602,21 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* Open group 2 source dset dtype, check address */ if((did = H5Dopen2(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR /* Open group 2 committed dtype, check address */ if((tid = H5Topen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* Open group 2 dset dtype, check address */ if((did = H5Dopen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10644,7 +10644,7 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* Open group 1 source dset dtype, get address */ if((did = H5Dopen2(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10652,7 +10652,7 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* Open group 1 dset dtype, check address */ if((did = H5Dopen2(fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10661,7 +10661,7 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo * different from group 1 source dset dtype */ if((did = H5Dopen2(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr == exp_addr) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR @@ -10670,7 +10670,7 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* Open group 2 dset dtype, check address */ if((did = H5Dopen2(fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10837,14 +10837,14 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* Open committed dtype "b", get address */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open dset dtype, check address */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10875,28 +10875,28 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* Open committed dtype "a", get address */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open dset 2 dtype, check address */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR /* Open committed dtype "b", get address */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open dset dtype, check address */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11072,7 +11072,7 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* Open attribute dtype, get address */ if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_TOP, "attr", H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR @@ -11080,7 +11080,7 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* Open dset dtype, check address */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11331,13 +11331,13 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* get address of committed datatype at root group */ if((tid = H5Topen2(fid_dst, SRC_ROOT_GROUP "/" ROOT_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr_int = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* get address of committed datatype at /g0 */ if((tid = H5Topen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" GROUP_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr_short = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR @@ -11351,7 +11351,7 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* check address of datatype for second dataset */ if((did = H5Dopen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr_short) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11359,7 +11359,7 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* check address of datatype for third dataset */ if((did = H5Dopen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr_int) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11371,7 +11371,7 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* get address of committed datatype at /g0 */ if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP "/" GROUP_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr_short) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR @@ -11385,7 +11385,7 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* check address of datatype for second dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr_short) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11393,7 +11393,7 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* check address of datatype for third dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr_int) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11408,7 +11408,7 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* Open attribute with anon ndt (short), get address */ if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_UNCOPIED, DST_ATTR_ANON_SHORT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr_short) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR @@ -11416,7 +11416,7 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* Open attribute with anon ndt (int), get address */ if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_UNCOPIED, DST_ATTR_ANON_INT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr_int) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR @@ -11431,7 +11431,7 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* check address of datatype for second dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr_short) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11439,7 +11439,7 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* check address of datatype for third dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr_int) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11642,50 +11642,50 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds */ /* get address of committed datatype: /src_root/src_ndt_double */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_DOUBLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* get address of committed datatype: /dst_ndt_double */ if((tid = H5Topen2(fid_dst, "/" DST_NDT_DOUBLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* get address of committed datatype: /src_root/src_ndt_float */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_FLOAT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* get address of committed datatype: /dst_ndt_float */ if((tid = H5Topen2(fid_dst, "/" DST_NDT_FLOAT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* get address of committed datatype: /src_root/src_ndt_int */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* get address of committed datatype: /dst_ndt_int */ if((tid = H5Topen2(fid_dst, "/" DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* get address of committed datatype: /src_root/src_ndt_short */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* open attribute; get its dtype; get dtype's address: /src_root/src_ndt_double/dst_attr */ if((aid = H5Aopen_by_name(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_DOUBLE, DST_ATTR, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR @@ -11816,13 +11816,13 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* open committed dtype "/dst_ndt_int", get its address */ if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* check address of "/uncopied/src_ndt_int" */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR @@ -11849,13 +11849,13 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* open committed dtype "/uncopied/src_ndt_int", get its address */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* check address of "/src_ndt_int" */ if((tid = H5Topen2(fid_dst, SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR @@ -11887,13 +11887,13 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Open committed dtype "/uncopied/src_ndt_int", get its address */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* check address of "/src_ndt_int2" */ if((tid = H5Topen2(fid_dst, SRC_NDT_INT2, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR @@ -11921,13 +11921,13 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Open committed dtype "/dst_dt_int", get its address */ if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* check address of "/uncopied/src_ndt_int2" */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT2, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR @@ -12077,14 +12077,14 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Open committed dtype "/dst_ndt_int", get its address */ if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* check address of datatype for the copied dataset: "/uncopied/src_ndt_dset" */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12113,7 +12113,7 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Open committed dtype dataset "/uncopied/src_ndt_dset", get its datatype address */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12121,7 +12121,7 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* check address of datatype for the copied dataset: "/src_ndt_dset" */ if((did = H5Dopen2(fid_dst, SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12155,7 +12155,7 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* open the copied dataset: /uncopied/src_ndt_dset", get its address */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12163,7 +12163,7 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* check address of datatype for the copied dataset: "/src_ndt_dset2" */ if((did = H5Dopen2(fid_dst, SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12193,7 +12193,7 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* open the copied dataset: "/src_ndt_dset", get its datatype address */ if((did = H5Dopen2(fid_dst, SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12201,7 +12201,7 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* check address of datatype for the copied dataset: /uncopied/src_ndt_dset2 */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12861,14 +12861,14 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Open committed dtype "b", get address */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open dset dtype, check address */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12909,14 +12909,14 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Open committed dtype "a", get address */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open copied dataset and its dtype, check address */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12948,28 +12948,28 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Open committed dtype "a", get address */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open the copied dataset and get its dtype, addresses should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr == exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR /* Open committed dtype "b", get address */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open the copied dataset and get its dtype, addresses should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr == exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -13008,28 +13008,28 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Open committed dtype "a", get address */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open the copied dataset and get its dtype, addresses should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr == exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR /* Open committed dtype "b", get address */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open the copied dataset and get its dtype, addresses should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info(tid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR if(oinfo.addr == exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR diff --git a/test/ohdr.c b/test/ohdr.c index e91c6a8..146245f 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -383,7 +383,7 @@ test_ohdr_swmr(hbool_t new_format) FAIL_STACK_ERROR /* Get the object information */ - if(H5Oget_info(did, &obj_info) < 0) + if(H5Oget_info2(did, &obj_info, H5O_INFO_HDR) < 0) FAIL_STACK_ERROR if(new_format) diff --git a/test/stab.c b/test/stab.c index 331c68d..37097b7 100644 --- a/test/stab.c +++ b/test/stab.c @@ -419,7 +419,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) if(H5G__is_new_dense_test(gid) != FALSE) TEST_ERROR /* Check that the object header is only one chunk and the space has been allocated correctly */ - if(H5Oget_info(gid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(gid, &oinfo, H5O_INFO_HDR) < 0) TEST_ERROR if(oinfo.hdr.space.total != 151) TEST_ERROR if(oinfo.hdr.space.free != 0) TEST_ERROR if(oinfo.hdr.nmesgs != 6) TEST_ERROR @@ -441,7 +441,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR /* Check that the object header is still one chunk and the space has been allocated correctly */ - if(H5Oget_info(gid, &oinfo) < 0) TEST_ERROR + if(H5Oget_info2(gid, &oinfo, H5O_INFO_HDR) < 0) TEST_ERROR if(oinfo.hdr.space.total != 151) TEST_ERROR if(oinfo.hdr.space.free != 92) TEST_ERROR if(oinfo.hdr.nmesgs != 3) TEST_ERROR diff --git a/test/tattr.c b/test/tattr.c index b5495de..f312870 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -422,7 +422,7 @@ test_attr_basic_read(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info(dataset, &oinfo); + ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo.num_attrs, 2, "H5Oget_info"); @@ -451,7 +451,7 @@ test_attr_basic_read(hid_t fapl) CHECK(group, FAIL, "H5Gopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info(group, &oinfo); + ret = H5Oget_info2(group, &oinfo, H5O_INFO_NUM_ATTRS); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); @@ -793,7 +793,7 @@ test_attr_compound_read(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info(dataset, &oinfo); + ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); @@ -997,7 +997,7 @@ test_attr_scalar_read(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info(dataset, &oinfo); + ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); @@ -1200,7 +1200,7 @@ test_attr_mult_read(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info(dataset, &oinfo); + ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo.num_attrs, 3, "H5Oget_info"); @@ -1457,7 +1457,7 @@ test_attr_iterate(hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); /* Verify the correct number of attributes */ - ret = H5Oget_info(dataset, &oinfo); + ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo.num_attrs, 0, "H5Oget_info"); @@ -1475,7 +1475,7 @@ test_attr_iterate(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info(dataset, &oinfo); + ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo.num_attrs, 3, "H5Oget_info"); @@ -1522,7 +1522,7 @@ test_attr_delete(hid_t fapl) CHECK(dataset, FAIL, "H5Dopen2"); /* Verify the correct number of attributes */ - ret = H5Oget_info(dataset, &oinfo); + ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo.num_attrs, 3, "H5Oget_info"); @@ -1531,7 +1531,7 @@ test_attr_delete(hid_t fapl) VERIFY(ret, FAIL, "H5Adelete"); /* Verify the correct number of attributes */ - ret = H5Oget_info(dataset, &oinfo); + ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo.num_attrs, 3, "H5Oget_info"); @@ -1540,7 +1540,7 @@ test_attr_delete(hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify the correct number of attributes */ - ret = H5Oget_info(dataset, &oinfo); + ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo.num_attrs, 2, "H5Oget_info"); @@ -1577,7 +1577,7 @@ test_attr_delete(hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify the correct number of attributes */ - ret = H5Oget_info(dataset, &oinfo); + ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); @@ -1600,7 +1600,7 @@ test_attr_delete(hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Verify the correct number of attributes */ - ret = H5Oget_info(dataset, &oinfo); + ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo.num_attrs, 0, "H5Oget_info"); @@ -1665,7 +1665,7 @@ test_attr_dtype_shared(hid_t fapl) CHECK(ret, FAIL, "H5Tcommit2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "H5Oget_info_by_name"); @@ -1678,7 +1678,7 @@ test_attr_dtype_shared(hid_t fapl) CHECK(dset_id, FAIL, "H5Dcreate2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 2, "H5Oget_info_by_name"); @@ -1687,7 +1687,7 @@ test_attr_dtype_shared(hid_t fapl) CHECK(attr_id, FAIL, "H5Acreate2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 3, "H5Oget_info_by_name"); @@ -1700,7 +1700,7 @@ test_attr_dtype_shared(hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 2, "H5Oget_info_by_name"); @@ -1709,7 +1709,7 @@ test_attr_dtype_shared(hid_t fapl) CHECK(attr_id, FAIL, "H5Acreate2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 3, "H5Oget_info_by_name"); @@ -1764,7 +1764,7 @@ test_attr_dtype_shared(hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 3, "H5Oget_info_by_name"); @@ -1773,7 +1773,7 @@ test_attr_dtype_shared(hid_t fapl) CHECK(ret, FAIL, "H5Ldelete"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "H5Oget_info_by_name"); @@ -2464,7 +2464,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check # of attributes */ - ret = H5Oget_info(dataset, &oinfo); + ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info"); } /* end for */ @@ -2646,7 +2646,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Arename_by_name"); /* Check # of attributes */ - ret = H5Oget_info(dataset, &oinfo); + ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info"); } /* end for */ @@ -2798,7 +2798,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check # of attributes */ - ret = H5Oget_info(dataset, &oinfo); + ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info"); } /* end for */ @@ -10484,7 +10484,7 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gcreate2"); /* Get root group address */ - ret = H5Oget_info(fid, &oinfo); + ret = H5Oget_info2(fid, &oinfo, 0); CHECK(ret, FAIL, "H5Oget_info"); root_addr = oinfo.addr; @@ -10509,7 +10509,7 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gopen2"); oid = H5Oopen(gid, LINK1_NAME, H5P_DEFAULT); CHECK(oid, FAIL, "H5Oopen"); - ret = H5Oget_info(oid, &oinfo); + ret = H5Oget_info2(oid, &oinfo, 0); CHECK(ret, FAIL, "H5Oget_info"); if(oinfo.addr != root_addr) TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)oinfo.addr, (long long unsigned)root_addr); @@ -10554,7 +10554,7 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gopen2"); oid = H5Oopen(gid, LINK1_NAME, H5P_DEFAULT); CHECK(oid, FAIL, "H5Oopen"); - ret = H5Oget_info(oid, &oinfo); + ret = H5Oget_info2(oid, &oinfo, 0); CHECK(ret, FAIL, "H5Oget_info"); if(oinfo.addr != root_addr) TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)oinfo.addr, (long long unsigned)root_addr); diff --git a/test/tfile.c b/test/tfile.c index 677fd06..d3134f8 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -4891,7 +4891,7 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, /* * Make sure the root group has the correct object header version */ - ret = H5Oget_info_by_name(file, "/", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.hdr.version, oh_vers_create, "H5Oget_info_by_name"); @@ -4907,7 +4907,7 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, file = H5Fopen("tfile5.h5", H5F_ACC_RDWR, fapl); CHECK(file, FAIL, "H5Fopen"); - ret = H5Oget_info_by_name(file, "/", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.hdr.version, oh_vers_create, "H5Oget_info_by_name"); @@ -4918,7 +4918,7 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, group = H5Gcreate2(file, "/G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(group, FAIL, "H5Gcreate"); - ret = H5Oget_info(group, &oinfo); + ret = H5Oget_info2(group, &oinfo, H5O_INFO_HDR); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo.hdr.version, oh_vers_mod, "H5Oget_info"); @@ -4932,7 +4932,7 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, group = H5Gcreate2(file, "/G1/G3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(group, FAIL, "H5Gcreate"); - ret = H5Oget_info(group, &oinfo); + ret = H5Oget_info2(group, &oinfo, H5O_INFO_HDR); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.hdr.version, oh_vers_mod, "H5Oget_info_by_name"); @@ -4942,7 +4942,7 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, /* * Make sure the root group still has the correct object header version */ - ret = H5Oget_info_by_name(file, "/", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.hdr.version, oh_vers_create, "H5Oget_info_by_name"); @@ -5640,7 +5640,7 @@ test_libver_bounds_obj(hid_t fapl) CHECK(fid, FAIL, "H5Fcreate"); /* Get root group's object info */ - ret = H5Oget_info_by_name(fid, "/", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); /* Verify object header version is 2 because shared message is enabled */ @@ -5659,7 +5659,7 @@ test_libver_bounds_obj(hid_t fapl) CHECK(fid, FAIL, "H5Fcreate"); /* Get root group's object info */ - ret = H5Oget_info_by_name(fid, "/", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); /* Verify object header version is as indicated by low_bound */ @@ -5714,7 +5714,7 @@ test_libver_bounds_obj(hid_t fapl) VERIFY(ginfo.storage_type, H5G_STORAGE_TYPE_SYMBOL_TABLE, "H5Gget_info"); /* Get object header information */ - ret = H5Oget_info_by_name(gid, GRP_NAME, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(gid, GRP_NAME, &oinfo, H5O_INFO_HDR, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); /* Verify object header version as indicated by low_bound */ diff --git a/test/th5o.c b/test/th5o.c index 00d706c..76ea3b1 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -30,6 +30,11 @@ #define TEST6_DIM1 100 #define TEST6_DIM2 100 +//#define NUM_GROUPS 100000 +#define NUM_GROUPS 100 +#define NUM_ATTRS 10 +#define NUM_DSETS 50 + /**************************************************************** ** @@ -410,13 +415,13 @@ test_h5o_refcount(void) CHECK(ret, FAIL, "H5Sclose"); /* Get ref counts for each object. They should all be 1, since each object has a hard link. */ - ret = H5Oget_info_by_name(fid, "group", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "group", &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name(fid, "datatype", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name(fid, "dataset", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); @@ -429,13 +434,13 @@ test_h5o_refcount(void) CHECK(ret, FAIL, "H5Oincr_refcount"); /* Get ref counts for each object. They should all be 2 now. */ - ret = H5Oget_info_by_name(fid, "group", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "group", &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name(fid, "datatype", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name(fid, "dataset", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); @@ -447,13 +452,13 @@ test_h5o_refcount(void) ret = H5Odecr_refcount(dset); CHECK(ret, FAIL, "H5Odecr_refcount"); - ret = H5Oget_info_by_name(fid, "group", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "group", &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name(fid, "datatype", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name(fid, "dataset", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); @@ -485,13 +490,13 @@ test_h5o_refcount(void) dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); CHECK(dset, FAIL, "H5Dopen2"); - ret = H5Oget_info_by_name(fid, "group", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "group", &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name(fid, "datatype", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name(fid, "dataset", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); @@ -523,13 +528,13 @@ test_h5o_refcount(void) dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); CHECK(dset, FAIL, "H5Dopen2"); - ret = H5Oget_info_by_name(fid, "group", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "group", &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name(fid, "datatype", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name(fid, "dataset", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); @@ -1272,9 +1277,9 @@ test_h5o_getinfo_same_file(void) HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, through group IDs */ - ret = H5Oget_info(gid1, &oinfo1); + ret = H5Oget_info2(gid1, &oinfo1, 0); CHECK(ret, FAIL, "H5Oget_info"); - ret = H5Oget_info(gid2, &oinfo2); + ret = H5Oget_info2(gid2, &oinfo2, 0); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); @@ -1284,9 +1289,9 @@ test_h5o_getinfo_same_file(void) HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, by name */ - ret = H5Oget_info_by_name(fid1, "group1", &oinfo1, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid1, "group1", &oinfo1, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name(fid1, "group2", &oinfo2, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid1, "group2", &oinfo2, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); @@ -1317,9 +1322,9 @@ test_h5o_getinfo_same_file(void) HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, through group IDs */ - ret = H5Oget_info(gid1, &oinfo1); + ret = H5Oget_info2(gid1, &oinfo1, 0); CHECK(ret, FAIL, "H5Oget_info"); - ret = H5Oget_info(gid2, &oinfo2); + ret = H5Oget_info2(gid2, &oinfo2, 0); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); @@ -1329,9 +1334,9 @@ test_h5o_getinfo_same_file(void) HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, by name */ - ret = H5Oget_info_by_name(fid1, "group1", &oinfo1, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid1, "group1", &oinfo1, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name(fid1, "group2", &oinfo2, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid1, "group2", &oinfo2, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); @@ -1348,6 +1353,331 @@ test_h5o_getinfo_same_file(void) } /* test_h5o_getinfo_same_file() */ +#ifndef H5_NO_DEPRECATED_SYMBOLS +/**************************************************************** +** +** visit_obj_cb(): +** This is the callback function invoked by H5Ovisit1() in +** test_h5o_getinfo_visit(): +** --Verify that the object info returned to the callback +** function is the same as H5Oget_info2(). +** +****************************************************************/ +static int +visit_obj_cb(hid_t group_id, const char *name, const H5O_info_t *oinfo1, + void H5_ATTR_UNUSED *_op_data) +{ + H5O_info_t oinfo2; /* Object info structs */ + + /* Verify the object info for "group1", "group2" and the root group */ + if(!(HDstrcmp(name, "group1"))) { + H5Oget_info_by_name2(group_id, name, &oinfo2, H5O_INFO_NUM_ATTRS, H5P_DEFAULT); + VERIFY(oinfo1->num_attrs, oinfo2.num_attrs, "obj info from H5Ovisit1"); + } else if(!(HDstrcmp(name, "group2"))) { + H5Oget_info_by_name2(group_id, name, &oinfo2, H5O_INFO_HDR, H5P_DEFAULT); + VERIFY(oinfo1->hdr.nmesgs, oinfo2.hdr.nmesgs, "obj info from H5Ovisit1/H5Oget_info2"); + VERIFY(oinfo1->hdr.nchunks, oinfo2.hdr.nchunks, "obj info from H5Ovisit1/H5Oget_info2"); + } else if(!(HDstrcmp(name, "."))) { + H5Oget_info_by_name2(group_id, name, &oinfo2, H5O_INFO_META_SIZE, H5P_DEFAULT); + VERIFY(oinfo1->meta_size.obj.index_size, oinfo2.meta_size.obj.index_size, "obj info from H5Ovisit1/H5Oget_info2"); + VERIFY(oinfo1->meta_size.obj.heap_size, oinfo2.meta_size.obj.heap_size, "obj info from H5Ovisit1/H5Oget_info2"); + } + + return(H5_ITER_CONT); +} /* end visit_obj_cb() */ + + +/**************************************************************** +** +** test_h5o_getinfo_visit(): +** Verify that the object info returned via H5Oget_info1() +** and H5Oget_info2() are the same. +** Verify that the object info retrieved via H5Ovisit1() is +** the same as H5Oget_info2(). +** +****************************************************************/ +static void +test_h5o_getinfo_visit(void) +{ + hid_t fid = -1; /* HDF5 File ID */ + hid_t gid1 = -1, gid2 = -1; /* Group IDs */ + hid_t sid = -1; /* Dataspace ID */ + hid_t aid = -1; /* Attribute ID */ + H5O_info_t oinfo1, oinfo2; /* Object info structs */ + char attrname[25]; /* Attribute name */ + int j; /* Local index variable */ + herr_t ret; /* Value returned from API calls */ + + /* Create an HDF5 file */ + fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create "group1" in the file */ + gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(gid1, FAIL, "H5Gcreate2"); + + /* Create dataspace */ + sid = H5Screate(H5S_SCALAR); + CHECK(sid, FAIL, "H5Screate"); + + /* Attach 10 attributes to "group1" */ + for(j = 0; j <10; j++) { + /* Create the attribute name */ + sprintf(attrname, "attr%u", j); + /* Create the attribute */ + aid = H5Acreate2(gid1, attrname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aid, FAIL, "H5Acreate2"); + /* Close the attribute */ + ret = H5Aclose(aid); + CHECK(ret, FAIL, "H5Aclose"); + } + + /* Create "group2" in the file */ + gid2 = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(gid2, FAIL, "H5Gcreate2"); + + /* Reset object info */ + HDmemset(&oinfo1, 0, sizeof(oinfo1)); + HDmemset(&oinfo2, 0, sizeof(oinfo2)); + + /* Query the object info for "group1" via H5Oget_info1 and H5Oget_info2 */ + ret = H5Oget_info1(gid1, &oinfo1); + CHECK(ret, FAIL, "H5Oget_info"); + ret = H5Oget_info2(gid1, &oinfo2, H5O_INFO_NUM_ATTRS); + CHECK(ret, FAIL, "H5Oget_info"); + + /* Verify the object info for "group1" is correct */ + VERIFY(oinfo1.fileno, oinfo2.fileno, "obj info from H5Oget_info1/2"); + VERIFY(oinfo1.num_attrs, oinfo2.num_attrs, "obj info from H5Oget_info1/2"); + + /* Reset object info */ + HDmemset(&oinfo1, 0, sizeof(oinfo1)); + HDmemset(&oinfo2, 0, sizeof(oinfo2)); + + /* Query the object info for "group2" via H5Oget_info1 and H5Oget_info2 */ + ret = H5Oget_info_by_name1(fid, "group2", &oinfo1, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name2(fid, "group2", &oinfo2, H5O_INFO_HDR|H5O_INFO_META_SIZE, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); + + /* Verify the object info for "group2" is correct */ + VERIFY(oinfo1.hdr.nmesgs, oinfo2.hdr.nmesgs, "obj info from H5Oget_info1/2"); + VERIFY(oinfo1.hdr.nchunks, oinfo2.hdr.nchunks, "obj info from H5Oget_info1/2"); + VERIFY(oinfo1.meta_size.obj.index_size, oinfo2.meta_size.obj.index_size, "obj info from H5Oget_info1/2"); + VERIFY(oinfo1.meta_size.obj.heap_size, oinfo2.meta_size.obj.heap_size, "obj info from H5Oget_info1/2"); + + /* Close everything */ + ret = H5Gclose(gid1); + CHECK(ret, FAIL, "H5Gclose"); + ret = H5Gclose(gid2); + CHECK(ret, FAIL, "H5Gclose"); + + /* Verify the object info returned to the callback function is correct */ + ret = H5Ovisit1(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, NULL); + + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + +} /* test_h5o_getinfo_visit() */ + + +/**************************************************************** +** +** perform_visit_obj_cb(): +** This is the callback function invoked by H5Ovisit1 and +** H5Ovisit2() used in test_h5o_perform_getinfo_visit(). +** +****************************************************************/ +static int +perform_visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, + const H5O_info_t H5_ATTR_UNUSED *oinfo, void H5_ATTR_UNUSED *_op_data) +{ + return(H5_ITER_CONT); +} /* end visit_obj_cb() */ + +/**************************************************************** +** +** test_h5o_perform_getinfo_visit(): +** Verify that H5Ovisit2 performs better than H5Ovisit1: +** --H5Ovisit2 has fields = 0 passed to the internal +** library routine H5O_get_info() +** --H5Ovisit1 has fields = H5O_INFO_ALL passed to +** internal library routine H5O_get_info() +** 1) Create an HDF5 file +** 2) Create a group with NUM_GROUPS sub-groups +** 3) Attach NUM_ATTRS attributes to each sub-group +** 4) Create NUM_DSETS datasets for each sub-group +** 5) Visit all the objects from the root group via +** H5Ovisit1 and H5Ovisit2 +** 6) Verify the iteration time used for H5Ovisit2 is +** less than H5Ovisit1 +** +****************************************************************/ +static void +test_h5o_perform_getinfo_visit(void) +{ + hid_t fid = -1; /* HDF5 File ID */ + hid_t fapl = -1; /* File access property list */ + hid_t gid = -1; /* Group IDs */ + hid_t asid = -1; /* Dataspace ID for the attribute */ + unsigned i, j; /* Local index variable */ + struct timeval startTime; /* Starting time */ + struct timeval endTime; /* Ending time */ + time_t new_runtime = 0.0; /* Time used for H5Oget_info2 */ + time_t old_runtime = 0.0; /* time used for H5Oget_info1 */ + hid_t dcpl = -1; /* Dataset creation property list */ + hid_t sid = -1; /* Dataspace ID for dataset */ + hid_t did = -1; /* Dataset ID */ + hsize_t dims[2]; /* Dimension sizes */ + hsize_t max_dims[2]; /* Maximum dimension sizes */ + hsize_t chunk_dims[2]; /* Chunk dimension sizes */ + unsigned wbuf[10][30]; /* Data buffer */ + herr_t ret; /* Value returned from API calls */ + + fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(fapl, FAIL, "H5Pcreate"); + ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); + CHECK(ret, FAIL, "H5Pset_libver_bounds"); + + /* Create a new HDF5 file */ + fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create dataspace for the attribute */ + asid = H5Screate(H5S_SCALAR); + CHECK(asid, FAIL, "H5Screate"); + + /* Set up to create a chunked dataset in the group: this will use v2 B-tree chunk indexing */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + chunk_dims[0] = chunk_dims[1] = 10; + H5Pset_chunk(dcpl, 2, chunk_dims); + dims[0] = 10; + dims[1] = 30; + max_dims[0] = max_dims[1] = H5S_UNLIMITED; + sid = H5Screate_simple(2, dims, max_dims); + + /* Initialize write buffer */ + for(i=0; itype != oinfo.type) { @@ -797,7 +797,7 @@ static void test_grp_memb_funcs(hid_t fapl) obj_names[i] = HDstrdup(dataset_name); CHECK_PTR(obj_names[i], "strdup"); - ret = H5Oget_info_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_idx"); if(!HDstrcmp(dataset_name, "grp")) @@ -891,7 +891,7 @@ static void test_links(hid_t fapl) /* Get object type */ if(linfo.type == H5L_TYPE_HARD) { - ret = H5Oget_info_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_idx"); } /* end if */ diff --git a/test/tmisc.c b/test/tmisc.c index 4a77b51..0ee0302 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -674,11 +674,11 @@ test_misc4(void) CHECK(group3, FAIL, "H5Gcreate2"); /* Get the stat information for each group */ - ret = H5Oget_info_by_name(file1, MISC4_GROUP_1, &oinfo1, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file1, MISC4_GROUP_1, &oinfo1, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name(file1, MISC4_GROUP_2, &oinfo2, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file1, MISC4_GROUP_2, &oinfo2, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name(file2, MISC4_GROUP_1, &oinfo3, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file2, MISC4_GROUP_1, &oinfo3, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); /* Verify that the fileno values are the same for groups from file1 */ @@ -2929,7 +2929,7 @@ test_misc18(void) CHECK(did1, FAIL, "H5Dcreate2"); /* Get object information */ - ret = H5Oget_info_by_name(fid, MISC18_DSET1_NAME, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name"); VERIFY(oinfo.hdr.nchunks, 1, "H5Oget_info_by_name"); @@ -2942,7 +2942,7 @@ test_misc18(void) CHECK(did2, FAIL, "H5Dcreate2"); /* Get object information */ - ret = H5Oget_info_by_name(fid, MISC18_DSET2_NAME, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name"); VERIFY(oinfo.hdr.nchunks, 1, "H5Oget_info_by_name"); @@ -2975,7 +2975,7 @@ test_misc18(void) } /* end for */ /* Get object information for dataset #1 now */ - ret = H5Oget_info_by_name(fid, MISC18_DSET1_NAME, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name"); VERIFY(oinfo.hdr.nchunks, 9, "H5Oget_info_by_name"); @@ -2984,7 +2984,7 @@ test_misc18(void) VERIFY(oinfo.num_attrs, 10, "H5Oget_info_by_name"); /* Get object information for dataset #2 now */ - ret = H5Oget_info_by_name(fid, MISC18_DSET2_NAME, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name"); VERIFY(oinfo.hdr.nchunks, 9, "H5Oget_info_by_name"); @@ -3958,7 +3958,7 @@ test_misc23(void) tmp_id = H5Gopen2(file_id, "/A/B01", H5P_DEFAULT); CHECK(tmp_id, FAIL, "H5Gopen2"); - status = H5Oget_info(tmp_id, &oinfo); + status = H5Oget_info2(tmp_id, &oinfo, 0); CHECK(status, FAIL, "H5Oget_info"); VERIFY(oinfo.rc, 1, "H5Oget_info"); @@ -5238,7 +5238,7 @@ test_misc30_get_info_cb(hid_t loc_id, const char *name, const H5L_info_t H5_ATTR { H5O_info_t object_info; - return H5Oget_info_by_name(loc_id, name, &object_info, H5P_DEFAULT); + return H5Oget_info_by_name2(loc_id, name, &object_info, 0, H5P_DEFAULT); } static int @@ -5504,19 +5504,19 @@ test_misc33(void) /* Case (1) */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_name(fid, "/soft_two", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "/soft_two", &oinfo, 0, H5P_DEFAULT); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Oget_info_by_name"); /* Case (2) */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_name(fid, "/dsetA", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "/dsetA", &oinfo, 0, H5P_DEFAULT); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Oget_info_by_name"); /* Case (3) */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_name(fid, "/soft_one", &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "/soft_one", &oinfo, 0, H5P_DEFAULT); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Oget_info_by_name"); diff --git a/test/trefer.c b/test/trefer.c index 7cbb77f..30ad112 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -1411,7 +1411,7 @@ test_reference_group(void) CHECK(size, FAIL, "H5Lget_name_by_idx"); VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx"); - ret = H5Oget_info_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, 0, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_idx"); VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx"); diff --git a/test/tsohm.c b/test/tsohm.c index 133b196..d00a03a 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -839,7 +839,7 @@ static void test_sohm_size1(void) CHECK_I(file, "size1_helper"); /* Get the size of a dataset object header */ - ret = H5Oget_info_by_name(file, DSETNAME[0], &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT); CHECK_I(ret, "H5Oget_info_by_name"); ret = H5Fclose(file); CHECK_I(ret, "H5Fclose"); @@ -894,7 +894,7 @@ static void test_sohm_size1(void) CHECK_I(file, "size1_helper"); /* Get the size of a dataset object header */ - ret = H5Oget_info_by_name(file, DSETNAME[0], &oinfo, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT); CHECK_I(ret, "H5Oget_info_by_name"); ret = H5Fclose(file); CHECK_I(ret, "H5Fclose"); diff --git a/test/unlink.c b/test/unlink.c index f5754f8..c3ebc4c 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -446,9 +446,9 @@ check_new_move(hid_t fapl) FAIL_STACK_ERROR /* Get hard link info */ - if(H5Oget_info_by_name(file, "/group2/group_new_name", &oi_hard1, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(file, "/group2/group_new_name", &oi_hard1, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name(file, "/group1/hard", &oi_hard2, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(file, "/group1/hard", &oi_hard2, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check hard links */ @@ -2228,7 +2228,7 @@ test_full_group_compact(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name(file_id, objname, &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file_id, objname, &oi, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 2) TEST_ERROR } /* end for */ @@ -2245,7 +2245,7 @@ test_full_group_compact(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name(file_id, objname, &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file_id, objname, &oi, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 1) TEST_ERROR } /* end for */ @@ -2374,7 +2374,7 @@ test_full_group_dense(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name(file_id, objname, &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file_id, objname, &oi, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 2) TEST_ERROR } /* end for */ @@ -2391,7 +2391,7 @@ test_full_group_dense(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name(file_id, objname, &oi, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file_id, objname, &oi, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 1) TEST_ERROR } /* end for */ diff --git a/test/vds.c b/test/vds.c index 7a659cb..3f00224 100644 --- a/test/vds.c +++ b/test/vds.c @@ -372,7 +372,7 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, TEST_ERROR /* Test H5Oget_info returns correct metadata size */ - if(H5Oget_info(dset, &oinfo) < 0) + if(H5Oget_info2(dset, &oinfo, H5O_INFO_META_SIZE) < 0) TEST_ERROR if(oinfo.meta_size.obj.index_size != (hsize_t)0) TEST_ERROR diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 94cca58..041ac8d 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -433,7 +433,7 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata) HGOTO_DONE(0); if(h5trav_visit(tinfo->fid, path, TRUE, TRUE, - trav_grp_objs,trav_grp_symlinks, tinfo) < 0) { + trav_grp_objs,trav_grp_symlinks, tinfo, 0) < 0) { parallel_print("Error: Could not get file contents\n"); opts->err_stat = 1; HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Could not get file contents"); @@ -465,7 +465,7 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata) HGOTO_DONE(0); if(h5trav_visit(tinfo->fid, path, TRUE, TRUE, - trav_grp_objs,trav_grp_symlinks, tinfo) < 0) { + trav_grp_objs,trav_grp_symlinks, tinfo, 0) < 0) { parallel_print("Error: Could not get file contents\n"); opts->err_stat = 1; HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Could not get file contents\n"); @@ -645,7 +645,7 @@ h5diff(const char *fname1, /* optional data pass */ info1_obj->opts = (diff_opt_t*)opts; - if(H5Oget_info_by_name(file1_id, obj1fullname, &oinfo1, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name2(file1_id, obj1fullname, &oinfo1, 0, H5P_DEFAULT) < 0) { parallel_print("Error: Could not get file contents\n"); HGOTO_ERROR(1, H5E_tools_min_id_g, "Error: Could not get file contents"); } @@ -695,7 +695,7 @@ h5diff(const char *fname1, /* optional data pass */ info2_obj->opts = (diff_opt_t*)opts; - if(H5Oget_info_by_name(file2_id, obj2fullname, &oinfo2, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name2(file2_id, obj2fullname, &oinfo2, 0, H5P_DEFAULT) < 0) { parallel_print("Error: Could not get file contents\n"); HGOTO_ERROR(1, H5E_tools_min_id_g, "Error: Could not get file contents"); } @@ -846,7 +846,7 @@ h5diff(const char *fname1, info1_grp->opts = (diff_opt_t*)opts; if(h5trav_visit(file1_id, obj1fullname, TRUE, TRUE, - trav_grp_objs, trav_grp_symlinks, info1_grp) < 0) { + trav_grp_objs, trav_grp_symlinks, info1_grp, 0) < 0) { parallel_print("Error: Could not get file contents\n"); HGOTO_ERROR(1, H5E_tools_min_id_g, "Could not get file contents"); } @@ -860,7 +860,7 @@ h5diff(const char *fname1, info2_grp->opts = (diff_opt_t*)opts; if(h5trav_visit(file2_id, obj2fullname, TRUE, TRUE, - trav_grp_objs, trav_grp_symlinks, info2_grp) < 0) { + trav_grp_objs, trav_grp_symlinks, info2_grp, 0) < 0) { parallel_print("Error: Could not get file contents\n"); HGOTO_ERROR(1, H5E_tools_min_id_g, "Could not get file contents"); } /* end if */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 11f5e41..e72f738 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -2096,8 +2096,8 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t if (nfound_b && opts->m_verbose) { H5O_info_t oi1, oi2; - H5Oget_info(obj1_id, &oi1); - H5Oget_info(obj2_id, &oi2); + H5Oget_info2(obj1_id, &oi1, 0); + H5Oget_info2(obj2_id, &oi2, 0); parallel_print("Referenced dataset %lu %lu\n", (unsigned long) oi1.addr, (unsigned long) oi2.addr); parallel_print( "------------------------------------------------------------\n"); diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 7f08cc7..4ad4c90 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -154,9 +154,9 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t h5difftrace("build_match_list_attrs start\n"); - if(H5Oget_info(loc1_id, &oinfo1) < 0) + if(H5Oget_info2(loc1_id, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info first object failed"); - if(H5Oget_info(loc2_id, &oinfo2) < 0) + if(H5Oget_info2(loc2_id, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info second object failed"); table_attrs_init(&table_lp); diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 11888bc..7ba82dd 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1758,14 +1758,14 @@ h5tools_is_obj_same(hid_t loc_id1, const char *name1, hbool_t ret_val = 0; if ( name1 && HDstrcmp(name1, ".")) - H5Oget_info_by_name(loc_id1, name1, &oinfo1, H5P_DEFAULT); + H5Oget_info_by_name2(loc_id1, name1, &oinfo1, 0, H5P_DEFAULT); else - H5Oget_info(loc_id1, &oinfo1); + H5Oget_info2(loc_id1, &oinfo1, 0); if ( name2 && HDstrcmp(name2, ".")) - H5Oget_info_by_name(loc_id2, name2, &oinfo2, H5P_DEFAULT); + H5Oget_info_by_name2(loc_id2, name2, &oinfo2, 0, H5P_DEFAULT); else - H5Oget_info(loc_id2, &oinfo2); + H5Oget_info2(loc_id2, &oinfo2, 0); if (oinfo1.fileno == oinfo2.fileno && oinfo1.addr==oinfo2.addr) ret_val = 1; diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 38ace81..42f9d05 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -1905,7 +1905,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ H5O_info_t oinfo; obj_t *obj = NULL; /* Found object */ - H5Oget_info(type, &oinfo); + H5Oget_info2(type, &oinfo, 0); obj = search_obj(h5dump_type_table, oinfo.addr); if(obj) { diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index d6e5f01..a874c0f 100644 --- a/tools/lib/h5tools_ref.c +++ b/tools/lib/h5tools_ref.c @@ -113,7 +113,7 @@ init_ref_path_table(void) return (-1); /* Iterate over objects in this file */ - if(h5trav_visit(thefile, "/", TRUE, TRUE, init_ref_path_cb, NULL, NULL) < 0) { + if(h5trav_visit(thefile, "/", TRUE, TRUE, init_ref_path_cb, NULL, NULL, 0) < 0) { error_msg("unable to construct reference path table\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ @@ -184,7 +184,7 @@ ref_path_table_lookup(const char *thepath) /* Get the object info now */ /* (returns failure for dangling soft links) */ - if(H5Oget_info_by_name(thefile, thepath, &oi, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(thefile, thepath, &oi, 0, H5P_DEFAULT) < 0) return HADDR_UNDEF; /* Return OID */ diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index a018394..3d029d2 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -1120,7 +1120,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai const char *path; obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, vp); - H5Oget_info(obj, &oi); + H5Oget_info2(obj, &oi, 0); /* Print object type and close object */ switch(oi.type) { diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 5272e81..fad3c5b 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -507,7 +507,7 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen if(H5Tcommitted(type) > 0) { H5O_info_t type_oinfo; - H5Oget_info(type, &type_oinfo); + H5Oget_info2(type, &type_oinfo, 0); if(search_obj(info->type_table, type_oinfo.addr) == NULL) add_obj(info->type_table, type_oinfo.addr, name, FALSE); } /* end if */ @@ -573,7 +573,7 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table, info->dset_table = *dset_table; /* Find all shared objects */ - return(h5trav_visit(fid, "/", TRUE, TRUE, find_objs_cb, NULL, info)); + return(h5trav_visit(fid, "/", TRUE, TRUE, find_objs_cb, NULL, info, 0)); } @@ -729,7 +729,7 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_ } /* get target object info */ - if(H5Oget_info_by_name(file_id, linkpath, &trg_oinfo, lapl) < 0) { + if(H5Oget_info_by_name2(file_id, linkpath, &trg_oinfo, 0, lapl) < 0) { if(link_info->opt.msg_mode == 1) parallel_print("Warning: unable to get object information for <%s>\n", linkpath); HGOTO_DONE(FAIL); diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index b6d32f7..e2df439 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -43,6 +43,7 @@ typedef struct { hbool_t is_absolute; /* Whether the traversal has absolute paths */ const char *base_grp_name; /* Name of the group that serves as the base * for iteration */ + unsigned fields; /* Fields needed in H5O_info_t struct */ } trav_ud_traverse_t; typedef struct { @@ -201,7 +202,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, H5O_info_t oinfo; /* Get information about the object */ - if(H5Oget_info_by_name(loc_id, path, &oinfo, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name2(loc_id, path, &oinfo, udata->fields, H5P_DEFAULT) < 0) { if(new_name) HDfree(new_name); return(H5_ITER_ERROR); @@ -251,13 +252,13 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo, */ static int traverse(hid_t file_id, const char *grp_name, hbool_t visit_start, - hbool_t recurse, const trav_visitor_t *visitor) + hbool_t recurse, const trav_visitor_t *visitor, unsigned fields) { H5O_info_t oinfo; /* Object info for starting group */ int ret_value = SUCCEED; /* Get info for starting object */ - if(H5Oget_info_by_name(file_id, grp_name, &oinfo, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(file_id, grp_name, &oinfo, fields, H5P_DEFAULT) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info_by_name failed"); /* Visit the starting object */ @@ -282,6 +283,7 @@ traverse(hid_t file_id, const char *grp_name, hbool_t visit_start, udata.visitor = visitor; udata.is_absolute = (*grp_name == '/'); udata.base_grp_name = grp_name; + udata.fields = fields; /* Check for iteration of links vs. visiting all links recursively */ if(recurse) { @@ -356,9 +358,9 @@ trav_fileinfo_add(trav_info_t *info, hid_t loc_id) size_t idx = info->nused - 1; if ( info->paths[idx].path && HDstrcmp(info->paths[idx].path, ".")) - H5Oget_info_by_name(loc_id, info->paths[idx].path, &oinfo, H5P_DEFAULT); + H5Oget_info_by_name2(loc_id, info->paths[idx].path, &oinfo, 0, H5P_DEFAULT); else - H5Oget_info(loc_id, &oinfo); + H5Oget_info2(loc_id, &oinfo, 0); info->paths[idx].objno = oinfo.addr; info->paths[idx].fileno = oinfo.fileno; @@ -436,7 +438,7 @@ h5trav_getinfo(hid_t file_id, trav_info_t *info) info_visitor.udata = info; /* Traverse all objects in the file, visiting each object & link */ - if(traverse(file_id, "/", TRUE, TRUE, &info_visitor) < 0) + if(traverse(file_id, "/", TRUE, TRUE, &info_visitor, 0) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); done: @@ -602,7 +604,7 @@ h5trav_gettable(hid_t fid, trav_table_t *table) table_visitor.udata = table; /* Traverse all objects in the file, visiting each object & link */ - if(traverse(fid, "/", TRUE, TRUE, &table_visitor) < 0) + if(traverse(fid, "/", TRUE, TRUE, &table_visitor, 0) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); done: @@ -1027,7 +1029,7 @@ h5trav_print(hid_t fid) print_visitor.udata = &print_udata; /* Traverse all objects in the file, visiting each object & link */ - if(traverse(fid, "/", TRUE, TRUE, &print_visitor) < 0) + if(traverse(fid, "/", TRUE, TRUE, &print_visitor, 0) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); done: @@ -1047,7 +1049,7 @@ done: int h5trav_visit(hid_t fid, const char *grp_name, hbool_t visit_start, hbool_t recurse, h5trav_obj_func_t visit_obj, h5trav_lnk_func_t visit_lnk, - void *udata) + void *udata, unsigned fields) { trav_visitor_t visitor; /* Visitor structure for objects */ int ret_value = SUCCEED; @@ -1058,7 +1060,7 @@ h5trav_visit(hid_t fid, const char *grp_name, hbool_t visit_start, visitor.udata = udata; /* Traverse all objects in the file, visiting each object & link */ - if(traverse(fid, grp_name, visit_start, recurse, &visitor) < 0) + if(traverse(fid, grp_name, visit_start, recurse, &visitor, fields) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); done: diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h index c2ad9b7..a1d33b7 100644 --- a/tools/lib/h5trav.h +++ b/tools/lib/h5trav.h @@ -134,7 +134,7 @@ extern "C" { H5TOOLS_DLL void h5trav_set_index(H5_index_t print_index_by, H5_iter_order_t print_index_order); H5TOOLS_DLL int h5trav_visit(hid_t file_id, const char *grp_name, hbool_t visit_start, hbool_t recurse, h5trav_obj_func_t visit_obj, - h5trav_lnk_func_t visit_lnk, void *udata); + h5trav_lnk_func_t visit_lnk, void *udata, unsigned fields); H5TOOLS_DLL herr_t symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path); H5TOOLS_DLL hbool_t symlink_is_visited(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path); diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index 25e4858..a0d2e6e 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -1,4 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * @@ -1482,7 +1483,7 @@ main(int argc, const char *argv[]) } /* Get object info for root group */ - if(H5Oget_info_by_name(fid, "/", &oi, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name2(fid, "/", &oi, 0, H5P_DEFAULT) < 0) { error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); h5tools_setstatus(EXIT_FAILURE); goto done; diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c index 6646626..d4ce2da 100644 --- a/tools/src/h5dump/h5dump_ddl.c +++ b/tools/src/h5dump/h5dump_ddl.c @@ -229,7 +229,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR H5O_info_t oinfo; /* Stat the object */ - if(H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name2(group, name, &oinfo, 0, H5P_DEFAULT) < 0) { error_msg("unable to get object information for \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; @@ -706,7 +706,7 @@ dump_named_datatype(hid_t tid, const char *name) h5tools_dump_header_format->datatypeblockbegin); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - H5Oget_info(tid, &oinfo); + H5Oget_info2(tid, &oinfo, 0); /* Must check for uniqueness of all objects if we've traversed an elink, * otherwise only check if the reference count > 1. @@ -876,7 +876,7 @@ dump_group(hid_t gid, const char *name) h5tools_dump_comment(rawoutstream, outputformat, &ctx, gid); - H5Oget_info(gid, &oinfo); + H5Oget_info2(gid, &oinfo, 0); /* Must check for uniqueness of all objects if we've traversed an elink, * otherwise only check if the reference count > 1. @@ -1512,7 +1512,7 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H handle_udata.fid = fid; handle_udata.op_name = path_name; - if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata) < 0) { + if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata, 0) < 0) { error_msg("error traversing information\n"); h5tools_setstatus(EXIT_FAILURE); } @@ -1800,7 +1800,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis } /* end if */ - H5Oget_info(dsetid, &oinfo); + H5Oget_info2(dsetid, &oinfo, 0); if(oinfo.rc > 1 || hit_elink) { obj_t *found_obj; /* Found object */ @@ -2101,7 +2101,7 @@ dump_extlink(hid_t group, const char *linkname, const char *objname) goto fail; /* Get object info */ - if (H5Oget_info(oid, &oi) < 0) { + if (H5Oget_info2(oid, &oi, 0) < 0) { H5Oclose(oid); goto fail; } diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index 4e13df3..6c04aef 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -180,7 +180,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ H5O_info_t oinfo; /* Stat the object */ - if(H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name2(group, name, &oinfo, 0, H5P_DEFAULT) < 0) { error_msg("unable to get object information for \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; @@ -881,7 +881,7 @@ xml_print_datatype(hid_t type, unsigned in_group) obj_t *found_obj; /* Found object */ /* detect a shared datatype, output only once */ - H5Oget_info(type, &oinfo); + H5Oget_info2(type, &oinfo, 0); found_obj = search_obj(type_table, oinfo.addr); if(found_obj) { @@ -1534,7 +1534,7 @@ xml_dump_datatype(hid_t type) obj_t *found_obj; /* Found object */ /* Datatype is a shared or named datatype */ - H5Oget_info(type, &oinfo); + H5Oget_info2(type, &oinfo, 0); found_obj = search_obj(type_table, oinfo.addr); if(found_obj) { @@ -2362,7 +2362,7 @@ xml_dump_named_datatype(hid_t type, const char *name) h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* Check uniqueness of named datatype */ - H5Oget_info(type, &oinfo); + H5Oget_info2(type, &oinfo, 0); if(oinfo.rc > 1) { obj_t *found_obj; /* Found object */ @@ -2548,7 +2548,7 @@ xml_dump_group(hid_t gid, const char *name) } } - H5Oget_info(gid, &oinfo); + H5Oget_info2(gid, &oinfo, 0); if(oinfo.rc > 1) { obj_t *found_obj; /* Found object */ diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c index 2bfe280..cb1be4d 100644 --- a/tools/src/h5format_convert/h5format_convert.c +++ b/tools/src/h5format_convert/h5format_convert.c @@ -430,7 +430,7 @@ main(int argc, const char *argv[]) } else { /* Convert all datasets in the file */ if(verbose_g) HDfprintf(stdout, "Processing all datasets in the file...\n"); - if(h5trav_visit(fid, "/", TRUE, TRUE, convert_dsets_cb, NULL, &fid) < 0) + if(h5trav_visit(fid, "/", TRUE, TRUE, convert_dsets_cb, NULL, &fid, 0) < 0) goto done; } /* end else */ diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index a07d308..653438d 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -1320,7 +1320,7 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind) if(H5Tcommitted(type)) { H5O_info_t oi; - if(H5Oget_info(type, &oi) >= 0) + if(H5Oget_info2(type, &oi, 0) >= 0) h5tools_str_append(buffer,"shared-%lu:"H5_PRINTF_HADDR_FMT" ", oi.fileno, oi.addr); else @@ -2386,7 +2386,7 @@ visit_obj(hid_t file, const char *oname, iter_t *iter) h5tools_str_reset(&buffer); /* Retrieve info for object to list */ - if(H5Oget_info_by_name(file, oname, &oi, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name2(file, oname, &oi, H5O_INFO_TIME, H5P_DEFAULT) < 0) { if(iter->symlink_target) { h5tools_str_append(&buffer, "{**NOT FOUND**}\n"); iter->symlink_target = FALSE; @@ -2414,7 +2414,7 @@ visit_obj(hid_t file, const char *oname, iter_t *iter) iter->name_start = iter->base_len; /* Specified name is a group. List the complete contents of the group. */ - h5trav_visit(file, oname, (hbool_t) (display_root_g || iter->symlink_target), recursive_g, list_obj, list_lnk, iter); + h5trav_visit(file, oname, (hbool_t) (display_root_g || iter->symlink_target), recursive_g, list_obj, list_lnk, iter, H5O_INFO_TIME); /* Close group */ if(!iter->symlink_target) diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index e7f4aae..aa2d909 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -222,7 +222,7 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout, H5O_info_t oinfo; /* Object info of input dtype */ hid_t ret_value = -1; /* The identifier of the named dtype in the out file */ - if (H5Oget_info(type_in, &oinfo) < 0) + if (H5Oget_info2(type_in, &oinfo, 0) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed"); if (*named_dt_head_p) { @@ -352,7 +352,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, hbool_t is_ref = 0; H5T_class_t type_class = -1; - if (H5Oget_info(loc_in, &oinfo) < 0) + if (H5Oget_info2(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed"); /*------------------------------------------------------------------------- diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c index 7b610a3..80c98b5 100644 --- a/tools/src/h5repack/h5repack_refs.c +++ b/tools/src/h5repack/h5repack_refs.c @@ -456,7 +456,7 @@ static int copy_refs_attr(hid_t loc_in, int ref_comp_field_n = 0; - if(H5Oget_info(loc_in, &oinfo) < 0) + if(H5Oget_info2(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed"); for(u = 0; u < (unsigned)oinfo.num_attrs; u++) { @@ -807,7 +807,7 @@ MapIdToName(hid_t refobj_id, trav_table_t *travt) H5O_info_t ref_oinfo; /* Stat for the refobj id */ /* obtain information to identify the referenced object uniquely */ - if(H5Oget_info(refobj_id, &ref_oinfo) < 0) + if(H5Oget_info2(refobj_id, &ref_oinfo, 0) < 0) goto out; if(ref_oinfo.addr == travt->objs[u].objno) { diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 6f196b4..da713ac 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -1788,14 +1788,14 @@ main(int argc, const char *argv[]) unsigned u; for(u = 0; u < hand->obj_count; u++) { - if(h5trav_visit(fid, hand->obj[u], TRUE, TRUE, obj_stats, lnk_stats, &iter) < 0) + if(h5trav_visit(fid, hand->obj[u], TRUE, TRUE, obj_stats, lnk_stats, &iter, H5O_INFO_ALL) < 0) warn_msg("Unable to traverse object \"%s\"\n", hand->obj[u]); else print_statistics(hand->obj[u], &iter); } /* end for */ } /* end if */ else { - if(h5trav_visit(fid, "/", TRUE, TRUE, obj_stats, lnk_stats, &iter) < 0) + if(h5trav_visit(fid, "/", TRUE, TRUE, obj_stats, lnk_stats, &iter, H5O_INFO_ALL) < 0) warn_msg("Unable to traverse objects/links in file \"%s\"\n", fname); else print_statistics("/", &iter); -- cgit v0.12 From 09b1106e39edc1d2fa7c92c9c8de57d8c01e4e71 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 30 Apr 2018 07:52:07 -0700 Subject: First stage of moving H5DOread/write_chunk() to src/ and making them H5D calls. * Moved H5DOread/write_chunk() to H5Dio.c and renamed to H5D*. * Moved the hl/test/test_dset_opt test to test/ and renamed to direct_chunk. * Moved the hl/test/dectris_hl_perf test to tools/test/perform and renamed to direct_write_perf. * Updated autotools and CMake files. --- hl/src/H5DO.c | 227 +--- hl/src/H5DOpublic.h | 9 - hl/test/CMakeLists.txt | 1 - hl/test/CMakeTests.cmake | 2 - hl/test/Makefile.am | 5 +- hl/test/dectris_hl_perf.c | 691 ---------- hl/test/test_dset_opt.c | 2171 -------------------------------- src/H5Dio.c | 155 ++- src/H5Dpublic.h | 4 + test/CMakeLists.txt | 1 + test/CMakeTests.cmake | 1 + test/Makefile.am | 13 +- test/direct_chunk.c | 2167 +++++++++++++++++++++++++++++++ tools/test/perform/direct_write_perf.c | 684 ++++++++++ 14 files changed, 3058 insertions(+), 3073 deletions(-) delete mode 100644 hl/test/dectris_hl_perf.c delete mode 100644 hl/test/test_dset_opt.c create mode 100644 test/direct_chunk.c create mode 100644 tools/test/perform/direct_write_perf.c diff --git a/hl/src/H5DO.c b/hl/src/H5DO.c index 99cf2f7..20d5a4a 100644 --- a/hl/src/H5DO.c +++ b/hl/src/H5DO.c @@ -22,163 +22,20 @@ /* public LT prototypes */ #include "H5DOpublic.h" - /*------------------------------------------------------------------------- - * Function: H5DOwrite_chunk - * - * Purpose: Writes an entire chunk to the file directly. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Raymond Lu - * 30 July 2012 + * Function: H5DOappend() * - *------------------------------------------------------------------------- - */ -herr_t -H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, - size_t data_size, const void *buf) -{ - hbool_t created_dxpl = FALSE; /* Whether we created a DXPL */ - hbool_t do_direct_write = TRUE; /* Flag for direct writes */ - uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */ - herr_t ret_value = FAIL; /* Return value */ - - /* Check arguments */ - if(dset_id < 0) - goto done; - if(!buf) - goto done; - if(!offset) - goto done; - if(!data_size) - goto done; - data_size_32 = (uint32_t)data_size; - if(data_size != (size_t)data_size_32) - goto done; - - /* If the user passed in a default DXPL, create one to pass to H5Dwrite() */ - if(H5P_DEFAULT == dxpl_id) { - if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) - goto done; - created_dxpl = TRUE; - } /* end if */ - - /* Set direct write parameters */ - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0) - goto done; - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, &filters) < 0) - goto done; - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, &offset) < 0) - goto done; - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, &data_size_32) < 0) - goto done; - - /* Write chunk */ - if(H5Dwrite(dset_id, 0, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0) - goto done; - - /* Indicate success */ - ret_value = SUCCEED; - -done: - if(created_dxpl) { - if(H5Pclose(dxpl_id) < 0) - ret_value = FAIL; - } /* end if */ - else { - /* Reset the direct write flag on user DXPL */ - do_direct_write = FALSE; - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0) - ret_value = FAIL; - } - - return ret_value; -} /* end H5DOwrite_chunk() */ - - -/*------------------------------------------------------------------------- - * Function: H5DOread_chunk + * Purpose: To append elements to a dataset. * - * Purpose: Reads an entire chunk from the file directly. + * axis: the dataset dimension (zero-based) for the append + * extension: the # of elements to append for the axis-th dimension + * memtype: the datatype + * buf: buffer with data for the append * * Return: Non-negative on success/Negative on failure * - * Programmer: Matthew Strong (GE Healthcare) - * 14 February 2016 - * - *--------------------------------------------------------------------------- - */ -herr_t -H5DOread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, - void *buf) -{ - hbool_t created_dxpl = FALSE; /* Whether we created a DXPL */ - hbool_t do_direct_read = TRUE; /* Flag for direct writes */ - herr_t ret_value = FAIL; /* Return value */ - - /* Check arguments */ - if(dset_id < 0) - goto done; - if(!buf) - goto done; - if(!offset) - goto done; - if(!filters) - goto done; - - /* If the user passed in a default DXPL, create one to pass to H5Dwrite() */ - if(H5P_DEFAULT == dxpl_id) { - if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) - goto done; - created_dxpl = TRUE; - } /* end if */ - - /* Set direct write parameters */ - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, &do_direct_read) < 0) - goto done; - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME, &offset) < 0) - goto done; - - /* Read chunk */ - if(H5Dread(dset_id, 0, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0) - goto done; - /* Get the filter mask */ - if(H5Pget(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME, filters) < 0) - goto done; - - /* Indicate success */ - ret_value = SUCCEED; - -done: - if(created_dxpl) { - if(H5Pclose(dxpl_id) < 0) - ret_value = FAIL; - } /* end if */ - else { - /* Reset the direct read flag on user DXPL */ - do_direct_read = FALSE; - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, &do_direct_read) < 0) - ret_value = FAIL; - } - - return ret_value; -} /* end H5DOread_chunk() */ - - -/*------------------------------------------------------------------------- - * Function: H5DOappend() - * - * Purpose: To append elements to a dataset. - * axis: the dataset dimension (zero-based) for the append - * extension: the # of elements to append for the axis-th dimension - * memtype: the datatype - * buf: buffer with data for the append - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Vailin Choi; Jan 2014 + * Programmer: Vailin Choi; Jan 2014 * * Note: * This routine is copied from the fast forward feature branch: features/hdf5_ff @@ -227,7 +84,7 @@ H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension, /* check arguments */ if(H5I_DATASET != H5Iget_type(dset_id)) - goto done; + goto done; /* If the user passed in a default DXPL, create one to pass to H5Dwrite() */ if(H5P_DEFAULT == dxpl_id) { @@ -236,35 +93,35 @@ H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension, created_dxpl = TRUE; } /* end if */ else if(TRUE != H5Pisa_class(dxpl_id, H5P_DATASET_XFER)) - goto done; + goto done; /* Get the dataspace of the dataset */ if(FAIL == (space_id = H5Dget_space(dset_id))) - goto done; + goto done; /* Get the rank of this dataspace */ if((sndims = H5Sget_simple_extent_ndims(space_id)) < 0) - goto done; + goto done; ndims = (unsigned)sndims; /* Verify correct axis */ if(axis >= ndims) - goto done; + goto done; /* Get the dimensions sizes of the dataspace */ if(H5Sget_simple_extent_dims(space_id, size, NULL) < 0) - goto done; + goto done; /* Adjust the dimension size of the requested dimension, but first record the old dimension size */ old_size = size[axis]; size[axis] += extension; if(size[axis] < old_size) - goto done; + goto done; /* Set the extent of the dataset to the new dimension */ if(H5Dset_extent(dset_id, size) < 0) - goto done; + goto done; /* Get the new dataspace of the dataset */ if(FAIL == (new_space_id = H5Dget_space(dset_id))) @@ -282,51 +139,51 @@ H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension, } /* end if */ } /* end for */ if(FAIL == H5Sselect_hyperslab(new_space_id, H5S_SELECT_SET, start, stride, count, block)) - goto done; + goto done; /* The # of elemnts in the new extended dataspace */ if((snelmts = H5Sget_select_npoints(new_space_id)) < 0) - goto done; + goto done; nelmts = (hsize_t)snelmts; /* create a memory space */ if(FAIL == (mem_space_id = H5Screate_simple(1, &nelmts, NULL))) - goto done; + goto done; /* Write the data */ if(H5Dwrite(dset_id, memtype, mem_space_id, new_space_id, dxpl_id, buf) < 0) - goto done; + goto done; /* Obtain the dataset's access property list */ if((dapl = H5Dget_access_plist(dset_id)) < 0) - goto done; + goto done; /* Allocate the boundary array */ boundary = (hsize_t *)HDmalloc(ndims * sizeof(hsize_t)); /* Retrieve the append flush property */ if(H5Pget_append_flush(dapl, ndims, boundary, &append_cb, &udata) < 0) - goto done; + goto done; /* No boundary for this axis */ if(boundary[axis] != 0) { - /* Determine whether a boundary is hit or not */ - for(k = start[axis]; k < size[axis]; k++) - if(!((k + 1) % boundary[axis])) { - hit = TRUE; - break; - } - - if(hit) { /* Hit the boundary */ - /* Invoke callback if there is one */ - if(append_cb && append_cb(dset_id, size, udata) < 0) - goto done; - - /* Do a dataset flush */ - if(H5Dflush(dset_id) < 0) - goto done; - } /* end if */ + /* Determine whether a boundary is hit or not */ + for(k = start[axis]; k < size[axis]; k++) + if(!((k + 1) % boundary[axis])) { + hit = TRUE; + break; + } + + if(hit) { /* Hit the boundary */ + /* Invoke callback if there is one */ + if(append_cb && append_cb(dset_id, size, udata) < 0) + goto done; + + /* Do a dataset flush */ + if(H5Dflush(dset_id) < 0) + goto done; + } /* end if */ } /* end if */ /* Indicate success */ @@ -341,22 +198,22 @@ done: /* Close old dataspace */ if(space_id != FAIL && H5Sclose(space_id) < 0) - ret_value = FAIL; + ret_value = FAIL; /* Close new dataspace */ if(new_space_id != FAIL && H5Sclose(new_space_id) < 0) - ret_value = FAIL; + ret_value = FAIL; /* Close memory dataspace */ if(mem_space_id != FAIL && H5Sclose(mem_space_id) < 0) - ret_value = FAIL; + ret_value = FAIL; /* Close the dataset access property list */ if(dapl != FAIL && H5Pclose(dapl) < 0) - ret_value = FAIL; + ret_value = FAIL; if(boundary) - HDfree(boundary); + HDfree(boundary); return ret_value; } /* H5DOappend() */ diff --git a/hl/src/H5DOpublic.h b/hl/src/H5DOpublic.h index d5c8de4..7f83a7f 100644 --- a/hl/src/H5DOpublic.h +++ b/hl/src/H5DOpublic.h @@ -25,15 +25,6 @@ extern "C" { *------------------------------------------------------------------------- */ -H5_HLDLL herr_t H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, - const hsize_t *offset, size_t data_size, const void *buf); - -H5_HLDLL herr_t H5DOread_chunk(hid_t dset_id, /*in*/ - hid_t dxpl_id, /*in*/ - const hsize_t *offset, /*in*/ - uint32_t *filters, /*out*/ - void *buf); /*out*/ - H5_HLDLL herr_t H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension, hid_t memtype, const void *buf); diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 6b3c764..8a059a2 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -47,7 +47,6 @@ HL_ADD_EXE (test_image) HL_ADD_EXE (test_file_image) HL_ADD_EXE (test_table) HL_ADD_EXE (test_ds) -HL_ADD_EXE (test_dset_opt) HL_ADD_EXE (test_ld) HL_ADD_EXE (test_dset_append) diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake index e5eb58e..6f57a8c 100644 --- a/hl/test/CMakeTests.cmake +++ b/hl/test/CMakeTests.cmake @@ -90,7 +90,6 @@ add_test ( test_ds8.h5 test_ds9.h5 test_ds10.h5 - test_dectris.h5 test_image1.h5 test_image2.h5 test_image3.h5 @@ -115,7 +114,6 @@ HL_add_test (test_file_image) HL_add_test (test_table) HL_add_test (test_ds) HL_add_test (test_packet) -HL_add_test (test_dset_opt) HL_add_test (test_ld) HL_add_test (test_dset_append) diff --git a/hl/test/Makefile.am b/hl/test/Makefile.am index e16550f..35e680c 100644 --- a/hl/test/Makefile.am +++ b/hl/test/Makefile.am @@ -26,7 +26,7 @@ LDADD=$(LIBH5_HL) $(LIBH5TEST) $(LIBHDF5) # Test programs. These are our main targets. They should be listed in the # order to be executed, generally most specific tests to least specific tests. -TEST_PROG=test_lite test_image test_file_image test_table test_ds test_packet test_dset_opt \ +TEST_PROG=test_lite test_image test_file_image test_table test_ds test_packet \ test_ld test_dset_append check_PROGRAMS=$(TEST_PROG) @@ -45,8 +45,7 @@ endif CHECK_CLEANFILES+=combine_tables[1-2].h5 test_ds[1-9].h5 test_ds10.h5 \ test_image[1-3].h5 file_img[1-2].h5 test_lite[1-4].h5 test_table.h5 \ test_packet_table.h5 test_packet_compress.h5 test_detach.h5 \ - test_packet_table_vlen.h5 testfl_packet_table_vlen.h5 \ - test_dectris.h5 test_append.h5 + test_packet_table_vlen.h5 testfl_packet_table_vlen.h5 test_append.h5 # Sources for test_packet executable test_packet_SOURCES=test_packet.c test_packet_vlen.c diff --git a/hl/test/dectris_hl_perf.c b/hl/test/dectris_hl_perf.c deleted file mode 100644 index 13cfac8..0000000 --- a/hl/test/dectris_hl_perf.c +++ /dev/null @@ -1,691 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * This test is for the DECTRIS project to the H5DOwrite_chunk function - * - */ - -#include "hdf5_hl.h" - -#ifdef H5_HAVE_FILTER_DEFLATE -#include - -#if !defined(WIN32) && !defined(__MINGW32__) - -#include - -#ifdef H5_STDC_HEADERS -# include -# include -# include -# include -#endif - -#ifdef H5_HAVE_UNISTD_H -# include -# include -#endif - -#ifdef H5_HAVE_SYS_STAT_H -# include -#endif - -#if defined(H5_TIME_WITH_SYS_TIME) -# include -# include -#elif defined(H5_HAVE_SYS_TIME_H) -# include -#else -# include -#endif - -const char *FILENAME[] = { - "dectris_perf", - "unix.raw", - NULL -}; - -/* - * Print the current location on the standard output stream. - */ -#define FUNC __func__ -#define AT() printf (" at %s:%d in %s()...\n", \ - __FILE__, __LINE__, FUNC); -#define H5_FAILED() {puts("*FAILED*");fflush(stdout);} -#define TEST_ERROR {H5_FAILED(); AT(); goto error;} -#define TESTING(WHAT) {printf("Testing %-62s",WHAT); fflush(stdout);} -#define PASSED() {puts(" PASSED");fflush(stdout);} - -#define DIRECT_UNCOMPRESSED_DSET "direct_uncompressed_dset" -#define DIRECT_COMPRESSED_DSET "direct_compressed_dset" -#define REG_COMPRESSED_DSET "reg_compressed_dset" -#define REG_NO_COMPRESS_DSET "reg_no_compress_dset" -#define RANK 3 -#define NX 100 -#define NY 1000 -#define NZ 250 -#define CHUNK_NX 1 -#define CHUNK_NY 1000 -#define CHUNK_NZ 250 - -#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12) -char filename[1024]; -unsigned int *outbuf[NX]; -size_t data_size[NX]; -double total_size = 0.0; -unsigned int *direct_buf[NX]; -double MB = 1048576.0; - -/*-------------------------------------------------- - * Function to report IO rate - *-------------------------------------------------- - */ -void reportTime(struct timeval start, double mbytes) -{ - struct timeval timeval_stop,timeval_diff; - - /*end timing*/ - gettimeofday(&timeval_stop,NULL); - - /* Calculate the elapsed gettimeofday time */ - timeval_diff.tv_usec=timeval_stop.tv_usec-start.tv_usec; - timeval_diff.tv_sec=timeval_stop.tv_sec-start.tv_sec; - - if(timeval_diff.tv_usec<0) { - timeval_diff.tv_usec+=1000000; - timeval_diff.tv_sec--; - } /* end if */ - -/*printf("mbytes=%lf, sec=%lf, usec=%lf\n", mbytes, (double)timeval_diff.tv_sec, (double)timeval_diff.tv_usec);*/ - printf("MBytes/second: %lf\n", (double)mbytes/((double)timeval_diff.tv_sec+((double)timeval_diff.tv_usec/(double)1000000.0))); -} - -/*-------------------------------------------------- - * Create file, datasets, and initialize data - *-------------------------------------------------- - */ -int create_file(hid_t fapl_id) -{ - hid_t file; /* handles */ - hid_t fapl; - hid_t cparms; - hid_t dataspace, dataset; - hsize_t dims[RANK] = {NX, NY, NZ}; - hsize_t chunk_dims[RANK] ={CHUNK_NX, CHUNK_NY, CHUNK_NZ}; - unsigned int aggression = 9; /* Compression aggression setting */ - int ret; - int i, j, n; - - int flag; - int unix_file; - - unsigned int *p; - size_t buf_size = CHUNK_NY*CHUNK_NZ*sizeof(unsigned int); - - const Bytef *z_src; - Bytef *z_dst; /*destination buffer */ - uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); - uLong z_src_nbytes = (uLong)buf_size; - - TESTING("Create a file and dataset"); - - /* - * Create the data space with unlimited dimensions. - */ - if((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0) - TEST_ERROR; - - /* - * Create a new file. If file exists its contents will be overwritten. - */ - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) - TEST_ERROR; - - /* - * Modify dataset creation properties, i.e. enable chunking and compression - */ - if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) - TEST_ERROR; - - if(H5Pset_chunk( cparms, RANK, chunk_dims) < 0) - TEST_ERROR; - - /* - * Create a new dataset within the file using cparms - * creation properties. - */ - if((dataset = H5Dcreate2(file, DIRECT_UNCOMPRESSED_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, - cparms, H5P_DEFAULT)) < 0) - TEST_ERROR; - - if(H5Dclose(dataset) < 0) - TEST_ERROR; - - if((dataset = H5Dcreate2(file, REG_NO_COMPRESS_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, - cparms, H5P_DEFAULT)) < 0) - TEST_ERROR; - - if(H5Dclose(dataset) < 0) - TEST_ERROR; - - /* Set compression */ - if(H5Pset_deflate( cparms, aggression) < 0) - TEST_ERROR; - - if((dataset = H5Dcreate2(file, DIRECT_COMPRESSED_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, - cparms, H5P_DEFAULT)) < 0) - TEST_ERROR; - - if(H5Dclose(dataset) < 0) - TEST_ERROR; - - - if((dataset = H5Dcreate2(file, REG_COMPRESSED_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, - cparms, H5P_DEFAULT)) < 0) - TEST_ERROR; - - if(H5Dclose(dataset) < 0) - TEST_ERROR; - - if(H5Fclose(file) < 0) - TEST_ERROR; - - if(H5Sclose(dataspace) < 0) - TEST_ERROR; - - if(H5Pclose(cparms) < 0) - TEST_ERROR; - - /* create a unix file*/ - flag = O_CREAT|O_TRUNC|O_WRONLY; - - if ((unix_file=open(FILENAME[1],flag,S_IRWXU))== -1) - TEST_ERROR; - - if (close(unix_file) < 0) - { - printf(" unable to close the file\n"); - TEST_ERROR; - } - - - /* Initialize data for chunks */ - for(i = 0; i < NX; i++) { - p = direct_buf[i] = (unsigned int*)malloc(CHUNK_NY*CHUNK_NZ*sizeof(unsigned int)); - - for(j=0; j < CHUNK_NY*CHUNK_NZ; j++, p++) - *p = rand() % 65000; - - z_src = (const Bytef*)direct_buf[i]; - - z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); - /* Allocate output (compressed) buffer */ - outbuf[i] = (unsigned int*)malloc((size_t)z_dst_nbytes); - z_dst = (Bytef *)outbuf[i]; - - /* Perform compression from the source to the destination buffer */ - ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression); - - data_size[i] = (size_t)z_dst_nbytes; - total_size += data_size[i]; - - /* Check for various zlib errors */ - if(Z_BUF_ERROR == ret) { - fprintf(stderr, "overflow"); - TEST_ERROR; - } else if(Z_MEM_ERROR == ret) { - fprintf(stderr, "deflate memory error"); - TEST_ERROR; - } else if(Z_OK != ret) { - fprintf(stderr, "other deflate error"); - TEST_ERROR; - } - } - - - PASSED(); - -error: - H5E_BEGIN_TRY { - H5Dclose(dataset); - H5Sclose(dataspace); - H5Pclose(cparms); - H5Fclose(file); - } H5E_END_TRY; - return 1; -} - -/*-------------------------------------------------- - * Benchmark the performance of the new function - * with precompressed data. - *-------------------------------------------------- - */ -int -test_direct_write_uncompressed_data(hid_t fapl_id) -{ - hid_t file; /* handles */ - hid_t dataspace, dataset; - hid_t dxpl; - herr_t status; - int i; - - unsigned filter_mask = 0; - hsize_t offset[RANK] = {0, 0, 0}; - - struct timeval timeval_start; - - TESTING("H5DOwrite_chunk for uncompressed data"); - - if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - TEST_ERROR; - - /* Start the timer */ - gettimeofday(&timeval_start,NULL); - - /* Reopen the file and dataset */ - if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) - TEST_ERROR; - - if((dataset = H5Dopen2(file, DIRECT_UNCOMPRESSED_DSET, H5P_DEFAULT)) < 0) - TEST_ERROR; - - - /* Write the compressed chunk data repeatedly to cover all the chunks in the - * dataset, using the direct writing function. */ - for(i=0; i -#include -#include "h5hltest.h" -#include "H5DOpublic.h" -#include - -#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER) -# define H5_ZLIB_HEADER "zlib.h" -#endif -#if defined(H5_ZLIB_HEADER) -# include H5_ZLIB_HEADER /* "zlib.h" */ -#endif - -#define FILE_NAME "test_dectris.h5" - -/* Datasets for Direct Write tests */ -#define DATASETNAME1 "direct_write" -#define DATASETNAME2 "skip_one_filter" -#define DATASETNAME3 "skip_two_filters" -#define DATASETNAME4 "data_conv" -#define DATASETNAME5 "contiguous_dset" -#define DATASETNAME6 "invalid_argue" -#define DATASETNAME7 "overwrite_chunk" -/* Datasets for Direct Read tests */ -#define DATASETNAME8 "disabled_chunk_cache" -#define DATASETNAME9 "flush_chunk_cache" -#define DATASETNAME10 "read_w_valid_cache" -#define DATASETNAME11 "unallocated_chunk" -#define DATASETNAME12 "unfiltered_data" - -#define RANK 2 -#define NX 16 -#define NY 16 -#define CHUNK_NX 4 -#define CHUNK_NY 4 - -#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s))*H5_DOUBLE(1.001))+H5_DOUBLE(12.0)) - -/* Temporary filter IDs used for testing */ -#define H5Z_FILTER_BOGUS1 305 -#define H5Z_FILTER_BOGUS2 306 -#define ADD_ON 7 -#define FACTOR 3 - -/* Constants for the overwrite test */ -#define OVERWRITE_NDIMS 3 -#define OVERWRITE_CHUNK_NX 3 -#define OVERWRITE_CHUNK_2NX 6 -#define OVERWRITE_CHUNK_NY 2 -#define OVERWRITE_VALUE 42 - -/* Defines used in test_single_chunk_latest() */ -#define FILE "single_latest.h5" -#define DATASET "dataset" -#define DIM0 4 -#define DIM1 32 -#define CHUNK0 DIM0 -#define CHUNK1 DIM1 - -/* Local prototypes for filter functions */ -static size_t filter_bogus1(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); -static size_t filter_bogus2(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); - -/* This message derives from H5Z */ -const H5Z_class2_t H5Z_BOGUS1[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_BOGUS1, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "bogus1", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - filter_bogus1, /* The actual filter function */ -}}; - -const H5Z_class2_t H5Z_BOGUS2[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_BOGUS2, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "bogus2", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - filter_bogus2, /* The actual filter function */ -}}; - -/*------------------------------------------------------------------------- - * Function: test_direct_chunk_write - * - * Purpose: Test the basic functionality of H5DOwrite_chunk - * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: Raymond Lu - * 30 November 2012 - * - *------------------------------------------------------------------------- - */ -#ifdef H5_HAVE_FILTER_DEFLATE -static int -test_direct_chunk_write (hid_t file) -{ - hid_t dataspace = -1, dataset = -1; - hid_t mem_space = -1; - hid_t cparms = -1, dxpl = -1; - hsize_t dims[2] = {NX, NY}; - hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; - hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; - herr_t status; - int ret; - int data[NX][NY]; - int i, j, n; - - unsigned filter_mask = 0; - int direct_buf[CHUNK_NX][CHUNK_NY]; - int check_chunk[CHUNK_NX][CHUNK_NY]; - hsize_t offset[2] = {0, 0}; - size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); - - const Bytef *z_src = (const Bytef*)(direct_buf); - Bytef *z_dst = NULL; /*destination buffer */ - uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); - uLong z_src_nbytes = (uLong)buf_size; - int aggression = 9; /* Compression aggression setting */ - void *outbuf = NULL; /* Pointer to new buffer */ - - hsize_t start[2]; /* Start of hyperslab */ - hsize_t stride[2]; /* Stride of hyperslab */ - hsize_t count[2]; /* Block count */ - hsize_t block[2]; /* Block sizes */ - - TESTING("basic functionality of H5DOwrite_chunk"); - - /* - * Create the data space with unlimited dimensions. - */ - if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) - goto error; - - if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) - goto error; - - /* - * Modify dataset creation properties, i.e. enable chunking and compression - */ - if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto error; - - if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) - goto error; - - if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0) - goto error; - - /* - * Create a new dataset within the file using cparms - * creation properties. - */ - if((dataset = H5Dcreate2(file, DATASETNAME1, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, - cparms, H5P_DEFAULT)) < 0) - goto error; - - /* Initialize the dataset */ - for(i = n = 0; i < NX; i++) - for(j = 0; j < NY; j++) - data[i][j] = n++; - - if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - goto error; - - /* - * Write the data for the dataset. It should stay in the chunk cache. - * It will be evicted from the cache by the H5DOwrite_chunk calls. - */ - if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - dxpl, data)) < 0) - goto error; - - /* Initialize data for one chunk */ - for(i = n = 0; i < CHUNK_NX; i++) - for(j = 0; j < CHUNK_NY; j++) - direct_buf[i][j] = n++; - - /* Allocate output (compressed) buffer */ - outbuf = HDmalloc(z_dst_nbytes); - z_dst = (Bytef *)outbuf; - - /* Perform compression from the source to the destination buffer */ - ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression); - - /* Check for various zlib errors */ - if(Z_BUF_ERROR == ret) { - HDfprintf(stderr, "overflow"); - goto error; - } else if(Z_MEM_ERROR == ret) { - HDfprintf(stderr, "deflate memory error"); - goto error; - } else if(Z_OK != ret) { - HDfprintf(stderr, "other deflate error"); - goto error; - } - - /* Write the compressed chunk data repeatedly to cover all the chunks in the - * dataset, using the direct writing function. */ - for(i=0; i0) { - *int_ptr++ -= (int)ADD_ON; - buf_left -= (ssize_t)sizeof(int); - } /* end while */ - } /* end if */ - else { /* write */ - /* Add the "add on" value to all the data values */ - while(buf_left>0) { - *int_ptr++ += (int)ADD_ON; - buf_left -= (ssize_t)sizeof(int); - } /* end while */ - } /* end else */ - - return nbytes; -} /* filter_bogus1() */ - -/*------------------------------------------------------------------------- - * Function: filter_bogus2 - * - * Purpose: A bogus filter that multiplies the original value by FACTOR. - * - * Return: Success: Data chunk size - * - * Programmer: Raymond Lu - * 30 November 2012 - *------------------------------------------------------------------------- - */ -static size_t -filter_bogus2(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, - const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, - size_t *buf_size, void **buf) -{ - int *int_ptr=(int *)*buf; /* Pointer to the data values */ - ssize_t buf_left=(ssize_t)*buf_size; /* Amount of data buffer left to process */ - - if(flags & H5Z_FLAG_REVERSE) { /* read */ - /* Substract the "add on" value to all the data values */ - while(buf_left>0) { - *int_ptr++ /= (int)FACTOR; - buf_left -= (ssize_t)sizeof(int); - } /* end while */ - } /* end if */ - else { /* write */ - /* Add the "add on" value to all the data values */ - while(buf_left>0) { - *int_ptr++ *= (int)FACTOR; - buf_left -= (ssize_t)sizeof(int); - } /* end while */ - } /* end else */ - - return nbytes; -} /* filter_bogus2() */ - -/*------------------------------------------------------------------------- - * Function: test_skip_compress_write2 - * - * Purpose: Test skipping compression filter when there are three filters - * for the dataset - * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: Raymond Lu - * 30 November 2012 - * - *------------------------------------------------------------------------- - */ -static int -test_skip_compress_write2(hid_t file) -{ - hid_t dataspace = -1, dataset = -1; - hid_t mem_space = -1; - hid_t cparms = -1, dxpl = -1; - hsize_t dims[2] = {NX, NY}; - hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; - hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; - herr_t status; - int i, j, n; - - unsigned filter_mask = 0; /* orig filter mask */ - int origin_direct_buf[CHUNK_NX][CHUNK_NY]; - int direct_buf[CHUNK_NX][CHUNK_NY]; - int check_chunk[CHUNK_NX][CHUNK_NY]; - hsize_t offset[2] = {0, 0}; - size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); - int aggression = 9; /* Compression aggression setting */ - - unsigned read_filter_mask = 0; /* filter mask after direct read */ - int read_direct_buf[CHUNK_NX][CHUNK_NY]; - hsize_t read_buf_size = 0; /* buf size */ - - hsize_t start[2]; /* Start of hyperslab */ - hsize_t stride[2]; /* Stride of hyperslab */ - hsize_t count[2]; /* Block count */ - hsize_t block[2]; /* Block sizes */ - - TESTING("skipping compression filters but keep two other filters"); - - /* - * Create the data space with unlimited dimensions. - */ - if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) - goto error; - - if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) - goto error; - - /* - * Modify dataset creation properties, i.e. enable chunking and compression. - * The order of filters is bogus 1 + deflate + bogus 2. - */ - if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto error; - - if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) - goto error; - - /* Register and enable first bogus filter */ - if(H5Zregister (H5Z_BOGUS1) < 0) - goto error; - - if(H5Pset_filter(cparms, H5Z_FILTER_BOGUS1, 0, (size_t)0, NULL) < 0) - goto error; - - /* Enable compression filter */ - if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0) - goto error; - - /* Register and enable second bogus filter */ - if(H5Zregister (H5Z_BOGUS2) < 0) - goto error; - - if(H5Pset_filter(cparms, H5Z_FILTER_BOGUS2, 0, (size_t)0, NULL) < 0) - goto error; - - /* - * Create a new dataset within the file using cparms - * creation properties. - */ - if((dataset = H5Dcreate2(file, DATASETNAME3, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, - cparms, H5P_DEFAULT)) < 0) - goto error; - - if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - goto error; - - /* Initialize data for one chunk. Apply operations of two bogus filters to the chunk */ - for(i = n = 0; i < CHUNK_NX; i++) - for(j = 0; j < CHUNK_NY; j++) { - origin_direct_buf[i][j] = n++; - direct_buf[i][j] = (origin_direct_buf[i][j] + ADD_ON) * FACTOR; - } - - /* write the uncompressed chunk data repeatedly to dataset, using the direct writing function. - * Indicate skipping the compression filter but keep the other two bogus filters */ - offset[0] = CHUNK_NX; - offset[1] = CHUNK_NY; - - /* compression filter is the middle one to be skipped */ - filter_mask = 0x00000002; - - if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0) - goto error; - - if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0) - goto error; - - if(H5Dclose(dataset) < 0) - goto error; - - if((dataset = H5Dopen2(file, DATASETNAME3, H5P_DEFAULT)) < 0) - goto error; - - /* - * Select hyperslab for one chunk in the file - */ - start[0] = CHUNK_NX; start[1] = CHUNK_NY; - stride[0] = 1; stride[1] = 1; - count[0] = 1; count[1] = 1; - block[0] = CHUNK_NX; block[1] = CHUNK_NY; - if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0) - goto error; - - /* Read the chunk back */ - if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0) - goto error; - - /* Check that the values read are the same as the values written */ - for(i = 0; i < CHUNK_NX; i++) { - for(j = 0; j < CHUNK_NY; j++) { - if(origin_direct_buf[i][j] != check_chunk[i][j]) { - HDprintf(" 1. Read different values than written."); - HDprintf(" At index %d,%d\n", i, j); - HDprintf(" origin_direct_buf=%d, check_chunk=%d\n", origin_direct_buf[i][j], check_chunk[i][j]); - goto error; - } - } - } - - /* Query chunk storage size */ - if((status = H5Dget_chunk_storage_size(dataset, offset, &read_buf_size)) < 0) - goto error; - if(read_buf_size != buf_size) - goto error; - - /* Read the raw chunk back */ - HDmemset(&read_direct_buf, 0, sizeof(read_direct_buf)); - if((status = H5DOread_chunk(dataset, H5P_DEFAULT, offset, &read_filter_mask, read_direct_buf)) < 0) - goto error; - if(read_filter_mask != filter_mask) - goto error; - - /* Check that the direct chunk read is the same as the chunk written */ - for(i = 0; i < CHUNK_NX; i++) { - for(j = 0; j < CHUNK_NY; j++) { - if(direct_buf[i][j] != read_direct_buf[i][j]) { - HDprintf(" 1. Read different values than written."); - HDprintf(" At index %d,%d\n", i, j); - HDprintf(" direct_buf=%d, read_direct_buf=%d\n", direct_buf[i][j], read_direct_buf[i][j]); - goto error; - } - } - } - - /* - * Close/release resources. - */ - H5Dclose(dataset); - H5Sclose(mem_space); - H5Sclose(dataspace); - H5Pclose(cparms); - H5Pclose(dxpl); - - PASSED(); - return 0; - -error: - H5E_BEGIN_TRY { - H5Dclose(dataset); - H5Sclose(mem_space); - H5Sclose(dataspace); - H5Pclose(cparms); - H5Pclose(dxpl); - } H5E_END_TRY; - - H5_FAILED(); - return 1; -} /* test_skip_compress_write2() */ - -/*------------------------------------------------------------------------- - * Function: test_data_conv - * - * Purpose: Test data conversion - * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: Raymond Lu - * 30 November 2012 - * - *------------------------------------------------------------------------- - */ -static int -test_data_conv(hid_t file) -{ - typedef struct { - int a, b, c[4], d, e; - } src_type_t; - typedef struct { - int a, c[4], e; - } dst_type_t; - - hid_t dataspace = -1, dataset = -1; - hid_t mem_space = -1; - hid_t cparms = -1, dxpl = -1; - hsize_t dims[2] = {NX, NY}; - hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; - hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; - herr_t status; - int i, j, n; - const hsize_t four = 4; - hid_t st=-1, dt=-1; - hid_t array_dt; - - unsigned filter_mask = 0; - src_type_t direct_buf[CHUNK_NX][CHUNK_NY]; - dst_type_t check_chunk[CHUNK_NX][CHUNK_NY]; - src_type_t read_chunk[CHUNK_NX][CHUNK_NY]; /* For H5DOread_chunk */ - - hsize_t offset[2] = {0, 0}; - size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(src_type_t); - - hsize_t start[2]; /* Start of hyperslab */ - hsize_t stride[2]; /* Stride of hyperslab */ - hsize_t count[2]; /* Block count */ - hsize_t block[2]; /* Block sizes */ - - TESTING("data conversion for H5DOwrite_chunk/H5DOread_chunk"); - - /* - * Create the data space with unlimited dimensions. - */ - if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) - goto error; - - if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) - goto error; - - /* - * Modify dataset creation properties, i.e. enable chunking - */ - if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto error; - - if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) - goto error; - - /* Build hdf5 datatypes */ - array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); - if((st = H5Tcreate(H5T_COMPOUND, sizeof(src_type_t))) < 0 || - H5Tinsert(st, "a", HOFFSET(src_type_t, a), H5T_NATIVE_INT) < 0 || - H5Tinsert(st, "b", HOFFSET(src_type_t, b), H5T_NATIVE_INT) < 0 || - H5Tinsert(st, "c", HOFFSET(src_type_t, c), array_dt) < 0 || - H5Tinsert(st, "d", HOFFSET(src_type_t, d), H5T_NATIVE_INT) < 0 || - H5Tinsert(st, "e", HOFFSET(src_type_t, e), H5T_NATIVE_INT) < 0) - goto error; - - if(H5Tclose(array_dt) < 0) - goto error; - - array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); - if((dt = H5Tcreate(H5T_COMPOUND, sizeof(dst_type_t))) < 0 || - H5Tinsert(dt, "a", HOFFSET(dst_type_t, a), H5T_NATIVE_INT) < 0 || - H5Tinsert(dt, "c", HOFFSET(dst_type_t, c), array_dt) < 0 || - H5Tinsert(dt, "e", HOFFSET(dst_type_t, e), H5T_NATIVE_INT) < 0) - goto error; - - if(H5Tclose(array_dt) < 0) - goto error; - - /* - * Create a new dataset within the file using cparms - * creation properties. - */ - if((dataset = H5Dcreate2(file, DATASETNAME4, st, dataspace, H5P_DEFAULT, - cparms, H5P_DEFAULT)) < 0) - goto error; - - if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - goto error; - - /* Initialize data for one chunk */ - for(i = n = 0; i < CHUNK_NX; i++) { - for(j = 0; j < CHUNK_NY; j++) { - (direct_buf[i][j]).a = i*j+0; - (direct_buf[i][j]).b = i*j+1; - (direct_buf[i][j]).c[0] = i*j+2; - (direct_buf[i][j]).c[1] = i*j+3; - (direct_buf[i][j]).c[2] = i*j+4; - (direct_buf[i][j]).c[3] = i*j+5; - (direct_buf[i][j]).d = i*j+6; - (direct_buf[i][j]).e = i*j+7; - } - } - - /* write the chunk data to dataset, using the direct writing function. - * There should be no data conversion involved. */ - offset[0] = CHUNK_NX; - offset[1] = CHUNK_NY; - - if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0) - goto error; - - if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0) - goto error; - - if(H5Dclose(dataset) < 0) - goto error; - - if((dataset = H5Dopen2(file, DATASETNAME4, H5P_DEFAULT)) < 0) - goto error; - - /* Use H5DOread_chunk() to read the uncompressed data */ - if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, read_chunk)) < 0) - goto error; - - /* Check that the values read are the same as the values written */ - for(i = 0; i < CHUNK_NX; i++) { - for(j = 0; j < CHUNK_NY; j++) { - if ((direct_buf[i][j]).a != (read_chunk[i][j]).a || - (direct_buf[i][j]).b != (read_chunk[i][j]).b || - (direct_buf[i][j]).c[0] != (read_chunk[i][j]).c[0] || - (direct_buf[i][j]).c[1] != (read_chunk[i][j]).c[1] || - (direct_buf[i][j]).c[2] != (read_chunk[i][j]).c[2] || - (direct_buf[i][j]).c[3] != (read_chunk[i][j]).c[3] || - (direct_buf[i][j]).d != (read_chunk[i][j]).d || - (direct_buf[i][j]).e != (read_chunk[i][j]).e) { - HDprintf(" 1. Read different values than written."); - HDprintf(" At index %d,%d\n", i, j); - HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", - (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1], - (direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d, (direct_buf[i][j]).e); - HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", - (read_chunk[i][j]).a, (read_chunk[i][j]).b, (read_chunk[i][j]).c[0], (read_chunk[i][j]).c[1], - (read_chunk[i][j]).c[2], (read_chunk[i][j]).c[3], (read_chunk[i][j]).d, (read_chunk[i][j]).e); - - goto error; - } - } - } - - /* - * Select hyperslab for the chunk just written in the file - */ - start[0] = CHUNK_NX; start[1] = CHUNK_NY; - stride[0] = 1; stride[1] = 1; - count[0] = 1; count[1] = 1; - block[0] = CHUNK_NX; block[1] = CHUNK_NY; - if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0) - goto error; - - /* Read the chunk back. Data should be converted */ - if((status = H5Dread(dataset, dt, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0) - goto error; - - /* Check that the values read are the same as the values written */ - for(i = 0; i < CHUNK_NX; i++) { - for(j = 0; j < CHUNK_NY; j++) { - if ((direct_buf[i][j]).a != (check_chunk[i][j]).a || - (direct_buf[i][j]).c[0] != (check_chunk[i][j]).c[0] || - (direct_buf[i][j]).c[1] != (check_chunk[i][j]).c[1] || - (direct_buf[i][j]).c[2] != (check_chunk[i][j]).c[2] || - (direct_buf[i][j]).c[3] != (check_chunk[i][j]).c[3] || - (direct_buf[i][j]).e != (check_chunk[i][j]).e) { - HDprintf(" 1. Read different values than written."); - HDprintf(" At index %d,%d\n", i, j); - HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", - (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1], - (direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d, (direct_buf[i][j]).e); - HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n", - (check_chunk[i][j]).a, (check_chunk[i][j]).c[0], (check_chunk[i][j]).c[1], (check_chunk[i][j]).c[2], - (check_chunk[i][j]).c[3], (check_chunk[i][j]).e); - - goto error; - } - } - } - - /* - * Close/release resources. - */ - H5Dclose(dataset); - H5Sclose(mem_space); - H5Sclose(dataspace); - H5Pclose(cparms); - H5Pclose(dxpl); - H5Tclose(st); - H5Tclose(dt); - - PASSED(); - return 0; - -error: - H5E_BEGIN_TRY { - H5Dclose(dataset); - H5Sclose(mem_space); - H5Sclose(dataspace); - H5Pclose(cparms); - H5Pclose(dxpl); - H5Tclose(st); - H5Tclose(dt); - } H5E_END_TRY; - - H5_FAILED(); - return 1; -} /* test_data_conv() */ - -/*------------------------------------------------------------------------- - * Function: test_invalid_parameters - * - * Purpose: Test invalid parameters for H5DOwrite_chunk and H5DOread_chunk - * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: Raymond Lu - * 30 November 2012 - * - *------------------------------------------------------------------------- - */ -static int -test_invalid_parameters(hid_t file) -{ - hid_t dataspace = -1, dataset = -1; - hid_t mem_space = -1; - hid_t cparms = -1, dxpl = -1; - hsize_t dims[2] = {NX, NY}; - hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; - herr_t status; - int i, j, n; - - unsigned filter_mask = 0; - int direct_buf[CHUNK_NX][CHUNK_NY]; - hsize_t offset[2] = {0, 0}; - size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); - int aggression = 9; /* Compression aggression setting */ - - hsize_t chunk_nbytes; /* Chunk size */ - - TESTING("invalid parameters for H5DOwrite_chunk/H5DOread_chunk"); - - /* - * Create the data space with unlimited dimensions. - */ - if((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0) - goto error; - - if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) - goto error; - - /* - * Modify dataset creation properties - */ - if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto error; - - /* - * Create a new contiguous dataset to verify H5DOwrite_chunk/H5DOread_chunk doesn't work - */ - if((dataset = H5Dcreate2(file, DATASETNAME5, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, - cparms, H5P_DEFAULT)) < 0) - goto error; - - if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - goto error; - - /* Initialize data for one chunk */ - for(i = n = 0; i < CHUNK_NX; i++) - for(j = 0; j < CHUNK_NY; j++) { - direct_buf[i][j] = n++; - } - - /* Try to write the chunk data to contiguous dataset. It should fail */ - offset[0] = CHUNK_NX; - offset[1] = CHUNK_NY; - - H5E_BEGIN_TRY { - if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - /* Try to get chunk size for a contiguous dataset. It should fail */ - H5E_BEGIN_TRY { - if((status = H5Dget_chunk_storage_size(dataset, offset, &chunk_nbytes)) != FAIL) - goto error; - } H5E_END_TRY; - - /* Try to H5DOread_chunk from the contiguous dataset. It should fail */ - H5E_BEGIN_TRY { - if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - if(H5Dclose(dataset) < 0) - goto error; - - - /* Create a chunked dataset with compression filter */ - if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) - goto error; - - if((status = H5Pset_deflate( cparms, (unsigned ) aggression)) < 0) - goto error; - - /* - * Create a new dataset within the file using cparms - * creation properties. - */ - if((dataset = H5Dcreate2(file, DATASETNAME6, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, - cparms, H5P_DEFAULT)) < 0) - goto error; - - /* Check invalid dataset ID for H5DOwrite_chunk and H5DOread_chunk */ - H5E_BEGIN_TRY { - if((status = H5DOwrite_chunk((hid_t)-1, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - H5E_BEGIN_TRY { - if((status = H5DOread_chunk((hid_t)-1, dxpl, offset, &filter_mask, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - /* Check invalid DXPL ID for H5DOwrite_chunk and H5DOread_chunk */ - H5E_BEGIN_TRY { - if((status = H5DOwrite_chunk(dataset, (hid_t)-1, filter_mask, offset, buf_size, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - H5E_BEGIN_TRY { - if((status = H5DOread_chunk(dataset, (hid_t)-1, offset, &filter_mask, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - /* Check invalid OFFSET for H5DOwrite_chunk and H5DOread_chunk */ - H5E_BEGIN_TRY { - if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, NULL, buf_size, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - H5E_BEGIN_TRY { - if((status = H5DOread_chunk(dataset, dxpl, NULL, &filter_mask, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - /* Check when OFFSET is out of dataset range for H5DOwrite_chunk and H5DOread_chunk */ - offset[0] = NX + 1; - offset[1] = NY; - H5E_BEGIN_TRY { - if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - H5E_BEGIN_TRY { - if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - /* Check when OFFSET is not on chunk boundary for H5DOwrite_chunk and H5DOread_chunk */ - offset[0] = CHUNK_NX; - offset[1] = CHUNK_NY + 1; - H5E_BEGIN_TRY { - if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - H5E_BEGIN_TRY { - if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - /* Check invalid buffer size for H5DOwrite_chunk only */ - offset[0] = CHUNK_NX; - offset[1] = CHUNK_NY; - buf_size = 0; - H5E_BEGIN_TRY { - if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - /* Check invalid data buffer for H5DOwrite_chunk and H5DOread_chunk */ - buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); - H5E_BEGIN_TRY { - if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, NULL)) != FAIL) - goto error; - } H5E_END_TRY; - - H5E_BEGIN_TRY { - if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, NULL)) != FAIL) - goto error; - } H5E_END_TRY; - - if(H5Dclose(dataset) < 0) - goto error; - - /* - * Close/release resources. - */ - H5Sclose(mem_space); - H5Sclose(dataspace); - H5Pclose(cparms); - H5Pclose(dxpl); - - PASSED(); - return 0; - -error: - H5E_BEGIN_TRY { - H5Dclose(dataset); - H5Sclose(mem_space); - H5Sclose(dataspace); - H5Pclose(cparms); - H5Pclose(dxpl); - } H5E_END_TRY; - - H5_FAILED(); - return 1; -} /* test_invalid_parameters() */ - -/*------------------------------------------------------------------------- - * Function: test_direct_chunk_read_no_cache - * - * Purpose: Test the basic functionality of H5DOread_chunk with the - * chunk cache diabled. - * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: Matthew Strong (GE Healthcare) - * 14 February 2016 - * - *------------------------------------------------------------------------- - */ -#ifdef H5_HAVE_FILTER_DEFLATE -static int -test_direct_chunk_read_no_cache (hid_t file) -{ - hid_t dataspace = -1, dataset = -1; - hid_t mem_space = -1; - hid_t cparms = -1, dxpl = -1, dapl = -1; - hsize_t dims[2] = {NX, NY}; - hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; - hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; - herr_t status; /* status from H5 function calls */ - int ret; /* deflate return status */ - int data[NX][NY]; - int i, j, k, l, n; /* local index variables */ - - unsigned filter_mask = 0; /* filter mask returned from H5DOread_chunk */ - int direct_buf[CHUNK_NX][CHUNK_NY]; /* chunk read with H5DOread and manually decompressed */ - int check_chunk[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread */ - hsize_t offset[2]; /* chunk offset used for H5DOread_chunk */ - size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); - - Bytef *z_src = NULL; /* source buffer */ - uLongf z_src_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); - Bytef *z_dst = (Bytef*)(direct_buf); - uLong z_dst_nbytes = (uLong)buf_size; - int aggression = 9; /* Compression aggression setting */ - void *outbuf = NULL; /* Pointer to new buffer */ - - hsize_t start[2]; /* Start of hyperslab */ - hsize_t stride[2]; /* Stride of hyperslab */ - hsize_t count[2]; /* Block count */ - hsize_t block[2]; /* Block sizes */ - - TESTING("basic functionality of H5DOread_chunk (chunk cache disabled)"); - - /* Create the data space with unlimited dimensions. */ - if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) - goto error; - if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) - goto error; - - /* Modify dataset creation properties, i.e. enable chunking and compression */ - if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto error; - if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) - goto error; - if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0) - goto error; - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - goto error; - - /* Disable chunk cache by setting number of slots to 0 */ - if((status = H5Pset_chunk_cache(dapl, 0, H5D_CHUNK_CACHE_NBYTES_DEFAULT, H5D_CHUNK_CACHE_W0_DEFAULT)) < 0) - goto error; - - /* Create a new dataset within the file using cparms creation properties. */ - if((dataset = H5Dcreate2(file, DATASETNAME8, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, - cparms, dapl)) < 0) - goto error; - - /* Initialize the dataset */ - for(i = n = 0; i < NX; i++) - for(j = 0; j < NY; j++) - data[i][j] = n++; - - if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - goto error; - - /* Write the data for the dataset. - * Data will skip chunk cache and go directly to disk. */ - if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - dxpl, data)) < 0) - goto error; - - /* Allocate output (compressed) buffer */ - outbuf = HDmalloc(z_src_nbytes); - z_src = (Bytef *)outbuf; - - /* For each chunk in the dataset, compare the result of H5Dread and H5DOread_chunk. */ - for(i=0; ioloc.file) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") - - if(mem_space_id < 0 || file_space_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") + if(mem_space_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid mem_space_id") + if(file_space_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file_space_id") if(H5S_ALL != mem_space_id) { if(NULL == (mem_space = (const H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE))) @@ -215,6 +216,76 @@ done: /*------------------------------------------------------------------------- + * Function: H5Dread_chunk + * + * Purpose: Reads an entire chunk from the file directly. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Matthew Strong (GE Healthcare) + * 14 February 2016 + * + *--------------------------------------------------------------------------- + */ +herr_t +H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, + void *buf) +{ + hbool_t created_dxpl = FALSE; /* Whether we created a DXPL */ + hbool_t do_direct_read = TRUE; /* Flag for direct writes */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "ii*h*Iu*x", dset_id, dxpl_id, offset, filters, buf); + + /* Check arguments */ + if(dset_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset ID") + if(!buf) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL") + if(!offset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset cannot be NULL") + if(!filters) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filters cannot be NULL") + + /* If the user passed in a default DXPL, create one to pass to H5Dwrite() */ + if(H5P_DEFAULT == dxpl_id) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "cannot create dxpl") + created_dxpl = TRUE; + } /* end if */ + + /* Set direct write parameters */ + if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, &do_direct_read) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot set direct read property") + if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME, &offset) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot set offset property") + + /* Read chunk */ + if(H5Dread(dset_id, 0, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "cannot read from dataset") + + /* Get the filter mask */ + if(H5Pget(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME, filters) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "cannot get filter mask property") + +done: + if(created_dxpl) { + if(H5Pclose(dxpl_id) < 0) + HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close dxpl") + } /* end if */ + else { + /* Reset the direct read flag on user DXPL */ + do_direct_read = FALSE; + if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, &do_direct_read) < 0) + HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot reset direct write property") + } + + FUNC_LEAVE_API(ret_value) +} /* end H5Dread_chunk() */ + + +/*------------------------------------------------------------------------- * Function: H5Dwrite * * Purpose: Writes (part of) a DSET from application memory BUF to the @@ -311,6 +382,80 @@ done: /*------------------------------------------------------------------------- + * Function: H5Dwrite_chunk + * + * Purpose: Writes an entire chunk to the file directly. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Raymond Lu + * 30 July 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, + size_t data_size, const void *buf) +{ + hbool_t created_dxpl = FALSE; /* Whether we created a DXPL */ + hbool_t do_direct_write = TRUE; /* Flag for direct writes */ + uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "iiIu*hz*x", dset_id, dxpl_id, filters, offset, data_size, buf); + + /* Check arguments */ + if(dset_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset ID") + if(!buf) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL") + if(!offset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset cannot be NULL") + if(!data_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "data_size cannot be NULL") + data_size_32 = (uint32_t)data_size; + if(data_size != (size_t)data_size_32) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid data_size") + + /* If the user passed in a default DXPL, create one to pass to H5Dwrite() */ + if(H5P_DEFAULT == dxpl_id) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "cannot create dxpl") + created_dxpl = TRUE; + } /* end if */ + + /* Set direct write parameters */ + if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot set direct read property") + if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, &filters) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot set filters property") + if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, &offset) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot set offset property") + if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, &data_size_32) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot set data size property") + + /* Write chunk */ + if(H5Dwrite(dset_id, 0, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "cannot write to dataset") + +done: + if(created_dxpl) { + if(H5Pclose(dxpl_id) < 0) + HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close dxpl") + } /* end if */ + else { + /* Reset the direct write flag on user DXPL */ + do_direct_write = FALSE; + if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0) + HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot reset direct write property") + } + + FUNC_LEAVE_API(ret_value) +} /* end H5Dwrite_chunk() */ + + +/*------------------------------------------------------------------------- * Function: H5D__pre_write * * Purpose: Preparation for writing data. diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index 790674a..be80cef 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -157,6 +157,10 @@ H5_DLL herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf/*out*/); H5_DLL herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf); +H5_DLL herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, + const hsize_t *offset, size_t data_size, const void *buf); +H5_DLL herr_t H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, + const hsize_t *offset, uint32_t *filters, void *buf); H5_DLL herr_t H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op, void *operator_data); H5_DLL herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ec560f2..0d93211 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -214,6 +214,7 @@ set (H5_TESTS cmpd_dset filter_fail extend + direct_chunk external efc objcopy diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 04cc41f..6f914ba 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -532,6 +532,7 @@ set (test_CLEANFILES vds_swmr.h5 vds_swmr_src_*.h5 tmp/vds_src_2.h5 + direct_chunk.h5 ) # Remove any output file left over from previous test run diff --git a/test/Makefile.am b/test/Makefile.am index ab81f50..8f671ac 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -55,11 +55,12 @@ TEST_PROG= testhdf5 \ cache cache_api cache_image cache_tagging lheap ohdr stab gheap \ evict_on_close farray earray btree2 fheap \ pool accum hyperslab istore bittests dt_arith page_buffer \ - dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \ - twriteorder big mtime fillval mount flush1 flush2 app_ref enum \ - set_extent ttsafe enc_dec_plist enc_dec_plist_cross_platform\ - getname vfd ntypes dangle dtransform reserved cross_read \ - freespace mf vds file_image unregister cache_logging cork swmr + dtypes dsets cmpd_dset filter_fail extend direct_chunk external efc \ + objcopy links unlink twriteorder big mtime fillval mount \ + flush1 flush2 app_ref enum set_extent ttsafe enc_dec_plist \ + enc_dec_plist_cross_platform getname vfd ntypes dangle dtransform \ + reserved cross_read freespace mf vds file_image unregister \ + cache_logging cork swmr # List programs to be built when testing here. # error_test and err_compat are built at the same time as the other tests, but executed by testerror.sh. @@ -190,7 +191,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse flushrefresh_VERIFICATION_DONE atomic_data accum_swmr_big.h5 ohdr_swmr.h5 \ test_swmr*.h5 cache_logging.h5 cache_logging.out vds_swmr.h5 vds_swmr_src_*.h5 \ swmr[0-2].h5 swmr_writer.out swmr_writer.log.* swmr_reader.out.* swmr_reader.log.* \ - tbogus.h5.copy cache_image_test.h5 + tbogus.h5.copy cache_image_test.h5 direct_chunk.h5 # Sources for testhdf5 executable testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ diff --git a/test/direct_chunk.c b/test/direct_chunk.c new file mode 100644 index 0000000..2ef38ea --- /dev/null +++ b/test/direct_chunk.c @@ -0,0 +1,2167 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* Copyright by The HDF Group. * +* Copyright by the Board of Trustees of the University of Illinois. * +* All rights reserved. * +* * +* This file is part of HDF5. The full HDF5 copyright notice, including * +* terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "h5test.h" + +#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER) +# define H5_ZLIB_HEADER "zlib.h" +#endif +#if defined(H5_ZLIB_HEADER) +# include H5_ZLIB_HEADER /* "zlib.h" */ +#endif + +#define FILE_NAME "direct_chunk.h5" + +/* Datasets for Direct Write tests */ +#define DATASETNAME1 "direct_write" +#define DATASETNAME2 "skip_one_filter" +#define DATASETNAME3 "skip_two_filters" +#define DATASETNAME4 "data_conv" +#define DATASETNAME5 "contiguous_dset" +#define DATASETNAME6 "invalid_argue" +#define DATASETNAME7 "overwrite_chunk" +/* Datasets for Direct Read tests */ +#define DATASETNAME8 "disabled_chunk_cache" +#define DATASETNAME9 "flush_chunk_cache" +#define DATASETNAME10 "read_w_valid_cache" +#define DATASETNAME11 "unallocated_chunk" +#define DATASETNAME12 "unfiltered_data" + +#define RANK 2 +#define NX 16 +#define NY 16 +#define CHUNK_NX 4 +#define CHUNK_NY 4 + +#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s))*H5_DOUBLE(1.001))+H5_DOUBLE(12.0)) + +/* Temporary filter IDs used for testing */ +#define H5Z_FILTER_BOGUS1 305 +#define H5Z_FILTER_BOGUS2 306 +#define ADD_ON 7 +#define FACTOR 3 + +/* Constants for the overwrite test */ +#define OVERWRITE_NDIMS 3 +#define OVERWRITE_CHUNK_NX 3 +#define OVERWRITE_CHUNK_2NX 6 +#define OVERWRITE_CHUNK_NY 2 +#define OVERWRITE_VALUE 42 + +/* Defines used in test_single_chunk_latest() */ +#define FILE "single_latest.h5" +#define DATASET "dataset" +#define DIM0 4 +#define DIM1 32 +#define CHUNK0 DIM0 +#define CHUNK1 DIM1 + +/* Local prototypes for filter functions */ +static size_t filter_bogus1(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); +static size_t filter_bogus2(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + +/* This message derives from H5Z */ +const H5Z_class2_t H5Z_BOGUS1[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_BOGUS1, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "bogus1", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + filter_bogus1, /* The actual filter function */ +}}; + +const H5Z_class2_t H5Z_BOGUS2[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_BOGUS2, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "bogus2", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + filter_bogus2, /* The actual filter function */ +}}; + +/*------------------------------------------------------------------------- + * Function: test_direct_chunk_write + * + * Purpose: Test the basic functionality of H5Dwrite_chunk + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Raymond Lu + * 30 November 2012 + * + *------------------------------------------------------------------------- + */ +#ifdef H5_HAVE_FILTER_DEFLATE +static int +test_direct_chunk_write (hid_t file) +{ + hid_t dataspace = -1, dataset = -1; + hid_t mem_space = -1; + hid_t cparms = -1, dxpl = -1; + hsize_t dims[2] = {NX, NY}; + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; + herr_t status; + int ret; + int data[NX][NY]; + int i, j, n; + + unsigned filter_mask = 0; + int direct_buf[CHUNK_NX][CHUNK_NY]; + int check_chunk[CHUNK_NX][CHUNK_NY]; + hsize_t offset[2] = {0, 0}; + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); + + const Bytef *z_src = (const Bytef*)(direct_buf); + Bytef *z_dst = NULL; /*destination buffer */ + uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); + uLong z_src_nbytes = (uLong)buf_size; + int aggression = 9; /* Compression aggression setting */ + void *outbuf = NULL; /* Pointer to new buffer */ + + hsize_t start[2]; /* Start of hyperslab */ + hsize_t stride[2]; /* Stride of hyperslab */ + hsize_t count[2]; /* Block count */ + hsize_t block[2]; /* Block sizes */ + + TESTING("basic functionality of H5Dwrite_chunk"); + + /* + * Create the data space with unlimited dimensions. + */ + if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + goto error; + + if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) + goto error; + + /* + * Modify dataset creation properties, i.e. enable chunking and compression + */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) + goto error; + + if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0) + goto error; + + /* + * Create a new dataset within the file using cparms + * creation properties. + */ + if((dataset = H5Dcreate2(file, DATASETNAME1, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + goto error; + + /* Initialize the dataset */ + for(i = n = 0; i < NX; i++) + for(j = 0; j < NY; j++) + data[i][j] = n++; + + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + + /* + * Write the data for the dataset. It should stay in the chunk cache. + * It will be evicted from the cache by the H5Dwrite_chunk calls. + */ + if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + dxpl, data)) < 0) + goto error; + + /* Initialize data for one chunk */ + for(i = n = 0; i < CHUNK_NX; i++) + for(j = 0; j < CHUNK_NY; j++) + direct_buf[i][j] = n++; + + /* Allocate output (compressed) buffer */ + outbuf = HDmalloc(z_dst_nbytes); + z_dst = (Bytef *)outbuf; + + /* Perform compression from the source to the destination buffer */ + ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression); + + /* Check for various zlib errors */ + if(Z_BUF_ERROR == ret) { + HDfprintf(stderr, "overflow"); + goto error; + } else if(Z_MEM_ERROR == ret) { + HDfprintf(stderr, "deflate memory error"); + goto error; + } else if(Z_OK != ret) { + HDfprintf(stderr, "other deflate error"); + goto error; + } + + /* Write the compressed chunk data repeatedly to cover all the chunks in the + * dataset, using the direct writing function. */ + for(i=0; i0) { + *int_ptr++ -= (int)ADD_ON; + buf_left -= (ssize_t)sizeof(int); + } /* end while */ + } /* end if */ + else { /* write */ + /* Add the "add on" value to all the data values */ + while(buf_left>0) { + *int_ptr++ += (int)ADD_ON; + buf_left -= (ssize_t)sizeof(int); + } /* end while */ + } /* end else */ + + return nbytes; +} /* filter_bogus1() */ + +/*------------------------------------------------------------------------- + * Function: filter_bogus2 + * + * Purpose: A bogus filter that multiplies the original value by FACTOR. + * + * Return: Success: Data chunk size + * + * Programmer: Raymond Lu + * 30 November 2012 + *------------------------------------------------------------------------- + */ +static size_t +filter_bogus2(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, + const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, + size_t *buf_size, void **buf) +{ + int *int_ptr=(int *)*buf; /* Pointer to the data values */ + ssize_t buf_left=(ssize_t)*buf_size; /* Amount of data buffer left to process */ + + if(flags & H5Z_FLAG_REVERSE) { /* read */ + /* Substract the "add on" value to all the data values */ + while(buf_left>0) { + *int_ptr++ /= (int)FACTOR; + buf_left -= (ssize_t)sizeof(int); + } /* end while */ + } /* end if */ + else { /* write */ + /* Add the "add on" value to all the data values */ + while(buf_left>0) { + *int_ptr++ *= (int)FACTOR; + buf_left -= (ssize_t)sizeof(int); + } /* end while */ + } /* end else */ + + return nbytes; +} /* filter_bogus2() */ + +/*------------------------------------------------------------------------- + * Function: test_skip_compress_write2 + * + * Purpose: Test skipping compression filter when there are three filters + * for the dataset + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Raymond Lu + * 30 November 2012 + * + *------------------------------------------------------------------------- + */ +static int +test_skip_compress_write2(hid_t file) +{ + hid_t dataspace = -1, dataset = -1; + hid_t mem_space = -1; + hid_t cparms = -1, dxpl = -1; + hsize_t dims[2] = {NX, NY}; + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; + herr_t status; + int i, j, n; + + unsigned filter_mask = 0; /* orig filter mask */ + int origin_direct_buf[CHUNK_NX][CHUNK_NY]; + int direct_buf[CHUNK_NX][CHUNK_NY]; + int check_chunk[CHUNK_NX][CHUNK_NY]; + hsize_t offset[2] = {0, 0}; + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); + int aggression = 9; /* Compression aggression setting */ + + unsigned read_filter_mask = 0; /* filter mask after direct read */ + int read_direct_buf[CHUNK_NX][CHUNK_NY]; + hsize_t read_buf_size = 0; /* buf size */ + + hsize_t start[2]; /* Start of hyperslab */ + hsize_t stride[2]; /* Stride of hyperslab */ + hsize_t count[2]; /* Block count */ + hsize_t block[2]; /* Block sizes */ + + TESTING("skipping compression filters but keep two other filters"); + + /* + * Create the data space with unlimited dimensions. + */ + if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + goto error; + + if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) + goto error; + + /* + * Modify dataset creation properties, i.e. enable chunking and compression. + * The order of filters is bogus 1 + deflate + bogus 2. + */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) + goto error; + + /* Register and enable first bogus filter */ + if(H5Zregister (H5Z_BOGUS1) < 0) + goto error; + + if(H5Pset_filter(cparms, H5Z_FILTER_BOGUS1, 0, (size_t)0, NULL) < 0) + goto error; + + /* Enable compression filter */ + if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0) + goto error; + + /* Register and enable second bogus filter */ + if(H5Zregister (H5Z_BOGUS2) < 0) + goto error; + + if(H5Pset_filter(cparms, H5Z_FILTER_BOGUS2, 0, (size_t)0, NULL) < 0) + goto error; + + /* + * Create a new dataset within the file using cparms + * creation properties. + */ + if((dataset = H5Dcreate2(file, DATASETNAME3, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + goto error; + + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + + /* Initialize data for one chunk. Apply operations of two bogus filters to the chunk */ + for(i = n = 0; i < CHUNK_NX; i++) + for(j = 0; j < CHUNK_NY; j++) { + origin_direct_buf[i][j] = n++; + direct_buf[i][j] = (origin_direct_buf[i][j] + ADD_ON) * FACTOR; + } + + /* write the uncompressed chunk data repeatedly to dataset, using the direct writing function. + * Indicate skipping the compression filter but keep the other two bogus filters */ + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY; + + /* compression filter is the middle one to be skipped */ + filter_mask = 0x00000002; + + if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0) + goto error; + + if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0) + goto error; + + if(H5Dclose(dataset) < 0) + goto error; + + if((dataset = H5Dopen2(file, DATASETNAME3, H5P_DEFAULT)) < 0) + goto error; + + /* + * Select hyperslab for one chunk in the file + */ + start[0] = CHUNK_NX; start[1] = CHUNK_NY; + stride[0] = 1; stride[1] = 1; + count[0] = 1; count[1] = 1; + block[0] = CHUNK_NX; block[1] = CHUNK_NY; + if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0) + goto error; + + /* Read the chunk back */ + if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0) + goto error; + + /* Check that the values read are the same as the values written */ + for(i = 0; i < CHUNK_NX; i++) { + for(j = 0; j < CHUNK_NY; j++) { + if(origin_direct_buf[i][j] != check_chunk[i][j]) { + HDprintf(" 1. Read different values than written."); + HDprintf(" At index %d,%d\n", i, j); + HDprintf(" origin_direct_buf=%d, check_chunk=%d\n", origin_direct_buf[i][j], check_chunk[i][j]); + goto error; + } + } + } + + /* Query chunk storage size */ + if((status = H5Dget_chunk_storage_size(dataset, offset, &read_buf_size)) < 0) + goto error; + if(read_buf_size != buf_size) + goto error; + + /* Read the raw chunk back */ + HDmemset(&read_direct_buf, 0, sizeof(read_direct_buf)); + if((status = H5Dread_chunk(dataset, H5P_DEFAULT, offset, &read_filter_mask, read_direct_buf)) < 0) + goto error; + if(read_filter_mask != filter_mask) + goto error; + + /* Check that the direct chunk read is the same as the chunk written */ + for(i = 0; i < CHUNK_NX; i++) { + for(j = 0; j < CHUNK_NY; j++) { + if(direct_buf[i][j] != read_direct_buf[i][j]) { + HDprintf(" 1. Read different values than written."); + HDprintf(" At index %d,%d\n", i, j); + HDprintf(" direct_buf=%d, read_direct_buf=%d\n", direct_buf[i][j], read_direct_buf[i][j]); + goto error; + } + } + } + + /* + * Close/release resources. + */ + H5Dclose(dataset); + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Dclose(dataset); + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + } H5E_END_TRY; + + H5_FAILED(); + return 1; +} /* test_skip_compress_write2() */ + +/*------------------------------------------------------------------------- + * Function: test_data_conv + * + * Purpose: Test data conversion + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Raymond Lu + * 30 November 2012 + * + *------------------------------------------------------------------------- + */ +static int +test_data_conv(hid_t file) +{ + typedef struct { + int a, b, c[4], d, e; + } src_type_t; + typedef struct { + int a, c[4], e; + } dst_type_t; + + hid_t dataspace = -1, dataset = -1; + hid_t mem_space = -1; + hid_t cparms = -1, dxpl = -1; + hsize_t dims[2] = {NX, NY}; + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; + herr_t status; + int i, j, n; + const hsize_t four = 4; + hid_t st=-1, dt=-1; + hid_t array_dt; + + unsigned filter_mask = 0; + src_type_t direct_buf[CHUNK_NX][CHUNK_NY]; + dst_type_t check_chunk[CHUNK_NX][CHUNK_NY]; + src_type_t read_chunk[CHUNK_NX][CHUNK_NY]; /* For H5Dread_chunk */ + + hsize_t offset[2] = {0, 0}; + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(src_type_t); + + hsize_t start[2]; /* Start of hyperslab */ + hsize_t stride[2]; /* Stride of hyperslab */ + hsize_t count[2]; /* Block count */ + hsize_t block[2]; /* Block sizes */ + + TESTING("data conversion for H5Dwrite_chunk/H5Dread_chunk"); + + /* + * Create the data space with unlimited dimensions. + */ + if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + goto error; + + if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) + goto error; + + /* + * Modify dataset creation properties, i.e. enable chunking + */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) + goto error; + + /* Build hdf5 datatypes */ + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); + if((st = H5Tcreate(H5T_COMPOUND, sizeof(src_type_t))) < 0 || + H5Tinsert(st, "a", HOFFSET(src_type_t, a), H5T_NATIVE_INT) < 0 || + H5Tinsert(st, "b", HOFFSET(src_type_t, b), H5T_NATIVE_INT) < 0 || + H5Tinsert(st, "c", HOFFSET(src_type_t, c), array_dt) < 0 || + H5Tinsert(st, "d", HOFFSET(src_type_t, d), H5T_NATIVE_INT) < 0 || + H5Tinsert(st, "e", HOFFSET(src_type_t, e), H5T_NATIVE_INT) < 0) + goto error; + + if(H5Tclose(array_dt) < 0) + goto error; + + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); + if((dt = H5Tcreate(H5T_COMPOUND, sizeof(dst_type_t))) < 0 || + H5Tinsert(dt, "a", HOFFSET(dst_type_t, a), H5T_NATIVE_INT) < 0 || + H5Tinsert(dt, "c", HOFFSET(dst_type_t, c), array_dt) < 0 || + H5Tinsert(dt, "e", HOFFSET(dst_type_t, e), H5T_NATIVE_INT) < 0) + goto error; + + if(H5Tclose(array_dt) < 0) + goto error; + + /* + * Create a new dataset within the file using cparms + * creation properties. + */ + if((dataset = H5Dcreate2(file, DATASETNAME4, st, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + goto error; + + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + + /* Initialize data for one chunk */ + for(i = n = 0; i < CHUNK_NX; i++) { + for(j = 0; j < CHUNK_NY; j++) { + (direct_buf[i][j]).a = i*j+0; + (direct_buf[i][j]).b = i*j+1; + (direct_buf[i][j]).c[0] = i*j+2; + (direct_buf[i][j]).c[1] = i*j+3; + (direct_buf[i][j]).c[2] = i*j+4; + (direct_buf[i][j]).c[3] = i*j+5; + (direct_buf[i][j]).d = i*j+6; + (direct_buf[i][j]).e = i*j+7; + } + } + + /* write the chunk data to dataset, using the direct writing function. + * There should be no data conversion involved. */ + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY; + + if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0) + goto error; + + if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0) + goto error; + + if(H5Dclose(dataset) < 0) + goto error; + + if((dataset = H5Dopen2(file, DATASETNAME4, H5P_DEFAULT)) < 0) + goto error; + + /* Use H5Dread_chunk() to read the uncompressed data */ + if((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, read_chunk)) < 0) + goto error; + + /* Check that the values read are the same as the values written */ + for(i = 0; i < CHUNK_NX; i++) { + for(j = 0; j < CHUNK_NY; j++) { + if ((direct_buf[i][j]).a != (read_chunk[i][j]).a || + (direct_buf[i][j]).b != (read_chunk[i][j]).b || + (direct_buf[i][j]).c[0] != (read_chunk[i][j]).c[0] || + (direct_buf[i][j]).c[1] != (read_chunk[i][j]).c[1] || + (direct_buf[i][j]).c[2] != (read_chunk[i][j]).c[2] || + (direct_buf[i][j]).c[3] != (read_chunk[i][j]).c[3] || + (direct_buf[i][j]).d != (read_chunk[i][j]).d || + (direct_buf[i][j]).e != (read_chunk[i][j]).e) { + HDprintf(" 1. Read different values than written."); + HDprintf(" At index %d,%d\n", i, j); + HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1], + (direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d, (direct_buf[i][j]).e); + HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + (read_chunk[i][j]).a, (read_chunk[i][j]).b, (read_chunk[i][j]).c[0], (read_chunk[i][j]).c[1], + (read_chunk[i][j]).c[2], (read_chunk[i][j]).c[3], (read_chunk[i][j]).d, (read_chunk[i][j]).e); + + goto error; + } + } + } + + /* + * Select hyperslab for the chunk just written in the file + */ + start[0] = CHUNK_NX; start[1] = CHUNK_NY; + stride[0] = 1; stride[1] = 1; + count[0] = 1; count[1] = 1; + block[0] = CHUNK_NX; block[1] = CHUNK_NY; + if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0) + goto error; + + /* Read the chunk back. Data should be converted */ + if((status = H5Dread(dataset, dt, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0) + goto error; + + /* Check that the values read are the same as the values written */ + for(i = 0; i < CHUNK_NX; i++) { + for(j = 0; j < CHUNK_NY; j++) { + if ((direct_buf[i][j]).a != (check_chunk[i][j]).a || + (direct_buf[i][j]).c[0] != (check_chunk[i][j]).c[0] || + (direct_buf[i][j]).c[1] != (check_chunk[i][j]).c[1] || + (direct_buf[i][j]).c[2] != (check_chunk[i][j]).c[2] || + (direct_buf[i][j]).c[3] != (check_chunk[i][j]).c[3] || + (direct_buf[i][j]).e != (check_chunk[i][j]).e) { + HDprintf(" 1. Read different values than written."); + HDprintf(" At index %d,%d\n", i, j); + HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1], + (direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d, (direct_buf[i][j]).e); + HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n", + (check_chunk[i][j]).a, (check_chunk[i][j]).c[0], (check_chunk[i][j]).c[1], (check_chunk[i][j]).c[2], + (check_chunk[i][j]).c[3], (check_chunk[i][j]).e); + + goto error; + } + } + } + + /* + * Close/release resources. + */ + H5Dclose(dataset); + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + H5Tclose(st); + H5Tclose(dt); + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Dclose(dataset); + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + H5Tclose(st); + H5Tclose(dt); + } H5E_END_TRY; + + H5_FAILED(); + return 1; +} /* test_data_conv() */ + +/*------------------------------------------------------------------------- + * Function: test_invalid_parameters + * + * Purpose: Test invalid parameters for H5Dwrite_chunk and H5Dread_chunk + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Raymond Lu + * 30 November 2012 + * + *------------------------------------------------------------------------- + */ +static int +test_invalid_parameters(hid_t file) +{ + hid_t dataspace = -1, dataset = -1; + hid_t mem_space = -1; + hid_t cparms = -1, dxpl = -1; + hsize_t dims[2] = {NX, NY}; + hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; + herr_t status; + int i, j, n; + + unsigned filter_mask = 0; + int direct_buf[CHUNK_NX][CHUNK_NY]; + hsize_t offset[2] = {0, 0}; + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); + int aggression = 9; /* Compression aggression setting */ + + hsize_t chunk_nbytes; /* Chunk size */ + + TESTING("invalid parameters for H5Dwrite_chunk/H5Dread_chunk"); + + /* + * Create the data space with unlimited dimensions. + */ + if((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0) + goto error; + + if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) + goto error; + + /* + * Modify dataset creation properties + */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + /* + * Create a new contiguous dataset to verify H5Dwrite_chunk/H5Dread_chunk doesn't work + */ + if((dataset = H5Dcreate2(file, DATASETNAME5, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + goto error; + + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + + /* Initialize data for one chunk */ + for(i = n = 0; i < CHUNK_NX; i++) + for(j = 0; j < CHUNK_NY; j++) { + direct_buf[i][j] = n++; + } + + /* Try to write the chunk data to contiguous dataset. It should fail */ + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY; + + H5E_BEGIN_TRY { + if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Try to get chunk size for a contiguous dataset. It should fail */ + H5E_BEGIN_TRY { + if((status = H5Dget_chunk_storage_size(dataset, offset, &chunk_nbytes)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Try to H5Dread_chunk from the contiguous dataset. It should fail */ + H5E_BEGIN_TRY { + if((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + if(H5Dclose(dataset) < 0) + goto error; + + + /* Create a chunked dataset with compression filter */ + if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) + goto error; + + if((status = H5Pset_deflate( cparms, (unsigned ) aggression)) < 0) + goto error; + + /* + * Create a new dataset within the file using cparms + * creation properties. + */ + if((dataset = H5Dcreate2(file, DATASETNAME6, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + goto error; + + /* Check invalid dataset ID for H5Dwrite_chunk and H5Dread_chunk */ + H5E_BEGIN_TRY { + if((status = H5Dwrite_chunk((hid_t)-1, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + H5E_BEGIN_TRY { + if((status = H5Dread_chunk((hid_t)-1, dxpl, offset, &filter_mask, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Check invalid DXPL ID for H5Dwrite_chunk and H5Dread_chunk */ + H5E_BEGIN_TRY { + if((status = H5Dwrite_chunk(dataset, (hid_t)-1, filter_mask, offset, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + H5E_BEGIN_TRY { + if((status = H5Dread_chunk(dataset, (hid_t)-1, offset, &filter_mask, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Check invalid OFFSET for H5Dwrite_chunk and H5Dread_chunk */ + H5E_BEGIN_TRY { + if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, NULL, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + H5E_BEGIN_TRY { + if((status = H5Dread_chunk(dataset, dxpl, NULL, &filter_mask, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Check when OFFSET is out of dataset range for H5Dwrite_chunk and H5Dread_chunk */ + offset[0] = NX + 1; + offset[1] = NY; + H5E_BEGIN_TRY { + if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + H5E_BEGIN_TRY { + if((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Check when OFFSET is not on chunk boundary for H5Dwrite_chunk and H5Dread_chunk */ + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY + 1; + H5E_BEGIN_TRY { + if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + H5E_BEGIN_TRY { + if((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Check invalid buffer size for H5Dwrite_chunk only */ + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY; + buf_size = 0; + H5E_BEGIN_TRY { + if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Check invalid data buffer for H5Dwrite_chunk and H5Dread_chunk */ + buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); + H5E_BEGIN_TRY { + if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, NULL)) != FAIL) + goto error; + } H5E_END_TRY; + + H5E_BEGIN_TRY { + if((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, NULL)) != FAIL) + goto error; + } H5E_END_TRY; + + if(H5Dclose(dataset) < 0) + goto error; + + /* + * Close/release resources. + */ + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Dclose(dataset); + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + } H5E_END_TRY; + + H5_FAILED(); + return 1; +} /* test_invalid_parameters() */ + +/*------------------------------------------------------------------------- + * Function: test_direct_chunk_read_no_cache + * + * Purpose: Test the basic functionality of H5Dread_chunk with the + * chunk cache diabled. + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Matthew Strong (GE Healthcare) + * 14 February 2016 + * + *------------------------------------------------------------------------- + */ +#ifdef H5_HAVE_FILTER_DEFLATE +static int +test_direct_chunk_read_no_cache (hid_t file) +{ + hid_t dataspace = -1, dataset = -1; + hid_t mem_space = -1; + hid_t cparms = -1, dxpl = -1, dapl = -1; + hsize_t dims[2] = {NX, NY}; + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; + herr_t status; /* status from H5 function calls */ + int ret; /* deflate return status */ + int data[NX][NY]; + int i, j, k, l, n; /* local index variables */ + + unsigned filter_mask = 0; /* filter mask returned from H5Dread_chunk */ + int direct_buf[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread and manually decompressed */ + int check_chunk[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread */ + hsize_t offset[2]; /* chunk offset used for H5Dread_chunk */ + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); + + Bytef *z_src = NULL; /* source buffer */ + uLongf z_src_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); + Bytef *z_dst = (Bytef*)(direct_buf); + uLong z_dst_nbytes = (uLong)buf_size; + int aggression = 9; /* Compression aggression setting */ + void *outbuf = NULL; /* Pointer to new buffer */ + + hsize_t start[2]; /* Start of hyperslab */ + hsize_t stride[2]; /* Stride of hyperslab */ + hsize_t count[2]; /* Block count */ + hsize_t block[2]; /* Block sizes */ + + TESTING("basic functionality of H5Dread_chunk (chunk cache disabled)"); + + /* Create the data space with unlimited dimensions. */ + if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + goto error; + if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) + goto error; + + /* Modify dataset creation properties, i.e. enable chunking and compression */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) + goto error; + if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0) + goto error; + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + goto error; + + /* Disable chunk cache by setting number of slots to 0 */ + if((status = H5Pset_chunk_cache(dapl, 0, H5D_CHUNK_CACHE_NBYTES_DEFAULT, H5D_CHUNK_CACHE_W0_DEFAULT)) < 0) + goto error; + + /* Create a new dataset within the file using cparms creation properties. */ + if((dataset = H5Dcreate2(file, DATASETNAME8, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, dapl)) < 0) + goto error; + + /* Initialize the dataset */ + for(i = n = 0; i < NX; i++) + for(j = 0; j < NY; j++) + data[i][j] = n++; + + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + + /* Write the data for the dataset. + * Data will skip chunk cache and go directly to disk. */ + if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + dxpl, data)) < 0) + goto error; + + /* Allocate output (compressed) buffer */ + outbuf = HDmalloc(z_src_nbytes); + z_src = (Bytef *)outbuf; + + /* For each chunk in the dataset, compare the result of H5Dread and H5Dread_chunk. */ + for(i=0; i + +#if !defined(WIN32) && !defined(__MINGW32__) + +#include + +#ifdef H5_STDC_HEADERS +# include +# include +# include +# include +#endif + +#ifdef H5_HAVE_UNISTD_H +# include +# include +#endif + +#ifdef H5_HAVE_SYS_STAT_H +# include +#endif + +#if defined(H5_TIME_WITH_SYS_TIME) +# include +# include +#elif defined(H5_HAVE_SYS_TIME_H) +# include +#else +# include +#endif + +const char *FILENAME[] = { + "direct_write", + "unix.raw", + NULL +}; + +/* + * Print the current location on the standard output stream. + */ +#define FUNC __func__ +#define AT() printf (" at %s:%d in %s()...\n", \ + __FILE__, __LINE__, FUNC); +#define H5_FAILED() {puts("*FAILED*");fflush(stdout);} +#define TEST_ERROR {H5_FAILED(); AT(); goto error;} +#define TESTING(WHAT) {printf("Testing %-62s",WHAT); fflush(stdout);} +#define PASSED() {puts(" PASSED");fflush(stdout);} + +#define DIRECT_UNCOMPRESSED_DSET "direct_uncompressed_dset" +#define DIRECT_COMPRESSED_DSET "direct_compressed_dset" +#define REG_COMPRESSED_DSET "reg_compressed_dset" +#define REG_NO_COMPRESS_DSET "reg_no_compress_dset" +#define RANK 3 +#define NX 100 +#define NY 1000 +#define NZ 250 +#define CHUNK_NX 1 +#define CHUNK_NY 1000 +#define CHUNK_NZ 250 + +#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12) +char filename[1024]; +unsigned int *outbuf[NX]; +size_t data_size[NX]; +double total_size = 0.0; +unsigned int *direct_buf[NX]; +double MB = 1048576.0; + +/*-------------------------------------------------- + * Function to report IO rate + *-------------------------------------------------- + */ +void reportTime(struct timeval start, double mbytes) +{ + struct timeval timeval_stop,timeval_diff; + + /*end timing*/ + gettimeofday(&timeval_stop,NULL); + + /* Calculate the elapsed gettimeofday time */ + timeval_diff.tv_usec=timeval_stop.tv_usec-start.tv_usec; + timeval_diff.tv_sec=timeval_stop.tv_sec-start.tv_sec; + + if(timeval_diff.tv_usec<0) { + timeval_diff.tv_usec+=1000000; + timeval_diff.tv_sec--; + } /* end if */ + +/*printf("mbytes=%lf, sec=%lf, usec=%lf\n", mbytes, (double)timeval_diff.tv_sec, (double)timeval_diff.tv_usec);*/ + printf("MBytes/second: %lf\n", (double)mbytes/((double)timeval_diff.tv_sec+((double)timeval_diff.tv_usec/(double)1000000.0))); +} + +/*-------------------------------------------------- + * Create file, datasets, and initialize data + *-------------------------------------------------- + */ +int create_file(hid_t fapl_id) +{ + hid_t file; /* handles */ + hid_t fapl; + hid_t cparms; + hid_t dataspace, dataset; + hsize_t dims[RANK] = {NX, NY, NZ}; + hsize_t chunk_dims[RANK] ={CHUNK_NX, CHUNK_NY, CHUNK_NZ}; + unsigned int aggression = 9; /* Compression aggression setting */ + int ret; + int i, j, n; + + int flag; + int unix_file; + + unsigned int *p; + size_t buf_size = CHUNK_NY*CHUNK_NZ*sizeof(unsigned int); + + const Bytef *z_src; + Bytef *z_dst; /*destination buffer */ + uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); + uLong z_src_nbytes = (uLong)buf_size; + + TESTING("Create a file and dataset"); + + /* + * Create the data space with unlimited dimensions. + */ + if((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0) + TEST_ERROR; + + /* + * Create a new file. If file exists its contents will be overwritten. + */ + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + TEST_ERROR; + + /* + * Modify dataset creation properties, i.e. enable chunking and compression + */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + + if(H5Pset_chunk( cparms, RANK, chunk_dims) < 0) + TEST_ERROR; + + /* + * Create a new dataset within the file using cparms + * creation properties. + */ + if((dataset = H5Dcreate2(file, DIRECT_UNCOMPRESSED_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if(H5Dclose(dataset) < 0) + TEST_ERROR; + + if((dataset = H5Dcreate2(file, REG_NO_COMPRESS_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if(H5Dclose(dataset) < 0) + TEST_ERROR; + + /* Set compression */ + if(H5Pset_deflate( cparms, aggression) < 0) + TEST_ERROR; + + if((dataset = H5Dcreate2(file, DIRECT_COMPRESSED_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if(H5Dclose(dataset) < 0) + TEST_ERROR; + + + if((dataset = H5Dcreate2(file, REG_COMPRESSED_DSET, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if(H5Dclose(dataset) < 0) + TEST_ERROR; + + if(H5Fclose(file) < 0) + TEST_ERROR; + + if(H5Sclose(dataspace) < 0) + TEST_ERROR; + + if(H5Pclose(cparms) < 0) + TEST_ERROR; + + /* create a unix file*/ + flag = O_CREAT|O_TRUNC|O_WRONLY; + + if ((unix_file=open(FILENAME[1],flag,S_IRWXU))== -1) + TEST_ERROR; + + if (close(unix_file) < 0) + { + printf(" unable to close the file\n"); + TEST_ERROR; + } + + + /* Initialize data for chunks */ + for(i = 0; i < NX; i++) { + p = direct_buf[i] = (unsigned int*)malloc(CHUNK_NY*CHUNK_NZ*sizeof(unsigned int)); + + for(j=0; j < CHUNK_NY*CHUNK_NZ; j++, p++) + *p = rand() % 65000; + + z_src = (const Bytef*)direct_buf[i]; + + z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); + /* Allocate output (compressed) buffer */ + outbuf[i] = (unsigned int*)malloc((size_t)z_dst_nbytes); + z_dst = (Bytef *)outbuf[i]; + + /* Perform compression from the source to the destination buffer */ + ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression); + + data_size[i] = (size_t)z_dst_nbytes; + total_size += data_size[i]; + + /* Check for various zlib errors */ + if(Z_BUF_ERROR == ret) { + fprintf(stderr, "overflow"); + TEST_ERROR; + } else if(Z_MEM_ERROR == ret) { + fprintf(stderr, "deflate memory error"); + TEST_ERROR; + } else if(Z_OK != ret) { + fprintf(stderr, "other deflate error"); + TEST_ERROR; + } + } + + + PASSED(); + +error: + H5E_BEGIN_TRY { + H5Dclose(dataset); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} + +/*-------------------------------------------------- + * Benchmark the performance of the new function + * with precompressed data. + *-------------------------------------------------- + */ +int +test_direct_write_uncompressed_data(hid_t fapl_id) +{ + hid_t file; /* handles */ + hid_t dataspace, dataset; + hid_t dxpl; + herr_t status; + int i; + + unsigned filter_mask = 0; + hsize_t offset[RANK] = {0, 0, 0}; + + struct timeval timeval_start; + + TESTING("H5Dwrite_chunk for uncompressed data"); + + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + TEST_ERROR; + + /* Start the timer */ + gettimeofday(&timeval_start,NULL); + + /* Reopen the file and dataset */ + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) + TEST_ERROR; + + if((dataset = H5Dopen2(file, DIRECT_UNCOMPRESSED_DSET, H5P_DEFAULT)) < 0) + TEST_ERROR; + + + /* Write the compressed chunk data repeatedly to cover all the chunks in the + * dataset, using the direct writing function. */ + for(i=0; i Date: Mon, 30 Apr 2018 09:34:53 -0700 Subject: Finished move of H5DOread/write_chunk calls to H5D. --- src/H5CX.c | 280 --------------------------------------- src/H5CXprivate.h | 7 - src/H5Dio.c | 388 ++++++++++++++++++++---------------------------------- src/H5Dpkg.h | 2 - src/H5Pdxpl.c | 65 --------- 5 files changed, 142 insertions(+), 600 deletions(-) diff --git a/src/H5CX.c b/src/H5CX.c index deaf1a1..f809d1c 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -233,24 +233,10 @@ typedef struct H5CX_t { hbool_t data_transform_valid; /* Whether data transform info is valid */ H5T_vlen_alloc_info_t vl_alloc_info; /* VL datatype alloc info (H5D_XFER_VLEN_*_NAME) */ hbool_t vl_alloc_info_valid; /* Whether VL datatype alloc info is valid */ - hbool_t dcr_flag; /* Direct chunk read flag (H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME) */ - hbool_t dcr_flag_valid; /* Whether direct chunk read flag is valid */ - hsize_t *dcr_offset; /* Direct chunk read offset (H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME) */ - hbool_t dcr_offset_valid; /* Whether direct chunk read offset is valid */ - hbool_t dcw_flag; /* Direct chunk write flag (H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME) */ - hbool_t dcw_flag_valid; /* Whether direct chunk write flag is valid */ - uint32_t dcw_filters; /* Direct chunk write filter flags (H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME) */ - hbool_t dcw_filters_valid; /* Whether direct chunk write filter flags is valid */ - hsize_t *dcw_offset; /* Direct chunk write offset (H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME) */ - hbool_t dcw_offset_valid; /* Whether direct chunk write offset is valid */ - uint32_t dcw_datasize; /* Direct chunk write data size (H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME) */ - hbool_t dcw_datasize_valid; /* Whether direct chunk write data size is valid */ H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */ hbool_t dt_conv_cb_valid; /* Whether datatype conversion struct is valid */ /* Return-only DXPL properties to return to application */ - uint32_t dcr_filters; /* Direct chunk read filter flags (H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME) */ - hbool_t dcr_filters_set; /* Whether direct chunk read filter flags are set */ #ifdef H5_HAVE_PARALLEL H5D_mpio_actual_chunk_opt_mode_t mpio_actual_chunk_opt; /* Chunk optimization mode used for parallel I/O (H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME) */ hbool_t mpio_actual_chunk_opt_set; /* Whether chunk optimization mode used for parallel I/O is set */ @@ -321,12 +307,6 @@ typedef struct H5CX_dxpl_cache_t { H5Z_cb_t filter_cb; /* Filter callback function (H5D_XFER_FILTER_CB_NAME) */ H5Z_data_xform_t *data_transform; /* Data transform info (H5D_XFER_XFORM_NAME) */ H5T_vlen_alloc_info_t vl_alloc_info; /* VL datatype alloc info (H5D_XFER_VLEN_*_NAME) */ - hbool_t dcr_flag; /* Direct chunk read flag (H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME) */ - hsize_t *dcr_offset; /* Direct chunk read offset (H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME) */ - hbool_t dcw_flag; /* Direct chunk write flag (H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME) */ - uint32_t dcw_datasize; /* Direct chunk write data size (H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME) */ - hsize_t *dcw_offset; /* Direct chunk write offset (H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME) */ - uint32_t dcw_filters; /* Direct chunk write filter flags (H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME) */ H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */ } H5CX_dxpl_cache_t; @@ -469,27 +449,10 @@ H5CX__init_package(void) if(H5P_get(dx_plist, H5D_XFER_VLEN_FREE_INFO_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.free_info) < 0) HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info") - /* Get direct chunk read info */ - if(H5P_get(dx_plist, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, &H5CX_def_dxpl_cache.dcr_flag) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve direct chunk read flag") - if(H5P_get(dx_plist, H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME, &H5CX_def_dxpl_cache.dcr_offset) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve direct chunk read offset") - - /* Get direct chunk write info */ - if(H5P_get(dx_plist, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &H5CX_def_dxpl_cache.dcw_flag) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve direct chunk write flag") - if(H5P_get(dx_plist, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, &H5CX_def_dxpl_cache.dcw_filters) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve direct chunk write filter mask") - if(H5P_get(dx_plist, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, &H5CX_def_dxpl_cache.dcw_offset) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve direct chunk write offset") - if(H5P_get(dx_plist, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, &H5CX_def_dxpl_cache.dcw_datasize) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve direct chunk write data size") - /* Get datatype conversion struct */ if(H5P_get(dx_plist, H5D_XFER_CONV_CB_NAME, &H5CX_def_dxpl_cache.dt_conv_cb) < 0) HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve datatype conversion exception callback") - /* Reset the "default LAPL cache" information */ HDmemset(&H5CX_def_lapl_cache, 0, sizeof(H5CX_lapl_cache_t)); @@ -1791,216 +1754,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5CX_get_dcr_flag - * - * Purpose: Retrieves the direct chunk read flag for the current API call context. - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * March 6, 2018 - * - *------------------------------------------------------------------------- - */ -herr_t -H5CX_get_dcr_flag(hbool_t *dcr_flag) -{ - H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity check */ - HDassert(dcr_flag); - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); - - H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, dcr_flag) - - /* Get the value */ - *dcr_flag = (*head)->ctx.dcr_flag; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5CX_get_dcr_flag() */ - - -/*------------------------------------------------------------------------- - * Function: H5CX_get_dcr_offset - * - * Purpose: Retrieves the direct chunk read offset for the current API call context. - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * March 6, 2018 - * - *------------------------------------------------------------------------- - */ -herr_t -H5CX_get_dcr_offset(hsize_t **dcr_offset) -{ - H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity check */ - HDassert(dcr_offset); - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); - - H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME, dcr_offset) - - /* Get the value */ - *dcr_offset = (*head)->ctx.dcr_offset; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5CX_get_dcr_offset() */ - - -/*------------------------------------------------------------------------- - * Function: H5CX_get_dcw_flag - * - * Purpose: Retrieves the direct chunk write flag for the current API call context. - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * March 6, 2018 - * - *------------------------------------------------------------------------- - */ -herr_t -H5CX_get_dcw_flag(hbool_t *dcw_flag) -{ - H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity check */ - HDassert(dcw_flag); - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); - - H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, dcw_flag) - - /* Get the value */ - *dcw_flag = (*head)->ctx.dcw_flag; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5CX_get_dcw_flag() */ - - -/*------------------------------------------------------------------------- - * Function: H5CX_get_dcw_filters - * - * Purpose: Retrieves the direct chunk write filter mask for the current API call context. - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * March 6, 2018 - * - *------------------------------------------------------------------------- - */ -herr_t -H5CX_get_dcw_filters(uint32_t *dcw_filters) -{ - H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity check */ - HDassert(dcw_filters); - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); - - H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, dcw_filters) - - /* Get the value */ - *dcw_filters = (*head)->ctx.dcw_filters; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5CX_get_dcw_filters() */ - - -/*------------------------------------------------------------------------- - * Function: H5CX_get_dcw_offset - * - * Purpose: Retrieves the direct chunk write offset for the current API call context. - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * March 6, 2018 - * - *------------------------------------------------------------------------- - */ -herr_t -H5CX_get_dcw_offset(hsize_t **dcw_offset) -{ - H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity check */ - HDassert(dcw_offset); - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); - - H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, dcw_offset) - - /* Get the value */ - *dcw_offset = (*head)->ctx.dcw_offset; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5CX_get_dcw_offset() */ - - -/*------------------------------------------------------------------------- - * Function: H5CX_get_dcw_datasize - * - * Purpose: Retrieves the direct chunk write data size for the current API call context. - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * March 6, 2018 - * - *------------------------------------------------------------------------- - */ -herr_t -H5CX_get_dcw_datasize(uint32_t *dcw_datasize) -{ - H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity check */ - HDassert(dcw_datasize); - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); - - H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, dcw_datasize) - - /* Get the value */ - *dcw_datasize = (*head)->ctx.dcw_datasize; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5CX_get_dcw_datasize() */ - - -/*------------------------------------------------------------------------- * Function: H5CX_get_dt_conv_cb * * Purpose: Retrieves the datatype conversion exception callback for the current API call context. @@ -2358,38 +2111,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX_set_nlinks() */ - -/*------------------------------------------------------------------------- - * Function: H5CX_set_dcr_filters - * - * Purpose: Sets the direct chunk read filter flags for the current API call context. - * - * Return: - * - * Programmer: Quincey Koziol - * March 6, 2018 - * - *------------------------------------------------------------------------- - */ -void -H5CX_set_dcr_filters(uint32_t direct_filters) -{ - H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Sanity checks */ - HDassert(head && *head); - HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || - (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); - - /* Cache the filter mask for later, marking it to set in DXPL when context popped */ - (*head)->ctx.dcr_filters = direct_filters; - (*head)->ctx.dcr_filters_set = TRUE; - - FUNC_LEAVE_NOAPI_VOID -} /* end H5CX_set_dcr_filters() */ - #ifdef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- @@ -2755,7 +2476,6 @@ H5CX__pop_common(void) HDassert(head && *head); /* Check for cached DXPL properties to return to application */ - H5CX_SET_PROP(H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME, dcr_filters) #ifdef H5_HAVE_PARALLEL H5CX_SET_PROP(H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, mpio_actual_chunk_opt) H5CX_SET_PROP(H5D_MPIO_ACTUAL_IO_MODE_NAME, mpio_actual_io_mode) diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h index 3566f11..44a4067 100644 --- a/src/H5CXprivate.h +++ b/src/H5CXprivate.h @@ -95,12 +95,6 @@ H5_DLL herr_t H5CX_get_err_detect(H5Z_EDC_t *err_detect); H5_DLL herr_t H5CX_get_filter_cb(H5Z_cb_t *filter_cb); H5_DLL herr_t H5CX_get_data_transform(H5Z_data_xform_t **data_transform); H5_DLL herr_t H5CX_get_vlen_alloc_info(H5T_vlen_alloc_info_t *vl_alloc_info); -H5_DLL herr_t H5CX_get_dcr_flag(hbool_t *direct_read); -H5_DLL herr_t H5CX_get_dcr_offset(hsize_t **direct_offset); -H5_DLL herr_t H5CX_get_dcw_flag(hbool_t *direct_write); -H5_DLL herr_t H5CX_get_dcw_filters(uint32_t *direct_filters); -H5_DLL herr_t H5CX_get_dcw_offset(hsize_t **direct_offset); -H5_DLL herr_t H5CX_get_dcw_datasize(uint32_t *direct_datasize); H5_DLL herr_t H5CX_get_dt_conv_cb(H5T_conv_cb_t *cb_struct); /* "Getter" routines for LAPL properties cached in API context */ @@ -127,7 +121,6 @@ H5_DLL herr_t H5CX_set_vlen_alloc_info(H5MM_allocate_t alloc_func, H5_DLL herr_t H5CX_set_nlinks(size_t nlinks); /* "Setter" routines for cached DXPL properties that must be returned to application */ -H5_DLL void H5CX_set_dcr_filters(uint32_t direct_filters); #ifdef H5_HAVE_PARALLEL H5_DLL void H5CX_set_mpio_actual_chunk_opt(H5D_mpio_actual_chunk_opt_mode_t chunk_opt); H5_DLL void H5CX_set_mpio_actual_io_mode(H5D_mpio_actual_io_mode_t actual_io_mode); diff --git a/src/H5Dio.c b/src/H5Dio.c index 70a0bfe..6dec5b0 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -113,102 +113,56 @@ herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf/*out*/) { - H5D_t *dset = NULL; - const H5S_t *mem_space = NULL; - const H5S_t *file_space = NULL; - hbool_t direct_read = FALSE; - herr_t ret_value = SUCCEED; /* Return value */ + H5D_t *dset = NULL; + const H5S_t *mem_space = NULL; + const H5S_t *file_space = NULL; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iiiiix", dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); /* check arguments */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID") - if(NULL == dset->oloc.file) + if (NULL == dset->oloc.file) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") - if(mem_space_id < 0) + if (mem_space_id < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid mem_space_id") - if(file_space_id < 0) + if (file_space_id < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file_space_id") - if(H5S_ALL != mem_space_id) { - if(NULL == (mem_space = (const H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE))) + /* Check dataspaces */ + if (H5S_ALL != mem_space_id) { + if (NULL == (mem_space = (const H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") /* Check for valid selection */ - if(H5S_SELECT_VALID(mem_space) != TRUE) + if (H5S_SELECT_VALID(mem_space) != TRUE) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent") - } /* end if */ - - if(H5S_ALL != file_space_id) { - if(NULL == (file_space = (const H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE))) + } + if (H5S_ALL != file_space_id) { + if (NULL == (file_space = (const H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") /* Check for valid selection */ - if(H5S_SELECT_VALID(file_space) != TRUE) + if (H5S_SELECT_VALID(file_space) != TRUE) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent") - } /* end if */ + } /* Get the default dataset transfer property list if the user didn't provide one */ - if(H5P_DEFAULT == dxpl_id) + if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else - if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Retrieve the 'direct read' flag */ - if(H5CX_get_dcr_flag(&direct_read) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting flag for direct chunk read") - - /* Set up for direct read of chunk, bypassing filters, etc. */ - if(direct_read) { - hsize_t *direct_offset; /* Chunk offset from calling routine */ - hsize_t internal_offset[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ - uint32_t direct_filters = 0; /* Filters for chunk */ - unsigned u; /* Local index variable */ - - /* Sanity check */ - if(H5D_CHUNKED != dset->shared->layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") - - /* Get the direct chunk offset */ - if(H5CX_get_dcr_offset(&direct_offset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting offset for direct chunk read") - HDassert(direct_offset); - - /* The library's chunking code requires the offset terminates with a zero. So transfer the - * offset array to an internal offset array */ - for(u = 0; u < dset->shared->ndims; u++) { - /* Make sure the offset doesn't exceed the dataset's dimensions */ - if(direct_offset[u] > dset->shared->curr_dims[u]) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset") - - /* Make sure the offset fall right on a chunk's boundary */ - if(direct_offset[u] % dset->shared->layout.u.chunk.dim[u]) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset doesn't fall on chunks's boundary") - - internal_offset[u] = direct_offset[u]; - } /* end for */ - - /* Terminate the offset with a zero */ - internal_offset[dset->shared->ndims] = 0; - - /* Read the raw chunk */ - if(H5D__chunk_direct_read(dset, internal_offset, &direct_filters, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read chunk directly") - - /* Set the chunk filter mask for application */ - H5CX_set_dcr_filters(direct_filters); - } /* end if */ - else - /* Read raw data */ - if(H5D__read(dset, mem_type_id, mem_space, file_space, buf/*out*/) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") + /* Read raw data */ + if (H5D__read(dset, mem_type_id, mem_space, file_space, buf/*out*/) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") done: FUNC_LEAVE_API(ret_value) @@ -231,56 +185,62 @@ herr_t H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, void *buf) { - hbool_t created_dxpl = FALSE; /* Whether we created a DXPL */ - hbool_t do_direct_read = TRUE; /* Flag for direct writes */ - herr_t ret_value = SUCCEED; /* Return value */ + H5D_t *dset = NULL; + hsize_t internal_offset[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "ii*h*Iu*x", dset_id, dxpl_id, offset, filters, buf); /* Check arguments */ - if(dset_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset ID") - if(!buf) + if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID") + if (NULL == dset->oloc.file) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") + if (H5D_CHUNKED != dset->shared->layout.type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + if (!buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL") - if(!offset) + if (!offset) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset cannot be NULL") - if(!filters) + if (!filters) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filters cannot be NULL") - /* If the user passed in a default DXPL, create one to pass to H5Dwrite() */ - if(H5P_DEFAULT == dxpl_id) { - if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "cannot create dxpl") - created_dxpl = TRUE; - } /* end if */ + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == dxpl_id) + dxpl_id = H5P_DATASET_XFER_DEFAULT; + else + if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID") - /* Set direct write parameters */ - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, &do_direct_read) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot set direct read property") - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME, &offset) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot set offset property") + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); - /* Read chunk */ - if(H5Dread(dset_id, 0, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "cannot read from dataset") + /* The library's chunking code requires the offset to terminate with a zero. + * So transfer the offset array to an internal offset array that we + * can properly terminate (don't mess with the passed-in buffer). + */ + for (u = 0; u < dset->shared->ndims; u++) { + /* Make sure the offset doesn't exceed the dataset's dimensions */ + if (offset[u] > dset->shared->curr_dims[u]) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset") - /* Get the filter mask */ - if(H5Pget(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME, filters) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "cannot get filter mask property") + /* Make sure the offset fall right on a chunk's boundary */ + if (offset[u] % dset->shared->layout.u.chunk.dim[u]) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset doesn't fall on chunks's boundary") -done: - if(created_dxpl) { - if(H5Pclose(dxpl_id) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close dxpl") - } /* end if */ - else { - /* Reset the direct read flag on user DXPL */ - do_direct_read = FALSE; - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, &do_direct_read) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot reset direct write property") + internal_offset[u] = offset[u]; } + /* Terminate the offset with a zero */ + internal_offset[dset->shared->ndims] = 0; + + /* Read the raw chunk */ + if (H5D__chunk_direct_read(dset, internal_offset, filters, buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data") + +done: FUNC_LEAVE_API(ret_value) } /* end H5Dread_chunk() */ @@ -320,10 +280,9 @@ herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf) { - H5D_t *dset = NULL; + H5D_t *dset = NULL; const H5S_t *mem_space = NULL; const H5S_t *file_space = NULL; - hbool_t direct_write = FALSE; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -331,50 +290,46 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, dxpl_id, buf); /* check arguments */ - if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") - if(NULL == dset->oloc.file) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID") + if (NULL == dset->oloc.file) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") + if (mem_space_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid mem_space_id") + if (file_space_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file_space_id") + + /* Check dataspace selections */ + if (H5S_ALL != mem_space_id) { + if (NULL == (mem_space = (const H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "mem_space_id is not a dataspace ID") + + /* Check for valid selection */ + if (H5S_SELECT_VALID(mem_space) != TRUE) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "memory selection + offset not within extent") + } + if (H5S_ALL != file_space_id) { + if (NULL == (file_space = (const H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "file_space_id is not a dataspace ID") + + /* Check for valid selection */ + if (H5S_SELECT_VALID(file_space) != TRUE) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "file selection + offset not within extent") + } /* Get the default dataset transfer property list if the user didn't provide one */ - if(H5P_DEFAULT == dxpl_id) + if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else - if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Retrieve the 'direct write' flag */ - if(H5CX_get_dcw_flag(&direct_write) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting flag for direct chunk read") - - /* Check dataspace selections if this is not a direct write */ - if(!direct_write) { - if(mem_space_id < 0 || file_space_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") - - if(H5S_ALL != mem_space_id) { - if(NULL == (mem_space = (const H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") - - /* Check for valid selection */ - if(H5S_SELECT_VALID(mem_space) != TRUE) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "memory selection+offset not within extent") - } /* end if */ - if(H5S_ALL != file_space_id) { - if(NULL == (file_space = (const H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") - - /* Check for valid selection */ - if(H5S_SELECT_VALID(file_space) != TRUE) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "file selection+offset not within extent") - } /* end if */ - } /* end if */ - - if(H5D__pre_write(dset, direct_write, mem_type_id, mem_space, file_space, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't prepare for writing data") + /* Write the data */ + if (H5D__write(dset, mem_type_id, mem_space, file_space, buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") done: FUNC_LEAVE_API(ret_value) @@ -397,129 +352,70 @@ herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, size_t data_size, const void *buf) { - hbool_t created_dxpl = FALSE; /* Whether we created a DXPL */ - hbool_t do_direct_write = TRUE; /* Flag for direct writes */ - uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */ - herr_t ret_value = SUCCEED; /* Return value */ + H5D_t *dset = NULL; + hsize_t internal_offset[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ + unsigned u; /* Local index variable */ + uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iiIu*hz*x", dset_id, dxpl_id, filters, offset, data_size, buf); /* Check arguments */ - if(dset_id < 0) + if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset ID") - if(!buf) + if (NULL == dset->oloc.file) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") + if (H5D_CHUNKED != dset->shared->layout.type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + if (!buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL") - if(!offset) + if (!offset) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset cannot be NULL") - if(!data_size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "data_size cannot be NULL") + if (0 == data_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "data_size cannot be zero") + + /* Make sure data size is less than 4 GiB */ data_size_32 = (uint32_t)data_size; - if(data_size != (size_t)data_size_32) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid data_size") - - /* If the user passed in a default DXPL, create one to pass to H5Dwrite() */ - if(H5P_DEFAULT == dxpl_id) { - if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "cannot create dxpl") - created_dxpl = TRUE; - } /* end if */ + if (data_size != (size_t)data_size_32) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid data_size - chunks cannot be > 4 GiB") - /* Set direct write parameters */ - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot set direct read property") - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, &filters) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot set filters property") - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, &offset) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot set offset property") - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, &data_size_32) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot set data size property") + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == dxpl_id) + dxpl_id = H5P_DATASET_XFER_DEFAULT; + else + if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID") - /* Write chunk */ - if(H5Dwrite(dset_id, 0, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "cannot write to dataset") + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); -done: - if(created_dxpl) { - if(H5Pclose(dxpl_id) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close dxpl") - } /* end if */ - else { - /* Reset the direct write flag on user DXPL */ - do_direct_write = FALSE; - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "cannot reset direct write property") - } + /* The library's chunking code requires the offset to terminate with a zero. + * So transfer the offset array to an internal offset array that we + * can properly terminate (don't mess with the passed-in buffer). + */ + for (u = 0; u < dset->shared->ndims; u++) { + /* Make sure the offset doesn't exceed the dataset's dimensions */ + if (offset[u] > dset->shared->curr_dims[u]) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset") - FUNC_LEAVE_API(ret_value) -} /* end H5Dwrite_chunk() */ + /* Make sure the offset fall right on a chunk's boundary */ + if (offset[u] % dset->shared->layout.u.chunk.dim[u]) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset doesn't fall on chunks's boundary") - -/*------------------------------------------------------------------------- - * Function: H5D__pre_write - * - * Purpose: Preparation for writing data. - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id, - const H5S_t *mem_space, const H5S_t *file_space, const void *buf) -{ - herr_t ret_value = SUCCEED; /* Return value */ + internal_offset[u] = offset[u]; + } - FUNC_ENTER_PACKAGE_VOL - - /* Direct chunk write */ - if(direct_write) { - uint32_t direct_filters; - hsize_t *direct_offset; - uint32_t direct_datasize; - hsize_t internal_offset[H5O_LAYOUT_NDIMS]; - unsigned u; /* Local index variable */ - - if(H5D_CHUNKED != dset->shared->layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") - - /* Retrieve parameters for direct chunk write */ - if(H5CX_get_dcw_filters(&direct_filters) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting filter info for direct chunk write") - if(H5CX_get_dcw_offset(&direct_offset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting offset info for direct chunk write") - if(H5CX_get_dcw_datasize(&direct_datasize) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting data size for direct chunk write") - - /* The library's chunking code requires the offset terminates with a zero. So transfer the - * offset array to an internal offset array */ - for(u = 0; u < dset->shared->ndims; u++) { - /* Make sure the offset doesn't exceed the dataset's dimensions */ - if(direct_offset[u] > dset->shared->curr_dims[u]) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset") - - /* Make sure the offset fall right on a chunk's boundary */ - if(direct_offset[u] % dset->shared->layout.u.chunk.dim[u]) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset doesn't fall on chunks's boundary") - - internal_offset[u] = direct_offset[u]; - } /* end for */ - - /* Terminate the offset with a zero */ - internal_offset[dset->shared->ndims] = 0; - - /* write raw data */ - if(H5D__chunk_direct_write(dset, direct_filters, internal_offset, direct_datasize, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write chunk directly") - } /* end if */ - else - /* Normal write of raw data */ - if(H5D__write(dset, mem_type_id, mem_space, file_space, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") + /* Terminate the offset with a zero */ + internal_offset[dset->shared->ndims] = 0; + + /* Write chunk */ + if (H5D__chunk_direct_write(dset, filters, internal_offset, data_size, buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5D__pre_write() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Dwrite_chunk() */ /*------------------------------------------------------------------------- diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 126a3c0..b887b87 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -583,8 +583,6 @@ H5_DLL herr_t H5D__refresh(hid_t dset_id, H5D_t *dataset); H5_DLL herr_t H5D__format_convert(H5D_t *dataset); /* Internal I/O routines */ -H5_DLL herr_t H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id, - const H5S_t *mem_space, const H5S_t *file_space, const void *buf); H5_DLL herr_t H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t *file_space, void *buf/*out*/); H5_DLL herr_t H5D__write(H5D_t *dataset, hid_t mem_type_id, diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index e33e762..b56c137 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -152,22 +152,6 @@ #define H5D_XFER_XFORM_COPY H5P__dxfr_xform_copy #define H5D_XFER_XFORM_CMP H5P__dxfr_xform_cmp #define H5D_XFER_XFORM_CLOSE H5P__dxfr_xform_close -/* Definitions for properties of direct chunk write */ -#define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_SIZE sizeof(hbool_t) -#define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_DEF FALSE -#define H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_SIZE sizeof(uint32_t) -#define H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_DEF 0 -#define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_SIZE sizeof(hsize_t *) -#define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_DEF NULL -#define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_SIZE sizeof(uint32_t) -#define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF 0 -/* Definitions for properties of direct chunk read */ -#define H5D_XFER_DIRECT_CHUNK_READ_FLAG_SIZE sizeof(hbool_t) -#define H5D_XFER_DIRECT_CHUNK_READ_FLAG_DEF FALSE -#define H5D_XFER_DIRECT_CHUNK_READ_FILTERS_SIZE sizeof(uint32_t) -#define H5D_XFER_DIRECT_CHUNK_READ_FILTERS_DEF 0 -#define H5D_XFER_DIRECT_CHUNK_READ_OFFSET_SIZE sizeof(hsize_t *) -#define H5D_XFER_DIRECT_CHUNK_READ_OFFSET_DEF NULL /******************/ @@ -266,13 +250,6 @@ static const H5Z_EDC_t H5D_def_enable_edc_g = H5D_XFER_EDC_DEF; /* De static const H5Z_cb_t H5D_def_filter_cb_g = H5D_XFER_FILTER_CB_DEF; /* Default value for filter callback */ static const H5T_conv_cb_t H5D_def_conv_cb_g = H5D_XFER_CONV_CB_DEF; /* Default value for datatype conversion callback */ static const void *H5D_def_xfer_xform_g = H5D_XFER_XFORM_DEF; /* Default value for data transform */ -static const hbool_t H5D_def_direct_chunk_flag_g = H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_DEF; /* Default value for the flag of direct chunk write */ -static const uint32_t H5D_def_direct_chunk_filters_g = H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_DEF; /* Default value for the filters of direct chunk write */ -static const hsize_t *H5D_def_direct_chunk_offset_g = H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_DEF; /* Default value for the offset of direct chunk write */ -static const uint32_t H5D_def_direct_chunk_datasize_g = H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF; /* Default value for the datasize of direct chunk write */ -static const hbool_t direct_chunk_read_flag = H5D_XFER_DIRECT_CHUNK_READ_FLAG_DEF; /* Default value for the flag of direct chunk read */ -static const hsize_t *direct_chunk_read_offset = H5D_XFER_DIRECT_CHUNK_READ_OFFSET_DEF; /* Default value for the offset of direct chunk read */ -static const uint32_t direct_chunk_read_filters = H5D_XFER_DIRECT_CHUNK_READ_FILTERS_DEF; /* Default value for the filters of direct chunk read */ /*------------------------------------------------------------------------- @@ -423,48 +400,6 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, H5D_XFER_XFORM_CMP, H5D_XFER_XFORM_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register the property of flag for direct chunk write */ - /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_SIZE, &H5D_def_direct_chunk_flag_g, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the property of filter for direct chunk write */ - /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_SIZE, &H5D_def_direct_chunk_filters_g, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the property of offset for direct chunk write */ - /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_SIZE, &H5D_def_direct_chunk_offset_g, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the property of datasize for direct chunk write */ - /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_SIZE, &H5D_def_direct_chunk_datasize_g, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the property of flag for direct chunk read */ - /* (Note: this property should not have an encode/decode callback) */ - if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME, H5D_XFER_DIRECT_CHUNK_READ_FLAG_SIZE, &direct_chunk_read_flag, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the property of filter for direct chunk read */ - /* (Note: this property should not have an encode/decode callback) */ - if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME, H5D_XFER_DIRECT_CHUNK_READ_FILTERS_SIZE, &direct_chunk_read_filters, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the property of offset for direct chunk read */ - /* (Note: this property should not have an encode/decode callback) */ - if(H5P_register_real(pclass, H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME, H5D_XFER_DIRECT_CHUNK_READ_OFFSET_SIZE, &direct_chunk_read_offset, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dxfr_reg_prop() */ -- cgit v0.12 From 4fe4394c5856336345efd2e7293d703c9bfc6d1b Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 30 Apr 2018 15:04:45 -0700 Subject: Fixed a warning. --- src/H5Dio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5Dio.c b/src/H5Dio.c index 6dec5b0..b1117e9 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -410,7 +410,7 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of internal_offset[dset->shared->ndims] = 0; /* Write chunk */ - if (H5D__chunk_direct_write(dset, filters, internal_offset, data_size, buf) < 0) + if (H5D__chunk_direct_write(dset, filters, internal_offset, data_size_32, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data") done: -- cgit v0.12 From 3313fde3bb8b6cc5cfa3c8401615ac064f7cbdf9 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 30 Apr 2018 15:15:14 -0700 Subject: Normalize with trunk prior to update merge --- src/H5Dio.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/H5Dio.c b/src/H5Dio.c index b1117e9..1447f99 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -90,14 +90,14 @@ H5FL_DEFINE(H5D_chunk_map_t); * passed to this function with the PLIST_ID argument. * * The FILE_SPACE_ID can be the constant H5S_ALL which indicates - * that the entire file data space is to be referenced. + * that the entire file dataspace is to be referenced. * * The MEM_SPACE_ID can be the constant H5S_ALL in which case - * the memory data space is the same as the file data space + * the memory dataspace is the same as the file dataspace * defined when the dataset was created. * - * The number of elements in the memory data space must match - * the number of elements in the file data space. + * The number of elements in the memory dataspace must match + * the number of elements in the file dataspace. * * The PLIST_ID can be the constant H5P_DEFAULT in which * case the default data transfer properties are used. @@ -135,7 +135,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, /* Check dataspaces */ if (H5S_ALL != mem_space_id) { if (NULL == (mem_space = (const H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Check for valid selection */ if (H5S_SELECT_VALID(mem_space) != TRUE) @@ -143,7 +143,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, } if (H5S_ALL != file_space_id) { if (NULL == (file_space = (const H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Check for valid selection */ if (H5S_SELECT_VALID(file_space) != TRUE) @@ -257,14 +257,14 @@ done: * PLIST_ID argument. * * The FILE_SPACE_ID can be the constant H5S_ALL which indicates - * that the entire file data space is to be referenced. + * that the entire file dataspace is to be referenced. * * The MEM_SPACE_ID can be the constant H5S_ALL in which case - * the memory data space is the same as the file data space + * the memory dataspace is the same as the file dataspace * defined when the dataset was created. * - * The number of elements in the memory data space must match - * the number of elements in the file data space. + * The number of elements in the memory dataspace must match + * the number of elements in the file dataspace. * * The PLIST_ID can be the constant H5P_DEFAULT in which * case the default data transfer properties are used. @@ -441,7 +441,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, hbool_t type_info_init = FALSE; /* Whether the datatype info has been initialized */ H5S_t * projected_mem_space = NULL; /* If not NULL, ptr to dataspace containing a */ /* projection of the supplied mem_space to a new */ - /* data space with rank equal to that of */ + /* dataspace with rank equal to that of */ /* file_space. */ /* */ /* This field is only used if */ @@ -494,7 +494,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, /* Make certain that the number of elements in each selection is the same */ if(nelmts != (hsize_t)H5S_GET_SELECT_NPOINTS(file_space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest dataspaces have different sizes") /* Check for a NULL buffer, after the H5S_ALL dataspace selection has been handled */ if(NULL == buf) { @@ -653,7 +653,7 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, hbool_t type_info_init = FALSE; /* Whether the datatype info has been initialized */ H5S_t * projected_mem_space = NULL; /* If not NULL, ptr to dataspace containing a */ /* projection of the supplied mem_space to a new */ - /* data space with rank equal to that of */ + /* dataspace with rank equal to that of */ /* file_space. */ /* */ /* This field is only used if */ @@ -737,7 +737,7 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, /* Make certain that the number of elements in each selection is the same */ if(nelmts != (hsize_t)H5S_GET_SELECT_NPOINTS(file_space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest dataspaces have different sizes") /* Check for a NULL buffer, after the H5S_ALL dataspace selection has been handled */ if(NULL == buf) { @@ -797,7 +797,7 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, if(H5D__ioinfo_init(dataset, &type_info, &store, &io_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up I/O operation") - /* Allocate data space and initialize it if it hasn't been. */ + /* Allocate dataspace and initialize it if it hasn't been. */ if(nelmts > 0 && dataset->shared->dcpl_cache.efl.nused == 0 && !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage)) { hssize_t file_nelmts; /* Number of elements in file dataset's dataspace */ @@ -992,7 +992,7 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write, } /* end else */ /* - * Locate the type conversion function and data space conversion + * Locate the type conversion function and dataspace conversion * functions, and set up the element numbering information. If a data * type conversion is necessary then register datatype atoms. Data type * conversion is necessary if the user has set the `need_bkg' to a high -- cgit v0.12 From ac035bf3679dc539c6b35534f310539210322779 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 2 May 2018 10:11:49 -0700 Subject: * Fixed the error tests * Moved common functionality into helper functions --- src/H5Dio.c | 171 +++++++++++++++++++++----------------------- src/H5S.c | 53 +++++++++++++- src/H5Sprivate.h | 1 + test/testfiles/err_compat_1 | 2 +- test/testfiles/error_test_1 | 4 +- 5 files changed, 139 insertions(+), 92 deletions(-) diff --git a/src/H5Dio.c b/src/H5Dio.c index 95efa08..781bd17 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -50,7 +50,8 @@ /* Local Prototypes */ /********************/ -/* Setup/teardown routines */ +static herr_t H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, + hsize_t **offset_copy/*out*/); static herr_t H5D__ioinfo_init(H5D_t *dset, const H5D_type_info_t *type_info, H5D_storage_t *store, H5D_io_info_t *io_info); static herr_t H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, @@ -80,6 +81,56 @@ H5FL_DEFINE(H5D_chunk_map_t); /*------------------------------------------------------------------------- + * Function: H5D__get_offset_copy + * + * Purpose: Gets a copy of the user's offset array that is guaraneteed + * to be suitable for use by the library. + * + * The caller must free the constructed offset array. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t **offset_copy) +{ + unsigned u; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(dset); + HDassert(offset); + HDassert(offset_copy); + + if (NULL == (*offset_copy = (hsize_t *)H5MM_calloc(H5O_LAYOUT_NDIMS * sizeof(hsize_t)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate offset_copy array") + + /* The library's chunking code requires the offset to terminate with a zero. + * So transfer the offset array to an internal offset array that we + * can properly terminate (handled via the calloc call). + */ + for (u = 0; u < dset->shared->ndims; u++) { + /* Make sure the offset doesn't exceed the dataset's dimensions */ + if (offset[u] > dset->shared->curr_dims[u]) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset") + + /* Make sure the offset fall right on a chunk's boundary */ + if (offset[u] % dset->shared->layout.u.chunk.dim[u]) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset doesn't fall on chunks's boundary") + + (*offset_copy)[u] = offset[u]; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5D__get_offset_copy() */ + + + +/*------------------------------------------------------------------------- * Function: H5Dread * * Purpose: Reads (part of) a DSET from the file into application @@ -122,33 +173,17 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, H5TRACE6("e", "iiiiix", dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); - /* check arguments */ + /* Get dataset pointer */ if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID") if (NULL == dset->oloc.file) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") - if (mem_space_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid mem_space_id") - if (file_space_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file_space_id") - - /* Check dataspaces */ - if (H5S_ALL != mem_space_id) { - if (NULL == (mem_space = (const H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "mem_space_id is not a dataspace ID") - - /* Check for valid selection */ - if (H5S_SELECT_VALID(mem_space) != TRUE) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection + offset not within extent") - } - if (H5S_ALL != file_space_id) { - if (NULL == (file_space = (const H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "file_space_id is not a dataspace ID") - /* Check for valid selection */ - if (H5S_SELECT_VALID(file_space) != TRUE) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection + offset not within extent") - } + /* Get validated dataspace pointers */ + if (H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id") + if (H5S_get_validated_dataspace(file_space_id, &file_space) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id") /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) @@ -186,9 +221,8 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil void *buf) { H5D_t *dset = NULL; - hsize_t internal_offset[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + hsize_t *offset_copy = NULL; /* Internal copy of chunk offset */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "ii*h*Iu*x", dset_id, dxpl_id, offset, filters, buf); @@ -217,30 +251,19 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* The library's chunking code requires the offset to terminate with a zero. - * So transfer the offset array to an internal offset array that we - * can properly terminate (don't mess with the passed-in buffer). + /* Copy the user's offset array so we can be sure it's terminated properly. + * (we don't want to mess with the user's buffer). */ - for (u = 0; u < dset->shared->ndims; u++) { - /* Make sure the offset doesn't exceed the dataset's dimensions */ - if (offset[u] > dset->shared->curr_dims[u]) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset") - - /* Make sure the offset fall right on a chunk's boundary */ - if (offset[u] % dset->shared->layout.u.chunk.dim[u]) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset doesn't fall on chunks's boundary") - - internal_offset[u] = offset[u]; - } - - /* Terminate the offset with a zero */ - internal_offset[dset->shared->ndims] = 0; + if (H5D__get_offset_copy(dset, offset, &offset_copy) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array") /* Read the raw chunk */ - if (H5D__chunk_direct_read(dset, internal_offset, filters, buf) < 0) + if (H5D__chunk_direct_read(dset, offset_copy, filters, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data") done: + offset_copy = (hsize_t *)H5MM_xfree(offset_copy); + FUNC_LEAVE_API(ret_value) } /* end H5Dread_chunk() */ @@ -289,33 +312,17 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); - /* check arguments */ + /* Get dataset pointer and ensure it's associated with a file */ if (NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID") if (NULL == dset->oloc.file) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") - if (mem_space_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid mem_space_id") - if (file_space_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file_space_id") - - /* Check dataspace selections */ - if (H5S_ALL != mem_space_id) { - if (NULL == (mem_space = (const H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "mem_space_id is not a dataspace ID") - - /* Check for valid selection */ - if (H5S_SELECT_VALID(mem_space) != TRUE) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "memory selection + offset not within extent") - } - if (H5S_ALL != file_space_id) { - if (NULL == (file_space = (const H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "file_space_id is not a dataspace ID") - /* Check for valid selection */ - if (H5S_SELECT_VALID(file_space) != TRUE) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "file selection + offset not within extent") - } + /* Get validated dataspace pointers */ + if (H5S_get_validated_dataspace(mem_space_id, &mem_space) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from mem_space_id") + if (H5S_get_validated_dataspace(file_space_id, &file_space) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not get a validated dataspace from file_space_id") /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) @@ -353,10 +360,9 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of size_t data_size, const void *buf) { H5D_t *dset = NULL; - hsize_t internal_offset[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ - unsigned u; /* Local index variable */ - uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */ - herr_t ret_value = SUCCEED; /* Return value */ + hsize_t *offset_copy = NULL; /* Internal copy of chunk offset */ + uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iiIu*hz*x", dset_id, dxpl_id, filters, offset, data_size, buf); @@ -390,30 +396,19 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* The library's chunking code requires the offset to terminate with a zero. - * So transfer the offset array to an internal offset array that we - * can properly terminate (don't mess with the passed-in buffer). + /* Copy the user's offset array so we can be sure it's terminated properly. + * (we don't want to mess with the user's buffer). */ - for (u = 0; u < dset->shared->ndims; u++) { - /* Make sure the offset doesn't exceed the dataset's dimensions */ - if (offset[u] > dset->shared->curr_dims[u]) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset") - - /* Make sure the offset fall right on a chunk's boundary */ - if (offset[u] % dset->shared->layout.u.chunk.dim[u]) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset doesn't fall on chunks's boundary") - - internal_offset[u] = offset[u]; - } - - /* Terminate the offset with a zero */ - internal_offset[dset->shared->ndims] = 0; + if (H5D__get_offset_copy(dset, offset, &offset_copy) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array") /* Write chunk */ - if (H5D__chunk_direct_write(dset, filters, internal_offset, data_size_32, buf) < 0) + if (H5D__chunk_direct_write(dset, filters, offset_copy, data_size_32, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data") done: + offset_copy = (hsize_t *)H5MM_xfree(offset_copy); + FUNC_LEAVE_API(ret_value) } /* end H5Dwrite_chunk() */ diff --git a/src/H5S.c b/src/H5S.c index 3d09fa0..88c2f72 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -26,7 +26,6 @@ #include "H5Fprivate.h" /* Files */ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* Object headers */ #include "H5Spkg.h" /* Dataspaces */ @@ -208,6 +207,58 @@ H5S_term_package(void) FUNC_LEAVE_NOAPI(n) } /* end H5S_term_package() */ + + +/*-------------------------------------------------------------------------- + NAME + H5S_get_validiated_dataspace + PURPOSE + Get a pointer to a validated H5S_t pointer + USAGE + H5S_t *H5S_get_validated_space(dataspace_id, space) + hid_t space_id; IN: The ID of the dataspace + const H5S_t * space; OUT: A pointer to the dataspace + RETURNS + SUCCEED/FAIL + DESCRIPTION + Gets a pointer to a dataspace struct after validating it. The pointer + can be NULL (if the ID is H5S_ALL, for example). + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(space); + + if (space_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid space_id (ID cannot be a negative number)") + + if (H5S_ALL == space_id) { + /* No special dataspace struct for H5S_ALL */ + *space = NULL; + } + else { + /* Get the dataspace pointer */ + if (NULL == (*space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "space_id is not a dataspace ID") + + /* Check for valid selection */ + if (H5S_SELECT_VALID(*space) != TRUE) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection + offset not within extent") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5S_get_validated_dataspace() */ + /*-------------------------------------------------------------------------- NAME diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index b4ae1ff..15ce75d 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -215,6 +215,7 @@ H5_DLL herr_t H5S_set_extent_real(H5S_t *space, const hsize_t *size); H5_DLL herr_t H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, const hsize_t *max); H5_DLL H5S_t *H5S_create(H5S_class_t type); +H5_DLL herr_t H5S_get_validated_dataspace(hid_t space_id, const H5S_t **space/*out*/); H5_DLL H5S_t *H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/*rank*/]); H5_DLL herr_t H5S_set_version(H5F_t *f, H5S_t *ds); diff --git a/test/testfiles/err_compat_1 b/test/testfiles/err_compat_1 index d471e13..8190665 100644 --- a/test/testfiles/err_compat_1 +++ b/test/testfiles/err_compat_1 @@ -54,6 +54,6 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #001: (file name) line (number) in test_error2(): H5Dwrite shouldn't succeed major: Error API minor: Write failed - #002: (file name) line (number) in H5Dwrite(): not a dataset + #002: (file name) line (number) in H5Dwrite(): dset_id is not a dataset ID major: Invalid arguments to routine minor: Inappropriate type diff --git a/test/testfiles/error_test_1 b/test/testfiles/error_test_1 index b0b5085..02cfed8 100644 --- a/test/testfiles/error_test_1 +++ b/test/testfiles/error_test_1 @@ -21,7 +21,7 @@ Error Test-DIAG: Error detected in Error Program (1.0) thread (IDs): Testing error API based on data I/O HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #000: (file name) line (number) in H5Dwrite(): not a dataset + #000: (file name) line (number) in H5Dwrite(): dset_id is not a dataset ID major: Invalid arguments to routine minor: Inappropriate type Error Test-DIAG: Error detected in Error Program (1.0) thread (IDs): @@ -32,7 +32,7 @@ Error Test-DIAG: Error detected in Error Program (1.0) thread (IDs): major: Error in IO minor: Error in H5Dwrite HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): - #002: (file name) line (number) in H5Dwrite(): not a dataset + #002: (file name) line (number) in H5Dwrite(): dset_id is not a dataset ID major: Invalid arguments to routine minor: Inappropriate type -- cgit v0.12 From 1fa0c5a4b57e51788d95a73b965fdbd5a6d2af5c Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 4 May 2018 09:01:54 -0700 Subject: * Added H5DO compatibility functions. * Changed the offset copy to use an array on the stack. * Yanked some unused #defines. --- hl/src/H5DO.c | 63 +- hl/src/H5DOpublic.h | 6 + hl/test/CMakeLists.txt | 1 + hl/test/CMakeTests.cmake | 2 + hl/test/Makefile.am | 5 +- hl/test/test_h5do_compat.c | 2174 ++++++++++++++++++++++++++++++++++++++++++++ src/H5Dio.c | 107 ++- src/H5Dpublic.h | 11 - 8 files changed, 2292 insertions(+), 77 deletions(-) create mode 100644 hl/test/test_h5do_compat.c diff --git a/hl/src/H5DO.c b/hl/src/H5DO.c index 20d5a4a..3caa32b 100644 --- a/hl/src/H5DO.c +++ b/hl/src/H5DO.c @@ -11,11 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include -#include -#include - /* High-level library internal header file */ #include "H5HLprivate2.h" @@ -24,6 +19,57 @@ /*------------------------------------------------------------------------- + * Function: H5DOwrite_chunk + * + * Purpose: Writes an entire chunk to the file directly. + * + * The H5DOwrite_chunk() call was moved to H5Dwrite_chunk. This + * simple wrapper remains so that people can still link to the + * high-level library without changing their code. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, + size_t data_size, const void *buf) +{ + /* Call underlying H5D function */ + if (H5Dwrite_chunk(dset_id, dxpl_id, filters, offset, data_size, buf) < 0) + return FAIL; + else + return SUCCEED; + +} /* end H5DOwrite_chunk() */ + + +/*------------------------------------------------------------------------- + * Function: H5DOread_chunk + * + * Purpose: Reads an entire chunk from the file directly. + * + * The H5DOread_chunk() call was moved to H5Dread_chunk. This + * simple wrapper remains so that people can still link to the + * high-level library without changing their code. + * + * Return: Non-negative on success/Negative on failure + * + *--------------------------------------------------------------------------- + */ +herr_t +H5DOread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, + void *buf) +{ + /* Call underlying H5D function */ + if (H5Dread_chunk(dset_id, dxpl_id, offset, filters, buf) < 0) + return FAIL; + else + return SUCCEED; + } /* end H5DOread_chunk() */ + + +/*------------------------------------------------------------------------- * Function: H5DOappend() * * Purpose: To append elements to a dataset. @@ -113,7 +159,8 @@ H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension, goto done; /* Adjust the dimension size of the requested dimension, - but first record the old dimension size */ + * but first record the old dimension size + */ old_size = size[axis]; size[axis] += extension; if(size[axis] < old_size) @@ -125,7 +172,7 @@ H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension, /* Get the new dataspace of the dataset */ if(FAIL == (new_space_id = H5Dget_space(dset_id))) - goto done; + goto done; /* Select a hyperslab corresponding to the append operation */ for(u = 0 ; u < ndims ; u++) { @@ -181,7 +228,7 @@ H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension, goto done; /* Do a dataset flush */ - if(H5Dflush(dset_id) < 0) + if(H5Dflush(dset_id) < 0) goto done; } /* end if */ } /* end if */ diff --git a/hl/src/H5DOpublic.h b/hl/src/H5DOpublic.h index 7f83a7f..0271938 100644 --- a/hl/src/H5DOpublic.h +++ b/hl/src/H5DOpublic.h @@ -28,6 +28,12 @@ extern "C" { H5_HLDLL herr_t H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension, hid_t memtype, const void *buf); +/* Compatibility wrappers for functionality moved to H5D */ +H5_HLDLL herr_t H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, + const hsize_t *offset, size_t data_size, const void *buf); +H5_HLDLL herr_t H5DOread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, + uint32_t *filters /*out*/, void *buf /*out*/); + #ifdef __cplusplus } #endif diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 58869da..4e0ae83 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -48,6 +48,7 @@ HL_ADD_EXE (test_table) HL_ADD_EXE (test_ds) HL_ADD_EXE (test_ld) HL_ADD_EXE (test_dset_append) +HL_ADD_EXE (test_h5do_compat) # test_packet has two source files add_executable (hl_test_packet test_packet.c test_packet_vlen.c) diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake index 6f57a8c..4e945bc 100644 --- a/hl/test/CMakeTests.cmake +++ b/hl/test/CMakeTests.cmake @@ -79,6 +79,7 @@ add_test ( file_img1.h5 file_img2.h5 test_append.h5 + h5do_compat.h5 test_detach.h5 test_ds1.h5 test_ds2.h5 @@ -116,4 +117,5 @@ HL_add_test (test_ds) HL_add_test (test_packet) HL_add_test (test_ld) HL_add_test (test_dset_append) +HL_add_test (test_h5do_compat) diff --git a/hl/test/Makefile.am b/hl/test/Makefile.am index 35e680c..2e63438 100644 --- a/hl/test/Makefile.am +++ b/hl/test/Makefile.am @@ -27,7 +27,7 @@ LDADD=$(LIBH5_HL) $(LIBH5TEST) $(LIBHDF5) # Test programs. These are our main targets. They should be listed in the # order to be executed, generally most specific tests to least specific tests. TEST_PROG=test_lite test_image test_file_image test_table test_ds test_packet \ - test_ld test_dset_append + test_ld test_dset_append test_h5do_compat check_PROGRAMS=$(TEST_PROG) # These programs generate test files for the tests. They don't need to be @@ -45,7 +45,8 @@ endif CHECK_CLEANFILES+=combine_tables[1-2].h5 test_ds[1-9].h5 test_ds10.h5 \ test_image[1-3].h5 file_img[1-2].h5 test_lite[1-4].h5 test_table.h5 \ test_packet_table.h5 test_packet_compress.h5 test_detach.h5 \ - test_packet_table_vlen.h5 testfl_packet_table_vlen.h5 test_append.h5 + test_packet_table_vlen.h5 testfl_packet_table_vlen.h5 test_append.h5 \ + h5do_compat.h5 # Sources for test_packet executable test_packet_SOURCES=test_packet.c test_packet_vlen.c diff --git a/hl/test/test_h5do_compat.c b/hl/test/test_h5do_compat.c new file mode 100644 index 0000000..3ad4eaf --- /dev/null +++ b/hl/test/test_h5do_compat.c @@ -0,0 +1,2174 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* Copyright by The HDF Group. * +* Copyright by the Board of Trustees of the University of Illinois. * +* All rights reserved. * +* * +* This file is part of HDF5. The full HDF5 copyright notice, including * +* terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "h5hltest.h" +#include "H5DOpublic.h" + +/* This test is a direct copy of the direct_chunk.c test from test/ but + * with the H5Dread/write_chunk calls replaced with H5DOread/write_chunk. + * This ensures that older code which uses the H5DO calls can still + * work with the newer library. + */ + +#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER) +# define H5_ZLIB_HEADER "zlib.h" +#endif +#if defined(H5_ZLIB_HEADER) +# include H5_ZLIB_HEADER /* "zlib.h" */ +#endif + +#define FILE_NAME "h5do_compat.h5" + +/* Datasets for Direct Write tests */ +#define DATASETNAME1 "direct_write" +#define DATASETNAME2 "skip_one_filter" +#define DATASETNAME3 "skip_two_filters" +#define DATASETNAME4 "data_conv" +#define DATASETNAME5 "contiguous_dset" +#define DATASETNAME6 "invalid_argue" +#define DATASETNAME7 "overwrite_chunk" +/* Datasets for Direct Read tests */ +#define DATASETNAME8 "disabled_chunk_cache" +#define DATASETNAME9 "flush_chunk_cache" +#define DATASETNAME10 "read_w_valid_cache" +#define DATASETNAME11 "unallocated_chunk" +#define DATASETNAME12 "unfiltered_data" + +#define RANK 2 +#define NX 16 +#define NY 16 +#define CHUNK_NX 4 +#define CHUNK_NY 4 + +#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s))*H5_DOUBLE(1.001))+H5_DOUBLE(12.0)) + +/* Temporary filter IDs used for testing */ +#define H5Z_FILTER_BOGUS1 305 +#define H5Z_FILTER_BOGUS2 306 +#define ADD_ON 7 +#define FACTOR 3 + +/* Constants for the overwrite test */ +#define OVERWRITE_NDIMS 3 +#define OVERWRITE_CHUNK_NX 3 +#define OVERWRITE_CHUNK_2NX 6 +#define OVERWRITE_CHUNK_NY 2 +#define OVERWRITE_VALUE 42 + +/* Defines used in test_single_chunk_latest() */ +#define FILE "single_latest.h5" +#define DATASET "dataset" +#define DIM0 4 +#define DIM1 32 +#define CHUNK0 DIM0 +#define CHUNK1 DIM1 + +/* Local prototypes for filter functions */ +static size_t filter_bogus1(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); +static size_t filter_bogus2(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + +/* This message derives from H5Z */ +const H5Z_class2_t H5Z_BOGUS1[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_BOGUS1, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "bogus1", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + filter_bogus1, /* The actual filter function */ +}}; + +const H5Z_class2_t H5Z_BOGUS2[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_BOGUS2, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "bogus2", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + filter_bogus2, /* The actual filter function */ +}}; + +/*------------------------------------------------------------------------- + * Function: test_direct_chunk_write + * + * Purpose: Test the basic functionality of H5DOwrite_chunk + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Raymond Lu + * 30 November 2012 + * + *------------------------------------------------------------------------- + */ +#ifdef H5_HAVE_FILTER_DEFLATE +static int +test_direct_chunk_write (hid_t file) +{ + hid_t dataspace = -1, dataset = -1; + hid_t mem_space = -1; + hid_t cparms = -1, dxpl = -1; + hsize_t dims[2] = {NX, NY}; + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; + herr_t status; + int ret; + int data[NX][NY]; + int i, j, n; + + unsigned filter_mask = 0; + int direct_buf[CHUNK_NX][CHUNK_NY]; + int check_chunk[CHUNK_NX][CHUNK_NY]; + hsize_t offset[2] = {0, 0}; + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); + + const Bytef *z_src = (const Bytef*)(direct_buf); + Bytef *z_dst = NULL; /*destination buffer */ + uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); + uLong z_src_nbytes = (uLong)buf_size; + int aggression = 9; /* Compression aggression setting */ + void *outbuf = NULL; /* Pointer to new buffer */ + + hsize_t start[2]; /* Start of hyperslab */ + hsize_t stride[2]; /* Stride of hyperslab */ + hsize_t count[2]; /* Block count */ + hsize_t block[2]; /* Block sizes */ + + TESTING("basic functionality of H5DOwrite_chunk"); + + /* + * Create the data space with unlimited dimensions. + */ + if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + goto error; + + if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) + goto error; + + /* + * Modify dataset creation properties, i.e. enable chunking and compression + */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) + goto error; + + if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0) + goto error; + + /* + * Create a new dataset within the file using cparms + * creation properties. + */ + if((dataset = H5Dcreate2(file, DATASETNAME1, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + goto error; + + /* Initialize the dataset */ + for(i = n = 0; i < NX; i++) + for(j = 0; j < NY; j++) + data[i][j] = n++; + + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + + /* + * Write the data for the dataset. It should stay in the chunk cache. + * It will be evicted from the cache by the H5DOwrite_chunk calls. + */ + if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + dxpl, data)) < 0) + goto error; + + /* Initialize data for one chunk */ + for(i = n = 0; i < CHUNK_NX; i++) + for(j = 0; j < CHUNK_NY; j++) + direct_buf[i][j] = n++; + + /* Allocate output (compressed) buffer */ + outbuf = HDmalloc(z_dst_nbytes); + z_dst = (Bytef *)outbuf; + + /* Perform compression from the source to the destination buffer */ + ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression); + + /* Check for various zlib errors */ + if(Z_BUF_ERROR == ret) { + HDfprintf(stderr, "overflow"); + goto error; + } else if(Z_MEM_ERROR == ret) { + HDfprintf(stderr, "deflate memory error"); + goto error; + } else if(Z_OK != ret) { + HDfprintf(stderr, "other deflate error"); + goto error; + } + + /* Write the compressed chunk data repeatedly to cover all the chunks in the + * dataset, using the direct writing function. */ + for(i=0; i0) { + *int_ptr++ -= (int)ADD_ON; + buf_left -= (ssize_t)sizeof(int); + } /* end while */ + } /* end if */ + else { /* write */ + /* Add the "add on" value to all the data values */ + while(buf_left>0) { + *int_ptr++ += (int)ADD_ON; + buf_left -= (ssize_t)sizeof(int); + } /* end while */ + } /* end else */ + + return nbytes; +} /* filter_bogus1() */ + +/*------------------------------------------------------------------------- + * Function: filter_bogus2 + * + * Purpose: A bogus filter that multiplies the original value by FACTOR. + * + * Return: Success: Data chunk size + * + * Programmer: Raymond Lu + * 30 November 2012 + *------------------------------------------------------------------------- + */ +static size_t +filter_bogus2(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, + const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, + size_t *buf_size, void **buf) +{ + int *int_ptr=(int *)*buf; /* Pointer to the data values */ + ssize_t buf_left=(ssize_t)*buf_size; /* Amount of data buffer left to process */ + + if(flags & H5Z_FLAG_REVERSE) { /* read */ + /* Substract the "add on" value to all the data values */ + while(buf_left>0) { + *int_ptr++ /= (int)FACTOR; + buf_left -= (ssize_t)sizeof(int); + } /* end while */ + } /* end if */ + else { /* write */ + /* Add the "add on" value to all the data values */ + while(buf_left>0) { + *int_ptr++ *= (int)FACTOR; + buf_left -= (ssize_t)sizeof(int); + } /* end while */ + } /* end else */ + + return nbytes; +} /* filter_bogus2() */ + +/*------------------------------------------------------------------------- + * Function: test_skip_compress_write2 + * + * Purpose: Test skipping compression filter when there are three filters + * for the dataset + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Raymond Lu + * 30 November 2012 + * + *------------------------------------------------------------------------- + */ +static int +test_skip_compress_write2(hid_t file) +{ + hid_t dataspace = -1, dataset = -1; + hid_t mem_space = -1; + hid_t cparms = -1, dxpl = -1; + hsize_t dims[2] = {NX, NY}; + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; + herr_t status; + int i, j, n; + + unsigned filter_mask = 0; /* orig filter mask */ + int origin_direct_buf[CHUNK_NX][CHUNK_NY]; + int direct_buf[CHUNK_NX][CHUNK_NY]; + int check_chunk[CHUNK_NX][CHUNK_NY]; + hsize_t offset[2] = {0, 0}; + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); + int aggression = 9; /* Compression aggression setting */ + + unsigned read_filter_mask = 0; /* filter mask after direct read */ + int read_direct_buf[CHUNK_NX][CHUNK_NY]; + hsize_t read_buf_size = 0; /* buf size */ + + hsize_t start[2]; /* Start of hyperslab */ + hsize_t stride[2]; /* Stride of hyperslab */ + hsize_t count[2]; /* Block count */ + hsize_t block[2]; /* Block sizes */ + + TESTING("skipping compression filters but keep two other filters"); + + /* + * Create the data space with unlimited dimensions. + */ + if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + goto error; + + if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) + goto error; + + /* + * Modify dataset creation properties, i.e. enable chunking and compression. + * The order of filters is bogus 1 + deflate + bogus 2. + */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) + goto error; + + /* Register and enable first bogus filter */ + if(H5Zregister (H5Z_BOGUS1) < 0) + goto error; + + if(H5Pset_filter(cparms, H5Z_FILTER_BOGUS1, 0, (size_t)0, NULL) < 0) + goto error; + + /* Enable compression filter */ + if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0) + goto error; + + /* Register and enable second bogus filter */ + if(H5Zregister (H5Z_BOGUS2) < 0) + goto error; + + if(H5Pset_filter(cparms, H5Z_FILTER_BOGUS2, 0, (size_t)0, NULL) < 0) + goto error; + + /* + * Create a new dataset within the file using cparms + * creation properties. + */ + if((dataset = H5Dcreate2(file, DATASETNAME3, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + goto error; + + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + + /* Initialize data for one chunk. Apply operations of two bogus filters to the chunk */ + for(i = n = 0; i < CHUNK_NX; i++) + for(j = 0; j < CHUNK_NY; j++) { + origin_direct_buf[i][j] = n++; + direct_buf[i][j] = (origin_direct_buf[i][j] + ADD_ON) * FACTOR; + } + + /* write the uncompressed chunk data repeatedly to dataset, using the direct writing function. + * Indicate skipping the compression filter but keep the other two bogus filters */ + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY; + + /* compression filter is the middle one to be skipped */ + filter_mask = 0x00000002; + + if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0) + goto error; + + if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0) + goto error; + + if(H5Dclose(dataset) < 0) + goto error; + + if((dataset = H5Dopen2(file, DATASETNAME3, H5P_DEFAULT)) < 0) + goto error; + + /* + * Select hyperslab for one chunk in the file + */ + start[0] = CHUNK_NX; start[1] = CHUNK_NY; + stride[0] = 1; stride[1] = 1; + count[0] = 1; count[1] = 1; + block[0] = CHUNK_NX; block[1] = CHUNK_NY; + if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0) + goto error; + + /* Read the chunk back */ + if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0) + goto error; + + /* Check that the values read are the same as the values written */ + for(i = 0; i < CHUNK_NX; i++) { + for(j = 0; j < CHUNK_NY; j++) { + if(origin_direct_buf[i][j] != check_chunk[i][j]) { + HDprintf(" 1. Read different values than written."); + HDprintf(" At index %d,%d\n", i, j); + HDprintf(" origin_direct_buf=%d, check_chunk=%d\n", origin_direct_buf[i][j], check_chunk[i][j]); + goto error; + } + } + } + + /* Query chunk storage size */ + if((status = H5Dget_chunk_storage_size(dataset, offset, &read_buf_size)) < 0) + goto error; + if(read_buf_size != buf_size) + goto error; + + /* Read the raw chunk back */ + HDmemset(&read_direct_buf, 0, sizeof(read_direct_buf)); + if((status = H5DOread_chunk(dataset, H5P_DEFAULT, offset, &read_filter_mask, read_direct_buf)) < 0) + goto error; + if(read_filter_mask != filter_mask) + goto error; + + /* Check that the direct chunk read is the same as the chunk written */ + for(i = 0; i < CHUNK_NX; i++) { + for(j = 0; j < CHUNK_NY; j++) { + if(direct_buf[i][j] != read_direct_buf[i][j]) { + HDprintf(" 1. Read different values than written."); + HDprintf(" At index %d,%d\n", i, j); + HDprintf(" direct_buf=%d, read_direct_buf=%d\n", direct_buf[i][j], read_direct_buf[i][j]); + goto error; + } + } + } + + /* + * Close/release resources. + */ + H5Dclose(dataset); + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Dclose(dataset); + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + } H5E_END_TRY; + + H5_FAILED(); + return 1; +} /* test_skip_compress_write2() */ + +/*------------------------------------------------------------------------- + * Function: test_data_conv + * + * Purpose: Test data conversion + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Raymond Lu + * 30 November 2012 + * + *------------------------------------------------------------------------- + */ +static int +test_data_conv(hid_t file) +{ + typedef struct { + int a, b, c[4], d, e; + } src_type_t; + typedef struct { + int a, c[4], e; + } dst_type_t; + + hid_t dataspace = -1, dataset = -1; + hid_t mem_space = -1; + hid_t cparms = -1, dxpl = -1; + hsize_t dims[2] = {NX, NY}; + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; + herr_t status; + int i, j, n; + const hsize_t four = 4; + hid_t st=-1, dt=-1; + hid_t array_dt; + + unsigned filter_mask = 0; + src_type_t direct_buf[CHUNK_NX][CHUNK_NY]; + dst_type_t check_chunk[CHUNK_NX][CHUNK_NY]; + src_type_t read_chunk[CHUNK_NX][CHUNK_NY]; /* For H5DOread_chunk */ + + hsize_t offset[2] = {0, 0}; + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(src_type_t); + + hsize_t start[2]; /* Start of hyperslab */ + hsize_t stride[2]; /* Stride of hyperslab */ + hsize_t count[2]; /* Block count */ + hsize_t block[2]; /* Block sizes */ + + TESTING("data conversion for H5DOwrite_chunk/H5DOread_chunk"); + + /* + * Create the data space with unlimited dimensions. + */ + if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + goto error; + + if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) + goto error; + + /* + * Modify dataset creation properties, i.e. enable chunking + */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) + goto error; + + /* Build hdf5 datatypes */ + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); + if((st = H5Tcreate(H5T_COMPOUND, sizeof(src_type_t))) < 0 || + H5Tinsert(st, "a", HOFFSET(src_type_t, a), H5T_NATIVE_INT) < 0 || + H5Tinsert(st, "b", HOFFSET(src_type_t, b), H5T_NATIVE_INT) < 0 || + H5Tinsert(st, "c", HOFFSET(src_type_t, c), array_dt) < 0 || + H5Tinsert(st, "d", HOFFSET(src_type_t, d), H5T_NATIVE_INT) < 0 || + H5Tinsert(st, "e", HOFFSET(src_type_t, e), H5T_NATIVE_INT) < 0) + goto error; + + if(H5Tclose(array_dt) < 0) + goto error; + + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); + if((dt = H5Tcreate(H5T_COMPOUND, sizeof(dst_type_t))) < 0 || + H5Tinsert(dt, "a", HOFFSET(dst_type_t, a), H5T_NATIVE_INT) < 0 || + H5Tinsert(dt, "c", HOFFSET(dst_type_t, c), array_dt) < 0 || + H5Tinsert(dt, "e", HOFFSET(dst_type_t, e), H5T_NATIVE_INT) < 0) + goto error; + + if(H5Tclose(array_dt) < 0) + goto error; + + /* + * Create a new dataset within the file using cparms + * creation properties. + */ + if((dataset = H5Dcreate2(file, DATASETNAME4, st, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + goto error; + + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + + /* Initialize data for one chunk */ + for(i = n = 0; i < CHUNK_NX; i++) { + for(j = 0; j < CHUNK_NY; j++) { + (direct_buf[i][j]).a = i*j+0; + (direct_buf[i][j]).b = i*j+1; + (direct_buf[i][j]).c[0] = i*j+2; + (direct_buf[i][j]).c[1] = i*j+3; + (direct_buf[i][j]).c[2] = i*j+4; + (direct_buf[i][j]).c[3] = i*j+5; + (direct_buf[i][j]).d = i*j+6; + (direct_buf[i][j]).e = i*j+7; + } + } + + /* write the chunk data to dataset, using the direct writing function. + * There should be no data conversion involved. */ + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY; + + if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0) + goto error; + + if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0) + goto error; + + if(H5Dclose(dataset) < 0) + goto error; + + if((dataset = H5Dopen2(file, DATASETNAME4, H5P_DEFAULT)) < 0) + goto error; + + /* Use H5DOread_chunk() to read the uncompressed data */ + if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, read_chunk)) < 0) + goto error; + + /* Check that the values read are the same as the values written */ + for(i = 0; i < CHUNK_NX; i++) { + for(j = 0; j < CHUNK_NY; j++) { + if ((direct_buf[i][j]).a != (read_chunk[i][j]).a || + (direct_buf[i][j]).b != (read_chunk[i][j]).b || + (direct_buf[i][j]).c[0] != (read_chunk[i][j]).c[0] || + (direct_buf[i][j]).c[1] != (read_chunk[i][j]).c[1] || + (direct_buf[i][j]).c[2] != (read_chunk[i][j]).c[2] || + (direct_buf[i][j]).c[3] != (read_chunk[i][j]).c[3] || + (direct_buf[i][j]).d != (read_chunk[i][j]).d || + (direct_buf[i][j]).e != (read_chunk[i][j]).e) { + HDprintf(" 1. Read different values than written."); + HDprintf(" At index %d,%d\n", i, j); + HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1], + (direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d, (direct_buf[i][j]).e); + HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + (read_chunk[i][j]).a, (read_chunk[i][j]).b, (read_chunk[i][j]).c[0], (read_chunk[i][j]).c[1], + (read_chunk[i][j]).c[2], (read_chunk[i][j]).c[3], (read_chunk[i][j]).d, (read_chunk[i][j]).e); + + goto error; + } + } + } + + /* + * Select hyperslab for the chunk just written in the file + */ + start[0] = CHUNK_NX; start[1] = CHUNK_NY; + stride[0] = 1; stride[1] = 1; + count[0] = 1; count[1] = 1; + block[0] = CHUNK_NX; block[1] = CHUNK_NY; + if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0) + goto error; + + /* Read the chunk back. Data should be converted */ + if((status = H5Dread(dataset, dt, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0) + goto error; + + /* Check that the values read are the same as the values written */ + for(i = 0; i < CHUNK_NX; i++) { + for(j = 0; j < CHUNK_NY; j++) { + if ((direct_buf[i][j]).a != (check_chunk[i][j]).a || + (direct_buf[i][j]).c[0] != (check_chunk[i][j]).c[0] || + (direct_buf[i][j]).c[1] != (check_chunk[i][j]).c[1] || + (direct_buf[i][j]).c[2] != (check_chunk[i][j]).c[2] || + (direct_buf[i][j]).c[3] != (check_chunk[i][j]).c[3] || + (direct_buf[i][j]).e != (check_chunk[i][j]).e) { + HDprintf(" 1. Read different values than written."); + HDprintf(" At index %d,%d\n", i, j); + HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1], + (direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d, (direct_buf[i][j]).e); + HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n", + (check_chunk[i][j]).a, (check_chunk[i][j]).c[0], (check_chunk[i][j]).c[1], (check_chunk[i][j]).c[2], + (check_chunk[i][j]).c[3], (check_chunk[i][j]).e); + + goto error; + } + } + } + + /* + * Close/release resources. + */ + H5Dclose(dataset); + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + H5Tclose(st); + H5Tclose(dt); + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Dclose(dataset); + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + H5Tclose(st); + H5Tclose(dt); + } H5E_END_TRY; + + H5_FAILED(); + return 1; +} /* test_data_conv() */ + +/*------------------------------------------------------------------------- + * Function: test_invalid_parameters + * + * Purpose: Test invalid parameters for H5DOwrite_chunk and H5DOread_chunk + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Raymond Lu + * 30 November 2012 + * + *------------------------------------------------------------------------- + */ +static int +test_invalid_parameters(hid_t file) +{ + hid_t dataspace = -1, dataset = -1; + hid_t mem_space = -1; + hid_t cparms = -1, dxpl = -1; + hsize_t dims[2] = {NX, NY}; + hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; + herr_t status; + int i, j, n; + + unsigned filter_mask = 0; + int direct_buf[CHUNK_NX][CHUNK_NY]; + hsize_t offset[2] = {0, 0}; + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); + int aggression = 9; /* Compression aggression setting */ + + hsize_t chunk_nbytes; /* Chunk size */ + + TESTING("invalid parameters for H5DOwrite_chunk/H5DOread_chunk"); + + /* + * Create the data space with unlimited dimensions. + */ + if((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0) + goto error; + + if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) + goto error; + + /* + * Modify dataset creation properties + */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + + /* + * Create a new contiguous dataset to verify H5DOwrite_chunk/H5DOread_chunk doesn't work + */ + if((dataset = H5Dcreate2(file, DATASETNAME5, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + goto error; + + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + + /* Initialize data for one chunk */ + for(i = n = 0; i < CHUNK_NX; i++) + for(j = 0; j < CHUNK_NY; j++) { + direct_buf[i][j] = n++; + } + + /* Try to write the chunk data to contiguous dataset. It should fail */ + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY; + + H5E_BEGIN_TRY { + if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Try to get chunk size for a contiguous dataset. It should fail */ + H5E_BEGIN_TRY { + if((status = H5Dget_chunk_storage_size(dataset, offset, &chunk_nbytes)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Try to H5DOread_chunk from the contiguous dataset. It should fail */ + H5E_BEGIN_TRY { + if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + if(H5Dclose(dataset) < 0) + goto error; + + + /* Create a chunked dataset with compression filter */ + if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) + goto error; + + if((status = H5Pset_deflate( cparms, (unsigned ) aggression)) < 0) + goto error; + + /* + * Create a new dataset within the file using cparms + * creation properties. + */ + if((dataset = H5Dcreate2(file, DATASETNAME6, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, H5P_DEFAULT)) < 0) + goto error; + + /* Check invalid dataset ID for H5DOwrite_chunk and H5DOread_chunk */ + H5E_BEGIN_TRY { + if((status = H5DOwrite_chunk((hid_t)-1, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + H5E_BEGIN_TRY { + if((status = H5DOread_chunk((hid_t)-1, dxpl, offset, &filter_mask, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Check invalid DXPL ID for H5DOwrite_chunk and H5DOread_chunk */ + H5E_BEGIN_TRY { + if((status = H5DOwrite_chunk(dataset, (hid_t)-1, filter_mask, offset, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + H5E_BEGIN_TRY { + if((status = H5DOread_chunk(dataset, (hid_t)-1, offset, &filter_mask, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Check invalid OFFSET for H5DOwrite_chunk and H5DOread_chunk */ + H5E_BEGIN_TRY { + if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, NULL, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + H5E_BEGIN_TRY { + if((status = H5DOread_chunk(dataset, dxpl, NULL, &filter_mask, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Check when OFFSET is out of dataset range for H5DOwrite_chunk and H5DOread_chunk */ + offset[0] = NX + 1; + offset[1] = NY; + H5E_BEGIN_TRY { + if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + H5E_BEGIN_TRY { + if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Check when OFFSET is not on chunk boundary for H5DOwrite_chunk and H5DOread_chunk */ + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY + 1; + H5E_BEGIN_TRY { + if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + H5E_BEGIN_TRY { + if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Check invalid buffer size for H5DOwrite_chunk only */ + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY; + buf_size = 0; + H5E_BEGIN_TRY { + if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) + goto error; + } H5E_END_TRY; + + /* Check invalid data buffer for H5DOwrite_chunk and H5DOread_chunk */ + buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); + H5E_BEGIN_TRY { + if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, NULL)) != FAIL) + goto error; + } H5E_END_TRY; + + H5E_BEGIN_TRY { + if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, NULL)) != FAIL) + goto error; + } H5E_END_TRY; + + if(H5Dclose(dataset) < 0) + goto error; + + /* + * Close/release resources. + */ + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Dclose(dataset); + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + } H5E_END_TRY; + + H5_FAILED(); + return 1; +} /* test_invalid_parameters() */ + +/*------------------------------------------------------------------------- + * Function: test_direct_chunk_read_no_cache + * + * Purpose: Test the basic functionality of H5DOread_chunk with the + * chunk cache diabled. + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Matthew Strong (GE Healthcare) + * 14 February 2016 + * + *------------------------------------------------------------------------- + */ +#ifdef H5_HAVE_FILTER_DEFLATE +static int +test_direct_chunk_read_no_cache (hid_t file) +{ + hid_t dataspace = -1, dataset = -1; + hid_t mem_space = -1; + hid_t cparms = -1, dxpl = -1, dapl = -1; + hsize_t dims[2] = {NX, NY}; + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; + herr_t status; /* status from H5 function calls */ + int ret; /* deflate return status */ + int data[NX][NY]; + int i, j, k, l, n; /* local index variables */ + + unsigned filter_mask = 0; /* filter mask returned from H5DOread_chunk */ + int direct_buf[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread and manually decompressed */ + int check_chunk[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread */ + hsize_t offset[2]; /* chunk offset used for H5DOread_chunk */ + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); + + Bytef *z_src = NULL; /* source buffer */ + uLongf z_src_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); + Bytef *z_dst = (Bytef*)(direct_buf); + uLong z_dst_nbytes = (uLong)buf_size; + int aggression = 9; /* Compression aggression setting */ + void *outbuf = NULL; /* Pointer to new buffer */ + + hsize_t start[2]; /* Start of hyperslab */ + hsize_t stride[2]; /* Stride of hyperslab */ + hsize_t count[2]; /* Block count */ + hsize_t block[2]; /* Block sizes */ + + TESTING("basic functionality of H5DOread_chunk (chunk cache disabled)"); + + /* Create the data space with unlimited dimensions. */ + if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + goto error; + if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) + goto error; + + /* Modify dataset creation properties, i.e. enable chunking and compression */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto error; + if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) + goto error; + if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0) + goto error; + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + goto error; + + /* Disable chunk cache by setting number of slots to 0 */ + if((status = H5Pset_chunk_cache(dapl, 0, H5D_CHUNK_CACHE_NBYTES_DEFAULT, H5D_CHUNK_CACHE_W0_DEFAULT)) < 0) + goto error; + + /* Create a new dataset within the file using cparms creation properties. */ + if((dataset = H5Dcreate2(file, DATASETNAME8, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + cparms, dapl)) < 0) + goto error; + + /* Initialize the dataset */ + for(i = n = 0; i < NX; i++) + for(j = 0; j < NY; j++) + data[i][j] = n++; + + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + goto error; + + /* Write the data for the dataset. + * Data will skip chunk cache and go directly to disk. */ + if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + dxpl, data)) < 0) + goto error; + + /* Allocate output (compressed) buffer */ + outbuf = HDmalloc(z_src_nbytes); + z_src = (Bytef *)outbuf; + + /* For each chunk in the dataset, compare the result of H5Dread and H5DOread_chunk. */ + for(i=0; ishared->ndims; u++) { /* Make sure the offset doesn't exceed the dataset's dimensions */ if (offset[u] > dset->shared->curr_dims[u]) @@ -120,7 +119,7 @@ H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t **offset_ if (offset[u] % dset->shared->layout.u.chunk.dim[u]) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset doesn't fall on chunks's boundary") - (*offset_copy)[u] = offset[u]; + offset_copy[u] = offset[u]; } done: @@ -133,30 +132,30 @@ done: /*------------------------------------------------------------------------- * Function: H5Dread * - * Purpose: Reads (part of) a DSET from the file into application - * memory BUF. The part of the dataset to read is defined with - * MEM_SPACE_ID and FILE_SPACE_ID. The data points are - * converted from their file type to the MEM_TYPE_ID specified. - * Additional miscellaneous data transfer properties can be - * passed to this function with the PLIST_ID argument. + * Purpose: Reads (part of) a DSET from the file into application + * memory BUF. The part of the dataset to read is defined with + * MEM_SPACE_ID and FILE_SPACE_ID. The data points are + * converted from their file type to the MEM_TYPE_ID specified. + * Additional miscellaneous data transfer properties can be + * passed to this function with the PLIST_ID argument. * - * The FILE_SPACE_ID can be the constant H5S_ALL which indicates - * that the entire file dataspace is to be referenced. + * The FILE_SPACE_ID can be the constant H5S_ALL which indicates + * that the entire file dataspace is to be referenced. * - * The MEM_SPACE_ID can be the constant H5S_ALL in which case - * the memory dataspace is the same as the file dataspace - * defined when the dataset was created. + * The MEM_SPACE_ID can be the constant H5S_ALL in which case + * the memory dataspace is the same as the file dataspace + * defined when the dataset was created. * - * The number of elements in the memory dataspace must match - * the number of elements in the file dataspace. + * The number of elements in the memory dataspace must match + * the number of elements in the file dataspace. * - * The PLIST_ID can be the constant H5P_DEFAULT in which - * case the default data transfer properties are used. + * The PLIST_ID can be the constant H5P_DEFAULT in which + * case the default data transfer properties are used. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 + * Programmer: Robb Matzke + * Thursday, December 4, 1997 * *------------------------------------------------------------------------- */ @@ -221,8 +220,8 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil void *buf) { H5D_t *dset = NULL; - hsize_t *offset_copy = NULL; /* Internal copy of chunk offset */ - herr_t ret_value = SUCCEED; /* Return value */ + hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "ii*h*Iu*x", dset_id, dxpl_id, offset, filters, buf); @@ -254,7 +253,7 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil /* Copy the user's offset array so we can be sure it's terminated properly. * (we don't want to mess with the user's buffer). */ - if (H5D__get_offset_copy(dset, offset, &offset_copy) < 0) + if (H5D__get_offset_copy(dset, offset, offset_copy) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array") /* Read the raw chunk */ @@ -262,40 +261,38 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data") done: - offset_copy = (hsize_t *)H5MM_xfree(offset_copy); - FUNC_LEAVE_API(ret_value) } /* end H5Dread_chunk() */ /*------------------------------------------------------------------------- - * Function: H5Dwrite + * Function: H5Dwrite * - * Purpose: Writes (part of) a DSET from application memory BUF to the - * file. The part of the dataset to write is defined with the - * MEM_SPACE_ID and FILE_SPACE_ID arguments. The data points - * are converted from their current type (MEM_TYPE_ID) to their - * file datatype. Additional miscellaneous data transfer - * properties can be passed to this function with the - * PLIST_ID argument. + * Purpose: Writes (part of) a DSET from application memory BUF to the + * file. The part of the dataset to write is defined with the + * MEM_SPACE_ID and FILE_SPACE_ID arguments. The data points + * are converted from their current type (MEM_TYPE_ID) to their + * file datatype. Additional miscellaneous data transfer + * properties can be passed to this function with the + * PLIST_ID argument. * - * The FILE_SPACE_ID can be the constant H5S_ALL which indicates - * that the entire file dataspace is to be referenced. + * The FILE_SPACE_ID can be the constant H5S_ALL which indicates + * that the entire file dataspace is to be referenced. * - * The MEM_SPACE_ID can be the constant H5S_ALL in which case - * the memory dataspace is the same as the file dataspace - * defined when the dataset was created. + * The MEM_SPACE_ID can be the constant H5S_ALL in which case + * the memory dataspace is the same as the file dataspace + * defined when the dataset was created. * - * The number of elements in the memory dataspace must match - * the number of elements in the file dataspace. + * The number of elements in the memory dataspace must match + * the number of elements in the file dataspace. * - * The PLIST_ID can be the constant H5P_DEFAULT in which - * case the default data transfer properties are used. + * The PLIST_ID can be the constant H5P_DEFAULT in which + * case the default data transfer properties are used. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 + * Programmer: Robb Matzke + * Thursday, December 4, 1997 * *------------------------------------------------------------------------- */ @@ -360,9 +357,9 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of size_t data_size, const void *buf) { H5D_t *dset = NULL; - hsize_t *offset_copy = NULL; /* Internal copy of chunk offset */ - uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */ - herr_t ret_value = SUCCEED; /* Return value */ + hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */ + uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "iiIu*hz*x", dset_id, dxpl_id, filters, offset, data_size, buf); @@ -399,7 +396,7 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of /* Copy the user's offset array so we can be sure it's terminated properly. * (we don't want to mess with the user's buffer). */ - if (H5D__get_offset_copy(dset, offset, &offset_copy) < 0) + if (H5D__get_offset_copy(dset, offset, offset_copy) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array") /* Write chunk */ @@ -407,8 +404,6 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data") done: - offset_copy = (hsize_t *)H5MM_xfree(offset_copy); - FUNC_LEAVE_API(ret_value) } /* end H5Dwrite_chunk() */ diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index be80cef..6cec3f5 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -35,17 +35,6 @@ /* Bit flags for the H5Pset_chunk_opts() and H5Pget_chunk_opts() */ #define H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS (0x0002u) -/* Property names for H5DOwrite_chunk */ -#define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME "direct_chunk_flag" -#define H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME "direct_chunk_filters" -#define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME "direct_chunk_offset" -#define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME "direct_chunk_datasize" - -/* Property names for H5DOread_chunk */ -#define H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME "direct_chunk_read_flag" -#define H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME "direct_chunk_read_offset" -#define H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME "direct_chunk_read_filters" - /*******************/ /* Public Typedefs */ /*******************/ -- cgit v0.12 From def636edb0ce9a2627015c336efe9f9f836c7101 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 4 May 2018 14:13:56 -0700 Subject: Stripped out most of the duplicated functionality in the H5DO compat test. --- hl/test/test_h5do_compat.c | 2201 +++----------------------------------------- 1 file changed, 151 insertions(+), 2050 deletions(-) diff --git a/hl/test/test_h5do_compat.c b/hl/test/test_h5do_compat.c index 3ad4eaf..486f9da 100644 --- a/hl/test/test_h5do_compat.c +++ b/hl/test/test_h5do_compat.c @@ -20,2155 +20,256 @@ * work with the newer library. */ -#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER) -# define H5_ZLIB_HEADER "zlib.h" -#endif -#if defined(H5_ZLIB_HEADER) -# include H5_ZLIB_HEADER /* "zlib.h" */ -#endif +#define FILE_NAME "h5do_compat.h5" +#define DATASET_NAME "direct_chunk_io" -#define FILE_NAME "h5do_compat.h5" - -/* Datasets for Direct Write tests */ -#define DATASETNAME1 "direct_write" -#define DATASETNAME2 "skip_one_filter" -#define DATASETNAME3 "skip_two_filters" -#define DATASETNAME4 "data_conv" -#define DATASETNAME5 "contiguous_dset" -#define DATASETNAME6 "invalid_argue" -#define DATASETNAME7 "overwrite_chunk" -/* Datasets for Direct Read tests */ -#define DATASETNAME8 "disabled_chunk_cache" -#define DATASETNAME9 "flush_chunk_cache" -#define DATASETNAME10 "read_w_valid_cache" -#define DATASETNAME11 "unallocated_chunk" -#define DATASETNAME12 "unfiltered_data" - -#define RANK 2 -#define NX 16 -#define NY 16 -#define CHUNK_NX 4 -#define CHUNK_NY 4 - -#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s))*H5_DOUBLE(1.001))+H5_DOUBLE(12.0)) - -/* Temporary filter IDs used for testing */ -#define H5Z_FILTER_BOGUS1 305 -#define H5Z_FILTER_BOGUS2 306 -#define ADD_ON 7 -#define FACTOR 3 - -/* Constants for the overwrite test */ -#define OVERWRITE_NDIMS 3 -#define OVERWRITE_CHUNK_NX 3 -#define OVERWRITE_CHUNK_2NX 6 -#define OVERWRITE_CHUNK_NY 2 -#define OVERWRITE_VALUE 42 - -/* Defines used in test_single_chunk_latest() */ -#define FILE "single_latest.h5" -#define DATASET "dataset" -#define DIM0 4 -#define DIM1 32 -#define CHUNK0 DIM0 -#define CHUNK1 DIM1 - -/* Local prototypes for filter functions */ -static size_t filter_bogus1(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); -static size_t filter_bogus2(unsigned int flags, size_t cd_nelmts, - const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); - -/* This message derives from H5Z */ -const H5Z_class2_t H5Z_BOGUS1[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_BOGUS1, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "bogus1", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - filter_bogus1, /* The actual filter function */ -}}; - -const H5Z_class2_t H5Z_BOGUS2[1] = {{ - H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_BOGUS2, /* Filter id number */ - 1, 1, /* Encoding and decoding enabled */ - "bogus2", /* Filter name for debugging */ - NULL, /* The "can apply" callback */ - NULL, /* The "set local" callback */ - filter_bogus2, /* The actual filter function */ -}}; +#define NX 8 +#define CHUNK_NX 4 + /*------------------------------------------------------------------------- * Function: test_direct_chunk_write * * Purpose: Test the basic functionality of H5DOwrite_chunk * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: Raymond Lu - * 30 November 2012 + * Return: Success: An identifer for the dataset used in the tests + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_FILTER_DEFLATE -static int -test_direct_chunk_write (hid_t file) +static hid_t +create_dataset(hid_t fid) { - hid_t dataspace = -1, dataset = -1; - hid_t mem_space = -1; - hid_t cparms = -1, dxpl = -1; - hsize_t dims[2] = {NX, NY}; - hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; - hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; - herr_t status; - int ret; - int data[NX][NY]; - int i, j, n; - - unsigned filter_mask = 0; - int direct_buf[CHUNK_NX][CHUNK_NY]; - int check_chunk[CHUNK_NX][CHUNK_NY]; - hsize_t offset[2] = {0, 0}; - size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); - - const Bytef *z_src = (const Bytef*)(direct_buf); - Bytef *z_dst = NULL; /*destination buffer */ - uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); - uLong z_src_nbytes = (uLong)buf_size; - int aggression = 9; /* Compression aggression setting */ - void *outbuf = NULL; /* Pointer to new buffer */ - - hsize_t start[2]; /* Start of hyperslab */ - hsize_t stride[2]; /* Stride of hyperslab */ - hsize_t count[2]; /* Block count */ - hsize_t block[2]; /* Block sizes */ - - TESTING("basic functionality of H5DOwrite_chunk"); - - /* - * Create the data space with unlimited dimensions. - */ - if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) - goto error; - - if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) - goto error; - - /* - * Modify dataset creation properties, i.e. enable chunking and compression - */ - if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto error; - - if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) - goto error; - - if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0) - goto error; - - /* - * Create a new dataset within the file using cparms - * creation properties. - */ - if((dataset = H5Dcreate2(file, DATASETNAME1, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, - cparms, H5P_DEFAULT)) < 0) - goto error; - - /* Initialize the dataset */ - for(i = n = 0; i < NX; i++) - for(j = 0; j < NY; j++) - data[i][j] = n++; - - if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - goto error; - - /* - * Write the data for the dataset. It should stay in the chunk cache. - * It will be evicted from the cache by the H5DOwrite_chunk calls. - */ - if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - dxpl, data)) < 0) - goto error; - - /* Initialize data for one chunk */ - for(i = n = 0; i < CHUNK_NX; i++) - for(j = 0; j < CHUNK_NY; j++) - direct_buf[i][j] = n++; - - /* Allocate output (compressed) buffer */ - outbuf = HDmalloc(z_dst_nbytes); - z_dst = (Bytef *)outbuf; - - /* Perform compression from the source to the destination buffer */ - ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression); - - /* Check for various zlib errors */ - if(Z_BUF_ERROR == ret) { - HDfprintf(stderr, "overflow"); - goto error; - } else if(Z_MEM_ERROR == ret) { - HDfprintf(stderr, "deflate memory error"); - goto error; - } else if(Z_OK != ret) { - HDfprintf(stderr, "other deflate error"); - goto error; - } - - /* Write the compressed chunk data repeatedly to cover all the chunks in the - * dataset, using the direct writing function. */ - for(i=0; i0) { - *int_ptr++ -= (int)ADD_ON; - buf_left -= (ssize_t)sizeof(int); - } /* end while */ - } /* end if */ - else { /* write */ - /* Add the "add on" value to all the data values */ - while(buf_left>0) { - *int_ptr++ += (int)ADD_ON; - buf_left -= (ssize_t)sizeof(int); - } /* end while */ - } /* end else */ - - return nbytes; -} /* filter_bogus1() */ - -/*------------------------------------------------------------------------- - * Function: filter_bogus2 - * - * Purpose: A bogus filter that multiplies the original value by FACTOR. - * - * Return: Success: Data chunk size - * - * Programmer: Raymond Lu - * 30 November 2012 - *------------------------------------------------------------------------- - */ -static size_t -filter_bogus2(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, - const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, - size_t *buf_size, void **buf) -{ - int *int_ptr=(int *)*buf; /* Pointer to the data values */ - ssize_t buf_left=(ssize_t)*buf_size; /* Amount of data buffer left to process */ - - if(flags & H5Z_FLAG_REVERSE) { /* read */ - /* Substract the "add on" value to all the data values */ - while(buf_left>0) { - *int_ptr++ /= (int)FACTOR; - buf_left -= (ssize_t)sizeof(int); - } /* end while */ - } /* end if */ - else { /* write */ - /* Add the "add on" value to all the data values */ - while(buf_left>0) { - *int_ptr++ *= (int)FACTOR; - buf_left -= (ssize_t)sizeof(int); - } /* end while */ - } /* end else */ - - return nbytes; -} /* filter_bogus2() */ +} /* test_direct_chunk_write() */ + /*------------------------------------------------------------------------- - * Function: test_skip_compress_write2 + * Function: test_direct_chunk_read * - * Purpose: Test skipping compression filter when there are three filters - * for the dataset + * Purpose: Test the basic functionality of H5DOread_chunk * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: Raymond Lu - * 30 November 2012 + * Return: Success: 0 + * Failure: 1 * *------------------------------------------------------------------------- */ static int -test_skip_compress_write2(hid_t file) +test_direct_chunk_read(hid_t did) { - hid_t dataspace = -1, dataset = -1; - hid_t mem_space = -1; - hid_t cparms = -1, dxpl = -1; - hsize_t dims[2] = {NX, NY}; - hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; - hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; - herr_t status; - int i, j, n; - - unsigned filter_mask = 0; /* orig filter mask */ - int origin_direct_buf[CHUNK_NX][CHUNK_NY]; - int direct_buf[CHUNK_NX][CHUNK_NY]; - int check_chunk[CHUNK_NX][CHUNK_NY]; - hsize_t offset[2] = {0, 0}; - size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); - int aggression = 9; /* Compression aggression setting */ + hid_t mem_sid = H5I_INVALID_HID; + hid_t file_sid = H5I_INVALID_HID; + hsize_t dims[1] = {NX}; + hsize_t chunk_dims[1] = {CHUNK_NX}; - unsigned read_filter_mask = 0; /* filter mask after direct read */ - int read_direct_buf[CHUNK_NX][CHUNK_NY]; - hsize_t read_buf_size = 0; /* buf size */ + unsigned filter_mask; + int chunk_data[CHUNK_NX]; /* Chunk read with H5DOread_chunk */ + int check[CHUNK_NX]; /* Chunk read with H5Dread */ + hsize_t offset[1]; - hsize_t start[2]; /* Start of hyperslab */ - hsize_t stride[2]; /* Stride of hyperslab */ - hsize_t count[2]; /* Block count */ - hsize_t block[2]; /* Block sizes */ + hsize_t start[1]; /* Start of hyperslab */ + hsize_t stride[1]; /* Stride of hyperslab */ + hsize_t count[1]; /* Block count */ + hsize_t block[1]; /* Block sizes */ - TESTING("skipping compression filters but keep two other filters"); + int i,j; - /* - * Create the data space with unlimited dimensions. - */ - if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) - goto error; - - if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) - goto error; - - /* - * Modify dataset creation properties, i.e. enable chunking and compression. - * The order of filters is bogus 1 + deflate + bogus 2. - */ - if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto error; - - if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) - goto error; - - /* Register and enable first bogus filter */ - if(H5Zregister (H5Z_BOGUS1) < 0) - goto error; - - if(H5Pset_filter(cparms, H5Z_FILTER_BOGUS1, 0, (size_t)0, NULL) < 0) - goto error; - - /* Enable compression filter */ - if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0) - goto error; - - /* Register and enable second bogus filter */ - if(H5Zregister (H5Z_BOGUS2) < 0) - goto error; - - if(H5Pset_filter(cparms, H5Z_FILTER_BOGUS2, 0, (size_t)0, NULL) < 0) - goto error; - - /* - * Create a new dataset within the file using cparms - * creation properties. - */ - if((dataset = H5Dcreate2(file, DATASETNAME3, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, - cparms, H5P_DEFAULT)) < 0) - goto error; - - if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - goto error; - - /* Initialize data for one chunk. Apply operations of two bogus filters to the chunk */ - for(i = n = 0; i < CHUNK_NX; i++) - for(j = 0; j < CHUNK_NY; j++) { - origin_direct_buf[i][j] = n++; - direct_buf[i][j] = (origin_direct_buf[i][j] + ADD_ON) * FACTOR; - } - - /* write the uncompressed chunk data repeatedly to dataset, using the direct writing function. - * Indicate skipping the compression filter but keep the other two bogus filters */ - offset[0] = CHUNK_NX; - offset[1] = CHUNK_NY; - - /* compression filter is the middle one to be skipped */ - filter_mask = 0x00000002; - - if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0) - goto error; - - if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0) - goto error; - - if(H5Dclose(dataset) < 0) - goto error; - - if((dataset = H5Dopen2(file, DATASETNAME3, H5P_DEFAULT)) < 0) - goto error; + TESTING("H5DOread_chunk wrapper"); - /* - * Select hyperslab for one chunk in the file - */ - start[0] = CHUNK_NX; start[1] = CHUNK_NY; - stride[0] = 1; stride[1] = 1; - count[0] = 1; count[1] = 1; - block[0] = CHUNK_NX; block[1] = CHUNK_NY; - if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0) - goto error; - - /* Read the chunk back */ - if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0) - goto error; - - /* Check that the values read are the same as the values written */ - for(i = 0; i < CHUNK_NX; i++) { - for(j = 0; j < CHUNK_NY; j++) { - if(origin_direct_buf[i][j] != check_chunk[i][j]) { - HDprintf(" 1. Read different values than written."); - HDprintf(" At index %d,%d\n", i, j); - HDprintf(" origin_direct_buf=%d, check_chunk=%d\n", origin_direct_buf[i][j], check_chunk[i][j]); - goto error; - } - } - } - - /* Query chunk storage size */ - if((status = H5Dget_chunk_storage_size(dataset, offset, &read_buf_size)) < 0) - goto error; - if(read_buf_size != buf_size) - goto error; + /* Create dataspaces for reading */ + if ((mem_sid = H5Screate_simple(1, chunk_dims, NULL)) < 0) + TEST_ERROR + if ((file_sid = H5Screate_simple(1, dims, NULL)) < 0) + TEST_ERROR - /* Read the raw chunk back */ - HDmemset(&read_direct_buf, 0, sizeof(read_direct_buf)); - if((status = H5DOread_chunk(dataset, H5P_DEFAULT, offset, &read_filter_mask, read_direct_buf)) < 0) - goto error; - if(read_filter_mask != filter_mask) - goto error; - - /* Check that the direct chunk read is the same as the chunk written */ - for(i = 0; i < CHUNK_NX; i++) { - for(j = 0; j < CHUNK_NY; j++) { - if(direct_buf[i][j] != read_direct_buf[i][j]) { - HDprintf(" 1. Read different values than written."); - HDprintf(" At index %d,%d\n", i, j); - HDprintf(" direct_buf=%d, read_direct_buf=%d\n", direct_buf[i][j], read_direct_buf[i][j]); - goto error; - } - } + /* For each chunk in the dataset, compare the result of H5Dread and H5DOread_chunk. */ + for (i = 0; i < NX/CHUNK_NX; i++) { + + /* Select hyperslab for one chunk in the file */ + start[0] = (hsize_t)i * CHUNK_NX; + stride[0] = 1; + count[0] = 1; + block[0] = CHUNK_NX; + + /* Hyperslab selection equals single chunk */ + if (H5Sselect_hyperslab(file_sid, H5S_SELECT_SET, start, stride, count, block) < 0) + TEST_ERROR + + /* Read the chunk back */ + if (H5Dread(did, H5T_NATIVE_INT, mem_sid, file_sid, H5P_DEFAULT, check) < 0) + TEST_ERROR + + /* Read the raw chunk back */ + HDmemset(chunk_data, 0, CHUNK_NX * sizeof(int)); + filter_mask = UINT_MAX; + offset[0] = (hsize_t)i * CHUNK_NX; + if (H5DOread_chunk(did, H5P_DEFAULT, offset, &filter_mask, chunk_data) < 0) + TEST_ERROR + + /* Check filter mask return value */ + if (filter_mask != 0) + TEST_ERROR + + /* Check that the values are correct */ + for (j = 0; j < CHUNK_NX; j++) + if (chunk_data[i] != check[i]) + TEST_ERROR } - /* - * Close/release resources. - */ - H5Dclose(dataset); - H5Sclose(mem_space); - H5Sclose(dataspace); - H5Pclose(cparms); - H5Pclose(dxpl); + /* Close */ + if (H5Sclose(mem_sid) < 0) + TEST_ERROR + if (H5Sclose(file_sid) < 0) + TEST_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Dclose(dataset); - H5Sclose(mem_space); - H5Sclose(dataspace); - H5Pclose(cparms); - H5Pclose(dxpl); + H5Sclose(mem_sid); + H5Sclose(file_sid); } H5E_END_TRY; H5_FAILED(); return 1; -} /* test_skip_compress_write2() */ +} /* test_direct_chunk_read() */ + /*------------------------------------------------------------------------- - * Function: test_data_conv - * - * Purpose: Test data conversion + * Function: Main function * - * Return: Success: 0 - * Failure: 1 + * Purpose: Test direct chunk write function H5DOwrite_chunk and + * chunk direct read function H5DOread_chunk * - * Programmer: Raymond Lu - * 30 November 2012 + * Return: Success: 0 + * Failure: 1 * *------------------------------------------------------------------------- */ -static int -test_data_conv(hid_t file) +int main( void ) { - typedef struct { - int a, b, c[4], d, e; - } src_type_t; - typedef struct { - int a, c[4], e; - } dst_type_t; - - hid_t dataspace = -1, dataset = -1; - hid_t mem_space = -1; - hid_t cparms = -1, dxpl = -1; - hsize_t dims[2] = {NX, NY}; - hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; - hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; - herr_t status; - int i, j, n; - const hsize_t four = 4; - hid_t st=-1, dt=-1; - hid_t array_dt; - - unsigned filter_mask = 0; - src_type_t direct_buf[CHUNK_NX][CHUNK_NY]; - dst_type_t check_chunk[CHUNK_NX][CHUNK_NY]; - src_type_t read_chunk[CHUNK_NX][CHUNK_NY]; /* For H5DOread_chunk */ - - hsize_t offset[2] = {0, 0}; - size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(src_type_t); - - hsize_t start[2]; /* Start of hyperslab */ - hsize_t stride[2]; /* Stride of hyperslab */ - hsize_t count[2]; /* Block count */ - hsize_t block[2]; /* Block sizes */ + hid_t fid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + int nerrors = 0; - TESTING("data conversion for H5DOwrite_chunk/H5DOread_chunk"); - - /* - * Create the data space with unlimited dimensions. - */ - if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) - goto error; - - if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) - goto error; - - /* - * Modify dataset creation properties, i.e. enable chunking - */ - if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((fid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) + if ((did = create_dataset(fid)) < 0) goto error; - /* Build hdf5 datatypes */ - array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); - if((st = H5Tcreate(H5T_COMPOUND, sizeof(src_type_t))) < 0 || - H5Tinsert(st, "a", HOFFSET(src_type_t, a), H5T_NATIVE_INT) < 0 || - H5Tinsert(st, "b", HOFFSET(src_type_t, b), H5T_NATIVE_INT) < 0 || - H5Tinsert(st, "c", HOFFSET(src_type_t, c), array_dt) < 0 || - H5Tinsert(st, "d", HOFFSET(src_type_t, d), H5T_NATIVE_INT) < 0 || - H5Tinsert(st, "e", HOFFSET(src_type_t, e), H5T_NATIVE_INT) < 0) - goto error; + nerrors += test_direct_chunk_write(did); + nerrors += test_direct_chunk_read(did); - if(H5Tclose(array_dt) < 0) + if (H5Dclose(did) < 0) goto error; - - array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); - if((dt = H5Tcreate(H5T_COMPOUND, sizeof(dst_type_t))) < 0 || - H5Tinsert(dt, "a", HOFFSET(dst_type_t, a), H5T_NATIVE_INT) < 0 || - H5Tinsert(dt, "c", HOFFSET(dst_type_t, c), array_dt) < 0 || - H5Tinsert(dt, "e", HOFFSET(dst_type_t, e), H5T_NATIVE_INT) < 0) - goto error; - - if(H5Tclose(array_dt) < 0) - goto error; - - /* - * Create a new dataset within the file using cparms - * creation properties. - */ - if((dataset = H5Dcreate2(file, DATASETNAME4, st, dataspace, H5P_DEFAULT, - cparms, H5P_DEFAULT)) < 0) - goto error; - - if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - goto error; - - /* Initialize data for one chunk */ - for(i = n = 0; i < CHUNK_NX; i++) { - for(j = 0; j < CHUNK_NY; j++) { - (direct_buf[i][j]).a = i*j+0; - (direct_buf[i][j]).b = i*j+1; - (direct_buf[i][j]).c[0] = i*j+2; - (direct_buf[i][j]).c[1] = i*j+3; - (direct_buf[i][j]).c[2] = i*j+4; - (direct_buf[i][j]).c[3] = i*j+5; - (direct_buf[i][j]).d = i*j+6; - (direct_buf[i][j]).e = i*j+7; - } - } - - /* write the chunk data to dataset, using the direct writing function. - * There should be no data conversion involved. */ - offset[0] = CHUNK_NX; - offset[1] = CHUNK_NY; - - if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0) - goto error; - - if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0) - goto error; - - if(H5Dclose(dataset) < 0) - goto error; - - if((dataset = H5Dopen2(file, DATASETNAME4, H5P_DEFAULT)) < 0) - goto error; - - /* Use H5DOread_chunk() to read the uncompressed data */ - if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, read_chunk)) < 0) - goto error; - - /* Check that the values read are the same as the values written */ - for(i = 0; i < CHUNK_NX; i++) { - for(j = 0; j < CHUNK_NY; j++) { - if ((direct_buf[i][j]).a != (read_chunk[i][j]).a || - (direct_buf[i][j]).b != (read_chunk[i][j]).b || - (direct_buf[i][j]).c[0] != (read_chunk[i][j]).c[0] || - (direct_buf[i][j]).c[1] != (read_chunk[i][j]).c[1] || - (direct_buf[i][j]).c[2] != (read_chunk[i][j]).c[2] || - (direct_buf[i][j]).c[3] != (read_chunk[i][j]).c[3] || - (direct_buf[i][j]).d != (read_chunk[i][j]).d || - (direct_buf[i][j]).e != (read_chunk[i][j]).e) { - HDprintf(" 1. Read different values than written."); - HDprintf(" At index %d,%d\n", i, j); - HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", - (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1], - (direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d, (direct_buf[i][j]).e); - HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", - (read_chunk[i][j]).a, (read_chunk[i][j]).b, (read_chunk[i][j]).c[0], (read_chunk[i][j]).c[1], - (read_chunk[i][j]).c[2], (read_chunk[i][j]).c[3], (read_chunk[i][j]).d, (read_chunk[i][j]).e); - - goto error; - } - } - } - - /* - * Select hyperslab for the chunk just written in the file - */ - start[0] = CHUNK_NX; start[1] = CHUNK_NY; - stride[0] = 1; stride[1] = 1; - count[0] = 1; count[1] = 1; - block[0] = CHUNK_NX; block[1] = CHUNK_NY; - if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0) - goto error; - - /* Read the chunk back. Data should be converted */ - if((status = H5Dread(dataset, dt, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0) - goto error; - - /* Check that the values read are the same as the values written */ - for(i = 0; i < CHUNK_NX; i++) { - for(j = 0; j < CHUNK_NY; j++) { - if ((direct_buf[i][j]).a != (check_chunk[i][j]).a || - (direct_buf[i][j]).c[0] != (check_chunk[i][j]).c[0] || - (direct_buf[i][j]).c[1] != (check_chunk[i][j]).c[1] || - (direct_buf[i][j]).c[2] != (check_chunk[i][j]).c[2] || - (direct_buf[i][j]).c[3] != (check_chunk[i][j]).c[3] || - (direct_buf[i][j]).e != (check_chunk[i][j]).e) { - HDprintf(" 1. Read different values than written."); - HDprintf(" At index %d,%d\n", i, j); - HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", - (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1], - (direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d, (direct_buf[i][j]).e); - HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n", - (check_chunk[i][j]).a, (check_chunk[i][j]).c[0], (check_chunk[i][j]).c[1], (check_chunk[i][j]).c[2], - (check_chunk[i][j]).c[3], (check_chunk[i][j]).e); - - goto error; - } - } - } - - /* - * Close/release resources. - */ - H5Dclose(dataset); - H5Sclose(mem_space); - H5Sclose(dataspace); - H5Pclose(cparms); - H5Pclose(dxpl); - H5Tclose(st); - H5Tclose(dt); - - PASSED(); - return 0; - -error: - H5E_BEGIN_TRY { - H5Dclose(dataset); - H5Sclose(mem_space); - H5Sclose(dataspace); - H5Pclose(cparms); - H5Pclose(dxpl); - H5Tclose(st); - H5Tclose(dt); - } H5E_END_TRY; - - H5_FAILED(); - return 1; -} /* test_data_conv() */ - -/*------------------------------------------------------------------------- - * Function: test_invalid_parameters - * - * Purpose: Test invalid parameters for H5DOwrite_chunk and H5DOread_chunk - * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: Raymond Lu - * 30 November 2012 - * - *------------------------------------------------------------------------- - */ -static int -test_invalid_parameters(hid_t file) -{ - hid_t dataspace = -1, dataset = -1; - hid_t mem_space = -1; - hid_t cparms = -1, dxpl = -1; - hsize_t dims[2] = {NX, NY}; - hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; - herr_t status; - int i, j, n; - - unsigned filter_mask = 0; - int direct_buf[CHUNK_NX][CHUNK_NY]; - hsize_t offset[2] = {0, 0}; - size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); - int aggression = 9; /* Compression aggression setting */ - - hsize_t chunk_nbytes; /* Chunk size */ - - TESTING("invalid parameters for H5DOwrite_chunk/H5DOread_chunk"); - - /* - * Create the data space with unlimited dimensions. - */ - if((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0) - goto error; - - if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) - goto error; - - /* - * Modify dataset creation properties - */ - if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto error; - - /* - * Create a new contiguous dataset to verify H5DOwrite_chunk/H5DOread_chunk doesn't work - */ - if((dataset = H5Dcreate2(file, DATASETNAME5, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, - cparms, H5P_DEFAULT)) < 0) - goto error; - - if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - goto error; - - /* Initialize data for one chunk */ - for(i = n = 0; i < CHUNK_NX; i++) - for(j = 0; j < CHUNK_NY; j++) { - direct_buf[i][j] = n++; - } - - /* Try to write the chunk data to contiguous dataset. It should fail */ - offset[0] = CHUNK_NX; - offset[1] = CHUNK_NY; - - H5E_BEGIN_TRY { - if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - /* Try to get chunk size for a contiguous dataset. It should fail */ - H5E_BEGIN_TRY { - if((status = H5Dget_chunk_storage_size(dataset, offset, &chunk_nbytes)) != FAIL) - goto error; - } H5E_END_TRY; - - /* Try to H5DOread_chunk from the contiguous dataset. It should fail */ - H5E_BEGIN_TRY { - if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - if(H5Dclose(dataset) < 0) - goto error; - - - /* Create a chunked dataset with compression filter */ - if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) - goto error; - - if((status = H5Pset_deflate( cparms, (unsigned ) aggression)) < 0) - goto error; - - /* - * Create a new dataset within the file using cparms - * creation properties. - */ - if((dataset = H5Dcreate2(file, DATASETNAME6, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, - cparms, H5P_DEFAULT)) < 0) - goto error; - - /* Check invalid dataset ID for H5DOwrite_chunk and H5DOread_chunk */ - H5E_BEGIN_TRY { - if((status = H5DOwrite_chunk((hid_t)-1, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - H5E_BEGIN_TRY { - if((status = H5DOread_chunk((hid_t)-1, dxpl, offset, &filter_mask, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - /* Check invalid DXPL ID for H5DOwrite_chunk and H5DOread_chunk */ - H5E_BEGIN_TRY { - if((status = H5DOwrite_chunk(dataset, (hid_t)-1, filter_mask, offset, buf_size, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - H5E_BEGIN_TRY { - if((status = H5DOread_chunk(dataset, (hid_t)-1, offset, &filter_mask, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - /* Check invalid OFFSET for H5DOwrite_chunk and H5DOread_chunk */ - H5E_BEGIN_TRY { - if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, NULL, buf_size, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - H5E_BEGIN_TRY { - if((status = H5DOread_chunk(dataset, dxpl, NULL, &filter_mask, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - /* Check when OFFSET is out of dataset range for H5DOwrite_chunk and H5DOread_chunk */ - offset[0] = NX + 1; - offset[1] = NY; - H5E_BEGIN_TRY { - if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - H5E_BEGIN_TRY { - if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - /* Check when OFFSET is not on chunk boundary for H5DOwrite_chunk and H5DOread_chunk */ - offset[0] = CHUNK_NX; - offset[1] = CHUNK_NY + 1; - H5E_BEGIN_TRY { - if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - H5E_BEGIN_TRY { - if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - /* Check invalid buffer size for H5DOwrite_chunk only */ - offset[0] = CHUNK_NX; - offset[1] = CHUNK_NY; - buf_size = 0; - H5E_BEGIN_TRY { - if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL) - goto error; - } H5E_END_TRY; - - /* Check invalid data buffer for H5DOwrite_chunk and H5DOread_chunk */ - buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); - H5E_BEGIN_TRY { - if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, NULL)) != FAIL) - goto error; - } H5E_END_TRY; - - H5E_BEGIN_TRY { - if((status = H5DOread_chunk(dataset, dxpl, offset, &filter_mask, NULL)) != FAIL) - goto error; - } H5E_END_TRY; - - if(H5Dclose(dataset) < 0) - goto error; - - /* - * Close/release resources. - */ - H5Sclose(mem_space); - H5Sclose(dataspace); - H5Pclose(cparms); - H5Pclose(dxpl); - - PASSED(); - return 0; - -error: - H5E_BEGIN_TRY { - H5Dclose(dataset); - H5Sclose(mem_space); - H5Sclose(dataspace); - H5Pclose(cparms); - H5Pclose(dxpl); - } H5E_END_TRY; - - H5_FAILED(); - return 1; -} /* test_invalid_parameters() */ - -/*------------------------------------------------------------------------- - * Function: test_direct_chunk_read_no_cache - * - * Purpose: Test the basic functionality of H5DOread_chunk with the - * chunk cache diabled. - * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: Matthew Strong (GE Healthcare) - * 14 February 2016 - * - *------------------------------------------------------------------------- - */ -#ifdef H5_HAVE_FILTER_DEFLATE -static int -test_direct_chunk_read_no_cache (hid_t file) -{ - hid_t dataspace = -1, dataset = -1; - hid_t mem_space = -1; - hid_t cparms = -1, dxpl = -1, dapl = -1; - hsize_t dims[2] = {NX, NY}; - hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; - hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; - herr_t status; /* status from H5 function calls */ - int ret; /* deflate return status */ - int data[NX][NY]; - int i, j, k, l, n; /* local index variables */ - - unsigned filter_mask = 0; /* filter mask returned from H5DOread_chunk */ - int direct_buf[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread and manually decompressed */ - int check_chunk[CHUNK_NX][CHUNK_NY]; /* chunk read with H5Dread */ - hsize_t offset[2]; /* chunk offset used for H5DOread_chunk */ - size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); - - Bytef *z_src = NULL; /* source buffer */ - uLongf z_src_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); - Bytef *z_dst = (Bytef*)(direct_buf); - uLong z_dst_nbytes = (uLong)buf_size; - int aggression = 9; /* Compression aggression setting */ - void *outbuf = NULL; /* Pointer to new buffer */ - - hsize_t start[2]; /* Start of hyperslab */ - hsize_t stride[2]; /* Stride of hyperslab */ - hsize_t count[2]; /* Block count */ - hsize_t block[2]; /* Block sizes */ - - TESTING("basic functionality of H5DOread_chunk (chunk cache disabled)"); - - /* Create the data space with unlimited dimensions. */ - if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) - goto error; - if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) - goto error; - - /* Modify dataset creation properties, i.e. enable chunking and compression */ - if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto error; - if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) - goto error; - if((status = H5Pset_deflate( cparms, (unsigned) aggression)) < 0) - goto error; - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - goto error; - - /* Disable chunk cache by setting number of slots to 0 */ - if((status = H5Pset_chunk_cache(dapl, 0, H5D_CHUNK_CACHE_NBYTES_DEFAULT, H5D_CHUNK_CACHE_W0_DEFAULT)) < 0) - goto error; - - /* Create a new dataset within the file using cparms creation properties. */ - if((dataset = H5Dcreate2(file, DATASETNAME8, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, - cparms, dapl)) < 0) - goto error; - - /* Initialize the dataset */ - for(i = n = 0; i < NX; i++) - for(j = 0; j < NY; j++) - data[i][j] = n++; - - if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - goto error; - - /* Write the data for the dataset. - * Data will skip chunk cache and go directly to disk. */ - if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - dxpl, data)) < 0) - goto error; - - /* Allocate output (compressed) buffer */ - outbuf = HDmalloc(z_src_nbytes); - z_src = (Bytef *)outbuf; - - /* For each chunk in the dataset, compare the result of H5Dread and H5DOread_chunk. */ - for(i=0; i Date: Fri, 4 May 2018 14:16:56 -0700 Subject: Updated commenting in the H5DO compat test. --- hl/test/test_h5do_compat.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/hl/test/test_h5do_compat.c b/hl/test/test_h5do_compat.c index 486f9da..dc30414 100644 --- a/hl/test/test_h5do_compat.c +++ b/hl/test/test_h5do_compat.c @@ -1,23 +1,21 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright by The HDF Group. * -* Copyright by the Board of Trustees of the University of Illinois. * -* All rights reserved. * -* * -* This file is part of HDF5. The full HDF5 copyright notice, including * -* terms governing use, modification, and redistribution, is contained in * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * -* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "h5hltest.h" #include "H5DOpublic.h" -/* This test is a direct copy of the direct_chunk.c test from test/ but - * with the H5Dread/write_chunk calls replaced with H5DOread/write_chunk. - * This ensures that older code which uses the H5DO calls can still - * work with the newer library. +/* This test is a minimal test to ensure that the H5DO compatibility wrappers + * work correctly. */ #define FILE_NAME "h5do_compat.h5" -- cgit v0.12 From 1c11ddec6d6d9aa39ea7d56a183e7a096bc9076f Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 4 May 2018 16:43:06 -0700 Subject: Added deprecated symbol wrappers for the H5DOwrite/read_chunk wrappers. --- hl/src/H5DO.c | 3 +++ hl/src/H5DOpublic.h | 8 ++++++++ hl/test/test_h5do_compat.c | 15 ++++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/hl/src/H5DO.c b/hl/src/H5DO.c index 3caa32b..057c43b 100644 --- a/hl/src/H5DO.c +++ b/hl/src/H5DO.c @@ -17,6 +17,7 @@ /* public LT prototypes */ #include "H5DOpublic.h" +#ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- * Function: H5DOwrite_chunk @@ -68,6 +69,8 @@ H5DOread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fi return SUCCEED; } /* end H5DOread_chunk() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + /*------------------------------------------------------------------------- * Function: H5DOappend() diff --git a/hl/src/H5DOpublic.h b/hl/src/H5DOpublic.h index 0271938..e09ebca 100644 --- a/hl/src/H5DOpublic.h +++ b/hl/src/H5DOpublic.h @@ -28,12 +28,20 @@ extern "C" { H5_HLDLL herr_t H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension, hid_t memtype, const void *buf); +/* Symbols defined for compatibility with previous versions of the HDF5 API. + * + * Use of these symbols is deprecated. + */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + /* Compatibility wrappers for functionality moved to H5D */ H5_HLDLL herr_t H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, size_t data_size, const void *buf); H5_HLDLL herr_t H5DOread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters /*out*/, void *buf /*out*/); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + #ifdef __cplusplus } #endif diff --git a/hl/test/test_h5do_compat.c b/hl/test/test_h5do_compat.c index dc30414..4df5eef 100644 --- a/hl/test/test_h5do_compat.c +++ b/hl/test/test_h5do_compat.c @@ -18,6 +18,8 @@ * work correctly. */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + #define FILE_NAME "h5do_compat.h5" #define DATASET_NAME "direct_chunk_io" @@ -228,9 +230,11 @@ error: return 1; } /* test_direct_chunk_read() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + /*------------------------------------------------------------------------- - * Function: Main function + * Function: main * * Purpose: Test direct chunk write function H5DOwrite_chunk and * chunk direct read function H5DOread_chunk @@ -242,6 +246,14 @@ error: */ int main( void ) { +#ifdef H5_NO_DEPRECATED_SYMBOLS + + HDputs("Direct chunk read/write wrapper tests SKIPPED."); + HDputs("(Backward compatibility not configured)"); + return EXIT_SUCCESS; + +#else + hid_t fid = H5I_INVALID_HID; hid_t did = H5I_INVALID_HID; int nerrors = 0; @@ -270,4 +282,5 @@ int main( void ) error: HDputs("*** TESTS FAILED ***"); return EXIT_FAILURE; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end main() */ -- cgit v0.12 From b178d80be0946e3d332ecf575b2f145837cc9454 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Mon, 14 May 2018 12:26:48 -0500 Subject: Changes made based on feedback from pull request #1039. --- c++/src/H5Location.cpp | 4 +- fortran/src/H5Af.c | 3 +- fortran/src/H5Of.c | 15 +-- hl/src/H5DS.c | 28 ++--- src/H5Gdeprec.c | 2 +- src/H5Gnode.c | 4 +- src/H5Oint.c | 27 +++-- src/H5Opublic.h | 16 ++- test/cache_tagging.c | 8 +- test/cork.c | 40 +++---- test/dsets.c | 14 +-- test/flushrefresh.c | 8 +- test/genall5.c | 6 +- test/getname.c | 2 +- test/h5test.c | 2 +- test/links.c | 88 +++++++------- test/mount.c | 64 +++++----- test/mtime.c | 4 +- test/objcopy.c | 162 +++++++++++++------------- test/tattr.c | 20 ++-- test/th5o.c | 53 +++++---- test/titerate.c | 10 +- test/tmisc.c | 16 +-- test/trefer.c | 2 +- test/unlink.c | 12 +- tools/lib/h5diff.c | 12 +- tools/lib/h5diff_array.c | 4 +- tools/lib/h5tools.c | 8 +- tools/lib/h5tools_dump.c | 2 +- tools/lib/h5tools_ref.c | 4 +- tools/lib/h5tools_str.c | 2 +- tools/lib/h5tools_utils.c | 6 +- tools/lib/h5trav.c | 10 +- tools/src/h5dump/h5dump.c | 3 +- tools/src/h5dump/h5dump_ddl.c | 12 +- tools/src/h5dump/h5dump_xml.c | 10 +- tools/src/h5format_convert/h5format_convert.c | 2 +- tools/src/h5ls/h5ls.c | 6 +- tools/src/h5repack/h5repack.c | 2 +- tools/src/h5repack/h5repack_refs.c | 2 +- 40 files changed, 346 insertions(+), 349 deletions(-) diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 5e01a74..8df7467 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -1827,7 +1827,7 @@ H5O_type_t H5Location::childObjType(const char* objname) const H5O_type_t objtype = H5O_TYPE_UNKNOWN; // Use C API to get information of the object - herr_t ret_value = H5Oget_info_by_name2(getId(), objname, &objinfo, 0, H5P_DEFAULT); + herr_t ret_value = H5Oget_info_by_name2(getId(), objname, &objinfo, H5O_INFO_BASIC, H5P_DEFAULT); // Throw exception if C API returns failure if (ret_value < 0) @@ -1902,7 +1902,7 @@ H5O_type_t H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_ite H5O_type_t objtype = H5O_TYPE_UNKNOWN; // Use C API to get information of the object - ret_value = H5Oget_info_by_idx2(getId(), objname, index_type, order, index, &objinfo, 0, H5P_DEFAULT); + ret_value = H5Oget_info_by_idx2(getId(), objname, index_type, order, index, &objinfo, H5O_INFO_BASIC, H5P_DEFAULT); // Throw exception if C API returns failure if (ret_value < 0) diff --git a/fortran/src/H5Af.c b/fortran/src/H5Af.c index c75f19e..31a18fc 100644 --- a/fortran/src/H5Af.c +++ b/fortran/src/H5Af.c @@ -143,8 +143,7 @@ h5aget_num_attrs_c (hid_t_f *obj_id, int_f *attr_num) /* * Call H5Oget_info function. */ - /* TO DO: See H5Opublic.h: #define H5O_INFO_NUM_ATTRS 0x0002u Fill in the num_attrs field */ - if(H5Oget_info2((hid_t)*obj_id, &oinfo, (unsigned)2) < 0) + if(H5Oget_info2((hid_t)*obj_id, &oinfo, H5O_INFO_NUM_ATTRS) < 0) HGOTO_DONE(FAIL); /* Set number of attributes */ diff --git a/fortran/src/H5Of.c b/fortran/src/H5Of.c index 63d0084..1c32861 100644 --- a/fortran/src/H5Of.c +++ b/fortran/src/H5Of.c @@ -250,8 +250,7 @@ h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, /* * Call H5Ovisit */ - /* TO DO: See H5Opublic.h: #define H5O_INFO_ALL (H5O_INFO_TIME|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR|H5O_INFO_META_SIZE) */ - func_ret_value = H5Ovisit( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, op, op_data, (unsigned)15); + func_ret_value = H5Ovisit( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, op, op_data, H5O_INFO_ALL); ret_value = (int_f)func_ret_value; @@ -331,9 +330,8 @@ h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *l /* * Call H5Oinfo_by_name function. */ - /* TO DO: See H5Opublic.h: #define H5O_INFO_ALL (H5O_INFO_TIME|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR|H5O_INFO_META_SIZE) */ if(H5Oget_info_by_name2((hid_t)*loc_id, c_name, - &Oinfo, (unsigned)15, (hid_t)*lapl_id) < 0) + &Oinfo, H5O_INFO_ALL, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); ret_value = fill_h5o_info_t_f(Oinfo,object_info); @@ -387,9 +385,8 @@ h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen, /* * Call H5Oinfo_by_idx function. */ - /* TO DO: See H5Opublic.h: #define H5O_INFO_ALL (H5O_INFO_TIME|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR|H5O_INFO_META_SIZE) */ if(H5Oget_info_by_idx2((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, - &Oinfo, (unsigned)15, (hid_t)*lapl_id) < 0) + &Oinfo, H5O_INFO_ALL, (hid_t)*lapl_id) < 0) HGOTO_DONE(FAIL); ret_value = fill_h5o_info_t_f(Oinfo,object_info); @@ -427,8 +424,7 @@ h5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info) /* * Call H5Oinfo_by_name function. */ - /* TO DO: See H5Opublic.h: #define H5O_INFO_ALL (H5O_INFO_TIME|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR|H5O_INFO_META_SIZE) */ - if(H5Oget_info2((hid_t)*object_id, &Oinfo, (unsigned)15) < 0) + if(H5Oget_info2((hid_t)*object_id, &Oinfo, H5O_INFO_ALL) < 0) HGOTO_DONE(FAIL); ret_value = fill_h5o_info_t_f(Oinfo,object_info); @@ -536,9 +532,8 @@ h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f /* * Call H5Ovisit */ - /* TO DO: See H5Opublic.h: #define H5O_INFO_ALL (H5O_INFO_TIME|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR|H5O_INFO_META_SIZE) */ func_ret_value = H5Ovisit_by_name2( (hid_t)*loc_id, c_object_name, (H5_index_t)*index_type, (H5_iter_order_t)*order, - op, op_data, (unsigned)15, (hid_t)*lapl_id); + op, op_data, H5O_INFO_ALL, (hid_t)*lapl_id); ret_value = (int_f)func_ret_value; done: diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 78fb59d..d86cc98 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -160,11 +160,11 @@ herr_t H5DSattach_scale(hid_t did, return FAIL; /* get info for the dataset in the parameter list */ - if(H5Oget_info2(did, &oi1, 0) < 0) + if(H5Oget_info2(did, &oi1, H5O_INFO_BASIC) < 0) return FAIL; /* get info for the scale in the parameter list */ - if(H5Oget_info2(dsid, &oi2, 0) < 0) + if(H5Oget_info2(dsid, &oi2, H5O_INFO_BASIC) < 0) return FAIL; /* same object, not valid */ @@ -324,11 +324,11 @@ herr_t H5DSattach_scale(hid_t did, goto out; /* get info for DS in the parameter list */ - if(H5Oget_info2(dsid, &oi1, 0) < 0) + if(H5Oget_info2(dsid, &oi1, H5O_INFO_BASIC) < 0) goto out; /* get info for this DS */ - if(H5Oget_info2(dsid_j, &oi2, 0) < 0) + if(H5Oget_info2(dsid_j, &oi2, H5O_INFO_BASIC) < 0) goto out; /* same object, so this DS scale is already in this DIM IDX */ @@ -609,11 +609,11 @@ herr_t H5DSdetach_scale(hid_t did, return FAIL; /* get info for the dataset in the parameter list */ - if(H5Oget_info2(did, &did_oi, 0) < 0) + if(H5Oget_info2(did, &did_oi, H5O_INFO_BASIC) < 0) return FAIL; /* get info for the scale in the parameter list */ - if(H5Oget_info2(dsid, &dsid_oi, 0) < 0) + if(H5Oget_info2(dsid, &dsid_oi, H5O_INFO_BASIC) < 0) return FAIL; /* same object, not valid */ @@ -696,7 +696,7 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* get info for this DS */ - if(H5Oget_info2(dsid_j, &tmp_oi, 0) < 0) + if(H5Oget_info2(dsid_j, &tmp_oi, H5O_INFO_BASIC) < 0) goto out; /* Close the dereferenced dataset */ @@ -806,7 +806,7 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* get info for this dataset */ - if(H5Oget_info2(did_i, &tmp_oi, 0) < 0) + if(H5Oget_info2(did_i, &tmp_oi, H5O_INFO_BASIC) < 0) goto out; /* close the dereferenced dataset */ @@ -973,11 +973,11 @@ htri_t H5DSis_attached(hid_t did, return FAIL; /* get info for the dataset in the parameter list */ - if(H5Oget_info2(did, &oi1, 0) < 0) + if(H5Oget_info2(did, &oi1, H5O_INFO_BASIC) < 0) return FAIL; /* get info for the scale in the parameter list */ - if(H5Oget_info2(dsid, &oi2, 0) < 0) + if(H5Oget_info2(dsid, &oi2, H5O_INFO_BASIC) < 0) return FAIL; /* same object, not valid */ @@ -1054,11 +1054,11 @@ htri_t H5DSis_attached(hid_t did, goto out; /* get info for DS in the parameter list */ - if(H5Oget_info2(dsid, &oi1, 0) < 0) + if(H5Oget_info2(dsid, &oi1, H5O_INFO_BASIC) < 0) goto out; /* get info for this DS */ - if(H5Oget_info2(dsid_j, &oi2, 0) < 0) + if(H5Oget_info2(dsid_j, &oi2, H5O_INFO_BASIC) < 0) goto out; /* same object */ @@ -1144,11 +1144,11 @@ htri_t H5DSis_attached(hid_t did, goto out; /* get info for dataset in the parameter list */ - if(H5Oget_info2(did, &oi3, 0) < 0) + if(H5Oget_info2(did, &oi3, H5O_INFO_BASIC) < 0) goto out; /* get info for this dataset */ - if(H5Oget_info2(did_i, &oi4, 0) < 0) + if(H5Oget_info2(did_i, &oi4, H5O_INFO_BASIC) < 0) goto out; /* same object */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index bd1b0ec..f6c6d8f 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -1118,7 +1118,7 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char *name, c /* Go retrieve the object information */ /* (don't need index & heap info) */ HDassert(obj_loc); - if(H5O_get_info(obj_loc->oloc, &oinfo, H5O_INFO_TIME | H5O_INFO_HDR) < 0) + if(H5O_get_info(obj_loc->oloc, &oinfo, H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_HDR) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info") /* Get mapped object type */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index bf77833..72b3633 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -1274,8 +1274,8 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get link name") /* Check if the object pointed by the soft link exists in the source file */ - /* Only basic information is needed therefore pass in "0" for field selection */ - if(H5G_loc_info(&grp_loc, link_name, &oinfo, 0) >= 0) { + /* Only basic information is needed */ + if(H5G_loc_info(&grp_loc, link_name, &oinfo, H5O_INFO_BASIC) >= 0) { tmp_src_ent.header = oinfo.addr; src_ent = &tmp_src_ent; } /* end if */ diff --git a/src/H5Oint.c b/src/H5Oint.c index 7c5977f..2752a25 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -2243,24 +2243,27 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info_t *oinfo, unsigned fields) if(NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + /* Get class for object */ + if(NULL == (obj_class = H5O__obj_class_real(oh))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class") + /* Reset the object info structure */ HDmemset(oinfo, 0, sizeof(*oinfo)); - /* Retrieve the file's fileno */ - H5F_GET_FILENO(loc->file, oinfo->fileno); - - /* Set the object's address */ - oinfo->addr = loc->addr; + /* Get basic information, if requested */ + if(fields & H5O_INFO_BASIC) { + /* Retrieve the file's fileno */ + H5F_GET_FILENO(loc->file, oinfo->fileno); - /* Get class for object */ - if(NULL == (obj_class = H5O__obj_class_real(oh))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class") + /* Set the object's address */ + oinfo->addr = loc->addr; - /* Retrieve the type of the object */ - oinfo->type = obj_class->type; + /* Retrieve the type of the object */ + oinfo->type = obj_class->type; - /* Set the object's reference count */ - oinfo->rc = oh->nlink; + /* Set the object's reference count */ + oinfo->rc = oh->nlink; + } /* Get time information, if requested */ if(fields & H5O_INFO_TIME) { diff --git a/src/H5Opublic.h b/src/H5Opublic.h index 54869bc..da2910d 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -75,16 +75,14 @@ /* Flags for H5Oget_info. * Theses flags determine which fields will be filled in in the H5O_info_t - * struct. Some fields are always filled in because there is no performance - * penalty. - * A value of 0 returns basic information: fileno, addr, type, rc and will be - * returned regardless. + * struct. */ -#define H5O_INFO_TIME 0x0001u /* Fill in the atime, mtime, ctime, and btime fields */ -#define H5O_INFO_NUM_ATTRS 0x0002u /* Fill in the num_attrs field */ -#define H5O_INFO_HDR 0x0004u /* Fill in the hdr field */ -#define H5O_INFO_META_SIZE 0x0008u /* Fill in the meta_size field */ -#define H5O_INFO_ALL (H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE) +#define H5O_INFO_BASIC 0x0001u /* Fill in the fileno, addr, type, and rc fields */ +#define H5O_INFO_TIME 0x0002u /* Fill in the atime, mtime, ctime, and btime fields */ +#define H5O_INFO_NUM_ATTRS 0x0004u /* Fill in the num_attrs field */ +#define H5O_INFO_HDR 0x0008u /* Fill in the hdr field */ +#define H5O_INFO_META_SIZE 0x0010u /* Fill in the meta_size field */ +#define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE) /*******************/ /* Public Typedefs */ diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 55afa68..d34cad3 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -377,7 +377,7 @@ get_object_header_tag(hid_t loc_id, haddr_t *tag) H5O_info_t oinfo; /* Object info */ /* Retrieve the info for the object */ - if(H5Oget_info2(loc_id, &oinfo, 0) < 0) + if(H5Oget_info2(loc_id, &oinfo, H5O_INFO_ALL) < 0) TEST_ERROR; /* Set the tag to return */ @@ -2937,7 +2937,7 @@ check_object_info_tags(void) /* Get information on an object by name */ /* ===================================== */ - if ( H5Oget_info_by_name2(fid, GROUPNAME, &oinfo, 0, H5P_DEFAULT) < 0 ) TEST_ERROR; + if ( H5Oget_info_by_name2(fid, GROUPNAME, &oinfo, H5O_INFO_ALL, H5P_DEFAULT) < 0 ) TEST_ERROR; /* =================================== */ /* Verification of Metadata Tag Values */ @@ -2956,6 +2956,8 @@ check_object_info_tags(void) /* Verify dataset's tagged metadata */ if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_BT_ID, g_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid, H5AC_LHEAP_PRFX_ID, g_tag) < 0 ) TEST_ERROR; /* verify no other entries present */ if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; @@ -3583,6 +3585,8 @@ check_external_link_open_tags(void) /* verify tag value of linked group's object header */ if ( verify_tag(fid2, H5AC_OHDR_ID, link_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid2, H5AC_LHEAP_PRFX_ID, link_tag) < 0 ) TEST_ERROR; + if ( verify_tag(fid2, H5AC_BT_ID, link_tag) < 0 ) TEST_ERROR; /* verify no other entries present */ if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; diff --git a/test/cork.c b/test/cork.c index 7487a9e..dceaf5a 100644 --- a/test/cork.c +++ b/test/cork.c @@ -126,7 +126,7 @@ verify_old_dset_cork(void) TEST_ERROR /* Get dataset object header address: DSET_BT1 */ - if(H5Oget_info2(did, &oinfo, 0) < 0) + if(H5Oget_info2(did, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_BT1 */ @@ -163,7 +163,7 @@ verify_old_dset_cork(void) FAIL_STACK_ERROR /* Get dataset object address */ - if(H5Oget_info2(did2, &oinfo2, 0) < 0) + if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_COMPACT */ @@ -216,7 +216,7 @@ verify_old_dset_cork(void) FAIL_STACK_ERROR /* Get dataset object address: DSET_CONTIG */ - if(H5Oget_info2(did3, &oinfo3, 0) < 0) + if(H5Oget_info2(did3, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_CONTIG */ @@ -329,7 +329,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Get dataset object header address */ - if(H5Oget_info2(did, &oinfo, 0) < 0) + if(H5Oget_info2(did, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ @@ -372,7 +372,7 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Get dataset object header address */ - if(H5Oget_info2(did2, &oinfo2, 0) < 0) + if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_NONE */ @@ -546,7 +546,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Get dataset object header address: DSET_EA */ - if(H5Oget_info2(did, &oinfo, 0) < 0) + if(H5Oget_info2(did, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_EA */ @@ -564,7 +564,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Get dataset object header address: DSET_FA */ - if(H5Oget_info2(did2, &oinfo2, 0) < 0) + if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_FA */ @@ -591,7 +591,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Get dataset object header address: DSET_BT2 */ - if(H5Oget_info2(did3, &oinfo3, 0) < 0) + if(H5Oget_info2(did3, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET_BT2 */ @@ -770,11 +770,11 @@ verify_group_cork(hbool_t swmr) TEST_ERROR /* Get group object header addresses */ - if(H5Oget_info2(gid, &oinfo, 0) < 0) + if(H5Oget_info2(gid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(gid2, &oinfo2, 0) < 0) + if(H5Oget_info2(gid2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(gid3, &oinfo3, 0) < 0) + if(H5Oget_info2(gid3, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR /* Verify cork status of the groups */ @@ -959,11 +959,11 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Get named datatype object header addresses */ - if(H5Oget_info2(tid, &oinfo, 0) < 0) + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(tid2, &oinfo2, 0) < 0) + if(H5Oget_info2(tid2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(tid3, &oinfo3, 0) < 0) + if(H5Oget_info2(tid3, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR /* Verify cork status of the named datatypes */ @@ -1063,7 +1063,7 @@ verify_named_cork(hbool_t swmr) FAIL_STACK_ERROR /* Get dataset object header address */ - if(H5Oget_info2(did, &oinfo4, 0) < 0) + if(H5Oget_info2(did, &oinfo4, H5O_INFO_BASIC) < 0) TEST_ERROR /* Cork the dataset: DSET */ @@ -1277,7 +1277,7 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the group: gid2 */ - if(H5Oget_info2(gid2, &oinfo1, 0) < 0) + if(H5Oget_info2(gid2, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR if(H5C__verify_cork_tag_test(fid2, oinfo1.addr, TRUE) < 0) TEST_ERROR @@ -1305,7 +1305,7 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: did1 */ - if(H5Oget_info2(did1, &oinfo2, 0) < 0) + if(H5Oget_info2(did1, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR if(H5C__verify_cork_tag_test(fid1, oinfo2.addr, TRUE) < 0) TEST_ERROR @@ -1333,7 +1333,7 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the datatype: tid2 */ - if(H5Oget_info2(tid2, &oinfo3, 0) < 0) + if(H5Oget_info2(tid2, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR if(H5C__verify_cork_tag_test(fid2, oinfo3.addr, TRUE) < 0) TEST_ERROR @@ -1349,7 +1349,7 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the group: gid1 */ - if(H5Oget_info2(gid1, &oinfo1, 0) < 0) + if(H5Oget_info2(gid1, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR if(H5C__verify_cork_tag_test(fid1, oinfo1.addr, FALSE) < 0) TEST_ERROR @@ -1383,7 +1383,7 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: did2 */ - if(H5Oget_info2(did2, &oinfo2, 0) < 0) + if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR if(H5C__verify_cork_tag_test(fid2, oinfo2.addr, FALSE) < 0) TEST_ERROR diff --git a/test/dsets.c b/test/dsets.c index ebe7f68..d23f438 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -10719,9 +10719,9 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR; /* The second call triggered a bug in the library (JIRA issue: SWMR-95) */ - if(H5Oget_info_by_name2(fid, DSET_EARRAY_HDR_FD, &info, 0, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; - if(H5Oget_info_by_name2(fid, DSET_EARRAY_HDR_FD, &info, 0, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if(H5Pclose(fapl) < 0) @@ -10839,9 +10839,9 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR; /* The second call triggered a bug in the library (JIRA issue: SWMR-95) */ - if(H5Oget_info_by_name2(fid, DSET_FARRAY_HDR_FD, &info, 0, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; - if(H5Oget_info_by_name2(fid, DSET_FARRAY_HDR_FD, &info, 0, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if(H5Pclose(fapl) < 0) @@ -10959,9 +10959,9 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) FAIL_STACK_ERROR; /* The second call triggered a bug in the library (JIRA issue: SWMR-95) */ - if(H5Oget_info_by_name2(fid, DSET_BT2_HDR_FD, &info, 0, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; - if(H5Oget_info_by_name2(fid, DSET_BT2_HDR_FD, &info, 0, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; if(H5Pclose(fapl) < 0) @@ -12680,7 +12680,7 @@ dls_01_read_stuff( hid_t fid ) { did = H5Dopen2( fid, DLS_01_DATASET, H5P_DEFAULT ); if ( did <= 0 ) TEST_ERROR - status = H5Oget_info2( did, &info, 0 ); + status = H5Oget_info2( did, &info, H5O_INFO_BASIC ); if ( status != 0 ) TEST_ERROR status = H5Dclose( did ); diff --git a/test/flushrefresh.c b/test/flushrefresh.c index 9348a10..4196d85 100644 --- a/test/flushrefresh.c +++ b/test/flushrefresh.c @@ -848,7 +848,7 @@ herr_t flush_verification(const char * obj_pathname, const char * expected) H5E_BEGIN_TRY { fid = H5Fopen(FILENAME, H5F_ACC_SWMR_READ, H5P_DEFAULT); oid = H5Oopen(fid, obj_pathname, H5P_DEFAULT); - status = H5Oget_info2(oid, &oinfo, 0); + status = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC); } H5E_END_TRY; /* Compare to expected result */ @@ -989,7 +989,7 @@ herr_t refresh_verification(const char * obj_pathname) if((oid = H5Oopen(fid, obj_pathname, H5P_DEFAULT)) < 0) PROCESS_ERROR; /* Get Object info */ - if((status = H5Oget_info2(oid, &flushed_oinfo, H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; + if((status = H5Oget_info2(oid, &flushed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; /* Make sure there are no attributes on the object. This is just a sanity check to ensure we didn't erroneously flush the attribute before @@ -1008,7 +1008,7 @@ herr_t refresh_verification(const char * obj_pathname) /* Get object info again. This will NOT reflect what's on disk, only what's in the cache. Thus, all values will be unchanged from above, despite newer information being on disk. */ - if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; + if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; /* Verify that before doing a refresh, getting the object info returns stale information. (i.e., unchanged from above, despite new info on disk). */ @@ -1046,7 +1046,7 @@ herr_t refresh_verification(const char * obj_pathname) } /* end else */ /* Get object info. This should now accurately reflect the refreshed object on disk. */ - if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; + if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR; /* Confirm following (first 4) attributes are the same: */ /* Confirm following (last 4) attributes are different */ diff --git a/test/genall5.c b/test/genall5.c index 69ff964..37bab7a 100644 --- a/test/genall5.c +++ b/test/genall5.c @@ -650,7 +650,7 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) HDassert(H5L_TYPE_HARD == lnk_info.type); memset(&root_oinfo, 0, sizeof(root_oinfo)); - ret = H5Oget_info2(fid, &root_oinfo, 0); + ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); if ( ret < 0 ) { @@ -1130,7 +1130,7 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) HDassert(H5L_TYPE_HARD == lnk_info.type); memset(&root_oinfo, 0, sizeof(root_oinfo)); - ret = H5Oget_info2(fid, &root_oinfo, 0); + ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); if ( ret < 0 ) { pass = FALSE; @@ -1825,7 +1825,7 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) HDassert(H5L_TYPE_HARD == lnk_info.type); memset(&root_oinfo, 0, sizeof(root_oinfo)); - ret = H5Oget_info2(fid, &root_oinfo, 0); + ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC); if ( ret < 0 ) { diff --git a/test/getname.c b/test/getname.c index a6ef2d1..1d2b4a3 100644 --- a/test/getname.c +++ b/test/getname.c @@ -2390,7 +2390,7 @@ test_main(hid_t file_id, hid_t fapl) if((size = H5Iget_name(dtype_anon, NULL,0)) != 0) TEST_ERROR /* Store the address of the datatype for later use */ - if(H5Oget_info2(dtype_anon, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(dtype_anon, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Update the reference count to dtype_anon to preserve the datatype */ if(H5Oincr_refcount(dtype_anon) < 0) TEST_ERROR diff --git a/test/h5test.c b/test/h5test.c index 5d944ee..687f594 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1695,7 +1695,7 @@ h5_verify_cached_stabs(const char *base_name[], hid_t fapl) } /* end if */ if(H5Ovisit2(file, H5_INDEX_NAME, H5_ITER_NATIVE, - h5_verify_cached_stabs_cb, NULL, 0) < 0) + h5_verify_cached_stabs_cb, NULL, H5O_INFO_BASIC) < 0) goto error; if(H5Fclose(file) < 0) diff --git a/test/links.c b/test/links.c index 80f9481..fb2c75a 100644 --- a/test/links.c +++ b/test/links.c @@ -541,8 +541,8 @@ cklinks(hid_t fapl, hbool_t new_format) if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Hard link */ - if(H5Oget_info_by_name2(file, "d1", &oinfo1, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { H5_FAILED(); printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); @@ -577,7 +577,7 @@ cklinks(hid_t fapl, hbool_t new_format) } /* end if */ /* Symbolic link */ - if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { H5_FAILED(); printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); @@ -599,7 +599,7 @@ cklinks(hid_t fapl, hbool_t new_format) /* Dangling link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, 0, H5P_DEFAULT); + status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -626,7 +626,7 @@ cklinks(hid_t fapl, hbool_t new_format) /* Recursive link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, 0, H5P_DEFAULT); + status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -696,11 +696,11 @@ ck_new_links(hid_t fapl, hbool_t new_format) if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Get hard link info */ - if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, 0, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, 0, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, 0, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR /* Check hard links */ @@ -5377,7 +5377,7 @@ external_link_query(hid_t fapl, hbool_t new_format) if(HDstrcmp(object_name, "/dst")) TEST_ERROR /* Query information about object that external link points to */ - if(H5Oget_info_by_name2(fid, "src", &oi, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_GROUP != oi.type) { H5_FAILED(); HDputs(" Unexpected object type - should have been a group"); @@ -6110,8 +6110,8 @@ external_link_closing(hid_t fapl, hbool_t new_format) /* Test that getting info works */ if(H5Lget_info(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR if(H5Lget_info(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(fid1, "elink/elink/elink/type1", &oi, 0, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(fid1, "elink/elink/elink", &oi, 0, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR /* Test move */ if(H5Lmove(fid1, "elink/elink/elink/group1", fid1, @@ -6198,7 +6198,7 @@ external_link_closing(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR - if(H5Oget_info_by_name2(fid1, "elink/elink2/group2/group3/group4", &oi, 0, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR /* Add a few regular groups and a soft link in file2 using intermediate group creation */ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR @@ -9608,13 +9608,13 @@ obj_visit(hid_t fapl, hbool_t new_format) /* Visit all the objects reachable from the root group (with file ID) */ udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0) < 0) FAIL_STACK_ERROR + if(H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR /* Visit all the objects reachable from the root group (with group ID) */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0) < 0) FAIL_STACK_ERROR + if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR @@ -9622,13 +9622,13 @@ obj_visit(hid_t fapl, hbool_t new_format) if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; - if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0) < 0) FAIL_STACK_ERROR + if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; - if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0) < 0) FAIL_STACK_ERROR + if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR @@ -9678,36 +9678,36 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) /* Visit all the objects reachable from the root group (with file ID) */ udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Visit all the objects reachable from the root group (with group ID) */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit0_new : ovisit0_old; - if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Visit all the objects reachable from each internal group */ udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; - if(H5Ovisit_by_name2(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name2(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; - if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; - if(H5Ovisit_by_name2(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name2(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; - if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR @@ -9784,7 +9784,7 @@ obj_visit_stop(hid_t fapl, hbool_t new_format) * returns H5_ITER_STOP */ nvisited = 0; - if((ret = H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited, 0)) < 0) + if((ret = H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited, H5O_INFO_BASIC)) < 0) FAIL_STACK_ERROR if(ret != H5_ITER_STOP) TEST_ERROR if(nvisited != 1) TEST_ERROR @@ -9792,7 +9792,7 @@ obj_visit_stop(hid_t fapl, hbool_t new_format) /* Same test with H5Ovisit_by_name */ nvisited = 0; if((ret = H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, - &nvisited, 0, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + &nvisited, H5O_INFO_BASIC, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(ret != H5_ITER_STOP) TEST_ERROR if(nvisited != 1) TEST_ERROR @@ -11596,7 +11596,7 @@ link_info_by_idx_old(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, 0) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR objno[u] = oi.addr; /* Close group */ @@ -12095,7 +12095,7 @@ delete_by_idx_old(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, 0) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR objno[u] = oi.addr; /* Close group */ @@ -12168,7 +12168,7 @@ delete_by_idx_old(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, 0) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR objno[u] = oi.addr; /* Close group */ @@ -13163,7 +13163,7 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, if((obj_id = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT)) < 0) TEST_ERROR /* Get the object's information */ - if(H5Oget_info2(obj_id, &oi, 0) < 0) TEST_ERROR + if(H5Oget_info2(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR /* Check that the object is the correct one */ if(order == H5_ITER_INC) { @@ -13189,7 +13189,7 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, */ /* Get the address of the root group in the file to mount */ - if(H5Oget_info2(mount_file_id, &oi, 0) < 0) TEST_ERROR + if(H5Oget_info2(mount_file_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR mnt_root_addr = oi.addr; /* Mount a file over a group in main group */ @@ -13201,7 +13201,7 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, if((obj_id = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)mnt_idx, H5P_DEFAULT)) < 0) TEST_ERROR /* Get the object's information */ - if(H5Oget_info2(obj_id, &oi, 0) < 0) TEST_ERROR + if(H5Oget_info2(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR /* Check that the object is the root of the mounted file and not in the previous file */ if(H5F_addr_ne(oi.addr, mnt_root_addr)) TEST_ERROR @@ -13352,7 +13352,7 @@ open_by_idx(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, 0) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR objno[u] = oi.addr; /* Close group created */ @@ -13387,7 +13387,7 @@ open_by_idx(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, 0) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR objno[u] = oi.addr; /* Close group created */ @@ -13529,7 +13529,7 @@ open_by_idx_old(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oi, 0) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR objno[u] = oi.addr; /* Close group created */ @@ -13623,14 +13623,14 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, sprintf(objname, "filler %02u", u); /* Query the object's information, by name */ - if(H5Oget_info_by_name2(group_id, objname, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR /* Check that the object is the correct one */ if(H5F_addr_ne(oinfo.addr, objno[u])) TEST_ERROR if(H5F_addr_ne(oinfo.num_attrs, u)) TEST_ERROR /* Query the object's information, by index */ - if(H5Oget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR /* Check that the object is the correct one */ if(order == H5_ITER_INC) { @@ -13772,7 +13772,7 @@ object_info(hid_t fapl) /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -13788,7 +13788,7 @@ object_info(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR objno[u] = oinfo.addr; /* Create attributes on new object */ @@ -13816,7 +13816,7 @@ object_info(hid_t fapl) /* Check for out of bound query by index */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -13836,7 +13836,7 @@ object_info(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR objno[u] = oinfo.addr; /* Create attributes on new object */ @@ -13864,7 +13864,7 @@ object_info(hid_t fapl) /* Check for out of bound query by index */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -13969,7 +13969,7 @@ object_info_old(hid_t fapl) /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -13985,7 +13985,7 @@ object_info_old(hid_t fapl) if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Retrieve group's address on disk */ - if(H5Oget_info2(group_id2, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR objno[u] = oinfo.addr; /* Create attributes on new object */ @@ -14013,13 +14013,13 @@ object_info_old(hid_t fapl) /* Check for out of bound query by index */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR /* Check for creation order index query */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR diff --git a/test/mount.c b/test/mount.c index dad780a..c6230ee 100644 --- a/test/mount.c +++ b/test/mount.c @@ -412,7 +412,7 @@ test_hide(hid_t fapl) FAIL_STACK_ERROR /* Get information about file1:/mnt1/file1 for later */ - if(H5Oget_info_by_name2(file1, "/mnt1/file1", &oi1, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Build the virtual file */ if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -431,7 +431,7 @@ test_hide(hid_t fapl) * The original objects under file1:/mnt1 are still accessible by their * other names. This is a rather stupid test but demonstrates a point. */ - if(H5Oget_info_by_name2(file1, "/file1", &oi2, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { H5_FAILED(); puts(" Hard link failed for hidden object."); @@ -490,7 +490,7 @@ test_assoc(hid_t fapl) FAIL_STACK_ERROR /* Get information about the root of file2 */ - if(H5Oget_info2(file2, &oi1, 0) < 0) FAIL_STACK_ERROR + if(H5Oget_info2(file2, &oi1, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR /* Create the virtual file */ if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -499,7 +499,7 @@ test_assoc(hid_t fapl) * Get info about the mount point -- should be the same as the root group * of file2. */ - if(H5Oget_info_by_name2(file1, "/mnt1", &oi2, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) { H5_FAILED(); @@ -688,7 +688,7 @@ test_preopen(hid_t fapl) if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Now access the thing we previously opened */ - if(H5Oget_info2(grp, &oinfo, 0) < 0) FAIL_STACK_ERROR + if(H5Oget_info2(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -752,10 +752,10 @@ test_postopen(hid_t fapl) if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR /* Now access the thing we previously opened */ - if(H5Oget_info2(grp, &oinfo, 0) < 0) FAIL_STACK_ERROR + if(H5Oget_info2(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR /* Try accessing it from the file */ - if(H5Oget_info_by_name2(file2, "/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file2, "/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Gclose(grp) < 0) FAIL_STACK_ERROR @@ -825,12 +825,12 @@ test_unlink(hid_t fapl) * before the H5Fmount() and thus refers to the mount point itself rather * than the group mounted there. */ - if(H5Oget_info_by_name2(file1, "/mnt_unlink/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(mnt, "/mnt_unlink/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(root, "/mnt_unlink/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(root, "file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(mnt, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(root, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(mnt, "file2", &oinfo, 0, H5P_DEFAULT); + status = H5Oget_info_by_name2(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -845,9 +845,9 @@ test_unlink(hid_t fapl) * We should still be able to get to "/file2" of file2 by starting at * `root' which is still open, but not by name. */ - if(H5Oget_info_by_name2(root, "file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(mnt, "file2", &oinfo, 0, H5P_DEFAULT); + status = H5Oget_info_by_name2(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -855,7 +855,7 @@ test_unlink(hid_t fapl) TEST_ERROR } /* end if */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file2, "/mnt_unlink/file2", &oinfo, 0, H5P_DEFAULT); + status = H5Oget_info_by_name2(file2, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { H5_FAILED(); @@ -943,7 +943,7 @@ test_mvmpt(hid_t fapl) if(H5Lmove(file1, "/mnt_move_a", H5L_SAME_LOC, "/mnt_move_b", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access something under the new name */ - if(H5Oget_info_by_name2(file1, "/mnt_move_b/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/mnt_move_b/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Funmount(file1, "/mnt_move_b") < 0) FAIL_STACK_ERROR @@ -1102,18 +1102,18 @@ test_uniformity(hid_t fapl) if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access some things from the file1 handle */ - if(H5Oget_info_by_name2(file1, "/", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "/mnt1", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "mnt1", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "/mnt1/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "mnt1/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access the same things from the file2 handle */ - if(H5Oget_info_by_name2(file2, "/", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "mnt1", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "/mnt1/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "mnt1/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file2, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file2, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file2, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file2, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Shut down */ if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR @@ -1170,7 +1170,7 @@ test_close(hid_t fapl) * still accessible through the file2 handle. */ if(H5Fclose(file1) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, 0, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { H5_FAILED(); puts(" File1 contents are not accessible!"); TEST_ERROR @@ -1191,7 +1191,7 @@ test_close(hid_t fapl) * Close file2. It is not actually closed because it's a child of file1. */ if(H5Fclose(file2) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file1, "/mnt1/file2", &oinfo, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Fclose(file1) < 0) FAIL_STACK_ERROR /* Check that all file IDs have been closed */ @@ -2495,9 +2495,9 @@ test_fcdegree_strong(hid_t fapl) TEST_ERROR /* Check that objects are still open */ - if(H5Oget_info2(gidA, &oinfo, 0) < 0) + if(H5Oget_info2(gidA, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5Oget_info2(gidAM, &oinfo, 0) < 0) + if(H5Oget_info2(gidAM, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR /* Close file #2 (should close open objects also) */ @@ -2506,12 +2506,12 @@ test_fcdegree_strong(hid_t fapl) /* Check that objects are closed */ H5E_BEGIN_TRY { - ret = H5Oget_info2(gidA, &oinfo, 0); + ret = H5Oget_info2(gidA, &oinfo, H5O_INFO_BASIC); } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Oget_info2(gidAM, &oinfo, 0); + ret = H5Oget_info2(gidAM, &oinfo, H5O_INFO_BASIC); } H5E_END_TRY; if(ret >= 0) TEST_ERROR diff --git a/test/mtime.c b/test/mtime.c index 59457d4..2cd2d31 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -90,9 +90,9 @@ main(void) */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR; - if(H5Oget_info_by_name2(file, "dset", &oi1, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR; + if(H5Oget_info_by_name2(file, "dset", &oi1, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR; if((dset = H5Dopen2(file, "dset", H5P_DEFAULT)) < 0) TEST_ERROR; - if(H5Oget_info2(dset, &oi2, H5O_INFO_TIME) < 0) TEST_ERROR; + if(H5Oget_info2(dset, &oi2, H5O_INFO_BASIC|H5O_INFO_TIME) < 0) TEST_ERROR; if(H5Dclose(dset) < 0) TEST_ERROR; if(H5Fclose(file) < 0) TEST_ERROR; diff --git a/test/objcopy.c b/test/objcopy.c index 7e57a56..18de027 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -1071,8 +1071,8 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, if(obj_owner > 0) { H5O_info_t oinfo1, oinfo2; - if(H5Oget_info2(obj_owner, &oinfo1, 0) < 0) TEST_ERROR - if(H5Oget_info2(obj1_id, &oinfo2, 0) < 0) TEST_ERROR + if(H5Oget_info2(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info2(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR if(H5F_addr_eq(oinfo1.addr, oinfo2.addr)) { if(H5Oclose(obj1_id) < 0) TEST_ERROR if(H5Oclose(obj2_id) < 0) TEST_ERROR @@ -1129,8 +1129,8 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, if(obj_owner > 0) { H5O_info_t oinfo1, oinfo2; - if(H5Oget_info2(obj_owner, &oinfo1, 0) < 0) TEST_ERROR - if(H5Oget_info2(obj1_id, &oinfo2, 0) < 0) TEST_ERROR + if(H5Oget_info2(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info2(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR if(H5F_addr_eq(oinfo1.addr, oinfo2.addr)) { if(H5Oclose(obj1_id) < 0) TEST_ERROR if(H5Oclose(obj2_id) < 0) TEST_ERROR @@ -1423,8 +1423,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) H5O_info_t oinfo, oinfo2; /* Object info */ /* Compare some pieces of the object info */ - if(H5Oget_info_by_name2(gid, objname, &oinfo, H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Oget_info_by_name2(gid2, objname2, &oinfo2, H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(gid, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(gid2, objname2, &oinfo2, H5O_INFO_BASIC|H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR if(oinfo.type != oinfo2.type) TEST_ERROR if(oinfo.rc != oinfo2.rc) TEST_ERROR @@ -1949,8 +1949,8 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap if(H5Tcommitted(tid) != TRUE) TEST_ERROR /* verify that the addresses of the datatypes are the same */ - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR - if(H5Oget_info2(tid2, &oinfo2, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR + if(H5Oget_info2(tid2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.fileno != oinfo2.fileno || oinfo.addr != oinfo2.addr) FAIL_PUTS_ERROR("destination attribute does not use the same committed datatype") @@ -10331,28 +10331,28 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* Open SRC1 committed dtype, get address */ if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open SRC1 dset dtype, check address */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR /* Open SRC2 committed dtype, check address */ if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* Open SRC2 dset dtype, check address */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10385,7 +10385,7 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* Open SRC1 dset dtype, get address */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10393,7 +10393,7 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* Open SRC2 dset dtype, check address */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10565,28 +10565,28 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* Open group 1 source committed dtype, get address */ if((tid = H5Topen2(fid, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open group 1 source dset dtype, check address */ if((did = H5Dopen2(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR /* Open group 1 committed dtype, check address */ if((tid = H5Topen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* Open group 1 dset dtype, check address */ if((did = H5Dopen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10594,7 +10594,7 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* Open group 2 source committed dtype, get address and make sure it is * different from group 1 source committed dtype */ if((tid = H5Topen2(fid, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr == exp_addr) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR @@ -10602,21 +10602,21 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* Open group 2 source dset dtype, check address */ if((did = H5Dopen2(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR /* Open group 2 committed dtype, check address */ if((tid = H5Topen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* Open group 2 dset dtype, check address */ if((did = H5Dopen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10644,7 +10644,7 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* Open group 1 source dset dtype, get address */ if((did = H5Dopen2(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10652,7 +10652,7 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* Open group 1 dset dtype, check address */ if((did = H5Dopen2(fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10661,7 +10661,7 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo * different from group 1 source dset dtype */ if((did = H5Dopen2(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr == exp_addr) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR @@ -10670,7 +10670,7 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* Open group 2 dset dtype, check address */ if((did = H5Dopen2(fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10837,14 +10837,14 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* Open committed dtype "b", get address */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open dset dtype, check address */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -10875,28 +10875,28 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* Open committed dtype "a", get address */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open dset 2 dtype, check address */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR /* Open committed dtype "b", get address */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open dset dtype, check address */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11072,7 +11072,7 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* Open attribute dtype, get address */ if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_TOP, "attr", H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR @@ -11080,7 +11080,7 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* Open dset dtype, check address */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11331,13 +11331,13 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* get address of committed datatype at root group */ if((tid = H5Topen2(fid_dst, SRC_ROOT_GROUP "/" ROOT_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr_int = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* get address of committed datatype at /g0 */ if((tid = H5Topen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" GROUP_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr_short = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR @@ -11351,7 +11351,7 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* check address of datatype for second dataset */ if((did = H5Dopen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr_short) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11359,7 +11359,7 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* check address of datatype for third dataset */ if((did = H5Dopen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr_int) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11371,7 +11371,7 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* get address of committed datatype at /g0 */ if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP "/" GROUP_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr_short) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR @@ -11385,7 +11385,7 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* check address of datatype for second dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr_short) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11393,7 +11393,7 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* check address of datatype for third dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr_int) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11408,7 +11408,7 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* Open attribute with anon ndt (short), get address */ if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_UNCOPIED, DST_ATTR_ANON_SHORT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr_short) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR @@ -11416,7 +11416,7 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* Open attribute with anon ndt (int), get address */ if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_UNCOPIED, DST_ATTR_ANON_INT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr_int) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR @@ -11431,7 +11431,7 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* check address of datatype for second dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr_short) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11439,7 +11439,7 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d /* check address of datatype for third dataset */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr_int) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -11642,50 +11642,50 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds */ /* get address of committed datatype: /src_root/src_ndt_double */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_DOUBLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* get address of committed datatype: /dst_ndt_double */ if((tid = H5Topen2(fid_dst, "/" DST_NDT_DOUBLE, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* get address of committed datatype: /src_root/src_ndt_float */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_FLOAT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* get address of committed datatype: /dst_ndt_float */ if((tid = H5Topen2(fid_dst, "/" DST_NDT_FLOAT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* get address of committed datatype: /src_root/src_ndt_int */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* get address of committed datatype: /dst_ndt_int */ if((tid = H5Topen2(fid_dst, "/" DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR /* get address of committed datatype: /src_root/src_ndt_short */ if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* open attribute; get its dtype; get dtype's address: /src_root/src_ndt_double/dst_attr */ if((aid = H5Aopen_by_name(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_DOUBLE, DST_ATTR, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Aget_type(aid)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Aclose(aid) < 0) TEST_ERROR @@ -11816,13 +11816,13 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* open committed dtype "/dst_ndt_int", get its address */ if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* check address of "/uncopied/src_ndt_int" */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR @@ -11849,13 +11849,13 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* open committed dtype "/uncopied/src_ndt_int", get its address */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* check address of "/src_ndt_int" */ if((tid = H5Topen2(fid_dst, SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR @@ -11887,13 +11887,13 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Open committed dtype "/uncopied/src_ndt_int", get its address */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* check address of "/src_ndt_int2" */ if((tid = H5Topen2(fid_dst, SRC_NDT_INT2, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR @@ -11921,13 +11921,13 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Open committed dtype "/dst_dt_int", get its address */ if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* check address of "/uncopied/src_ndt_int2" */ if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT2, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR @@ -12077,14 +12077,14 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Open committed dtype "/dst_ndt_int", get its address */ if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* check address of datatype for the copied dataset: "/uncopied/src_ndt_dset" */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12113,7 +12113,7 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Open committed dtype dataset "/uncopied/src_ndt_dset", get its datatype address */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12121,7 +12121,7 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* check address of datatype for the copied dataset: "/src_ndt_dset" */ if((did = H5Dopen2(fid_dst, SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12155,7 +12155,7 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* open the copied dataset: /uncopied/src_ndt_dset", get its address */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12163,7 +12163,7 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* check address of datatype for the copied dataset: "/src_ndt_dset2" */ if((did = H5Dopen2(fid_dst, SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12193,7 +12193,7 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* open the copied dataset: "/src_ndt_dset", get its datatype address */ if((did = H5Dopen2(fid_dst, SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12201,7 +12201,7 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* check address of datatype for the copied dataset: /uncopied/src_ndt_dset2 */ if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12861,14 +12861,14 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Open committed dtype "b", get address */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open dset dtype, check address */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12909,14 +12909,14 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Open committed dtype "a", get address */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open copied dataset and its dtype, check address */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr != exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -12948,28 +12948,28 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Open committed dtype "a", get address */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open the copied dataset and get its dtype, addresses should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr == exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR /* Open committed dtype "b", get address */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open the copied dataset and get its dtype, addresses should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr == exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -13008,28 +13008,28 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Open committed dtype "a", get address */ if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open the copied dataset and get its dtype, addresses should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr == exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR /* Open committed dtype "b", get address */ if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR exp_addr = oinfo.addr; if(H5Tclose(tid) < 0) TEST_ERROR /* Open the copied dataset and get its dtype, addresses should not be equal */ if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR if((tid = H5Dget_type(did)) < 0) TEST_ERROR - if(H5Oget_info2(tid, &oinfo, 0) < 0) TEST_ERROR + if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR if(oinfo.addr == exp_addr) TEST_ERROR if(H5Tclose(tid) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR diff --git a/test/tattr.c b/test/tattr.c index f312870..bf9ce96 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -1665,7 +1665,7 @@ test_attr_dtype_shared(hid_t fapl) CHECK(ret, FAIL, "H5Tcommit2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "H5Oget_info_by_name"); @@ -1678,7 +1678,7 @@ test_attr_dtype_shared(hid_t fapl) CHECK(dset_id, FAIL, "H5Dcreate2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 2, "H5Oget_info_by_name"); @@ -1687,7 +1687,7 @@ test_attr_dtype_shared(hid_t fapl) CHECK(attr_id, FAIL, "H5Acreate2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 3, "H5Oget_info_by_name"); @@ -1700,7 +1700,7 @@ test_attr_dtype_shared(hid_t fapl) CHECK(ret, FAIL, "H5Adelete"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 2, "H5Oget_info_by_name"); @@ -1709,7 +1709,7 @@ test_attr_dtype_shared(hid_t fapl) CHECK(attr_id, FAIL, "H5Acreate2"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 3, "H5Oget_info_by_name"); @@ -1764,7 +1764,7 @@ test_attr_dtype_shared(hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 3, "H5Oget_info_by_name"); @@ -1773,7 +1773,7 @@ test_attr_dtype_shared(hid_t fapl) CHECK(ret, FAIL, "H5Ldelete"); /* Check reference count on named datatype */ - ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "H5Oget_info_by_name"); @@ -10484,7 +10484,7 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gcreate2"); /* Get root group address */ - ret = H5Oget_info2(fid, &oinfo, 0); + ret = H5Oget_info2(fid, &oinfo, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); root_addr = oinfo.addr; @@ -10509,7 +10509,7 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gopen2"); oid = H5Oopen(gid, LINK1_NAME, H5P_DEFAULT); CHECK(oid, FAIL, "H5Oopen"); - ret = H5Oget_info2(oid, &oinfo, 0); + ret = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); if(oinfo.addr != root_addr) TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)oinfo.addr, (long long unsigned)root_addr); @@ -10554,7 +10554,7 @@ test_attr_bug8(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gopen2"); oid = H5Oopen(gid, LINK1_NAME, H5P_DEFAULT); CHECK(oid, FAIL, "H5Oopen"); - ret = H5Oget_info2(oid, &oinfo, 0); + ret = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); if(oinfo.addr != root_addr) TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)oinfo.addr, (long long unsigned)root_addr); diff --git a/test/th5o.c b/test/th5o.c index 76ea3b1..eeef373 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -30,7 +30,6 @@ #define TEST6_DIM1 100 #define TEST6_DIM2 100 -//#define NUM_GROUPS 100000 #define NUM_GROUPS 100 #define NUM_ATTRS 10 #define NUM_DSETS 50 @@ -415,13 +414,13 @@ test_h5o_refcount(void) CHECK(ret, FAIL, "H5Sclose"); /* Get ref counts for each object. They should all be 1, since each object has a hard link. */ - ret = H5Oget_info_by_name2(fid, "group", &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); @@ -434,13 +433,13 @@ test_h5o_refcount(void) CHECK(ret, FAIL, "H5Oincr_refcount"); /* Get ref counts for each object. They should all be 2 now. */ - ret = H5Oget_info_by_name2(fid, "group", &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); @@ -452,13 +451,13 @@ test_h5o_refcount(void) ret = H5Odecr_refcount(dset); CHECK(ret, FAIL, "H5Odecr_refcount"); - ret = H5Oget_info_by_name2(fid, "group", &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); @@ -490,13 +489,13 @@ test_h5o_refcount(void) dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); CHECK(dset, FAIL, "H5Dopen2"); - ret = H5Oget_info_by_name2(fid, "group", &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name"); @@ -528,13 +527,13 @@ test_h5o_refcount(void) dset = H5Dopen2(fid, "dataset", H5P_DEFAULT); CHECK(dset, FAIL, "H5Dopen2"); - ret = H5Oget_info_by_name2(fid, "group", &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name"); @@ -1277,9 +1276,9 @@ test_h5o_getinfo_same_file(void) HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, through group IDs */ - ret = H5Oget_info2(gid1, &oinfo1, 0); + ret = H5Oget_info2(gid1, &oinfo1, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); - ret = H5Oget_info2(gid2, &oinfo2, 0); + ret = H5Oget_info2(gid2, &oinfo2, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); @@ -1289,9 +1288,9 @@ test_h5o_getinfo_same_file(void) HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, by name */ - ret = H5Oget_info_by_name2(fid1, "group1", &oinfo1, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid1, "group1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid1, "group2", &oinfo2, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid1, "group2", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); @@ -1322,9 +1321,9 @@ test_h5o_getinfo_same_file(void) HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, through group IDs */ - ret = H5Oget_info2(gid1, &oinfo1, 0); + ret = H5Oget_info2(gid1, &oinfo1, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); - ret = H5Oget_info2(gid2, &oinfo2, 0); + ret = H5Oget_info2(gid2, &oinfo2, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Oget_info"); VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); @@ -1334,9 +1333,9 @@ test_h5o_getinfo_same_file(void) HDmemset(&oinfo2, 0, sizeof(oinfo2)); /* Query the object info for each object, by name */ - ret = H5Oget_info_by_name2(fid1, "group1", &oinfo1, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid1, "group1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(fid1, "group2", &oinfo2, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid1, "group2", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); @@ -1443,7 +1442,7 @@ test_h5o_getinfo_visit(void) /* Query the object info for "group1" via H5Oget_info1 and H5Oget_info2 */ ret = H5Oget_info1(gid1, &oinfo1); CHECK(ret, FAIL, "H5Oget_info"); - ret = H5Oget_info2(gid1, &oinfo2, H5O_INFO_NUM_ATTRS); + ret = H5Oget_info2(gid1, &oinfo2, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS); CHECK(ret, FAIL, "H5Oget_info"); /* Verify the object info for "group1" is correct */ @@ -1632,8 +1631,8 @@ test_h5o_perform_getinfo_visit(void) HDgettimeofday(&startTime, 0); /* Recursively visit all the objects from the root group via H5Ovisit2 */ - /* Object info with fields = 0 is returned to perform_visit_obj_cb() */ - ret = H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, perform_visit_obj_cb, NULL, 0); + /* Object info with fields = H5O_INFO_BASIC is returned to perform_visit_obj_cb() */ + ret = H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, perform_visit_obj_cb, NULL, H5O_INFO_BASIC); CHECK(ret, FAIL, "H5Ovisit2"); /* Get the ending time */ diff --git a/test/titerate.c b/test/titerate.c index 1f4c0ed..de652a7 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -213,7 +213,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT); CHECK(ret, FAIL, "H5Lget_name_by_idx"); - ret = H5Oget_info_by_idx2(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_idx"); } /* end for */ @@ -239,7 +239,7 @@ test_iter_group(hid_t fapl, hbool_t new_format) ret = (herr_t)H5Lget_name_by_idx(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT); CHECK(ret, FAIL, "H5Lget_name_by_idx"); - ret = H5Oget_info_by_idx2(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_idx"); } /* end for */ @@ -553,7 +553,7 @@ liter_cb2(hid_t loc_id, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_ /* * Get type of the object and check it. */ - ret = H5Oget_info_by_name2(loc_id, name, &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(loc_id, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); if(test_info->type != oinfo.type) { @@ -797,7 +797,7 @@ static void test_grp_memb_funcs(hid_t fapl) obj_names[i] = HDstrdup(dataset_name); CHECK_PTR(obj_names[i], "strdup"); - ret = H5Oget_info_by_idx2(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_idx"); if(!HDstrcmp(dataset_name, "grp")) @@ -891,7 +891,7 @@ static void test_links(hid_t fapl) /* Get object type */ if(linfo.type == H5L_TYPE_HARD) { - ret = H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_idx"); } /* end if */ diff --git a/test/tmisc.c b/test/tmisc.c index 0ee0302..07234e9 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -674,11 +674,11 @@ test_misc4(void) CHECK(group3, FAIL, "H5Gcreate2"); /* Get the stat information for each group */ - ret = H5Oget_info_by_name2(file1, MISC4_GROUP_1, &oinfo1, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file1, MISC4_GROUP_1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(file1, MISC4_GROUP_2, &oinfo2, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file1, MISC4_GROUP_2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Oget_info_by_name2(file2, MISC4_GROUP_1, &oinfo3, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(file2, MISC4_GROUP_1, &oinfo3, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_name"); /* Verify that the fileno values are the same for groups from file1 */ @@ -3958,7 +3958,7 @@ test_misc23(void) tmp_id = H5Gopen2(file_id, "/A/B01", H5P_DEFAULT); CHECK(tmp_id, FAIL, "H5Gopen2"); - status = H5Oget_info2(tmp_id, &oinfo, 0); + status = H5Oget_info2(tmp_id, &oinfo, H5O_INFO_BASIC); CHECK(status, FAIL, "H5Oget_info"); VERIFY(oinfo.rc, 1, "H5Oget_info"); @@ -5238,7 +5238,7 @@ test_misc30_get_info_cb(hid_t loc_id, const char *name, const H5L_info_t H5_ATTR { H5O_info_t object_info; - return H5Oget_info_by_name2(loc_id, name, &object_info, 0, H5P_DEFAULT); + return H5Oget_info_by_name2(loc_id, name, &object_info, H5O_INFO_BASIC, H5P_DEFAULT); } static int @@ -5504,19 +5504,19 @@ test_misc33(void) /* Case (1) */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_name2(fid, "/soft_two", &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "/soft_two", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Oget_info_by_name"); /* Case (2) */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_name2(fid, "/dsetA", &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "/dsetA", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Oget_info_by_name"); /* Case (3) */ H5E_BEGIN_TRY { - ret = H5Oget_info_by_name2(fid, "/soft_one", &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_name2(fid, "/soft_one", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Oget_info_by_name"); diff --git a/test/trefer.c b/test/trefer.c index 30ad112..4f76cb3 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -1411,7 +1411,7 @@ test_reference_group(void) CHECK(size, FAIL, "H5Lget_name_by_idx"); VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx"); - ret = H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, 0, H5P_DEFAULT); + ret = H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_idx"); VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx"); diff --git a/test/unlink.c b/test/unlink.c index c3ebc4c..2a7bbcd 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -446,9 +446,9 @@ check_new_move(hid_t fapl) FAIL_STACK_ERROR /* Get hard link info */ - if(H5Oget_info_by_name2(file, "/group2/group_new_name", &oi_hard1, 0, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(file, "/group2/group_new_name", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - if(H5Oget_info_by_name2(file, "/group1/hard", &oi_hard2, 0, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(file, "/group1/hard", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check hard links */ @@ -2228,7 +2228,7 @@ test_full_group_compact(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name2(file_id, objname, &oi, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 2) TEST_ERROR } /* end for */ @@ -2245,7 +2245,7 @@ test_full_group_compact(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name2(file_id, objname, &oi, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 1) TEST_ERROR } /* end for */ @@ -2374,7 +2374,7 @@ test_full_group_dense(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name2(file_id, objname, &oi, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 2) TEST_ERROR } /* end for */ @@ -2391,7 +2391,7 @@ test_full_group_dense(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { sprintf(objname, "/keep/keep %u\n", u); - if(H5Oget_info_by_name2(file_id, objname, &oi, 0, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 1) TEST_ERROR } /* end for */ diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 041ac8d..28b1f00 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -433,7 +433,7 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata) HGOTO_DONE(0); if(h5trav_visit(tinfo->fid, path, TRUE, TRUE, - trav_grp_objs,trav_grp_symlinks, tinfo, 0) < 0) { + trav_grp_objs,trav_grp_symlinks, tinfo, H5O_INFO_BASIC) < 0) { parallel_print("Error: Could not get file contents\n"); opts->err_stat = 1; HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Could not get file contents"); @@ -465,7 +465,7 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata) HGOTO_DONE(0); if(h5trav_visit(tinfo->fid, path, TRUE, TRUE, - trav_grp_objs,trav_grp_symlinks, tinfo, 0) < 0) { + trav_grp_objs,trav_grp_symlinks, tinfo, H5O_INFO_BASIC) < 0) { parallel_print("Error: Could not get file contents\n"); opts->err_stat = 1; HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Could not get file contents\n"); @@ -645,7 +645,7 @@ h5diff(const char *fname1, /* optional data pass */ info1_obj->opts = (diff_opt_t*)opts; - if(H5Oget_info_by_name2(file1_id, obj1fullname, &oinfo1, 0, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name2(file1_id, obj1fullname, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { parallel_print("Error: Could not get file contents\n"); HGOTO_ERROR(1, H5E_tools_min_id_g, "Error: Could not get file contents"); } @@ -695,7 +695,7 @@ h5diff(const char *fname1, /* optional data pass */ info2_obj->opts = (diff_opt_t*)opts; - if(H5Oget_info_by_name2(file2_id, obj2fullname, &oinfo2, 0, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name2(file2_id, obj2fullname, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { parallel_print("Error: Could not get file contents\n"); HGOTO_ERROR(1, H5E_tools_min_id_g, "Error: Could not get file contents"); } @@ -846,7 +846,7 @@ h5diff(const char *fname1, info1_grp->opts = (diff_opt_t*)opts; if(h5trav_visit(file1_id, obj1fullname, TRUE, TRUE, - trav_grp_objs, trav_grp_symlinks, info1_grp, 0) < 0) { + trav_grp_objs, trav_grp_symlinks, info1_grp, H5O_INFO_BASIC) < 0) { parallel_print("Error: Could not get file contents\n"); HGOTO_ERROR(1, H5E_tools_min_id_g, "Could not get file contents"); } @@ -860,7 +860,7 @@ h5diff(const char *fname1, info2_grp->opts = (diff_opt_t*)opts; if(h5trav_visit(file2_id, obj2fullname, TRUE, TRUE, - trav_grp_objs, trav_grp_symlinks, info2_grp, 0) < 0) { + trav_grp_objs, trav_grp_symlinks, info2_grp, H5O_INFO_BASIC) < 0) { parallel_print("Error: Could not get file contents\n"); HGOTO_ERROR(1, H5E_tools_min_id_g, "Could not get file contents"); } /* end if */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index e72f738..9d5f062 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -2096,8 +2096,8 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t if (nfound_b && opts->m_verbose) { H5O_info_t oi1, oi2; - H5Oget_info2(obj1_id, &oi1, 0); - H5Oget_info2(obj2_id, &oi2, 0); + H5Oget_info2(obj1_id, &oi1, H5O_INFO_BASIC); + H5Oget_info2(obj2_id, &oi2, H5O_INFO_BASIC); parallel_print("Referenced dataset %lu %lu\n", (unsigned long) oi1.addr, (unsigned long) oi2.addr); parallel_print( "------------------------------------------------------------\n"); diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 7ba82dd..470df63 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1758,14 +1758,14 @@ h5tools_is_obj_same(hid_t loc_id1, const char *name1, hbool_t ret_val = 0; if ( name1 && HDstrcmp(name1, ".")) - H5Oget_info_by_name2(loc_id1, name1, &oinfo1, 0, H5P_DEFAULT); + H5Oget_info_by_name2(loc_id1, name1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT); else - H5Oget_info2(loc_id1, &oinfo1, 0); + H5Oget_info2(loc_id1, &oinfo1, H5O_INFO_BASIC); if ( name2 && HDstrcmp(name2, ".")) - H5Oget_info_by_name2(loc_id2, name2, &oinfo2, 0, H5P_DEFAULT); + H5Oget_info_by_name2(loc_id2, name2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); else - H5Oget_info2(loc_id2, &oinfo2, 0); + H5Oget_info2(loc_id2, &oinfo2, H5O_INFO_BASIC); if (oinfo1.fileno == oinfo2.fileno && oinfo1.addr==oinfo2.addr) ret_val = 1; diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 42f9d05..69cecb0 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -1905,7 +1905,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ H5O_info_t oinfo; obj_t *obj = NULL; /* Found object */ - H5Oget_info2(type, &oinfo, 0); + H5Oget_info2(type, &oinfo, H5O_INFO_BASIC); obj = search_obj(h5dump_type_table, oinfo.addr); if(obj) { diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index a874c0f..e98a8e2 100644 --- a/tools/lib/h5tools_ref.c +++ b/tools/lib/h5tools_ref.c @@ -113,7 +113,7 @@ init_ref_path_table(void) return (-1); /* Iterate over objects in this file */ - if(h5trav_visit(thefile, "/", TRUE, TRUE, init_ref_path_cb, NULL, NULL, 0) < 0) { + if(h5trav_visit(thefile, "/", TRUE, TRUE, init_ref_path_cb, NULL, NULL, H5O_INFO_BASIC) < 0) { error_msg("unable to construct reference path table\n"); h5tools_setstatus(EXIT_FAILURE); } /* end if */ @@ -184,7 +184,7 @@ ref_path_table_lookup(const char *thepath) /* Get the object info now */ /* (returns failure for dangling soft links) */ - if(H5Oget_info_by_name2(thefile, thepath, &oi, 0, H5P_DEFAULT) < 0) + if(H5Oget_info_by_name2(thefile, thepath, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) return HADDR_UNDEF; /* Return OID */ diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 3d029d2..3d595ca 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -1120,7 +1120,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai const char *path; obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, vp); - H5Oget_info2(obj, &oi, 0); + H5Oget_info2(obj, &oi, H5O_INFO_BASIC); /* Print object type and close object */ switch(oi.type) { diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index fad3c5b..8ac0d32 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -507,7 +507,7 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen if(H5Tcommitted(type) > 0) { H5O_info_t type_oinfo; - H5Oget_info2(type, &type_oinfo, 0); + H5Oget_info2(type, &type_oinfo, H5O_INFO_BASIC); if(search_obj(info->type_table, type_oinfo.addr) == NULL) add_obj(info->type_table, type_oinfo.addr, name, FALSE); } /* end if */ @@ -573,7 +573,7 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table, info->dset_table = *dset_table; /* Find all shared objects */ - return(h5trav_visit(fid, "/", TRUE, TRUE, find_objs_cb, NULL, info, 0)); + return(h5trav_visit(fid, "/", TRUE, TRUE, find_objs_cb, NULL, info, H5O_INFO_BASIC)); } @@ -729,7 +729,7 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_ } /* get target object info */ - if(H5Oget_info_by_name2(file_id, linkpath, &trg_oinfo, 0, lapl) < 0) { + if(H5Oget_info_by_name2(file_id, linkpath, &trg_oinfo, H5O_INFO_BASIC, lapl) < 0) { if(link_info->opt.msg_mode == 1) parallel_print("Warning: unable to get object information for <%s>\n", linkpath); HGOTO_DONE(FAIL); diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index e2df439..917d5f5 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -358,9 +358,9 @@ trav_fileinfo_add(trav_info_t *info, hid_t loc_id) size_t idx = info->nused - 1; if ( info->paths[idx].path && HDstrcmp(info->paths[idx].path, ".")) - H5Oget_info_by_name2(loc_id, info->paths[idx].path, &oinfo, 0, H5P_DEFAULT); + H5Oget_info_by_name2(loc_id, info->paths[idx].path, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); else - H5Oget_info2(loc_id, &oinfo, 0); + H5Oget_info2(loc_id, &oinfo, H5O_INFO_BASIC); info->paths[idx].objno = oinfo.addr; info->paths[idx].fileno = oinfo.fileno; @@ -438,7 +438,7 @@ h5trav_getinfo(hid_t file_id, trav_info_t *info) info_visitor.udata = info; /* Traverse all objects in the file, visiting each object & link */ - if(traverse(file_id, "/", TRUE, TRUE, &info_visitor, 0) < 0) + if(traverse(file_id, "/", TRUE, TRUE, &info_visitor, H5O_INFO_BASIC) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); done: @@ -604,7 +604,7 @@ h5trav_gettable(hid_t fid, trav_table_t *table) table_visitor.udata = table; /* Traverse all objects in the file, visiting each object & link */ - if(traverse(fid, "/", TRUE, TRUE, &table_visitor, 0) < 0) + if(traverse(fid, "/", TRUE, TRUE, &table_visitor, H5O_INFO_BASIC) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); done: @@ -1029,7 +1029,7 @@ h5trav_print(hid_t fid) print_visitor.udata = &print_udata; /* Traverse all objects in the file, visiting each object & link */ - if(traverse(fid, "/", TRUE, TRUE, &print_visitor, 0) < 0) + if(traverse(fid, "/", TRUE, TRUE, &print_visitor, H5O_INFO_BASIC) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); done: diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index a0d2e6e..a5f0369 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -1,5 +1,4 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * @@ -1483,7 +1482,7 @@ main(int argc, const char *argv[]) } /* Get object info for root group */ - if(H5Oget_info_by_name2(fid, "/", &oi, 0, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name2(fid, "/", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); h5tools_setstatus(EXIT_FAILURE); goto done; diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c index d4ce2da..5c47abd 100644 --- a/tools/src/h5dump/h5dump_ddl.c +++ b/tools/src/h5dump/h5dump_ddl.c @@ -229,7 +229,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR H5O_info_t oinfo; /* Stat the object */ - if(H5Oget_info_by_name2(group, name, &oinfo, 0, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name2(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { error_msg("unable to get object information for \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; @@ -706,7 +706,7 @@ dump_named_datatype(hid_t tid, const char *name) h5tools_dump_header_format->datatypeblockbegin); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - H5Oget_info2(tid, &oinfo, 0); + H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC); /* Must check for uniqueness of all objects if we've traversed an elink, * otherwise only check if the reference count > 1. @@ -876,7 +876,7 @@ dump_group(hid_t gid, const char *name) h5tools_dump_comment(rawoutstream, outputformat, &ctx, gid); - H5Oget_info2(gid, &oinfo, 0); + H5Oget_info2(gid, &oinfo, H5O_INFO_BASIC); /* Must check for uniqueness of all objects if we've traversed an elink, * otherwise only check if the reference count > 1. @@ -1512,7 +1512,7 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H handle_udata.fid = fid; handle_udata.op_name = path_name; - if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata, 0) < 0) { + if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata, H5O_INFO_BASIC) < 0) { error_msg("error traversing information\n"); h5tools_setstatus(EXIT_FAILURE); } @@ -1800,7 +1800,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis } /* end if */ - H5Oget_info2(dsetid, &oinfo, 0); + H5Oget_info2(dsetid, &oinfo, H5O_INFO_BASIC); if(oinfo.rc > 1 || hit_elink) { obj_t *found_obj; /* Found object */ @@ -2101,7 +2101,7 @@ dump_extlink(hid_t group, const char *linkname, const char *objname) goto fail; /* Get object info */ - if (H5Oget_info2(oid, &oi, 0) < 0) { + if (H5Oget_info2(oid, &oi, H5O_INFO_BASIC) < 0) { H5Oclose(oid); goto fail; } diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index 6c04aef..e399d8f 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -180,7 +180,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ H5O_info_t oinfo; /* Stat the object */ - if(H5Oget_info_by_name2(group, name, &oinfo, 0, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name2(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { error_msg("unable to get object information for \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; @@ -881,7 +881,7 @@ xml_print_datatype(hid_t type, unsigned in_group) obj_t *found_obj; /* Found object */ /* detect a shared datatype, output only once */ - H5Oget_info2(type, &oinfo, 0); + H5Oget_info2(type, &oinfo, H5O_INFO_BASIC); found_obj = search_obj(type_table, oinfo.addr); if(found_obj) { @@ -1534,7 +1534,7 @@ xml_dump_datatype(hid_t type) obj_t *found_obj; /* Found object */ /* Datatype is a shared or named datatype */ - H5Oget_info2(type, &oinfo, 0); + H5Oget_info2(type, &oinfo, H5O_INFO_BASIC); found_obj = search_obj(type_table, oinfo.addr); if(found_obj) { @@ -2362,7 +2362,7 @@ xml_dump_named_datatype(hid_t type, const char *name) h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* Check uniqueness of named datatype */ - H5Oget_info2(type, &oinfo, 0); + H5Oget_info2(type, &oinfo, H5O_INFO_BASIC); if(oinfo.rc > 1) { obj_t *found_obj; /* Found object */ @@ -2548,7 +2548,7 @@ xml_dump_group(hid_t gid, const char *name) } } - H5Oget_info2(gid, &oinfo, 0); + H5Oget_info2(gid, &oinfo, H5O_INFO_BASIC); if(oinfo.rc > 1) { obj_t *found_obj; /* Found object */ diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c index cb1be4d..0fc0289 100644 --- a/tools/src/h5format_convert/h5format_convert.c +++ b/tools/src/h5format_convert/h5format_convert.c @@ -430,7 +430,7 @@ main(int argc, const char *argv[]) } else { /* Convert all datasets in the file */ if(verbose_g) HDfprintf(stdout, "Processing all datasets in the file...\n"); - if(h5trav_visit(fid, "/", TRUE, TRUE, convert_dsets_cb, NULL, &fid, 0) < 0) + if(h5trav_visit(fid, "/", TRUE, TRUE, convert_dsets_cb, NULL, &fid, H5O_INFO_BASIC) < 0) goto done; } /* end else */ diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 653438d..4bc1526 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -1320,7 +1320,7 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind) if(H5Tcommitted(type)) { H5O_info_t oi; - if(H5Oget_info2(type, &oi, 0) >= 0) + if(H5Oget_info2(type, &oi, H5O_INFO_BASIC) >= 0) h5tools_str_append(buffer,"shared-%lu:"H5_PRINTF_HADDR_FMT" ", oi.fileno, oi.addr); else @@ -2386,7 +2386,7 @@ visit_obj(hid_t file, const char *oname, iter_t *iter) h5tools_str_reset(&buffer); /* Retrieve info for object to list */ - if(H5Oget_info_by_name2(file, oname, &oi, H5O_INFO_TIME, H5P_DEFAULT) < 0) { + if(H5Oget_info_by_name2(file, oname, &oi, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) { if(iter->symlink_target) { h5tools_str_append(&buffer, "{**NOT FOUND**}\n"); iter->symlink_target = FALSE; @@ -2414,7 +2414,7 @@ visit_obj(hid_t file, const char *oname, iter_t *iter) iter->name_start = iter->base_len; /* Specified name is a group. List the complete contents of the group. */ - h5trav_visit(file, oname, (hbool_t) (display_root_g || iter->symlink_target), recursive_g, list_obj, list_lnk, iter, H5O_INFO_TIME); + h5trav_visit(file, oname, (hbool_t) (display_root_g || iter->symlink_target), recursive_g, list_obj, list_lnk, iter, H5O_INFO_BASIC|H5O_INFO_TIME); /* Close group */ if(!iter->symlink_target) diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index aa2d909..a63e56f 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -222,7 +222,7 @@ hid_t copy_named_datatype(hid_t type_in, hid_t fidout, H5O_info_t oinfo; /* Object info of input dtype */ hid_t ret_value = -1; /* The identifier of the named dtype in the out file */ - if (H5Oget_info2(type_in, &oinfo, 0) < 0) + if (H5Oget_info2(type_in, &oinfo, H5O_INFO_BASIC) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed"); if (*named_dt_head_p) { diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c index 80c98b5..a275443 100644 --- a/tools/src/h5repack/h5repack_refs.c +++ b/tools/src/h5repack/h5repack_refs.c @@ -807,7 +807,7 @@ MapIdToName(hid_t refobj_id, trav_table_t *travt) H5O_info_t ref_oinfo; /* Stat for the refobj id */ /* obtain information to identify the referenced object uniquely */ - if(H5Oget_info2(refobj_id, &ref_oinfo, 0) < 0) + if(H5Oget_info2(refobj_id, &ref_oinfo, H5O_INFO_BASIC) < 0) goto out; if(ref_oinfo.addr == travt->objs[u].objno) { -- cgit v0.12 From 1da9c5545c013ebc540ba3044810889d4acfa5be Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 14 May 2018 17:50:11 -0700 Subject: Restored some unused #defines to the deprecated section of H5Dpublic.h. --- src/H5Dpublic.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index 6cec3f5..a1ccda0 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -178,7 +178,19 @@ H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type); /* Macros */ #define H5D_CHUNK_BTREE H5D_CHUNK_IDX_BTREE - +/* Formerly used to support the H5DOread/write_chunk() API calls. + * These symbols are no longer used in the library. + */ +/* Property names for H5DOwrite_chunk */ +#define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME "direct_chunk_flag" +#define H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME "direct_chunk_filters" +#define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME "direct_chunk_offset" +#define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME "direct_chunk_datasize" +/* Property names for H5DOread_chunk */ +#define H5D_XFER_DIRECT_CHUNK_READ_FLAG_NAME "direct_chunk_read_flag" +#define H5D_XFER_DIRECT_CHUNK_READ_OFFSET_NAME "direct_chunk_read_offset" +#define H5D_XFER_DIRECT_CHUNK_READ_FILTERS_NAME "direct_chunk_read_filters" + /* Typedefs */ -- cgit v0.12 From 448cc37a90b2a71aac45c96949da07d5a9cc9cbd Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 24 May 2018 14:05:47 -0700 Subject: Removed unused H5MF functions and updated FUNC_ENTER macros and naming in H5MFsection.c. --- src/H5MFsection.c | 297 +++++++++++++++++------------------------------------- 1 file changed, 91 insertions(+), 206 deletions(-) diff --git a/src/H5MFsection.c b/src/H5MFsection.c index fe140a7..d722139 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -56,44 +56,40 @@ /********************/ /* 'simple/small/large' section callbacks */ -static H5FS_section_info_t *H5MF_sect_deserialize(const H5FS_section_class_t *cls, +static H5FS_section_info_t *H5MF__sect_deserialize(const H5FS_section_class_t *cls, const uint8_t *buf, haddr_t sect_addr, hsize_t sect_size, unsigned *des_flags); -static herr_t H5MF_sect_valid(const H5FS_section_class_t *cls, +static herr_t H5MF__sect_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t *sect); -static H5FS_section_info_t *H5MF_sect_split(H5FS_section_info_t *sect, +static H5FS_section_info_t *H5MF__sect_split(H5FS_section_info_t *sect, hsize_t frag_size); /* 'simple' section callbacks */ -static htri_t H5MF_sect_simple_can_merge(const H5FS_section_info_t *sect1, +static htri_t H5MF__sect_simple_can_merge(const H5FS_section_info_t *sect1, const H5FS_section_info_t *sect2, void *udata); -static herr_t H5MF_sect_simple_merge(H5FS_section_info_t **sect1, +static herr_t H5MF__sect_simple_merge(H5FS_section_info_t **sect1, H5FS_section_info_t *sect2, void *udata); -static htri_t H5MF_sect_simple_can_shrink(const H5FS_section_info_t *_sect, +static htri_t H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *udata); -static herr_t H5MF_sect_simple_shrink(H5FS_section_info_t **_sect, +static herr_t H5MF__sect_simple_shrink(H5FS_section_info_t **_sect, void *udata); /* 'small' section callbacks */ -static herr_t H5MF_sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata); -static htri_t H5MF_sect_small_can_merge(const H5FS_section_info_t *sect1, +static herr_t H5MF__sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata); +static htri_t H5MF__sect_small_can_merge(const H5FS_section_info_t *sect1, const H5FS_section_info_t *sect2, void *udata); -static herr_t H5MF_sect_small_merge(H5FS_section_info_t **sect1, +static herr_t H5MF__sect_small_merge(H5FS_section_info_t **sect1, H5FS_section_info_t *sect2, void *udata); -static htri_t H5MF_sect_small_can_shrink(const H5FS_section_info_t *_sect, - void *udata); -static herr_t H5MF_sect_small_shrink(H5FS_section_info_t **_sect, - void *udata); /* 'large' section callbacks */ -static htri_t H5MF_sect_large_can_merge(const H5FS_section_info_t *sect1, +static htri_t H5MF__sect_large_can_merge(const H5FS_section_info_t *sect1, const H5FS_section_info_t *sect2, void *udata); -static herr_t H5MF_sect_large_merge(H5FS_section_info_t **sect1, +static herr_t H5MF__sect_large_merge(H5FS_section_info_t **sect1, H5FS_section_info_t *sect2, void *udata); -static htri_t H5MF_sect_large_can_shrink(const H5FS_section_info_t *_sect, +static htri_t H5MF__sect_large_can_shrink(const H5FS_section_info_t *_sect, void *udata); -static herr_t H5MF_sect_large_shrink(H5FS_section_info_t **_sect, +static herr_t H5MF__sect_large_shrink(H5FS_section_info_t **_sect, void *udata); /*********************/ @@ -115,14 +111,14 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{ /* Object methods */ NULL, /* Add section */ NULL, /* Serialize section */ - H5MF_sect_deserialize, /* Deserialize section */ - H5MF_sect_simple_can_merge, /* Can sections merge? */ - H5MF_sect_simple_merge, /* Merge sections */ - H5MF_sect_simple_can_shrink, /* Can section shrink container?*/ - H5MF_sect_simple_shrink, /* Shrink container w/section */ + H5MF__sect_deserialize, /* Deserialize section */ + H5MF__sect_simple_can_merge, /* Can sections merge? */ + H5MF__sect_simple_merge, /* Merge sections */ + H5MF__sect_simple_can_shrink, /* Can section shrink container?*/ + H5MF__sect_simple_shrink, /* Shrink container w/section */ H5MF_sect_free, /* Free section */ - H5MF_sect_valid, /* Check validity of section */ - H5MF_sect_split, /* Split section node for alignment */ + H5MF__sect_valid, /* Check validity of section */ + H5MF__sect_split, /* Split section node for alignment */ NULL, /* Dump debugging for section */ }}; @@ -139,16 +135,16 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{ NULL, /* Terminate section class */ /* Object methods */ - H5MF_sect_small_add, /* Add section */ + H5MF__sect_small_add, /* Add section */ NULL, /* Serialize section */ - H5MF_sect_deserialize, /* Deserialize section */ - H5MF_sect_small_can_merge, /* Can sections merge? */ - H5MF_sect_small_merge, /* Merge sections */ - NULL, /* Can section shrink container?*/ - NULL, /* Shrink container w/section */ + H5MF__sect_deserialize, /* Deserialize section */ + H5MF__sect_small_can_merge, /* Can sections merge? */ + H5MF__sect_small_merge, /* Merge sections */ + NULL, /* Can section shrink container?*/ + NULL, /* Shrink container w/section */ H5MF_sect_free, /* Free section */ - H5MF_sect_valid, /* Check validity of section */ - H5MF_sect_split, /* Split section node for alignment */ + H5MF__sect_valid, /* Check validity of section */ + H5MF__sect_split, /* Split section node for alignment */ NULL, /* Dump debugging for section */ }}; @@ -167,14 +163,14 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{ /* Object methods */ NULL, /* Add section */ NULL, /* Serialize section */ - H5MF_sect_deserialize, /* Deserialize section */ - H5MF_sect_large_can_merge, /* Can sections merge? */ - H5MF_sect_large_merge, /* Merge sections */ - H5MF_sect_large_can_shrink, /* Can section shrink container?*/ - H5MF_sect_large_shrink, /* Shrink container w/section */ + H5MF__sect_deserialize, /* Deserialize section */ + H5MF__sect_large_can_merge, /* Can sections merge? */ + H5MF__sect_large_merge, /* Merge sections */ + H5MF__sect_large_can_shrink, /* Can section shrink container?*/ + H5MF__sect_large_shrink, /* Shrink container w/section */ H5MF_sect_free, /* Free section */ - H5MF_sect_valid, /* Check validity of section */ - H5MF_sect_split, /* Split section node for alignment */ + H5MF__sect_valid, /* Check validity of section */ + H5MF__sect_split, /* Split section node for alignment */ NULL, /* Dump debugging for section */ }}; @@ -283,14 +279,14 @@ H5MF_sect_free(H5FS_section_info_t *_sect) *------------------------------------------------------------------------- */ static H5FS_section_info_t * -H5MF_sect_deserialize(const H5FS_section_class_t *cls, +H5MF__sect_deserialize(const H5FS_section_class_t *cls, const uint8_t H5_ATTR_UNUSED *buf, haddr_t sect_addr, hsize_t sect_size, unsigned H5_ATTR_UNUSED *des_flags) { H5MF_free_section_t *sect; /* New section */ H5FS_section_info_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(cls); @@ -306,11 +302,11 @@ H5MF_sect_deserialize(const H5FS_section_class_t *cls, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5MF_sect_deserialize() */ +} /* H5MF__sect_deserialize() */ /*------------------------------------------------------------------------- - * Function: H5MF_sect_valid + * Function: H5MF__sect_valid * * Purpose: Check the validity of a section * @@ -323,7 +319,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5MF_sect_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, +H5MF__sect_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5FS_section_info_t #ifdef NDEBUG H5_ATTR_UNUSED @@ -334,17 +330,17 @@ H5MF_sect_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */ #endif /* NDEBUG */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments. */ HDassert(sect); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5MF_sect_valid() */ +} /* H5MF__sect_valid() */ /*------------------------------------------------------------------------- - * Function: H5MF_sect_split + * Function: H5MF__sect_split * * Purpose: Split SECT into 2 sections: fragment for alignment & the aligned section * SECT's addr and size are updated to point to the aligned section @@ -357,11 +353,11 @@ H5MF_sect_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, *------------------------------------------------------------------------- */ static H5FS_section_info_t * -H5MF_sect_split(H5FS_section_info_t *sect, hsize_t frag_size) +H5MF__sect_split(H5FS_section_info_t *sect, hsize_t frag_size) { H5MF_free_section_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Allocate space for new section */ if(NULL == (ret_value = H5MF_sect_new(sect->type, sect->addr, frag_size))) @@ -373,14 +369,14 @@ H5MF_sect_split(H5FS_section_info_t *sect, hsize_t frag_size) done: FUNC_LEAVE_NOAPI((H5FS_section_info_t *)ret_value) -} /* end H5MF_sect_split() */ +} /* end H5MF__sect_split() */ /* * "simple" section callbacks */ /*------------------------------------------------------------------------- - * Function: H5MF_sect_simple_can_merge + * Function: H5MF__sect_simple_can_merge * * Purpose: Can two sections of this type merge? * @@ -395,14 +391,14 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5MF_sect_simple_can_merge(const H5FS_section_info_t *_sect1, +H5MF__sect_simple_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section_info_t *_sect2, void H5_ATTR_UNUSED *_udata) { const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */ const H5MF_free_section_t *sect2 = (const H5MF_free_section_t *)_sect2; /* File free section */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments. */ HDassert(sect1); @@ -414,11 +410,11 @@ H5MF_sect_simple_can_merge(const H5FS_section_info_t *_sect1, ret_value = H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr); FUNC_LEAVE_NOAPI(ret_value) -} /* H5MF_sect_simple_can_merge() */ +} /* H5MF__sect_simple_can_merge() */ /*------------------------------------------------------------------------- - * Function: H5MF_sect_simple_merge + * Function: H5MF__sect_simple_merge * * Purpose: Merge two sections of this type * @@ -433,14 +429,14 @@ H5MF_sect_simple_can_merge(const H5FS_section_info_t *_sect1, *------------------------------------------------------------------------- */ static herr_t -H5MF_sect_simple_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2, +H5MF__sect_simple_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2, void H5_ATTR_UNUSED *_udata) { H5MF_free_section_t **sect1 = (H5MF_free_section_t **)_sect1; /* File free section */ H5MF_free_section_t *sect2 = (H5MF_free_section_t *)_sect2; /* File free section */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sect1); @@ -458,11 +454,11 @@ H5MF_sect_simple_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2 done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5MF_sect_simple_merge() */ +} /* H5MF__sect_simple_merge() */ /*------------------------------------------------------------------------- - * Function: H5MF_sect_simple_can_shrink + * Function: H5MF__sect_simple_can_shrink * * Purpose: Can this section shrink the container? * @@ -475,7 +471,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5MF_sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata) +H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata) { const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */ H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */ @@ -483,7 +479,7 @@ H5MF_sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata) haddr_t end; /* End of section to extend */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sect); @@ -557,11 +553,11 @@ HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins small data aggregator\n", FUNC done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5MF_sect_simple_can_shrink() */ +} /* H5MF__sect_simple_can_shrink() */ /*------------------------------------------------------------------------- - * Function: H5MF_sect_simple_shrink + * Function: H5MF__sect_simple_shrink * * Purpose: Shrink container with section * @@ -574,13 +570,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5MF_sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata) +H5MF__sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata) { H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* File free section */ H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sect); @@ -617,7 +613,7 @@ H5MF_sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5MF_sect_simple_shrink() */ +} /* H5MF__sect_simple_shrink() */ /* * "small" section callbacks @@ -625,7 +621,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5MF_sect_small_add + * Function: H5MF__sect_small_add * * Purpose: Perform actions on a small "meta" action before adding it to the free space manager: * 1) Drop the section if it is at page end and its size <= page end threshold @@ -640,7 +636,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5MF_sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata) +H5MF__sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata) { H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* Fractal heap free section */ H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */ @@ -648,7 +644,7 @@ H5MF_sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata) hsize_t rem, prem; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef H5MF_ALLOC_DEBUG_MORE HDfprintf(stderr, "%s: Entering, section {%a, %Hu}\n", FUNC, (*sect)->sect_info.addr, (*sect)->sect_info.size); @@ -684,122 +680,11 @@ HDfprintf(stderr, "%s: section is adjusted {%a, %Hu}\n", FUNC, (*sect)->sect_inf done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5MF_sect_small_add() */ +} /* H5MF__sect_small_add() */ /*------------------------------------------------------------------------- - * Function: H5MF_sect_small_can_shrink - * - * Purpose: Can this section shrink the container? - * - * Note: A small section is allowed to shrink only at closing. - * - * Note: This is unused currently, to maintain the invariant that the - * file size is always a multiple of the page size. - * - * (This function should probably be deleted, or the invariant - * relaxed) - * - * Return: Success: non-negative (TRUE/FALSE) - * Failure: negative - * - * Programmer: Vailin Choi; Dec 2012 - * - *------------------------------------------------------------------------- - */ -static htri_t -H5MF_sect_small_can_shrink(const H5FS_section_info_t *_sect, void *_udata) -{ - const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */ - H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */ - haddr_t eoa; /* End of address space in the file */ - haddr_t end; /* End of section to extend */ - htri_t ret_value = FALSE; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Check arguments. */ - HDassert(sect); - HDassert(udata); - HDassert(udata->f); - - /* Retrieve the end of the file's address space */ - if(HADDR_UNDEF == (eoa = H5FD_get_eoa(udata->f->shared->lf, udata->alloc_type))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") - - /* Compute address of end of section to check */ - end = sect->sect_info.addr + sect->sect_info.size; - - /* Check if the section is exactly at the end of the allocated space in the file */ - if(H5F_addr_eq(end, eoa) && sect->sect_info.size == udata->f->shared->fs_page_size) { - udata->shrink = H5MF_SHRINK_EOA; - -#ifdef H5MF_ALLOC_DEBUG_MORE -HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect->sect_info.addr, sect->sect_info.size, eoa); -#endif /* H5MF_ALLOC_DEBUG_MORE */ - - /* Indicate shrinking can occur */ - HGOTO_DONE(TRUE) - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5MF_sect_small_can_shrink() */ - - -/*------------------------------------------------------------------------- - * Function: H5MF_sect_small_shrink - * - * Purpose: Shrink container with section - * - * Note: This is unused currently, to maintain the invariant that the - * file size is always a multiple of the page size. - * - * (This function should probably be deleted, or the invariant - * relaxed) - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Vailin Choi; Dec 2012 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5MF_sect_small_shrink(H5FS_section_info_t **_sect, void *_udata) -{ - H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* File free section */ - H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Check arguments. */ - HDassert(sect); - HDassert((*sect)->sect_info.type == H5MF_FSPACE_SECT_SMALL); - HDassert(udata); - HDassert(udata->f); - HDassert(udata->shrink == H5MF_SHRINK_EOA); - HDassert(H5F_INTENT(udata->f) & H5F_ACC_RDWR); - - /* Release section's space at EOA */ - if(H5F__free(udata->f, udata->alloc_type, (*sect)->sect_info.addr, (*sect)->sect_info.size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "driver free request failed") - - /* Free section */ - if(H5MF_sect_free((H5FS_section_info_t *)*sect) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") - - /* Mark section as freed, for free space manager */ - *sect = NULL; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5MF_sect_small_shrink() */ - - -/*------------------------------------------------------------------------- - * Function: H5MF_sect_small_can_merge + * Function: H5MF__sect_small_can_merge * * Purpose: Can two sections of this type merge? * @@ -814,7 +699,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5MF_sect_small_can_merge(const H5FS_section_info_t *_sect1, +H5MF__sect_small_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section_info_t *_sect2, void *_udata) { const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */ @@ -822,7 +707,7 @@ H5MF_sect_small_can_merge(const H5FS_section_info_t *_sect1, H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */ htri_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments. */ HDassert(sect1); @@ -842,11 +727,11 @@ HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5MF_sect_small_can_merge() */ +} /* H5MF__sect_small_can_merge() */ /*------------------------------------------------------------------------- - * Function: H5MF_sect_small_merge + * Function: H5MF__sect_small_merge * * Purpose: Merge two sections of this type * @@ -862,7 +747,7 @@ HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value); *------------------------------------------------------------------------- */ static herr_t -H5MF_sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2, +H5MF__sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2, void *_udata) { H5MF_free_section_t **sect1 = (H5MF_free_section_t **)_sect1; /* File free section */ @@ -870,7 +755,7 @@ H5MF_sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2, H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sect1); @@ -905,7 +790,7 @@ H5MF_sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5MF_sect_small_merge() */ +} /* H5MF__sect_small_merge() */ /* * "Large" section callbacks @@ -913,7 +798,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5MF_sect_large_can_merge (same as H5MF_sect_simple_can_merge) + * Function: H5MF__sect_large_can_merge (same as H5MF__sect_simple_can_merge) * * Purpose: Can two sections of this type merge? * @@ -927,14 +812,14 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5MF_sect_large_can_merge(const H5FS_section_info_t *_sect1, +H5MF__sect_large_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section_info_t *_sect2, void H5_ATTR_UNUSED *_udata) { const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */ const H5MF_free_section_t *sect2 = (const H5MF_free_section_t *)_sect2; /* File free section */ htri_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check arguments. */ HDassert(sect1); @@ -949,11 +834,11 @@ HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5MF_sect_large_can_merge() */ +} /* H5MF__sect_large_can_merge() */ /*------------------------------------------------------------------------- - * Function: H5MF_sect_large_merge (same as H5MF_sect_simple_merge) + * Function: H5MF__sect_large_merge (same as H5MF__sect_simple_merge) * * Purpose: Merge two sections of this type * @@ -967,14 +852,14 @@ HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value); *------------------------------------------------------------------------- */ static herr_t -H5MF_sect_large_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2, +H5MF__sect_large_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2, void H5_ATTR_UNUSED *_udata) { H5MF_free_section_t **sect1 = (H5MF_free_section_t **)_sect1; /* File free section */ H5MF_free_section_t *sect2 = (H5MF_free_section_t *)_sect2; /* File free section */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sect1); @@ -992,11 +877,11 @@ H5MF_sect_large_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2, done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5MF_sect_large_merge() */ +} /* H5MF__sect_large_merge() */ /*------------------------------------------------------------------------- - * Function: H5MF_sect_large_can_shrink + * Function: H5MF__sect_large_can_shrink * * Purpose: Can this section shrink the container? * @@ -1008,7 +893,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5MF_sect_large_can_shrink(const H5FS_section_info_t *_sect, void *_udata) +H5MF__sect_large_can_shrink(const H5FS_section_info_t *_sect, void *_udata) { const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */ H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */ @@ -1016,7 +901,7 @@ H5MF_sect_large_can_shrink(const H5FS_section_info_t *_sect, void *_udata) haddr_t end; /* End of section to extend */ htri_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sect); @@ -1045,11 +930,11 @@ HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect- done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5MF_sect_large_can_shrink() */ +} /* H5MF__sect_large_can_shrink() */ /*------------------------------------------------------------------------- - * Function: H5MF_sect_large_shrink + * Function: H5MF__sect_large_shrink * * Purpose: Shrink a large-sized section * @@ -1061,14 +946,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5MF_sect_large_shrink(H5FS_section_info_t **_sect, void *_udata) +H5MF__sect_large_shrink(H5FS_section_info_t **_sect, void *_udata) { H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* File free section */ H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */ hsize_t frag_size = 0; /* Fragment size */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments. */ HDassert(sect); @@ -1100,5 +985,5 @@ H5MF_sect_large_shrink(H5FS_section_info_t **_sect, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5MF_sect_large_shrink() */ +} /* H5MF__sect_large_shrink() */ -- cgit v0.12 From 384a1ec709b841ce1eb8b9bf74be988a1c24d638 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 29 May 2018 14:06:01 -0700 Subject: Normalize with vol_integration. --- src/H5B.c | 8 +- src/H5B2dbg.c | 10 +-- src/H5B2pkg.h | 2 +- src/H5B2test.c | 33 ++++--- src/H5I.c | 110 +++++++++++------------ src/H5Ipkg.h | 2 +- src/H5Itest.c | 42 ++++----- src/H5MF.c | 199 ++++++++++++++++++++++------------------- src/H5MFaggr.c | 261 +++++++++++++++++++++++++++--------------------------- src/H5MFdbg.c | 25 +++--- src/H5MFpkg.h | 24 ++--- src/H5MFsection.c | 48 +++++----- src/H5PB.c | 34 +++---- src/H5R.c | 16 ++-- src/H5Rdeprec.c | 2 +- src/H5Rint.c | 17 ++-- src/H5Rpkg.h | 5 ++ test/btree2.c | 62 ++++++------- test/getname.c | 4 +- test/mf.c | 250 +++++++++++++++++++++++++-------------------------- 20 files changed, 584 insertions(+), 570 deletions(-) diff --git a/src/H5B.c b/src/H5B.c index fe09b42..1f19d7b 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -245,7 +245,7 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *addr_p/*out* NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for B-tree root node") if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, (hsize_t)shared->sizeof_rnode))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "file allocation failed for B-tree root node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "file allocation failed for B-tree root node") /* * Cache the new B-tree node. @@ -320,7 +320,7 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) /* Get shared info for B-tree */ if(NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); HDassert(shared); @@ -332,7 +332,7 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) cache_udata.type = type; cache_udata.rc_shared = rc_shared; if(NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") rt = bt->nchildren; while(lt < rt && cmp) { @@ -1300,7 +1300,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, if((int)(ret_value = H5B__remove_helper(f, bt->child[idx], type, level + 1, H5B_NKEY(bt, shared, idx)/*out*/, lt_key_changed/*out*/, udata, H5B_NKEY(bt, shared, idx + 1)/*out*/, - rt_key_changed/*out*/)) < 0) + rt_key_changed/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in subtree") } else if(type->remove) { /* diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index c4f56e5..0e3ebd5 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -109,7 +109,7 @@ H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* Load the B-tree header */ if(NULL == (hdr = H5B2__hdr_protect(f, addr, f, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header") /* Set file pointer for this B-tree operation */ hdr->f = f; @@ -208,7 +208,7 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* Load the B-tree header */ if(NULL == (hdr = H5B2__hdr_protect(f, hdr_addr, f, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load v2 B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load v2 B-tree header") /* Set file pointer for this B-tree operation */ hdr->f = f; @@ -220,7 +220,7 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, node_ptr.addr = addr; H5_CHECKED_ASSIGN(node_ptr.node_nrec, uint16_t, nrec, unsigned) if(NULL == (internal = H5B2__protect_internal(hdr, NULL, &node_ptr, (uint16_t)depth, FALSE, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree internal node") /* Print opening message */ HDfprintf(stream, "%*sv2 B-tree Internal Node...\n", indent, ""); @@ -320,7 +320,7 @@ H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* Load the B-tree header */ if(NULL == (hdr = H5B2__hdr_protect(f, hdr_addr, f, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header") /* Set file pointer for this B-tree operation */ hdr->f = f; @@ -332,7 +332,7 @@ H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, node_ptr.addr = addr; H5_CHECKED_ASSIGN(node_ptr.node_nrec, uint16_t, nrec, unsigned) if(NULL == (leaf = H5B2__protect_leaf(hdr, NULL, &node_ptr, FALSE, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Print opening message */ HDfprintf(stream, "%*sv2 B-tree Leaf Node...\n", indent, ""); diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index 552cebb..27229f1 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -467,7 +467,7 @@ H5_DLL herr_t H5B2__assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf, /* Testing routines */ #ifdef H5B2_TESTING -H5_DLL herr_t H5B2_get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr); +H5_DLL herr_t H5B2__get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr); H5_DLL int H5B2__get_node_depth_test(H5B2_t *bt2, void *udata); H5_DLL herr_t H5B2__get_node_info_test(H5B2_t *bt2, void *udata, H5B2_node_info_test_t *ninfo); diff --git a/src/H5B2test.c b/src/H5B2test.c index 49fe3af..0f4a39c 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -469,12 +469,11 @@ H5B2__test2_debug(FILE *stream, int indent, int fwidth, const void *record, /*------------------------------------------------------------------------- - * Function: H5B2_get_root_addr_test + * Function: H5B2__get_root_addr_test * - * Purpose: Retrieve the root node's address + * Purpose: Retrieve the root node's address * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Saturday, February 26, 2005 @@ -482,7 +481,7 @@ H5B2__test2_debug(FILE *stream, int indent, int fwidth, const void *record, *------------------------------------------------------------------------- */ herr_t -H5B2_get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr) +H5B2__get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -494,16 +493,15 @@ H5B2_get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr) *root_addr = bt2->hdr->root.addr; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5B2_get_root_addr_test() */ +} /* H5B2__get_root_addr_test() */ /*------------------------------------------------------------------------- - * Function: H5B2__get_node_info_test + * Function: H5B2__get_node_info_test * - * Purpose: Determine information about a node holding a record in the B-tree + * Purpose: Determine information about a node holding a record in the B-tree * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Thursday, August 31, 2006 @@ -647,15 +645,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5B2__get_node_depth_test + * Function: H5B2__get_node_depth_test * - * Purpose: Determine the depth of a node holding a record in the B-tree + * Purpose: Determine the depth of a node holding a record in the B-tree * - * Note: Just a simple wrapper around the H5B2__get_node_info_test() routine + * Note: Just a simple wrapper around the H5B2__get_node_info_test() routine * - * Return: Success: non-negative depth of the node where the record - * was found - * Failure: negative + * Return: Success: Non-negative depth of the node where the record + * was found + * + * Failure: -1 * * Programmer: Quincey Koziol * Saturday, August 26, 2006 @@ -675,7 +674,7 @@ H5B2__get_node_depth_test(H5B2_t *bt2, void *udata) /* Get information abou the node */ if(H5B2__get_node_info_test(bt2, udata, &ninfo) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "error looking up node info") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, (-1), "error looking up node info") /* Set return value */ ret_value = (int)ninfo.depth; diff --git a/src/H5I.c b/src/H5I.c index 5117394..66082de 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -31,8 +31,8 @@ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Ipkg.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* Object headers */ @@ -738,10 +738,10 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) /* Create the struct & its ID */ new_id = H5I_MAKE(type, type_ptr->nextid); - id_ptr->id = new_id; - id_ptr->count = 1; /* initial reference count */ - id_ptr->app_count = !!app_ref; - id_ptr->obj_ptr = object; + id_ptr->id = new_id; + id_ptr->count = 1; /* initial reference count */ + id_ptr->app_count = !!app_ref; + id_ptr->obj_ptr = object; /* Insert into the type */ if (H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) @@ -784,6 +784,7 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ + HDassert(object); /* Make sure ID is not already in use */ if(NULL != (id_ptr = H5I__find_id(id))) @@ -808,10 +809,10 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed") /* Create the struct & insert requested ID */ - id_ptr->id = id; - id_ptr->count = 1; /*initial reference count*/ - id_ptr->app_count = !!app_ref; - id_ptr->obj_ptr = object; + id_ptr->id = id; + id_ptr->count = 1; /* initial reference count*/ + id_ptr->app_count = !!app_ref; + id_ptr->obj_ptr = object; /* Insert into the type */ if(H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) @@ -862,51 +863,45 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_object + * Function: H5I_object * - * Purpose: Find an object pointer for the specified ID. + * Purpose: Find an object pointer for the specified ID. * - * Return: Success: Non-null object pointer associated with the - * specified ID. - * Failure: NULL + * Return: Success: Non-null object pointer associated with the + * specified ID * - * Programmer: Unknown + * Failure: NULL * *------------------------------------------------------------------------- */ void * H5I_object(hid_t id) { - H5I_id_info_t *id_ptr; /*ptr to the new atom */ - void *ret_value = NULL; /*return value */ + H5I_id_info_t *id_ptr; /* Pointer to the new atom */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOERR /* General lookup of the ID */ if(NULL != (id_ptr = H5I__find_id(id))) { /* Get the object pointer to return */ - /* (Casting away const OK -QAK) */ - ret_value = (void *)id_ptr->obj_ptr; - } /* end if */ + ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_object() */ /*------------------------------------------------------------------------- - * Function: H5Iobject_verify - * - * Purpose: Find an object pointer for the specified ID, verifying that - * its in a particular type. Public interface to - * H5I_object_verify. + * Function: H5Iobject_verify * - * Return: Success: Non-null object pointer associated with the - * specified ID. - * Failure: NULL + * Purpose: Find an object pointer for the specified ID, verifying that + * its in a particular type. Public interface to + * H5I_object_verify. * - * Programmer: Nathaniel Furrer - * James Laird - * Friday, April 23, 2004 + * Return: Success: Non-null object pointer associated with the + * specified ID. + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -932,14 +927,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_object_verify + * Function: H5I_object_verify * - * Purpose: Find an object pointer for the specified ID, verifying that - * its in a particular type. + * Purpose: Find an object pointer for the specified ID, verifying that + * its in a particular type. * - * Return: Success: Non-null object pointer associated with the - * specified ID. - * Failure: NULL + * Return: Success: Non-null object pointer associated with the + * specified ID. + * Failure: NULL * * Programmer: Quincey Koziol * Wednesday, July 31, 2002 @@ -949,8 +944,8 @@ done: void * H5I_object_verify(hid_t id, H5I_type_t id_type) { - H5I_id_info_t *id_ptr = NULL; /*ptr to the new atom */ - void *ret_value = NULL; /*return value */ + H5I_id_info_t *id_ptr = NULL; /* Pointer to the new atom */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOERR @@ -959,9 +954,8 @@ H5I_object_verify(hid_t id, H5I_type_t id_type) /* Verify that the type of the ID is correct & lookup the ID */ if(id_type == H5I_TYPE(id) && NULL != (id_ptr = H5I__find_id(id))) { /* Get the object pointer to return */ - /* (Casting away const OK -QAK) */ - ret_value = (void *)id_ptr->obj_ptr; - } /* end if */ + ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ + } FUNC_LEAVE_NOAPI(ret_value) } /* H5I_object_verify() */ @@ -1867,8 +1861,8 @@ done: * function, and then sets return value, based on the result of * that callback. * - * Return: Success: Non-negative on success - * Failure: Negative + * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1) + * Failure: H5_ITER_ERROR (-1) * *------------------------------------------------------------------------- */ @@ -1925,8 +1919,8 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) herr_t H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref) { - H5I_id_type_t *type_ptr; /*ptr to the type */ - herr_t ret_value = SUCCEED; /*return value */ + H5I_id_type_t *type_ptr; /* Pointer to the type */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1941,9 +1935,9 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re herr_t iter_status; /* Iteration status */ /* Set up iterator user data */ - iter_udata.user_func = func; - iter_udata.user_udata = udata; - iter_udata.app_ref = app_ref; + iter_udata.user_func = func; + iter_udata.user_udata = udata; + iter_udata.app_ref = app_ref; /* Iterate over IDs */ if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) @@ -2020,16 +2014,16 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) H5G_loc_t loc; /* Object location */ ssize_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "ixz", id, name, size); /* Get object location */ if(H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") /* Call internal routine to retrieve object's name */ if((ret_value = H5I__get_name(&loc, name, size)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: FUNC_LEAVE_API(ret_value) @@ -2047,15 +2041,15 @@ done: * Return: Success: The length of the name * Failure: -1 * - * Programmer: Quincey Koziol - * January 9, 2018 + * Programmer: Quincey Koziol + * January 9, 2018 * *------------------------------------------------------------------------- */ static ssize_t H5I__get_name(const H5G_loc_t *loc, char *name, size_t size) { - ssize_t ret_value = FAIL; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_STATIC_VOL @@ -2064,7 +2058,7 @@ H5I__get_name(const H5G_loc_t *loc, char *name, size_t size) /* Retrieve object's name */ if((ret_value = H5G_get_name(loc, name, size, NULL)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: FUNC_LEAVE_NOAPI_VOL(ret_value) @@ -2086,7 +2080,7 @@ done: hid_t H5Iget_file_id(hid_t obj_id) { - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", obj_id); diff --git a/src/H5Ipkg.h b/src/H5Ipkg.h index 16d7d67..2c1d81f 100644 --- a/src/H5Ipkg.h +++ b/src/H5Ipkg.h @@ -67,7 +67,7 @@ /* Testing functions */ #ifdef H5I_TESTING -H5_DLL ssize_t H5I_get_name_test(hid_t id, char *name/*out*/, size_t size, +H5_DLL ssize_t H5I__get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached); #endif /* H5I_TESTING */ diff --git a/src/H5Itest.c b/src/H5Itest.c index 426c026..4b54835 100644 --- a/src/H5Itest.c +++ b/src/H5Itest.c @@ -28,12 +28,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Ipkg.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Ipkg.h" /* IDs */ /****************/ @@ -63,44 +63,44 @@ /*------------------------------------------------------------------------- - * Function: H5I_get_name_test + * Function: H5I__get_name_test * - * Purpose: Testing version of H5Iget_name() + * Purpose: Testing version of H5Iget_name() * - * Return: Success: The length of name. - * Failure: -1 + * Return: Success: The length of name. + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, July 27, 2010 * *------------------------------------------------------------------------- */ ssize_t -H5I_get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached) +H5I__get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached) { - H5G_loc_t loc; /* Object location */ - hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ - ssize_t ret_value = -1; /* Return value */ + H5G_loc_t loc; /* Object location */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location */ if(H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") /* Set API context */ if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set API context") api_ctx_pushed = TRUE; /* Call internal group routine to retrieve object's name */ if((ret_value = H5G_get_name(&loc, name, size, cached)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") + HDONE_ERROR(H5E_SYM, H5E_CANTRESET, (-1), "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_get_name_test() */ +} /* end H5I__get_name_test() */ diff --git a/src/H5MF.c b/src/H5MF.c index 59ee1fc..64e91c8 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -97,6 +97,9 @@ static herr_t H5MF__close_fstype(H5F_t *f, H5F_mem_page_t type); static herr_t H5MF__delete_fstype(H5F_t *f, H5F_mem_page_t type); static herr_t H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type); +/* Callbacks */ +static herr_t H5MF__sects_cb(H5FS_section_info_t *_sect, void *_udata); + /*********************/ /* Package Variables */ @@ -232,7 +235,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5MF_alloc_to_fs_type + * Function: H5MF__alloc_to_fs_type * * Purpose: Map "alloc_type" to the free-space manager type * @@ -244,9 +247,9 @@ done: *------------------------------------------------------------------------- */ void -H5MF_alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type) +H5MF__alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(f); HDassert(fs_type); @@ -271,7 +274,7 @@ H5MF_alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_pag *fs_type = (H5F_mem_page_t)H5MF_ALLOC_TO_FS_AGGR_TYPE(f, alloc_type); FUNC_LEAVE_NOAPI_VOID -} /* end H5MF_alloc_to_fs_type() */ +} /* end H5MF__alloc_to_fs_type() */ /*------------------------------------------------------------------------- @@ -379,10 +382,10 @@ H5MF__create_fstype(H5F_t *f, H5F_mem_page_t type) H5MF_FSPACE_SECT_CLS_LARGE }; H5FS_create_t fs_create; /* Free space creation parameters */ hsize_t alignment; /* Alignment to use */ - hsize_t threshold; /* Threshold to use */ + hsize_t threshold; /* Threshold to use */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t fsm_ring; /* Ring of FSM */ - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_ring_t fsm_ring; /* Ring of FSM */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG) @@ -509,7 +512,7 @@ static herr_t H5MF__delete_fstype(H5F_t *f, H5F_mem_page_t type) { H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t fsm_ring; /* Ring of FSM */ + H5AC_ring_t fsm_ring = H5AC_RING_INV; /* Ring of FSM */ haddr_t tmp_fs_addr; /* Temporary holder for free space manager address */ herr_t ret_value = SUCCEED; /* Return value */ @@ -628,10 +631,10 @@ herr_t H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_section_t *node) { H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t fsm_ring; /* Ring of FSM */ - H5MF_sect_ud_t udata; /* User data for callback */ - H5F_mem_page_t fs_type; /* Free space type (mapped from allocation type) */ - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_ring_t fsm_ring = H5AC_RING_INV; /* Ring of FSM */ + H5MF_sect_ud_t udata; /* User data for callback */ + H5F_mem_page_t fs_type; /* Free space type (mapped from allocation type) */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(H5AC__FREESPACE_TAG) @@ -639,7 +642,7 @@ H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_sectio HDassert(fspace); HDassert(node); - H5MF_alloc_to_fs_type(f, alloc_type, node->sect_info.size, &fs_type); + H5MF__alloc_to_fs_type(f, alloc_type, node->sect_info.size, &fs_type); /* Construct user data for callbacks */ udata.f = f; @@ -688,7 +691,7 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, haddr_t *addr) { H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t fsm_ring; /* Ring of FSM */ + H5AC_ring_t fsm_ring = H5AC_RING_INV; /* Ring of FSM */ H5MF_free_section_t *node; /* Free space section pointer */ htri_t ret_value = FAIL; /* Whether an existing free list node was found */ @@ -728,7 +731,7 @@ HDfprintf(stderr, "%s: freeing node\n", FUNC); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Free section node */ - if(H5MF_sect_free((H5FS_section_info_t *)node) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)node) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") } /* end if */ else { @@ -776,7 +779,7 @@ haddr_t H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) { H5AC_ring_t fsm_ring = H5AC_RING_INV; /* free space manager ring */ - H5AC_ring_t orig_ring; /* Original ring value */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ H5F_mem_page_t fs_type; /* Free space type (mapped from allocation type) */ haddr_t ret_value = HADDR_UNDEF; /* Return value */ @@ -797,7 +800,7 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "tidy of self referential fsm hack failed") } /* end if */ - H5MF_alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); #ifdef H5MF_ALLOC_DEBUG_MORE HDfprintf(stderr, "%s: Check 1.0\n", FUNC); @@ -862,7 +865,7 @@ done: HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP -H5MF_sects_dump(f, stderr); +H5MF__sects_dump(f, stderr); #endif /* H5MF_ALLOC_DEBUG_DUMP */ FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -903,7 +906,7 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size); #endif /* H5MF_ALLOC_DEBUG */ - H5MF_alloc_to_fs_type(f, alloc_type, size, &ptype); + H5MF__alloc_to_fs_type(f, alloc_type, size, &ptype); switch(ptype) { case H5F_MEM_PAGE_GENERIC: @@ -936,7 +939,7 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "can't initialize file free space") /* Create free space section for the fragment */ - if(NULL == (node = H5MF_sect_new(H5MF_FSPACE_SECT_LARGE, ret_value + size, frag_size))) + if(NULL == (node = H5MF__sect_new(H5MF_FSPACE_SECT_LARGE, ret_value + size, frag_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "can't initialize free space section") /* Add the fragment to the large free-space manager */ @@ -967,7 +970,7 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "can't initialize file free space") HDassert(f->shared->fs_man[ptype]); - if(NULL == (node = H5MF_sect_new(H5MF_FSPACE_SECT_SMALL, (new_page + size), (f->shared->fs_page_size - size)))) + if(NULL == (node = H5MF__sect_new(H5MF_FSPACE_SECT_SMALL, (new_page + size), (f->shared->fs_page_size - size)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "can't initialize free space section") /* Add the remaining space in the page to the manager */ @@ -997,12 +1000,12 @@ done: HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP -H5MF_sects_dump(f, stderr); +H5MF__sects_dump(f, stderr); #endif /* H5MF_ALLOC_DEBUG_DUMP */ /* Release section node, if allocated and not added to section list or merged */ if(node) - if(H5MF_sect_free((H5FS_section_info_t *)node) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)node) < 0) HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, HADDR_UNDEF, "can't free section node") FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -1110,7 +1113,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "tidy of self referential fsm hack failed") } /* end if */ - H5MF_alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); /* Set the ring type in the API context */ if(H5MF__fsm_type_is_self_referential(f, fs_type)) @@ -1197,7 +1200,7 @@ HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", FUNC, a /* Create the free-space section for the freed section */ ctype = H5MF_SECT_CLASS_TYPE(f, size); - if(NULL == (node = H5MF_sect_new(ctype, addr, size))) + if(NULL == (node = H5MF__sect_new(ctype, addr, size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space section") /* If size of the freed section is larger than threshold, add it to the free space manager */ @@ -1242,14 +1245,14 @@ done: /* Release section node, if allocated and not added to section list or merged */ if(node) - if(H5MF_sect_free((H5FS_section_info_t *)node) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)node) < 0) HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP -H5MF_sects_dump(f, stderr); +H5MF__sects_dump(f, stderr); #endif /* H5MF_ALLOC_DEBUG_DUMP */ FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5MF_xfree() */ @@ -1334,7 +1337,7 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r } /* end if */ /* Get free space type from allocation type */ - H5MF_alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); /* Set the ring type in the API context */ if(H5MF__fsm_type_is_self_referential(f, fs_type)) @@ -1365,7 +1368,7 @@ HDfprintf(stderr, "%s: extended = %t\n", FUNC, ret_value); HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") /* Create free space section for the fragment */ - if(NULL == (node = H5MF_sect_new(H5MF_FSPACE_SECT_LARGE, end + extra_requested, frag_size))) + if(NULL == (node = H5MF__sect_new(H5MF_FSPACE_SECT_LARGE, end + extra_requested, frag_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space section") /* Add the fragment to the large-sized free-space manager */ @@ -1436,7 +1439,7 @@ done: HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP -H5MF_sects_dump(f, stderr); +H5MF__sects_dump(f, stderr); #endif /* H5MF_ALLOC_DEBUG_DUMP */ FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -1464,9 +1467,9 @@ H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) H5MF_sect_ud_t udata; /* User data for callback */ H5FS_section_class_t *sect_cls; /* Section class */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t fsm_ring; /* Ring of FSM */ - H5F_mem_page_t fs_type; /* Free space type */ - htri_t ret_value = FALSE; /* Return value */ + H5AC_ring_t fsm_ring = H5AC_RING_INV; /* Ring of FSM */ + H5F_mem_page_t fs_type; /* Free space type */ + htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG @@ -1485,7 +1488,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN HDassert(sect_cls); /* Get free space type from allocation type */ - H5MF_alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); /* Set the ring type in the API context */ if(H5MF__fsm_type_is_self_referential(f, fs_type)) @@ -1495,7 +1498,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN H5AC_set_ring(fsm_ring, &orig_ring); /* Create free-space section for block */ - if(NULL == (node = H5MF_sect_new(sect_cls->type, addr, size))) + if(NULL == (node = H5MF__sect_new(sect_cls->type, addr, size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space section") /* Construct user data for callbacks */ @@ -1522,7 +1525,7 @@ done: H5AC_set_ring(orig_ring, NULL); /* Free section node allocated */ - if(node && H5MF_sect_free((H5FS_section_info_t *)node) < 0) + if(node && H5MF__sect_free((H5FS_section_info_t *)node) < 0) HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") #ifdef H5MF_ALLOC_DEBUG @@ -1561,10 +1564,11 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); if(H5F_PAGED_AGGR(f)) { if((ret_value = H5MF__close_pagefs(f)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't close free-space managers for 'page' file space") - } /* end if */ - else + } + else { if((ret_value = H5MF__close_aggrfs(f)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't close free-space managers for 'aggr' file space") + } done: #ifdef H5MF_ALLOC_DEBUG @@ -1650,8 +1654,8 @@ herr_t H5MF_try_close(H5F_t *f) { H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t curr_ring; /* Current ring value */ - H5AC_ring_t needed_ring; /* Ring value needed for this iteration */ + H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */ + H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) @@ -1689,7 +1693,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Set the ring type in the API context. In most cases, we will * need H5AC_RING_RDFSM, so initialy set the ring in - * the DXPL to that value. We will alter this later if needed. + * the context to that value. We will alter this later if needed. */ H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring); curr_ring = H5AC_RING_RDFSM; @@ -1706,6 +1710,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring ) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -1727,6 +1732,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -1765,10 +1771,10 @@ static herr_t H5MF__close_aggrfs(H5F_t *f) { H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t curr_ring; /* Current ring value */ - H5AC_ring_t needed_ring; /* Ring value needed for this iteration. */ + H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */ + H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration. */ H5FD_mem_t type; /* Memory type for iteration */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG) #ifdef H5MF_ALLOC_DEBUG @@ -1783,7 +1789,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Set the ring type in the API context. In most cases, we will * need H5AC_RING_RDFSM, so initialy set the ring in - * the DXPL to that value. We will alter this later if needed. + * the context to that value. We will alter this later if needed. */ H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring); curr_ring = H5AC_RING_RDFSM; @@ -1842,6 +1848,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -1929,8 +1936,8 @@ static herr_t H5MF__close_pagefs(H5F_t *f) { H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t curr_ring; /* Current ring value */ - H5AC_ring_t needed_ring; /* Ring value needed for this iteration. */ + H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */ + H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration. */ H5F_mem_page_t ptype; /* Memory type for iteration */ H5O_fsinfo_t fsinfo; /* File space info message */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1950,7 +1957,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Set the ring type in the API context. In most cases, we will * need H5AC_RING_RDFSM, so initialy set the ring in - * the DXPL to that value. We will alter this later if needed. + * the context to that value. We will alter this later if needed. */ H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring); curr_ring = H5AC_RING_RDFSM; @@ -2005,6 +2012,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -2102,8 +2110,8 @@ static herr_t H5MF__close_shrink_eoa(H5F_t *f) { H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t curr_ring; /* Current ring value */ - H5AC_ring_t needed_ring; /* Ring value needed for this iteration. */ + H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */ + H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration. */ H5F_mem_t type; H5F_mem_page_t ptype; /* Memory type for iteration */ hbool_t eoa_shrank; /* Whether an EOA shrink occurs */ @@ -2139,6 +2147,7 @@ H5MF__close_shrink_eoa(H5F_t *f) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -2162,6 +2171,7 @@ H5MF__close_shrink_eoa(H5F_t *f) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -2222,9 +2232,9 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) htri_t fs_started[H5F_MEM_PAGE_NTYPES]; /* Indicate whether the free-space manager has been started */ haddr_t fs_eoa[H5FD_MEM_NTYPES]; /* EAO for each free-space manager */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t curr_ring; /* Current ring value */ - H5AC_ring_t needed_ring; /* Ring value needed for this iteration. */ - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */ + H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration. */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) @@ -2235,7 +2245,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) /* Set the ring type in the API context. In most cases, we will * need H5AC_RING_RDFSM, so initialy set the ring in - * the DXPL to that value. We will alter this later if needed. + * the context to that value. We will alter this later if needed. */ H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring); curr_ring = H5AC_RING_RDFSM; @@ -2256,11 +2266,11 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) if(!H5F_PAGED_AGGR(f)) { /* Retrieve metadata aggregator info, if available */ - if(H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0) + if(H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats") /* Retrieve 'small data' aggregator info, if available */ - if(H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0) + if(H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats") } /* end if */ @@ -2342,7 +2352,8 @@ done: * Purpose: To retrieve free-space section information for * paged or non-paged aggregation * - * Return: SUCCEED/FAIL + * Return: Success: Number of free sections + * Failure: -1 * * Programmer: Vailin Choi; Dec 2012 * @@ -2352,15 +2363,15 @@ ssize_t H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info) { H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t curr_ring; /* Current ring value */ - H5AC_ring_t needed_ring; /* Ring value needed for this iteration. */ + H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */ + H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration. */ size_t total_sects = 0; /* Total number of sections */ H5MF_sect_iter_ud_t sect_udata; /* User data for callback */ H5F_mem_page_t start_type, end_type; /* Memory types to iterate over */ H5F_mem_page_t ty; /* Memory type for iteration */ ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) + FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, (-1)) /* check args */ HDassert(f); @@ -2382,11 +2393,11 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t if(f->shared->first_alloc_dealloc) { if(H5AC_cache_image_pending(f)) { if(H5AC_force_cache_image_load(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "forced cache image load failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, (-1), "forced cache image load failed") } /* end if */ else { if(H5MF_tidy_self_referential_fsm_hack(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "tidy of self referential fsm hack failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, (-1), "tidy of self referential fsm hack failed") } /* end else */ } /* end if */ @@ -2409,7 +2420,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t /* Set the ring type in the API context. In most cases, we will * need H5AC_RING_RDFSM, so initialy set the ring in - * the DXPL to that value. We will alter this later if needed. + * the context to that value. We will alter this later if needed. */ H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring); curr_ring = H5AC_RING_RDFSM; @@ -2431,7 +2442,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t if(!f->shared->fs_man[ty] && H5F_addr_defined(f->shared->fs_addr[ty])) { if(H5MF__open_fstype(f, ty) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't open the free space manager") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, (-1), "can't open the free space manager") HDassert(f->shared->fs_man[ty]); fs_started = TRUE; } /* end if */ @@ -2439,7 +2450,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t /* Check if there's free space sections of this type */ if(f->shared->fs_man[ty]) if(H5MF__get_free_sects(f, f->shared->fs_man[ty], §_udata, &nums) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't get section info for the free space manager") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, (-1), "can't get section info for the free space manager") /* Increment total # of sections */ total_sects += nums; @@ -2447,7 +2458,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t /* Close the free space manager of this type, if we started it here */ if(fs_started) if(H5MF__close_fstype(f, ty) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCLOSEOBJ, FAIL, "can't close file free space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCLOSEOBJ, (-1), "can't close file free space") if((H5F_PAGED_AGGR(f)) && (type != H5FD_MEM_DEFAULT)) ty = (H5F_mem_page_t)(ty + H5FD_MEM_NTYPES - 2); } /* end for */ @@ -2465,7 +2476,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5MF_sects_cb() + * Function: H5MF__sects_cb() * * Purpose: Iterator callback for each free-space section * Retrieve address and size into user data @@ -2478,12 +2489,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5MF_sects_cb(H5FS_section_info_t *_sect, void *_udata) +H5MF__sects_cb(H5FS_section_info_t *_sect, void *_udata) { H5MF_free_section_t *sect = (H5MF_free_section_t *)_sect; H5MF_sect_iter_ud_t *udata = (H5MF_sect_iter_ud_t *)_udata; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(udata->sect_idx < udata->sect_count) { udata->sects[udata->sect_idx].addr = sect->sect_info.addr; @@ -2492,7 +2503,7 @@ H5MF_sects_cb(H5FS_section_info_t *_sect, void *_udata) } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5MF_sects_cb() */ +} /* H5MF__sects_cb() */ /*------------------------------------------------------------------------- @@ -2513,7 +2524,7 @@ H5MF__get_free_sects(H5F_t *f, H5FS_t *fspace, H5MF_sect_iter_ud_t *sect_udata, hsize_t hnums = 0; /* # of sections */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check args */ HDassert(f); @@ -2529,7 +2540,7 @@ H5MF__get_free_sects(H5F_t *f, H5FS_t *fspace, H5MF_sect_iter_ud_t *sect_udata, /* Check if we should retrieve the section info */ if(sect_udata->sects && *nums > 0) /* Iterate over all the free space sections of this type, adding them to the user's section info */ - if(H5FS_sect_iterate(f, fspace, H5MF_sects_cb, sect_udata) < 0) + if(H5FS_sect_iterate(f, fspace, H5MF__sects_cb, sect_udata) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_BADITER, FAIL, "can't iterate over sections") done: @@ -2648,8 +2659,8 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) H5O_fsinfo_t fsinfo; /* Free space manager info message */ H5FS_stat_t fs_stat; /* Information for free-space manager */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t curr_ring; /* Current ring value */ - H5AC_ring_t needed_ring; /* Ring value needed for this iteration. */ + H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */ + H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) @@ -2744,7 +2755,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) break; for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) { - H5MF_alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type); + H5MF__alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type); if(pass_count == 0) { /* this is the first pass */ HDassert(fsm_type > H5F_MEM_PAGE_DEFAULT); @@ -2781,6 +2792,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -2888,7 +2900,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) break; for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) { - H5MF_alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type); + H5MF__alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type); if(pass_count == 0) { /* this is the first pass */ HDassert(fsm_type > H5F_MEM_PAGE_DEFAULT); @@ -2906,6 +2918,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -3136,8 +3149,8 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) /* should only be called if file is opened R/W */ HDassert(H5F_INTENT(f) & H5F_ACC_RDWR); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type); HDassert(sm_fshdr_fs_type > H5F_MEM_PAGE_DEFAULT); HDassert(sm_fshdr_fs_type < H5F_MEM_PAGE_LARGE_SUPER); @@ -3153,8 +3166,8 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) sm_sinfo_fspace = f->shared->fs_man[sm_fssinfo_fs_type]; if(H5F_PAGED_AGGR(f)) { - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type); HDassert(lg_fshdr_fs_type >= H5F_MEM_PAGE_LARGE_SUPER); HDassert(lg_fshdr_fs_type < H5F_MEM_PAGE_NTYPES); @@ -3398,7 +3411,7 @@ H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type) H5F_mem_page_t lg_fssinfo_fsm; hbool_t result = FALSE; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(f); @@ -3406,12 +3419,12 @@ H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type) HDassert(fsm_type >= H5F_MEM_PAGE_DEFAULT); HDassert(fsm_type < H5F_MEM_PAGE_NTYPES); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); if(H5F_PAGED_AGGR(f)) { - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); result = (fsm_type == sm_fshdr_fsm) || (fsm_type == sm_fssinfo_fsm) || (fsm_type == lg_fshdr_fsm) || (fsm_type == lg_fssinfo_fsm); @@ -3460,15 +3473,15 @@ H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace) HDassert(f->shared); HDassert(fspace); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); if(H5F_PAGED_AGGR(f)) { H5F_mem_page_t lg_fshdr_fsm; H5F_mem_page_t lg_fssinfo_fsm; - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); result = (fspace == f->shared->fs_man[sm_fshdr_fsm]) || (fspace == f->shared->fs_man[sm_fssinfo_fsm]) || @@ -3609,8 +3622,8 @@ H5MF_tidy_self_referential_fsm_hack(H5F_t *f) * this -- we can use the regular I/O methods even if * paged aggregation and page buffering is enabled. */ - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type); HDassert(sm_fshdr_fs_type > H5F_MEM_PAGE_DEFAULT); HDassert(sm_fshdr_fs_type < H5F_MEM_PAGE_LARGE_SUPER); @@ -3648,8 +3661,8 @@ H5MF_tidy_self_referential_fsm_hack(H5F_t *f) } /* end if */ if(H5F_PAGED_AGGR(f)) { - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type); HDassert(lg_fshdr_fs_type >= H5F_MEM_PAGE_LARGE_SUPER); HDassert(lg_fshdr_fs_type < H5F_MEM_PAGE_NTYPES); diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index cd80a10..5ab1834 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -59,6 +59,8 @@ static herr_t H5MF__aggr_free(H5F_t *f, H5FD_mem_t type, H5F_blk_aggr_t *aggr); static haddr_t H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5FD_mem_t type, hsize_t size); +static herr_t H5MF__aggr_reset(H5F_t *f, H5F_blk_aggr_t *aggr); +static htri_t H5MF__aggr_can_shrink_eoa(H5F_t *f, H5FD_mem_t type, H5F_blk_aggr_t *aggr); /*********************/ @@ -179,7 +181,7 @@ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size); /* * If the aggregation feature is enabled for this file and strategy is not H5F_FILE_SPACE_NONE, * allocate "generic" space and sub-allocate out of that, if possible. - * Otherwise just allocate through H5F_alloc(). + * Otherwise just allocate through H5F__alloc(). */ if((f->shared->feature_flags & aggr->feature_flag) && f->shared->fs_strategy != H5F_FSPACE_STRATEGY_NONE) { haddr_t aggr_frag_addr = HADDR_UNDEF; /* Address of aggregrator fragment */ @@ -193,18 +195,18 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz #endif /* H5MF_AGGR_DEBUG */ /* Turn off alignment if allocation < threshold */ - alignment = H5F_ALIGNMENT(f); - if(!((alignment > 1) && (size >= H5F_THRESHOLD(f)))) - alignment = 0; /* no alignment */ + alignment = H5F_ALIGNMENT(f); + if(!((alignment > 1) && (size >= H5F_THRESHOLD(f)))) + alignment = 0; /* no alignment */ /* Generate fragment if aggregator is mis-aligned */ - if(alignment && H5F_addr_gt(aggr->addr, 0) && (aggr_mis_align = (aggr->addr + H5F_BASE_ADDR(f)) % alignment)) { - aggr_frag_addr = aggr->addr; - aggr_frag_size = alignment - aggr_mis_align; - } /* end if */ + if(alignment && H5F_addr_gt(aggr->addr, 0) && (aggr_mis_align = (aggr->addr + H5F_BASE_ADDR(f)) % alignment)) { + aggr_frag_addr = aggr->addr; + aggr_frag_size = alignment - aggr_mis_align; + } /* end if */ - alloc_type = aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW; - other_alloc_type = other_aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW; + alloc_type = aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW; + other_alloc_type = other_aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW; /* Check if the space requested is larger than the space left in the block */ if((size + aggr_frag_size) > aggr->size) { @@ -212,73 +214,74 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz /* Check if the block asked for is too large for 'normal' aggregator block */ if(size >= aggr->alloc_size) { - hsize_t ext_size = size + aggr_frag_size; + hsize_t ext_size = size + aggr_frag_size; /* Check for overlapping into file's temporary allocation space */ if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr)) HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space") - if((aggr->addr > 0) && (extended = H5F__try_extend(f, alloc_type, (aggr->addr + aggr->size), ext_size)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space") - else if (extended) { - /* aggr->size is unchanged */ - ret_value = aggr->addr + aggr_frag_size; - aggr->addr += ext_size; - aggr->tot_size += ext_size; - } else { + if((aggr->addr > 0) && (extended = H5F__try_extend(f, alloc_type, (aggr->addr + aggr->size), ext_size)) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space") + else if(extended) { + /* aggr->size is unchanged */ + ret_value = aggr->addr + aggr_frag_size; + aggr->addr += ext_size; + aggr->tot_size += ext_size; + } + else { /* Release "other" aggregator, if it exists, is at the end of the allocated space, * has allocated more than one block and the unallocated space is greater than its * allocation block size. */ - if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && - (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { + if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && + (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { if(H5MF__aggr_free(f, other_alloc_type, other_aggr) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block") - } /* end if */ + } /* end if */ /* Allocate space from the VFD (i.e. at the end of the file) */ - if(HADDR_UNDEF == (ret_value = H5F__alloc(f, alloc_type, size, &eoa_frag_addr, &eoa_frag_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space") + if(HADDR_UNDEF == (ret_value = H5F__alloc(f, alloc_type, size, &eoa_frag_addr, &eoa_frag_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space") } /* end else */ } /* end if */ - else { - hsize_t ext_size = aggr->alloc_size; + else { + hsize_t ext_size = aggr->alloc_size; /* Allocate another block */ #ifdef H5MF_AGGR_DEBUG HDfprintf(stderr, "%s: Allocating block\n", FUNC); #endif /* H5MF_AGGR_DEBUG */ - if(aggr_frag_size > (ext_size - size)) - ext_size += (aggr_frag_size - (ext_size - size)); + if(aggr_frag_size > (ext_size - size)) + ext_size += (aggr_frag_size - (ext_size - size)); /* Check for overlapping into file's temporary allocation space */ if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr)) HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space") - if((aggr->addr > 0) && (extended = H5F__try_extend(f, alloc_type, (aggr->addr + aggr->size), ext_size)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space") - else if(extended) { - aggr->addr += aggr_frag_size; - aggr->size += (ext_size - aggr_frag_size); - aggr->tot_size += ext_size; - } /* end else-if */ - else { + if((aggr->addr > 0) && (extended = H5F__try_extend(f, alloc_type, (aggr->addr + aggr->size), ext_size)) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space") + else if(extended) { + aggr->addr += aggr_frag_size; + aggr->size += (ext_size - aggr_frag_size); + aggr->tot_size += ext_size; + } /* end else-if */ + else { haddr_t new_space; /* Address of new space allocated */ /* Release "other" aggregator, if it exists, is at the end of the allocated space, * has allocated more than one block and the unallocated space is greater than its * allocation block size. */ - if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && - (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { + if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && + (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { if(H5MF__aggr_free(f, other_alloc_type, other_aggr) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block") - } /* end if */ + } /* end if */ /* Allocate space from the VFD (i.e. at the end of the file) */ - if(HADDR_UNDEF == (new_space = H5F__alloc(f, alloc_type, aggr->alloc_size, &eoa_frag_addr, &eoa_frag_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space") + if(HADDR_UNDEF == (new_space = H5F__alloc(f, alloc_type, aggr->alloc_size, &eoa_frag_addr, &eoa_frag_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space") /* Return the unused portion of the block to a free list */ if(aggr->size > 0) @@ -307,32 +310,32 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); } /* end else */ } /* end else */ - /* Allocate space out of the metadata block */ - ret_value = aggr->addr; - aggr->size -= size; - aggr->addr += size; + /* Allocate space out of the metadata block */ + ret_value = aggr->addr; + aggr->size -= size; + aggr->addr += size; } /* end else */ - /* Freeing any possible fragment due to file allocation */ - if(eoa_frag_size) - if(H5MF_xfree(f, alloc_type, eoa_frag_addr, eoa_frag_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment") + /* Freeing any possible fragment due to file allocation */ + if(eoa_frag_size) + if(H5MF_xfree(f, alloc_type, eoa_frag_addr, eoa_frag_size) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment") - /* Freeing any possible fragment due to alignment in the block after extension */ + /* Freeing any possible fragment due to alignment in the block after extension */ if(extended && aggr_frag_size) - if(H5MF_xfree(f, alloc_type, aggr_frag_addr, aggr_frag_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment") + if(H5MF_xfree(f, alloc_type, aggr_frag_addr, aggr_frag_size) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment") } /* end if */ else { /* Allocate space out of the block */ - ret_value = aggr->addr + aggr_frag_size; - aggr->size -= (size + aggr_frag_size); - aggr->addr += (size + aggr_frag_size); - - /* free any possible fragment */ - if(aggr_frag_size) - if(H5MF_xfree(f, alloc_type, aggr_frag_addr, aggr_frag_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment") + ret_value = aggr->addr + aggr_frag_size; + aggr->size -= (size + aggr_frag_size); + aggr->addr += (size + aggr_frag_size); + + /* free any possible fragment */ + if(aggr_frag_size) + if(H5MF_xfree(f, alloc_type, aggr_frag_addr, aggr_frag_size) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment") } /* end else */ } /* end if */ else { @@ -341,10 +344,10 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space") /* Check if fragment was generated */ - if(eoa_frag_size) + if(eoa_frag_size) /* Put fragment on the free list */ - if(H5MF_xfree(f, type, eoa_frag_addr, eoa_frag_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment") + if(H5MF_xfree(f, type, eoa_frag_addr, eoa_frag_size) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment") } /* end else */ /* Sanity check for overlapping into file's temporary allocation space */ @@ -403,53 +406,53 @@ H5MF__aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, /* Check if this aggregator is active */ if(f->shared->feature_flags & aggr->feature_flag) { /* - * If the block being tested adjoins the beginning of the aggregator + * If the block being tested adjoins the beginning of the aggregator * block, check if the aggregator can accomodate the extension. */ if(H5F_addr_eq(blk_end, aggr->addr)) { - haddr_t eoa; /* EOA for the file */ - - /* Get the EOA for the file */ - if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa") - - /* If the aggregator is at the end of file: */ - if(H5F_addr_eq(eoa, aggr->addr + aggr->size)) { - /* If extra_requested is below percentage threshold, extend block into the aggregator. */ - if(extra_requested <= (hsize_t)(EXTEND_THRESHOLD * (float)aggr->size)) { - aggr->size -= extra_requested; - aggr->addr += extra_requested; - - /* Indicate success */ - HGOTO_DONE(TRUE); - } /* end if */ - /* - * If extra_requested is above percentage threshold: - * 1) "bubble" up the aggregator by aggr->alloc_size or extra_requested - * 2) extend the block into the aggregator - */ - else { - hsize_t extra = (extra_requested < aggr->alloc_size) ? aggr->alloc_size : extra_requested; + haddr_t eoa; /* EOA for the file */ + + /* Get the EOA for the file */ + if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa") + + /* If the aggregator is at the end of file: */ + if(H5F_addr_eq(eoa, aggr->addr + aggr->size)) { + /* If extra_requested is below percentage threshold, extend block into the aggregator. */ + if(extra_requested <= (hsize_t)(EXTEND_THRESHOLD * (float)aggr->size)) { + aggr->size -= extra_requested; + aggr->addr += extra_requested; + + /* Indicate success */ + HGOTO_DONE(TRUE); + } /* end if */ + /* + * If extra_requested is above percentage threshold: + * 1) "bubble" up the aggregator by aggr->alloc_size or extra_requested + * 2) extend the block into the aggregator + */ + else { + hsize_t extra = (extra_requested < aggr->alloc_size) ? aggr->alloc_size : extra_requested; if((ret_value = H5F__try_extend(f, type, (aggr->addr + aggr->size), extra)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file") - else if(ret_value == TRUE) { - /* Shift the aggregator block by the extra requested */ + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file") + else if(ret_value == TRUE) { + /* Shift the aggregator block by the extra requested */ /* (allocates the space for the extra_requested) */ - aggr->addr += extra_requested; + aggr->addr += extra_requested; - /* Add extra to the aggregator's total allocated amount */ - aggr->tot_size += extra; + /* Add extra to the aggregator's total allocated amount */ + aggr->tot_size += extra; /* Account for any space added to the aggregator */ /* (either 0 (if extra_requested > aggr->alloc_size) or * (aggr->alloc_size - extra_requested) -QAK */ - aggr->size += extra; - aggr->size -= extra_requested; - } /* end else-if */ - } /* end else */ - } /* end if */ + aggr->size += extra; + aggr->size -= extra_requested; + } /* end else-if */ + } /* end else */ + } /* end if */ else { /* The aggreator is not at end of file */ /* Check if aggregator has enough internal space to satisfy the extension. */ @@ -461,8 +464,8 @@ H5MF__aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, /* Indicate success */ HGOTO_DONE(TRUE); } /* end if */ - } /* end else */ - } /* end if */ + } /* end else */ + } /* end if */ } /* end if */ done: @@ -471,7 +474,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5MF_aggr_can_absorb + * Function: H5MF__aggr_can_absorb * * Purpose: Check if a section adjoins an aggregator block and one can * absorb the other. @@ -486,12 +489,12 @@ done: *------------------------------------------------------------------------- */ htri_t -H5MF_aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr, +H5MF__aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr, const H5MF_free_section_t *sect, H5MF_shrink_type_t *shrink) { htri_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check args */ HDassert(f); @@ -506,7 +509,7 @@ H5MF_aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr, if(H5F_addr_eq((sect->sect_info.addr + sect->sect_info.size), aggr->addr) || H5F_addr_eq((aggr->addr + aggr->size), sect->sect_info.addr)) { #ifdef H5MF_AGGR_DEBUG -HDfprintf(stderr, "%s: section {%a, %Hu} adjoins aggr = {%a, %Hu}\n", "H5MF_aggr_can_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size); +HDfprintf(stderr, "%s: section {%a, %Hu} adjoins aggr = {%a, %Hu}\n", "H5MF__aggr_can_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size); #endif /* H5MF_AGGR_DEBUG */ /* Check if aggregator would get too large and should be absorbed into section */ if((aggr->size + sect->sect_info.size) >= aggr->alloc_size) @@ -521,11 +524,11 @@ HDfprintf(stderr, "%s: section {%a, %Hu} adjoins aggr = {%a, %Hu}\n", "H5MF_aggr done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5MF_aggr_can_absorb() */ +} /* end H5MF__aggr_can_absorb() */ /*------------------------------------------------------------------------- - * Function: H5MF_aggr_absorb + * Function: H5MF__aggr_absorb * * Purpose: Absorb a free space section into an aggregator block or * vice versa. @@ -539,10 +542,10 @@ done: *------------------------------------------------------------------------- */ herr_t -H5MF_aggr_absorb(const H5F_t H5_ATTR_UNUSED *f, H5F_blk_aggr_t *aggr, H5MF_free_section_t *sect, +H5MF__aggr_absorb(const H5F_t H5_ATTR_UNUSED *f, H5F_blk_aggr_t *aggr, H5MF_free_section_t *sect, hbool_t allow_sect_absorb) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check args */ HDassert(f); @@ -556,7 +559,7 @@ H5MF_aggr_absorb(const H5F_t H5_ATTR_UNUSED *f, H5F_blk_aggr_t *aggr, H5MF_free_ /* Check if the section adjoins the beginning or end of the aggregator */ if(H5F_addr_eq((sect->sect_info.addr + sect->sect_info.size), aggr->addr)) { #ifdef H5MF_AGGR_DEBUG -HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins front of section = {%a, %Hu}\n", "H5MF_aggr_absorb", aggr->addr, aggr->size, sect->sect_info.addr, sect->sect_info.size); +HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins front of section = {%a, %Hu}\n", "H5MF__aggr_absorb", aggr->addr, aggr->size, sect->sect_info.addr, sect->sect_info.size); #endif /* H5MF_AGGR_DEBUG */ /* Absorb aggregator onto end of section */ sect->sect_info.size += aggr->size; @@ -566,7 +569,7 @@ HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins front of section = {%a, %Hu}\n", " HDassert(H5F_addr_eq((aggr->addr + aggr->size), sect->sect_info.addr)); #ifdef H5MF_AGGR_DEBUG -HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins end of section = {%a, %Hu}\n", "H5MF_aggr_absorb", aggr->addr, aggr->size, sect->sect_info.addr, sect->sect_info.size); +HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins end of section = {%a, %Hu}\n", "H5MF__aggr_absorb", aggr->addr, aggr->size, sect->sect_info.addr, sect->sect_info.size); #endif /* H5MF_AGGR_DEBUG */ /* Absorb aggregator onto beginning of section */ sect->sect_info.addr -= aggr->size; @@ -582,7 +585,7 @@ HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins end of section = {%a, %Hu}\n", "H5 /* Check if the section adjoins the beginning or end of the aggregator */ if(H5F_addr_eq((sect->sect_info.addr + sect->sect_info.size), aggr->addr)) { #ifdef H5MF_AGGR_DEBUG -HDfprintf(stderr, "%s: section {%a, %Hu} adjoins front of aggr = {%a, %Hu}\n", "H5MF_aggr_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size); +HDfprintf(stderr, "%s: section {%a, %Hu} adjoins front of aggr = {%a, %Hu}\n", "H5MF__aggr_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size); #endif /* H5MF_AGGR_DEBUG */ /* Absorb section onto front of aggregator */ aggr->addr -= sect->sect_info.size; @@ -598,7 +601,7 @@ HDfprintf(stderr, "%s: section {%a, %Hu} adjoins front of aggr = {%a, %Hu}\n", " HDassert(H5F_addr_eq((aggr->addr + aggr->size), sect->sect_info.addr)); #ifdef H5MF_AGGR_DEBUG -HDfprintf(stderr, "%s: section {%a, %Hu} adjoins end of aggr = {%a, %Hu}\n", "H5MF_aggr_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size); +HDfprintf(stderr, "%s: section {%a, %Hu} adjoins end of aggr = {%a, %Hu}\n", "H5MF__aggr_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size); #endif /* H5MF_AGGR_DEBUG */ /* Absorb section onto end of aggregator */ aggr->size += sect->sect_info.size; @@ -608,11 +611,11 @@ HDfprintf(stderr, "%s: section {%a, %Hu} adjoins end of aggr = {%a, %Hu}\n", "H5 } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5MF_aggr_absorb() */ +} /* end H5MF__aggr_absorb() */ /*------------------------------------------------------------------------- - * Function: H5MF_aggr_query + * Function: H5MF__aggr_query * * Purpose: Query a block aggregator's current address & size info * @@ -625,10 +628,10 @@ HDfprintf(stderr, "%s: section {%a, %Hu} adjoins end of aggr = {%a, %Hu}\n", "H5 *------------------------------------------------------------------------- */ herr_t -H5MF_aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr, +H5MF__aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr, hsize_t *size) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check args */ HDassert(f); @@ -644,7 +647,7 @@ H5MF_aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr, } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5MF_aggr_query() */ +} /* end H5MF__aggr_query() */ /*------------------------------------------------------------------------- @@ -737,11 +740,11 @@ H5MF_free_aggrs(H5F_t *f) HDassert(f->shared->lf); /* Retrieve metadata aggregator info, if available */ - if(H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0) + if(H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats") /* Retrieve 'small data' aggregator info, if available */ - if(H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0) + if(H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats") /* Make certain we release the aggregator that's later in the file first */ @@ -774,7 +777,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5MF_aggr_can_shrink_eoa + * Function: H5MF__aggr_can_shrink_eoa * * Purpose: Check if the remaining space in the aggregator is at EOA * @@ -786,12 +789,12 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5MF_aggr_can_shrink_eoa(H5F_t *f, H5FD_mem_t type, H5F_blk_aggr_t *aggr) +H5MF__aggr_can_shrink_eoa(H5F_t *f, H5FD_mem_t type, H5F_blk_aggr_t *aggr) { haddr_t eoa = HADDR_UNDEF; /* EOA for the file */ htri_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -808,7 +811,7 @@ H5MF_aggr_can_shrink_eoa(H5F_t *f, H5FD_mem_t type, H5F_blk_aggr_t *aggr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5MF_aggr_can_shrink_eoa() */ +} /* H5MF__aggr_can_shrink_eoa() */ /*------------------------------------------------------------------------- @@ -882,17 +885,17 @@ H5MF_aggrs_try_shrink_eoa(H5F_t *f) HDassert(f); HDassert(f->shared); - if((ma_status = H5MF_aggr_can_shrink_eoa(f, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr))) < 0) + if((ma_status = H5MF__aggr_can_shrink_eoa(f, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr))) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats") if(ma_status > 0) - if(H5MF__aggr_free(f, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa") + if(H5MF__aggr_free(f, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr)) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa") - if((sda_status = H5MF_aggr_can_shrink_eoa(f, H5FD_MEM_DRAW, &(f->shared->sdata_aggr))) < 0) + if((sda_status = H5MF__aggr_can_shrink_eoa(f, H5FD_MEM_DRAW, &(f->shared->sdata_aggr))) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats") if(sda_status > 0) - if(H5MF__aggr_free(f, H5FD_MEM_DRAW, &(f->shared->sdata_aggr)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa") + if(H5MF__aggr_free(f, H5FD_MEM_DRAW, &(f->shared->sdata_aggr)) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa") ret_value = (ma_status || sda_status); diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index 592ca87..eedb72e 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -67,6 +67,7 @@ typedef struct { /* Local Prototypes */ /********************/ +static herr_t H5MF__sects_debug_cb(H5FS_section_info_t *_sect, void *_udata); /*********************/ /* Package Variables */ @@ -84,7 +85,7 @@ typedef struct { /*------------------------------------------------------------------------- - * Function: H5MF_sects_debug_cb + * Function: H5MF__sects_debug_cb * * Purpose: Prints debugging info about a free space section for a file * @@ -97,13 +98,13 @@ typedef struct { *------------------------------------------------------------------------- */ static herr_t -H5MF_sects_debug_cb(H5FS_section_info_t *_sect, void *_udata) +H5MF__sects_debug_cb(H5FS_section_info_t *_sect, void *_udata) { H5MF_free_section_t *sect = (H5MF_free_section_t *)_sect; /* Section to dump info */ H5MF_debug_iter_ud_t *udata = (H5MF_debug_iter_ud_t *)_udata; /* User data for callbacks */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -136,7 +137,7 @@ H5MF_sects_debug_cb(H5FS_section_info_t *_sect, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5MF_sects_debug_cb() */ +} /* end H5MF__sects_debug_cb() */ /*------------------------------------------------------------------------- @@ -184,7 +185,7 @@ H5MF_sects_debug(H5F_t *f, haddr_t fs_addr, FILE *stream, int indent, int fwidth udata.fwidth = fwidth; /* Iterate over all the free space sections */ - if(H5FS_sect_iterate(f, f->shared->fs_man[type], H5MF_sects_debug_cb, &udata) < 0) + if(H5FS_sect_iterate(f, f->shared->fs_man[type], H5MF__sects_debug_cb, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space") /* Close the free space information */ @@ -201,7 +202,7 @@ done: #ifdef H5MF_ALLOC_DEBUG_DUMP /*------------------------------------------------------------------------- - * Function: H5MF_sects_dump + * Function: H5MF__sects_dump * * Purpose: Prints debugging info about free space sections for a file. * @@ -221,7 +222,7 @@ H5MF_sects_dump(H5F_t *f, FILE *stream) int fwidth = 50; /* Field width */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) + FUNC_ENTER_PACKAGE_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Dumping file free space sections\n", FUNC); #endif /* H5MF_ALLOC_DEBUG */ @@ -234,7 +235,7 @@ HDfprintf(stderr, "%s: Dumping file free space sections\n", FUNC); /* Retrieve the 'eoa' for the file */ if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa); #endif /* H5MF_ALLOC_DEBUG */ @@ -276,13 +277,13 @@ HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa); hsize_t sda_size = 0; /* Size of "small data aggregator" */ /* Retrieve metadata aggregator info, if available */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: ma_addr = %a, ma_size = %Hu, end of ma = %a\n", FUNC, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1)); #endif /* H5MF_ALLOC_DEBUG */ /* Retrieve 'small data' aggregator info, if available */ - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size); #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, sda_addr, sda_size, (haddr_t)((sda_addr + sda_size) - 1)); #endif /* H5MF_ALLOC_DEBUG */ @@ -303,7 +304,7 @@ HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, HDfprintf(stream, "%*sSections:\n", indent + 3, ""); /* If there is a free space manager for this type, iterate over them */ - if(f->shared->fs.aggr.fs_man[atype]) { + if(f->shared->fs_man[atype]) { H5MF_debug_iter_ud_t udata; /* User data for callbacks */ /* Prepare user data for section iteration callback */ @@ -327,6 +328,6 @@ HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, done: HDfprintf(stderr, "%s: Done dumping file free space sections\n", FUNC); FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5MF_sects_dump() */ +} /* end H5MF__sects_dump() */ #endif /* H5MF_ALLOC_DEBUG_DUMP */ diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h index fbf9ee8..ec4aab4 100644 --- a/src/H5MFpkg.h +++ b/src/H5MFpkg.h @@ -12,12 +12,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Tuesday, January 8, 2008 + * Programmer: Quincey Koziol + * Tuesday, January 8, 2008 * - * Purpose: This file contains declarations which are visible only within - * the H5MF package. Source files outside the H5MF package should - * include H5MFprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5MF package. Source files outside the H5MF package should + * include H5MFprivate.h instead. */ #if !(defined H5MF_FRIEND || defined H5MF_MODULE) #error "Do not include this file outside the H5MF package!" @@ -186,24 +186,24 @@ H5_DLL herr_t H5MF__start_fstype(H5F_t *f, H5F_mem_page_t type); H5_DLL htri_t H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, haddr_t *addr); H5_DLL herr_t H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_section_t *node); -H5_DLL herr_t H5MF_sects_dump(H5F_t *f, FILE *stream); +H5_DLL herr_t H5MF__sects_dump(H5F_t *f, FILE *stream); -H5_DLL void H5MF_alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type); +H5_DLL void H5MF__alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type); /* 'simple/small/large' section routines */ -H5_DLL H5MF_free_section_t *H5MF_sect_new(unsigned ctype, haddr_t sect_off, +H5_DLL H5MF_free_section_t *H5MF__sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size); -H5_DLL herr_t H5MF_sect_free(H5FS_section_info_t *sect); +H5_DLL herr_t H5MF__sect_free(H5FS_section_info_t *sect); /* Block aggregator routines */ H5_DLL htri_t H5MF__aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, H5FD_mem_t type, haddr_t abs_blk_end, hsize_t extra_requested); -H5_DLL htri_t H5MF_aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr, +H5_DLL htri_t H5MF__aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr, const H5MF_free_section_t *sect, H5MF_shrink_type_t *shrink); -H5_DLL herr_t H5MF_aggr_absorb(const H5F_t *f, H5F_blk_aggr_t *aggr, +H5_DLL herr_t H5MF__aggr_absorb(const H5F_t *f, H5F_blk_aggr_t *aggr, H5MF_free_section_t *sect, hbool_t allow_sect_absorb); -H5_DLL herr_t H5MF_aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, +H5_DLL herr_t H5MF__aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr, hsize_t *size); /* Testing routines */ diff --git a/src/H5MFsection.c b/src/H5MFsection.c index d722139..3ebc5c8 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -116,7 +116,7 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{ H5MF__sect_simple_merge, /* Merge sections */ H5MF__sect_simple_can_shrink, /* Can section shrink container?*/ H5MF__sect_simple_shrink, /* Shrink container w/section */ - H5MF_sect_free, /* Free section */ + H5MF__sect_free, /* Free section */ H5MF__sect_valid, /* Check validity of section */ H5MF__sect_split, /* Split section node for alignment */ NULL, /* Dump debugging for section */ @@ -142,7 +142,7 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{ H5MF__sect_small_merge, /* Merge sections */ NULL, /* Can section shrink container?*/ NULL, /* Shrink container w/section */ - H5MF_sect_free, /* Free section */ + H5MF__sect_free, /* Free section */ H5MF__sect_valid, /* Check validity of section */ H5MF__sect_split, /* Split section node for alignment */ NULL, /* Dump debugging for section */ @@ -168,7 +168,7 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{ H5MF__sect_large_merge, /* Merge sections */ H5MF__sect_large_can_shrink, /* Can section shrink container?*/ H5MF__sect_large_shrink, /* Shrink container w/section */ - H5MF_sect_free, /* Free section */ + H5MF__sect_free, /* Free section */ H5MF__sect_valid, /* Check validity of section */ H5MF__sect_split, /* Split section node for alignment */ NULL, /* Dump debugging for section */ @@ -192,7 +192,7 @@ H5FL_DEFINE(H5MF_free_section_t); /*------------------------------------------------------------------------- - * Function: H5MF_sect_new + * Function: H5MF__sect_new * * Purpose: Create a new section of "ctype" and return it to the caller * @@ -205,12 +205,12 @@ H5FL_DEFINE(H5MF_free_section_t); *------------------------------------------------------------------------- */ H5MF_free_section_t * -H5MF_sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size) +H5MF__sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size) { H5MF_free_section_t *sect; /* 'Simple' free space section to add */ H5MF_free_section_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(sect_size); @@ -232,11 +232,11 @@ H5MF_sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5MF_sect_new() */ +} /* end H5MF__sect_new() */ /*------------------------------------------------------------------------- - * Function: H5MF_sect_free + * Function: H5MF__sect_free * * Purpose: Free a 'simple/small/large' section node * @@ -249,11 +249,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5MF_sect_free(H5FS_section_info_t *_sect) +H5MF__sect_free(H5FS_section_info_t *_sect) { H5MF_free_section_t *sect = (H5MF_free_section_t *)_sect; /* File free section */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ HDassert(sect); @@ -262,11 +262,11 @@ H5MF_sect_free(H5FS_section_info_t *_sect) sect = H5FL_FREE(H5MF_free_section_t, sect); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5MF_sect_free() */ +} /* H5MF__sect_free() */ /*------------------------------------------------------------------------- - * Function: H5MF_sect_deserialize + * Function: H5MF__sect_deserialize * * Purpose: Deserialize a buffer into a "live" section * @@ -294,7 +294,7 @@ H5MF__sect_deserialize(const H5FS_section_class_t *cls, HDassert(sect_size); /* Create free space section for block */ - if(NULL == (sect = H5MF_sect_new(cls->type, sect_addr, sect_size))) + if(NULL == (sect = H5MF__sect_new(cls->type, sect_addr, sect_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't initialize free space section") /* Set return value */ @@ -360,7 +360,7 @@ H5MF__sect_split(H5FS_section_info_t *sect, hsize_t frag_size) FUNC_ENTER_STATIC /* Allocate space for new section */ - if(NULL == (ret_value = H5MF_sect_new(sect->type, sect->addr, frag_size))) + if(NULL == (ret_value = H5MF__sect_new(sect->type, sect->addr, frag_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't initialize free space section") /* Set new section's info */ @@ -449,7 +449,7 @@ H5MF__sect_simple_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect (*sect1)->sect_info.size += sect2->sect_info.size; /* Get rid of second section */ - if(H5MF_sect_free((H5FS_section_info_t *)sect2) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)sect2) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node") done: @@ -514,7 +514,7 @@ HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect- htri_t status; /* Status from aggregator adjoin */ /* See if section can absorb the aggregator & vice versa */ - if((status = H5MF_aggr_can_absorb(udata->f, &(udata->f->shared->meta_aggr), sect, &(udata->shrink))) < 0) + if((status = H5MF__aggr_can_absorb(udata->f, &(udata->f->shared->meta_aggr), sect, &(udata->shrink))) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "error merging section with aggregation block") else if(status > 0) { /* Set the aggregator to operate on */ @@ -533,7 +533,7 @@ HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins metadata aggregator\n", FUNC, htri_t status; /* Status from aggregator adjoin */ /* See if section can absorb the aggregator & vice versa */ - if((status = H5MF_aggr_can_absorb(udata->f, &(udata->f->shared->sdata_aggr), sect, &(udata->shrink))) < 0) + if((status = H5MF__aggr_can_absorb(udata->f, &(udata->f->shared->sdata_aggr), sect, &(udata->shrink))) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "error merging section with aggregation block") else if(status > 0) { /* Set the aggregator to operate on */ @@ -597,14 +597,14 @@ H5MF__sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata) HDassert(udata->aggr); /* Absorb the section into the aggregator or vice versa */ - if(H5MF_aggr_absorb(udata->f, udata->aggr, *sect, udata->allow_sect_absorb) < 0) + if(H5MF__aggr_absorb(udata->f, udata->aggr, *sect, udata->allow_sect_absorb) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "can't absorb section into aggregator or vice versa") } /* end else */ /* Check for freeing section */ if(udata->shrink != H5MF_SHRINK_SECT_ABSORB_AGGR) { /* Free section */ - if(H5MF_sect_free((H5FS_section_info_t *)*sect) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)*sect) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") /* Mark section as freed, for free space manager */ @@ -660,7 +660,7 @@ HDfprintf(stderr, "%s: Entering, section {%a, %Hu}\n", FUNC, (*sect)->sect_info. /* Drop the section if it is at page end and its size is <= pgend threshold */ if(!rem && (*sect)->sect_info.size <= H5F_PGEND_META_THRES(udata->f) && (*flags & H5FS_ADD_RETURNED_SPACE)) { - if(H5MF_sect_free((H5FS_section_info_t *)(*sect)) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)(*sect)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node") *sect = NULL; *flags &= (unsigned)~H5FS_ADD_RETURNED_SPACE; @@ -779,13 +779,13 @@ H5MF__sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2 if(H5PB_remove_entry(udata->f, (*sect1)->sect_info.addr) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free merged section") - if(H5MF_sect_free((H5FS_section_info_t *)(*sect1)) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)(*sect1)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node") *sect1 = NULL; } /* end if */ /* Get rid of second section */ - if(H5MF_sect_free((H5FS_section_info_t *)sect2) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)sect2) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node") done: @@ -872,7 +872,7 @@ H5MF__sect_large_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2 (*sect1)->sect_info.size += sect2->sect_info.size; /* Get rid of second section */ - if(H5MF_sect_free((H5FS_section_info_t *)sect2) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)sect2) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node") done: @@ -976,7 +976,7 @@ H5MF__sect_large_shrink(H5FS_section_info_t **_sect, void *_udata) (*sect)->sect_info.size = frag_size; else { /* Free section */ - if(H5MF_sect_free((H5FS_section_info_t *)*sect) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)*sect) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") /* Mark section as freed, for free space manager */ diff --git a/src/H5PB.c b/src/H5PB.c index dab69f4..a325ad1 100644 --- a/src/H5PB.c +++ b/src/H5PB.c @@ -254,23 +254,23 @@ H5PB_print_stats(const H5PB_t *page_buf) printf("PAGE BUFFER STATISTICS:\n"); - printf("******* METADATA\n"); - printf("\t Total Accesses: %u\n", page_buf->accesses[0]); - printf("\t Hits: %u\n", page_buf->hits[0]); - printf("\t Misses: %u\n", page_buf->misses[0]); - printf("\t Evictions: %u\n", page_buf->evictions[0]); - printf("\t Bypasses: %u\n", page_buf->bypasses[0]); - printf("\t Hit Rate = %f%%\n", ((double)page_buf->hits[0]/(page_buf->accesses[0] - page_buf->bypasses[0]))*100); - printf("*****************\n\n"); - - printf("******* RAWDATA\n"); - printf("\t Total Accesses: %u\n", page_buf->accesses[1]); - printf("\t Hits: %u\n", page_buf->hits[1]); - printf("\t Misses: %u\n", page_buf->misses[1]); - printf("\t Evictions: %u\n", page_buf->evictions[1]); - printf("\t Bypasses: %u\n", page_buf->bypasses[1]); - printf("\t Hit Rate = %f%%\n", ((double)page_buf->hits[1]/(page_buf->accesses[1]-page_buf->bypasses[0]))*100); - printf("*****************\n\n"); + HDprintf("******* METADATA\n"); + HDprintf("\t Total Accesses: %u\n", page_buf->accesses[0]); + HDprintf("\t Hits: %u\n", page_buf->hits[0]); + HDprintf("\t Misses: %u\n", page_buf->misses[0]); + HDprintf("\t Evictions: %u\n", page_buf->evictions[0]); + HDprintf("\t Bypasses: %u\n", page_buf->bypasses[0]); + HDprintf("\t Hit Rate = %f%%\n", ((double)page_buf->hits[0]/(page_buf->accesses[0] - page_buf->bypasses[0]))*100); + HDprintf("*****************\n\n"); + + HDprintf("******* RAWDATA\n"); + HDprintf("\t Total Accesses: %u\n", page_buf->accesses[1]); + HDprintf("\t Hits: %u\n", page_buf->hits[1]); + HDprintf("\t Misses: %u\n", page_buf->misses[1]); + HDprintf("\t Evictions: %u\n", page_buf->evictions[1]); + HDprintf("\t Bypasses: %u\n", page_buf->bypasses[1]); + HDprintf("\t Hit Rate = %f%%\n", ((double)page_buf->hits[1]/(page_buf->accesses[1]-page_buf->bypasses[0]))*100); + HDprintf("*****************\n\n"); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5PB_print_stats */ diff --git a/src/H5R.c b/src/H5R.c index ab73b59..95abc32 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -141,7 +141,7 @@ done: void *ref; IN: Reference to open. RETURNS - Valid ID on success, Negative on failure + Valid ID on success, H5I_INVALID_HID on failure DESCRIPTION Given a reference to some object, open that object and return an ID for that object. @@ -203,7 +203,7 @@ done: void *ref; IN: Reference to open. RETURNS - Valid ID on success, Negative on failure + Valid ID on success, H5I_INVALID_HID on failure DESCRIPTION Given a reference to some object, creates a copy of the dataset pointed to's dataspace and defines a selection in the copy which is the region @@ -311,7 +311,7 @@ done: when passing in the size) RETURNS - Non-negative length of the path on success, Negative on failure + Non-negative length of the path on success, -1 on failure DESCRIPTION Given a reference to some object, determine a path to the object referenced in the file. @@ -335,23 +335,23 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, H5F_t *file; /* File object */ ssize_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE5("Zs", "iRt*x*sz", id, ref_type, _ref, name, size); /* Check args */ if (H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location") if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type") if (_ref == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer") /* Get the file pointer from the entry */ file = loc.oloc->file; /* Get name */ if((ret_value = H5R__get_name(file, id, ref_type, _ref, name, size)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object path") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to determine object path") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 2f41f7d..fb62430 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -141,7 +141,7 @@ done: * ref IN: Reference to open * * Return: Success: Valid HDF5 ID - * Failure: Negative + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ diff --git a/src/H5Rint.c b/src/H5Rint.c index 02f7778..761ba44 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -587,7 +587,7 @@ done: H5F_t *file; IN: File the object being dereferenced is within H5R_type_t ref_type; IN: Type of reference to query void *ref; IN: Reference to query. - H5O_type_t *obj_type; OUT: The type of the object, set on success + H5O_type_t *obj_type; OUT: The type of the object, set on success RETURNS Non-negative on success/Negative on failure @@ -678,12 +678,12 @@ done: hid_t lapl_id; IN: LAPL to use for operation hid_t id; IN: Location ID given for reference H5R_type_t ref_type; IN: Type of reference - void *ref; IN: Reference to query. + void *_ref; IN: Reference to query. char *name; OUT: Buffer to place name of object referenced size_t size; IN: Size of name buffer RETURNS - Non-negative length of the path on success, Negative on failure + Non-negative length of the path on success, -1 on failure DESCRIPTION Given a reference to some object, determine a path to the object referenced in the file. @@ -732,7 +732,7 @@ H5R__get_name(H5F_t *f, hid_t id, H5R_type_t ref_type, const void *_ref, /* Get the dataset region from the heap (allocate inside routine) */ if ((buf = (uint8_t *)H5HG_read(oloc.file, &hobjid, NULL, NULL)) == NULL) - HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information") + HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, (-1), "Unable to read dataset region information") /* Get the object oid for the dataset */ p = buf; @@ -747,22 +747,21 @@ H5R__get_name(H5F_t *f, hid_t id, H5R_type_t ref_type, const void *_ref, case H5R_BADTYPE: case H5R_MAXTYPE: default: - HDassert("unknown reference type" && 0); - HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") + HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, (-1), "internal error (unknown reference type)") } /* end switch */ /* Retrieve file ID for name search */ if ((file_id = H5I_get_file_id(id, FALSE)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve file ID") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't retrieve file ID") /* Get name, length, etc. */ if ((ret_value = H5G_get_name_by_addr(file_id, &oloc, name, size)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't determine name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't determine name") done: /* Close file ID used for search */ if (file_id > 0 && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "can't decrement ref count of temp ID") + HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, (-1), "can't decrement ref count of temp ID") FUNC_LEAVE_NOAPI_VOL(ret_value) } /* end H5R__get_name() */ diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index 49261eb..fbbff50 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -26,6 +26,11 @@ #include "H5Rprivate.h" /* Other private headers needed by this file */ +#include "H5Fprivate.h" /* Files */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Sprivate.h" /* Dataspaces */ + /**************************/ /* Package Private Macros */ diff --git a/test/btree2.c b/test/btree2.c index e2874b7..d26fed5 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -5259,7 +5259,7 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -5269,7 +5269,7 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam, /* Attempt to remove a non-existant record from a B-tree with 1 record */ record = 0; H5E_BEGIN_TRY { - ret = H5B2_remove(bt2, &record, NULL, NULL); + ret = H5B2_remove(bt2, &record, NULL, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -5302,7 +5302,7 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the root node has been freed */ @@ -5384,7 +5384,7 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the root node has not been freed */ @@ -5409,7 +5409,7 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the root node has not been freed */ @@ -5434,7 +5434,7 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the root node has not been freed */ @@ -5459,7 +5459,7 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the root node has been freed */ @@ -5544,7 +5544,7 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -5773,7 +5773,7 @@ test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -5971,7 +5971,7 @@ test_remove_level1_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -6149,7 +6149,7 @@ test_remove_level1_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -6280,7 +6280,7 @@ test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -6500,7 +6500,7 @@ test_remove_level1_promote_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cpar TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -6647,7 +6647,7 @@ test_remove_level1_promote_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cpar TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -6794,7 +6794,7 @@ test_remove_level1_promote_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -6938,7 +6938,7 @@ test_remove_level1_promote_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -7079,7 +7079,7 @@ test_remove_level1_collapse(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -7126,7 +7126,7 @@ test_remove_level1_collapse(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -7220,7 +7220,7 @@ test_remove_level2_promote(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -7505,7 +7505,7 @@ test_remove_level2_promote_2internal_redistrib(hid_t fapl, const H5B2_create_t * TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -7654,7 +7654,7 @@ test_remove_level2_promote_3internal_redistrib(hid_t fapl, const H5B2_create_t * TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -7803,7 +7803,7 @@ test_remove_level2_promote_2internal_merge(hid_t fapl, const H5B2_create_t *cpar TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -7953,7 +7953,7 @@ test_remove_level2_promote_3internal_merge(hid_t fapl, const H5B2_create_t *cpar TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -8103,7 +8103,7 @@ test_remove_level2_2internal_merge_left(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -8228,7 +8228,7 @@ test_remove_level2_2internal_merge_right(hid_t fapl, const H5B2_create_t *cparam TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -8353,7 +8353,7 @@ test_remove_level2_3internal_merge(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -8479,7 +8479,7 @@ test_remove_level2_collapse_right(hid_t fapl, const H5B2_create_t *cparam, TEST_ERROR /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -8765,7 +8765,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); } /* end for */ /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -8852,7 +8852,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); } /* end for */ /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -8937,7 +8937,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); } /* end for */ /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ @@ -9022,7 +9022,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); } /* end for */ /* Query the address of the root node in the B-tree */ - if(H5B2_get_root_addr_test(bt2, &root_addr) < 0) + if(H5B2__get_root_addr_test(bt2, &root_addr) < 0) FAIL_STACK_ERROR /* Make certain that the address of the root node is defined */ diff --git a/test/getname.c b/test/getname.c index c3f3c54..39c3464 100644 --- a/test/getname.c +++ b/test/getname.c @@ -2937,7 +2937,7 @@ test_elinks(hid_t fapl) /* Query the external link object's name */ *name = '\0'; name_cached = FALSE; - namelen = H5I_get_name_test(group, (char*)name, sizeof(name), &name_cached); + namelen = H5I__get_name_test(group, (char*)name, sizeof(name), &name_cached); if(!((HDstrcmp(name, "/Group2") == 0) && (namelen == 7) && name_cached)) TEST_ERROR @@ -2952,7 +2952,7 @@ test_elinks(hid_t fapl) /* Query the external link to external link object's name */ *name = '\0'; name_cached = FALSE; - namelen = H5I_get_name_test(group, (char*)name, sizeof(name), &name_cached); + namelen = H5I__get_name_test(group, (char*)name, sizeof(name), &name_cached); if(!((HDstrcmp(name, "/Group2") == 0) && (namelen == 7) && name_cached)) TEST_ERROR diff --git a/test/mf.c b/test/mf.c index a537679..9203804 100644 --- a/test/mf.c +++ b/test/mf.c @@ -258,13 +258,13 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); type = H5FD_MEM_SUPER; addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30); /* nothing should be changed in meta_aggr */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size); if (new_ma_addr != ma_addr) TEST_ERROR @@ -274,7 +274,7 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50); /* nothing should be changed in meta_aggr */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size); if (new_ma_addr != ma_addr) TEST_ERROR @@ -403,7 +403,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); type = H5FD_MEM_SUPER; addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30); @@ -412,7 +412,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* nothing should be changed in meta_aggr */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if (new_ma_addr != ma_addr) TEST_ERROR if (new_ma_size != ma_size) TEST_ERROR @@ -435,14 +435,14 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); /* should succeed */ if(H5MF_try_shrink(f, type, addr, (hsize_t)TBLOCK_SIZE30) <= 0) TEST_ERROR /* nothing should be changed in meta_aggr */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size); if(new_ma_addr != ma_addr) TEST_ERROR if(new_ma_size != ma_size) @@ -480,7 +480,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30); @@ -492,7 +492,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* nothing should be changed in meta_aggr */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size); if (new_ma_addr != ma_addr) TEST_ERROR if (new_ma_size != ma_size) TEST_ERROR @@ -529,14 +529,14 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); /* should not succeed in shrinking */ if(H5MF_try_shrink(f, type, addr, (hsize_t)TBLOCK_SIZE30 + 10) > 0) TEST_ERROR /* nothing should be changed in meta_aggr */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size); if (new_ma_addr != ma_addr) TEST_ERROR if (new_ma_size != ma_size) TEST_ERROR @@ -572,14 +572,14 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); /* should succeed in shrinking */ if(H5MF_try_shrink(f, type, addr+10, (hsize_t)(TBLOCK_SIZE30 - 10)) <= 0) TEST_ERROR /* nothing should be changed in meta_aggr */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size); if(new_ma_addr != ma_addr) TEST_ERROR if(new_ma_size != ma_size) @@ -684,7 +684,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); type = H5FD_MEM_SUPER; addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30); @@ -692,7 +692,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* nothing should be changed in meta_aggr */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if (new_ma_addr != ma_addr) TEST_ERROR @@ -722,7 +722,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* nothing should be changed in meta_aggr */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if (new_ma_addr != ma_addr) TEST_ERROR @@ -762,7 +762,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); type = H5FD_MEM_SUPER; addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30); @@ -771,7 +771,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* nothing should be changed in meta_aggr */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if(new_ma_addr != ma_addr) TEST_ERROR @@ -782,7 +782,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* nothing should be changed in meta_aggr */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if (new_ma_addr != ma_addr) TEST_ERROR @@ -1186,7 +1186,7 @@ test_mf_fs_alloc_free(hid_t fapl) TEST_ERROR /* Create section A */ - sect_node = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30); + sect_node = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30); /* Add section A to free-space manager */ if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node)) @@ -1263,7 +1263,7 @@ test_mf_fs_alloc_free(hid_t fapl) TEST_ERROR /* Create section A */ - sect_node = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30); + sect_node = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30); /* Add section A to free-space manager */ if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node)) @@ -1338,7 +1338,7 @@ test_mf_fs_alloc_free(hid_t fapl) TEST_ERROR /* Create section A */ - sect_node = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30); + sect_node = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30); /* Add section A to free-space manager */ if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node)) @@ -1511,7 +1511,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Create section A */ - sect_node1 = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30); + sect_node1 = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30); /* Add section A to free-space manager */ if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node1)) @@ -1540,7 +1540,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Create section B */ - sect_node2 = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR100, (hsize_t)TBLOCK_SIZE50); + sect_node2 = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR100, (hsize_t)TBLOCK_SIZE50); /* Add section B to free-space manager */ if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node2)) @@ -1619,7 +1619,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Create section A */ - sect_node1 = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30); + sect_node1 = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30); /* Add section A to free-space manager */ if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node1)) @@ -1648,7 +1648,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Create section B */ - sect_node2 = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR100, (hsize_t)TBLOCK_SIZE50); + sect_node2 = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR100, (hsize_t)TBLOCK_SIZE50); /* Add section B to free-space manager */ if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node2)) @@ -1721,7 +1721,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Create section A */ - sect_node1 = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30); + sect_node1 = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE30); /* Add section A to free-space manager */ if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node1)) @@ -1750,7 +1750,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Create section B */ - sect_node2 = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR100, (hsize_t)TBLOCK_SIZE50); + sect_node2 = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR100, (hsize_t)TBLOCK_SIZE50); /* Add section B to free-space manager */ if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node2)) @@ -1823,7 +1823,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Create section A */ - sect_node1 = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)(TBLOCK_SIZE30-10)); + sect_node1 = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)(TBLOCK_SIZE30-10)); /* Add section A of size=20 to free-space */ if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node1)) @@ -1852,7 +1852,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Create section B */ - sect_node2 = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR100, (hsize_t)TBLOCK_SIZE50); + sect_node2 = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR100, (hsize_t)TBLOCK_SIZE50); /* Add section B to free-space manager */ if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node2)) @@ -1997,10 +1997,10 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) /* Allocate a section from meta_aggr */ addr = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); /* Create a section */ - sect_node = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)(ma_addr+ma_size), (hsize_t)TBLOCK_SIZE2048); + sect_node = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)(ma_addr+ma_size), (hsize_t)TBLOCK_SIZE2048); /* Add a section to free-space that adjoins end of the aggregator */ if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node)) @@ -2052,13 +2052,13 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) /* Allocate a section from meta_aggr */ addr = H5MF_alloc(f, H5FD_MEM_SUPER, (hsize_t)TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); /* Allocate a section from sdata_aggr */ saddr = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE50); /* Add a section to free-space that adjoins the beginning of meta_aggr */ - sect_node = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)addr, (hsize_t)TBLOCK_SIZE30); + sect_node = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)addr, (hsize_t)TBLOCK_SIZE30); /* When adding, meta_aggr is absorbed onto the end of the section */ if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node)) @@ -2172,7 +2172,7 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) if((addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30)) == HADDR_UNDEF) TEST_ERROR - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr1+TBLOCK_SIZE30) != ma_addr) TEST_ERROR @@ -2180,7 +2180,7 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) if((addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50)) == HADDR_UNDEF) TEST_ERROR - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr2+TBLOCK_SIZE50) != ma_addr) TEST_ERROR if(ma_size != (TBLOCK_SIZE2048 - (TBLOCK_SIZE30 + TBLOCK_SIZE50))) @@ -2311,13 +2311,13 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) type = H5FD_MEM_SUPER; addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr1+TBLOCK_SIZE30) != ma_addr) TEST_ERROR addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr2+TBLOCK_SIZE50) != ma_addr) TEST_ERROR @@ -2326,7 +2326,7 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE2058); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr3+TBLOCK_SIZE2058) != ma_addr) TEST_ERROR @@ -2468,14 +2468,14 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) type = H5FD_MEM_SUPER; addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr1+TBLOCK_SIZE30) != ma_addr) TEST_ERROR /* Allocate second block from meta_aggr */ addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr2+TBLOCK_SIZE50) != ma_addr) TEST_ERROR @@ -2485,7 +2485,7 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) /* Allocate first block from sdata_aggr */ stype = H5FD_MEM_DRAW; saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if((saddr1+TBLOCK_SIZE30) != sdata_addr) TEST_ERROR if(sdata_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE30)) TEST_ERROR @@ -2493,7 +2493,7 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) /* Allocate third block, which is from file allocation not from meta_aggr */ addr3 = H5MF_alloc(f, type, (hsize_t)(TBLOCK_SIZE2058)); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); /* info for meta_aggr shouldn't be changed */ if(addr3 != (sdata_addr+sdata_size)) TEST_ERROR @@ -2502,7 +2502,7 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) /* Allocate fourth block, which should be from meta_aggr */ addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr4+TBLOCK_SIZE50) != ma_addr) TEST_ERROR @@ -2631,7 +2631,7 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) type = H5FD_MEM_SUPER; addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr1+TBLOCK_SIZE30) != ma_addr) TEST_ERROR @@ -2641,19 +2641,19 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) /* Allocate first block from sdata_aggr */ stype = H5FD_MEM_DRAW; saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if((saddr1+TBLOCK_SIZE30) != sdata_addr) TEST_ERROR /* Allocate second block from sdata_aggr */ saddr2 = H5MF_alloc(f, stype, (hsize_t)(TBLOCK_SIZE2048 - TBLOCK_SIZE30)); - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if(saddr2+(TBLOCK_SIZE2048 - TBLOCK_SIZE30) != sdata_addr) TEST_ERROR /* Allocate third block from sdata_aggr */ saddr3 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE50); - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if((saddr3+TBLOCK_SIZE50) != sdata_addr) TEST_ERROR @@ -2667,12 +2667,12 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* sdata_aggr is reset 0 */ - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if((sdata_addr != 0) && (sdata_size != 0)) TEST_ERROR /* info is unchanged in meta_aggr */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if((new_ma_addr != ma_addr) && (new_ma_size != ma_size)) TEST_ERROR @@ -2779,13 +2779,13 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) type = H5FD_MEM_SUPER; addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr1+TBLOCK_SIZE30) != ma_addr) TEST_ERROR /* Allocate second block from meta_aggr */ addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if(addr2+TBLOCK_SIZE50 != ma_addr) TEST_ERROR @@ -2794,7 +2794,7 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) /* Allocate third block from meta_aggr */ addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1970); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if(addr3 != ma_addr) TEST_ERROR if((addr3+TBLOCK_SIZE1970) != new_ma_addr) TEST_ERROR @@ -2914,13 +2914,13 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) /* Allocate first block from meta_aggr */ addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr1+TBLOCK_SIZE30) != ma_addr) TEST_ERROR /* Allocate second block from meta_aggr */ addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if(addr2+TBLOCK_SIZE50 != ma_addr) TEST_ERROR @@ -2931,14 +2931,14 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) stype = H5FD_MEM_DRAW; saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if((saddr1+TBLOCK_SIZE30) != sdata_addr) TEST_ERROR if(sdata_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE30)) TEST_ERROR /* Allocate third block from meta_aggr */ addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1970); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if((addr3+TBLOCK_SIZE1970) != new_ma_addr) TEST_ERROR if(addr3 != (sdata_addr+sdata_size)) TEST_ERROR @@ -3079,13 +3079,13 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) /* Allocate the first block from meta_aggr */ type = H5FD_MEM_SUPER; addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr1+TBLOCK_SIZE30) != ma_addr) TEST_ERROR /* Allocate the second block from meta_aggr */ addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if (addr2+TBLOCK_SIZE50 != ma_addr) TEST_ERROR @@ -3095,14 +3095,14 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) /* Allocate the first block from sdata_aggr */ stype = H5FD_MEM_DRAW; saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if ((saddr1+TBLOCK_SIZE30) != sdata_addr) TEST_ERROR /* Allocate the second block from sdata_aggr */ saddr2 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE2048 - TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if ((saddr2+(TBLOCK_SIZE2048 - TBLOCK_SIZE30)) != sdata_addr) TEST_ERROR if (sdata_size != 0) TEST_ERROR @@ -3110,7 +3110,7 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) /* Allocate the third block from sdata_aggr */ saddr3 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE50); - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if ((saddr3+TBLOCK_SIZE50) != sdata_addr) TEST_ERROR if (sdata_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE50)) @@ -3118,14 +3118,14 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) /* Allocate the third block from meta_aggr */ addr3 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE1970); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if (addr3 != sdata_addr) TEST_ERROR if ((addr3 + TBLOCK_SIZE1970) != ma_addr) TEST_ERROR if (ma_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE1970)) TEST_ERROR /* sdata_aggr info is reset to 0 */ - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if (sdata_addr != HADDR_UNDEF) TEST_ERROR if (sdata_size != 0) TEST_ERROR @@ -3242,7 +3242,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) /* Allocate the first block from meta_aggr */ type = H5FD_MEM_SUPER; addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr+TBLOCK_SIZE30) != ma_addr) TEST_ERROR @@ -3259,7 +3259,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) if(!was_extended) TEST_ERROR - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if(new_ma_addr != (addr+TBLOCK_SIZE50)) TEST_ERROR @@ -3275,7 +3275,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) if(!was_extended) TEST_ERROR - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if(new_ma_addr != (addr + TBLOCK_SIZE700)) TEST_ERROR @@ -3291,7 +3291,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) if(!was_extended) TEST_ERROR - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if (new_ma_addr != (addr + TBLOCK_SIZE2058)) TEST_ERROR @@ -3333,14 +3333,14 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) /* Allocate the first block from meta_aggr */ type = H5FD_MEM_SUPER; addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr+TBLOCK_SIZE30) != ma_addr) TEST_ERROR /* Allocate the first block from sdata_aggr */ stype = H5FD_MEM_DRAW; saddr = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE50); - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if((saddr+TBLOCK_SIZE50) != sdata_addr) TEST_ERROR @@ -3356,7 +3356,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) if(!was_extended) TEST_ERROR - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if(new_ma_addr != (addr+TBLOCK_SIZE50)) TEST_ERROR @@ -3403,14 +3403,14 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) /* Allocate first block from meta_aggr */ type = H5FD_MEM_SUPER; addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr+TBLOCK_SIZE30) != ma_addr) TEST_ERROR /* Allocate first block from sdata_aggr */ stype = H5FD_MEM_DRAW; saddr = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE50); - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if((saddr+TBLOCK_SIZE50) != sdata_addr) TEST_ERROR @@ -3426,7 +3426,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) if(was_extended) TEST_ERROR - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if (new_ma_addr != addr) TEST_ERROR if (new_ma_size != 0) TEST_ERROR @@ -3533,7 +3533,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) /* Allocate block A from meta_aggr */ type = H5FD_MEM_SUPER; addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); ma_addr = new_ma_addr - TBLOCK_SIZE30; if((addr1 + TBLOCK_SIZE30) != new_ma_addr) @@ -3543,7 +3543,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) if(H5MF_try_shrink(f, type, addr1, (hsize_t)TBLOCK_SIZE30) <= 0) TEST_ERROR - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if(new_ma_addr != ma_addr) TEST_ERROR @@ -3580,7 +3580,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) /* Allocate block A from meta_aggr */ type = H5FD_MEM_SUPER; addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr1+TBLOCK_SIZE30) != ma_addr) TEST_ERROR if(ma_size != (TBLOCK_SIZE2048 - TBLOCK_SIZE30)) TEST_ERROR @@ -3589,18 +3589,18 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) stype = H5FD_MEM_DRAW; saddr1 = H5MF_alloc(f, stype, (hsize_t)TBLOCK_SIZE50); - H5MF_aggr_query(f, &(f->shared->sdata_aggr), NULL, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), NULL, &sdata_size); /* should succeed */ if(H5MF_try_shrink(f, stype, saddr1, (hsize_t)TBLOCK_SIZE50) <= 0) TEST_ERROR - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &new_sdata_addr, &new_sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &new_sdata_addr, &new_sdata_size); if(new_sdata_addr != saddr1) TEST_ERROR if(new_sdata_size != sdata_size + TBLOCK_SIZE50) TEST_ERROR /* meta_aggr info should be updated because the block is absorbed into the meta_aggr */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if (new_ma_addr != ma_addr) TEST_ERROR if (new_ma_size != (ma_size)) TEST_ERROR @@ -3639,20 +3639,20 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) /* Allocate block A from meta_aggr */ type = H5FD_MEM_SUPER; addr1 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE30); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr1+TBLOCK_SIZE30) != ma_addr) TEST_ERROR /* Allocate block B from meta_aggr */ addr2 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE50); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr2+TBLOCK_SIZE50) != ma_addr) TEST_ERROR /* Allocate block C from meta_aggr */ addr3 = H5MF_alloc(f, type, (hsize_t)(TBLOCK_SIZE30+TBLOCK_SIZE50)); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr3+TBLOCK_SIZE30+TBLOCK_SIZE50) != ma_addr) TEST_ERROR @@ -3661,7 +3661,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* aggregator info should be the same as before */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if(new_ma_addr != ma_addr) TEST_ERROR H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE30); @@ -3799,7 +3799,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) if(addr1 % alignment) TEST_ERROR /* there should be nothing in the aggregator */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if(ma_addr || ma_size) TEST_ERROR HDmemset(&state, 0, sizeof(H5FS_stat_t)); @@ -3823,7 +3823,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) if (addr2 % alignment) TEST_ERROR /* there should be nothing in the aggregator */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if(ma_addr || ma_size) TEST_ERROR if(mis_align) { @@ -4054,7 +4054,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TEST_ERROR /* Create section A */ - sect_node = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)alignment, (hsize_t)TBLOCK_SIZE50); + sect_node = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)alignment, (hsize_t)TBLOCK_SIZE50); /* Add section A to free-space manager */ if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node)) @@ -4117,7 +4117,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TEST_ERROR /* Create section A */ - sect_node = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE8000); + sect_node = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE8000); /* Add section A to free-space manager */ if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node)) @@ -4200,7 +4200,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TEST_ERROR /* Create section A */ - sect_node = H5MF_sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE700); + sect_node = H5MF__sect_new(H5MF_FSPACE_SECT_SIMPLE, (haddr_t)TBLOCK_ADDR70, (hsize_t)TBLOCK_SIZE700); /* Add section A to free-space manager */ if(H5MF__add_sect(f, H5FD_MEM_SUPER, f->shared->fs_man[H5FD_MEM_SUPER], sect_node)) @@ -4429,7 +4429,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state.serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr1 + TBLOCK_SIZE30) != ma_addr) TEST_ERROR @@ -4452,7 +4452,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state.serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr2 + TBLOCK_SIZE50) != ma_addr) TEST_ERROR @@ -4474,7 +4474,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state.serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr3 + TBLOCK_SIZE80) != ma_addr) TEST_ERROR @@ -4497,7 +4497,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state.serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr4 + TBLOCK_SIZE1970) != ma_addr) TEST_ERROR @@ -4685,7 +4685,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state[type].serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr1 + TBLOCK_SIZE30) != ma_addr) TEST_ERROR @@ -4707,7 +4707,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state[type].serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr2 + TBLOCK_SIZE50) != ma_addr) TEST_ERROR @@ -4743,8 +4743,8 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Verify that the allocated block is aligned */ if (saddr1 % alignment) TEST_ERROR - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if(sdata_addr != (saddr1 + TBLOCK_SIZE30)) TEST_ERROR @@ -4776,7 +4776,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state[type].serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr3 + TBLOCK_SIZE80) != ma_addr) TEST_ERROR @@ -5024,7 +5024,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state[type].serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr1 + TBLOCK_SIZE30) != ma_addr) TEST_ERROR @@ -5046,7 +5046,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state[type].serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr2 + TBLOCK_SIZE50) != ma_addr) TEST_ERROR @@ -5081,7 +5081,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state[stype].serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if(sdata_addr != (saddr1+TBLOCK_SIZE30)) TEST_ERROR /* calculate fragment for alignment of block 50 in sdata_aggr */ @@ -5102,7 +5102,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state[stype].serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if(sdata_addr != (saddr2 + TBLOCK_SIZE50)) TEST_ERROR /* calculate fragment for alignment of block 80 in sdata_aggr */ @@ -5123,7 +5123,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state[stype].serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if ((saddr3 + TBLOCK_SIZE80) != sdata_addr) TEST_ERROR @@ -5157,7 +5157,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state[type].serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr3 + TBLOCK_SIZE1034) != ma_addr) TEST_ERROR @@ -5329,7 +5329,7 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state.serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); saved_ma_size = ma_size; if((addr1+TBLOCK_SIZE30) != ma_addr) TEST_ERROR @@ -5351,7 +5351,7 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state.serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr2 + TBLOCK_SIZE2058) != ma_addr) TEST_ERROR @@ -5532,7 +5532,7 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Verify that the allocated block is aligned */ if(addr1 % alignment) TEST_ERROR - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if((addr1 + TBLOCK_SIZE30) != ma_addr) TEST_ERROR @@ -5563,7 +5563,7 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state[stype].serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if((saddr1+TBLOCK_SIZE30) != sdata_addr) TEST_ERROR /* calculate fragment for alignment of block 2058 from meta_aggr */ @@ -5596,12 +5596,12 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) } /* nothing is changed in meta_aggr */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if (new_ma_addr != ma_addr || new_ma_size != ma_size) TEST_ERROR /* nothing is changed in sdata_aggr */ - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &new_sdata_addr, &new_sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &new_sdata_addr, &new_sdata_size); if (new_sdata_addr != sdata_addr || new_sdata_size != sdata_size) TEST_ERROR @@ -5804,7 +5804,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state[type].serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr1+TBLOCK_SIZE30) != ma_addr) TEST_ERROR @@ -5827,7 +5827,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state[stype].serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if (sdata_addr != (saddr1+TBLOCK_SIZE30)) TEST_ERROR /* calculate fragment for alignment of block 50 in sdata_aggr */ @@ -5848,7 +5848,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state[stype].serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if (sdata_addr != (saddr2+TBLOCK_SIZE50)) TEST_ERROR /* calculate fragment for alignment of block 80 in sdata_aggr */ @@ -5869,7 +5869,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state[stype].serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if (sdata_addr != (saddr3+TBLOCK_SIZE80)) TEST_ERROR /* calculate fragment for alignment of block 2058 */ @@ -5891,8 +5891,8 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) state[type].serial_sect_count += 1; } - H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if (new_ma_addr != ma_addr && new_ma_size != ma_size) TEST_ERROR @@ -6815,7 +6815,7 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR - H5MF_alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); + H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); /* Verify that H5FD_MEM_SUPER free-space manager is there */ if(!H5F_addr_defined(f->shared->fs_addr[tt])) @@ -6996,7 +6996,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR - H5MF_alloc_to_fs_type(f, type, TBLOCK_SIZE4, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE4, (H5F_mem_page_t *)&fs_type); /* Verify that the H5FD_MEM_SUPER free-space manager is not there */ if(H5F_addr_defined(f->shared->fs_addr[fs_type])) @@ -7208,7 +7208,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR - H5MF_alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); + H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5I_object(file))) @@ -7359,7 +7359,7 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE6))) FAIL_STACK_ERROR - H5MF_alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); + H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); /* For paged aggregation, the section in the page at EOF for small meta fs is not shrunk away */ if(fs_type == H5F_FSPACE_STRATEGY_PAGE) { @@ -7671,7 +7671,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if(!fs_persist) { - H5MF_alloc_to_fs_type(f, H5FD_MEM_OHDR, TBLOCK_SIZE1034, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_OHDR, TBLOCK_SIZE1034, (H5F_mem_page_t *)&fs_type); /* Verify that the freed block with addr2 is found from the small meta data manager */ if(H5MF__find_sect(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE1034, f->shared->fs_man[fs_type], &found_addr) < 0) @@ -7704,7 +7704,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if(!fs_persist) { - H5MF_alloc_to_fs_type(f, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); /* Verify that the freed block with gaddr1 is found from the large data manager */ if(H5MF__find_sect(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE8192, f->shared->fs_man[fs_type], &found_addr) < 0) @@ -7731,12 +7731,12 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Verify that the large generic manager is there */ - H5MF_alloc_to_fs_type(f, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) TEST_ERROR /* Verify that the small meta data manager is there */ - H5MF_alloc_to_fs_type(f, H5FD_MEM_OHDR, f->shared->fs_page_size - 1, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_OHDR, f->shared->fs_page_size - 1, (H5F_mem_page_t *)&fs_type); if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) TEST_ERROR @@ -7777,7 +7777,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if(found_addr != saddr1) TEST_ERROR - H5MF_alloc_to_fs_type(f, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); if(!(f->shared->fs_man[fs_type])) /* Set up to use the large data manager */ -- cgit v0.12 From 18fe60ae10b4b5abb6992e7b9b2ae7b22dfa9156 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Thu, 31 May 2018 11:45:20 -0500 Subject: (1) Made the change according to the pull request feedback. (2) Removed the performance test form test/th5o.c: will decide on what needs to be done to show speedup via HDFFV-10463. --- fortran/src/H5Gf.c | 3 +- test/th5o.c | 202 +---------------------------------------------------- 2 files changed, 2 insertions(+), 203 deletions(-) diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c index 4ce7970..def67e1 100644 --- a/fortran/src/H5Gf.c +++ b/fortran/src/H5Gf.c @@ -200,8 +200,7 @@ h5gget_obj_info_idx_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, /* Query the object's information */ if(H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, c_obj_name, c_obj_namelen, H5P_DEFAULT) < 0) goto DONE; - /* TO DO: See flags for H5Oget_info in H5Opublic.h */ - if(H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, &oinfo, 0, H5P_DEFAULT) < 0) + if(H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, c_idx, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) goto DONE; /* XXX: Switch from using H5Gget_objtype_by_idx() means that this routine won't diff --git a/test/th5o.c b/test/th5o.c index eeef373..63fee5f 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -30,10 +30,6 @@ #define TEST6_DIM1 100 #define TEST6_DIM2 100 -#define NUM_GROUPS 100 -#define NUM_ATTRS 10 -#define NUM_DSETS 50 - /**************************************************************** ** @@ -1353,6 +1349,7 @@ test_h5o_getinfo_same_file(void) } /* test_h5o_getinfo_same_file() */ #ifndef H5_NO_DEPRECATED_SYMBOLS + /**************************************************************** ** ** visit_obj_cb(): @@ -1480,202 +1477,6 @@ test_h5o_getinfo_visit(void) } /* test_h5o_getinfo_visit() */ - -/**************************************************************** -** -** perform_visit_obj_cb(): -** This is the callback function invoked by H5Ovisit1 and -** H5Ovisit2() used in test_h5o_perform_getinfo_visit(). -** -****************************************************************/ -static int -perform_visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, - const H5O_info_t H5_ATTR_UNUSED *oinfo, void H5_ATTR_UNUSED *_op_data) -{ - return(H5_ITER_CONT); -} /* end visit_obj_cb() */ - -/**************************************************************** -** -** test_h5o_perform_getinfo_visit(): -** Verify that H5Ovisit2 performs better than H5Ovisit1: -** --H5Ovisit2 has fields = 0 passed to the internal -** library routine H5O_get_info() -** --H5Ovisit1 has fields = H5O_INFO_ALL passed to -** internal library routine H5O_get_info() -** 1) Create an HDF5 file -** 2) Create a group with NUM_GROUPS sub-groups -** 3) Attach NUM_ATTRS attributes to each sub-group -** 4) Create NUM_DSETS datasets for each sub-group -** 5) Visit all the objects from the root group via -** H5Ovisit1 and H5Ovisit2 -** 6) Verify the iteration time used for H5Ovisit2 is -** less than H5Ovisit1 -** -****************************************************************/ -static void -test_h5o_perform_getinfo_visit(void) -{ - hid_t fid = -1; /* HDF5 File ID */ - hid_t fapl = -1; /* File access property list */ - hid_t gid = -1; /* Group IDs */ - hid_t asid = -1; /* Dataspace ID for the attribute */ - unsigned i, j; /* Local index variable */ - struct timeval startTime; /* Starting time */ - struct timeval endTime; /* Ending time */ - time_t new_runtime = 0.0; /* Time used for H5Oget_info2 */ - time_t old_runtime = 0.0; /* time used for H5Oget_info1 */ - hid_t dcpl = -1; /* Dataset creation property list */ - hid_t sid = -1; /* Dataspace ID for dataset */ - hid_t did = -1; /* Dataset ID */ - hsize_t dims[2]; /* Dimension sizes */ - hsize_t max_dims[2]; /* Maximum dimension sizes */ - hsize_t chunk_dims[2]; /* Chunk dimension sizes */ - unsigned wbuf[10][30]; /* Data buffer */ - herr_t ret; /* Value returned from API calls */ - - fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(fapl, FAIL, "H5Pcreate"); - ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); - CHECK(ret, FAIL, "H5Pset_libver_bounds"); - - /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - CHECK(fid, FAIL, "H5Fcreate"); - - /* Create dataspace for the attribute */ - asid = H5Screate(H5S_SCALAR); - CHECK(asid, FAIL, "H5Screate"); - - /* Set up to create a chunked dataset in the group: this will use v2 B-tree chunk indexing */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - chunk_dims[0] = chunk_dims[1] = 10; - H5Pset_chunk(dcpl, 2, chunk_dims); - dims[0] = 10; - dims[1] = 30; - max_dims[0] = max_dims[1] = H5S_UNLIMITED; - sid = H5Screate_simple(2, dims, max_dims); - - /* Initialize write buffer */ - for(i=0; i Date: Thu, 31 May 2018 13:17:18 -0700 Subject: Changed 'deprecated' to indicate 'no longer supported' in the --enable-debug/production configure flags. --- configure.ac | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index c68caab..1de69c8 100644 --- a/configure.ac +++ b/configure.ac @@ -1954,12 +1954,12 @@ AC_DEFINE_UNQUOTED([PRINTF_LL_WIDTH], ["$hdf5_cv_printf_ll"], ## around to help people migrate to 1.10.x and newer versions. ## AC_ARG_ENABLE([debug], - [AS_HELP_STRING([--enable-debug], [DEPRECATED: use --enable-build-mode=debug])], - [AC_MSG_ERROR([--enable-debug is deprecated, use --enable-build-mode=debug instead.])]) + [AS_HELP_STRING([--enable-debug], [OPTION CHANGE: use --enable-build-mode=debug])], + [AC_MSG_ERROR([--enable-debug is no longer supported, use --enable-build-mode=debug instead.])]) AC_ARG_ENABLE([production], - [AS_HELP_STRING([--enable-production], [DEPRECATED: use --enable-build-mode=production])], - [AC_MSG_ERROR([--enable-production is deprecated, use --enable-build-mode=production instead.])]) + [AS_HELP_STRING([--enable-production], [OPTION CHANGE: use --enable-build-mode=production])], + [AC_MSG_ERROR([--enable-production is no longer supported, use --enable-build-mode=production instead.])]) ## ---------------------------------------------------------------------- -- cgit v0.12 From 931bd3aa6a7aa742d3a302b49eb20233b021f1bf Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 31 May 2018 14:08:48 -0700 Subject: Added a RELASE.txt entry for HDFFV-10505. --- release_docs/RELEASE.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 0a1b892..48fbef0 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -154,6 +154,19 @@ Bug Fixes since HDF5-1.10.2 release (ADB 2018/05/08) + - The --enable-debug/production configure flags are listed as 'deprecated' + when they should really be listed as 'removed'. + + In the autotools overhaul several years ago, we removed these flags and + implemented a new --enable-build-mode= flag. This was done because we + changed the semantics of the modes and didn't want users to silently + be exposed to them. The newer system is also more flexible and us to + add other modes (like 'clean'). + + The --enable-debug/production flags are now listed as removed. + + (DER - 2018/05/31, HDFFV-10505) + Performance ------------- - -- cgit v0.12 From b28815c20554f7cd35ec820e1e5ba97624ff8e88 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 31 May 2018 16:09:48 -0500 Subject: H5O_info fixes for java and examples --- examples/h5_attribute.c | 2 +- java/src/hdf/hdf5lib/H5.java | 148 ++++++++++++++++++++++++++++++-- java/src/hdf/hdf5lib/HDF5Constants.java | 18 ++++ java/src/jni/h5Constants.c | 12 +++ java/src/jni/h5oImp.c | 30 +++---- java/src/jni/h5oImp.h | 20 ++--- java/src/jni/h5util.c | 6 +- java/test/TestH5Oparams.java | 16 ++-- 8 files changed, 210 insertions(+), 42 deletions(-) diff --git a/examples/h5_attribute.c b/examples/h5_attribute.c index 335f9c2..e3b5759 100644 --- a/examples/h5_attribute.c +++ b/examples/h5_attribute.c @@ -189,7 +189,7 @@ main (void) /* * Find string attribute by iterating through all attributes */ - ret = H5Oget_info(dataset, &oinfo); + ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_ALL); for(i = 0; i < (unsigned)oinfo.num_attrs; i++) { attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)i, H5P_DEFAULT, H5P_DEFAULT); atype = H5Aget_type(attr); diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 62cfb6d..f826fbc 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -4287,7 +4287,27 @@ public class H5 implements java.io.Serializable { * @exception NullPointerException * - name is null. **/ - public synchronized static native H5O_info_t H5Oget_info(long loc_id) throws HDF5LibraryException, + public static H5O_info_t H5Oget_info(long loc_id) throws HDF5LibraryException, + NullPointerException { + return H5Oget_info(loc_id, HDF5Constants.H5O_INFO_ALL); + } + + /** + * H5Oget_info retrieves the metadata for an object specified by an identifier. + * + * @param loc_id + * IN: Identifier for target object + * @param fields + * IN: Object fields to select + * + * @return object information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native H5O_info_t H5Oget_info(long loc_id, int fields) throws HDF5LibraryException, NullPointerException; /** @@ -4314,8 +4334,62 @@ public class H5 implements java.io.Serializable { * @exception NullPointerException * - name is null. **/ + public static H5O_info_t H5Oget_info_by_idx(long loc_id, String group_name, int idx_type, + int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException { + return H5Oget_info_by_idx(loc_id, group_name, idx_type, order, n, HDF5Constants.H5O_INFO_ALL, lapl_id); + } + + /** + * H5Oget_info_by_idx retrieves the metadata for an object, identifying the object by an index position. + * + * @param loc_id + * IN: File or group identifier + * @param group_name + * IN: Name of group, relative to loc_id, in which object is located + * @param idx_type + * IN: Type of index by which objects are ordered + * @param order + * IN: Order of iteration within index + * @param n + * IN: Object to open + * @param fields + * IN: Object fields to select + * @param lapl_id + * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as + * H5P_DEFAULT.) + * + * @return object information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ public synchronized static native H5O_info_t H5Oget_info_by_idx(long loc_id, String group_name, int idx_type, - int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + int order, long n, int fields, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Oget_info_by_name retrieves the metadata for an object, identifying the object by location and relative name. + * + * @param loc_id + * IN: File or group identifier specifying location of group in which object is located + * @param name + * IN: Relative name of group + * @param lapl_id + * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as + * H5P_DEFAULT.) + * + * @return object information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static H5O_info_t H5Oget_info_by_name(long loc_id, String name, long lapl_id) + throws HDF5LibraryException, NullPointerException { + return H5Oget_info_by_name(loc_id, name, HDF5Constants.H5O_INFO_ALL, lapl_id); + } /** * H5Oget_info_by_name retrieves the metadata for an object, identifying the object by location and relative name. @@ -4324,6 +4398,8 @@ public class H5 implements java.io.Serializable { * IN: File or group identifier specifying location of group in which object is located * @param name * IN: Relative name of group + * @param fields + * IN: Object fields to select * @param lapl_id * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as * H5P_DEFAULT.) @@ -4335,7 +4411,7 @@ public class H5 implements java.io.Serializable { * @exception NullPointerException * - name is null. **/ - public synchronized static native H5O_info_t H5Oget_info_by_name(long loc_id, String name, long lapl_id) + public synchronized static native H5O_info_t H5Oget_info_by_name(long loc_id, String name, int fields, long lapl_id) throws HDF5LibraryException, NullPointerException; /** @@ -4412,8 +4488,68 @@ public class H5 implements java.io.Serializable { * @exception NullPointerException * - name is null. **/ + public static int H5Ovisit(long obj_id, int idx_type, int order, H5O_iterate_cb op, H5O_iterate_t op_data) + throws HDF5LibraryException, NullPointerException { + return H5Ovisit(obj_id, idx_type, order, op, op_data, HDF5Constants.H5O_INFO_ALL); + } + + /** + * H5Ovisit recursively visits all objects accessible from a specified object. + * + * @param obj_id + * IN: Identifier of the object at which the recursive iteration begins. + * @param idx_type + * IN: Type of index + * @param order + * IN: Order of iteration within index + * @param op + * IN: Callback function passing data regarding the object to the calling application + * @param op_data + * IN: User-defined pointer to data required by the application for its processing of the object + * @param fields + * IN: Object fields to select + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ public synchronized static native int H5Ovisit(long obj_id, int idx_type, int order, H5O_iterate_cb op, - H5O_iterate_t op_data) throws HDF5LibraryException, NullPointerException; + H5O_iterate_t op_data, int fields) throws HDF5LibraryException, NullPointerException; + + /** + * H5Ovisit_by_name recursively visits all objects starting from a specified object. + * + * @param loc_id + * IN: File or group identifier + * @param obj_name + * IN: Relative path to the object + * @param idx_type + * IN: Type of index + * @param order + * IN: Order of iteration within index + * @param op + * IN: Callback function passing data regarding the object to the calling application + * @param op_data + * IN: User-defined pointer to data required by the application for its processing of the object + * @param lapl_id + * IN: Link access property list identifier + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static int H5Ovisit_by_name(long loc_id, String obj_name, int idx_type, int order, + H5O_iterate_cb op, H5O_iterate_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException { + return H5Ovisit_by_name(loc_id, obj_name, idx_type, order, op, op_data, HDF5Constants.H5O_INFO_ALL, lapl_id); + } /** * H5Ovisit_by_name recursively visits all objects starting from a specified object. @@ -4430,6 +4566,8 @@ public class H5 implements java.io.Serializable { * IN: Callback function passing data regarding the object to the calling application * @param op_data * IN: User-defined pointer to data required by the application for its processing of the object + * @param fields + * IN: Object fields to select * @param lapl_id * IN: Link access property list identifier * @@ -4442,7 +4580,7 @@ public class H5 implements java.io.Serializable { * - name is null. **/ public synchronized static native int H5Ovisit_by_name(long loc_id, String obj_name, int idx_type, int order, - H5O_iterate_cb op, H5O_iterate_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException; + H5O_iterate_cb op, H5O_iterate_t op_data, int fields, long lapl_id) throws HDF5LibraryException, NullPointerException; /** diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index eb4055d..43109f2 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -330,6 +330,12 @@ public class HDF5Constants { public static final int H5O_COPY_EXPAND_REFERENCE_FLAG = H5O_COPY_EXPAND_REFERENCE_FLAG(); public static final int H5O_COPY_WITHOUT_ATTR_FLAG = H5O_COPY_WITHOUT_ATTR_FLAG(); public static final int H5O_COPY_PRESERVE_NULL_FLAG = H5O_COPY_PRESERVE_NULL_FLAG(); + public static final int H5O_INFO_BASIC = H5O_INFO_BASIC(); + public static final int H5O_INFO_TIME = H5O_INFO_TIME(); + public static final int H5O_INFO_NUM_ATTRS = H5O_INFO_NUM_ATTRS(); + public static final int H5O_INFO_HDR = H5O_INFO_HDR(); + public static final int H5O_INFO_META_SIZE = H5O_INFO_META_SIZE(); + public static final int H5O_INFO_ALL = H5O_INFO_ALL(); public static final int H5O_SHMESG_NONE_FLAG = H5O_SHMESG_NONE_FLAG(); public static final int H5O_SHMESG_SDSPACE_FLAG = H5O_SHMESG_SDSPACE_FLAG(); public static final int H5O_SHMESG_DTYPE_FLAG = H5O_SHMESG_DTYPE_FLAG(); @@ -1239,6 +1245,18 @@ public class HDF5Constants { private static native final int H5O_COPY_PRESERVE_NULL_FLAG(); + private static native final int H5O_INFO_BASIC(); + + private static native final int H5O_INFO_TIME(); + + private static native final int H5O_INFO_NUM_ATTRS(); + + private static native final int H5O_INFO_HDR(); + + private static native final int H5O_INFO_META_SIZE(); + + private static native final int H5O_INFO_ALL(); + private static native final int H5O_SHMESG_NONE_FLAG(); private static native final int H5O_SHMESG_SDSPACE_FLAG(); diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 900316e..0f4361f 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -643,6 +643,18 @@ Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1WITHOUT_1ATTR_1FLAG(JNIEnv *env, jclas JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1PRESERVE_1NULL_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_PRESERVE_NULL_FLAG; } JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1BASIC(JNIEnv *env, jclass cls) { return H5O_INFO_BASIC; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1TIME(JNIEnv *env, jclass cls) { return H5O_INFO_TIME; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1NUM_1ATTRS(JNIEnv *env, jclass cls) { return H5O_INFO_NUM_ATTRS; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1HDR(JNIEnv *env, jclass cls) { return H5O_INFO_HDR; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1META_1SIZE(JNIEnv *env, jclass cls) { return H5O_INFO_META_SIZE; } +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1ALL(JNIEnv *env, jclass cls) { return H5O_INFO_ALL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1NONE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_NONE_FLAG; } JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1SDSPACE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_SDSPACE_FLAG; } diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c index e8abead..d9276da 100644 --- a/java/src/jni/h5oImp.c +++ b/java/src/jni/h5oImp.c @@ -105,11 +105,11 @@ Java_hdf_hdf5lib_H5_H5Ocopy /* * Class: hdf_hdf5lib_H5 * Method: H5Oget_info - * Signature: (J)Lhdf/hdf5lib/structs/H5O_info_t; + * Signature: (JI)Lhdf/hdf5lib/structs/H5O_info_t; */ JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info - (JNIEnv *env, jclass clss, jlong loc_id) + (JNIEnv *env, jclass clss, jlong loc_id, jint fields) { herr_t status = -1; H5O_info_t infobuf; @@ -119,7 +119,7 @@ Java_hdf_hdf5lib_H5_H5Oget_1info jobject ihinfobuf2; jobject ret_obj = NULL; - status = H5Oget_info((hid_t)loc_id, &infobuf); + status = H5Oget_info2((hid_t)loc_id, &infobuf, (unsigned)fields); if (status < 0) { h5libraryError(env); @@ -168,11 +168,11 @@ Java_hdf_hdf5lib_H5_H5Oget_1info /* * Class: hdf_hdf5lib_H5 * Method: H5Oget_info_by_name - * Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5O_info_t; + * Signature: (JLjava/lang/String;IJ)Lhdf/hdf5lib/structs/H5O_info_t; */ JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name - (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id) + (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint fields, jlong access_id) { const char *lName; herr_t status = -1; @@ -185,7 +185,7 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Oget_info_by_name((hid_t)loc_id, lName, &infobuf, (hid_t)access_id); + status = H5Oget_info_by_name2((hid_t)loc_id, lName, &infobuf, (unsigned)fields, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); @@ -237,12 +237,12 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name /* * Class: hdf_hdf5lib_H5 * Method: H5Oget_info_by_idx - * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5O_info_t; + * Signature: (JLjava/lang/String;IIJIJ)Lhdf/hdf5lib/structs/H5O_info_t; */ JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx (JNIEnv *env, jclass clss, jlong loc_id, - jstring name, jint index_field, jint order, jlong link_n, jlong access_id) + jstring name, jint index_field, jint order, jlong link_n, jint fields, jlong access_id) { const char *lName; herr_t status; @@ -255,7 +255,7 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Oget_info_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id); + status = H5Oget_info_by_idx2((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (unsigned)fields, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); @@ -423,12 +423,12 @@ H5O_iterate_cb /* * Class: hdf_hdf5lib_H5 * Method: H5Ovisit - * Signature: (JIILjava/lang/Object;Ljava/lang/Object;)I + * Signature: (JIILjava/lang/Object;Ljava/lang/Object;I)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Ovisit (JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order, - jobject callback_op, jobject op_data) + jobject callback_op, jobject op_data, jint fields) { herr_t status = -1; @@ -442,7 +442,7 @@ Java_hdf_hdf5lib_H5_H5Ovisit h5nullArgument(env, "H5Ovisit: callback_op is NULL"); } /* end if */ else { - status = H5Ovisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data); + status = H5Ovisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (unsigned)fields); if (status < 0) h5libraryError(env); @@ -454,12 +454,12 @@ Java_hdf_hdf5lib_H5_H5Ovisit /* * Class: hdf_hdf5lib_H5 * Method: H5Ovisit_by_name - * Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;J)I + * Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;IJ)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name (JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order, - jobject callback_op, jobject op_data, jlong access_id) + jobject callback_op, jobject op_data, jint fields, jlong access_id) { herr_t status = -1; const char *lName; @@ -478,7 +478,7 @@ Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name else { PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Ovisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (hid_t)access_id); + status = H5Ovisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (unsigned)fields, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); diff --git a/java/src/jni/h5oImp.h b/java/src/jni/h5oImp.h index 224f298..cb8c776 100644 --- a/java/src/jni/h5oImp.h +++ b/java/src/jni/h5oImp.h @@ -52,29 +52,29 @@ Java_hdf_hdf5lib_H5_H5Ocopy /* * Class: hdf_hdf5lib_H5 * Method: H5Oget_info - * Signature: (J)Lhdf/hdf5lib/structs/H5O_info_t; + * Signature: (JI)Lhdf/hdf5lib/structs/H5O_info_t; */ JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info -(JNIEnv*, jclass, jlong); +(JNIEnv*, jclass, jlong, jint fields); /* * Class: hdf_hdf5lib_H5 * Method: H5Oget_info_by_name - * Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5O_info_t; + * Signature: (JLjava/lang/String;IJ)Lhdf/hdf5lib/structs/H5O_info_t; */ JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name -(JNIEnv*, jclass, jlong, jstring, jlong); +(JNIEnv*, jclass, jlong, jstring, jint fields, jlong); /* * Class: hdf_hdf5lib_H5 * Method: H5Oget_info_by_idx - * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5O_info_t; + * Signature: (JLjava/lang/String;IIJIJ)Lhdf/hdf5lib/structs/H5O_info_t; */ JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx -(JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong); +(JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jint fields, jlong); /* * Class: hdf_hdf5lib_H5 @@ -88,20 +88,20 @@ Java_hdf_hdf5lib_H5_H5Olink /* * Class: hdf_hdf5lib_H5 * Method: H5Ovisit - * Signature: (JIILjava/lang/Object;Ljava/lang/Object;)I + * Signature: (JIILjava/lang/Object;Ljava/lang/Object;I)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Ovisit - (JNIEnv*, jclass, jlong, jint, jint, jobject, jobject); + (JNIEnv*, jclass, jlong, jint, jint, jobject, jobject, jint); /* * Class: hdf_hdf5lib_H5 * Method: H5Ovisit_by_name - * Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;J)I + * Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;IJ)I */ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name - (JNIEnv*, jclass, jlong, jstring, jint, jint, jobject, jobject, jlong); + (JNIEnv*, jclass, jlong, jstring, jint, jint, jobject, jobject, jint, jlong); /* * Class: hdf_hdf5lib_H5 diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index fdabd76..9a98202 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -425,7 +425,7 @@ h5str_sprintf this_str = (char*)HDmalloc(64); obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, ptr); - H5Oget_info(obj, &oi); + H5Oget_info2(obj, &oi, H5O_INFO_ALL); /* Print object data and close object */ sprintf(this_str, "%u-%lu", (unsigned) oi.type, oi.addr); @@ -2552,7 +2552,7 @@ obj_info_all info_all_t *datainfo = (info_all_t*)op_data; H5O_info_t object_info; - retVal = H5Oget_info_by_name(loc_id, name, &object_info, H5P_DEFAULT); + retVal = H5Oget_info_by_name2(loc_id, name, &object_info, H5O_INFO_ALL, H5P_DEFAULT); if (retVal < 0) { *(datainfo->otype+datainfo->count) = -1; @@ -2591,7 +2591,7 @@ obj_info_max info_all_t *datainfo = (info_all_t*)op_data; H5O_info_t object_info; - retVal = H5Oget_info(loc_id, &object_info); + retVal = H5Oget_info2(loc_id, &object_info, H5O_INFO_ALL); if (retVal < 0) { *(datainfo->otype+datainfo->count) = -1; *(datainfo->ltype+datainfo->count) = -1; diff --git a/java/test/TestH5Oparams.java b/java/test/TestH5Oparams.java index 2af190f..8b3c673 100644 --- a/java/test/TestH5Oparams.java +++ b/java/test/TestH5Oparams.java @@ -71,27 +71,27 @@ public class TestH5Oparams { @Test(expected = HDF5LibraryException.class) public void testH5Oget_info_invalid() throws Throwable { - H5.H5Oget_info(-1); + H5.H5Oget_info(-1, 0); } @Test(expected = NullPointerException.class) public void testH5Oget_info_by_name_null() throws Throwable { - H5.H5Oget_info_by_name(-1, null, HDF5Constants.H5P_DEFAULT); + H5.H5Oget_info_by_name(-1, null, 0, HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) public void testH5Oget_info_by_name_invalid() throws Throwable { - H5.H5Oget_info_by_name(-1, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT); + H5.H5Oget_info_by_name(-1, "/testH5Gcreate", 0, HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) public void testH5Oget_info_by_idx_invalid() throws Throwable { - H5.H5Oget_info_by_idx(-1, "Bogus", -1, -1, -1L, -1); + H5.H5Oget_info_by_idx(-1, "Bogus", -1, -1, -1L, 0, -1); } @Test(expected = NullPointerException.class) public void testH5Oget_info_by_idx_null() throws Throwable { - H5.H5Oget_info_by_idx(-1, null, 0, 0, 0L, 0); + H5.H5Oget_info_by_idx(-1, null, 0, 0, 0L, 0, 0); } @Test(expected = HDF5LibraryException.class) @@ -106,17 +106,17 @@ public class TestH5Oparams { @Test(expected = NullPointerException.class) public void testH5Ovisit_null() throws Throwable { - H5.H5Ovisit(-1, -1, -1, null, null); + H5.H5Ovisit(-1, -1, -1, null, null, 0); } @Test(expected = NullPointerException.class) public void testH5Ovisit_by_name_nullname() throws Throwable { - H5.H5Ovisit_by_name(-1, null, -1, -1, null, null, -1); + H5.H5Ovisit_by_name(-1, null, -1, -1, null, null, 0, -1); } @Test(expected = NullPointerException.class) public void testH5Ovisit_by_name_null() throws Throwable { - H5.H5Ovisit_by_name(-1, "Bogus", -1, -1, null, null, -1); + H5.H5Ovisit_by_name(-1, "Bogus", -1, -1, null, null, 0, -1); } @Test(expected = HDF5LibraryException.class) -- cgit v0.12 From 7a5fa418e3edf1f85f3e1462a119c3f5aa41a3d1 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Thu, 31 May 2018 19:05:58 -0500 Subject: Fix the error found after earlier checkin. --- fortran/src/H5Of.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fortran/src/H5Of.c b/fortran/src/H5Of.c index 1c32861..45b7f09 100644 --- a/fortran/src/H5Of.c +++ b/fortran/src/H5Of.c @@ -248,9 +248,9 @@ h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, herr_t func_ret_value; /* H5Linterate return value */ /* - * Call H5Ovisit + * Call H5Ovisit2 */ - func_ret_value = H5Ovisit( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, op, op_data, H5O_INFO_ALL); + func_ret_value = H5Ovisit2( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, op, op_data, H5O_INFO_ALL); ret_value = (int_f)func_ret_value; -- cgit v0.12 From 1a018cb3340ec8ecd4ded25ec719ac831aa165bd Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 1 Jun 2018 09:33:51 -0500 Subject: Fix jni function call version --- java/src/jni/h5oImp.c | 4 ++-- java/src/jni/h5pImp.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c index d9276da..7665c70 100644 --- a/java/src/jni/h5oImp.c +++ b/java/src/jni/h5oImp.c @@ -442,7 +442,7 @@ Java_hdf_hdf5lib_H5_H5Ovisit h5nullArgument(env, "H5Ovisit: callback_op is NULL"); } /* end if */ else { - status = H5Ovisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (unsigned)fields); + status = H5Ovisit2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (unsigned)fields); if (status < 0) h5libraryError(env); @@ -478,7 +478,7 @@ Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name else { PIN_JAVA_STRING(name, lName); if (lName != NULL) { - status = H5Ovisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (unsigned)fields, (hid_t)access_id); + status = H5Ovisit_by_name2((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (unsigned)fields, (hid_t)access_id); UNPIN_JAVA_STRING(name, lName); diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index 49cfeb9..3ff7436 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -5204,10 +5204,10 @@ Java_hdf_hdf5lib_H5_H5Pset_1append_1flush visit_callback = callback_op; if (op_data == NULL) { - h5nullArgument(env, "H5Ovisit: op_data is NULL"); + h5nullArgument(env, "H5Pset_append_flush: op_data is NULL"); } /* end if */ else if (callback_op == NULL) { - h5nullArgument(env, "H5Ovisit: callback_op is NULL"); + h5nullArgument(env, "H5Pset_append_flush: callback_op is NULL"); } /* end if */ else { status = H5Pset_append_flush((hid_t)plist_id, (unsigned)ndims, (const hsize_t*)boundary, (H5D_append_cb_t)H5D_append_cb, (void*)op_data); -- cgit v0.12 From f5b0b1c60784a3dbfea6cdf6082106fc8bed0462 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 1 Jun 2018 10:09:44 -0500 Subject: Fix usage of compression lib in shared tests --- test/CMakeLists.txt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a2ade92..517a620 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -200,7 +200,7 @@ set (H5_TESTS cmpd_dset filter_fail extend - direct_chunk + direct_chunk # compression lib link external efc objcopy @@ -252,6 +252,7 @@ macro (ADD_H5_EXE file) endmacro () set (H5_TESTS_MULTIPLE + direct_chunk testhdf5 cache_image ttsafe @@ -266,7 +267,23 @@ endforeach () ############################################################################## ### M U L T I P L E S O U R C E T E S T S ### ############################################################################## +######### Also special handling of link libs ############# +#-- Adding test for direct_chunk +add_executable (direct_chunk ${HDF5_TEST_SOURCE_DIR}/direct_chunk.c) +target_include_directories(direct_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +TARGET_C_PROPERTIES (direct_chunk STATIC) +target_link_libraries (direct_chunk PRIVATE ${HDF5_TEST_LIB_TARGET} ${LINK_COMP_LIBS}) +set_target_properties (direct_chunk PROPERTIES FOLDER test) +if (BUILD_SHARED_LIBS) + add_executable (direct_chunk-shared ${HDF5_TEST_SOURCE_DIR}/direct_chunk.c) + target_include_directories(direct_chunk-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (direct_chunk-shared SHARED) + target_link_libraries (direct_chunk-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${LINK_COMP_LIBS}) + set_target_properties (direct_chunk-shared PROPERTIES FOLDER test) +endif () + +######### Special handling for multiple sources ############# #-- Adding test for testhdf5 add_executable (testhdf5 ${testhdf5_SOURCES}) target_include_directories(testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -- cgit v0.12 From 512f1cac54ee3cdb5c415b1e96b47323aae1e793 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 1 Jun 2018 08:43:13 -0700 Subject: Fixed MANIFEST --- MANIFEST | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MANIFEST b/MANIFEST index 086e8f1..9ab179f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -941,6 +941,7 @@ ./test/cross_read.c ./test/dangle.c ./test/deflate.h5 +./test/direct_chunk.c ./test/dsets.c ./test/dt_arith.c ./test/dtypes.c @@ -2589,6 +2590,7 @@ ./tools/test/perform/build_h5perf_alone.sh ./tools/test/perform/build_h5perf_serial_alone.sh ./tools/test/perform/chunk.c +./tools/test/perform/direct_write_perf.c ./tools/test/perform/gen_report.pl ./tools/test/perform/iopipe.c ./tools/test/perform/overhead.c @@ -2666,7 +2668,6 @@ ./hl/test/COPYING ./hl/test/H5srcdir_str.h.in ./hl/test/Makefile.am -./hl/test/dectris_hl_perf.c ./hl/test/dsdata.txt ./hl/test/dslat.txt ./hl/test/dslon.txt @@ -2685,8 +2686,8 @@ ./hl/test/test_ds_be.h5 ./hl/test/test_ds_le.h5 ./hl/test/test_dset_append.c -./hl/test/test_dset_opt.c ./hl/test/test_file_image.c +./hl/test/test_h5do_compat.c ./hl/test/test_image.c ./hl/test/test_ld.c ./hl/test/test_ld.h5 -- cgit v0.12