summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MANIFEST1
-rw-r--r--src/H5Aint.c55
-rw-r--r--src/H5Cimage.c5
-rw-r--r--src/H5Dint.c85
-rw-r--r--src/H5Dlayout.c43
-rw-r--r--src/H5F.c30
-rw-r--r--src/H5Fdeprec.c62
-rw-r--r--src/H5Fint.c78
-rw-r--r--src/H5Fpkg.h3
-rw-r--r--src/H5Fprivate.h34
-rw-r--r--src/H5Fpublic.h14
-rw-r--r--src/H5Fquery.c82
-rw-r--r--src/H5Fsuper.c101
-rw-r--r--src/H5Gobj.c21
-rw-r--r--src/H5HFhdr.c8
-rw-r--r--src/H5O.c1
-rw-r--r--src/H5Oattr.c16
-rw-r--r--src/H5Ocopy.c30
-rw-r--r--src/H5Odtype.c29
-rw-r--r--src/H5Ofill.c252
-rw-r--r--src/H5Oint.c62
-rw-r--r--src/H5Olayout.c40
-rw-r--r--src/H5Opkg.h17
-rw-r--r--src/H5Opline.c51
-rw-r--r--src/H5Oprivate.h11
-rw-r--r--src/H5Osdspace.c9
-rw-r--r--src/H5Pfapl.c185
-rw-r--r--src/H5S.c41
-rw-r--r--src/H5Sprivate.h2
-rw-r--r--src/H5T.c37
-rw-r--r--src/H5Tcommit.c29
-rw-r--r--src/H5Tprivate.h2
-rw-r--r--src/H5trace.c1045
-rw-r--r--test/CMakeTests.cmake1
-rw-r--r--test/Makefile.am2
-rw-r--r--test/dsets.c419
-rw-r--r--test/gen_bounds.c606
-rw-r--r--test/genall5.c127
-rw-r--r--test/mf.c8
-rw-r--r--test/objcopy.c199
-rw-r--r--test/ohdr.c86
-rw-r--r--test/set_extent.c31
-rw-r--r--test/testfiles/plist_files/dapl_32bebin186 -> 199 bytes
-rw-r--r--test/testfiles/plist_files/dapl_32lebin186 -> 199 bytes
-rw-r--r--test/testfiles/plist_files/dapl_64bebin186 -> 199 bytes
-rw-r--r--test/testfiles/plist_files/dapl_64lebin186 -> 199 bytes
-rw-r--r--test/testfiles/plist_files/def_dapl_32bebin181 -> 194 bytes
-rw-r--r--test/testfiles/plist_files/def_dapl_32lebin181 -> 194 bytes
-rw-r--r--test/testfiles/plist_files/def_dapl_64bebin181 -> 194 bytes
-rw-r--r--test/testfiles/plist_files/def_dapl_64lebin181 -> 194 bytes
-rw-r--r--test/testfiles/plist_files/def_fapl_32bebin1520 -> 1711 bytes
-rw-r--r--test/testfiles/plist_files/def_fapl_32lebin1520 -> 1711 bytes
-rw-r--r--test/testfiles/plist_files/def_fapl_64bebin1520 -> 1711 bytes
-rw-r--r--test/testfiles/plist_files/def_fapl_64lebin1520 -> 1711 bytes
-rw-r--r--test/testfiles/plist_files/fapl_32bebin1522 -> 1713 bytes
-rw-r--r--test/testfiles/plist_files/fapl_32lebin1522 -> 1713 bytes
-rw-r--r--test/testfiles/plist_files/fapl_64bebin1522 -> 1713 bytes
-rw-r--r--test/testfiles/plist_files/fapl_64lebin1522 -> 1713 bytes
-rw-r--r--test/testfiles/plist_files/lapl_32bebin1625 -> 1816 bytes
-rw-r--r--test/testfiles/plist_files/lapl_32lebin1625 -> 1816 bytes
-rw-r--r--test/testfiles/plist_files/lapl_64bebin1625 -> 1816 bytes
-rw-r--r--test/testfiles/plist_files/lapl_64lebin1625 -> 1816 bytes
-rw-r--r--test/tfile.c1885
-rw-r--r--test/th5o.c191
-rw-r--r--test/th5s.c146
-rw-r--r--tools/src/h5repack/h5repack.c2
-rw-r--r--tools/src/h5repack/h5repack.h30
-rw-r--r--tools/src/h5repack/h5repack_copy.c20
-rw-r--r--tools/src/h5repack/h5repack_main.c41
-rw-r--r--tools/test/h5repack/testfiles/h5repack-help.txt19
70 files changed, 5073 insertions, 1221 deletions
diff --git a/MANIFEST b/MANIFEST
index a2a78c8..8e79458 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -981,6 +981,7 @@
./test/gen_bad_ohdr.c
./test/gen_bad_compound.c
./test/gen_bogus.c
+./test/gen_bounds.c
./test/gen_cross.c
./test/gen_deflate.c
./test/gen_file_image.c
diff --git a/src/H5Aint.c b/src/H5Aint.c
index f1dd41e..55c46f6 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -102,6 +102,12 @@ static herr_t H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type
/* Package Variables */
/*********************/
+/* Format version bounds for attribute */
+const unsigned H5O_attr_ver_bounds[] = {
+ H5O_ATTR_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_ATTR_VERSION_3, /* H5F_LIBVER_V18 */
+ H5O_ATTR_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
/*****************************/
/* Library Private Variables */
@@ -209,18 +215,16 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
if(H5T_set_loc(attr->shared->dt, loc->oloc->file, H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location")
- /* Set the latest format for datatype, if requested */
- if(H5F_USE_LATEST_FLAGS(loc->oloc->file, H5F_LATEST_DATATYPE))
- if(H5T_set_latest_version(attr->shared->dt) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of datatype")
+ /* Set the version for datatype */
+ if(H5T_set_version(loc->oloc->file, attr->shared->dt) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set version of datatype")
/* Copy the dataspace for the attribute */
attr->shared->ds = H5S_copy(space, FALSE, TRUE);
- /* Set the latest format for dataspace, if requested */
- if(H5F_USE_LATEST_FLAGS(loc->oloc->file, H5F_LATEST_DATASPACE))
- if(H5S_set_latest_version(attr->shared->ds) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of dataspace")
+ /* Set the version for dataspace */
+ if(H5S_set_version(loc->oloc->file, attr->shared->ds) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set version of dataspace")
/* Copy the object header information */
if(H5O_loc_copy(&(attr->oloc), loc->oloc, H5_COPY_DEEP) < 0)
@@ -1843,11 +1847,11 @@ done:
* Function: H5A_set_version
*
* Purpose: Sets the correct version to encode attribute with.
- * Chooses the oldest version possible, unless the "use the
- * latest format" flag is set.
+ * Chooses the oldest version possible, unless the
+ * file's low bound indicates otherwise.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -1859,8 +1863,8 @@ herr_t
H5A_set_version(const H5F_t *f, H5A_t *attr)
{
hbool_t type_shared, space_shared; /* Flags to indicate that shared messages are used for this attribute */
- hbool_t use_latest_format; /* Flag indicating the latest attribute version support is enabled */
- herr_t ret_value = SUCCEED; /* Return value */
+ uint8_t version; /* Message version */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1868,9 +1872,6 @@ H5A_set_version(const H5F_t *f, H5A_t *attr)
HDassert(f);
HDassert(attr);
- /* Get the file's 'use the latest attribute version support' flag */
- use_latest_format = H5F_USE_LATEST_FLAGS(f, H5F_LATEST_ATTRIBUTE);
-
/* Check whether datatype and dataspace are shared */
if(H5O_msg_is_shared(H5O_DTYPE_ID, attr->shared->dt) > 0)
type_shared = TRUE;
@@ -1883,14 +1884,22 @@ H5A_set_version(const H5F_t *f, H5A_t *attr)
space_shared = FALSE;
/* Check which version to encode attribute with */
- if(use_latest_format)
- attr->shared->version = H5O_ATTR_VERSION_LATEST; /* Write out latest attribute version */
- else if(attr->shared->encoding != H5T_CSET_ASCII)
- attr->shared->version = H5O_ATTR_VERSION_3; /* Write version which includes the character encoding */
+ if(attr->shared->encoding != H5T_CSET_ASCII)
+ version = H5O_ATTR_VERSION_3; /* Write version which includes the character encoding */
else if(type_shared || space_shared)
- attr->shared->version = H5O_ATTR_VERSION_2; /* Write out version with flag for indicating shared datatype or dataspace */
+ version = H5O_ATTR_VERSION_2; /* Write out version with flag for indicating shared datatype or dataspace */
else
- attr->shared->version = H5O_ATTR_VERSION_1; /* Write out basic version */
+ version = H5O_ATTR_VERSION_1; /* Write out basic version */
+
+ /* Upgrade to the version indicated by the file's low bound if higher */
+ version = MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]);
+
+ /* Version bounds check */
+ if(version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(f)])
+ HGOTO_ERROR(H5E_ATTR, H5E_BADRANGE, FAIL, "attribute version out of bounds")
+
+ /* Set the message version */
+ attr->shared->version = version;
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Cimage.c b/src/H5Cimage.c
index 53d1712..be2560f 100644
--- a/src/H5Cimage.c
+++ b/src/H5Cimage.c
@@ -1382,9 +1382,12 @@ H5C__prep_image_for_file_close(H5F_t *f, hid_t dxpl_id, hbool_t *image_generated
* Note that under some error conditions, the superblock will be
* undefined in this case as well -- if so, assume that the
* superblock does not support superblock extension messages.
+ * Also verify that the file's high_bound is at least release
+ * 1.10.x, otherwise cancel the request for a cache image
*/
if((NULL == f->shared->sblock) ||
- (f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2)) {
+ (f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2) ||
+ (f->shared->high_bound < H5F_LIBVER_V110)) {
H5C_cache_image_ctl_t default_image_ctl = H5C__DEFAULT_CACHE_IMAGE_CTL;
cache_ptr->image_ctl = default_image_ctl;
diff --git a/src/H5Dint.c b/src/H5Dint.c
index bfe1497..fc191ff 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -623,10 +623,10 @@ done:
static herr_t
H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
{
- htri_t relocatable; /* Flag whether the type is relocatable */
- htri_t immutable; /* Flag whether the type is immutable */
- hbool_t use_latest_format; /* Flag indicating the 'latest datatype version support' is enabled */
- herr_t ret_value = SUCCEED; /* Return value */
+ htri_t relocatable; /* Flag whether the type is relocatable */
+ htri_t immutable; /* Flag whether the type is immutable */
+ hbool_t use_at_least_v18; /* Flag indicating to use at least v18 format versions */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -643,17 +643,17 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
if((immutable = H5T_is_immutable(type)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't check datatype?")
- /* Get the file's 'use the latest datatype version support' flag */
- use_latest_format = H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATATYPE);
+ /* To use at least v18 format versions or not */
+ use_at_least_v18 = (H5F_LOW_BOUND(file) >= H5F_LIBVER_V18);
/* Copy the datatype if it's a custom datatype or if it'll change when it's location is changed */
- if(!immutable || relocatable || use_latest_format) {
+ if(!immutable || relocatable || use_at_least_v18) {
/* Copy datatype for dataset */
if((dset->shared->type = H5T_copy(type, H5T_COPY_ALL)) == NULL)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy datatype")
- /* Convert a datatype (if committed) to a transient type if the committed datatype's file
- location is different from the file location where the dataset will be created */
+ /* Convert a datatype (if committed) to a transient type if the committed datatype's file
+ location is different from the file location where the dataset will be created */
if(H5T_convert_committed_datatype(dset->shared->type, file) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get shared datatype info")
@@ -661,14 +661,13 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
if(H5T_set_loc(dset->shared->type, file, H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't set datatype location")
- /* Set the latest format, if requested */
- if(use_latest_format)
- if(H5T_set_latest_version(dset->shared->type) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
+ /* Set the version for datatype */
+ if(H5T_set_version(file, dset->shared->type) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set version of datatype")
/* Get a datatype ID for the dataset's datatype */
- if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type")
+ if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type")
} /* end if */
/* Not a custom datatype, just use it directly */
else {
@@ -738,7 +737,6 @@ done:
static herr_t
H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
{
- hbool_t use_latest_format; /* Flag indicating the 'latest dataspace version support' is enabled */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -748,9 +746,6 @@ H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
HDassert(dset);
HDassert(space);
- /* Get the file's 'use the latest dataspace version support' flag */
- use_latest_format = H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATASPACE);
-
/* Copy dataspace for dataset */
if(NULL == (dset->shared->space = H5S_copy(space, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace")
@@ -759,10 +754,9 @@ H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
if(H5D__cache_dataspace_info(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info")
- /* Set the latest format, if requested */
- if(use_latest_format)
- if(H5S_set_latest_version(dset->shared->space) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
+ /* Set the version for dataspace */
+ if(H5S_set_version(file, dset->shared->space) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
/* Set the dataset's dataspace to 'all' selection */
if(H5S_select_all(dset->shared->space, TRUE) < 0)
@@ -794,6 +788,7 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
H5D_fill_value_t fill_status; /* Fill value status */
hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */
hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
+ hbool_t use_at_least_v18; /* Flag indicating to use at least v18 format versions */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -808,6 +803,9 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
type = dset->shared->type;
fill_prop = &dset->shared->dcpl_cache.fill;
+ /* To use at least v18 format versions or not */
+ use_at_least_v18 = (H5F_LOW_BOUND(file) >= H5F_LIBVER_V18);
+
/* Retrieve "defined" status of fill value */
if(H5P_is_fill_value_defined(fill_prop, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
@@ -886,8 +884,8 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update new fill value header message")
/* If there is valid information for the old fill value struct, add it */
- /* (only if we aren't trying to write the 'latest fill message version support') */
- if(fill_prop->buf && !(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG))) {
+ /* (only if we aren't using v18 format versions and above */
+ if(fill_prop->buf && !use_at_least_v18) {
H5O_fill_t old_fill_prop; /* Copy of fill value property, for writing as "old" fill value */
/* Shallow copy the fill value property */
@@ -922,27 +920,27 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
(H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_ID_NAME) > 0) ) {
uint8_t bogus_flags = 0; /* Flags for creating "bogus" message */
- unsigned bogus_id; /* "bogus" ID */
+ unsigned bogus_id; /* "bogus" ID */
- /* Retrieve "bogus" message ID */
+ /* Retrieve "bogus" message ID */
if(H5P_get(dc_plist, H5O_BOGUS_MSG_ID_NAME, &bogus_id) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options")
/* Retrieve "bogus" message flags */
if(H5P_get(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus message options")
/* Add a "bogus" message (for error testing). */
- if(H5O_bogus_oh(file, dxpl_id, oh, bogus_id, (unsigned)bogus_flags) < 0)
+ if(H5O_bogus_oh(file, dxpl_id, oh, bogus_id, (unsigned)bogus_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create 'bogus' message")
} /* end if */
}
#endif /* H5O_ENABLE_BOGUS */
/* Add a modification time message, if using older format. */
- /* (If using the latest 'no modification time message' version support, the modification time is part of the object
+ /* (If using v18 format versions and above, the the modification time is part of the object
* header and doesn't use a separate message -QAK)
*/
- if(!(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_NO_MOD_TIME_MSG)))
+ if(!use_at_least_v18)
if(H5O_touch_oh(file, dxpl_id, oh, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time message")
@@ -1174,27 +1172,20 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "compact dataset must have early space allocation")
} /* end if */
- /* Set the latest version of the layout, pline & fill messages, if requested */
- if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DSET_MSG_FLAGS)) {
- /* Set the latest version for the I/O pipeline message */
- if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_PLINE_MSG))
- if(H5O_pline_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0)
+ /* Set the version for the I/O pipeline message */
+ if(H5O_pline_set_version(file, &new_dset->shared->dcpl_cache.pline) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline")
- /* Set the latest version for the fill message */
- if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG))
- /* Set the latest version for the fill value message */
- if(H5O_fill_set_latest_version(&new_dset->shared->dcpl_cache.fill) < 0)
+ /* Set the version for the fill message */
+ if(H5O_fill_set_version(file, &new_dset->shared->dcpl_cache.fill) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value")
- /* Set the latest version for the layout message */
- if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_LAYOUT_MSG))
- /* Set the latest version for the layout message */
- if(H5D__layout_set_latest_version(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0)
+ /* Set the latest version for the layout message */
+ if(H5D__layout_set_version(file, &new_dset->shared->layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of layout")
- } /* end if */
- else if(new_dset->shared->layout.version >= H5O_LAYOUT_VERSION_4) {
- /* Use latest indexing type for layout message version >= 4 */
+
+ if(new_dset->shared->layout.version >= H5O_LAYOUT_VERSION_4) {
+ /* Use latest indexing type for layout message version >= 4 */
if(H5D__layout_set_latest_indexing(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest indexing")
} /* end if */
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index ec18e86..980b810 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -46,6 +46,12 @@
/* Package Variables */
/*********************/
+/* Format version bounds for layout */
+const unsigned H5O_layout_ver_bounds[] = {
+ H5O_LAYOUT_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_LAYOUT_VERSION_3, /* H5F_LIBVER_V18 */ /* H5O_LAYOUT_VERSION_DEFAULT */
+ H5O_LAYOUT_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
/*****************************/
/* Library Private Variables */
@@ -57,6 +63,7 @@
/*******************/
+
/*-------------------------------------------------------------------------
* Function: H5D__layout_set_io_ops
@@ -277,49 +284,47 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__layout_set_latest_version
+ * Function: H5D__layout_set_version
*
- * Purpose: Set the encoding for a layout to the latest version.
- * Part of the coding in this routine is moved to
- * H5D__layout_set_latest_indexing().
+ * Purpose: Set the version to encode a layout with.
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Thursday, January 15, 2009
+ * Programmer: Vailin Choi; December 2017
*
*-------------------------------------------------------------------------
*/
herr_t
-H5D__layout_set_latest_version(H5O_layout_t *layout, const H5S_t *space,
- const H5D_dcpl_cache_t *dcpl_cache)
+H5D__layout_set_version(H5F_t *f, H5O_layout_t *layout)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned version; /* Message version */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(layout);
- HDassert(space);
- HDassert(dcpl_cache);
+ HDassert(f);
+
+ /* Upgrade to the version indicated by the file's low bound if higher */
+ version = MAX(layout->version, H5O_layout_ver_bounds[H5F_LOW_BOUND(f)]);
- /* Set encoding of layout to latest version */
- layout->version = H5O_LAYOUT_VERSION_LATEST;
+ /* Version bounds check */
+ if(version > H5O_layout_ver_bounds[H5F_HIGH_BOUND(f)])
+ HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "layout version out of bounds")
- /* Set the latest indexing type for the layout message */
- if(H5D__layout_set_latest_indexing(layout, space, dcpl_cache) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest indexing type")
+ /* Set the message version */
+ layout->version = version;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D__layout_set_latest_version() */
+} /* end H5D__layout_set_version() */
/*-------------------------------------------------------------------------
* Function: H5D__layout_set_latest_indexing
*
* Purpose: Set the latest indexing type for a layout message
- * This is moved from H5D_layout_set_latest_version().
*
* Return: Non-negative on success/Negative on failure
*
diff --git a/src/H5F.c b/src/H5F.c
index f435502..8e5f65a 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -1477,7 +1477,8 @@ H5Fstart_swmr_write(hid_t file_id)
if(file->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_3)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file superblock version should be at least 3")
- HDassert((file->shared->latest_flags | H5F_LATEST_LAYOUT_MSG) > 0);
+
+ HDassert((file->shared->low_bound == H5F_LIBVER_V110) && (file->shared->high_bound == H5F_LIBVER_V110));
/* Should not be marked for SWMR writing mode already */
if(file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS)
@@ -1740,41 +1741,36 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fset_latest_format
+ * Function: H5Fset_libver_bounds
*
- * Purpose: Enable switching the "latest format" flag while a file is open.
+ * Purpose: Set to a different low and high bounds while a file is open.
+ * This public routine is introduced in place of
+ * H5Fset_latest_format() starting release 1.10.2.
+ * See explanation for H5Fset_latest_format() in H5Fdeprec.c.
*
* Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
-H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
+H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high)
{
H5F_t *f; /* File */
- unsigned latest_flags; /* Latest format flags for file */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "ib", file_id, latest_format);
+ H5TRACE3("e", "iFvFv", file_id, low, high);
/* Check args */
if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID")
- /* Check if the value is changing */
- latest_flags = H5F_USE_LATEST_FLAGS(f, H5F_LATEST_ALL_FLAGS);
- if(latest_format != (H5F_LATEST_ALL_FLAGS == latest_flags)) {
- /* Call the flush routine, for this file */
- if(H5F__flush(f, H5AC_ind_read_dxpl_id, H5AC_rawdata_dxpl_id, FALSE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
-
- /* Toggle the 'latest format' flag */
- H5F_SET_LATEST_FLAGS(f, latest_format ? H5F_LATEST_ALL_FLAGS : 0);
- } /* end if */
+ /* Call private set_libver_bounds function */
+ if(H5F_set_libver_bounds(f, low, high) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Fset_latest_format() */
+} /* end H5Fset_libver_bounds() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c
index 03f5df8..a9ffa43 100644
--- a/src/H5Fdeprec.c
+++ b/src/H5Fdeprec.c
@@ -143,5 +143,67 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fget_info1() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fset_latest_format
+ *
+ * Purpose: Enable switching between latest or non-latest format while
+ * a file is open.
+ * This is deprecated starting release 1.10.2 and is modified
+ * to call the private H5F_set_libver_bounds() to set the
+ * bounds.
+ *
+ * Before release 1.10.2, the library supports only two
+ * combinations of low/high bounds:
+ * (earliest, latest)
+ * (latest, latest)
+ * Thus, this public routine does the job in switching
+ * between the two combinations listed above.
+ *
+ * Starting release 1.10.2, we add v18 to the enumerated
+ * define H5F_libver_t and the library supports five combinations
+ * as below:
+ * (earliest, v18)
+ * (earliest, v10)
+ * (v18, v18)
+ * (v18, v10)
+ * (v10, v10)
+ * So we introduce the new public routine H5Fset_libver_bounds()
+ * in place of H5Fset_latest_format().
+ * See also RFC: Setting Bounds for Object Creation in HDF5 1.10.0.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; December 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
+{
+ H5F_t *f; /* File */
+ H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */
+ H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "ib", file_id, latest_format);
+
+ /* Check args */
+ if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID")
+
+ /* 'low' and 'high' are both initialized to LATEST.
+ If latest format is not expected, set 'low' to EARLIEST */
+ if(!latest_format)
+ low = H5F_LIBVER_EARLIEST;
+
+ /* Call private set_libver_bounds function to set the bounds */
+ if(H5F_set_libver_bounds(f, low, high) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Fset_latest_format() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Fint.c b/src/H5Fint.c
index e528cab..c41453a 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -161,10 +161,10 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't sieve buffer size")
if(H5P_set(new_plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(f->shared->sdata_aggr.alloc_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' cache size")
- if(f->shared->latest_flags > 0)
- latest_format = TRUE;
- if(H5P_set(new_plist, H5F_ACS_LATEST_FORMAT_NAME, &latest_format) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'latest format' flag")
+ if(H5P_set(new_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &f->shared->low_bound) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'low' bound for library format versions")
+ if(H5P_set(new_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &f->shared->high_bound) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'high' bound for library format versions")
if(H5P_set(new_plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &(f->shared->read_attempts)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'read attempts ' flag")
if(H5P_set(new_plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0)
@@ -902,13 +902,10 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get garbage collect reference")
if(H5P_get(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get sieve buffer size")
- if(H5P_get(plist, H5F_ACS_LATEST_FORMAT_NAME, &latest_format) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'latest format' flag")
- /* For latest format or SWMR_WRITE, activate all latest version support */
- if(latest_format)
- f->shared->latest_flags |= H5F_LATEST_ALL_FLAGS;
- else if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE)
- f->shared->latest_flags |= H5F_LATEST_LAYOUT_MSG;
+ if(H5P_get(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &(f->shared->low_bound)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'low' bound for library format versions")
+ if(H5P_get(plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &(f->shared->high_bound)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'high' bound for library format versions")
if(H5P_get(plist, H5F_ACS_USE_MDC_LOGGING_NAME, &(f->shared->use_mdc_logging)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'use mdc logging' flag")
if(H5P_get(plist, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, &(f->shared->start_mdc_log_on_access)) < 0)
@@ -2571,7 +2568,39 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5F_set_store_msg_crt_idx() */
+/*-------------------------------------------------------------------------
+ * Function: H5F_set_libver_bounds()
+ *
+ * Purpose: Set the file's low and high bound to the input parameters
+ * 'low' and 'high' respectively.
+ * This is done only if the existing setting is different
+ * from the inputs.
+ *
+ * Return: SUCCEED on success, and FAIL on failure.
+ *
+ * Programmer: Vailin Choi; December 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_set_libver_bounds(H5F_t * f, H5F_libver_t low, H5F_libver_t high)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(f->shared);
+
+ /* Set the bounds only if the existing setting is different from the inputs */
+ if(f->shared->low_bound != low || f->shared->high_bound != high) {
+ f->shared->low_bound = low;
+ f->shared->high_bound = high;
+ }
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5F_set_libver_bounds() */
+
+
/*-------------------------------------------------------------------------
* Function: H5F_get_file_image
*
@@ -2908,30 +2937,3 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr)
FUNC_LEAVE_NOAPI_VOID
} /* H5F_set_coll_md_read() */
#endif /* H5_HAVE_PARALLEL */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5F_set_latest_flags
- *
- * Purpose: Set the latest_flags field with a new value.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *-------------------------------------------------------------------------
- */
-herr_t
-H5F_set_latest_flags(H5F_t *f, unsigned flags)
-{
- /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Sanity check */
- HDassert(f);
- HDassert(f->shared);
- HDassert(0 == ((~flags) & H5F_LATEST_ALL_FLAGS));
-
- f->shared->latest_flags = flags;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5F_set_latest_flags() */
-
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index b50b4e5..c9aba56 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -300,7 +300,8 @@ struct H5F_file_t {
hsize_t threshold; /* Threshold for alignment */
hsize_t alignment; /* Alignment */
unsigned gc_ref; /* Garbage-collect references? */
- unsigned latest_flags; /* The latest version support */
+ H5F_libver_t low_bound; /* The 'low' bound of library format versions */
+ H5F_libver_t high_bound; /* The 'high' bound of library format versions */
hbool_t store_msg_crt_idx; /* Store creation index for object header messages? */
unsigned ncwfs; /* Num entries on cwfs list */
struct H5HG_heap_t **cwfs; /* Global heap cache */
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 49c5098..856e618 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -275,6 +275,8 @@ typedef struct H5F_t H5F_t;
/* If the module using this macro is allowed access to the private variables, access them directly */
#ifdef H5F_MODULE
+#define H5F_LOW_BOUND(F) ((F)->shared->low_bound)
+#define H5F_HIGH_BOUND(F) ((F)->shared->high_bound)
#define H5F_INTENT(F) ((F)->shared->flags)
#define H5F_OPEN_NAME(F) ((F)->open_name)
#define H5F_ACTUAL_NAME(F) ((F)->actual_name)
@@ -311,14 +313,12 @@ typedef struct H5F_t H5F_t;
#define H5F_RDCC_W0(F) ((F)->shared->rdcc_w0)
#define H5F_SIEVE_BUF_SIZE(F) ((F)->shared->sieve_buf_size)
#define H5F_GC_REF(F) ((F)->shared->gc_ref)
-#define H5F_USE_LATEST_FLAGS(F,FL) ((F)->shared->latest_flags & (FL))
#define H5F_STORE_MSG_CRT_IDX(F) ((F)->shared->store_msg_crt_idx)
#define H5F_SET_STORE_MSG_CRT_IDX(F, FL) ((F)->shared->store_msg_crt_idx = (FL))
#define H5F_GRP_BTREE_SHARED(F) ((F)->shared->grp_btree_shared)
#define H5F_SET_GRP_BTREE_SHARED(F, RC) (((F)->shared->grp_btree_shared = (RC)) ? SUCCEED : FAIL)
#define H5F_USE_TMP_SPACE(F) ((F)->shared->fs.use_tmp_space)
#define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->fs.tmp_addr, (ADDR)))
-#define H5F_SET_LATEST_FLAGS(F, FL) ((F)->shared->latest_flags = (FL))
#ifdef H5_HAVE_PARALLEL
#define H5F_COLL_MD_READ(F) ((F)->coll_md_read)
#endif /* H5_HAVE_PARALLEL */
@@ -332,6 +332,8 @@ typedef struct H5F_t H5F_t;
#define H5F_FIRST_ALLOC_DEALLOC(F) ((F)->shared->first_alloc_dealloc)
#define H5F_EOA_PRE_FSM_FSALLOC(F) ((F)->shared->eoa_pre_fsm_fsalloc)
#else /* H5F_MODULE */
+#define H5F_LOW_BOUND(F) (H5F_get_low_bound(F))
+#define H5F_HIGH_BOUND(F) (H5F_get_high_bound(F))
#define H5F_INTENT(F) (H5F_get_intent(F))
#define H5F_OPEN_NAME(F) (H5F_get_open_name(F))
#define H5F_ACTUAL_NAME(F) (H5F_get_actual_name(F))
@@ -368,14 +370,12 @@ typedef struct H5F_t H5F_t;
#define H5F_RDCC_W0(F) (H5F_rdcc_w0(F))
#define H5F_SIEVE_BUF_SIZE(F) (H5F_sieve_buf_size(F))
#define H5F_GC_REF(F) (H5F_gc_ref(F))
-#define H5F_USE_LATEST_FLAGS(F,FL) (H5F_use_latest_flags(F,FL))
#define H5F_STORE_MSG_CRT_IDX(F) (H5F_store_msg_crt_idx(F))
#define H5F_SET_STORE_MSG_CRT_IDX(F, FL) (H5F_set_store_msg_crt_idx((F), (FL)))
#define H5F_GRP_BTREE_SHARED(F) (H5F_grp_btree_shared(F))
#define H5F_SET_GRP_BTREE_SHARED(F, RC) (H5F_set_grp_btree_shared((F), (RC)))
#define H5F_USE_TMP_SPACE(F) (H5F_use_tmp_space(F))
#define H5F_IS_TMP_ADDR(F, ADDR) (H5F_is_tmp_addr((F), (ADDR)))
-#define H5F_SET_LATEST_FLAGS(F, FL) (H5F_set_latest_flags((F), (FL)))
#ifdef H5_HAVE_PARALLEL
#define H5F_COLL_MD_READ(F) (H5F_coll_md_read(F))
#endif /* H5_HAVE_PARALLEL */
@@ -484,7 +484,8 @@ typedef struct H5F_t H5F_t;
#define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" /* New member size of family driver. (private property only used by h5repart) */
#define H5F_ACS_FAMILY_TO_SEC2_NAME "family_to_sec2" /* Whether to convert family to sec2 driver. (private property only used by h5repart) */
#define H5F_ACS_MULTI_TYPE_NAME "multi_type" /* Data type in multi file driver */
-#define H5F_ACS_LATEST_FORMAT_NAME "latest_format" /* 'Use latest format version' flag */
+#define H5F_ACS_LIBVER_LOW_BOUND_NAME "libver_low_bound" /* 'low' bound of library format versions */
+#define H5F_ACS_LIBVER_HIGH_BOUND_NAME "libver_high_bound" /* 'high' bound of library format versions */
#define H5F_ACS_WANT_POSIX_FD_NAME "want_posix_fd" /* Internal: query the file descriptor from the core VFD, instead of the memory address */
#define H5F_ACS_METADATA_READ_ATTEMPTS_NAME "metadata_read_attempts" /* # of metadata read attempts */
#define H5F_ACS_OBJECT_FLUSH_CB_NAME "object_flush_cb" /* Object flush callback */
@@ -629,23 +630,6 @@ typedef struct H5F_t H5F_t;
#define H5SM_TABLE_MAGIC "SMTB" /* Shared Message Table */
#define H5SM_LIST_MAGIC "SMLI" /* Shared Message List */
-
-/* Latest format will activate the following latest version support */
-/* "latest_flags" in H5F_file_t */
-#define H5F_LATEST_DATATYPE 0x0001
-#define H5F_LATEST_DATASPACE 0x0002
-#define H5F_LATEST_ATTRIBUTE 0x0004
-#define H5F_LATEST_FILL_MSG 0x0008
-#define H5F_LATEST_PLINE_MSG 0x0010
-#define H5F_LATEST_LAYOUT_MSG 0x0020
-#define H5F_LATEST_NO_MOD_TIME_MSG 0x0040
-#define H5F_LATEST_STYLE_GROUP 0x0080
-#define H5F_LATEST_OBJ_HEADER 0x0100
-#define H5F_LATEST_SUPERBLOCK 0x0200
-#define H5F_LATEST_ALL_FLAGS (H5F_LATEST_DATATYPE | H5F_LATEST_DATASPACE | H5F_LATEST_ATTRIBUTE | H5F_LATEST_FILL_MSG | H5F_LATEST_PLINE_MSG | H5F_LATEST_LAYOUT_MSG | H5F_LATEST_NO_MOD_TIME_MSG | H5F_LATEST_STYLE_GROUP | H5F_LATEST_OBJ_HEADER | H5F_LATEST_SUPERBLOCK)
-
-#define H5F_LATEST_DSET_MSG_FLAGS (H5F_LATEST_FILL_MSG | H5F_LATEST_PLINE_MSG | H5F_LATEST_LAYOUT_MSG)
-
/****************************/
/* Library Private Typedefs */
/****************************/
@@ -736,7 +720,9 @@ H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id,
hid_t fapl_id, hid_t dxpl_id);
H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/);
-/* Functions than retrieve values from the file struct */
+/* Functions that retrieve values from the file struct */
+H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f);
+H5_DLL H5F_libver_t H5F_get_high_bound(const H5F_t *f);
H5_DLL unsigned H5F_get_intent(const H5F_t *f);
H5_DLL char *H5F_get_open_name(const H5F_t *f);
H5_DLL char *H5F_get_actual_name(const H5F_t *f);
@@ -783,11 +769,11 @@ H5_DLL unsigned H5F_gc_ref(const H5F_t *f);
H5_DLL unsigned H5F_use_latest_flags(const H5F_t *f, unsigned fl);
H5_DLL hbool_t H5F_store_msg_crt_idx(const H5F_t *f);
H5_DLL herr_t H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag);
+H5_DLL herr_t H5F_set_libver_bounds(H5F_t * f, H5F_libver_t low, H5F_libver_t high);
H5_DLL struct H5UC_t *H5F_grp_btree_shared(const H5F_t *f);
H5_DLL herr_t H5F_set_grp_btree_shared(H5F_t *f, struct H5UC_t *rc);
H5_DLL hbool_t H5F_use_tmp_space(const H5F_t *f);
H5_DLL hbool_t H5F_is_tmp_addr(const H5F_t *f, haddr_t addr);
-H5_DLL herr_t H5F_set_latest_flags(H5F_t *f, unsigned flags);
H5_DLL hsize_t H5F_get_alignment(const H5F_t *f);
H5_DLL hsize_t H5F_get_threshold(const H5F_t *f);
#ifdef H5_HAVE_PARALLEL
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index 1594cb2..d333fa7 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -173,12 +173,17 @@ typedef struct H5F_sect_info_t {
hsize_t size; /* Size of free space section */
} H5F_sect_info_t;
-/* Library's file format versions */
+/* Library's format versions */
typedef enum H5F_libver_t {
- H5F_LIBVER_EARLIEST, /* Use the earliest possible format for storing objects */
- H5F_LIBVER_LATEST /* Use the latest possible format available for storing objects*/
+ H5F_LIBVER_ERROR = -1,
+ H5F_LIBVER_EARLIEST = 0, /* Use the earliest possible format for storing objects */
+ H5F_LIBVER_V18 = 1, /* Use the latest v18 format for storing objects */
+ H5F_LIBVER_V110 = 2, /* Use the latest v10 format for storing objects */
+ H5F_LIBVER_NBOUNDS
} H5F_libver_t;
+#define H5F_LIBVER_LATEST H5F_LIBVER_V110
+
/* File space handling strategy */
typedef enum H5F_fspace_strategy_t {
H5F_FSPACE_STRATEGY_FSM_AGGR = 0, /* Mechanisms: free-space managers, aggregators, and virtual file drivers */
@@ -255,7 +260,7 @@ H5_DLL herr_t H5Fstart_swmr_write(hid_t file_id);
H5_DLL ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type,
size_t nsects, H5F_sect_info_t *sect_info/*out*/);
H5_DLL herr_t H5Fclear_elink_file_cache(hid_t file_id);
-H5_DLL herr_t H5Fset_latest_format(hid_t file_id, hbool_t latest_format);
+H5_DLL herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high);
H5_DLL herr_t H5Fstart_mdc_logging(hid_t file_id);
H5_DLL herr_t H5Fstop_mdc_logging(hid_t file_id);
H5_DLL herr_t H5Fget_mdc_logging_status(hid_t file_id,
@@ -295,6 +300,7 @@ typedef struct H5F_info1_t {
/* Function prototypes */
H5_DLL herr_t H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo);
+H5_DLL herr_t H5Fset_latest_format(hid_t file_id, hbool_t latest_format);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index 4765d00..f7e222e 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -97,6 +97,56 @@ H5F_get_intent(const H5F_t *f)
/*-------------------------------------------------------------------------
+ * Function: H5F_get_low_bound
+ *
+ * Purpose: Quick and dirty routine to retrieve the file's low_bound.
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5F_t data structure)
+ *
+ * Return: low_bound on success/abort on failure (shouldn't fail)
+ *
+ * Programmer: Vailin Choi; June 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+H5F_libver_t
+H5F_get_low_bound(const H5F_t *f)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(f);
+
+ FUNC_LEAVE_NOAPI(f->shared->low_bound)
+} /* end H5F_get_low_bound() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_get_high_bound
+ *
+ * Purpose: Quick and dirty routine to retrieve the file's high_bound.
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5F_t data structure)
+ *
+ * Return: high_bound on success/abort on failure (shouldn't fail)
+ *
+ * Programmer: Vailin Choi; June 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+H5F_libver_t
+H5F_get_high_bound(const H5F_t *f)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(f);
+
+ FUNC_LEAVE_NOAPI(f->shared->high_bound)
+} /* end H5F_get_high_bound() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_get_open_name
*
* Purpose: Retrieve the name used to open a file.
@@ -667,9 +717,13 @@ H5F_sieve_buf_size(const H5F_t *f)
* references flag" now that the generic properties are being used
* to store the values.
*
- * Return: Success: The "garbage collect references flag"
- * is returned.
- * Failure: (should not happen)
+ * Return: Success: The "garbage collect references flag" is returned.
+ * Failure: (should not happen)
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Jul 8 2005
+ *
*-------------------------------------------------------------------------
*/
unsigned
@@ -686,28 +740,6 @@ H5F_gc_ref(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_use_latest_flags
- *
- * Purpose: Retrieve the 'latest version support' for the file.
- *
- * Return: Success: Non-negative, the requested 'version support'
- * Failure: (can't happen)
- *-------------------------------------------------------------------------
- */
-unsigned
-H5F_use_latest_flags(const H5F_t *f, unsigned fl)
-{
- /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- HDassert(f);
- HDassert(f->shared);
-
- FUNC_LEAVE_NOAPI(f->shared->latest_flags & (fl))
-} /* end H5F_use_latest_flags() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5F_get_fc_degree
*
* Purpose: Retrieve the 'file close degree' for the file.
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 0c6f9cd..4250ff0 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -59,7 +59,6 @@ static herr_t H5F__update_super_ext_driver_msg(H5F_t *f, hid_t dxpl_id);
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
@@ -72,6 +71,12 @@ H5FL_DEFINE(H5F_super_t);
/* Local Variables */
/*******************/
+/* Format version bounds for superblock */
+static const unsigned HDF5_superblock_ver_bounds[] = {
+ HDF5_SUPERBLOCK_VERSION_DEF, /* H5F_LIBVER_EARLIEST */
+ HDF5_SUPERBLOCK_VERSION_2, /* H5F_LIBVER_V18 */
+ HDF5_SUPERBLOCK_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
/*-------------------------------------------------------------------------
@@ -452,13 +457,46 @@ H5F__super_read(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t initial
if(NULL == (sblock = (H5F_super_t *)H5AC_protect(f, meta_dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, &udata, rw_flags)))
HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "unable to load superblock")
- if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE)
- if(sblock->super_vers < HDF5_SUPERBLOCK_VERSION_3)
- HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "invalid superblock version for SWMR_WRITE")
+ /*
+ * When opening a file with SWMR-write access, the library will first
+ * check to ensure that superblock version 3 is used. Otherwise fail
+ * file open.
+ *
+ * Then the library will upgrade the file's low_bound depending on
+ * superblock version as follows:
+ * --version 0 or 1: no change to low_bound
+ * --version 2: upgrade low_bound to at least V18
+ * --version 3: upgrade low_bound to at least V110
+ *
+ * Upgrading low_bound will give the best format versions available for
+ * that superblock version. Due to the possible upgrade, the fapl returned
+ * from H5Fget_access_plist() might indicate a low_bound higher than what
+ * the user originally set.
+ *
+ * After upgrading low_bound, the library will check to ensure that the
+ * superblock version does not exceed the version allowed by high_bound.
+ * Otherise fail file open.
+ *
+ * For details, please see RFC:Setting Bounds for Object Creation in HDF5 1.10.0.
+ */
+
+ /* Check to ensure that superblock version 3 is used for SWMR-write access */
+ if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) {
+ if(sblock->super_vers < HDF5_SUPERBLOCK_VERSION_3)
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "superblock version for SWMR is less than 3")
+ }
- /* Enable all latest version support when file has v3 superblock */
+ /* Upgrade low_bound to at least V18 when encountering version 2 superblock */
+ if(sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2)
+ f->shared->low_bound = MAX(H5F_LIBVER_V18, f->shared->low_bound);
+
+ /* Upgrade low_bound to at least V110 when encountering version 3 superblock */
if(sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_3)
- f->shared->latest_flags |= H5F_LATEST_ALL_FLAGS;
+ f->shared->low_bound = MAX(H5F_LIBVER_V110, f->shared->low_bound);
+
+ /* Version bounds check */
+ if(sblock->super_vers > HDF5_superblock_ver_bounds[f->shared->high_bound])
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "superblock version exceeds high bound")
/* Pin the superblock in the cache */
if(H5AC_pin_protected_entry(sblock) < 0)
@@ -1018,14 +1056,42 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF))
non_default_fs_settings = TRUE;
- /* Bump superblock version if latest superblock version support is enabled */
- if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_SUPERBLOCK))
- super_vers = HDF5_SUPERBLOCK_VERSION_LATEST;
- /* Bump superblock version to use version 3 superblock for SWMR writing */
- else if((H5F_INTENT(f) & H5F_ACC_SWMR_WRITE))
+ /*
+ * When creating a file with write access, the library will:
+ * -- set superblock version to 0, 1 or 2 based on feature enabled
+ * -- no change to low_bound
+ * When creating a file with SWMR-write access, the library will:
+ * (See explanation (#) below.)
+ * -- set superblock version to 3
+ * -- upgrade low_bound to at least V110
+ *
+ * Then the library will finalize superblock version to that allowed by
+ * low_bound if that is higher.
+ * Lastly, the library will check to ensure the superblock version does not
+ * exceed the version allowed by high_bound. Otherwise fail file open.
+ *
+ * For details, please see RFC:Setting Bounds for Object Creation in HDF5 1.10.0.
+ *
+ * (#)
+ * Version 3 superblock is introduced in 1.10 for SWMR due to the problem of
+ * the status_flags field in the superblock. The problem is discussed in
+ * jira issue SWMR-79 and also in the RFC: File Format Changes in HDF5 1.10.0.
+ * The file's low_bound is upgraded for SWMR so that the library will
+ * use the best format versions available in 1.10.
+ * Due to the possible upgrade, the fapl returned from H5Fget_access_plist()
+ * might indicate a low_bound higher than what the user originally set.
+ */
+
+ /*
+ * Creating a file with SWMR-write access will
+ * upgrade superblock version and low_bound
+ */
+ if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) {
super_vers = HDF5_SUPERBLOCK_VERSION_3;
+ f->shared->low_bound = MAX(H5F_LIBVER_V110, f->shared->low_bound);
+
/* Bump superblock version to create superblock extension for SOHM info */
- else if(f->shared->sohm_nindexes > 0)
+ } else if(f->shared->sohm_nindexes > 0)
super_vers = HDF5_SUPERBLOCK_VERSION_2;
/*
* Bump superblock version to create superblock extension for:
@@ -1043,6 +1109,13 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
else if(sblock->btree_k[H5B_CHUNK_ID] != HDF5_BTREE_CHUNK_IK_DEF)
super_vers = HDF5_SUPERBLOCK_VERSION_1;
+ /* Finalize superblock version to that allowed by the file's low bound if higher */
+ super_vers = MAX(super_vers, HDF5_superblock_ver_bounds[f->shared->low_bound]);
+
+ /* Version bounds check */
+ if(super_vers > HDF5_superblock_ver_bounds[f->shared->high_bound])
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "superblock version out of bounds")
+
/* If a newer superblock version is required, set it here */
if(super_vers != HDF5_SUPERBLOCK_VERSION_DEF) {
H5P_genplist_t *c_plist; /* Property list */
@@ -1067,8 +1140,8 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
/* Sanity check the userblock size vs. the file's allocation alignment */
if(userblock_size > 0) {
- /* Set up the alignment to use for page or aggr fs */
- hsize_t alignment = H5F_PAGED_AGGR(f) ? f->shared->fs_page_size : f->shared->alignment;
+ /* Set up the alignment to use for page or aggr fs */
+ hsize_t alignment = H5F_PAGED_AGGR(f) ? f->shared->fs_page_size : f->shared->alignment;
if(userblock_size < alignment)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "userblock size must be > file object alignment")
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index d2dc83b..5f9bdc8 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -185,7 +185,7 @@ H5G__obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
H5G_obj_create_t *gcrt_info, H5O_loc_t *oloc/*out*/)
{
size_t hdr_size; /* Size of object header to request */
- hbool_t use_latest_format; /* Flag indicating the new group format should be used */
+ hbool_t use_at_least_v18; /* Flag indicating the new group format should be used */
hid_t gcpl_id = gcrt_info->gcpl_id; /* Group creation property list ID */
herr_t ret_value = SUCCEED; /* Return value */
@@ -202,24 +202,23 @@ H5G__obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
/* Check for invalid access request */
if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file")
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file")
- /* Check for using the latest version of the group format */
+ /* Check for using the latest version of the group format which is introduced in v18 */
/* (add more checks for creating "new format" groups when needed) */
- if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_STYLE_GROUP) || linfo->track_corder
- || (pline && pline->nused))
- use_latest_format = TRUE;
+ if((H5F_LOW_BOUND(f) >= H5F_LIBVER_V18) || linfo->track_corder || (pline && pline->nused))
+ use_at_least_v18 = TRUE;
else
- use_latest_format = FALSE;
+ use_at_least_v18 = FALSE;
/* Make certain that the creation order is being tracked if an index is
* going to be built on it.
*/
if(linfo->index_corder && !linfo->track_corder)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "must track creation order to create index for it")
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "must track creation order to create index for it")
/* Check if we should be using the latest version of the group format */
- if(use_latest_format) {
+ if(use_at_least_v18) {
H5O_link_t lnk; /* Temporary link message info for computing message size */
char null_char = '\0'; /* Character for creating null string */
size_t ginfo_size; /* Size of the group info message */
@@ -262,10 +261,10 @@ H5G__obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
* incremented if the object is added to the group directed graph.
*/
if(H5O_create(f, dxpl_id, hdr_size, (size_t)1, gcpl_id, oloc/*out*/) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header")
/* Check for format of group to create */
- if(use_latest_format) {
+ if(use_at_least_v18) {
/* Insert link info message */
/* (Casting away const OK - QAK) */
if(H5O_msg_create(oloc, H5O_LINFO_ID, 0, H5O_UPDATE_TIME, (void *)linfo, dxpl_id) < 0)
diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c
index 2f01ce6..89b3b47 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -424,11 +424,9 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam)
if(NULL == H5O_msg_copy(H5O_PLINE_ID, &(cparam->pline), &(hdr->pline)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOPY, HADDR_UNDEF, "can't copy I/O filter pipeline")
- /* Pay attention to the latest version flag for the file */
- if(H5F_USE_LATEST_FLAGS(hdr->f, H5F_LATEST_PLINE_MSG))
- /* Set the latest version for the I/O pipeline message */
- if(H5O_pline_set_latest_version(&(hdr->pline)) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, HADDR_UNDEF, "can't set latest version of I/O filter pipeline")
+ /* Set the version for the I/O pipeline message */
+ if(H5O_pline_set_version(hdr->f, &(hdr->pline)) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, HADDR_UNDEF, "can't set version of I/O filter pipeline")
/* Compute the I/O filters' encoded size */
if(0 == (hdr->filter_len = (unsigned)H5O_msg_raw_size(hdr->f, H5O_PLINE_ID, FALSE, &(hdr->pline))))
diff --git a/src/H5O.c b/src/H5O.c
index cf84b47..109bf99 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -72,7 +72,6 @@
/* Local Variables */
/*******************/
-
/*-------------------------------------------------------------------------
* Function: H5Oopen
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index cb802ea..773a16b 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -622,14 +622,23 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src,
+H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src,
hbool_t *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ const H5A_t *attr_src = (const H5A_t *)native_src; /* Source attribute */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
/* check args */
HDassert(deleted);
HDassert(cpy_info);
+ HDassert(cpy_info->file_dst);
+
+ /* Check to ensure that the version of the message to be copied does not exceed
+ the message version allowed by the destination file's high bound */
+ if(attr_src->shared->version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "attribute message version out of bounds")
/* If we are not copying attributes into the destination file, indicate
* that this message should be deleted.
@@ -637,7 +646,8 @@ H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED
if(cpy_info->copy_without_attr)
*deleted = TRUE;
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_pre_copy_file() */
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index aa2a9e0..74c02f4 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -415,6 +415,11 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
/* Initialize header information */
oh_dst->version = oh_src->version;
+
+ /* Version bounds check for destination object header */
+ if(oh_dst->version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(oloc_dst->file)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "destination object header version out of bounds")
+
oh_dst->flags = oh_src->flags;
oh_dst->link_msgs_seen = oh_src->link_msgs_seen;
oh_dst->attr_msgs_seen = oh_src->attr_msgs_seen;
@@ -490,6 +495,12 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
/* Decode the message if necessary. */
H5O_LOAD_NATIVE(oloc_src->file, dxpl_id, 0, oh_src, mesg_src, FAIL)
+ /* Save destination file pointer in cpy_info so that it can be used
+ in the pre_copy_file callback to obtain the destination file's
+ high bound. The high bound is used to index into the corresponding
+ message's array of versions for doing version bounds check. */
+ cpy_info->file_dst = oloc_dst->file;
+
/* Perform "pre copy" operation on message */
if((copy_type->pre_copy_file)(oloc_src->file, mesg_src->native,
&(deleted[mesgno]), cpy_info, cpy_udata) < 0)
@@ -871,12 +882,19 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
/* Free destination object header on failure */
- if(ret_value < 0 && oh_dst && !inserted) {
- if(H5O__free(oh_dst) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
- if(H5O_loc_reset(oloc_dst) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
- } /* end if */
+ if(ret_value < 0) {
+ if(oh_dst && !inserted) {
+ if(H5O__free(oh_dst) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
+ if(H5O_loc_reset(oloc_dst) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
+ } /* end if */
+
+ if(addr_map == NULL && cpy_udata) {
+ if(obj_class && obj_class->free_copy_file_udata)
+ obj_class->free_copy_file_udata(cpy_udata);
+ } /* end if */
+ }
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
} /* end H5O_copy_header_real() */
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index a1c24b6..c51e31d 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -15,16 +15,16 @@
#define H5T_FRIEND /*prevent warning from including H5Tpkg */
-#include "H5private.h" /* Generic Functions */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Gprivate.h" /* Groups */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Opkg.h" /* Object headers */
-#include "H5Tpkg.h" /* Datatypes */
-#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Gprivate.h" /* Groups */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5Tpkg.h" /* Datatypes */
+#include "H5VMprivate.h" /* Vectors and arrays */
/* PRIVATE PROTOTYPES */
@@ -1516,7 +1516,7 @@ done:
*/
static herr_t
H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src,
- hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t H5_ATTR_UNUSED *cpy_info,
+ hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info,
void *_udata)
{
const H5T_t *dt_src = (const H5T_t *)mesg_src; /* Source datatype */
@@ -1528,6 +1528,13 @@ H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src,
/* check args */
HDassert(file_src);
HDassert(dt_src);
+ HDassert(cpy_info);
+ HDassert(cpy_info->file_dst);
+
+ /* Check to ensure that the version of the message to be copied does not exceed
+ the message version as indicated by the destination file's high bound */
+ if(dt_src->shared->version > H5O_dtype_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "datatype message version out of bounds")
/* If the user data is non-NULL, assume we are copying a dataset
* and check if we need to make a copy of the datatype for later in
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index 5419762..74f69d1 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -21,15 +21,15 @@
#include "H5Omodule.h" /* This source code file is part of the H5O module */
-#include "H5private.h" /* Generic Functions */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Opkg.h" /* Object headers */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5Sprivate.h" /* Dataspaces */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Sprivate.h" /* Dataspaces */
static void *H5O_fill_old_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
@@ -43,6 +43,8 @@ static size_t H5O_fill_new_size(const H5F_t *f, const void *_mesg);
static void *H5O_fill_copy(const void *_mesg, void *_dest);
static herr_t H5O_fill_reset(void *_mesg);
static herr_t H5O_fill_free(void *_mesg);
+static herr_t H5O_fill_pre_copy_file(H5F_t *file_src, const void *mesg_src,
+ hbool_t *deleted, const H5O_copy_t *cpy_info, void *udata);
static herr_t H5O_fill_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
int indent, int fwidth);
@@ -105,52 +107,59 @@ static herr_t H5O_fill_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *s
/* This message derives from H5O message class, for old fill value before version 1.5 */
const H5O_msg_class_t H5O_MSG_FILL[1] = {{
- H5O_FILL_ID, /*message id number */
- "fill", /*message name for debugging */
- sizeof(H5O_fill_t), /*native message size */
- H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */
- H5O_fill_shared_decode, /*decode message */
- H5O_fill_shared_encode, /*encode message */
- H5O_fill_copy, /*copy the native value */
- H5O_fill_shared_size, /*raw message size */
- H5O_fill_reset, /*free internal memory */
- H5O_fill_free, /* free method */
- H5O_fill_shared_delete, /* file delete method */
- H5O_fill_shared_link, /* link method */
- NULL, /* set share method */
- NULL, /*can share method */
- NULL, /* pre copy native value to file */
- H5O_fill_shared_copy_file, /* copy native value to file */
- H5O_fill_shared_post_copy_file, /* post copy native value to file */
- NULL, /* get creation index */
- NULL, /* set creation index */
- H5O_fill_shared_debug /*debug the message */
+ H5O_FILL_ID, /*message id number */
+ "fill", /*message name for debugging */
+ sizeof(H5O_fill_t), /*native message size */
+ H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */
+ H5O_fill_shared_decode, /*decode message */
+ H5O_fill_shared_encode, /*encode message */
+ H5O_fill_copy, /*copy the native value */
+ H5O_fill_shared_size, /*raw message size */
+ H5O_fill_reset, /*free internal memory */
+ H5O_fill_free, /* free method */
+ H5O_fill_shared_delete, /* file delete method */
+ H5O_fill_shared_link, /* link method */
+ NULL, /* set share method */
+ NULL, /*can share method */
+ H5O_fill_pre_copy_file, /* pre copy native value to file */
+ H5O_fill_shared_copy_file, /* copy native value to file */
+ H5O_fill_shared_post_copy_file, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
+ H5O_fill_shared_debug /*debug the message */
}};
/* This message derives from H5O message class, for new fill value after version 1.4 */
const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{
- H5O_FILL_NEW_ID, /*message id number */
- "fill_new", /*message name for debugging */
- sizeof(H5O_fill_t), /*native message size */
- H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */
- H5O_fill_new_shared_decode, /*decode message */
- H5O_fill_new_shared_encode, /*encode message */
- H5O_fill_copy, /*copy the native value */
- H5O_fill_new_shared_size, /*raw message size */
- H5O_fill_reset, /*free internal memory */
- H5O_fill_free, /* free method */
- H5O_fill_new_shared_delete, /* file delete method */
- H5O_fill_new_shared_link, /* link method */
- NULL, /* set share method */
- NULL, /*can share method */
- NULL, /* pre copy native value to file */
- H5O_fill_new_shared_copy_file, /* copy native value to file */
- H5O_fill_new_shared_post_copy_file, /* post copy native value to file */
- NULL, /* get creation index */
- NULL, /* set creation index */
- H5O_fill_new_shared_debug /*debug the message */
+ H5O_FILL_NEW_ID, /*message id number */
+ "fill_new", /*message name for debugging */
+ sizeof(H5O_fill_t), /*native message size */
+ H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */
+ H5O_fill_new_shared_decode, /*decode message */
+ H5O_fill_new_shared_encode, /*encode message */
+ H5O_fill_copy, /*copy the native value */
+ H5O_fill_new_shared_size, /*raw message size */
+ H5O_fill_reset, /*free internal memory */
+ H5O_fill_free, /* free method */
+ H5O_fill_new_shared_delete, /* file delete method */
+ H5O_fill_new_shared_link, /* link method */
+ NULL, /* set share method */
+ NULL, /*can share method */
+ H5O_fill_pre_copy_file, /* pre copy native value to file */
+ H5O_fill_new_shared_copy_file, /* copy native value to file */
+ H5O_fill_new_shared_post_copy_file, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
+ H5O_fill_new_shared_debug /*debug the message */
}};
+/* Format version bounds for fill value */
+const unsigned H5O_fill_ver_bounds[] = {
+ H5O_FILL_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_FILL_VERSION_2, /* H5F_LIBVER_V18 */
+ H5O_FILL_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
+
/* Masks, shift values & flags for fill value message */
#define H5O_FILL_MASK_ALLOC_TIME 0x03
#define H5O_FILL_SHIFT_ALLOC_TIME 0
@@ -171,11 +180,11 @@ H5FL_BLK_EXTERN(type_conv);
* Function: H5O_fill_new_decode
*
* Purpose: Decode a new fill value message. The new fill value
- * message is fill value plus space allocation time and
- * fill value writing time and whether fill value is defined.
+ * message is fill value plus space allocation time and
+ * fill value writing time and whether fill value is defined.
*
- * Return: Success: Ptr to new message in native struct.
- * Failure: NULL
+ * Return: Success: Ptr to new message in native struct.
+ * Failure: NULL
*
* Programmer: Raymond Lu
* Feb 26, 2002
@@ -195,7 +204,7 @@ H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t
HDassert(p);
if(NULL == (fill = H5FL_CALLOC(H5O_fill_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message")
/* Version */
fill->version = *p++;
@@ -276,7 +285,7 @@ done:
if(!ret_value && fill) {
if(fill->buf)
H5MM_xfree(fill->buf);
- fill = H5FL_FREE(H5O_fill_t, fill);
+ fill = H5FL_FREE(H5O_fill_t, fill);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -336,7 +345,7 @@ done:
if(!ret_value && fill) {
if(fill->buf)
H5MM_xfree(fill->buf);
- fill = H5FL_FREE(H5O_fill_t, fill);
+ fill = H5FL_FREE(H5O_fill_t, fill);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -347,8 +356,8 @@ done:
* Function: H5O_fill_new_encode
*
* Purpose: Encode a new fill value message. The new fill value
- * message is fill value plus space allocation time and
- * fill value writing time and whether fill value is defined.
+ * message is fill value plus space allocation time and
+ * fill value writing time and whether fill value is defined.
*
* Return: Non-negative on success/Negative on failure
*
@@ -481,7 +490,7 @@ H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill)
* whether fill value is defined.
*
* Return: Success: Ptr to _DEST
- * Failure: NULL
+ * Failure: NULL
*
* Programmer: Raymond Lu
* Feb 26, 2002
@@ -491,16 +500,16 @@ H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill)
static void *
H5O_fill_copy(const void *_src, void *_dst)
{
- const H5O_fill_t *src = (const H5O_fill_t *)_src;
- H5O_fill_t *dst = (H5O_fill_t *)_dst;
- void *ret_value = NULL; /* Return value */
+ const H5O_fill_t *src = (const H5O_fill_t *)_src;
+ H5O_fill_t *dst = (H5O_fill_t *)_dst;
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
HDassert(src);
if(!dst && NULL == (dst = H5FL_MALLOC(H5O_fill_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill message")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill message")
/* Shallow copy basic fields */
*dst = *src;
@@ -516,9 +525,9 @@ H5O_fill_copy(const void *_src, void *_dst)
/* Copy fill value and its size */
if(src->buf) {
H5_CHECK_OVERFLOW(src->size, ssize_t, size_t);
- if(NULL == (dst->buf = H5MM_malloc((size_t)src->size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
- HDmemcpy(dst->buf, src->buf, (size_t)src->size);
+ if(NULL == (dst->buf = H5MM_malloc((size_t)src->size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
+ HDmemcpy(dst->buf, src->buf, (size_t)src->size);
/* Check for needing to convert/copy fill value */
if(src->type) {
@@ -579,9 +588,9 @@ done:
if(!ret_value && dst) {
if(dst->buf)
H5MM_xfree(dst->buf);
- if(dst->type)
+ if(dst->type)
H5T_close(dst->type);
- if(!_dst)
+ if(!_dst)
dst = H5FL_FREE(H5O_fill_t, dst);
} /* end if */
@@ -593,13 +602,13 @@ done:
* Function: H5O_fill_new_size
*
* Purpose: Returns the size of the raw message in bytes not counting the
- * message type or size fields, but only the data fields. This
- * function doesn't take into account alignment. The new fill
- * value message is fill value plus space allocation time and
- * fill value writing time and whether fill value is defined.
+ * message type or size fields, but only the data fields. This
+ * function doesn't take into account alignment. The new fill
+ * value message is fill value plus space allocation time and
+ * fill value writing time and whether fill value is defined.
*
* Return: Success: Message data size in bytes w/o alignment.
- * Failure: 0
+ * Failure: 0
*
* Programmer: Raymond Lu
* Feb 26, 2002
@@ -609,8 +618,8 @@ done:
static size_t
H5O_fill_new_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill)
{
- const H5O_fill_t *fill = (const H5O_fill_t *)_fill;
- size_t ret_value = 0; /* Return value */
+ const H5O_fill_t *fill = (const H5O_fill_t *)_fill;
+ size_t ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -721,8 +730,8 @@ H5O_fill_reset_dyn(H5O_fill_t *fill)
} /* end if */
fill->size = 0;
if(fill->type) {
- H5T_close(fill->type);
- fill->type = NULL;
+ H5T_close(fill->type);
+ fill->type = NULL;
} /* end if */
done:
@@ -792,6 +801,42 @@ H5O_fill_free(void *fill)
/*-------------------------------------------------------------------------
+ * Function: H5O_fill_pre_copy_file
+ *
+ * Purpose: Perform any necessary actions before copying message between
+ * files.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Vailin Choi; Dec 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_fill_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
+ hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata)
+{
+ const H5O_fill_t *fill_src = (const H5O_fill_t *)mesg_src; /* Source fill value */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* check args */
+ HDassert(cpy_info);
+ HDassert(cpy_info->file_dst);
+
+ /* Check to ensure that the version of the message to be copied does not exceed
+ the message version allowed by the destination file's high bound */
+ if(fill_src->version > H5O_fill_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "fill value message version out of bounds")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_fill_pre_copy_file() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_fill_debug
*
* Purpose: Prints debugging info for the message.
@@ -883,11 +928,11 @@ H5O_fill_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void
"Size:", fill->size);
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Data type:");
if(fill->type) {
- H5T_debug(fill->type, stream);
- fprintf(stream, "\n");
+ H5T_debug(fill->type, stream);
+ HDfprintf(stream, "\n");
} /* end if */
else
- fprintf(stream, "<dataset type>\n");
+ HDfprintf(stream, "<dataset type>\n");
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_fill_debug() */
@@ -897,9 +942,9 @@ H5O_fill_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void
* Function: H5O_fill_convert
*
* Purpose: Convert a fill value from whatever data type it currently has
- * to the specified dataset type. The `type' field of the fill
- * value struct will be set to NULL to indicate that it has the
- * same type as the dataset.
+ * to the specified dataset type. The `type' field of the fill
+ * value struct will be set to NULL to indicate that it has the
+ * same type as the dataset.
*
* Return: Non-negative on success/Negative on failure
*
@@ -925,21 +970,21 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed, hid_
/* No-op cases */
if(!fill->buf || !fill->type || 0 == H5T_cmp(fill->type, dset_type, FALSE)) {
/* Don't need datatype for fill value */
- if(fill->type)
+ if(fill->type)
H5T_close(fill->type);
- fill->type = NULL;
+ fill->type = NULL;
/* Note that the fill value info has changed */
*fill_changed = TRUE;
- HGOTO_DONE(SUCCEED);
+ HGOTO_DONE(SUCCEED);
} /* end if */
/*
* Can we convert between source and destination data types?
*/
if(NULL == (tpath = H5T_path_find(fill->type, dset_type, NULL, NULL, dxpl_id, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
/* Don't bother doing anything if there will be no actual conversion */
if(!H5T_path_noop(tpath)) {
@@ -997,28 +1042,39 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_fill_set_latest_version
+ * Function: H5O_fill_set_version
*
- * Purpose: Set the encoding for a fill value to the latest version.
+ * Purpose: Set the version to encode a fill value with.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Tuesday, July 24, 2007
+ * Programmer: Vailin Choi; December 2017
*
*-------------------------------------------------------------------------
*/
herr_t
-H5O_fill_set_latest_version(H5O_fill_t *fill)
+H5O_fill_set_version(H5F_t *f, H5O_fill_t *fill)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ unsigned version; /* Message version */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ HDassert(f);
HDassert(fill);
- /* Set encoding of fill value to latest version */
- fill->version = H5O_FILL_VERSION_LATEST;
+ /* Upgrade to the version indicated by the file's low bound if higher */
+ version = MAX(fill->version, H5O_fill_ver_bounds[H5F_LOW_BOUND(f)]);
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_fill_set_latest_version() */
+ /* Version bounds check */
+ if(version > H5O_fill_ver_bounds[H5F_HIGH_BOUND(f)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "Filter pipeline version out of bounds")
+
+ /* Set the message version */
+ fill->version = version;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_fill_set_version() */
diff --git a/src/H5Oint.c b/src/H5Oint.c
index 6ab5393..08eb28d 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -131,6 +131,13 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = {
#endif /* H5O_ENABLE_BOGUS */
};
+/* Format version bounds for object header */
+const unsigned H5O_obj_ver_bounds[] = {
+ H5O_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_VERSION_2, /* H5F_LIBVER_V18 */
+ H5O_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
+
/* Declare a free list to manage the H5O_t struct */
H5FL_DEFINE(H5O_t);
@@ -203,6 +210,53 @@ H5O__init_package(void)
/*-------------------------------------------------------------------------
+ * Function: H5O_set_version
+ *
+ * Purpose: Sets the correct version to encode the object header.
+ * Chooses the oldest version possible, unless the file's
+ * low bound indicates otherwise.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Vailin Choi; December 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_set_version(H5F_t *f, H5O_t *oh, uint8_t oh_flags, hbool_t store_msg_crt_idx)
+{
+ uint8_t version; /* Message version */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* check arguments */
+ HDassert(f);
+ HDassert(oh);
+
+ /* Set the correct version to encode object header with */
+ if(store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED))
+ version = H5O_VERSION_LATEST;
+ else
+ version = H5O_VERSION_1;
+
+ /* Upgrade to the version indicated by the file's low bound if higher */
+ version = MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]);
+
+ /* Version bounds check */
+ if(version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(f)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "object header version out of bounds")
+
+ /* Set the message version */
+ oh->version = version;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_set_version() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_create
*
* Purpose: Creates a new object header. Allocates space for it and
@@ -263,10 +317,10 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, size_t initial_rc,
/* Initialize file-specific information for object header */
store_msg_crt_idx = H5F_STORE_MSG_CRT_IDX(f);
- if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_OBJ_HEADER) || store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED))
- oh->version = H5O_VERSION_LATEST;
- else
- oh->version = H5O_VERSION_1;
+
+ if(H5O_set_version(f, oh, oh_flags, store_msg_crt_idx) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set version of objecdt header")
+
oh->sizeof_size = H5F_SIZEOF_SIZE(f);
oh->sizeof_addr = H5F_SIZEOF_ADDR(f);
oh->swmr_write = !!(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE);
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 838a80f..85d7791 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -47,6 +47,8 @@ static herr_t H5O__layout_reset(void *_mesg);
static herr_t H5O__layout_free(void *_mesg);
static herr_t H5O__layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
void *_mesg);
+static herr_t H5O__layout_pre_copy_file(H5F_t *file_src, const void *mesg_src,
+ hbool_t *deleted, const H5O_copy_t *cpy_info, void *udata);
static void *H5O__layout_copy_file(H5F_t *file_src, void *mesg_src,
H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags,
H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id);
@@ -69,7 +71,7 @@ const H5O_msg_class_t H5O_MSG_LAYOUT[1] = {{
NULL, /* link method */
NULL, /* set share method */
NULL, /* can share method */
- NULL, /* pre copy native value to file */
+ H5O__layout_pre_copy_file, /* pre copy native value to file */
H5O__layout_copy_file, /* copy native value to file */
NULL, /* post copy native value to file */
NULL, /* get creation index */
@@ -1045,6 +1047,42 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5O__layout_pre_copy_file
+ *
+ * Purpose: Perform any necessary actions before copying message between
+ * files.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Vailin Choi; Dec 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O__layout_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
+ hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata)
+{
+ const H5O_layout_t *layout_src = (const H5O_layout_t *)mesg_src; /* Source layout */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* check args */
+ HDassert(cpy_info);
+ HDassert(cpy_info->file_dst);
+
+ /* Check to ensure that the version of the message to be copied does not exceed
+ the message version allowed by the destination file's high bound */
+ if(layout_src->version > H5O_layout_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "layout message version out of bounds")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O__layout_pre_copy_file() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O__layout_copy_file
*
* Purpose: Copies a message from _MESG to _DEST in file
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 109d273..498938a 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -63,8 +63,8 @@
)
#define H5O_ALIGN_OH(O, X) \
H5O_ALIGN_VERS((O)->version, X)
-#define H5O_ALIGN_F(F, X) \
- H5O_ALIGN_VERS((H5F_USE_LATEST_FLAGS(F, H5F_LATEST_OBJ_HEADER) ? H5O_VERSION_LATEST : H5O_VERSION_1), X)
+#define H5O_ALIGN_F(F, X) \
+ H5O_ALIGN_VERS(MAX(H5O_VERSION_1, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), X)
/* Size of checksum (on disk) */
#define H5O_SIZEOF_CHKSUM 4
@@ -136,7 +136,7 @@
#define H5O_SIZEOF_MSGHDR_OH(O) \
H5O_SIZEOF_MSGHDR_VERS((O)->version, (O)->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)
#define H5O_SIZEOF_MSGHDR_F(F, C) \
- H5O_SIZEOF_MSGHDR_VERS((H5F_USE_LATEST_FLAGS(F, H5F_LATEST_OBJ_HEADER) || H5F_STORE_MSG_CRT_IDX(F)) ? H5O_VERSION_LATEST : H5O_VERSION_1, (C))
+ H5O_SIZEOF_MSGHDR_VERS(MAX((H5F_STORE_MSG_CRT_IDX(F) ? H5O_VERSION_LATEST : H5O_VERSION_1), (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), (C))
/*
* Size of chunk "header" for each chunk
@@ -556,7 +556,6 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATASET[1];
/* Datatype Object. (H5O_TYPE_NAMED_DATATYPE - 2) */
H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1];
-
/* Package-local function prototypes */
H5_DLL herr_t H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg);
H5_DLL herr_t H5O_flush_msgs(H5F_t *f, H5O_t *oh);
@@ -642,6 +641,16 @@ H5_DLL herr_t H5O_attr_link(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg
H5_DLL herr_t H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
hsize_t *nattrs);
+/* Arrays of versions for:
+ Object header, Layout/Attribute/Datatype/Fill value/Filter pipeline/Dataspace messages */
+H5_DLLVAR const unsigned H5O_obj_ver_bounds[H5F_LIBVER_NBOUNDS];
+H5_DLLVAR const unsigned H5O_layout_ver_bounds[H5F_LIBVER_NBOUNDS];
+H5_DLLVAR const unsigned H5O_attr_ver_bounds[H5F_LIBVER_NBOUNDS];
+H5_DLLVAR const unsigned H5O_dtype_ver_bounds[H5F_LIBVER_NBOUNDS];
+H5_DLLVAR const unsigned H5O_fill_ver_bounds[H5F_LIBVER_NBOUNDS];
+H5_DLLVAR const unsigned H5O_pline_ver_bounds[H5F_LIBVER_NBOUNDS];
+H5_DLLVAR const unsigned H5O_sdspace_ver_bounds[H5F_LIBVER_NBOUNDS];
+
/* Testing functions */
#ifdef H5O_TESTING
H5_DLL htri_t H5O_is_attr_empty_test(hid_t oid);
diff --git a/src/H5Opline.c b/src/H5Opline.c
index 2e52dbb..e817f9a 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -89,6 +89,12 @@ const H5O_msg_class_t H5O_MSG_PLINE[1] = {{
H5O_pline_shared_debug /* debug the message */
}};
+/* Format version bounds for filter pipleline */
+const unsigned H5O_pline_ver_bounds[] = {
+ H5O_PLINE_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_PLINE_VERSION_2, /* H5F_LIBVER_V18 */
+ H5O_PLINE_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
/* Declare a free list to manage the H5O_pline_t struct */
H5FL_DEFINE(H5O_pline_t);
@@ -566,16 +572,23 @@ H5O_pline_free(void *mesg)
*/
static herr_t
H5O_pline_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
- hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t H5_ATTR_UNUSED *cpy_info, void *_udata)
+ hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void *_udata)
{
- const H5O_pline_t *pline_src = (const H5O_pline_t *)mesg_src; /* Source datatype */
+ const H5O_pline_t *pline_src = (const H5O_pline_t *)mesg_src; /* Source pline */
H5O_copy_file_ud_common_t *udata = (H5O_copy_file_ud_common_t *)_udata; /* Object copying user data */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* check args */
HDassert(pline_src);
+ HDassert(cpy_info);
+ HDassert(cpy_info->file_dst);
+
+ /* Check to ensure that the version of the message to be copied does not exceed
+ the message version allowed by the destination file's high bound */
+ if(pline_src->version > H5O_pline_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "pline message version out of bounds")
/* If the user data is non-NULL, assume we are copying a dataset or group
* and make a copy of the filter pipeline for later in
@@ -664,28 +677,38 @@ H5O_pline_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const voi
/*-------------------------------------------------------------------------
- * Function: H5O_pline_set_latest_version
+ * Function: H5O_pline_set_version
*
- * Purpose: Set the encoding for a I/O filter pipeline to the latest version.
+ * Purpose: Set the version to encode an I/O filter pipeline with.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Tuesday, July 24, 2007
+ * Programmer: Vailin Choi; December 2017
*
*-------------------------------------------------------------------------
*/
herr_t
-H5O_pline_set_latest_version(H5O_pline_t *pline)
+H5O_pline_set_version(H5F_t *f, H5O_pline_t *pline)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ unsigned version; /* Message version */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ HDassert(f);
HDassert(pline);
- /* Set encoding of I/O pipeline to latest version */
- pline->version = H5O_PLINE_VERSION_LATEST;
+ /* Upgrade to the version indicated by the file's low bound if higher */
+ version = MAX(pline->version, H5O_pline_ver_bounds[H5F_LOW_BOUND(f)]);
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_pline_set_latest_version() */
+ /* Version bounds check */
+ if(version > H5O_pline_ver_bounds[H5F_HIGH_BOUND(f)])
+ HGOTO_ERROR(H5E_PLINE, H5E_BADRANGE, FAIL, "Filter pipeline version out of bounds")
+
+ /* Set the message version */
+ pline->version = version;
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_pline_set_version() */
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 4b74d8f..2253bb2 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -177,7 +177,12 @@ typedef struct H5O_copy_t {
H5SL_t *dst_dt_list; /* Skip list to hold committed datatypes in dest file */
hbool_t dst_dt_list_complete; /* Whether the destination datatype list is complete (i.e. not only populated with "suggestions" from H5Padd_merge_committed_dtype_path) */
H5O_t *oh_dst; /* The destination object header */
- void *shared_fo; /* The shared pointer for the object */
+ H5F_t *file_dst; /* The destination file pointer */
+ /* This is used in the pre_copy_file callback to obtain
+ the destination file's high bound. The high bound
+ is used to index into the corresponding message's
+ array of versions for doing version bounds check. */
+ void *shared_fo; /* The shared pointer for the src object */
H5O_mcdt_search_cb_t mcdt_cb; /* The callback to invoke before searching the global list of committed datatypes at destination */
void *mcdt_ud; /* User data passed to callback */
} H5O_copy_t;
@@ -967,14 +972,14 @@ H5_DLL hsize_t H5O_efl_total_size(H5O_efl_t *efl);
/* Fill value operators */
H5_DLL herr_t H5O_fill_reset_dyn(H5O_fill_t *fill);
H5_DLL herr_t H5O_fill_convert(H5O_fill_t *fill, H5T_t *type, hbool_t *fill_changed, hid_t dxpl_id);
-H5_DLL herr_t H5O_fill_set_latest_version(H5O_fill_t *fill);
+H5_DLL herr_t H5O_fill_set_version(H5F_t * f, H5O_fill_t *fill);
/* Link operators */
H5_DLL herr_t H5O_link_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
void *_mesg);
/* Filter pipeline operators */
-H5_DLL herr_t H5O_pline_set_latest_version(H5O_pline_t *pline);
+H5_DLL herr_t H5O_pline_set_version(H5F_t *f, H5O_pline_t *pline);
/* Shared message operators */
H5_DLL herr_t H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src);
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 3fe5652..12a9bb6 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -441,7 +441,7 @@ H5O_sdspace_free(void *mesg)
*/
static herr_t
H5O_sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
- hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t H5_ATTR_UNUSED *cpy_info, void *_udata)
+ hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void *_udata)
{
const H5S_extent_t *src_space_extent = (const H5S_extent_t *)mesg_src; /* Source dataspace extent */
H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */
@@ -452,6 +452,13 @@ H5O_sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
/* check args */
HDassert(file_src);
HDassert(src_space_extent);
+ HDassert(cpy_info);
+ HDassert(cpy_info->file_dst);
+
+ /* Check to ensure that the version of the message to be copied does not exceed
+ the message version allowed by the destination file's high bound */
+ if(src_space_extent->version > H5O_sdspace_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "dataspace message version out of bounds")
/* If the user data is non-NULL, assume we are copying a dataset
* and make a copy of the dataspace extent for later in the object copying
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index ea9bfb4..7802535 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -140,11 +140,19 @@
#define H5F_ACS_MULTI_TYPE_DEF H5FD_MEM_DEFAULT
#define H5F_ACS_MULTI_TYPE_ENC H5P__facc_multi_type_enc
#define H5F_ACS_MULTI_TYPE_DEC H5P__facc_multi_type_dec
-/* Definition for 'use latest format version' flag */
-#define H5F_ACS_LATEST_FORMAT_SIZE sizeof(hbool_t)
-#define H5F_ACS_LATEST_FORMAT_DEF FALSE
-#define H5F_ACS_LATEST_FORMAT_ENC H5P__encode_hbool_t
-#define H5F_ACS_LATEST_FORMAT_DEC H5P__decode_hbool_t
+
+/* Definition for "low" bound of library format versions */
+#define H5F_ACS_LIBVER_LOW_BOUND_SIZE sizeof(H5F_libver_t)
+#define H5F_ACS_LIBVER_LOW_BOUND_DEF H5F_LIBVER_EARLIEST
+#define H5F_ACS_LIBVER_LOW_BOUND_ENC H5P__facc_libver_type_enc
+#define H5F_ACS_LIBVER_LOW_BOUND_DEC H5P__facc_libver_type_dec
+
+/* Definition for "high" bound of library format versions */
+#define H5F_ACS_LIBVER_HIGH_BOUND_SIZE sizeof(H5F_libver_t)
+#define H5F_ACS_LIBVER_HIGH_BOUND_DEF H5F_LIBVER_LATEST
+#define H5F_ACS_LIBVER_HIGH_BOUND_ENC H5P__facc_libver_type_enc
+#define H5F_ACS_LIBVER_HIGH_BOUND_DEC H5P__facc_libver_type_dec
+
/* Definition for whether to query the file descriptor from the core VFD
* instead of the memory address. (Private to library)
*/
@@ -288,6 +296,8 @@ static herr_t H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t
static herr_t H5P__facc_fclose_degree_dec(const void **pp, void *value);
static herr_t H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size);
static herr_t H5P__facc_multi_type_dec(const void **_pp, void *value);
+static herr_t H5P__facc_libver_type_enc(const void *value, void **_pp, size_t *size);
+static herr_t H5P__facc_libver_type_dec(const void **_pp, void *value);
/* Metadata cache log location property callbacks */
static herr_t H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size);
@@ -352,7 +362,10 @@ static const hsize_t H5F_def_family_offset_g = H5F_ACS_FAMILY_OFFSET_DEF;
static const hsize_t H5F_def_family_newsize_g = H5F_ACS_FAMILY_NEWSIZE_DEF; /* Default size of new files for family VFD */
static const hbool_t H5F_def_family_to_sec2_g = H5F_ACS_FAMILY_TO_SEC2_DEF; /* Default ?? for family VFD */
static const H5FD_mem_t H5F_def_mem_type_g = H5F_ACS_MULTI_TYPE_DEF; /* Default file space type for multi VFD */
-static const hbool_t H5F_def_latest_format_g = H5F_ACS_LATEST_FORMAT_DEF; /* Default setting for "use the latest version of the format" flag */
+
+static const H5F_libver_t H5F_def_libver_low_bound_g = H5F_ACS_LIBVER_LOW_BOUND_DEF; /* Default setting for "low" bound of format version */
+static const H5F_libver_t H5F_def_libver_high_bound_g = H5F_ACS_LIBVER_HIGH_BOUND_DEF; /* Default setting for "high" bound of format version */
+
static const hbool_t H5F_def_want_posix_fd_g = H5F_ACS_WANT_POSIX_FD_DEF; /* Default setting for retrieving 'handle' from core VFD */
static const unsigned H5F_def_efc_size_g = H5F_ACS_EFC_SIZE_DEF; /* Default external file cache size */
static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMAGE_INFO_DEF; /* Default file image info and callbacks */
@@ -491,9 +504,15 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass)
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the 'use the latest version of the format' flag */
- if(H5P_register_real(pclass, H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &H5F_def_latest_format_g,
- NULL, NULL, NULL, H5F_ACS_LATEST_FORMAT_ENC, H5F_ACS_LATEST_FORMAT_DEC,
+ /* Register the 'low' bound of library format versions */
+ if(H5P_register_real(pclass, H5F_ACS_LIBVER_LOW_BOUND_NAME, H5F_ACS_LIBVER_LOW_BOUND_SIZE, &H5F_def_libver_low_bound_g,
+ NULL, NULL, NULL, H5F_ACS_LIBVER_LOW_BOUND_ENC, H5F_ACS_LIBVER_LOW_BOUND_DEC,
+ NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
+ /* Register the 'high' bound of library format versions */
+ if(H5P_register_real(pclass, H5F_ACS_LIBVER_HIGH_BOUND_NAME, H5F_ACS_LIBVER_HIGH_BOUND_SIZE, &H5F_def_libver_high_bound_g,
+ NULL, NULL, NULL, H5F_ACS_LIBVER_HIGH_BOUND_ENC, H5F_ACS_LIBVER_HIGH_BOUND_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
@@ -2301,7 +2320,25 @@ done:
* releases and then map down to the previous actual library release which
* had a format change.
*
- * Return: Non-negative on success/Negative on failure
+ * Note #3: The enumerated define for H5F_libver_t in 1.10 is:
+ * typedef enum H5F_libver_t {
+ * H5F_LIBVER_ERROR = -1,
+ * H5F_LIBVER_EARLIEST = 0,
+ * H5F_LIBVER_V18 = 1,
+ * H5F_LIBVER_V110 = 2,
+ * H5F_LIBVER_NBOUNDS
+ * } H5F_libver_t;
+ * #define H5F_LIBVER_LATEST H5F_LIBVER_V110
+ *
+ * The library supports five pairs of (low, high) combinations via H5Pset_libver_bounds():
+ * 1) H5F_LIBVER_EARLIEST, H5F_LIBVER_V18
+ * 2) H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST
+ * 4) H5F_LIBVER_V18, H5F_LIBVER_V18
+ * 4) H5F_LIBVER_V18, H5F_LIBVER_LATEST
+ * 5) H5F_LIBVER_LATEST, H5F_LIBVER_LATEST
+ * See detailed description in the RFC: Setting Bounds for Object Creation in HDF5 1.10.0.
+ *
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Sunday, December 30, 2007
@@ -2309,32 +2346,38 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low,
- H5F_libver_t high)
+H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low, H5F_libver_t high)
{
H5P_genplist_t *plist; /* Property list pointer */
- hbool_t latest; /* Whether to use the latest version or not */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iFvFv", plist_id, low, high);
/* Check args */
- /* (Note that this is _really_ restricted right now, we'll want to loosen
- * this up more as we add features - QAK)
- */
- if(high != H5F_LIBVER_LATEST)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid high library version bound")
+ if(low < 0 || low > H5F_LIBVER_LATEST)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "low bound is not valid")
+
+ if(high < 0 || high > H5F_LIBVER_LATEST)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "high bound is not valid")
+
+ /* (earliest, earliest), (latest, earliest), (v18, earliest) are not valid combinations */
+ if(high == H5F_LIBVER_EARLIEST)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid (low,high) combination of library version bound")
+
+ /* (latest, v18) is not valid combination */
+ if(high < low)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid (low,high) combination of library version bound")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Set values */
- latest = (hbool_t)((low == H5F_LIBVER_LATEST) ? TRUE : FALSE);
- if(H5P_set(plist, H5F_ACS_LATEST_FORMAT_NAME, &latest) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set library version bounds")
-
+ if(H5P_set(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &low) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set low bound for library format versions")
+ if(H5P_set(plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &high) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set high bound for library format versions")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_libver_bounds() */
@@ -2343,8 +2386,8 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Pget_libver_bounds
*
- * Purpose: Returns the current settings for the library version format bounds
- * from a file access property list.
+ * Purpose: Returns the current settings for the library version format bounds
+ * from a file access property list.
*
* Return: Non-negative on success/Negative on failure
*
@@ -2358,7 +2401,6 @@ H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low/*out*/,
H5F_libver_t *high/*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
- hbool_t latest; /* Whether to use the latest version or not */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
@@ -2367,17 +2409,17 @@ H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low/*out*/,
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Get values */
+ if(low) {
+ if(H5P_get(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, low) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get low bound for library format versions")
+ }
- /* Get value */
- if(H5P_get(plist, H5F_ACS_LATEST_FORMAT_NAME, &latest) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get library version bounds")
-
- /* Check for setting values to return */
- /* (Again, this is restricted now, we'll need to open it up later -QAK) */
- if(low)
- *low = latest ? H5F_LIBVER_LATEST : H5F_LIBVER_EARLIEST;
- if(high)
- *high = H5F_LIBVER_LATEST;
+ if(high) {
+ if(H5P_get(plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, high) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get high bound for library format versions")
+ }
done:
FUNC_LEAVE_API(ret_value)
@@ -3793,7 +3835,78 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value)
/*-------------------------------------------------------------------------
- * Function: H5Pset_core_write_tracking
+ * Function: H5P__facc_libver_type_enc
+ *
+ * Purpose: Callback routine which is called whenever the 'low' or
+ * 'high' bound of library format versions property in the
+ * file access property list is encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__facc_libver_type_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5F_libver_t *type = (const H5F_libver_t *)value; /* Create local alias for values */
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(type);
+ HDassert(size);
+
+ /* Encode */
+ if(NULL != *pp)
+ *(*pp)++ = (uint8_t)*type;
+
+ /* Size */
+ (*size)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__facc_libver_type_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__facc_libver_type_dec
+ *
+ * Purpose: Callback routine which is called whenever the 'low' or
+ * 'high' bound of library format versions property in the
+ * file access property list is decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__facc_libver_type_dec(const void **_pp, void *_value)
+{
+ H5F_libver_t *type = (H5F_libver_t *)_value;
+ const uint8_t **pp = (const uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(type);
+
+ /* Decode */
+ *type = (H5F_libver_t)*(*pp)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__facc_libver_type_dec() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_core_write_tracking
*
* Purpose: Enables/disables core VFD write tracking and page
* aggregation size.
diff --git a/src/H5S.c b/src/H5S.c
index 9ac40a7..8f3e132 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -57,6 +57,12 @@ static htri_t H5S_is_simple(const H5S_t *sdim);
/* Package initialization variable */
hbool_t H5_PKG_INIT_VAR = FALSE;
+/* Format version bounds for dataspace */
+const unsigned H5O_sdspace_ver_bounds[] = {
+ H5O_SDSPACE_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_SDSPACE_VERSION_2, /* H5F_LIBVER_V18 */
+ H5O_SDSPACE_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
/*****************************/
/* Library Private Variables */
@@ -84,6 +90,7 @@ static const H5I_class_t H5I_DATASPACE_CLS[1] = {{
(H5I_free_t)H5S_close /* Callback routine for closing objects of this class */
}};
+
/* Flag indicating "top" of interface has been initialized */
static hbool_t H5S_top_package_initialize_s = FALSE;
@@ -2167,30 +2174,42 @@ H5S_extent_nelem(const H5S_extent_t *ext)
/*-------------------------------------------------------------------------
- * Function: H5S_set_latest_version
+ * Function: H5S_set_version
*
- * Purpose: Set the encoding for a dataspace to the latest version.
+ * Purpose: Set the version to encode a dataspace with.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Tuesday, July 24, 2007
+ * Programmer: Vailin Choi; December 2017
*
*-------------------------------------------------------------------------
*/
herr_t
-H5S_set_latest_version(H5S_t *ds)
+H5S_set_version(H5F_t *f, H5S_t *ds)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ unsigned version; /* Message version */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ HDassert(f);
HDassert(ds);
- /* Set encoding of extent to latest version */
- ds->extent.version = H5O_SDSPACE_VERSION_LATEST;
+ /* Upgrade to the version indicated by the file's low bound if higher */
+ version = MAX(ds->extent.version, H5O_sdspace_ver_bounds[H5F_LOW_BOUND(f)]);
+
+ /* Version bounds check */
+ if(version > H5O_sdspace_ver_bounds[H5F_HIGH_BOUND(f)])
+ HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "Dataspace version out of bounds")
+
+ /* Set the message version */
+ ds->extent.version = version;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_set_latest_version() */
+} /* end H5S_set_version() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index f125035..bb84ebd 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -219,7 +219,7 @@ H5_DLL herr_t H5S_set_extent_simple(H5S_t *space, unsigned rank,
H5_DLL H5S_t *H5S_create(H5S_class_t type);
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_latest_version(H5S_t *ds);
+H5_DLL herr_t H5S_set_version(H5F_t *f, H5S_t *ds);
H5_DLL herr_t H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc);
H5_DLL H5S_t *H5S_decode(const unsigned char **p);
H5_DLL herr_t H5S_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
diff --git a/src/H5T.c b/src/H5T.c
index a525cd5..eca0132 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -510,6 +510,12 @@ double H5T_NATIVE_DOUBLE_NEG_INF_g = (double)0.0f;
H5FL_DEFINE(H5T_t);
H5FL_DEFINE(H5T_shared_t);
+/* Format version bounds for datatype */
+const unsigned H5O_dtype_ver_bounds[] = {
+ H5O_DTYPE_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V18 */
+ H5O_DTYPE_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
/*******************/
/* Local Variables */
@@ -539,6 +545,7 @@ static const H5I_class_t H5I_DATATYPE_CLS[1] = {{
(H5I_free_t)H5T_close /* Callback routine for closing objects of this class */
}};
+
/* Flag indicating "top" of interface has been initialized */
static hbool_t H5T_top_package_initialize_s = FALSE;
@@ -5403,34 +5410,44 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5T_set_latest_version
+ * Function: H5T_set_version
*
- * Purpose: Set the encoding for a datatype to the latest version.
+ * Purpose: Set the encoding for a datatype to the version indicated by
+ * the file's low bound if that is higher than the datatype's
+ * version.
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Thursday, July 19, 2007
+ * Programmer: Vailin Choi; December 2017
*
*-------------------------------------------------------------------------
*/
herr_t
-H5T_set_latest_version(H5T_t *dt)
+H5T_set_version(H5F_t *f, H5T_t *dt)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned vers; /* The version */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ HDassert(f);
HDassert(dt);
- /* Upgrade the format version for the datatype to the latest */
- if(H5T__upgrade_version(dt, H5O_DTYPE_VERSION_LATEST) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't upgrade datatype encoding")
+ vers = H5O_dtype_ver_bounds[H5F_LOW_BOUND(f)];
+ if(vers > dt->shared->version) {
+ /* Upgrade the format version for the datatype */
+ if(H5T__upgrade_version(dt, vers) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't upgrade datatype encoding")
+ }
+
+ /* Version bounds check */
+ if(dt->shared->version > H5O_dtype_ver_bounds[H5F_HIGH_BOUND(f)])
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "Datatype version out of bounds")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5T_set_latest_version() */
+} /* end H5T_set_version() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 30fbeeb..cd0597c 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -328,9 +328,9 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id)
* a named type should always succeed.
*/
if(H5T_STATE_NAMED == type->shared->state || H5T_STATE_OPEN == type->shared->state)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is already committed")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is already committed")
if(H5T_STATE_IMMUTABLE == type->shared->state)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is immutable")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is immutable")
/* Check for a "sensible" datatype to store on disk */
if(H5T_is_sensible(type) <= 0)
@@ -344,15 +344,14 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id)
/* Reset datatype location and path */
if(H5O_loc_reset(&temp_oloc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize location")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize location")
if(H5G_name_reset(&temp_path) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize path")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize path")
loc_init = TRUE;
- /* Set the latest format, if requested */
- if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATATYPE))
- if(H5T_set_latest_version(type) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
+ /* Set the version for datatype */
+ if(H5T_set_version(file, type) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set version of datatype")
/* Calculate message size infomation, for creating object header */
dtype_size = H5O_msg_size_f(file, tcpl_id, H5O_DTYPE_ID, type, (size_t)0);
@@ -363,15 +362,15 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id)
* type message and then give the object header a name.
*/
if(H5O_create(file, dxpl_id, dtype_size, (size_t)1, tcpl_id, &temp_oloc) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header")
if(H5O_msg_create(&temp_oloc, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, type, dxpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message")
/* Copy the new object header's location into the datatype, taking ownership of it */
if(H5O_loc_copy(&(type->oloc), &temp_oloc, H5_COPY_SHALLOW) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location")
if(H5G_name_copy(&(type->path), &temp_path, H5_COPY_SHALLOW) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location")
loc_init = FALSE;
/* Set the shared info fields */
@@ -400,12 +399,12 @@ done:
if((type->shared->state == H5T_STATE_TRANSIENT || type->shared->state == H5T_STATE_RDONLY) && (type->sh_loc.type == H5O_SHARE_TYPE_COMMITTED)) {
if(H5O_dec_rc_by_loc(&(type->oloc), dxpl_id) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object")
- if(H5O_close(&(type->oloc), NULL) < 0)
+ if(H5O_close(&(type->oloc), NULL) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release object header")
if(H5O_delete(file, dxpl_id, type->sh_loc.u.loc.oh_addr) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to delete object header")
- type->sh_loc.type = H5O_SHARE_TYPE_UNSHARED;
- } /* end if */
+ type->sh_loc.type = H5O_SHARE_TYPE_UNSHARED;
+ } /* end if */
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 9171e1e..5272361 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -136,7 +136,7 @@ H5_DLL herr_t H5T_vlen_get_alloc_info(hid_t dxpl_id, H5T_vlen_alloc_info_t **vl_
H5_DLL htri_t H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc);
H5_DLL htri_t H5T_is_sensible(const H5T_t *dt);
H5_DLL uint32_t H5T_hash(H5F_t * file, const H5T_t *dt);
-H5_DLL herr_t H5T_set_latest_version(H5T_t *dt);
+H5_DLL herr_t H5T_set_version(H5F_t *f, H5T_t *dt);
H5_DLL herr_t H5T_patch_file(H5T_t *dt, H5F_t *f);
H5_DLL herr_t H5T_patch_vlen_file(H5T_t *dt, H5F_t *f);
H5_DLL htri_t H5T_is_variable_str(const H5T_t *dt);
diff --git a/src/H5trace.c b/src/H5trace.c
index 7bc2724..32e05a7 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -174,26 +174,26 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
if(H5_debug_g.ttimes) {
char tmp[128];
- sprintf(tmp, "%.6f", event_time.etime-first_time.etime);
- fprintf(out, " %*s ", (int)HDstrlen(tmp), "");
+ HDsprintf(tmp, "%.6f", event_time.etime-first_time.etime);
+ HDfprintf(out, " %*s ", (int)HDstrlen(tmp), "");
} /* end if */
for(i = 0; i < current_depth; i++)
HDfputc('+', out);
- fprintf(out, "%*s%s = ", 2*current_depth, "", func);
+ HDfprintf(out, "%*s%s = ", 2*current_depth, "", func);
} /* end if */
else {
/* Continue current line with return value */
- fprintf(out, " = ");
+ HDfprintf(out, " = ");
} /* end else */
} /* end if */
else {
if(current_depth>last_call_depth)
HDfputs(" = <delayed>\n", out);
if(H5_debug_g.ttimes)
- fprintf(out, "@%.6f ", event_time.etime - first_time.etime);
+ HDfprintf(out, "@%.6f ", event_time.etime - first_time.etime);
for(i = 0; i < current_depth; i++)
HDfputc('+', out);
- fprintf(out, "%*s%s(", 2*current_depth, "", func);
+ HDfprintf(out, "%*s%s(", 2*current_depth, "", func);
} /* end else */
/* Clear array sizes */
@@ -235,7 +235,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
buf[MIN((int)sizeof(buf) - 1, n)] = '\0';
argname = buf;
} /* end if */
- fprintf(out, "%s%s=", argno?", ":"", argname);
+ HDfprintf(out, "%s%s=", argno?", ":"", argname);
} /* end if */
else
argname = "";
@@ -247,9 +247,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'a':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
haddr_t addr = va_arg(ap, haddr_t);
@@ -261,33 +261,33 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'b':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
/* Can't pass hbool_t to va_arg() */
hbool_t bool_var = (hbool_t)va_arg(ap, int);
if(TRUE == bool_var)
- fprintf(out, "TRUE");
+ HDfprintf(out, "TRUE");
else if(!bool_var)
- fprintf(out, "FALSE");
+ HDfprintf(out, "FALSE");
else
- fprintf(out, "TRUE(%u)", (unsigned)bool_var);
+ HDfprintf(out, "TRUE(%u)", (unsigned)bool_var);
}
break;
case 'd':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
double dbl = va_arg(ap, double);
- fprintf(out, "%g", dbl);
+ HDfprintf(out, "%g", dbl);
} /* end else */
break;
@@ -296,36 +296,36 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'a':
if(ptr) {
if(vp)
- fprintf (out, "0x%lx", (unsigned long)vp);
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_alloc_time_t alloc_time = (H5D_alloc_time_t)va_arg(ap, int);
switch(alloc_time) {
case H5D_ALLOC_TIME_ERROR:
- fprintf(out, "H5D_ALLOC_TIME_ERROR");
+ HDfprintf(out, "H5D_ALLOC_TIME_ERROR");
break;
case H5D_ALLOC_TIME_DEFAULT:
- fprintf(out, "H5D_ALLOC_TIME_DEFAULT");
+ HDfprintf(out, "H5D_ALLOC_TIME_DEFAULT");
break;
case H5D_ALLOC_TIME_EARLY:
- fprintf(out, "H5D_ALLOC_TIME_EARLY");
+ HDfprintf(out, "H5D_ALLOC_TIME_EARLY");
break;
case H5D_ALLOC_TIME_LATE:
- fprintf(out, "H5D_ALLOC_TIME_LATE");
+ HDfprintf(out, "H5D_ALLOC_TIME_LATE");
break;
case H5D_ALLOC_TIME_INCR:
- fprintf(out, "H5D_ALLOC_TIME_INCR");
+ HDfprintf(out, "H5D_ALLOC_TIME_INCR");
break;
default:
- fprintf(out, "%ld", (long)alloc_time);
+ HDfprintf(out, "%ld", (long)alloc_time);
break;
} /* end switch */
} /* end else */
@@ -334,24 +334,24 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'c':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5FD_mpio_collective_opt_t opt = (H5FD_mpio_collective_opt_t)va_arg(ap, int);
switch(opt) {
case H5FD_MPIO_COLLECTIVE_IO:
- fprintf(out, "H5FD_MPIO_COLLECTIVE_IO");
+ HDfprintf(out, "H5FD_MPIO_COLLECTIVE_IO");
break;
case H5FD_MPIO_INDIVIDUAL_IO:
- fprintf(out, "H5FD_MPIO_INDIVIDUAL_IO");
+ HDfprintf(out, "H5FD_MPIO_INDIVIDUAL_IO");
break;
default:
- fprintf(out, "%ld", (long)opt);
+ HDfprintf(out, "%ld", (long)opt);
break;
} /* end switch */
} /* end else */
@@ -360,32 +360,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'f':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_fill_time_t fill_time = (H5D_fill_time_t)va_arg(ap, int);
switch(fill_time) {
case H5D_FILL_TIME_ERROR:
- fprintf(out, "H5D_FILL_TIME_ERROR");
+ HDfprintf(out, "H5D_FILL_TIME_ERROR");
break;
case H5D_FILL_TIME_ALLOC:
- fprintf(out, "H5D_FILL_TIME_ALLOC");
+ HDfprintf(out, "H5D_FILL_TIME_ALLOC");
break;
case H5D_FILL_TIME_NEVER:
- fprintf(out, "H5D_FILL_TIME_NEVER");
+ HDfprintf(out, "H5D_FILL_TIME_NEVER");
break;
case H5D_FILL_TIME_IFSET:
- fprintf(out, "H5D_FILL_TIME_IFSET");
+ HDfprintf(out, "H5D_FILL_TIME_IFSET");
break;
default:
- fprintf(out, "%ld", (long)fill_time);
+ HDfprintf(out, "%ld", (long)fill_time);
break;
} /* end switch */
} /* end else */
@@ -394,32 +394,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'F':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_fill_value_t fill_value = (H5D_fill_value_t)va_arg(ap, int);
switch(fill_value) {
case H5D_FILL_VALUE_ERROR:
- fprintf(out, "H5D_FILL_VALUE_ERROR");
+ HDfprintf(out, "H5D_FILL_VALUE_ERROR");
break;
case H5D_FILL_VALUE_UNDEFINED:
- fprintf(out, "H5D_FILL_VALUE_UNDEFINED");
+ HDfprintf(out, "H5D_FILL_VALUE_UNDEFINED");
break;
case H5D_FILL_VALUE_DEFAULT:
- fprintf(out, "H5D_FILL_VALUE_DEFAULT");
+ HDfprintf(out, "H5D_FILL_VALUE_DEFAULT");
break;
case H5D_FILL_VALUE_USER_DEFINED:
- fprintf(out, "H5D_FILL_VALUE_USER_DEFINED");
+ HDfprintf(out, "H5D_FILL_VALUE_USER_DEFINED");
break;
default:
- fprintf(out, "%ld", (long)fill_value);
+ HDfprintf(out, "%ld", (long)fill_value);
break;
} /* end switch */
} /* end else */
@@ -428,28 +428,28 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'h':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5FD_mpio_chunk_opt_t opt = (H5FD_mpio_chunk_opt_t)va_arg(ap, int);
switch(opt) {
case H5FD_MPIO_CHUNK_DEFAULT:
- fprintf(out, "H5FD_MPIO_CHUNK_DEFAULT");
+ HDfprintf(out, "H5FD_MPIO_CHUNK_DEFAULT");
break;
case H5FD_MPIO_CHUNK_ONE_IO:
- fprintf(out, "H5FD_MPIO_CHUNK_ONE_IO");
+ HDfprintf(out, "H5FD_MPIO_CHUNK_ONE_IO");
break;
case H5FD_MPIO_CHUNK_MULTI_IO:
- fprintf(out, "H5FD_MPIO_CHUNK_MULTI_IO");
+ HDfprintf(out, "H5FD_MPIO_CHUNK_MULTI_IO");
break;
default:
- fprintf(out, "%ld", (long)opt);
+ HDfprintf(out, "%ld", (long)opt);
break;
} /* end switch */
} /* end else */
@@ -458,36 +458,36 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'i':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_mpio_actual_io_mode_t actual_io_mode = (H5D_mpio_actual_io_mode_t)va_arg(ap, int);
switch(actual_io_mode) {
case H5D_MPIO_NO_COLLECTIVE:
- fprintf(out, "H5D_MPIO_NO_COLLECTIVE");
+ HDfprintf(out, "H5D_MPIO_NO_COLLECTIVE");
break;
case H5D_MPIO_CHUNK_INDEPENDENT:
- fprintf(out, "H5D_MPIO_CHUNK_INDEPENDENT");
+ HDfprintf(out, "H5D_MPIO_CHUNK_INDEPENDENT");
break;
case H5D_MPIO_CHUNK_COLLECTIVE:
- fprintf(out, "H5D_MPIO_CHUNK_COLLECTIVE");
+ HDfprintf(out, "H5D_MPIO_CHUNK_COLLECTIVE");
break;
case H5D_MPIO_CHUNK_MIXED:
- fprintf(out, "H5D_MPIO_CHUNK_MIXED");
+ HDfprintf(out, "H5D_MPIO_CHUNK_MIXED");
break;
case H5D_MPIO_CONTIGUOUS_COLLECTIVE:
- fprintf(out, "H5D_MPIO_CONTIGUOUS_COLLECTIVE");
+ HDfprintf(out, "H5D_MPIO_CONTIGUOUS_COLLECTIVE");
break;
default:
- fprintf(out, "%ld", (long)actual_io_mode);
+ HDfprintf(out, "%ld", (long)actual_io_mode);
break;
} /* end switch */
} /* end else */
@@ -496,44 +496,44 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'k':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_chunk_index_t idx = (H5D_chunk_index_t)va_arg(ap, int);
switch(idx) {
case H5D_CHUNK_IDX_BTREE:
- fprintf(out, "H5D_CHUNK_IDX_BTREE");
+ HDfprintf(out, "H5D_CHUNK_IDX_BTREE");
break;
case H5D_CHUNK_IDX_NONE:
- fprintf(out, "H5D_CHUNK_IDX_NONE");
+ HDfprintf(out, "H5D_CHUNK_IDX_NONE");
break;
case H5D_CHUNK_IDX_FARRAY:
- fprintf(out, "H5D_CHUNK_IDX_FARRAY");
+ HDfprintf(out, "H5D_CHUNK_IDX_FARRAY");
break;
case H5D_CHUNK_IDX_EARRAY:
- fprintf(out, "H5D_CHUNK_IDX_EARRAY");
+ HDfprintf(out, "H5D_CHUNK_IDX_EARRAY");
break;
case H5D_CHUNK_IDX_BT2:
- fprintf(out, "H5D_CHUNK_IDX_BT2");
+ HDfprintf(out, "H5D_CHUNK_IDX_BT2");
break;
case H5D_CHUNK_IDX_SINGLE:
- fprintf(out, "H5D_CHUNK_IDX_SINGLE");
+ HDfprintf(out, "H5D_CHUNK_IDX_SINGLE");
break;
case H5D_CHUNK_IDX_NTYPES:
- fprintf(out, "ERROR: H5D_CHUNK_IDX_NTYPES (invalid value)");
+ HDfprintf(out, "ERROR: H5D_CHUNK_IDX_NTYPES (invalid value)");
break;
default:
- fprintf(out, "UNKNOWN VALUE: %ld", (long)idx);
+ HDfprintf(out, "UNKNOWN VALUE: %ld", (long)idx);
break;
} /* end switch */
} /* end else */
@@ -542,40 +542,40 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'l':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_layout_t layout = (H5D_layout_t)va_arg(ap, int);
switch(layout) {
case H5D_LAYOUT_ERROR:
- fprintf(out, "H5D_LAYOUT_ERROR");
+ HDfprintf(out, "H5D_LAYOUT_ERROR");
break;
case H5D_COMPACT:
- fprintf(out, "H5D_COMPACT");
+ HDfprintf(out, "H5D_COMPACT");
break;
case H5D_CONTIGUOUS:
- fprintf(out, "H5D_CONTIGUOUS");
+ HDfprintf(out, "H5D_CONTIGUOUS");
break;
case H5D_CHUNKED:
- fprintf(out, "H5D_CHUNKED");
+ HDfprintf(out, "H5D_CHUNKED");
break;
case H5D_VIRTUAL:
- fprintf(out, "H5D_VIRTUAL");
+ HDfprintf(out, "H5D_VIRTUAL");
break;
case H5D_NLAYOUTS:
- fprintf(out, "H5D_NLAYOUTS");
+ HDfprintf(out, "H5D_NLAYOUTS");
break;
default:
- fprintf(out, "%ld", (long)layout);
+ HDfprintf(out, "%ld", (long)layout);
break;
} /* end switch */
} /* end else */
@@ -584,9 +584,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'n':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_mpio_no_collective_cause_t nocol_cause_mode = (H5D_mpio_no_collective_cause_t)va_arg(ap, int);
@@ -594,65 +594,65 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
/* Check for all bit-flags which might be set */
if(nocol_cause_mode & H5D_MPIO_COLLECTIVE) {
- fprintf(out, "H5D_MPIO_COLLECTIVE");
+ HDfprintf(out, "H5D_MPIO_COLLECTIVE");
flag_already_displayed = TRUE;
} /* end if */
if(nocol_cause_mode & H5D_MPIO_SET_INDEPENDENT) {
- fprintf(out, "%sH5D_MPIO_SET_INDEPENDENT", flag_already_displayed ? " | " : "");
+ HDfprintf(out, "%sH5D_MPIO_SET_INDEPENDENT", flag_already_displayed ? " | " : "");
flag_already_displayed = TRUE;
} /* end if */
if(nocol_cause_mode & H5D_MPIO_DATATYPE_CONVERSION) {
- fprintf(out, "%sH5D_MPIO_DATATYPE_CONVERSION", flag_already_displayed ? " | " : "");
+ HDfprintf(out, "%sH5D_MPIO_DATATYPE_CONVERSION", flag_already_displayed ? " | " : "");
flag_already_displayed = TRUE;
} /* end if */
if(nocol_cause_mode & H5D_MPIO_DATA_TRANSFORMS) {
- fprintf(out, "%sH5D_MPIO_DATA_TRANSFORMS", flag_already_displayed ? " | " : "");
+ HDfprintf(out, "%sH5D_MPIO_DATA_TRANSFORMS", flag_already_displayed ? " | " : "");
flag_already_displayed = TRUE;
} /* end if */
if(nocol_cause_mode & H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED) {
- fprintf(out, "%sH5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED", flag_already_displayed ? " | " : "");
+ HDfprintf(out, "%sH5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED", flag_already_displayed ? " | " : "");
flag_already_displayed = TRUE;
} /* end if */
if(nocol_cause_mode & H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES) {
- fprintf(out, "%sH5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES", flag_already_displayed ? " | " : "");
+ HDfprintf(out, "%sH5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES", flag_already_displayed ? " | " : "");
flag_already_displayed = TRUE;
} /* end if */
if(nocol_cause_mode & H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET) {
- fprintf(out, "%sH5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET", flag_already_displayed ? " | " : "");
+ HDfprintf(out, "%sH5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET", flag_already_displayed ? " | " : "");
flag_already_displayed = TRUE;
} /* end if */
/* Display '<none>' if there's no flags set */
if(!flag_already_displayed)
- fprintf(out, "<none>");
+ HDfprintf(out, "<none>");
} /* end else */
break;
case 'o':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_mpio_actual_chunk_opt_mode_t chunk_opt_mode = (H5D_mpio_actual_chunk_opt_mode_t)va_arg(ap, int);
switch(chunk_opt_mode) {
case H5D_MPIO_NO_CHUNK_OPTIMIZATION:
- fprintf(out, "H5D_MPIO_NO_CHUNK_OPTIMIZATION");
+ HDfprintf(out, "H5D_MPIO_NO_CHUNK_OPTIMIZATION");
break;
case H5D_MPIO_LINK_CHUNK:
- fprintf(out, "H5D_MPIO_LINK_CHUNK");
+ HDfprintf(out, "H5D_MPIO_LINK_CHUNK");
break;
case H5D_MPIO_MULTI_CHUNK:
- fprintf(out, "H5D_MPIO_MULTI_CHUNK");
+ HDfprintf(out, "H5D_MPIO_MULTI_CHUNK");
break;
default:
- fprintf(out, "%ld", (long)chunk_opt_mode);
+ HDfprintf(out, "%ld", (long)chunk_opt_mode);
break;
} /* end switch */
} /* end else */
@@ -661,32 +661,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_space_status_t space_status = (H5D_space_status_t)va_arg(ap, int);
switch(space_status) {
case H5D_SPACE_STATUS_NOT_ALLOCATED:
- fprintf(out, "H5D_SPACE_STATUS_NOT_ALLOCATED");
+ HDfprintf(out, "H5D_SPACE_STATUS_NOT_ALLOCATED");
break;
case H5D_SPACE_STATUS_PART_ALLOCATED:
- fprintf(out, "H5D_SPACE_STATUS_PART_ALLOCATED");
+ HDfprintf(out, "H5D_SPACE_STATUS_PART_ALLOCATED");
break;
case H5D_SPACE_STATUS_ALLOCATED:
- fprintf(out, "H5D_SPACE_STATUS_ALLOCATED");
+ HDfprintf(out, "H5D_SPACE_STATUS_ALLOCATED");
break;
case H5D_SPACE_STATUS_ERROR:
- fprintf(out, "H5D_SPACE_STATUS_ERROR");
+ HDfprintf(out, "H5D_SPACE_STATUS_ERROR");
break;
default:
- fprintf(out, "%ld", (long)space_status);
+ HDfprintf(out, "%ld", (long)space_status);
break;
} /* end switch */
} /* end else */
@@ -695,24 +695,24 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5FD_mpio_xfer_t transfer = (H5FD_mpio_xfer_t)va_arg(ap, int);
switch(transfer) {
case H5FD_MPIO_INDEPENDENT:
- fprintf(out, "H5FD_MPIO_INDEPENDENT");
+ HDfprintf(out, "H5FD_MPIO_INDEPENDENT");
break;
case H5FD_MPIO_COLLECTIVE:
- fprintf(out, "H5FD_MPIO_COLLECTIVE");
+ HDfprintf(out, "H5FD_MPIO_COLLECTIVE");
break;
default:
- fprintf(out, "%ld", (long)transfer);
+ HDfprintf(out, "%ld", (long)transfer);
break;
} /* end switch */
} /* end else */
@@ -721,35 +721,35 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'v':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_vds_view_t view = (H5D_vds_view_t)va_arg(ap, int);
switch(view) {
case H5D_VDS_ERROR:
- fprintf(out, "H5D_VDS_ERROR");
+ HDfprintf(out, "H5D_VDS_ERROR");
break;
case H5D_VDS_FIRST_MISSING:
- fprintf(out, "H5D_VDS_FIRST_MISSING");
+ HDfprintf(out, "H5D_VDS_FIRST_MISSING");
break;
case H5D_VDS_LAST_AVAILABLE:
- fprintf(out, "H5D_VDS_LAST_AVAILABLE");
+ HDfprintf(out, "H5D_VDS_LAST_AVAILABLE");
break;
default:
- fprintf(out, "%ld", (long)view);
+ HDfprintf(out, "%ld", (long)view);
break;
} /* end switch */
} /* end else */
break;
default:
- fprintf (out, "BADTYPE(D%c)", type[1]);
+ HDfprintf (out, "BADTYPE(D%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -757,17 +757,17 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'e':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
herr_t status = va_arg(ap, herr_t);
if(status >= 0)
- fprintf(out, "SUCCEED");
+ HDfprintf(out, "SUCCEED");
else
- fprintf(out, "FAIL");
+ HDfprintf(out, "FAIL");
} /* end else */
break;
@@ -776,24 +776,24 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'd':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5E_direction_t direction = (H5E_direction_t)va_arg(ap, int);
switch(direction) {
case H5E_WALK_UPWARD:
- fprintf(out, "H5E_WALK_UPWARD");
+ HDfprintf(out, "H5E_WALK_UPWARD");
break;
case H5E_WALK_DOWNWARD:
- fprintf(out, "H5E_WALK_DOWNWARD");
+ HDfprintf(out, "H5E_WALK_DOWNWARD");
break;
default:
- fprintf(out, "%ld", (long)direction);
+ HDfprintf(out, "%ld", (long)direction);
break;
} /* end switch */
} /* end else */
@@ -802,45 +802,45 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'e':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5E_error2_t *error = va_arg(ap, H5E_error2_t *);
- fprintf(out, "0x%lx", (unsigned long)error);
+ HDfprintf(out, "0x%lx", (unsigned long)error);
} /* end else */
break;
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5E_type_t etype = (H5E_type_t)va_arg(ap, int);
switch(etype) {
case H5E_MAJOR:
- fprintf(out, "H5E_MAJOR");
+ HDfprintf(out, "H5E_MAJOR");
break;
case H5E_MINOR:
- fprintf(out, "H5E_MINOR");
+ HDfprintf(out, "H5E_MINOR");
break;
default:
- fprintf(out, "%ld", (long)etype);
+ HDfprintf(out, "%ld", (long)etype);
break;
} /* end switch */
} /* end else */
break;
default:
- fprintf(out, "BADTYPE(E%c)", type[1]);
+ HDfprintf(out, "BADTYPE(E%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -850,32 +850,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'd':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5F_close_degree_t degree = (H5F_close_degree_t)va_arg(ap, int);
switch(degree) {
case H5F_CLOSE_DEFAULT:
- fprintf(out, "H5F_CLOSE_DEFAULT");
+ HDfprintf(out, "H5F_CLOSE_DEFAULT");
break;
case H5F_CLOSE_WEAK:
- fprintf(out, "H5F_CLOSE_WEAK");
+ HDfprintf(out, "H5F_CLOSE_WEAK");
break;
case H5F_CLOSE_SEMI:
- fprintf(out, "H5F_CLOSE_SEMI");
+ HDfprintf(out, "H5F_CLOSE_SEMI");
break;
case H5F_CLOSE_STRONG:
- fprintf(out, "H5F_CLOSE_STRONG");
+ HDfprintf(out, "H5F_CLOSE_STRONG");
break;
default:
- fprintf(out, "%ld", (long)degree);
+ HDfprintf(out, "%ld", (long)degree);
break;
} /* end switch */
} /* end else */
@@ -884,33 +884,33 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'f':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5F_fspace_strategy_t fs_strategy = (H5F_fspace_strategy_t)va_arg(ap, int);
switch(fs_strategy) {
case H5F_FSPACE_STRATEGY_FSM_AGGR:
- fprintf(out, "H5F_FSPACE_STRATEGY_FSM_AGGR");
+ HDfprintf(out, "H5F_FSPACE_STRATEGY_FSM_AGGR");
break;
case H5F_FSPACE_STRATEGY_PAGE:
- fprintf(out, "H5F_FSPACE_STRATEGY_PAGE");
+ HDfprintf(out, "H5F_FSPACE_STRATEGY_PAGE");
break;
case H5F_FSPACE_STRATEGY_AGGR:
- fprintf(out, "H5F_FSPACE_STRATEGY_AGGR");
+ HDfprintf(out, "H5F_FSPACE_STRATEGY_AGGR");
break;
case H5F_FSPACE_STRATEGY_NONE:
- fprintf(out, "H5F_FSPACE_STRATEGY_NONE");
+ HDfprintf(out, "H5F_FSPACE_STRATEGY_NONE");
break;
case H5F_FSPACE_STRATEGY_NTYPES:
default:
- fprintf(out, "%ld", (long)fs_strategy);
+ HDfprintf(out, "%ld", (long)fs_strategy);
break;
} /* end switch */
} /* end else */
@@ -919,49 +919,49 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'm':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5F_mem_t mem_type = (H5F_mem_t)va_arg(ap, int);
switch(mem_type) {
case H5FD_MEM_NOLIST:
- fprintf(out, "H5FD_MEM_NOLIST");
+ HDfprintf(out, "H5FD_MEM_NOLIST");
break;
case H5FD_MEM_DEFAULT:
- fprintf(out, "H5FD_MEM_DEFAULT");
+ HDfprintf(out, "H5FD_MEM_DEFAULT");
break;
case H5FD_MEM_SUPER:
- fprintf(out, "H5FD_MEM_SUPER");
+ HDfprintf(out, "H5FD_MEM_SUPER");
break;
case H5FD_MEM_BTREE:
- fprintf(out, "H5FD_MEM_BTREE");
+ HDfprintf(out, "H5FD_MEM_BTREE");
break;
case H5FD_MEM_DRAW:
- fprintf(out, "H5FD_MEM_DRAW");
+ HDfprintf(out, "H5FD_MEM_DRAW");
break;
case H5FD_MEM_GHEAP:
- fprintf(out, "H5FD_MEM_GHEAP");
+ HDfprintf(out, "H5FD_MEM_GHEAP");
break;
case H5FD_MEM_LHEAP:
- fprintf(out, "H5FD_MEM_LHEAP");
+ HDfprintf(out, "H5FD_MEM_LHEAP");
break;
case H5FD_MEM_OHDR:
- fprintf(out, "H5FD_MEM_OHDR");
+ HDfprintf(out, "H5FD_MEM_OHDR");
break;
case H5FD_MEM_NTYPES:
default:
- fprintf(out, "%ld", (long)mem_type);
+ HDfprintf(out, "%ld", (long)mem_type);
break;
} /* end switch */
} /* end else */
@@ -970,24 +970,24 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5F_scope_t scope = (H5F_scope_t)va_arg(ap, int);
switch(scope) {
case H5F_SCOPE_LOCAL:
- fprintf(out, "H5F_SCOPE_LOCAL");
+ HDfprintf(out, "H5F_SCOPE_LOCAL");
break;
case H5F_SCOPE_GLOBAL:
- fprintf(out, "H5F_SCOPE_GLOBAL");
+ HDfprintf(out, "H5F_SCOPE_GLOBAL");
break;
default:
- fprintf(out, "%ld", (long)scope);
+ HDfprintf(out, "%ld", (long)scope);
break;
} /* end switch */
} /* end else */
@@ -996,40 +996,47 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
break;
case 'v':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5F_libver_t libver_vers = (H5F_libver_t)va_arg(ap, int);
switch(libver_vers) {
case H5F_LIBVER_EARLIEST:
- fprintf(out, "H5F_LIBVER_EARLIEST");
+ HDfprintf(out, "H5F_LIBVER_EARLIEST");
break;
- case H5F_LIBVER_LATEST:
- fprintf(out, "H5F_LIBVER_LATEST");
+ case H5F_LIBVER_V18:
+ HDfprintf(out, "H5F_LIBVER_V18");
break;
+ case H5F_LIBVER_V110:
+ HDcompile_assert(H5F_LIBVER_LATEST == H5F_LIBVER_V110);
+ HDfprintf(out, "H5F_LIBVER_LATEST");
+ break;
+
+ case H5F_LIBVER_ERROR:
+ case H5F_LIBVER_NBOUNDS:
default:
- fprintf(out, "%ld", (long)libver_vers);
+ HDfprintf(out, "%ld", (long)libver_vers);
break;
} /* end switch */
} /* end else */
break;
default:
- fprintf(out, "BADTYPE(F%c)", type[1]);
+ HDfprintf(out, "BADTYPE(F%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -1040,46 +1047,46 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'o':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5G_obj_t obj_type = (H5G_obj_t)va_arg(ap, int);
switch(obj_type) {
case H5G_UNKNOWN:
- fprintf(out, "H5G_UNKNOWN");
+ HDfprintf(out, "H5G_UNKNOWN");
break;
case H5G_GROUP:
- fprintf(out, "H5G_GROUP");
+ HDfprintf(out, "H5G_GROUP");
break;
case H5G_DATASET:
- fprintf(out, "H5G_DATASET");
+ HDfprintf(out, "H5G_DATASET");
break;
case H5G_TYPE:
- fprintf(out, "H5G_TYPE");
+ HDfprintf(out, "H5G_TYPE");
break;
case H5G_LINK:
- fprintf(out, "H5G_LINK");
+ HDfprintf(out, "H5G_LINK");
break;
case H5G_UDLINK:
- fprintf(out, "H5G_UDLINK");
+ HDfprintf(out, "H5G_UDLINK");
break;
case H5G_RESERVED_5:
case H5G_RESERVED_6:
case H5G_RESERVED_7:
- fprintf(out, "H5G_RESERVED(%ld)", (long)obj_type);
+ HDfprintf(out, "H5G_RESERVED(%ld)", (long)obj_type);
break;
default:
- fprintf(out, "%ld", (long)obj_type);
+ HDfprintf(out, "%ld", (long)obj_type);
break;
} /* end switch */
} /* end else */
@@ -1088,20 +1095,20 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if(ptr) {
if(vp)
- fprintf (out, "0x%lx", (unsigned long)vp);
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5G_stat_t *statbuf = va_arg(ap, H5G_stat_t*);
- fprintf(out, "0x%lx", (unsigned long)statbuf);
+ HDfprintf(out, "0x%lx", (unsigned long)statbuf);
}
break;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
default:
- fprintf(out, "BADTYPE(G%c)", type[1]);
+ HDfprintf(out, "BADTYPE(G%c)", type[1]);
goto error;
}
break;
@@ -1109,22 +1116,22 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'h':
if(ptr) {
if(vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
if(asize_idx >= 0 && asize[asize_idx] >= 0) {
hsize_t *p = (hsize_t *)vp;
- fprintf(out, " {");
+ HDfprintf(out, " {");
for(i = 0; i < asize[asize_idx]; i++) {
if(H5S_UNLIMITED == p[i])
HDfprintf(out, "%sH5S_UNLIMITED", (i ? ", " : ""));
else
HDfprintf(out, "%s%Hu", (i ? ", " : ""), p[i]);
} /* end for */
- fprintf(out, "}");
+ HDfprintf(out, "}");
} /* end if */
} /* end if */
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
hsize_t hsize = va_arg(ap, hsize_t);
@@ -1143,18 +1150,18 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if(ptr) {
if(vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
if(asize_idx >= 0 && asize[asize_idx] >= 0) {
hssize_t *p = (hssize_t *)vp;
- fprintf(out, " {");
+ HDfprintf(out, " {");
for(i = 0; i < asize[asize_idx]; i++)
HDfprintf(out, "%s%Hd", (i ? ", " : ""), p[i]);
- fprintf(out, "}");
+ HDfprintf(out, "}");
} /* end if */
} /* end if */
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
hssize_t hssize = va_arg(ap, hssize_t);
@@ -1165,7 +1172,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
break;
default:
- fprintf (out, "BADTYPE(H%c)", type[1]);
+ HDfprintf (out, "BADTYPE(H%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -1173,130 +1180,130 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'i':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
hid_t obj = va_arg(ap, hid_t);
if(H5P_DEFAULT == obj)
- fprintf(out, "H5P_DEFAULT");
+ HDfprintf(out, "H5P_DEFAULT");
else if(obj < 0)
- fprintf(out, "FAIL");
+ HDfprintf(out, "FAIL");
else {
switch(H5I_TYPE(obj)) { /* Use internal H5I macro instead of function call */
case H5I_UNINIT:
- fprintf(out, "%ld (uninit - error)", (long)obj);
+ HDfprintf(out, "%ld (uninit - error)", (long)obj);
break;
case H5I_BADID:
- fprintf(out, "%ld (error)", (long)obj);
+ HDfprintf(out, "%ld (error)", (long)obj);
break;
case H5I_FILE:
- fprintf(out, "%ld (file)", (long)obj);
+ HDfprintf(out, "%ld (file)", (long)obj);
break;
case H5I_GROUP:
- fprintf(out, "%ld (group)", (long)obj);
+ HDfprintf(out, "%ld (group)", (long)obj);
break;
case H5I_DATATYPE:
if(obj == H5T_NATIVE_SCHAR_g)
- fprintf(out, "H5T_NATIVE_SCHAR");
+ HDfprintf(out, "H5T_NATIVE_SCHAR");
else if(obj == H5T_NATIVE_UCHAR_g)
- fprintf(out, "H5T_NATIVE_UCHAR");
+ HDfprintf(out, "H5T_NATIVE_UCHAR");
else if(obj == H5T_NATIVE_SHORT_g)
- fprintf(out, "H5T_NATIVE_SHORT");
+ HDfprintf(out, "H5T_NATIVE_SHORT");
else if(obj == H5T_NATIVE_USHORT_g)
- fprintf(out, "H5T_NATIVE_USHORT");
+ HDfprintf(out, "H5T_NATIVE_USHORT");
else if(obj == H5T_NATIVE_INT_g)
- fprintf(out, "H5T_NATIVE_INT");
+ HDfprintf(out, "H5T_NATIVE_INT");
else if(obj == H5T_NATIVE_UINT_g)
- fprintf(out, "H5T_NATIVE_UINT");
+ HDfprintf(out, "H5T_NATIVE_UINT");
else if(obj == H5T_NATIVE_LONG_g)
- fprintf(out, "H5T_NATIVE_LONG");
+ HDfprintf(out, "H5T_NATIVE_LONG");
else if(obj == H5T_NATIVE_ULONG_g)
- fprintf(out, "H5T_NATIVE_ULONG");
+ HDfprintf(out, "H5T_NATIVE_ULONG");
else if(obj == H5T_NATIVE_LLONG_g)
- fprintf(out, "H5T_NATIVE_LLONG");
+ HDfprintf(out, "H5T_NATIVE_LLONG");
else if(obj == H5T_NATIVE_ULLONG_g)
- fprintf(out, "H5T_NATIVE_ULLONG");
+ HDfprintf(out, "H5T_NATIVE_ULLONG");
else if(obj == H5T_NATIVE_FLOAT_g)
- fprintf(out, "H5T_NATIVE_FLOAT");
+ HDfprintf(out, "H5T_NATIVE_FLOAT");
else if(obj == H5T_NATIVE_DOUBLE_g)
- fprintf(out, "H5T_NATIVE_DOUBLE");
+ HDfprintf(out, "H5T_NATIVE_DOUBLE");
#if H5_SIZEOF_LONG_DOUBLE !=0
else if(obj == H5T_NATIVE_LDOUBLE_g)
- fprintf(out, "H5T_NATIVE_LDOUBLE");
+ HDfprintf(out, "H5T_NATIVE_LDOUBLE");
#endif
else if(obj == H5T_IEEE_F32BE_g)
- fprintf(out, "H5T_IEEE_F32BE");
+ HDfprintf(out, "H5T_IEEE_F32BE");
else if(obj == H5T_IEEE_F32LE_g)
- fprintf(out, "H5T_IEEE_F32LE");
+ HDfprintf(out, "H5T_IEEE_F32LE");
else if(obj == H5T_IEEE_F64BE_g)
- fprintf(out, "H5T_IEEE_F64BE");
+ HDfprintf(out, "H5T_IEEE_F64BE");
else if(obj == H5T_IEEE_F64LE_g)
- fprintf(out, "H5T_IEEE_F64LE");
+ HDfprintf(out, "H5T_IEEE_F64LE");
else if(obj == H5T_STD_I8BE_g)
- fprintf(out, "H5T_STD_I8BE");
+ HDfprintf(out, "H5T_STD_I8BE");
else if(obj == H5T_STD_I8LE_g)
- fprintf(out, "H5T_STD_I8LE");
+ HDfprintf(out, "H5T_STD_I8LE");
else if(obj == H5T_STD_I16BE_g)
- fprintf(out, "H5T_STD_I16BE");
+ HDfprintf(out, "H5T_STD_I16BE");
else if(obj == H5T_STD_I16LE_g)
- fprintf(out, "H5T_STD_I16LE");
+ HDfprintf(out, "H5T_STD_I16LE");
else if(obj == H5T_STD_I32BE_g)
- fprintf(out, "H5T_STD_I32BE");
+ HDfprintf(out, "H5T_STD_I32BE");
else if(obj == H5T_STD_I32LE_g)
- fprintf(out, "H5T_STD_I32LE");
+ HDfprintf(out, "H5T_STD_I32LE");
else if(obj == H5T_STD_I64BE_g)
- fprintf(out, "H5T_STD_I64BE");
+ HDfprintf(out, "H5T_STD_I64BE");
else if(obj == H5T_STD_I64LE_g)
- fprintf(out, "H5T_STD_I64LE");
+ HDfprintf(out, "H5T_STD_I64LE");
else if(obj == H5T_STD_U8BE_g)
- fprintf(out, "H5T_STD_U8BE");
+ HDfprintf(out, "H5T_STD_U8BE");
else if(obj == H5T_STD_U8LE_g)
- fprintf(out, "H5T_STD_U8LE");
+ HDfprintf(out, "H5T_STD_U8LE");
else if(obj == H5T_STD_U16BE_g)
- fprintf(out, "H5T_STD_U16BE");
+ HDfprintf(out, "H5T_STD_U16BE");
else if(obj == H5T_STD_U16LE_g)
- fprintf(out, "H5T_STD_U16LE");
+ HDfprintf(out, "H5T_STD_U16LE");
else if(obj == H5T_STD_U32BE_g)
- fprintf(out, "H5T_STD_U32BE");
+ HDfprintf(out, "H5T_STD_U32BE");
else if(obj == H5T_STD_U32LE_g)
- fprintf(out, "H5T_STD_U32LE");
+ HDfprintf(out, "H5T_STD_U32LE");
else if(obj == H5T_STD_U64BE_g)
- fprintf(out, "H5T_STD_U64BE");
+ HDfprintf(out, "H5T_STD_U64BE");
else if(obj == H5T_STD_U64LE_g)
- fprintf(out, "H5T_STD_U64LE");
+ HDfprintf(out, "H5T_STD_U64LE");
else if(obj == H5T_STD_B8BE_g)
- fprintf(out, "H5T_STD_B8BE");
+ HDfprintf(out, "H5T_STD_B8BE");
else if(obj == H5T_STD_B8LE_g)
- fprintf(out, "H5T_STD_B8LE");
+ HDfprintf(out, "H5T_STD_B8LE");
else if(obj == H5T_STD_B16BE_g)
- fprintf(out, "H5T_STD_B16BE");
+ HDfprintf(out, "H5T_STD_B16BE");
else if(obj == H5T_STD_B16LE_g)
- fprintf(out, "H5T_STD_B16LE");
+ HDfprintf(out, "H5T_STD_B16LE");
else if(obj == H5T_STD_B32BE_g)
- fprintf(out, "H5T_STD_B32BE");
+ HDfprintf(out, "H5T_STD_B32BE");
else if(obj == H5T_STD_B32LE_g)
- fprintf(out, "H5T_STD_B32LE");
+ HDfprintf(out, "H5T_STD_B32LE");
else if(obj == H5T_STD_B64BE_g)
- fprintf(out, "H5T_STD_B64BE");
+ HDfprintf(out, "H5T_STD_B64BE");
else if(obj == H5T_STD_B64LE_g)
- fprintf(out, "H5T_STD_B64LE");
+ HDfprintf(out, "H5T_STD_B64LE");
else if(obj == H5T_C_S1_g)
- fprintf(out, "H5T_C_S1");
+ HDfprintf(out, "H5T_C_S1");
else if(obj == H5T_FORTRAN_S1_g)
- fprintf(out, "H5T_FORTRAN_S1");
+ HDfprintf(out, "H5T_FORTRAN_S1");
else
- fprintf(out, "%ld (dtype)", (long)obj);
+ HDfprintf(out, "%ld (dtype)", (long)obj);
break;
case H5I_DATASPACE:
- fprintf(out, "%ld (dspace)", (long)obj);
+ HDfprintf(out, "%ld (dspace)", (long)obj);
/* Save the rank of simple data spaces for arrays */
/* This may generate recursive call to the library... -QAK */
{
@@ -1309,47 +1316,47 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
break;
case H5I_DATASET:
- fprintf(out, "%ld (dset)", (long)obj);
+ HDfprintf(out, "%ld (dset)", (long)obj);
break;
case H5I_ATTR:
- fprintf(out, "%ld (attr)", (long)obj);
+ HDfprintf(out, "%ld (attr)", (long)obj);
break;
case H5I_REFERENCE:
- fprintf(out, "%ld (reference)", (long)obj);
+ HDfprintf(out, "%ld (reference)", (long)obj);
break;
case H5I_VFL:
- fprintf(out, "%ld (file driver)", (long)obj);
+ HDfprintf(out, "%ld (file driver)", (long)obj);
break;
case H5I_GENPROP_CLS:
- fprintf(out, "%ld (genprop class)", (long)obj);
+ HDfprintf(out, "%ld (genprop class)", (long)obj);
break;
case H5I_GENPROP_LST:
- fprintf(out, "%ld (genprop list)", (long)obj);
+ HDfprintf(out, "%ld (genprop list)", (long)obj);
break;
case H5I_ERROR_CLASS:
- fprintf(out, "%ld (err class)", (long)obj);
+ HDfprintf(out, "%ld (err class)", (long)obj);
break;
case H5I_ERROR_MSG:
- fprintf(out, "%ld (err msg)", (long)obj);
+ HDfprintf(out, "%ld (err msg)", (long)obj);
break;
case H5I_ERROR_STACK:
- fprintf(out, "%ld (err stack)", (long)obj);
+ HDfprintf(out, "%ld (err stack)", (long)obj);
break;
case H5I_NTYPES:
- fprintf (out, "%ld (ntypes - error)", (long)obj);
+ HDfprintf (out, "%ld (ntypes - error)", (long)obj);
break;
default:
- fprintf(out, "%ld (unknown class)", (long)obj);
+ HDfprintf(out, "%ld (unknown class)", (long)obj);
break;
} /* end switch */
} /* end else */
@@ -1361,32 +1368,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'i':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5_index_t idx_type = (H5_index_t)va_arg(ap, int);
switch(idx_type) {
case H5_INDEX_UNKNOWN:
- fprintf(out, "H5_INDEX_UNKNOWN");
+ HDfprintf(out, "H5_INDEX_UNKNOWN");
break;
case H5_INDEX_NAME:
- fprintf(out, "H5_INDEX_NAME");
+ HDfprintf(out, "H5_INDEX_NAME");
break;
case H5_INDEX_CRT_ORDER:
- fprintf(out, "H5_INDEX_CRT_ORDER");
+ HDfprintf(out, "H5_INDEX_CRT_ORDER");
break;
case H5_INDEX_N:
- fprintf(out, "H5_INDEX_N");
+ HDfprintf(out, "H5_INDEX_N");
break;
default:
- fprintf(out, "%ld", (long)idx_type);
+ HDfprintf(out, "%ld", (long)idx_type);
break;
} /* end switch */
} /* end else */
@@ -1395,36 +1402,36 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'o':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5_iter_order_t order = (H5_iter_order_t)va_arg(ap, int);
switch(order) {
case H5_ITER_UNKNOWN:
- fprintf(out, "H5_ITER_UNKNOWN");
+ HDfprintf(out, "H5_ITER_UNKNOWN");
break;
case H5_ITER_INC:
- fprintf(out, "H5_ITER_INC");
+ HDfprintf(out, "H5_ITER_INC");
break;
case H5_ITER_DEC:
- fprintf(out, "H5_ITER_DEC");
+ HDfprintf(out, "H5_ITER_DEC");
break;
case H5_ITER_NATIVE:
- fprintf(out, "H5_ITER_NATIVE");
+ HDfprintf(out, "H5_ITER_NATIVE");
break;
case H5_ITER_N:
- fprintf(out, "H5_ITER_N");
+ HDfprintf(out, "H5_ITER_N");
break;
default:
- fprintf(out, "%ld", (long)order);
+ HDfprintf(out, "%ld", (long)order);
break;
} /* end switch */
} /* end else */
@@ -1433,23 +1440,23 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if(ptr) {
if(vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
if(asize_idx >= 0 && asize[asize_idx] >= 0) {
int *p = (int*)vp;
- fprintf(out, " {");
+ HDfprintf(out, " {");
for(i = 0; i < asize[asize_idx]; i++)
- fprintf(out, "%s%d", (i ? ", " : ""), p[i]);
- fprintf(out, "}");
+ HDfprintf(out, "%s%d", (i ? ", " : ""), p[i]);
+ HDfprintf(out, "}");
} /* end if */
} /* end if */
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
int is = va_arg(ap, int);
- fprintf (out, "%d", is);
+ HDfprintf (out, "%d", is);
asize[argno] = is;
} /* end else */
break;
@@ -1457,80 +1464,80 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5I_type_t id_type = (H5I_type_t)va_arg(ap, int);
switch (id_type) {
case H5I_UNINIT:
- fprintf(out, "H5I_UNINIT");
+ HDfprintf(out, "H5I_UNINIT");
break;
case H5I_BADID:
- fprintf(out, "H5I_BADID");
+ HDfprintf(out, "H5I_BADID");
break;
case H5I_FILE:
- fprintf(out, "H5I_FILE");
+ HDfprintf(out, "H5I_FILE");
break;
case H5I_GROUP:
- fprintf(out, "H5I_GROUP");
+ HDfprintf(out, "H5I_GROUP");
break;
case H5I_DATATYPE:
- fprintf(out, "H5I_DATATYPE");
+ HDfprintf(out, "H5I_DATATYPE");
break;
case H5I_DATASPACE:
- fprintf(out, "H5I_DATASPACE");
+ HDfprintf(out, "H5I_DATASPACE");
break;
case H5I_DATASET:
- fprintf(out, "H5I_DATASET");
+ HDfprintf(out, "H5I_DATASET");
break;
case H5I_ATTR:
- fprintf(out, "H5I_ATTR");
+ HDfprintf(out, "H5I_ATTR");
break;
case H5I_REFERENCE:
- fprintf(out, "H5I_REFERENCE");
+ HDfprintf(out, "H5I_REFERENCE");
break;
case H5I_VFL:
- fprintf(out, "H5I_VFL");
+ HDfprintf(out, "H5I_VFL");
break;
case H5I_GENPROP_CLS:
- fprintf(out, "H5I_GENPROP_CLS");
+ HDfprintf(out, "H5I_GENPROP_CLS");
break;
case H5I_GENPROP_LST:
- fprintf(out, "H5I_GENPROP_LST");
+ HDfprintf(out, "H5I_GENPROP_LST");
break;
case H5I_ERROR_CLASS:
- fprintf(out, "H5I_ERROR_CLASS");
+ HDfprintf(out, "H5I_ERROR_CLASS");
break;
case H5I_ERROR_MSG:
- fprintf(out, "H5I_ERROR_MSG");
+ HDfprintf(out, "H5I_ERROR_MSG");
break;
case H5I_ERROR_STACK:
- fprintf(out, "H5I_ERROR_STACK");
+ HDfprintf(out, "H5I_ERROR_STACK");
break;
case H5I_NTYPES:
- fprintf(out, "H5I_NTYPES");
+ HDfprintf(out, "H5I_NTYPES");
break;
default:
- fprintf(out, "%ld", (long)id_type);
+ HDfprintf(out, "%ld", (long)id_type);
break;
} /* end switch */
} /* end else */
@@ -1539,29 +1546,29 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'u':
if(ptr) {
if(vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
if(asize_idx >= 0 && asize[asize_idx] >= 0) {
unsigned *p = (unsigned*)vp;
- fprintf(out, " {");
+ HDfprintf(out, " {");
for(i = 0; i < asize[asize_idx]; i++)
HDfprintf(out, "%s%u", i?", ":"", p[i]);
- fprintf(out, "}");
+ HDfprintf(out, "}");
} /* end if */
} /* end if */
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
unsigned iu = va_arg(ap, unsigned);
- fprintf(out, "%u", iu);
+ HDfprintf(out, "%u", iu);
asize[argno] = iu;
} /* end else */
break;
default:
- fprintf (out, "BADTYPE(I%c)", type[1]);
+ HDfprintf (out, "BADTYPE(I%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -1571,43 +1578,43 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'l':
if(ptr) {
if(vp)
- fprintf (out, "0x%lx", (unsigned long)vp);
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5L_type_t link_type = (H5L_type_t)va_arg(ap, int);
switch(link_type) {
case H5L_TYPE_ERROR:
- fprintf(out, "H5L_TYPE_ERROR");
+ HDfprintf(out, "H5L_TYPE_ERROR");
break;
case H5L_TYPE_HARD:
- fprintf(out, "H5L_TYPE_HARD");
+ HDfprintf(out, "H5L_TYPE_HARD");
break;
case H5L_TYPE_SOFT:
- fprintf(out, "H5L_TYPE_SOFT");
+ HDfprintf(out, "H5L_TYPE_SOFT");
break;
case H5L_TYPE_EXTERNAL:
- fprintf(out, "H5L_TYPE_EXTERNAL");
+ HDfprintf(out, "H5L_TYPE_EXTERNAL");
break;
case H5L_TYPE_MAX:
- fprintf(out, "H5L_TYPE_MAX");
+ HDfprintf(out, "H5L_TYPE_MAX");
break;
default:
- fprintf(out, "%ld", (long)link_type);
+ HDfprintf(out, "%ld", (long)link_type);
break;
} /* end switch */
} /* end else */
break;
default:
- fprintf(out, "BADTYPE(G%c)", type[1]);
+ HDfprintf(out, "BADTYPE(G%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -1617,15 +1624,15 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'c':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
#ifdef H5_HAVE_PARALLEL
else {
MPI_Comm comm = va_arg(ap, MPI_Comm);
- fprintf(out, "%ld", (long)comm);
+ HDfprintf(out, "%ld", (long)comm);
} /* end else */
#endif /* H5_HAVE_PARALLEL */
break;
@@ -1633,15 +1640,15 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'i':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
#ifdef H5_HAVE_PARALLEL
else {
MPI_Info info = va_arg(ap, MPI_Info);
- fprintf(out, "%ld", (long)info);
+ HDfprintf(out, "%ld", (long)info);
} /* end else */
#endif /* H5_HAVE_PARALLEL */
break;
@@ -1649,52 +1656,52 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5FD_mem_t mt = (H5FD_mem_t)va_arg(ap, int);
switch(mt) {
case H5FD_MEM_NOLIST:
- fprintf(out, "H5FD_MEM_NOLIST");
+ HDfprintf(out, "H5FD_MEM_NOLIST");
break;
case H5FD_MEM_DEFAULT:
- fprintf(out, "H5FD_MEM_DEFAULT");
+ HDfprintf(out, "H5FD_MEM_DEFAULT");
break;
case H5FD_MEM_SUPER:
- fprintf(out, "H5FD_MEM_SUPER");
+ HDfprintf(out, "H5FD_MEM_SUPER");
break;
case H5FD_MEM_BTREE:
- fprintf(out, "H5FD_MEM_BTREE");
+ HDfprintf(out, "H5FD_MEM_BTREE");
break;
case H5FD_MEM_DRAW:
- fprintf(out, "H5FD_MEM_DRAW");
+ HDfprintf(out, "H5FD_MEM_DRAW");
break;
case H5FD_MEM_GHEAP:
- fprintf(out, "H5FD_MEM_GHEAP");
+ HDfprintf(out, "H5FD_MEM_GHEAP");
break;
case H5FD_MEM_LHEAP:
- fprintf(out, "H5FD_MEM_LHEAP");
+ HDfprintf(out, "H5FD_MEM_LHEAP");
break;
case H5FD_MEM_OHDR:
- fprintf(out, "H5FD_MEM_OHDR");
+ HDfprintf(out, "H5FD_MEM_OHDR");
break;
case H5FD_MEM_NTYPES:
- fprintf(out, "H5FD_MEM_NTYPES");
+ HDfprintf(out, "H5FD_MEM_NTYPES");
break;
default:
- fprintf(out, "%ld", (long)mt);
+ HDfprintf(out, "%ld", (long)mt);
break;
} /* end switch */
} /* end else */
@@ -1708,14 +1715,14 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'o':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
off_t offset = va_arg(ap, off_t);
- fprintf (out, "%ld", (long)offset);
+ HDfprintf (out, "%ld", (long)offset);
} /* end else */
break;
@@ -1724,43 +1731,43 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5O_type_t objtype = (H5O_type_t)va_arg(ap, int);
switch(objtype) {
case H5O_TYPE_UNKNOWN:
- fprintf(out, "H5O_TYPE_UNKNOWN");
+ HDfprintf(out, "H5O_TYPE_UNKNOWN");
break;
case H5O_TYPE_GROUP:
- fprintf(out, "H5O_TYPE_GROUP");
+ HDfprintf(out, "H5O_TYPE_GROUP");
break;
case H5O_TYPE_DATASET:
- fprintf(out, "H5O_TYPE_DATASET");
+ HDfprintf(out, "H5O_TYPE_DATASET");
break;
case H5O_TYPE_NAMED_DATATYPE:
- fprintf(out, "H5O_TYPE_NAMED_DATATYPE");
+ HDfprintf(out, "H5O_TYPE_NAMED_DATATYPE");
break;
case H5O_TYPE_NTYPES:
- fprintf(out, "H5O_TYPE_TYPES");
+ HDfprintf(out, "H5O_TYPE_TYPES");
break;
default:
- fprintf(out, "BADTYPE(%ld)", (long)objtype);
+ HDfprintf(out, "BADTYPE(%ld)", (long)objtype);
break;
} /* end switch */
} /* end else */
break;
default:
- fprintf(out, "BADTYPE(S%c)", type[1]);
+ HDfprintf(out, "BADTYPE(S%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -1768,9 +1775,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'p':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
hid_t pclass_id = va_arg(ap, hid_t);
@@ -1781,20 +1788,20 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
/* (This may generate recursive call to the library... -QAK) */
if(NULL != (pclass = (H5P_genclass_t *)H5I_object(pclass_id)) &&
NULL != (class_name = H5P_get_class_name(pclass))) {
- fprintf(out, "%s", class_name);
+ HDfprintf(out, "%s", class_name);
H5MM_xfree(class_name);
} /* end if */
else
- fprintf(out, "%ld", (long)pclass_id);
+ HDfprintf(out, "%ld", (long)pclass_id);
} /* end else */
break;
case 'r':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
hobj_ref_t ref = va_arg(ap, hobj_ref_t);
@@ -1808,39 +1815,39 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5R_type_t reftype = (H5R_type_t)va_arg(ap, int);
switch(reftype) {
case H5R_BADTYPE:
- fprintf(out, "H5R_BADTYPE");
+ HDfprintf(out, "H5R_BADTYPE");
break;
case H5R_OBJECT:
- fprintf(out, "H5R_OBJECT");
+ HDfprintf(out, "H5R_OBJECT");
break;
case H5R_DATASET_REGION:
- fprintf(out, "H5R_DATASET_REGION");
+ HDfprintf(out, "H5R_DATASET_REGION");
break;
case H5R_MAXTYPE:
- fprintf(out, "H5R_MAXTYPE");
+ HDfprintf(out, "H5R_MAXTYPE");
break;
default:
- fprintf(out, "BADTYPE(%ld)", (long)reftype);
+ HDfprintf(out, "BADTYPE(%ld)", (long)reftype);
break;
} /* end switch */
} /* end else */
break;
default:
- fprintf(out, "BADTYPE(S%c)", type[1]);
+ HDfprintf(out, "BADTYPE(S%c)", type[1]);
goto error;
}
break;
@@ -1850,32 +1857,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'c':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5S_class_t cls = (H5S_class_t)va_arg(ap, int);
switch(cls) {
case H5S_NO_CLASS:
- fprintf(out, "H5S_NO_CLASS");
+ HDfprintf(out, "H5S_NO_CLASS");
break;
case H5S_SCALAR:
- fprintf(out, "H5S_SCALAR");
+ HDfprintf(out, "H5S_SCALAR");
break;
case H5S_SIMPLE:
- fprintf(out, "H5S_SIMPLE");
+ HDfprintf(out, "H5S_SIMPLE");
break;
case H5S_NULL:
- fprintf(out, "H5S_NULL");
+ HDfprintf(out, "H5S_NULL");
break;
default:
- fprintf(out, "%ld", (long)cls);
+ HDfprintf(out, "%ld", (long)cls);
break;
} /* end switch */
} /* end else */
@@ -1884,56 +1891,56 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5S_seloper_t so = (H5S_seloper_t)va_arg(ap, int);
switch(so) {
case H5S_SELECT_NOOP:
- fprintf(out, "H5S_NOOP");
+ HDfprintf(out, "H5S_NOOP");
break;
case H5S_SELECT_SET:
- fprintf(out, "H5S_SELECT_SET");
+ HDfprintf(out, "H5S_SELECT_SET");
break;
case H5S_SELECT_OR:
- fprintf(out, "H5S_SELECT_OR");
+ HDfprintf(out, "H5S_SELECT_OR");
break;
case H5S_SELECT_AND:
- fprintf(out, "H5S_SELECT_AND");
+ HDfprintf(out, "H5S_SELECT_AND");
break;
case H5S_SELECT_XOR:
- fprintf(out, "H5S_SELECT_XOR");
+ HDfprintf(out, "H5S_SELECT_XOR");
break;
case H5S_SELECT_NOTB:
- fprintf(out, "H5S_SELECT_NOTB");
+ HDfprintf(out, "H5S_SELECT_NOTB");
break;
case H5S_SELECT_NOTA:
- fprintf(out, "H5S_SELECT_NOTA");
+ HDfprintf(out, "H5S_SELECT_NOTA");
break;
case H5S_SELECT_APPEND:
- fprintf(out, "H5S_SELECT_APPEND");
+ HDfprintf(out, "H5S_SELECT_APPEND");
break;
case H5S_SELECT_PREPEND:
- fprintf(out, "H5S_SELECT_PREPEND");
+ HDfprintf(out, "H5S_SELECT_PREPEND");
break;
case H5S_SELECT_INVALID:
- fprintf(out, "H5S_SELECT_INVALID");
+ HDfprintf(out, "H5S_SELECT_INVALID");
break;
default:
- fprintf(out, "%ld", (long)so);
+ HDfprintf(out, "%ld", (long)so);
break;
} /* end switch */
} /* end else */
@@ -1942,47 +1949,47 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5S_sel_type st = (H5S_sel_type)va_arg(ap, int);
switch(st) {
case H5S_SEL_ERROR:
- fprintf(out, "H5S_SEL_ERROR");
+ HDfprintf(out, "H5S_SEL_ERROR");
break;
case H5S_SEL_NONE:
- fprintf(out, "H5S_SEL_NONE");
+ HDfprintf(out, "H5S_SEL_NONE");
break;
case H5S_SEL_POINTS:
- fprintf(out, "H5S_SEL_POINTS");
+ HDfprintf(out, "H5S_SEL_POINTS");
break;
case H5S_SEL_HYPERSLABS:
- fprintf(out, "H5S_SEL_HYPERSLABS");
+ HDfprintf(out, "H5S_SEL_HYPERSLABS");
break;
case H5S_SEL_ALL:
- fprintf(out, "H5S_SEL_ALL");
+ HDfprintf(out, "H5S_SEL_ALL");
break;
case H5S_SEL_N:
- fprintf(out, "H5S_SEL_N");
+ HDfprintf(out, "H5S_SEL_N");
break;
default:
- fprintf(out, "%ld", (long)st);
+ HDfprintf(out, "%ld", (long)st);
break;
} /* end switch */
} /* end else */
break;
default:
- fprintf(out, "BADTYPE(S%c)", type[1]);
+ HDfprintf(out, "BADTYPE(S%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -1990,14 +1997,14 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
const char *str = va_arg(ap, const char *);
- fprintf(out, "\"%s\"", str);
+ HDfprintf(out, "\"%s\"", str);
} /* end else */
break;
@@ -2006,24 +2013,24 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'c':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5T_cset_t cset = (H5T_cset_t)va_arg(ap, int);
switch(cset) {
case H5T_CSET_ERROR:
- fprintf(out, "H5T_CSET_ERROR");
+ HDfprintf(out, "H5T_CSET_ERROR");
break;
case H5T_CSET_ASCII:
- fprintf(out, "H5T_CSET_ASCII");
+ HDfprintf(out, "H5T_CSET_ASCII");
break;
case H5T_CSET_UTF8:
- fprintf(out, "H5T_CSET_UTF8");
+ HDfprintf(out, "H5T_CSET_UTF8");
break;
case H5T_CSET_RESERVED_2:
@@ -2040,11 +2047,11 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5T_CSET_RESERVED_13:
case H5T_CSET_RESERVED_14:
case H5T_CSET_RESERVED_15:
- fprintf(out, "H5T_CSET_RESERVED_%ld", (long)cset);
+ HDfprintf(out, "H5T_CSET_RESERVED_%ld", (long)cset);
break;
default:
- fprintf(out, "%ld", (long)cset);
+ HDfprintf(out, "%ld", (long)cset);
break;
} /* end switch */
} /* end else */
@@ -2053,28 +2060,28 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'd':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5T_direction_t direct = (H5T_direction_t)va_arg(ap, int);
switch(direct) {
case H5T_DIR_DEFAULT:
- fprintf(out, "H5T_DIR_DEFAULT");
+ HDfprintf(out, "H5T_DIR_DEFAULT");
break;
case H5T_DIR_ASCEND:
- fprintf(out, "H5T_DIR_ASCEND");
+ HDfprintf(out, "H5T_DIR_ASCEND");
break;
case H5T_DIR_DESCEND:
- fprintf(out, "H5T_DIR_DESCEND");
+ HDfprintf(out, "H5T_DIR_DESCEND");
break;
default:
- fprintf(out, "%ld", (long)direct);
+ HDfprintf(out, "%ld", (long)direct);
break;
} /* end switch */
} /* end else */
@@ -2083,28 +2090,28 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'e':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5T_pers_t pers = (H5T_pers_t)va_arg(ap, int);
switch(pers) {
case H5T_PERS_DONTCARE:
- fprintf(out, "H5T_PERS_DONTCARE");
+ HDfprintf(out, "H5T_PERS_DONTCARE");
break;
case H5T_PERS_SOFT:
- fprintf(out, "H5T_PERS_SOFT");
+ HDfprintf(out, "H5T_PERS_SOFT");
break;
case H5T_PERS_HARD:
- fprintf(out, "H5T_PERS_HARD");
+ HDfprintf(out, "H5T_PERS_HARD");
break;
default:
- fprintf(out, "%ld", (long)pers);
+ HDfprintf(out, "%ld", (long)pers);
break;
} /* end switch */
} /* end else */
@@ -2113,32 +2120,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'n':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5T_norm_t norm = (H5T_norm_t)va_arg(ap, int);
switch(norm) {
case H5T_NORM_ERROR:
- fprintf(out, "H5T_NORM_ERROR");
+ HDfprintf(out, "H5T_NORM_ERROR");
break;
case H5T_NORM_IMPLIED:
- fprintf(out, "H5T_NORM_IMPLIED");
+ HDfprintf(out, "H5T_NORM_IMPLIED");
break;
case H5T_NORM_MSBSET:
- fprintf(out, "H5T_NORM_MSBSET");
+ HDfprintf(out, "H5T_NORM_MSBSET");
break;
case H5T_NORM_NONE:
- fprintf(out, "H5T_NORM_NONE");
+ HDfprintf(out, "H5T_NORM_NONE");
break;
default:
- fprintf(out, "%ld", (long)norm);
+ HDfprintf(out, "%ld", (long)norm);
break;
} /* end switch */
} /* end else */
@@ -2147,40 +2154,40 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'o':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5T_order_t order = (H5T_order_t)va_arg(ap, int);
switch(order) {
case H5T_ORDER_ERROR:
- fprintf(out, "H5T_ORDER_ERROR");
+ HDfprintf(out, "H5T_ORDER_ERROR");
break;
case H5T_ORDER_LE:
- fprintf(out, "H5T_ORDER_LE");
+ HDfprintf(out, "H5T_ORDER_LE");
break;
case H5T_ORDER_BE:
- fprintf(out, "H5T_ORDER_BE");
+ HDfprintf(out, "H5T_ORDER_BE");
break;
case H5T_ORDER_VAX:
- fprintf(out, "H5T_ORDER_VAX");
+ HDfprintf(out, "H5T_ORDER_VAX");
break;
case H5T_ORDER_MIXED:
- fprintf(out, "H5T_ORDER_MIXED");
+ HDfprintf(out, "H5T_ORDER_MIXED");
break;
case H5T_ORDER_NONE:
- fprintf(out, "H5T_ORDER_NONE");
+ HDfprintf(out, "H5T_ORDER_NONE");
break;
default:
- fprintf(out, "%ld", (long)order);
+ HDfprintf(out, "%ld", (long)order);
break;
} /* end switch */
} /* end else */
@@ -2189,36 +2196,36 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'p':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5T_pad_t pad = (H5T_pad_t)va_arg(ap, int);
switch(pad) {
case H5T_PAD_ERROR:
- fprintf(out, "H5T_PAD_ERROR");
+ HDfprintf(out, "H5T_PAD_ERROR");
break;
case H5T_PAD_ZERO:
- fprintf(out, "H5T_PAD_ZERO");
+ HDfprintf(out, "H5T_PAD_ZERO");
break;
case H5T_PAD_ONE:
- fprintf(out, "H5T_PAD_ONE");
+ HDfprintf(out, "H5T_PAD_ONE");
break;
case H5T_PAD_BACKGROUND:
- fprintf(out, "H5T_PAD_BACKGROUND");
+ HDfprintf(out, "H5T_PAD_BACKGROUND");
break;
case H5T_NPAD:
- fprintf(out, "H5T_NPAD");
+ HDfprintf(out, "H5T_NPAD");
break;
default:
- fprintf(out, "%ld", (long)pad);
+ HDfprintf(out, "%ld", (long)pad);
break;
} /* end switch */
} /* end else */
@@ -2227,32 +2234,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5T_sign_t sign = (H5T_sign_t)va_arg(ap, int);
switch(sign) {
case H5T_SGN_ERROR:
- fprintf(out, "H5T_SGN_ERROR");
+ HDfprintf(out, "H5T_SGN_ERROR");
break;
case H5T_SGN_NONE:
- fprintf(out, "H5T_SGN_NONE");
+ HDfprintf(out, "H5T_SGN_NONE");
break;
case H5T_SGN_2:
- fprintf(out, "H5T_SGN_2");
+ HDfprintf(out, "H5T_SGN_2");
break;
case H5T_NSGN:
- fprintf(out, "H5T_NSGN");
+ HDfprintf(out, "H5T_NSGN");
break;
default:
- fprintf(out, "%ld", (long)sign);
+ HDfprintf(out, "%ld", (long)sign);
break;
} /* end switch */
} /* end else */
@@ -2261,68 +2268,68 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5T_class_t type_class = (H5T_class_t)va_arg(ap, int);
switch(type_class) {
case H5T_NO_CLASS:
- fprintf(out, "H5T_NO_CLASS");
+ HDfprintf(out, "H5T_NO_CLASS");
break;
case H5T_INTEGER:
- fprintf(out, "H5T_INTEGER");
+ HDfprintf(out, "H5T_INTEGER");
break;
case H5T_FLOAT:
- fprintf(out, "H5T_FLOAT");
+ HDfprintf(out, "H5T_FLOAT");
break;
case H5T_TIME:
- fprintf(out, "H5T_TIME");
+ HDfprintf(out, "H5T_TIME");
break;
case H5T_STRING:
- fprintf(out, "H5T_STRING");
+ HDfprintf(out, "H5T_STRING");
break;
case H5T_BITFIELD:
- fprintf(out, "H5T_BITFIELD");
+ HDfprintf(out, "H5T_BITFIELD");
break;
case H5T_OPAQUE:
- fprintf(out, "H5T_OPAQUE");
+ HDfprintf(out, "H5T_OPAQUE");
break;
case H5T_COMPOUND:
- fprintf(out, "H5T_COMPOUND");
+ HDfprintf(out, "H5T_COMPOUND");
break;
case H5T_REFERENCE:
- fprintf(out, "H5T_REFERENCE");
+ HDfprintf(out, "H5T_REFERENCE");
break;
case H5T_ENUM:
- fprintf(out, "H5T_ENUM");
+ HDfprintf(out, "H5T_ENUM");
break;
case H5T_VLEN:
- fprintf(out, "H5T_VLEN");
+ HDfprintf(out, "H5T_VLEN");
break;
case H5T_ARRAY:
- fprintf(out, "H5T_ARRAY");
+ HDfprintf(out, "H5T_ARRAY");
break;
case H5T_NCLASSES:
- fprintf(out, "H5T_NCLASSES");
+ HDfprintf(out, "H5T_NCLASSES");
break;
default:
- fprintf(out, "%ld", (long)type_class);
+ HDfprintf(out, "%ld", (long)type_class);
break;
} /* end switch */
} /* end else */
@@ -2331,28 +2338,28 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'z':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5T_str_t str = (H5T_str_t)va_arg(ap, int);
switch(str) {
case H5T_STR_ERROR:
- fprintf(out, "H5T_STR_ERROR");
+ HDfprintf(out, "H5T_STR_ERROR");
break;
case H5T_STR_NULLTERM:
- fprintf(out, "H5T_STR_NULLTERM");
+ HDfprintf(out, "H5T_STR_NULLTERM");
break;
case H5T_STR_NULLPAD:
- fprintf(out, "H5T_STR_NULLPAD");
+ HDfprintf(out, "H5T_STR_NULLPAD");
break;
case H5T_STR_SPACEPAD:
- fprintf(out, "H5T_STR_SPACEPAD");
+ HDfprintf(out, "H5T_STR_SPACEPAD");
break;
case H5T_STR_RESERVED_3:
@@ -2368,18 +2375,18 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5T_STR_RESERVED_13:
case H5T_STR_RESERVED_14:
case H5T_STR_RESERVED_15:
- fprintf(out, "H5T_STR_RESERVED(%ld)",(long)str);
+ HDfprintf(out, "H5T_STR_RESERVED(%ld)",(long)str);
break;
default:
- fprintf(out, "%ld", (long)str);
+ HDfprintf(out, "%ld", (long)str);
break;
} /* end switch */
} /* end else */
break;
default:
- fprintf (out, "BADTYPE(T%c)", type[1]);
+ HDfprintf (out, "BADTYPE(T%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -2387,19 +2394,19 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
htri_t tri_var = va_arg (ap, htri_t);
if(tri_var>0)
- fprintf (out, "TRUE");
+ HDfprintf (out, "TRUE");
else if(!tri_var)
- fprintf (out, "FALSE");
+ HDfprintf (out, "FALSE");
else
- fprintf(out, "FAIL(%d)", (int)tri_var);
+ HDfprintf(out, "FAIL(%d)", (int)tri_var);
} /* end else */
break;
@@ -2408,23 +2415,23 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'l':
if(ptr) {
if(vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
if(asize_idx >= 0 && asize[asize_idx] >= 0) {
unsigned long *p = (unsigned long *)vp;
- fprintf(out, " {");
+ HDfprintf(out, " {");
for(i = 0; i < asize[asize_idx]; i++)
HDfprintf(out, "%s%lu", i?", ":"", p[i]);
- fprintf(out, "}");
+ HDfprintf(out, "}");
} /* end if */
} /* end if */
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
unsigned long iul = va_arg(ap, unsigned long);
- fprintf(out, "%lu", iul);
+ HDfprintf(out, "%lu", iul);
asize[argno] = (hssize_t)iul;
} /* end else */
break;
@@ -2432,29 +2439,29 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'L':
if(ptr) {
if(vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
if(asize_idx >= 0 && asize[asize_idx] >= 0) {
unsigned long long *p = (unsigned long long *)vp;
- fprintf(out, " {");
+ HDfprintf(out, " {");
for(i = 0; i < asize[asize_idx]; i++)
HDfprintf(out, "%s%llu", i?", ":"", p[i]);
- fprintf(out, "}");
+ HDfprintf(out, "}");
} /* end if */
} /* end if */
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
unsigned long long iull = va_arg(ap, unsigned long long);
- fprintf(out, "%llu", iull);
+ HDfprintf(out, "%llu", iull);
asize[argno] = (hssize_t)iull;
} /* end else */
break;
default:
- fprintf (out, "BADTYPE(U%c)", type[1]);
+ HDfprintf (out, "BADTYPE(U%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -2462,48 +2469,48 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'x':
if(ptr) {
if(vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
if(asize_idx >= 0 && asize[asize_idx] >= 0) {
void **p = (void**)vp;
- fprintf(out, " {");
+ HDfprintf(out, " {");
for(i = 0; i < asize[asize_idx]; i++) {
if(p[i])
- fprintf(out, "%s0x%lx", (i ? ", " : ""), (unsigned long)(p[i]));
+ HDfprintf(out, "%s0x%lx", (i ? ", " : ""), (unsigned long)(p[i]));
else
- fprintf(out, "%sNULL", (i ? ", " : ""));
+ HDfprintf(out, "%sNULL", (i ? ", " : ""));
} /* end for */
- fprintf(out, "}");
+ HDfprintf(out, "}");
} /* end if */
} /* end if */
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
vp = va_arg (ap, void *);
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end else */
break;
case 'z':
if(ptr) {
if(vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
if(asize_idx >= 0 && asize[asize_idx] >= 0) {
size_t *p = (size_t *)vp;
- fprintf(out, " {");
+ HDfprintf(out, " {");
for(i = 0; i < asize[asize_idx]; i++)
HDfprintf(out, "%s%Zu", (i ? ", " : ""), p[i]);
- fprintf(out, "}");
+ HDfprintf(out, "}");
} /* end if */
} /* end if */
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
size_t size = va_arg(ap, size_t);
@@ -2518,28 +2525,28 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'a':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5Z_SO_scale_type_t scale_type = (H5Z_SO_scale_type_t)va_arg(ap, int);
switch(scale_type) {
case H5Z_SO_FLOAT_DSCALE:
- fprintf(out, "H5Z_SO_FLOAT_DSCALE");
+ HDfprintf(out, "H5Z_SO_FLOAT_DSCALE");
break;
case H5Z_SO_FLOAT_ESCALE:
- fprintf(out, "H5Z_SO_FLOAT_ESCALE");
+ HDfprintf(out, "H5Z_SO_FLOAT_ESCALE");
break;
case H5Z_SO_INT:
- fprintf(out, "H5Z_SO_INT");
+ HDfprintf(out, "H5Z_SO_INT");
break;
default:
- fprintf(out, "%ld", (long)scale_type);
+ HDfprintf(out, "%ld", (long)scale_type);
break;
} /* end switch */
} /* end else */
@@ -2548,68 +2555,68 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'c':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5Z_class2_t *filter = va_arg(ap, H5Z_class2_t*);
- fprintf(out, "0x%lx", (unsigned long)filter);
+ HDfprintf(out, "0x%lx", (unsigned long)filter);
} /* end else */
break;
case 'e':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5Z_EDC_t edc = (H5Z_EDC_t)va_arg(ap, int);
if(H5Z_DISABLE_EDC == edc)
- fprintf(out, "H5Z_DISABLE_EDC");
+ HDfprintf(out, "H5Z_DISABLE_EDC");
else if (H5Z_ENABLE_EDC == edc)
- fprintf(out, "H5Z_ENABLE_EDC");
+ HDfprintf(out, "H5Z_ENABLE_EDC");
else
- fprintf(out, "%ld", (long)edc);
+ HDfprintf(out, "%ld", (long)edc);
} /* end else */
break;
case 'f':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5Z_filter_t id = va_arg(ap, H5Z_filter_t);
if(H5Z_FILTER_DEFLATE == id)
- fprintf(out, "H5Z_FILTER_DEFLATE");
+ HDfprintf(out, "H5Z_FILTER_DEFLATE");
else
- fprintf(out, "%ld", (long)id);
+ HDfprintf(out, "%ld", (long)id);
} /* end else */
break;
case 's':
if(ptr) {
if(vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
if(asize_idx >= 0 && asize[asize_idx] >= 0) {
ssize_t *p = (ssize_t *)vp;
- fprintf(out, " {");
+ HDfprintf(out, " {");
for(i = 0; i < asize[asize_idx]; i++)
HDfprintf(out, "%s%Zd", (i ? ", " : ""), p[i]);
- fprintf(out, "}");
+ HDfprintf(out, "}");
} /* end if */
} /* end if */
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
ssize_t ssize = va_arg(ap, ssize_t);
@@ -2620,32 +2627,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
break;
default:
- fprintf(out, "BADTYPE(Z%c)", type[1]);
+ HDfprintf(out, "BADTYPE(Z%c)", type[1]);
goto error;
} /* end switch */
break;
default:
if(HDisupper(type[0]))
- fprintf(out, "BADTYPE(%c%c)", type[0], type[1]);
+ HDfprintf(out, "BADTYPE(%c%c)", type[0], type[1]);
else
- fprintf(out, "BADTYPE(%c)", type[0]);
+ HDfprintf(out, "BADTYPE(%c)", type[0]);
goto error;
} /* end switch */
} /* end for */
/* Display event time for return */
if(returning && H5_debug_g.ttimes)
- fprintf(out, " @%.6f [dt=%.6f]", (event_time.etime - first_time.etime),
+ HDfprintf(out, " @%.6f [dt=%.6f]", (event_time.etime - first_time.etime),
(event_time.etime - *returning));
error:
va_end(ap);
if(returning)
- fprintf(out, ";\n");
+ HDfprintf(out, ";\n");
else {
last_call_depth = current_depth++;
- fprintf (out, ")");
+ HDfprintf (out, ")");
} /* end else */
HDfflush(out);
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index e6b364c..06bbd06 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -1355,6 +1355,7 @@ if (HDF5_BUILD_GENERATORS)
gen_bad_offset
gen_bad_ohdr
gen_bogus
+ gen_bounds
gen_cross
gen_deflate
gen_filters
diff --git a/test/Makefile.am b/test/Makefile.am
index efdc1ca..ab81f50 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -95,7 +95,7 @@ endif
BUILD_ALL_PROGS=gen_bad_ohdr gen_bogus gen_cross gen_deflate gen_filters gen_new_array \
gen_new_fill gen_new_group gen_new_mtime gen_new_super gen_noencoder \
gen_nullspace gen_udlinks space_overflow gen_filespace gen_specmetaread \
- gen_sizes_lheap gen_file_image gen_plist gen_bad_offset
+ gen_sizes_lheap gen_file_image gen_plist gen_bad_offset gen_bounds
if BUILD_ALL_CONDITIONAL
noinst_PROGRAMS=$(BUILD_ALL_PROGS)
diff --git a/test/dsets.c b/test/dsets.c
index 0fff2d1..09f553e 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -24,8 +24,31 @@
#define H5Z_FRIEND /*suppress error about including H5Zpkg */
-#include "h5test.h"
+#include "hdf5.h"
+#include "testhdf5.h"
#include "H5srcdir.h"
+
+#include "H5Bprivate.h"
+#include "H5Iprivate.h"
+#include "H5Pprivate.h"
+
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_TESTING
+#include "H5Fpkg.h" /* File access */
+
+#define H5S_FRIEND /*suppress error about including H5Spkg */
+#include "H5Spkg.h" /* Dataspace */
+
+#define H5T_FRIEND /*suppress error about including H5Tpkg */
+#include "H5Tpkg.h" /* Datatype */
+
+#define H5A_FRIEND /*suppress error about including H5Apkg */
+#include "H5Apkg.h" /* Attributes */
+
+/* Use in version bound test */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
+#include "H5Opkg.h" /* Object headers */
+
#include "H5Dpkg.h"
#include "H5FDpkg.h"
#include "H5VMprivate.h"
@@ -60,8 +83,10 @@ const char *FILENAME[] = {
"storage_size", /* 22 */
"dls_01_strings", /* 23 */
"power2up", /* 24 */
+ "version_bounds", /* 25 */
NULL
};
+
#define FILENAME_BUF_SIZE 1024
#define KB 1024
@@ -722,10 +747,15 @@ static herr_t
test_compact_io(hid_t fapl)
{
hid_t file, dataset, space, plist;
+ hid_t verfile = -1, new_fapl = -1;
hsize_t dims[2];
int wbuf[16][8], rbuf[16][8];
char filename[FILENAME_BUF_SIZE];
+ H5F_libver_t low, high; /* File format bounds */
+ H5F_t *fp; /* Internal file pointer */
+ H5D_t *dsetp; /* Internal dataset pointer */
int i, j, n;
+ herr_t ret; /* Generic return value */
TESTING("compact dataset I/O");
@@ -764,8 +794,6 @@ test_compact_io(hid_t fapl)
if(H5Dget_offset(dataset)!=HADDR_UNDEF) TEST_ERROR
/* Close file */
- if(H5Sclose(space) < 0) TEST_ERROR
- if(H5Pclose(plist) < 0) TEST_ERROR
if(H5Dclose(dataset) < 0) TEST_ERROR
if(H5Fclose(file) < 0) TEST_ERROR
@@ -789,16 +817,110 @@ test_compact_io(hid_t fapl)
printf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]);
printf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]);
goto error;
- } /* end if */
+ } /* end */
if(H5Dclose(dataset) < 0) TEST_ERROR
if(H5Fclose(file) < 0) TEST_ERROR
- PASSED();
- return 0;
+ /**************************************
+ * Additional test for version bounds *
+ **************************************/
+
+ /* Create a copy of file access property list */
+ if((new_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR
+
+ /* Loop through all the combinations of low/high library format bounds,
+ skipping invalid combinations.
+ - Create a file, create and write a compact dataset, and verify its data
+ - Verify the dataset's layout and fill message versions */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+
+ /* Set version bounds */
+ H5E_BEGIN_TRY {
+ ret = H5Pset_libver_bounds(new_fapl, low, high);
+ } H5E_END_TRY;
+
+ if (ret < 0) /* Invalid low/high combinations */
+ continue;
+
+ /* Create a file */
+ h5_fixname(FILENAME[25], new_fapl, filename, sizeof filename);
+ if((verfile = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, new_fapl)) < 0)
+ TEST_ERROR
+
+ /* Create the compact dataset */
+ dataset = H5Dcreate2(verfile, DSET_DEFAULT_NAME, H5T_NATIVE_INT, space, H5P_DEFAULT, plist, H5P_DEFAULT);
+ if(dataset < 0) TEST_ERROR
+
+ /* Write the same data as of DSET_COMPACT_IO_NAME */
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ TEST_ERROR
+
+ /* Close DSET_DEFAULT_NAME, then reopen it to read and verify
+ the data */
+ if(H5Dclose(dataset) < 0) TEST_ERROR
+ if((dataset = H5Dopen2(verfile, DSET_DEFAULT_NAME, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ TEST_ERROR
+
+ /* Check that the values read are the same as the values written */
+ for(i = 0; i < 16; i++)
+ for(j = 0; j < 8; j++)
+ if(rbuf[i][j] != wbuf[i][j]) {
+ H5_FAILED();
+ printf(" Read different values than written.\n");
+ printf(" At index %d,%d\n", i, j);
+ printf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]);
+ printf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]);
+ goto error;
+ } /* end */
+
+ /* Get the internal file pointer */
+ if((fp = (H5F_t *)H5I_object(verfile)) == NULL) TEST_ERROR
+
+ /* Get the internal dataset pointer */
+ if((dsetp = (H5D_t *)H5I_object(dataset)) == NULL) TEST_ERROR
+
+ /* Verify the dataset's layout and fill message versions */
+ if(fp->shared->low_bound == H5F_LIBVER_EARLIEST) {
+ VERIFY(dsetp->shared->layout.version, H5O_LAYOUT_VERSION_DEFAULT, "layout_ver_bounds");
+ VERIFY(dsetp->shared->dcpl_cache.fill.version, H5O_FILL_VERSION_2, "fill_ver_bounds");
+ } else {
+ VERIFY(dsetp->shared->layout.version, H5O_layout_ver_bounds[fp->shared->low_bound], "layout_ver_bounds");
+ VERIFY(dsetp->shared->dcpl_cache.fill.version, H5O_fill_ver_bounds[fp->shared->low_bound], "fill_ver_bounds");
+ }
+
+ /* Close the dataset and delete from the file */
+ if(H5Dclose(dataset) < 0) TEST_ERROR
+ if(H5Ldelete(verfile, DSET_DEFAULT_NAME, H5P_DEFAULT) < 0)
+ TEST_ERROR
+
+ /* Close the file */
+ if(H5Fclose(verfile) < 0) TEST_ERROR
+
+ } /* end for high */
+ } /* end for low */
+
+ if(H5Pclose(new_fapl) < 0) TEST_ERROR
+ if(H5Sclose(space) < 0) TEST_ERROR
+ if(H5Pclose(plist) < 0) TEST_ERROR
+
+ PASSED();
+ return 0;
error:
- return -1;
+ H5E_BEGIN_TRY {
+ H5Sclose(space);
+ H5Pclose(plist);
+ H5Pclose(new_fapl);
+ H5Dclose(dataset);
+ H5Fclose(file);
+ H5Fclose(verfile);
+ } H5E_END_TRY;
+
+ return -1;
}
@@ -5045,16 +5167,16 @@ error:
/*-------------------------------------------------------------------------
* Function: test_multiopen
*
- * Purpose: Tests that a bug no longer exists. If a dataset is opened
- * twice and one of the handles is used to extend the dataset,
- * then the other handle should return the new size when
- * queried.
+ * Purpose: Tests that a bug no longer exists. If a dataset is opened
+ * twice and one of the handles is used to extend the dataset,
+ * then the other handle should return the new size when
+ * queried.
*
- * Return: Success: 0
+ * Return: Success: 0
*
- * Failure: -1
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, June 9, 1998
*
*-------------------------------------------------------------------------
@@ -5062,10 +5184,10 @@ error:
static herr_t
test_multiopen (hid_t file)
{
- hid_t dcpl = -1, space = -1, dset1 = -1, dset2 = -1;
- hsize_t cur_size[1] = {10};
- static hsize_t max_size[1] = {H5S_UNLIMITED};
- hsize_t tmp_size[1];
+ hid_t dcpl = -1, space = -1, dset1 = -1, dset2 = -1;
+ hsize_t cur_size[1] = {10};
+ hsize_t tmp_size[1];
+ static hsize_t max_size[1] = {H5S_UNLIMITED};
TESTING("multi-open with extending");
@@ -5085,9 +5207,9 @@ test_multiopen (hid_t file)
if((space = H5Dget_space(dset2)) < 0) goto error;
if(H5Sget_simple_extent_dims(space, tmp_size, NULL) < 0) goto error;
if(cur_size[0] != tmp_size[0]) {
- H5_FAILED();
- printf(" Got %d instead of %d!\n", (int)tmp_size[0], (int)cur_size[0]);
- goto error;
+ H5_FAILED();
+ printf(" Got %d instead of %d!\n", (int)tmp_size[0], (int)cur_size[0]);
+ goto error;
} /* end if */
if(H5Dclose(dset1) < 0) goto error;
@@ -9790,6 +9912,7 @@ test_single_chunk(hid_t fapl)
} /* end for */
#endif /* H5_HAVE_FILTER_DEFLATE */
+
/* Release buffers */
HDfree(wbuf);
HDfree(rbuf);
@@ -10152,7 +10275,7 @@ error:
/*-------------------------------------------------------------------------
* Function: test_zero_dim_dset
*
- * Purpose: Tests support for reading a 1D chunled dataset with
+ * Purpose: Tests support for reading a 1D chunked dataset with
* dimension size = 0.
*
* Return: Success: 0
@@ -10173,40 +10296,59 @@ test_zero_dim_dset(hid_t fapl)
hid_t dsid = -1; /* Dataset ID */
hsize_t dim, chunk_dim; /* Dataset and chunk dimensions */
int data[1];
+ H5F_libver_t low, high; /* File format bounds */
+ herr_t ret; /* Generic return value */
- TESTING("shrinking large chunk");
+ TESTING("chunked dataset with zero dimension");
- h5_fixname(FILENAME[16], fapl, filename, sizeof filename);
+ /* Loop through all the combinations of low/high library format bounds,
+ skipping invalid combination, and verify support for reading a 1D
+ chunked dataset with dimension size = 0 */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
- /* Create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
+ /* Set version bounds before opening the file */
+ H5E_BEGIN_TRY {
+ ret = H5Pset_libver_bounds(fapl, low, high);
+ } H5E_END_TRY;
- /* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
+ if (ret < 0) /* Invalid low/high combinations */
+ continue;
- /* Set 1 chunk size */
- chunk_dim = 1;
- if(H5Pset_chunk(dcpl, 1, &chunk_dim) < 0) FAIL_STACK_ERROR
+ h5_fixname(FILENAME[16], fapl, filename, sizeof filename);
- /* Create 1D dataspace with 0 dim size */
- dim = 0;
- if((sid = H5Screate_simple(1, &dim, NULL)) < 0) FAIL_STACK_ERROR
+ /* Create file */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
- /* Create chunked dataset */
- if((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ /* Create dataset creation property list */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
- /* write 0 elements from dataset */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data) < 0) FAIL_STACK_ERROR
+ /* Set 1 chunk size */
+ chunk_dim = 1;
+ if(H5Pset_chunk(dcpl, 1, &chunk_dim) < 0) FAIL_STACK_ERROR
- /* Read 0 elements from dataset */
- if(H5Dread(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data) < 0) FAIL_STACK_ERROR
+ /* Create 1D dataspace with 0 dim size */
+ dim = 0;
+ if((sid = H5Screate_simple(1, &dim, NULL)) < 0) FAIL_STACK_ERROR
- /* Close everything */
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ /* Create chunked dataset */
+ if((dsid = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* write 0 elements from dataset */
+ if(H5Dwrite(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data) < 0) FAIL_STACK_ERROR
+
+ /* Read 0 elements from dataset */
+ if(H5Dread(dsid, H5T_NATIVE_INT, sid, sid, H5P_DEFAULT, data) < 0) FAIL_STACK_ERROR
+
+ /* Close everything */
+ if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
+ if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR
+ if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
+ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+
+ } /* end for high */
+ } /* end for low */
PASSED();
@@ -12728,34 +12870,186 @@ error:
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: test_versionbounds
*
- * Purpose: Tests the dataset interface (H5D)
+ * Purpose: Tests various format versions.
+ * (Currently, only virtual dataset feature)
+ *
+ * Return: Success: 0
+ * Failure: -1
+ * Description:
+ * This function attempts to create a virtual dataset in all
+ * valid combinations of low/high library format bounds. Creation
+ * of virtual dataset should only succeed in H5F_LIBVER_V110.
+ * -BMR, January 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+#define VDS_FNAME1 "virtual_file1"
+#define VDS_FNAME2 "virtual_file2"
+#define SRC_FNAME "source_file"
+#define SRC_DSET "src_dset"
+#define V_DSET "v_dset"
+static herr_t
+test_versionbounds()
+{
+ hid_t fapl = -1;
+ hid_t srcfile = -1; /* Files with source dsets */
+ hid_t vfile = -1; /* File with virtual dset */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t srcspace = -1; /* Source dataspaces */
+ hid_t vspace = -1; /* Virtual dset dataspaces */
+ hid_t srcdset = -1; /* Source datset */
+ hid_t vdset = -1; /* Virtual dataset */
+ hid_t null_dspace = -1; /* Data space of H5S_NULL */
+ hsize_t dims[1] = {3}; /* Data space current size */
+ char srcfilename[FILENAME_BUF_SIZE];
+ char vfilename1[FILENAME_BUF_SIZE];
+ char vfilename2[FILENAME_BUF_SIZE];
+ H5F_libver_t low, high; /* File format bounds */
+ herr_t ret; /* Generic return value */
+
+ TESTING("version bounds of datasets");
+
+ /* Create a copy of file access property list */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR
+
+ h5_fixname(VDS_FNAME1, fapl, vfilename1, sizeof vfilename1);
+ h5_fixname(VDS_FNAME2, fapl, vfilename2, sizeof vfilename2);
+ h5_fixname(SRC_FNAME, fapl, srcfilename, sizeof srcfilename);
+
+ /* Create DCPL */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+
+ /* Clear virtual layout in DCPL */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create source dataspace */
+ if((srcspace = H5Screate_simple(1, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspace */
+ if((vspace = H5Screate_simple(1, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Add virtual layout mapping */
+ if(H5Pset_virtual(dcpl, vspace, srcfilename, SRC_DSET, srcspace) < 0)
+ TEST_ERROR
+
+ /* Loop through all the combinations of low/high library format bounds */
+ /* Create a source file and a dataset in it. Create a virtual file and
+ virtual dataset. Creation of virtual dataset should only succeed in
+ H5F_LIBVER_V110 */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+
+ /* Set version bounds, skip for invalid low/high combination */
+ H5E_BEGIN_TRY {
+ ret = H5Pset_libver_bounds(fapl, low, high);
+ } H5E_END_TRY;
+
+ if (ret < 0) /* Invalid low/high combinations */
+ continue;
+
+ /* Create a source file and dataset */
+ if((srcfile = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if((srcdset = H5Dcreate2(srcfile, SRC_DSET, H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create a virtual file */
+ if((vfile = H5Fcreate(vfilename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create the virtual dataset */
+ H5E_BEGIN_TRY {
+ vdset = H5Dcreate2(vfile, V_DSET, H5T_NATIVE_INT, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ } H5E_END_TRY;
+
+ if (vdset > 0) /* dataset created successfully */
+ {
+ /* Virtual dataset is only available starting in V110 */
+ VERIFY(high, H5F_LIBVER_V110, "virtual dataset");
+
+ if(H5Dclose(vdset) < 0) TEST_ERROR
+ vdset = -1;
+ }
+
+ /* Close virtual file */
+ if(H5Fclose(vfile) < 0) TEST_ERROR
+ vfile = -1;
+
+ /* Close srcdset and srcfile */
+ if(H5Dclose(srcdset) < 0) TEST_ERROR
+ srcdset = -1;
+
+ if(H5Fclose(srcfile) < 0) TEST_ERROR
+ srcfile = -1;
+
+ } /* for high */
+ } /* for low */
+
+ /* Close dataspaces and properties */
+ if(H5Sclose(srcspace) < 0)
+ TEST_ERROR
+ srcspace = -1;
+ if(H5Sclose(vspace) < 0)
+ TEST_ERROR
+ vspace = -1;
+ if(H5Pclose(fapl) < 0)
+ TEST_ERROR
+ fapl = -1;
+ if(H5Pclose(dcpl) < 0)
+ TEST_ERROR
+ dcpl = -1;
+ PASSED();
+ return 0;
+
+ error:
+ H5E_BEGIN_TRY {
+ H5Sclose(srcspace);
+ H5Sclose(vspace);
+ H5Pclose(dcpl);
+ H5Pclose(fapl);
+ H5Dclose(srcdset);
+ H5Dclose(vdset);
+ H5Fclose(srcfile);
+ H5Fclose(vfile);
+ } H5E_END_TRY;
+ return -1;
+} /* test_versionbounds() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
*
- * Return: Success: exit(EXIT_SUCCESS)
+ * Purpose: Tests the dataset interface (H5D)
*
- * Failure: exit(EXIT_FAILURE)
+ * Return: Success: exit(EXIT_SUCCESS)
+ * Failure: exit(EXIT_FAILURE)
*
- * Programmer: Robb Matzke
- * Tuesday, December 9, 1997
+ * Programmer: Robb Matzke
+ * Tuesday, December 9, 1997
*
*-------------------------------------------------------------------------
*/
int
main(void)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t file, grp, fapl, fapl2;
- hid_t fcpl = -1, fcpl2 = -1;
+ char filename[FILENAME_BUF_SIZE];
+ hid_t file, grp, fapl, fapl2;
+ hid_t fcpl = -1, fcpl2 = -1;
unsigned new_format;
unsigned paged;
- int mdc_nelmts;
- size_t rdcc_nelmts;
- size_t rdcc_nbytes;
- double rdcc_w0;
- int nerrors = 0;
+ int mdc_nelmts;
+ size_t rdcc_nelmts;
+ size_t rdcc_nbytes;
+ double rdcc_w0;
+ int nerrors = 0;
const char *envval;
- hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
/* Don't run this test using certain file drivers */
envval = HDgetenv("HDF5_DRIVER");
@@ -12924,6 +13218,9 @@ main(void)
nerrors += (test_scatter_error() < 0 ? 1 : 0);
nerrors += (test_gather_error() < 0 ? 1 : 0);
+ /* Tests version bounds using its own file */
+ nerrors += (test_versionbounds() < 0 ? 1 : 0);
+
/* Run misc tests */
nerrors += dls_01_main();
diff --git a/test/gen_bounds.c b/test/gen_bounds.c
new file mode 100644
index 0000000..9702176
--- /dev/null
+++ b/test/gen_bounds.c
@@ -0,0 +1,606 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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: This program is to generate HDF5 data files used to test
+ * version bounds.
+ *
+ * Description
+ * ===========
+ * gen_bounds.c will generate the following files:
+ * - bounds_earliest_latest.h5
+ * - bounds_earliest_v18.h5
+ * - bounds_latest_latest.h5
+ * - bounds_v18_latest.h5
+ * - bounds_v18_v18.h5
+ * These files are copied to 1.6 and 1.8 libraries for verifying
+ * that they can or cannot read particular file format.
+ */
+
+#include "h5test.h"
+
+/***********************************************************************
+ * gen_earliest_latest() creates file "bounds_earliest_latest.h5"
+ *
+ * File contents:
+ * - Version 0 superblock (default)
+ * - A chunked dataset with layout version 3, "DS_chunked_layout_3". (default)
+ * - A chunked dataset with layout version 4, "DS_chunked_layout_4". (H5Pset_chunk_opts)
+ *
+ * Return: SUCCEED/FAIL
+ *
+ ***********************************************************************/
+
+/* File names for different file format */
+#define FILENAME_E_L "bounds_earliest_latest.h5"
+#define FILENAME_E_18 "bounds_earliest_v18.h5"
+#define FILENAME_L_L "bounds_latest_latest.h5"
+#define FILENAME_18_L "bounds_v18_latest.h5"
+#define FILENAME_18_18 "bounds_v18_v18.h5"
+
+/* 2-D dataset with fixed dimensions */
+#define RANK 2
+#define DIM1 100
+#define DIM2 200
+#define CHK_DIM1 50
+#define CHK_DIM2 50
+
+static herr_t gen_earliest_latest(void)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t space = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ float *buf = NULL; /* Buffer for writing data */
+ float *bufp = NULL; /* Pointer to data buffer */
+ hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
+ hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
+ int i, j;
+ herr_t ret = SUCCEED; /* Generic return value */
+
+ /* Create file creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR;
+
+ /* Create file access property list */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
+
+ /* Set the "use the earliest/latest version of the format" bounds
+ for creating objects in the file */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR;
+
+ /* Create file */
+ if((fid = H5Fcreate(FILENAME_E_L, H5F_ACC_TRUNC, fcpl, fapl)) <0)
+ TEST_ERROR;
+
+ /* Close file property lists */
+ if(H5Pclose(fapl) < 0) TEST_ERROR;
+ if(H5Pclose(fcpl) < 0) TEST_ERROR;
+
+ /*
+ * Add a chunked dataset with layout version 3 (default)
+ */
+ buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
+ if (buf == NULL) TEST_ERROR;
+
+ /* Fill sample data */
+ bufp = buf;
+ for (i = 0; i < DIM1; i++)
+ for (j = 0; j < DIM2; j++)
+ *bufp = 100.0F;
+
+ /* Create the dataspace */
+ if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
+
+ /* Create the dataset creation property list */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+
+ /* Set up for chunked data */
+ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
+
+ /* Create and write the dataset */
+ dset = H5Dcreate2(fid, "DS_chunked_layout_3", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ if (dset < 0) TEST_ERROR;
+
+ ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ if (ret < 0) TEST_ERROR;
+
+ /* Close property list and dataset, will reuse dataspace */
+ if(H5Pclose(dcpl) < 0) TEST_ERROR;
+ if(H5Dclose(dset) < 0) TEST_ERROR;
+
+ /*
+ * Add a chunked dataset with layout version 4 (H5Pset_chunk_opts)
+ */
+
+ /* Create the dataset creation property list */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+
+ /* Set up for chunked data */
+ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
+
+ /* Disable partial chunk filters, triggers layout version 4 */
+ if(H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
+ TEST_ERROR;
+
+ /* Create and write the dataset */
+ dset = H5Dcreate2(fid, "DS_chunked_layout_4", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ if (dset < 0) TEST_ERROR;
+ ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ if (ret < 0) TEST_ERROR;
+
+ /* Release allocated buffer */
+ HDfree(buf);
+ bufp = buf = NULL;
+
+ /* Close everything */
+ if(H5Pclose(dcpl) < 0) TEST_ERROR;
+ if(H5Dclose(dset) < 0) TEST_ERROR;
+ if(H5Sclose(space) < 0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR;
+
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ H5Sclose(space);
+ H5Pclose(dcpl);
+ H5Pclose(fcpl);
+ H5Pclose(fapl);
+ H5Fclose(fid);
+ HDfree(buf);
+ } H5E_END_TRY;
+ return FAIL;
+} /* gen_earliest_latest */
+
+/***********************************************************************
+ * gen_earliest_v18() creates file "bounds_earliest_v18.h5"
+ *
+ * File contents:
+ * - Version 0 superblock (default)
+ * - A chunked dataset with layout version 3, "DS_chunked_layout_3". (default)
+ *
+ * Return: SUCCEED/FAIL
+ *
+ ***********************************************************************/
+static herr_t gen_earliest_v18(void)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t space = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ float *buf = NULL; /* Buffer for writing data */
+ float *bufp = NULL; /* Pointer to data buffer */
+ hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
+ hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
+ int i, j;
+ herr_t ret = SUCCEED; /* Generic return value */
+
+ /* Create file creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR;
+
+ /* Create file access property list */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
+
+ /* Set the "use the earliest/v18 version of the format" bounds
+ for creating objects in the file */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_V18) < 0)
+ TEST_ERROR;
+
+ /* Create file */
+ if((fid = H5Fcreate(FILENAME_E_18, H5F_ACC_TRUNC, fcpl, fapl)) <0)
+ TEST_ERROR;
+
+ /* Close file property lists */
+ if(H5Pclose(fapl) < 0) TEST_ERROR;
+ if(H5Pclose(fcpl) < 0) TEST_ERROR;
+
+ /*
+ * Add a chunked dataset with layout version 3 (default)
+ */
+
+ buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
+ if (buf == NULL) TEST_ERROR;
+
+ /* Fill sample data */
+ bufp = buf;
+ for (i = 0; i < DIM1; i++)
+ for (j = 0; j < DIM2; j++)
+ *bufp = 100.0F;
+
+ /* Create the dataspace */
+ if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
+
+ /* Create the dataset creation property list */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+
+ /* Set up for chunked data */
+ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
+
+ /* Create and write the dataset */
+ dset = H5Dcreate2(fid, "DS_chunked_layout_3", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ if (dset < 0) TEST_ERROR;
+
+ ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ if (ret < 0) TEST_ERROR;
+
+ /* Release allocated buffer */
+ HDfree(buf);
+ bufp = buf = NULL;
+
+ /* Close everything */
+ if(H5Pclose(dcpl) < 0) TEST_ERROR;
+ if(H5Dclose(dset) < 0) TEST_ERROR;
+ if(H5Sclose(space) < 0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR;
+
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ H5Sclose(space);
+ H5Pclose(dcpl);
+ H5Pclose(fcpl);
+ H5Pclose(fapl);
+ H5Fclose(fid);
+ HDfree(buf);
+ } H5E_END_TRY;
+ return FAIL;
+} /* gen_earliest_v18 */
+
+/***********************************************************************
+ * gen_latest_latest() creates file "bounds_latest_latest.h5"
+ *
+ * File contents:
+ * - Version 3 superblock (triggered by H5Fcreate with H5F_ACC_SWMR_WRITE)
+ * - A chunked dataset with layout version 4, "DS_chunked_layout_4". (H5Pset_chunk_opts)
+ *
+ * NOTE: As of Feb 2018, latest is 1.10.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ ***********************************************************************/
+static herr_t gen_latest_latest(void)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t space = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ float *buf = NULL; /* Buffer for writing data */
+ float *bufp = NULL; /* Pointer to data buffer */
+ hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
+ hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
+ int i, j;
+ herr_t ret = SUCCEED; /* Generic return value */
+
+ /* Create file with H5F_ACC_SWMR_WRITE, triggers version 3 superblock */
+ fid = H5Fcreate(FILENAME_L_L, H5F_ACC_SWMR_WRITE, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid < 0) TEST_ERROR;
+
+ /*
+ * Add a chunked dataset with layout version 4 (H5Pset_chunk_opts)
+ */
+
+ buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
+ if (buf == NULL) TEST_ERROR;
+
+ /* Fill sample data */
+ bufp = buf;
+ for (i = 0; i < DIM1; i++)
+ for (j = 0; j < DIM2; j++)
+ *bufp = 100.0F;
+
+ /* Create the dataspace */
+ if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
+
+ /* Create the dataset creation property list */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+
+ /* Set up for chunked data */
+ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
+
+ /* Disable partial chunk filters, triggers layout version 4 */
+ if(H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
+ TEST_ERROR;
+
+ /* Create and write the dataset */
+ dset = H5Dcreate2(fid, "DS_chunked_layout_4", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ if (dset < 0) TEST_ERROR;
+ ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ if (ret < 0) TEST_ERROR;
+
+ /* Release allocated buffer */
+ HDfree(buf);
+ bufp = buf = NULL;
+
+ /* Close everything */
+ if(H5Pclose(dcpl) < 0) TEST_ERROR;
+ if(H5Dclose(dset) < 0) TEST_ERROR;
+ if(H5Sclose(space) < 0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR;
+
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ H5Sclose(space);
+ H5Pclose(dcpl);
+ H5Fclose(fid);
+ HDfree(buf);
+ } H5E_END_TRY;
+ return FAIL;
+} /* gen_latest_latest */
+
+/***********************************************************************
+ * gen_v18_latest() creates file "bounds_v18_latest.h5"
+ *
+ * File contents:
+ * - Version 2 superblock
+ * - A chunked dataset with layout version 3, "DS_chunked_layout_3". (default)
+ *
+ * Return: SUCCEED/FAIL
+ *
+ ***********************************************************************/
+static herr_t gen_v18_latest(void)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t space = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ float *buf = NULL; /* Buffer for writing data */
+ float *bufp = NULL; /* Pointer to data buffer */
+ hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
+ hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
+ int i, j;
+ herr_t ret = SUCCEED; /* Generic return value */
+
+ /* Create file creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR;
+
+ /* Create file access property list */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
+
+ /* Set the "use the v18/latest version of the format" bounds
+ for creating objects in the file, also trigger version 2 superblock */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR;
+
+ /* Create file */
+ if((fid = H5Fcreate(FILENAME_18_L, H5F_ACC_TRUNC, fcpl, fapl)) <0)
+ TEST_ERROR;
+
+ /* Close file property lists */
+ if(H5Pclose(fapl) < 0) TEST_ERROR;
+ if(H5Pclose(fcpl) < 0) TEST_ERROR;
+
+ /*
+ * Add a chunked dataset with layout version 3 (default)
+ */
+
+ buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
+ if (buf == NULL) TEST_ERROR;
+
+ /* Fill sample data */
+ bufp = buf;
+ for (i = 0; i < DIM1; i++)
+ for (j = 0; j < DIM2; j++)
+ *bufp = 100.0F;
+
+ /* Create the dataspace */
+ if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
+
+ /* Create the dataset creation property list */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+
+ /* Set up for chunked data */
+ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
+
+ /* Create and write the dataset */
+ dset = H5Dcreate2(fid, "DS_chunked_layout_3", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ if (dset < 0) TEST_ERROR;
+ ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ if (ret < 0) TEST_ERROR;
+
+ /* Release allocated buffer */
+ HDfree(buf);
+ bufp = buf = NULL;
+
+ /* Close property list and dataset, will reuse dataspace */
+ if(H5Pclose(dcpl) < 0) TEST_ERROR;
+ if(H5Dclose(dset) < 0) TEST_ERROR;
+ if(H5Sclose(space) < 0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR;
+
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ H5Sclose(space);
+ H5Pclose(dcpl);
+ H5Pclose(fcpl);
+ H5Pclose(fapl);
+ H5Fclose(fid);
+ HDfree(buf);
+ } H5E_END_TRY;
+ return FAIL;
+} /* gen_v18_latest */
+
+/***********************************************************************
+ * gen_v18_v18() creates file "bounds_v18_v18.h5"
+ *
+ * File contents:
+ * - Version 2 superblock (H5Pset_libver_bounds(v18, v18)
+ * - A chunked dataset with layout version 3, "DS_chunked_layout_3". (default)
+ * - A chunked dataset with layout version 4, "DS_chunked_layout_4". (H5Pset_chunk_opts)
+ *
+ * Return: SUCCEED/FAIL
+ *
+ ***********************************************************************/
+static herr_t gen_v18_v18(void)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t fcpl = -1; /* File creation property list ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t space = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ float *buf = NULL; /* Buffer for writing data */
+ float *bufp = NULL; /* Pointer to data buffer */
+ hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
+ hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
+ int i, j;
+ herr_t ret = SUCCEED; /* Generic return value */
+
+ /* Create file creation property list */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR;
+
+ /* Create file access property list */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
+
+ /* Set the "use the v18 version of the format" bounds
+ for creating objects in the file */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_V18) < 0)
+ TEST_ERROR;
+
+ /* Create file */
+ if((fid = H5Fcreate(FILENAME_18_18, H5F_ACC_TRUNC, fcpl, fapl)) <0)
+ TEST_ERROR;
+
+ /* Close file property lists */
+ if(H5Pclose(fapl) < 0) TEST_ERROR;
+ if(H5Pclose(fcpl) < 0) TEST_ERROR;
+
+ /*
+ * Add a chunked dataset with layout version 3 (default)
+ */
+
+ buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
+ if (buf == NULL) TEST_ERROR;
+
+ /* Fill sample data */
+ bufp = buf;
+ for (i = 0; i < DIM1; i++)
+ for (j = 0; j < DIM2; j++)
+ *bufp = 100.0F;
+
+ /* Create the dataspace */
+ if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
+
+ /* Create the dataset creation property list */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+
+ /* Set up for chunked data */
+ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
+
+ /* Create and write the dataset */
+ dset = H5Dcreate2(fid, "DS_chunked_layout_3", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ if (dset < 0) TEST_ERROR;
+ ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ if (ret < 0) TEST_ERROR;
+
+ /* Close property list and dataset, will reuse dataspace */
+ if(H5Pclose(dcpl) < 0) TEST_ERROR;
+ if(H5Dclose(dset) < 0) TEST_ERROR;
+
+ /* Close the file, then reopen it with the latest version */
+ if(H5Fclose(fid) < 0) TEST_ERROR;
+
+ /* Create file access property list */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
+
+ /* Set the "use the v18/latest version of the format" bounds
+ for creating a layout version 4 object in the file */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR;
+
+ if((fid = H5Fopen(FILENAME_18_18, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR;
+
+ /*
+ * Add a chunked dataset with layout version 4 (H5Pset_chunk_opts)
+ */
+
+ /* Create the dataset creation property list */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+
+ /* Set up for chunked data */
+ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
+
+ /* Disable partial chunk filters */
+ if(H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
+ TEST_ERROR;
+
+ /* Create and write the dataset */
+ dset = H5Dcreate2(fid, "DS_chunked_layout_4", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ if (dset < 0) TEST_ERROR;
+ ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ if (ret < 0) TEST_ERROR;
+
+ /* Release allocated buffer */
+ HDfree(buf);
+ bufp = buf = NULL;
+
+ /* Close everything */
+ if(H5Pclose(dcpl) < 0) TEST_ERROR;
+ if(H5Pclose(fapl) < 0) TEST_ERROR;
+ if(H5Dclose(dset) < 0) TEST_ERROR;
+ if(H5Sclose(space) < 0) TEST_ERROR;
+ if(H5Fclose(fid) < 0) TEST_ERROR;
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ H5Sclose(space);
+ H5Pclose(dcpl);
+ H5Pclose(fcpl);
+ H5Pclose(fapl);
+ H5Fclose(fid);
+ HDfree(buf);
+ } H5E_END_TRY;
+ return FAIL;
+} /* gen_v18_v18 */
+
+int main(void)
+{
+ /* Generate file bounds_earliest_latest.h5 */
+ if (gen_earliest_latest() < 0) TEST_ERROR;
+
+ /* Generate file bounds_earliest_v18.h5 */
+ if (gen_earliest_v18() < 0) TEST_ERROR;
+
+ /* Generate file bounds_latest_latest.h5 */
+ if (gen_latest_latest() < 0) TEST_ERROR;
+
+ /* Generate file bounds_v18_latest.h5 */
+ if (gen_v18_latest() < 0) TEST_ERROR;
+
+ /* Generate file bounds_v18_v18.h5 */
+ if (gen_v18_v18() < 0) TEST_ERROR;
+
+ return EXIT_SUCCESS;
+
+error:
+ return EXIT_FAILURE;
+}
+
diff --git a/test/genall5.c b/test/genall5.c
index a48f14b..e3a9c96 100644
--- a/test/genall5.c
+++ b/test/genall5.c
@@ -1248,29 +1248,55 @@ void
os_grp_0(hid_t fid, const char *group_name)
{
hid_t gid = -1;
+ hid_t fapl = -1;
+ H5F_libver_t low, high;
+
herr_t ret;
- if ( pass ) { /* turn file format latest off */
+ if ( pass ) { /* get the file's file access property list */
- ret = H5Fset_latest_format(fid, FALSE);
+ fapl = H5Fget_access_plist(fid);
+ if ( fapl <= 0 ) {
- if ( ret < 0 ) {
+ pass = FALSE;
+ failure_mssg = "os_grp_0: H5Fget_access_plist() failed.";
+ }
+ HDassert(fapl > 0);
+ }
+
+ if ( pass ) { /* get low and high bounds from fapl */
- pass = FALSE;
- failure_mssg = "os_grp_0: H5Fset_latest_format() failed(1).";
- }
+ ret = H5Pget_libver_bounds(fapl, &low, &high);
+ if ( ret < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "os_grp_0: H5Pget_libver_bounds() failed(1).";
+ }
HDassert(ret >= 0);
}
+ if ( pass ) { /* turn file format latest off */
+
+ if(low >= H5F_LIBVER_V18) {
+ ret = H5Fset_libver_bounds(fid, H5F_LIBVER_EARLIEST, high);
+ if ( ret < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "os_grp_0: H5Fset_libver_bounds() failed(1).";
+ }
+ HDassert(ret >= 0);
+ }
+ }
+
if ( pass ) {
gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT);
if ( gid <= 0 ) {
- pass = FALSE;
- failure_mssg = "os_grp_0: H5Gcreate2() failed.";
- }
+ pass = FALSE;
+ failure_mssg = "os_grp_0: H5Gcreate2() failed.";
+ }
HDassert(gid > 0);
}
@@ -1278,24 +1304,25 @@ os_grp_0(hid_t fid, const char *group_name)
ret = H5Gclose(gid);
- if ( ret < 0 ) {
+ if ( ret < 0 ) {
- pass = FALSE;
- failure_mssg = "os_grp_0: H5Gclose() failed.";
- }
+ pass = FALSE;
+ failure_mssg = "os_grp_0: H5Gclose() failed.";
+ }
HDassert(ret >= 0);
}
- if ( pass ) { /* turn file format latest on */
+ if ( pass ) { /* restore low and high bounds */
- ret = H5Fset_latest_format(fid, TRUE);
-
- if ( ret < 0 ) {
+ if(low >= H5F_LIBVER_V18) {
+ ret = H5Fset_libver_bounds(fid, low, high);
+ if ( ret < 0 ) {
- pass = FALSE;
- failure_mssg = "os_grp_0: H5Fset_latest_format() failed(2).";
- }
- HDassert(ret >= 0);
+ pass = FALSE;
+ failure_mssg = "os_grp_0: H5Fset_libver_bounds() failed(1).";
+ }
+ HDassert(ret >= 0);
+ }
}
return;
@@ -1462,28 +1489,53 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks)
{
hid_t gid = -1;
unsigned u;
+ hid_t fapl = -1;
+ H5F_libver_t low, high;
herr_t ret;
- if ( pass ) { /* turn file format latest off */
+ if ( pass ) { /* get the file's file access property list */
- ret = H5Fset_latest_format(fid, FALSE);
+ fapl = H5Fget_access_plist(fid);
+ if ( fapl <= 0 ) {
- if ( ret < 0 ) {
+ pass = FALSE;
+ failure_mssg = "os_grp_n: H5Fget_access_plist() failed.";
+ }
+ HDassert(fapl > 0);
+ }
- pass = FALSE;
- failure_mssg = "os_grp_n: H5Fset_latest_format() failed(1).";
- }
+ if ( pass ) { /* get low and high bounds from fapl */
+
+ ret = H5Pget_libver_bounds(fapl, &low, &high);
+ if ( ret < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "os_grp_0: H5Pget_libver_bounds() failed(1).";
+ }
HDassert(ret >= 0);
}
+ if ( pass ) { /* turn file format latest off */
+
+ if(low >= H5F_LIBVER_V18) {
+ ret = H5Fset_libver_bounds(fid, H5F_LIBVER_EARLIEST, high);
+ if ( ret < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "os_grp_0: H5Fset_libver_bounds() failed(1).";
+ }
+ HDassert(ret >= 0);
+ }
+ }
+
if ( pass ) {
gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT);
if ( gid <= 0 ) {
- pass = FALSE;
- failure_mssg = "os_grp_n: H5Gcreate2() failed.";
+ pass = FALSE;
+ failure_mssg = "os_grp_n: H5Gcreate2() failed.";
}
HDassert(gid > 0);
}
@@ -1538,16 +1590,17 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks)
assert(ret >= 0);
}
- if ( pass ) { /* turn file format latest on */
-
- ret = H5Fset_latest_format(fid, TRUE);
+ if ( pass ) { /* restore low and high bounds */
- if ( ret < 0 ) {
+ if(low >= H5F_LIBVER_V18) {
+ ret = H5Fset_libver_bounds(fid, low, high);
+ if ( ret < 0 ) {
- pass = FALSE;
- failure_mssg = "os_grp_n: H5Fset_latest_format() failed(2).";
- }
- HDassert(ret >= 0);
+ pass = FALSE;
+ failure_mssg = "os_grp_n: H5Fset_libver_bounds() failed(2).";
+ }
+ HDassert(ret >= 0);
+ }
}
return;
diff --git a/test/mf.c b/test/mf.c
index fea5ee2..35dfab3 100644
--- a/test/mf.c
+++ b/test/mf.c
@@ -6920,6 +6920,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
H5FD_mem_t type; /* File allocation type */
H5FS_stat_t fs_stat; /* Information for free-space manager */
haddr_t addr1, addr2, addr3, addr4; /* File address for H5FD_MEM_SUPER */
+ haddr_t addrx;
H5FD_mem_t fs_type;
hbool_t contig_addr_vfd;
hbool_t ran_H5MF_tidy_self_referential_fsm_hack = FALSE;
@@ -7054,6 +7055,12 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
if(H5MF_xfree(f, type, H5AC_ind_read_dxpl_id, addr4, (hsize_t)TBLOCK_SIZE4) < 0)
FAIL_STACK_ERROR
+ if(!new_format) {
+ /* Need to take up this space so that the free-space manager will go away */
+ if(HADDR_UNDEF == (addrx = H5MF_alloc(f, type, H5AC_ind_read_dxpl_id, (hsize_t)103)))
+ FAIL_STACK_ERROR
+ }
+
/* The H5FD_MEM_SUPER free-space manager will go away at H5MF_close() */
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -7065,7 +7072,6 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
/* Get a pointer to the internal file object */
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
-
/* Verify that the H5FD_MEM_SUPER free-space manager is not there */
if(H5F_addr_defined(f->shared->fs_addr[fs_type]))
TEST_ERROR
diff --git a/test/objcopy.c b/test/objcopy.c
index 216d111..c4bcbf3 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -18,9 +18,18 @@
* Purpose: Test H5Ocopy().
*/
+#include "hdf5.h"
#include "testhdf5.h"
#include "H5srcdir.h"
+#include "H5Bprivate.h"
+#include "H5Iprivate.h"
+#include "H5Pprivate.h"
+
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_TESTING
+#include "H5Fpkg.h" /* File access */
+
/*
* This file needs to access private information from the H5S package.
* This file also needs to access the dataspace testing code.
@@ -45,12 +54,22 @@
#define H5D_TESTING
#include "H5Dpkg.h" /* Datasets */
+/*
+ * This file needs to access private information from the H5O package.
+ * This file also needs to access the dataspace testing code.
+ */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
+#define H5O_TESTING
+#include "H5Opkg.h" /* Object header */
+
const char *FILENAME[] = {
"objcopy_src",
"objcopy_dst",
"objcopy_ext",
"objcopy_src2",
+ "verbound_src",
+ "verbound_dst",
NULL
};
@@ -127,6 +146,7 @@ const char *FILENAME[] = {
#define NAME_LINK_EXTERN_DANGLE "/g_links/external_link_to_nowhere"
#define NAME_LINK_EXTERN_DANGLE2 "/g_links2/external_link_to_nowhere"
#define NAME_OLD_FORMAT "/dset1"
+#define NAME_DSET_NULL "DSET_NULL"
#define NAME_BUF_SIZE 1024
#define ATTR_NAME_LEN 80
@@ -2089,6 +2109,184 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_copy_dataset_versionbounds
+ *
+ * Purpose: Verify copying dataset works as expected in various version
+ * bound combination.
+ *
+ * Description:
+ * Create a simple dataset in SRC file using default versions.
+ * For each valid version bound combination, create a DST file,
+ * and attempt to copy the SRC dataset to the DST file.
+ * When copying fails, verify that the failure is a result of
+ * the invalid bounds, that is, DST has lower bounds than SRC.
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src)
+{
+ hid_t fid_src = -1, fid_dst = -1; /* Source and destination file IDs */
+ hid_t fapl_dst = -1; /* File access plist for dest file */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did_src = -1, did_dst = -1; /* Source and destination dataset IDs */
+ int buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */
+ hsize_t dim2d[2]; /* Dataset dimensions */
+ char src_fname[NAME_BUF_SIZE]; /* Name of source file */
+ char dst_fname[NAME_BUF_SIZE]; /* Name of destination file */
+ H5F_libver_t low, high; /* File format bounds */
+ H5F_libver_t low_src, high_src; /* Source file format bounds */
+ unsigned srcdset_fillversion; /* Fill version of source dataset */
+ hbool_t valid_high = FALSE; /* TRUE if high bound is valid */
+ int i, j; /* Local index variables */
+ H5D_t *dsetp = NULL; /* Pointer to internal dset structure */
+ herr_t ret; /* Generic return value */
+
+ TESTING("H5Ocopy(): simple dataset with version bounds");
+
+ /* Initialize write buffer */
+ for (i=0; i<DIM_SIZE_1; i++)
+ for (j=0; j<DIM_SIZE_2; j++)
+ buf[i][j] = 10000 + 100*i+j;
+
+ /* Create a file access property list for destination file */
+ if ((fapl_dst = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR
+
+ /* Initialize the filenames */
+ h5_fixname(FILENAME[4], fapl_src, src_fname, sizeof src_fname);
+ h5_fixname(FILENAME[5], fapl_dst, dst_fname, sizeof dst_fname);
+
+ /* Reset file address checking info */
+ addr_reset();
+
+ /* Create source file */
+ fid_src = H5Fcreate(src_fname, H5F_ACC_TRUNC, fcpl_src, fapl_src);
+ if (fid_src < 0) TEST_ERROR
+
+ /* Set dataspace dimensions */
+ dim2d[0] = DIM_SIZE_1;
+ dim2d[1] = DIM_SIZE_2;
+
+ /* Create 2D dataspace */
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+
+ /* Create 2D int dataset in SRC file */
+ did_src = H5Dcreate2(fid_src, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (did_src < 0) TEST_ERROR
+
+ /* Write data into SRC file */
+ ret = H5Dwrite(did_src, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ if (ret < 0) TEST_ERROR
+
+ /* Get the internal dset ptr to get the fill version for verifying later */
+ if ((dsetp = (H5D_t *)H5I_object(did_src)) == NULL) TEST_ERROR
+ srcdset_fillversion = dsetp->shared->dcpl_cache.fill.version;
+
+ /* Close dataspace */
+ if(H5Sclose(sid) < 0) TEST_ERROR
+
+ /* Close the dataset */
+ if(H5Dclose(did_src) < 0) TEST_ERROR
+
+ /* Close the SRC file */
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
+
+ /* Open the source file with read-only */
+ fid_src = H5Fopen(src_fname, H5F_ACC_RDONLY, fapl_src);
+ if (fid_src < 0) TEST_ERROR
+
+ /* Loop through all the combinations of low/high library format bounds,
+ skipping invalid combinations. Create a destination file and copy the
+ source dataset to it, then verify */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+
+ /* Set version bounds */
+ H5E_BEGIN_TRY {
+ ret = H5Pset_libver_bounds(fapl_dst, low, high);
+ } H5E_END_TRY;
+
+ if (ret < 0) /* Invalid low/high combinations */
+ continue;
+
+ /* Create destination file */
+ fid_dst = H5Fcreate(dst_fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_dst);
+ if (fid_dst < 0) TEST_ERROR
+
+ /* Create an uncopied object in destination file so that addresses
+ in source and destination files aren't the same */
+ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Try to copy the dataset */
+ H5E_BEGIN_TRY {
+ ret = H5Ocopy(fid_src, NAME_DATASET_SIMPLE, fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT, H5P_DEFAULT);
+ } H5E_END_TRY;
+
+ /* If copy failed, check if the failure is expected */
+ if (ret < 0)
+ {
+ /* Failure is valid if fill version of source dataset is
+ greater than destination */
+ if (srcdset_fillversion <= H5O_fill_ver_bounds[high])
+ TEST_ERROR
+
+ /* Close the DST file before continue */
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
+ continue;
+ }
+
+ /* Close the DST file */
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
+
+ /* Open destination file */
+ fid_dst = H5Fopen(dst_fname, H5F_ACC_RDWR, fapl_dst);
+ if (fid_dst < 0) TEST_ERROR
+
+ /* Open the datasets to compare */
+ did_src = H5Dopen2(fid_src, NAME_DATASET_SIMPLE, H5P_DEFAULT);
+ if (did_src < 0) TEST_ERROR
+ did_dst = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT);
+ if (did_dst < 0) TEST_ERROR
+
+ /* Check if the datasets are equal */
+ if (compare_datasets(did_src, did_dst, H5P_DEFAULT, buf) != TRUE)
+ TEST_ERROR
+
+ /* Close the datasets */
+ if(H5Dclose(did_dst) < 0) TEST_ERROR
+ if(H5Dclose(did_src) < 0) TEST_ERROR
+
+ /* Close the DST file */
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
+
+ } /* for high */
+ } /* for low */
+
+ /* Close property list and source file */
+ if (H5Pclose(fapl_dst) < 0) TEST_ERROR
+ if (H5Fclose(fid_src) < 0) TEST_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(did_dst);
+ H5Dclose(did_src);
+ H5Sclose(sid);
+ H5Pclose(fapl_dst);
+ H5Fclose(fid_dst);
+ H5Fclose(fid_src);
+ } H5E_END_TRY;
+
+ return 1;
+} /* end test_copy_dataset_versionbounds */
+
+
+/*-------------------------------------------------------------------------
* Function: test_copy_dataset_simple_samefile
*
* Purpose: Create a simple dataset in SRC file and copy it to SRC file
@@ -14017,6 +14215,7 @@ main(void)
/* The tests... */
nerrors += test_copy_dataset_simple(fcpl_src, fcpl_dst, src_fapl, dst_fapl);
+ nerrors += test_copy_dataset_versionbounds(fcpl_src, src_fapl);
nerrors += test_copy_dataset_simple_samefile(fcpl_src, src_fapl);
/* Test with dataset opened in the file or not */
diff --git a/test/ohdr.c b/test/ohdr.c
index 3915b38..43346a5 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -738,6 +738,42 @@ error:
return FAIL;
} /* test_unknown() */
+#define STR_EARLIEST "earliest"
+#define STR_V18 "v18"
+#define STR_LATEST "latest"
+char *version_string(H5F_libver_t libver)
+{
+ char *str = NULL;
+
+ str = (char *) malloc(20 * sizeof(char));
+ if (str == NULL)
+ {
+ fprintf(stderr, "Allocation failed\n");
+ exit(1);
+ }
+
+ switch(libver) {
+ case H5F_LIBVER_EARLIEST:
+ strcpy(str, STR_EARLIEST);
+ break;
+
+ case H5F_LIBVER_V18:
+ strcpy(str, STR_V18);
+ break;
+
+ case H5F_LIBVER_V110:
+ HDassert(H5F_LIBVER_LATEST == H5F_LIBVER_V110);
+ strcpy(str, STR_LATEST);
+ break;
+
+ case H5F_LIBVER_ERROR:
+ case H5F_LIBVER_NBOUNDS:
+ default:
+ sprintf(str, "%ld", (long)libver);
+ break;
+ } /* end switch */
+} /* end of version_string */
+
/*-------------------------------------------------------------------------
* Function: main
@@ -755,32 +791,40 @@ error:
int
main(void)
{
- hid_t fapl = -1, file = -1;
- H5F_t *f = NULL;
- char filename[1024];
- H5O_hdr_info_t hdr_info; /* Object info */
- H5O_loc_t oh_loc; /* Object header locations */
- time_t time_new, ro;
- int i; /* Local index variable */
- unsigned b; /* Index for "new format" loop */
- herr_t ret; /* Generic return value */
+ hid_t fapl = -1;
+ hid_t file = -1;
+ H5F_t *f = NULL;
+ char filename[1024];
+ H5O_hdr_info_t hdr_info; /* Object info */
+ H5O_loc_t oh_loc; /* Object header locations */
+ H5F_libver_t low, high; /* File format bounds */
+ time_t time_new, ro;
+ unsigned b; /* Index for "new format" loop */
+ char msg[80]; /* Message for file format version */
+ int i; /* Local index variable */
+ herr_t ret; /* Generic return value */
/* Reset library */
h5_reset();
fapl = h5_fileaccess();
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- /* Loop over old & new formats */
- for(b = FALSE; b <= TRUE; b++) {
- /* Display info about testing */
- if(b)
- HDputs("Using new file format:");
- else
- HDputs("Using default file format:");
+ /* Loop through all the combinations of low/high library format bounds */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
- /* Set the format to use for the file */
- if(H5Pset_libver_bounds(fapl, (b ? H5F_LIBVER_LATEST : H5F_LIBVER_EARLIEST), H5F_LIBVER_LATEST) < 0)
- FAIL_STACK_ERROR
+ /* Set version bounds before opening the file */
+ H5E_BEGIN_TRY {
+ ret = H5Pset_libver_bounds(fapl, low, high);
+ } H5E_END_TRY;
+
+ if (ret < 0) /* Invalid low/high combinations */
+ continue;
+
+ /* Display info about testing */
+ sprintf(msg, "Using file format version: (%s, %s)", version_string(low),
+ version_string(high));
+ HDputs(msg);
/* test on object continuation block */
if(test_cont(filename, fapl) < 0)
@@ -977,7 +1021,9 @@ main(void)
/* Test object header creation metadata cache issues */
if(test_ohdr_cache(filename, fapl) < 0)
TEST_ERROR
- } /* end for */
+
+ } /* high */
+ } /* low */
/* Verify symbol table messages are cached */
if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR
diff --git a/test/set_extent.c b/test/set_extent.c
index b9536e5..0467073 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -427,14 +427,35 @@ error:
*/
static int do_layouts( hid_t fapl )
{
+ H5F_libver_t low, high; /* Low and high bounds */
+ herr_t ret; /* Generic return value */
- TESTING("storage layout use");
+ TESTING("storage layout use - tested with all low/high library format bounds");
+ /* Loop through all the combinations of low/high library format bounds */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
- if (test_layouts( H5D_COMPACT, fapl ) < 0)
- goto error;
+ hid_t new_fapl;
- if (test_layouts( H5D_CONTIGUOUS, fapl ) < 0)
- goto error;
+ /* Copy plist to use locally to avoid modifying the original */
+ new_fapl = H5Pcopy(fapl);
+
+ /* Set version bounds */
+ H5E_BEGIN_TRY {
+ ret = H5Pset_libver_bounds(new_fapl, low, high);
+ } H5E_END_TRY;
+
+ if (ret < 0) /* Invalid low/high combinations */
+ continue;
+
+ if (test_layouts( H5D_COMPACT, new_fapl ) < 0)
+ goto error;
+
+ if (test_layouts( H5D_CONTIGUOUS, new_fapl ) < 0)
+ goto error;
+
+ } /* end for high */
+ } /* end for low */
PASSED();
diff --git a/test/testfiles/plist_files/dapl_32be b/test/testfiles/plist_files/dapl_32be
index 4dedda2..8dcf239 100644
--- a/test/testfiles/plist_files/dapl_32be
+++ b/test/testfiles/plist_files/dapl_32be
Binary files differ
diff --git a/test/testfiles/plist_files/dapl_32le b/test/testfiles/plist_files/dapl_32le
index 4dedda2..8dcf239 100644
--- a/test/testfiles/plist_files/dapl_32le
+++ b/test/testfiles/plist_files/dapl_32le
Binary files differ
diff --git a/test/testfiles/plist_files/dapl_64be b/test/testfiles/plist_files/dapl_64be
index 4dedda2..8dcf239 100644
--- a/test/testfiles/plist_files/dapl_64be
+++ b/test/testfiles/plist_files/dapl_64be
Binary files differ
diff --git a/test/testfiles/plist_files/dapl_64le b/test/testfiles/plist_files/dapl_64le
index 4dedda2..8dcf239 100644
--- a/test/testfiles/plist_files/dapl_64le
+++ b/test/testfiles/plist_files/dapl_64le
Binary files differ
diff --git a/test/testfiles/plist_files/def_dapl_32be b/test/testfiles/plist_files/def_dapl_32be
index 3df7289..880eae5 100644
--- a/test/testfiles/plist_files/def_dapl_32be
+++ b/test/testfiles/plist_files/def_dapl_32be
Binary files differ
diff --git a/test/testfiles/plist_files/def_dapl_32le b/test/testfiles/plist_files/def_dapl_32le
index 3df7289..880eae5 100644
--- a/test/testfiles/plist_files/def_dapl_32le
+++ b/test/testfiles/plist_files/def_dapl_32le
Binary files differ
diff --git a/test/testfiles/plist_files/def_dapl_64be b/test/testfiles/plist_files/def_dapl_64be
index 3df7289..880eae5 100644
--- a/test/testfiles/plist_files/def_dapl_64be
+++ b/test/testfiles/plist_files/def_dapl_64be
Binary files differ
diff --git a/test/testfiles/plist_files/def_dapl_64le b/test/testfiles/plist_files/def_dapl_64le
index 3df7289..880eae5 100644
--- a/test/testfiles/plist_files/def_dapl_64le
+++ b/test/testfiles/plist_files/def_dapl_64le
Binary files differ
diff --git a/test/testfiles/plist_files/def_fapl_32be b/test/testfiles/plist_files/def_fapl_32be
index 3b35501..6e94011 100644
--- a/test/testfiles/plist_files/def_fapl_32be
+++ b/test/testfiles/plist_files/def_fapl_32be
Binary files differ
diff --git a/test/testfiles/plist_files/def_fapl_32le b/test/testfiles/plist_files/def_fapl_32le
index 3b35501..6e94011 100644
--- a/test/testfiles/plist_files/def_fapl_32le
+++ b/test/testfiles/plist_files/def_fapl_32le
Binary files differ
diff --git a/test/testfiles/plist_files/def_fapl_64be b/test/testfiles/plist_files/def_fapl_64be
index 3b35501..6e94011 100644
--- a/test/testfiles/plist_files/def_fapl_64be
+++ b/test/testfiles/plist_files/def_fapl_64be
Binary files differ
diff --git a/test/testfiles/plist_files/def_fapl_64le b/test/testfiles/plist_files/def_fapl_64le
index 3b35501..6e94011 100644
--- a/test/testfiles/plist_files/def_fapl_64le
+++ b/test/testfiles/plist_files/def_fapl_64le
Binary files differ
diff --git a/test/testfiles/plist_files/fapl_32be b/test/testfiles/plist_files/fapl_32be
index 43e5e67..237b291 100644
--- a/test/testfiles/plist_files/fapl_32be
+++ b/test/testfiles/plist_files/fapl_32be
Binary files differ
diff --git a/test/testfiles/plist_files/fapl_32le b/test/testfiles/plist_files/fapl_32le
index 43e5e67..237b291 100644
--- a/test/testfiles/plist_files/fapl_32le
+++ b/test/testfiles/plist_files/fapl_32le
Binary files differ
diff --git a/test/testfiles/plist_files/fapl_64be b/test/testfiles/plist_files/fapl_64be
index 43e5e67..237b291 100644
--- a/test/testfiles/plist_files/fapl_64be
+++ b/test/testfiles/plist_files/fapl_64be
Binary files differ
diff --git a/test/testfiles/plist_files/fapl_64le b/test/testfiles/plist_files/fapl_64le
index 43e5e67..237b291 100644
--- a/test/testfiles/plist_files/fapl_64le
+++ b/test/testfiles/plist_files/fapl_64le
Binary files differ
diff --git a/test/testfiles/plist_files/lapl_32be b/test/testfiles/plist_files/lapl_32be
index f3e9865..9d81759 100644
--- a/test/testfiles/plist_files/lapl_32be
+++ b/test/testfiles/plist_files/lapl_32be
Binary files differ
diff --git a/test/testfiles/plist_files/lapl_32le b/test/testfiles/plist_files/lapl_32le
index f3e9865..9d81759 100644
--- a/test/testfiles/plist_files/lapl_32le
+++ b/test/testfiles/plist_files/lapl_32le
Binary files differ
diff --git a/test/testfiles/plist_files/lapl_64be b/test/testfiles/plist_files/lapl_64be
index f3e9865..9d81759 100644
--- a/test/testfiles/plist_files/lapl_64be
+++ b/test/testfiles/plist_files/lapl_64be
Binary files differ
diff --git a/test/testfiles/plist_files/lapl_64le b/test/testfiles/plist_files/lapl_64le
index f3e9865..9d81759 100644
--- a/test/testfiles/plist_files/lapl_64le
+++ b/test/testfiles/plist_files/lapl_64le
Binary files differ
diff --git a/test/tfile.c b/test/tfile.c
index 80ba4da..8b66603 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -24,15 +24,31 @@
#include "H5srcdir.h"
#include "H5Bprivate.h"
+#include "H5Iprivate.h"
#include "H5Pprivate.h"
/*
* This file needs to access private information from the H5F package.
* This file also needs to access the file testing code.
*/
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
-#include "H5Fpkg.h" /* File access */
+#include "H5Fpkg.h" /* File access */
+
+#define H5D_FRIEND /*suppress error about including H5Dpkg */
+#include "H5Dpkg.h" /* Dataset access */
+
+#define H5S_FRIEND /*suppress error about including H5Spkg */
+#include "H5Spkg.h" /* Dataspace */
+
+#define H5T_FRIEND /*suppress error about including H5Tpkg */
+#include "H5Tpkg.h" /* Datatype */
+
+#define H5A_FRIEND /*suppress error about including H5Apkg */
+#include "H5Apkg.h" /* Attributes */
+
+#define H5O_FRIEND /*suppress error about including H5Opkg */
+#include "H5Opkg.h" /* Object headers */
#define BAD_USERBLOCK_SIZE1 (hsize_t)1
#define BAD_USERBLOCK_SIZE2 (hsize_t)2
@@ -151,6 +167,25 @@ const char *FILESPACE_NAME[] = {
NULL
};
+/* Local test function declarations for version bounds */
+static void test_libver_bounds_low_high(void);
+static void test_libver_bounds_super(hid_t fapl);
+static void test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr);
+static void test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr);
+static void test_libver_bounds_obj(hid_t fapl);
+static void test_libver_bounds_dataset(hid_t fapl);
+static void test_libver_bounds_dataspace(hid_t fapl);
+static void test_libver_bounds_datatype(hid_t fapl);
+static void test_libver_bounds_datatype_check(hid_t fapl, hid_t tid);
+static void test_libver_bounds_attributes(hid_t fapl);
+
+#define FILE8 "tfile8.h5" /* Test file */
+
+#define DSET_NULL "DSET_NULL"
+#define DSET "DSET"
+#define DSETA "DSETA"
+#define DSETB "DSETB"
+#define DSETC "DSETC"
static void
create_objects(hid_t, hid_t, hid_t *, hid_t *, hid_t *, hid_t *);
@@ -2135,7 +2170,7 @@ test_file_double_file_dataset_open(hbool_t new_format)
/* Create a chunked dataset with fixed array indexing */
sid1 = H5Screate_simple(1, dims, max_dims0);
- CHECK(sid1, FAIL, "H5Screate");
+ CHECK(sid1, FAIL, "H5Screate_simple");
tid1 = H5Tcopy(H5T_C_S1);
CHECK(tid1, FAIL, "H5Tcopy");
ret = H5Tset_size(tid1, H5T_VARIABLE);
@@ -2161,7 +2196,7 @@ test_file_double_file_dataset_open(hbool_t new_format)
/* Create a chunked dataset with extensible array indexing */
sid1 = H5Screate_simple(1, dims, max_dims1);
- CHECK(sid1, FAIL, "H5Screate");
+ CHECK(sid1, FAIL, "H5Screate_simple");
tid1 = H5Tcopy(H5T_C_S1);
CHECK(tid1, FAIL, "H5Tcopy");
ret = H5Tset_size(tid1, H5T_VARIABLE);
@@ -2190,7 +2225,7 @@ test_file_double_file_dataset_open(hbool_t new_format)
/* Create a chunked dataset with v2 btree indexing */
sid2 = H5Screate_simple(2, dims2, max_dims2);
- CHECK(sid2, FAIL, "H5Screate");
+ CHECK(sid2, FAIL, "H5Screate_simple");
dcpl = H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
@@ -4884,8 +4919,8 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create,
CHECK(group, FAIL, "H5Gcreate");
ret = H5Oget_info(group, &oinfo);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.version, oh_vers_mod, "H5Oget_info_by_name");
+ CHECK(ret, FAIL, "H5Oget_info");
+ VERIFY(oinfo.hdr.version, oh_vers_mod, "H5Oget_info");
ret = H5Gclose(group);
CHECK(ret, FAIL, "H5Gclose");
@@ -4918,6 +4953,134 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create,
CHECK(ret, FAIL, "H5Pclose");
} /* end test_libver_bounds_real() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_libver_bounds_open
+ *
+ * Purpose: Tests opening latest file with various low/high bounds.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ *-------------------------------------------------------------------------
+ */
+#define VERBFNAME "tverbounds_dspace.h5"
+#define VERBDSNAME "dataset 1"
+#define SPACE1_DIM1 3
+static int
+test_libver_bounds_open(void)
+{
+ hid_t file = -1; /* File ID */
+ hid_t space = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t new_fapl = -1;/* File access property list ID for reopened file */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hsize_t dim[1] = {SPACE1_DIM1}; /* Dataset dimensions */
+ H5F_libver_t low, high; /* File format bounds */
+ hsize_t chunk_dim[1] = {SPACE1_DIM1}; /* Chunk dimensions */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Opening File in Various Version Bounds\n"));
+
+ /* Create a file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Create dataspace */
+ space = H5Screate_simple(1, dim, NULL);
+ CHECK(space, FAIL, "H5Screate_simple");
+
+ /* Create a dataset creation property list */
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ CHECK(dcpl, FAIL, "H5Pcreate");
+
+ /* Create and set chunk plist */
+ ret = H5Pset_chunk(dcpl, 1, chunk_dim);
+ CHECK(ret, FAIL, "H5Pset_chunk");
+ ret = H5Pset_deflate(dcpl, 9);
+ CHECK(ret, FAIL, "H5Pset_deflate");
+ ret = H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS);
+ CHECK(ret, FAIL, "H5Pset_chunk_opts");
+
+ /* Create a file with (LATEST, LATEST) bounds, create a layout version 4
+ dataset, then close the file */
+
+ /* Set version bounds to (LATEST, LATEST) */
+ low = H5F_LIBVER_LATEST;
+ high = H5F_LIBVER_LATEST;
+ ret = H5Pset_libver_bounds(fapl, low, high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create the file */
+ file = H5Fcreate(VERBFNAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ CHECK(file, FAIL, "H5Fcreate");
+
+ /* Create dataset */
+ dset = H5Dcreate2(file, VERBDSNAME, H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ CHECK(dset, FAIL, "H5Dcreate2");
+
+ /* Close dataset and file */
+ ret = H5Dclose(dset);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Fclose(file);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Attempt to open latest file with (earliest, v18), should fail */
+ ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_V18);
+ H5E_BEGIN_TRY {
+ file = H5Fopen(VERBFNAME, H5F_ACC_RDONLY, fapl);
+ } H5E_END_TRY;
+ VERIFY(file, FAIL, "Attempted to open latest file with earliest version");
+
+ /* Attempt to open latest file with (v18, v18), should fail */
+ ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_V18);
+ H5E_BEGIN_TRY {
+ file = H5Fopen(VERBFNAME, H5F_ACC_RDONLY, fapl);
+ } H5E_END_TRY;
+ VERIFY(file, FAIL, "Attempted to open latest file with v18 bounds");
+
+ /* Opening VERBFNAME in these combination should succeed.
+ For each low bound, verify that it is upgraded properly */
+ high = H5F_LIBVER_LATEST;
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++)
+ {
+ H5F_libver_t new_low = H5F_LIBVER_EARLIEST;
+
+ /* Set version bounds for opening file */
+ ret = H5Pset_libver_bounds(fapl, low, high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Open the file */
+ file = H5Fopen(VERBFNAME, H5F_ACC_RDONLY, fapl);
+ CHECK(file, FAIL, "H5Fopen");
+
+ /* Get the new file access property */
+ new_fapl = H5Fget_access_plist(file);
+ CHECK(new_fapl, FAIL, "H5Fget_access_plist");
+
+ /* Get new low bound and verify that it has been upgraded properly */
+ ret = H5Pget_libver_bounds(new_fapl, &new_low, NULL);
+ CHECK(ret, FAIL, "H5Pget_libver_bounds");
+ VERIFY(new_low, H5F_LIBVER_LATEST, "Low bound should be upgraded to H5F_LIBVER_LATEST");
+
+ ret = H5Pclose(new_fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Fclose(file);
+ CHECK(ret, FAIL, "H5Fclose");
+ } /* for low */
+
+ /* Close dataspace and property lists */
+ ret = H5Sclose(space);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Pclose(dcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+} /* end test_libver_bounds_open() */
+
+
/****************************************************************
**
** test_libver_bounds():
@@ -4935,8 +5098,1715 @@ test_libver_bounds(void)
/* Run the tests */
test_libver_bounds_real(H5F_LIBVER_EARLIEST, 1, H5F_LIBVER_LATEST, 2);
test_libver_bounds_real(H5F_LIBVER_LATEST, 2, H5F_LIBVER_EARLIEST, 2);
+ test_libver_bounds_open();
} /* end test_libver_bounds() */
+/**************************************************************************************
+**
+** test_libver_bounds_low_high():
+** Tests to verify that format versions are correct with the following five
+** pairs of low/high version bounds set in fapl via H5Pset_libver_bounds():
+** (1) (earliest, v18)
+** (2) (earliest, v110)
+** (3) (v18, v18)
+** (4) (v18, v110)
+** (5) (v110, v110)
+**
+** For each pair of setting in fapl, verify format versions with the following
+** six tests:
+** (1) test_libver_bounds_super(fapl): superblock versions
+** (2) test_libver_bounds_obj(fapl): object header versions
+** (3) test_libver_bounds_dataset(fapl): message versions associated with dataset
+** (4) test_libver_bounds_dataspace(fapl): dataspace message versions
+** (5) test_libver_bounds_datatype(fapl): datatype message versions
+** (6) test_libver_bounds_attributes(fapl): attribute message versions
+**
+**************************************************************************************/
+static void
+test_libver_bounds_low_high(void)
+{
+ hid_t fapl = -1; /* File access property list */
+ H5F_libver_t low, high; /* Low and high bounds */
+ herr_t ret; /* The return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing setting (low, high) format version bounds\n"));
+
+ /* Create a file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Loop through all the combinations of low/high version bounds */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++)
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+
+ H5E_BEGIN_TRY {
+ /* Set the low/high version bounds */
+ ret = H5Pset_libver_bounds(fapl, low, high);
+ } H5E_END_TRY;
+
+ /* Should fail: invalid combinations */
+ if(high == H5F_LIBVER_EARLIEST) {
+ VERIFY(ret, FAIL, "H5Pset_libver_bounds");
+ continue;
+ }
+
+ /* Should fail: invalid combinations */
+ if(high < low) {
+ VERIFY(ret, FAIL, "H5Pset_libver_bounds");
+ continue;
+ }
+
+ /* All other combinations are valid and should succeed */
+ VERIFY(ret, SUCCEED, "H5Pset_libver_bounds");
+
+ /* Tests to verify version bounds */
+ test_libver_bounds_super(fapl);
+ test_libver_bounds_obj(fapl);
+ test_libver_bounds_dataset(fapl);
+ test_libver_bounds_dataspace(fapl);
+ test_libver_bounds_datatype(fapl);
+ test_libver_bounds_attributes(fapl);
+ }
+
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+} /* end test_libver_bounds_low_high() */
+
+
+/***********************************************************************
+**
+** test_libver_bounds_super():
+** Verify superblock version with the following two tests:
+** (1) test_libver_bounds_super_create():
+** --when creating a file with the input fapl and the fcpl
+** that has the following feature enabled:
+** (A) default fcpl
+** (B) fcpl with v1-btee K value enabled
+** (C) fcpl with shared messages enabled
+** (D) fcpl with persistent free-space manager enabled
+**
+** (2) test_libver_bounds_super_open():
+** --when opening a file which is created with the input fapl
+** and the fcpl setting as #A to #D above.
+**
+** These two tests are run with or without SWMR file access.
+**
+*************************************************************************/
+static void
+test_libver_bounds_super(hid_t fapl)
+{
+ hid_t fcpl = -1; /* File creation property list */
+ herr_t ret; /* The return value */
+
+ /* Create a default fcpl: #A */
+ /* This will result in superblock version 0 */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+
+ /* Verify superblock version when creating a file with input fapl,
+ fcpl #A and with/without SWMR access */
+ test_libver_bounds_super_create(fapl, fcpl, TRUE);
+ test_libver_bounds_super_create(fapl, fcpl, FALSE);
+
+ /* Verify superblock version when opening a file which is created
+ with input fapl, fcpl #A and with/without SWMR access */
+ test_libver_bounds_super_open(fapl, fcpl, TRUE);
+ test_libver_bounds_super_open(fapl, fcpl, FALSE);
+
+ /* Close the fcpl */
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Create a fcpl with v1-btree K value enabled: #B */
+ /* This will result in superblock version 1 */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+ ret = H5Pset_istore_k(fcpl, 64);
+ CHECK(ret, FAIL, "H5Pset_istore_k");
+
+ /* Verify superblock version when creating a file with input fapl,
+ fcpl #B and with/without SWMR access */
+ test_libver_bounds_super_create(fapl, fcpl, TRUE);
+ test_libver_bounds_super_create(fapl, fcpl, FALSE);
+
+ /* Verify superblock version when opening a file which is created
+ with input fapl, fcpl #B and with/without SWMR access */
+ test_libver_bounds_super_open(fapl, fcpl, TRUE);
+ test_libver_bounds_super_open(fapl, fcpl, FALSE);
+
+ /* Close the fcpl */
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Create a fcpl with shared messages enabled: #C */
+ /* This will result in superblock version 2 */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+ ret = H5Pset_shared_mesg_nindexes(fcpl, 1);
+ CHECK(ret, FAIL, "H5Pset_shared_mesg_nindexes");
+ ret = H5Pset_shared_mesg_index(fcpl, 0, H5O_SHMESG_ATTR_FLAG, 2);
+ CHECK(ret, FAIL, "H5Pset_shared_mesg_index");
+
+ /* Verify superblock version when creating a file with input fapl,
+ fcpl #C and with/without SWMR access */
+ test_libver_bounds_super_create(fapl, fcpl, TRUE);
+ test_libver_bounds_super_create(fapl, fcpl, FALSE);
+
+ /* Verify superblock version when opening a file which is created
+ with input fapl, fcpl #C and with/without SWMR access */
+ test_libver_bounds_super_open(fapl, fcpl, TRUE);
+ test_libver_bounds_super_open(fapl, fcpl, FALSE);
+
+ /* Close the fcpl */
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Create a fcpl with persistent free-space manager enabled: #D */
+ /* This will result in superblock version 2 */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+ ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0);
+ CHECK(ret, FAIL, "H5Pset_file_space");
+
+ /* Verify superblock version when creating a file with input fapl,
+ fcpl #D and with/without SWMR access */
+ test_libver_bounds_super_create(fapl, fcpl, TRUE);
+ test_libver_bounds_super_create(fapl, fcpl, FALSE);
+
+ /* Verify superblock version when opening a file which is created
+ with input fapl, fcpl #D and with/without SWMR access */
+ test_libver_bounds_super_open(fapl, fcpl, TRUE);
+ test_libver_bounds_super_open(fapl, fcpl, FALSE);
+
+ /* Close the fcpl */
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+} /* end test_libver_bounds_super() */
+
+
+/**************************************************************************************************
+**
+** test_libver_bounds_super_create():
+** Verify the following when the file is created with the input fapl, fcpl, and
+** with/without SWMR access:
+** (a) the superblock version #
+** (b) the file's low bound setting
+** (c) fail or succeed in creating the file
+**
+** For file creation, the bounds setting in fapl, the feature enabled in fcpl,
+** and with/without SWMR file access will determine the results for #a to #c.
+**
+** The first row for the following two tables is the 5 pairs of low/high bounds setting
+** in the input fapl. The next three rows list the expected results for #a to #c.
+** "-->" indicates "upgrade to"
+**
+** Creating a file with write access
+** --------------------------------------------------------------------------------
+** | (earliest, v18) | (earliest, v110) | (v18, v18) | (v18, v110) | (v110, v110) |
+** |______________________________________________________________________________|
+** Superblock version | vers 0, 1, 2 | vers 0, 1, 2 | vers 2 | vers 2 | vers 3 |
+** |------------------------------------------------------------------------------|
+** File's low bound | no change |
+** |------------------------------------------------------------------------------|
+** File creation | succeed |
+** |______________________________________________________________________________|
+**
+** Creating a file with SWMR-write access
+** --------------------------------------------------------------------------------
+** | (earliest, v18) | (earliest, v110) | (v18, v18) | (v18, v110) | (v110, v110) |
+** |______________________________________________________________________________|
+** Superblock version | -- | vers 3 | -- | vers 3 | vers 3 |
+** |------------------------------------------------------------------------------|
+** File's low bound | -- | ->v110 | -- | ->v110 | no change |
+** |------------------------------------------------------------------------------|
+** File creation | fail | succeed | fail | succeed | succed |
+** |______________________________________________________________________________|
+**
+******************************************************************************************************/
+static void
+test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr)
+{
+ hid_t fid = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file pointer */
+ H5F_libver_t low, high; /* Low and high bounds */
+ hbool_t ok; /* The result is ok or not */
+ herr_t ret; /* The return value */
+
+ /* Try to create the file */
+ H5E_BEGIN_TRY {
+ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC | (is_swmr ? H5F_ACC_SWMR_WRITE : 0), fcpl, fapl);
+ } H5E_END_TRY;
+
+ /* Get the internal file pointer if the create succeeds */
+ if((ok = fid >= 0)) {
+ f = (H5F_t *)H5I_object(fid);
+ CHECK(f, NULL, "H5I_object");
+ }
+
+ /* Retrieve the low/high bounds */
+ ret = H5Pget_libver_bounds(fapl, &low, &high);
+ CHECK(ret, FAIL, "H5Pget_libver_bounds");
+
+ if(is_swmr) { /* SWMR is enabled */
+
+ if(high == H5F_LIBVER_LATEST) { /* Should succeed */
+ VERIFY(ok, TRUE, "H5Fcreate");
+ VERIFY(HDF5_SUPERBLOCK_VERSION_3, f->shared->sblock->super_vers, "HDF5_superblock_ver_bounds");
+ VERIFY(H5F_LIBVER_V110, f->shared->low_bound, "HDF5_superblock_ver_bounds");
+
+ } else /* Should fail */
+ VERIFY(ok, FALSE, "H5Fcreate");
+
+ } else { /* Should succeed */
+ VERIFY(ok, TRUE, "H5Fcreate");
+ VERIFY(low, f->shared->low_bound, "HDF5_superblock_ver_bounds");
+
+ switch(low) {
+ case H5F_LIBVER_EARLIEST:
+ ok = (f->shared->sblock->super_vers == 0 ||
+ f->shared->sblock->super_vers == 1 ||
+ f->shared->sblock->super_vers == 2);
+ VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
+ break;
+
+ case H5F_LIBVER_V18:
+ ok = (f->shared->sblock->super_vers == 2);
+ VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
+ break;
+
+ case H5F_LIBVER_V110:
+ ok = (f->shared->sblock->super_vers == 3);
+ VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
+ break;
+
+ case H5F_LIBVER_ERROR:
+ case H5F_LIBVER_NBOUNDS:
+ default:
+ ERROR("H5Pget_libver_bounds");
+
+ } /* end switch */
+ }
+
+ if(ok) { /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+ }
+
+} /* end test_libver_bounds_super_create() */
+
+/**************************************************************************************************
+**
+** test_libver_bounds_super_open():
+** Verify the following when opening a file which is created with the input fapl, fcpl,
+** and with/without SWMR access:
+** (a) the file's low bound setting
+** (b) fail or succeed in opening the file
+**
+** (1) Create a file with the input fapl, fcpl and with/without SWMR access
+** (2) Close the file
+** (3) Reopen the file with a new fapl that is set to the 5 pairs of low/high bounds
+** in a for loop. For each pair of setting in the new fapl:
+** --Verify the expected results for #a and #b above.
+** --Close the file.
+**
+** For file open, the file's superblock version, the low/high bounds setting in fapl,
+** and with/without SWMR file access will determine the results for #a and #b.
+**
+** The first row for the following tables is the 5 pairs of low/high bounds setting
+** in the input fapl. The next two rows list the expected results for #a and #b.
+** "-->" indicates "upgrade to"
+**
+** Opening a file with write access
+**
+** Superblock version 0, 1
+** --------------------------------------------------------------------------------
+** | (earliest, v18) | (earliest, v110) | (v18, v18) | (v18, v110) | (v110, v110) |
+** |______________________________________________________________________________|
+** File's low bound | no change |
+** |------------------------------------------------------------------------------|
+** File open | succeed |
+** |______________________________________________________________________________|
+**
+**
+** Superblock version 2
+** --------------------------------------------------------------------------------
+** | (earliest, v18) | (earliest, v110) | (v18, v18) | (v18, v110) | (v110, v110) |
+** |______________________________________________________________________________|
+** File's low bound | -->v18 | no change |
+** |------------------------------------------------------------------------------|
+** File open | succeed |
+** |______________________________________________________________________________|
+**
+** Superblock version 3
+** --------------------------------------------------------------------------------
+** | (earliest, v18) | (earliest, v110) | (v18, v18) | (v18, v110) | (v110, v110) |
+** |______________________________________________________________________________|
+** File's low bound | -- | -->v110 | -- | -->v110 | no change |
+** |------------------------------------------------------------------------------|
+** File open | fail | succeed | fail | succeed | succeed |
+** |______________________________________________________________________________|
+**
+**
+**
+** Opening a file with SWMR-write access
+**
+** Superblock version 0, 1, 2
+** -------------------------------------------------------------------------------
+** | (earliest, v18) | (earliest, v10) | (v18, v18) | (v18, v110) | (v110, v110) |
+** |_____________________________________________________________________________|
+** File's low bound | ----
+** |-----------------------------------------------------------------------------|
+** File open | fail
+** |_____________________________________________________________________________|
+**
+**
+** Superblock version 3
+** -------------------------------------------------------------------------------
+** | (earliest, v18) | (earliest, v10) | (v18, v18) | (v18, v110) | (v110, v110) |
+** |_____________________________________________________________________________|
+** File's low bound | -- | -->v110 | -- | -->v110 | no change |
+** |-----------------------------------------------------------------------------|
+** File open | fail | succeed | fail | succeed | succeed |
+** |_____________________________________________________________________________|
+**
+**
+******************************************************************************************************/
+static void
+test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr)
+{
+ hid_t fid = -1; /* File ID */
+ H5F_t *f = NULL; /* Internal file pointer */
+ hid_t new_fapl = -1; /* File access property list */
+ unsigned super_vers; /* Superblock version */
+ H5F_libver_t low, high; /* Low and high bounds */
+ hbool_t ok; /* The result is ok or not */
+ herr_t ret; /* Return value */
+
+ /* Create the file with the input fcpl and fapl */
+ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Get the internal file pointer */
+ f = (H5F_t *)H5I_object(fid);
+ CHECK(f, NULL, "H5I_object");
+
+ /* The file's superblock version */
+ super_vers = f->shared->sblock->super_vers;
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Create a default file access property list */
+ new_fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(new_fapl, FAIL, "H5Pcreate");
+
+ /* Loop through all the combinations of low/high bounds in new_fapl */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ H5E_BEGIN_TRY {
+ ret = H5Pset_libver_bounds(new_fapl, low, high);
+ } H5E_END_TRY;
+
+ /* Invalid combinations */
+ if (ret < 0)
+ continue;
+
+ /* Open the file with or without SWMR access */
+ H5E_BEGIN_TRY {
+ fid = H5Fopen(FILE8, H5F_ACC_RDWR | (is_swmr ? H5F_ACC_SWMR_WRITE : 0), new_fapl);
+ } H5E_END_TRY;
+ ok = fid >= 0;
+
+ /* Verify the file open succeeds or fails */
+ switch(super_vers) {
+ case 3:
+ if(high == H5F_LIBVER_LATEST) {
+ /* Should succeed */
+ VERIFY(ok, TRUE, "H5Fopen");
+ VERIFY(H5F_LIBVER_V110, f->shared->low_bound, "HDF5_superblock_ver_bounds");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+ } else /* Should fail */
+ VERIFY(ok, FALSE, "H5Fopen");
+ break;
+
+ case 2:
+ if(is_swmr) /* Should fail */
+ VERIFY(ok, FALSE, "H5Fopen");
+ else { /* Should succeed */
+ VERIFY(ok, TRUE, "H5Fopen");
+
+ ok = f->shared->low_bound >= H5F_LIBVER_V18;
+ VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+ }
+ break;
+
+ case 1:
+ case 0:
+ if(is_swmr) /* Should fail */
+ VERIFY(ok, FALSE, "H5Fopen");
+ else { /* Should succeed */
+ VERIFY(ok, TRUE, "H5Fopen");
+ VERIFY(low, f->shared->low_bound, "HDF5_superblock_ver_bounds");
+
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+ }
+ break;
+
+ default:
+ break;
+ } /* end switch */
+ } /* end for */
+ } /* end for */
+
+ /* Close the file access property list */
+ ret = H5Pclose(new_fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+} /* end test_libver_bounds_super_open() */
+
+/****************************************************************
+**
+** test_libver_bounds_obj():
+** Verify object header versions:
+**
+** (a) Create a file with:
+** --the input fapl
+** --a fcpl that has shared message enabled
+** Verify the root group's object header version.
+** Close the file.
+**
+** (b) Create another file with:
+** --the input fapl
+** --a default fcpl
+** Verify the root group's object header version.
+** Close the file.
+**
+** (c) Reopen the same file in (b) with a new fapl.
+** The new fapl is set to the 5 pairs of low/high
+** bounds in a "for" loop. For each setting in fapl:
+** --Create a group in the file
+** --Verify the group's object header version
+** --Close and delete the group
+** --Close the file
+**
+****************************************************************/
+static void
+test_libver_bounds_obj(hid_t fapl)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t fcpl = -1; /* File creation property list */
+ hid_t new_fapl = -1; /* File access property list */
+ H5F_t *f = NULL; /* Internal file pointer */
+ H5F_libver_t low, high; /* Low and high bounds */
+ H5O_info_t oinfo; /* Object info */
+ H5G_info_t ginfo; /* Group info */
+ herr_t ret; /* Return value */
+
+ /* Retrieve the low/high bounds from the input fapl */
+ ret = H5Pget_libver_bounds(fapl, &low, &high);
+ CHECK(ret, FAIL, "H5Pget_libver_bounds");
+
+ /* Create a default file creation property list */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+
+ /* Enable shared message in the fcpl */
+ /* This will result in a version 2 object header */
+ ret = H5Pset_shared_mesg_nindexes(fcpl, 1);
+ CHECK(ret, FAIL, "H5Pset_shared_mesg_nindexes");
+ ret = H5Pset_shared_mesg_index(fcpl, 0, H5O_SHMESG_ATTR_FLAG, 2);
+ CHECK(ret, FAIL, "H5Pset_shared_mesg_index");
+
+ /* Create the file with the fcpl and the input fapl */
+ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Get root group's object info */
+ ret = H5Oget_info_by_name(fid, "/", &oinfo, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name");
+
+ /* Verify object header version is 2 because shared message is enabled */
+ VERIFY(oinfo.hdr.version, H5O_VERSION_2, "H5O_obj_ver_bounds");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Close the file creation property list */
+ ret = H5Pclose(fcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Create a file with the default fcpl and input fapl */
+ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Get root group's object info */
+ ret = H5Oget_info_by_name(fid, "/", &oinfo, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name");
+
+ /* Verify object header version is as indicated by low_bound */
+ VERIFY(oinfo.hdr.version, H5O_obj_ver_bounds[low], "H5O_obj_ver_bounds");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Create a new default file access property list which
+ is used to open the file in the "for" loop */
+ new_fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(new_fapl, FAIL, "H5Pcreate");
+
+ /* Loop through all the combinations of low/high bounds in new_fapl */
+ /* Open the file with the fapl; create a group and verify the
+ object header version, then delete the group and close the file.*/
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ H5E_BEGIN_TRY {
+ ret = H5Pset_libver_bounds(new_fapl, low, high);
+ } H5E_END_TRY;
+
+ if (ret < 0) /* Invalid combinations */
+ continue;
+
+ /* Open the file */
+ H5E_BEGIN_TRY {
+ fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl);
+ } H5E_END_TRY;
+
+ if(fid >=0 ) { /* The file open succeeds */
+
+ /* Get the internal file pointer */
+ f = (H5F_t *)H5I_object(fid);
+ CHECK(f, NULL, "H5I_object");
+
+ /* Create a group in the file */
+ gid = H5Gcreate2(fid, GRP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(gid, FAIL, "H5Gcreate2");
+
+ /* Get group information */
+ ret = H5Gget_info(gid, &ginfo);
+ CHECK(ret, FAIL, "H5Gget_info");
+
+ /* Verify group storage type */
+ if(f->shared->low_bound >= H5F_LIBVER_V18)
+ /* Links in group are stored in object header */
+ VERIFY(ginfo.storage_type, H5G_STORAGE_TYPE_COMPACT, "H5Gget_info");
+ else
+ /* Links in group are stored with a "symbol table" */
+ 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);
+ CHECK(ret, FAIL, "H5Oget_info_by_name");
+
+ /* Verify object header version as indicated by low_bound */
+ VERIFY(oinfo.hdr.version, H5O_obj_ver_bounds[f->shared->low_bound], "H5O_obj_ver_bounds");
+
+ /* Close the group */
+ ret = H5Gclose(gid);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Delete the group */
+ ret = H5Ldelete(fid, GRP_NAME, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ } /* end if */
+ } /* end for */
+ } /* end for */
+
+ /* Close the file access property list */
+ ret = H5Pclose(new_fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+} /* end test_libver_bounds_obj() */
+
+/****************************************************************
+**
+** test_libver_bounds_dataset():
+** Verify message versions associated with datasets:
+**
+** (a) Create a file with default fcpl and the input fapl.
+** Create the following two datasets:
+** --A contiguous dataset
+** --A chunked dataset with "no filter edge chunks"
+** For both datasets, verify the versions for the layout,
+** fill value and filter pipeline messages.
+** Close the file.
+**
+** (b) Create a new fapl that is set to the 5 pairs of low/high
+** bounds in a "for" loop. For each pair of setting in the
+** new fapl:
+** --Open the same file in (a) with the fapl
+** --Create a chunked dataset with 2 unlimited
+** dimensions
+** --Verify the versions for the layout, fill value
+** and filter pipeline messages
+** --Close and delete the dataset
+** --Close the file
+**
+****************************************************************/
+static void
+test_libver_bounds_dataset(hid_t fapl)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t new_fapl = -1; /* File access property list */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ H5D_t *dset = NULL; /* Internal dataset pointer */
+ H5F_t *f = NULL; /* Internal file pointer */
+ H5F_libver_t low, high; /* Low and high bounds */
+ herr_t ret; /* Return value */
+ hsize_t fix_dims2[2] = {10, 4}; /* Dimension sizes */
+ hsize_t fix_chunks2[2] = {4, 3}; /* Chunk dimension sizes */
+ hsize_t dims2[2] = {1, 4}; /* Dimension sizes */
+ hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunks2[2] = {4, 5}; /* Chunk dimension sizes */
+
+ /* Retrieve the low/high bounds from the input fapl */
+ ret = H5Pget_libver_bounds(fapl, &low, &high);
+ CHECK(ret, FAIL, "H5Pget_libver_bounds");
+
+ /* Create the file with the input fapl */
+ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Create the dataspace */
+ sid = H5Screate(H5S_SCALAR);
+ CHECK(sid, FAIL, "H5Screate");
+
+ /* Create a contiguous dataset */
+ did = H5Dcreate2(fid, DSETA, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dcreate");
+
+ /* Get the internal dataset pointer */
+ dset = (H5D_t *)H5I_object(did);
+ CHECK(dset, NULL, "H5I_object");
+
+ /* Verify version for layout and fill value messages */
+ if(low == H5F_LIBVER_EARLIEST) {
+ /* For layout message: the earliest version the library will set is 3 */
+ /* For fill value message: the earliest version the library will set is 2 */
+ VERIFY(dset->shared->layout.version, H5O_LAYOUT_VERSION_DEFAULT, "H5O_layout_ver_bounds");
+ VERIFY(dset->shared->dcpl_cache.fill.version, H5O_FILL_VERSION_2, "H5O_fill_ver_bounds");
+ } else {
+ VERIFY(dset->shared->layout.version, H5O_layout_ver_bounds[low], "H5O_layout_ver_bounds");
+ VERIFY(dset->shared->dcpl_cache.fill.version, H5O_fill_ver_bounds[low], "H5O_fill_ver_bounds");
+ }
+
+ /* Verify filter pipleline message version */
+ VERIFY(dset->shared->dcpl_cache.pline.version, H5O_pline_ver_bounds[low], "H5O_pline_ver_bounds");
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close the dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Set up dataspace and dcpl for creating a chunked dataset
+ with "no filter edge chunks" enabled.
+ This will result in a version 4 layout message */
+ sid = H5Screate_simple(2, fix_dims2, NULL);
+ CHECK(sid, FAIL, "H5Screate_simple");
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ CHECK(dcpl, FAIL, "H5Pcreate");
+ ret = H5Pset_chunk(dcpl, 2, fix_chunks2);
+ CHECK(ret, FAIL, "H5Pset_chunk");
+ ret = H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS);
+ CHECK(ret, FAIL, "H5Pset_chunk_opts");
+
+ /* Create the chunked dataset */
+ H5E_BEGIN_TRY {
+ did = H5Dcreate2(fid, DSETB, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ } H5E_END_TRY;
+
+ if(did >= 0) {
+
+ /* Get the internal dataset pointer */
+ dset = (H5D_t *)H5I_object(did);
+ CHECK(dset, NULL, "H5I_object");
+
+ /* Verify layout message version and chunk indexing type */
+ VERIFY(dset->shared->layout.version, H5O_LAYOUT_VERSION_4, "H5O_layout_ver_bounds");
+ VERIFY(dset->shared->layout.u.chunk.idx_type, H5D_CHUNK_IDX_FARRAY, "chunk_index_type");
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+ }
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Close the dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close the datset creation property list */
+ ret = H5Pclose(dcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Create a default file access property list which is used
+ to open the file in the 'for' loop */
+ new_fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(new_fapl, FAIL, "H5Pcreate");
+
+ /* Set up dataspace and dcpl for creating a chunked dataset with
+ 2 unlimited dimensions in the 'for' loop */
+ sid = H5Screate_simple(2, dims2, max_dims2);
+ CHECK(sid, FAIL, "H5Screate_simple");
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ CHECK(dcpl, FAIL, "H5Pcreate");
+ ret = H5Pset_chunk(dcpl, 2, chunks2);
+ CHECK(ret, FAIL, "H5Pset_chunk");
+
+ /* Loop through all the combinations of low/high bounds in new_fapl */
+ /* Open the file with the fapl and create the chunked dataset */
+ /* Verify the dataset's layout, fill value and filter pipleline message versions */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ H5E_BEGIN_TRY {
+ ret = H5Pset_libver_bounds(new_fapl, low, high);
+ } H5E_END_TRY;
+
+ if (ret < 0) /* Invalid low/high combinations */
+ continue;
+
+ /* Open the file */
+ H5E_BEGIN_TRY {
+ fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl);
+ } H5E_END_TRY;
+
+ if(fid >=0 ) { /* The file open succeeds */
+
+ /* Get the internal file pointer */
+ f = (H5F_t *)H5I_object(fid);
+ CHECK(f, NULL, "H5I_object");
+
+ /* Create the chunked dataset */
+ did = H5Dcreate2(fid, DSETC, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dcreate2");
+
+ /* Get the internal file pointer */
+ dset = (H5D_t *)H5I_object(did);
+ CHECK(dset, NULL, "H5I_object");
+
+ /* Verify the dataset's layout, fill value and filter pipeline message versions */
+ /* Also verify the chunk indexing type */
+ if(f->shared->low_bound == H5F_LIBVER_EARLIEST) {
+ /* For layout message: the earliest version the library will set is 3 */
+ /* For fill value message: the earliest version the library will set is 2 */
+ VERIFY(dset->shared->layout.version, H5O_LAYOUT_VERSION_DEFAULT, "H5O_layout_ver_bounds");
+ VERIFY(dset->shared->dcpl_cache.fill.version, H5O_FILL_VERSION_2, "H5O_fill_ver_bounds");
+ } else {
+ VERIFY(dset->shared->layout.version, H5O_layout_ver_bounds[f->shared->low_bound], "H5O_layout_ver_bounds");
+ VERIFY(dset->shared->dcpl_cache.fill.version, H5O_fill_ver_bounds[f->shared->low_bound], "H5O_fill_ver_bounds");
+ }
+
+ /* Verify the filter pipeline message version */
+ VERIFY(dset->shared->dcpl_cache.pline.version, H5O_pline_ver_bounds[f->shared->low_bound], "H5O_pline_ver_bounds");
+
+ /* Verify the dataset's chunk indexing type */
+ if(dset->shared->layout.version == H5O_LAYOUT_VERSION_LATEST)
+ VERIFY(dset->shared->layout.u.chunk.idx_type, H5D_CHUNK_IDX_BT2, "chunk_index_type");
+ else
+ VERIFY(dset->shared->layout.u.chunk.idx_type, H5D_CHUNK_IDX_BTREE, "chunk_index_type");
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Delete the dataset */
+ ret = H5Ldelete(fid, DSETC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ } /* end if */
+ } /* end for */
+ } /* end for */
+
+ /* Close the file access property list */
+ ret = H5Pclose(new_fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close the dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close the dataset creation property list */
+ ret = H5Pclose(dcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+} /* end test_libver_bounds_dataset() */
+
+/****************************************************************
+**
+** test_libver_bounds_dataspace():
+** Verify dataspace message versions:
+**
+** (a) Create a file with default fcpl and the input fapl.
+** Create the following two datasets:
+** --A dataset with scalar dataspace
+** --A dataset with null dataspace
+** For both datasets, verify the dataspace message versions.
+** Close the file.
+**
+** (b) Create a new fapl that is set to the 5 pairs of low/high
+** bounds in a "for" loop. For each pair of setting in the
+** new fapl:
+** --Open the same file in (a) with the fapl
+** --Create a chunked dataset, a compact dataset and
+** a contigous dataset
+** --Verify the dataspace message version for these
+** three datasets
+** --Delete the three datasets and the dataspaces
+** --Close the file
+**
+****************************************************************/
+static void
+test_libver_bounds_dataspace(hid_t fapl)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t new_fapl = -1; /* File access property list */
+ hid_t did = -1, did_null = -1; /* Dataset IDs */
+ hid_t did_compact = -1, did_contig = -1; /* Dataset IDs */
+ hid_t sid = -1, sid_null = -1; /* Dataspace IDs */
+ hid_t sid_compact = -1, sid_contig = -1; /* Dataspace IDs */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t dcpl_compact = -1, dcpl_contig = -1; /* Dataset creation property lists */
+ H5S_t *space = NULL, *space_null = NULL; /* Internal dataspace pointers */
+ H5F_t *f = NULL; /* Internal file pointer */
+ H5F_libver_t low, high; /* Low and high bounds */
+ hsize_t dims[1] = {1}; /* Dimension sizes */
+ hsize_t dims2[2] = {5, 4}; /* Dimension sizes */
+ hsize_t max_dims[1] = {H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunks[1] = {4}; /* Chunk dimension sizes */
+ herr_t ret; /* Return value */
+
+ /* Retrieve the low/high bounds from the input fapl */
+ ret = H5Pget_libver_bounds(fapl, &low, &high);
+ CHECK(ret, FAIL, "H5Pget_libver_bounds");
+
+ /* Create the file with the input fapl */
+ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Create scalar dataspace */
+ sid = H5Screate(H5S_SCALAR);
+ CHECK(sid, FAIL, "H5Screate");
+
+ /* Create a dataset with the scalar dataspace */
+ did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dcreate");
+
+ /* Get the internal dataspace pointer */
+ sid = H5Dget_space(did);
+ CHECK(sid, FAIL, "H5Dget_space");
+ space = (H5S_t *)H5I_object(sid);
+ CHECK(space, NULL, "H5I_object");
+
+ /* Verify the dataspace version */
+ VERIFY(space->extent.version, H5O_sdspace_ver_bounds[low], "H5O_sdspace_ver_bounds");
+
+ /* Create null dataspace */
+ sid_null = H5Screate(H5S_NULL);
+ CHECK(sid_null, FAIL, "H5Screate");
+
+ /* Create a dataset with the null dataspace */
+ did_null = H5Dcreate2(fid, DSET_NULL, H5T_NATIVE_INT, sid_null, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(did_null, FAIL, "H5Dcreate");
+
+ /* Get the internal dataspace pointer */
+ sid_null = H5Dget_space(did_null);
+ CHECK(sid_null, FAIL, "H5Dget_space");
+ space_null = (H5S_t *)H5I_object(sid_null);
+ CHECK(space_null, NULL, "H5I_object");
+
+ /* Verify the dataspace version */
+ VERIFY(space_null->extent.version, H5O_SDSPACE_VERSION_2, "H5O_sdspace_ver_bounds");
+
+ /* Close the datasets */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Dclose(did_null);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close the dataspaces */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(sid_null);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Create a default file access property list which is used
+ to open the file in the 'for' loop */
+ new_fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(new_fapl, FAIL, "H5Pcreate");
+
+ /* Set up dataspace and dcpl for creating a chunked dataset */
+ sid = H5Screate_simple(1, dims, max_dims);
+ CHECK(sid, FAIL, "H5Screate_simple");
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ CHECK(dcpl, FAIL, "H5Pcreate");
+ ret = H5Pset_chunk(dcpl, 1, chunks);
+ CHECK(ret, FAIL, "H5Pset_chunk");
+
+ /* Set up dataspace and dcpl for creating a compact dataset */
+ sid_compact = H5Screate_simple(1, dims, NULL);
+ CHECK(sid_compact, FAIL, "H5Screate_simple");
+ dcpl_compact = H5Pcreate(H5P_DATASET_CREATE);
+ CHECK(dcpl_compact, FAIL, "H5Pcreate");
+ ret = H5Pset_layout(dcpl_compact, H5D_COMPACT);
+ CHECK(ret, FAIL, "H5Pset_layout");
+
+ /* Set up dataspace and dcpl for creating a contiguous dataset */
+ sid_contig = H5Screate_simple(2, dims2, NULL);
+ CHECK(sid_contig, FAIL, "H5Screate_simple");
+ dcpl_contig = H5Pcreate(H5P_DATASET_CREATE);
+ CHECK(dcpl_contig, FAIL, "H5Pcreate");
+ ret = H5Pset_layout(dcpl_contig, H5D_CONTIGUOUS);
+ CHECK(ret, FAIL, "H5Pset_layout");
+
+ /* Loop through all the combinations of low/high bounds in new_fapl */
+ /* Open the file and create the chunked/compact/contiguous datasets */
+ /* Verify the dataspace message version for the three datasets */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ hid_t tmp_sid, tmp_sid_compact, tmp_sid_contig; /* Dataspace IDs */
+ H5S_t *tmp_space, *tmp_space_compact, *tmp_space_contig; /* Internal dataspace pointers */
+
+ H5E_BEGIN_TRY {
+ ret = H5Pset_libver_bounds(new_fapl, low, high);
+ } H5E_END_TRY;
+
+ if (ret < 0) /* Invalid low/high combinations */
+ continue;
+
+ /* Open the file */
+ H5E_BEGIN_TRY {
+ fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl);
+ } H5E_END_TRY;
+
+ if(fid >=0 ) { /* The file open succeeds */
+
+ /* Get the internal file pointer */
+ f = (H5F_t *)H5I_object(fid);
+ CHECK(f, NULL, "H5I_object");
+
+ /* Create the chunked dataset */
+ did = H5Dcreate2(fid, DSETA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dcreate2");
+
+ /* Get the internal dataspace pointer for the chunked dataset */
+ tmp_sid = H5Dget_space(did);
+ CHECK(tmp_sid, FAIL, "H5Dget_space");
+ tmp_space = (H5S_t *)H5I_object(tmp_sid);
+ CHECK(tmp_space, NULL, "H5I_object");
+
+ /* Create the compact dataset */
+ did_compact = H5Dcreate2(fid, DSETB, H5T_NATIVE_INT, sid_compact, H5P_DEFAULT, dcpl_compact, H5P_DEFAULT);
+ CHECK(did_compact, FAIL, "H5Dcreate2");
+
+ /* Get the internal dataspace pointer for the compact dataset */
+ tmp_sid_compact = H5Dget_space(did_compact);
+ CHECK(tmp_sid_compact, FAIL, "H5Dget_space");
+ tmp_space_compact = (H5S_t *)H5I_object(tmp_sid_compact);
+ CHECK(tmp_space_compact, NULL, "H5I_object");
+
+ /* Create the contiguous dataset */
+ did_contig = H5Dcreate2(fid, DSETC, H5T_NATIVE_INT, sid_contig, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT);
+ CHECK(did_contig, FAIL, "H5Dcreate2");
+
+ /* Get the internal dataspace pointer for the contiguous dataset */
+ tmp_sid_contig = H5Dget_space(did_contig);
+ CHECK(tmp_sid_contig, FAIL, "H5Dget_space");
+ tmp_space_contig = (H5S_t *)H5I_object(tmp_sid_contig);
+ CHECK(tmp_space_contig, NULL, "H5I_object");
+
+ /* Verify versions for the three dataspaces */
+ VERIFY(tmp_space->extent.version, H5O_sdspace_ver_bounds[f->shared->low_bound], "H5O_sdspace_ver_bounds");
+ VERIFY(tmp_space_compact->extent.version, H5O_sdspace_ver_bounds[f->shared->low_bound], "H5O_sdspace_ver_bounds");
+ VERIFY(tmp_space_contig->extent.version, H5O_sdspace_ver_bounds[f->shared->low_bound], "H5O_sdspace_ver_bounds");
+
+ /* Close the three datasets */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Dclose(did_compact);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Dclose(did_contig);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close the three dataspaces */
+ ret = H5Sclose(tmp_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(tmp_sid_compact);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(tmp_sid_contig);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Delete the three datasets */
+ ret = H5Ldelete(fid, DSETA, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
+ ret = H5Ldelete(fid, DSETB, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
+ ret = H5Ldelete(fid, DSETC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ } /* end if */
+ } /* end for */
+ } /* end for */
+
+ /* Close the file access property list */
+ ret = H5Pclose(new_fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close the three dataspaces */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(sid_compact);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(sid_contig);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close the three dataset creation property lists */
+ ret = H5Pclose(dcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(dcpl_compact);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(dcpl_contig);
+ CHECK(ret, FAIL, "H5Pclose");
+
+} /* end test_libver_bounds_dataspace() */
+
+
+/****************************************************************
+**
+** test_libver_bounds_datatype():
+** Verify the datatype message version:
+**
+** (a) Create the following datatypes:
+** 1) integer
+** 2) enum
+** 3) array
+** 4) compound
+** 5) vlen
+** (b) Call test_libver_bounds_datatype_check() for each
+** datatype in (a) to verify the datatype message version.
+**
+****************************************************************/
+static void
+test_libver_bounds_datatype(hid_t fapl)
+{
+ hid_t tid = -1, tid_enum = -1, tid_array = -1; /* Datatype IDs */
+ hid_t tid_compound = -1, tid_vlen = -1; /* Datatype IDs */
+ int enum_value; /* Value for enum datatype */
+ typedef struct s1 { /* Data structure for compound datatype */
+ char c;
+ int i;
+ } s1;
+ hsize_t dims[1] = {1}; /* Dimension sizes */
+ herr_t ret; /* Return value */
+
+ /* Create integer datatype */
+ tid = H5Tcopy(H5T_NATIVE_INT);
+
+ /* Verify datatype message version */
+ test_libver_bounds_datatype_check(fapl, tid);
+
+ /* Create enum datatype */
+ tid_enum = H5Tenum_create(tid);
+ enum_value = 0;
+ H5Tenum_insert(tid_enum, "val1", &enum_value);
+ enum_value = 1;
+ H5Tenum_insert(tid_enum, "val2", &enum_value);
+
+ /* Verify datatype message version */
+ test_libver_bounds_datatype_check(fapl, tid_enum);
+
+ /* Create array datatype */
+ tid_array = H5Tarray_create2(tid, 1, dims);
+
+ /* Verify datatype message version */
+ test_libver_bounds_datatype_check(fapl, tid_array);
+
+ /* Create compound datatype */
+ tid_compound = H5Tcreate(H5T_COMPOUND, sizeof(s1));
+ H5Tinsert(tid_compound, "c", HOFFSET(s1, c), H5T_STD_U8LE);
+ H5Tinsert(tid_compound, "i", HOFFSET(s1, i), H5T_NATIVE_INT);
+
+ /* Verify datatype message version */
+ test_libver_bounds_datatype_check(fapl, tid_compound);
+
+ /* Create vlen datatype */
+ tid_vlen = H5Tvlen_create(tid);
+
+ /* Verify datatype message version */
+ test_libver_bounds_datatype_check(fapl, tid_vlen);
+
+ /* Close the datatypes */
+ ret = H5Tclose(tid);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ ret = H5Tclose(tid_enum);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ ret = H5Tclose(tid_array);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ ret = H5Tclose(tid_compound);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ ret = H5Tclose(tid_vlen);
+ CHECK(ret, FAIL, "H5Tclose");
+
+} /* end test_libver_bounds_datatype() */
+
+/****************************************************************
+**
+** test_libver_bounds_datatype_check():
+** Helper routine called by test_libver_bounds_datatype()
+** to verify the datatype message version for the input tid:
+**
+** (a) Create a file with default fcpl and the input fapl.
+** Create a contiguous dataset with the input tid.
+** Verify the datatype message version.
+** Create a committed datatype of string to be
+** used later.
+** Close the file.
+**
+** (b) Create a new fapl that is set to the 5 pairs of low/high
+** bounds in a "for" loop. For each pair of setting in
+** the new fapl:
+** --Open the same file in (a) with the fapl
+** --Verify the message version for the committed
+** datatype created earlier
+** --Create a chunked dataset with the input tid
+** --Verify the datatype message version
+** --Close and delete the dataset
+** --Close the file
+**
+****************************************************************/
+static void
+test_libver_bounds_datatype_check(hid_t fapl, hid_t tid)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t new_fapl = -1; /* File acess property list */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t dtid = -1; /* Datatype ID for the dataset */
+ hid_t str_tid = -1; /* String datatype ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hsize_t dims[1] = {1}; /* Dimension sizes */
+ hsize_t dims2[2] = {5, 4}; /* Dimension sizes */
+ hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunks[2] = {2, 3}; /* Chunk dimension sizes */
+ H5T_t *dtype = NULL; /* Internal datatype pointer */
+ H5T_t *str_dtype = NULL; /* Internal datatype pointer for the string datatype */
+ H5F_t *f = NULL; /* Internal file pointer */
+ H5F_libver_t low, high; /* Low and high bounds */
+ herr_t ret; /* Return value */
+
+ /* Retrieve the low/high version bounds from the input fapl */
+ ret = H5Pget_libver_bounds(fapl, &low, &high);
+ CHECK(ret, FAIL, "H5Pget_libver_bounds");
+
+ /* Create the file with the input fapl */
+ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Create a committed datatype of string which will be used
+ later inside the 'for' loop */
+ str_tid = H5Tcopy(H5T_C_S1);
+ CHECK(str_tid, FAIL, "H5Tcopy");
+ ret = H5Tset_size(str_tid, (size_t)10);
+ CHECK(ret, FAIL, "H5Tset_size");
+ ret = H5Tcommit2(fid, "datatype", str_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Tcommit2");
+ ret = H5Tclose(str_tid);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* Create dataspace */
+ sid = H5Screate_simple(1, dims, NULL);
+ CHECK(sid, FAIL, "H5Screate_simple");
+
+ /* Create a dataset with the input tid */
+ did = H5Dcreate2(fid, DSET1, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dcreate2");
+
+ /* Get the dataset's datatype */
+ dtid = H5Dget_type(did);
+ CHECK(dtid, FAIL, "H5Dget_type");
+
+ /* Get the internal datatype pointer */
+ dtype = (H5T_t *)H5I_object(dtid);
+ CHECK(dtype, NULL, "H5I_object");
+
+ /* Verify the datatype message version */
+ /* H5T_COMPOUND, H5T_ENUM, H5T_ARRAY:
+ * --the library will set version according to low_bound
+ * --H5T_ARRAY: the earliest version the library will set is 2
+ * H5T_INTEGER, H5T_FLOAT, H5T_TIME, H5T_STRING, H5T_BITFIELD, H5T_OPAQUE, H5T_REFERENCE:
+ * --the library will only use basic version
+ */
+
+ if(dtype->shared->type == H5T_COMPOUND ||
+ dtype->shared->type == H5T_ENUM ||
+ dtype->shared->type == H5T_ARRAY) {
+ if(dtype->shared->type == H5T_ARRAY && low == H5F_LIBVER_EARLIEST)
+ VERIFY(dtype->shared->version, H5O_DTYPE_VERSION_2, "H5O_dtype_ver_bounds");
+ else
+ VERIFY(dtype->shared->version, H5O_dtype_ver_bounds[low], "H5O_dtype_ver_bounds");
+ } else
+ VERIFY(dtype->shared->version, H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST], "H5O_dtype_ver_bounds");
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close the dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close the datatype */
+ ret = H5Tclose(dtid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Create a default file access property list */
+ new_fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(new_fapl, FAIL, "H5Pcreate");
+
+ /* Set up dataspace and dcpl for creating a chunked dataset */
+ sid = H5Screate_simple(2, dims2, max_dims2);
+ CHECK(sid, FAIL, "H5Screate_simple");
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ CHECK(dcpl, FAIL, "H5Pcreate");
+ ret = H5Pset_chunk(dcpl, 2, chunks);
+ CHECK(ret, FAIL, "H5Pset_chunk");
+
+ /* Loop through all the combinations of low/high bounds */
+ /* Open the file and create the chunked dataset with the input tid */
+ /* Verify the dataset's datatype message version */
+ /* Also verify the committed atatype message version */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ H5E_BEGIN_TRY {
+ ret = H5Pset_libver_bounds(new_fapl, low, high);
+ } H5E_END_TRY;
+
+ if (ret < 0) /* Invalid low/high combinations */
+ continue;
+
+ /* Open the file */
+ H5E_BEGIN_TRY {
+ fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl);
+ } H5E_END_TRY;
+
+ if(fid >= 0 ) { /* The file open succeeds */
+
+ /* Get the internal file pointer */
+ f = (H5F_t *)H5I_object(fid);
+ CHECK(f, NULL, "H5I_object");
+
+ /* Open the committed datatype */
+ str_tid = H5Topen2(fid, "datatype", H5P_DEFAULT);
+ CHECK(str_tid, FAIL, "H5Topen2");
+ str_dtype = (H5T_t *)H5I_object(str_tid);
+ CHECK(str_dtype, NULL, "H5I_object");
+
+ /* Verify the committed datatype message version */
+ VERIFY(str_dtype->shared->version, H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST], "H5O_dtype_ver_bounds");
+
+ /* Close the committed datatype */
+ ret = H5Tclose(str_tid);
+ CHECK(ret, FAIL, "H5Tclose");
+
+
+ /* Create the chunked dataset */
+ did = H5Dcreate2(fid, DSETNAME, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dcreate2");
+
+ /* Get the dataset's datatype */
+ dtid = H5Dget_type(did);
+ CHECK(dtid, FAIL, "H5Dget_type");
+
+ /* Get the internal datatype pointer */
+ dtype = (H5T_t *)H5I_object(dtid);
+ CHECK(dtype, NULL, "H5I_object");
+
+ /* Verify the dataset's datatype message version */
+ /* H5T_COMPOUND, H5T_ENUM, H5T_ARRAY:
+ * --the library will set version according to low_bound
+ * --H5T_ARRAY: the earliest version the library will set is 2
+ * H5T_INTEGER, H5T_FLOAT, H5T_TIME, H5T_STRING, H5T_BITFIELD, H5T_OPAQUE, H5T_REFERENCE:
+ * --the library will only use basic version
+ */
+ if(dtype->shared->type == H5T_COMPOUND ||
+ dtype->shared->type == H5T_ENUM ||
+ dtype->shared->type == H5T_ARRAY) {
+ if(dtype->shared->type == H5T_ARRAY &&
+ f->shared->low_bound == H5F_LIBVER_EARLIEST)
+ VERIFY(dtype->shared->version, H5O_DTYPE_VERSION_2, "H5O_dtype_ver_bounds");
+ else
+ VERIFY(dtype->shared->version, H5O_dtype_ver_bounds[f->shared->low_bound], "H5O_dtype_ver_bounds");
+ } else
+ VERIFY(dtype->shared->version, H5O_dtype_ver_bounds[H5F_LIBVER_EARLIEST], "H5O_dtype_ver_bounds");
+
+ /* Close the dataset */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close the dataset's datatype */
+ ret = H5Tclose(dtid);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* Delete the dataset */
+ ret = H5Ldelete(fid, DSETNAME, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ } /* end if */
+ } /* end for */
+ } /* end for */
+
+ /* Close the file access property list */
+ ret = H5Pclose(new_fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close the dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close the dataset creation property list */
+ ret = H5Pclose(dcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+} /* end test_libver_bounds_datatype_check() */
+
+/****************************************************************
+**
+** test_libver_bounds_attributes():
+** Verify the attribute message versions:
+**
+** (a) Create a file with default fcpl and the input fapl.
+** Create a group and attach the following three attributes
+** to the group:
+** (1) Attribute with a committed datatype
+** (2) Attribute with integer type
+** (3) Attribute with character encoding set
+** Verify the three attributes' message versions.
+** Close the file.
+**
+** (b) Create a fcpl that has shared datatype message enabled.
+** Create a file with the fcpl and the input fapl.
+** Create a group and attach an attribute with shared
+** integer type to the group.
+** Verify the attribute message version.
+** Close the file
+**
+** (b) Create a new fapl that is set to the 5 pairs of low/high
+** bounds in a "for" loop. For each pair of setting in
+** the new fapl:
+** --Open the same file in (b) with the fapl
+** --Open the group and attach an attribute with integer
+** type to the group
+** --Verify the attribute message version
+** --Delete the attribute
+** --Close the group and the file
+**
+****************************************************************/
+static void
+test_libver_bounds_attributes(hid_t fapl)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t fcpl = -1; /* File creation property list */
+ hid_t new_fapl = -1; /* File access property list */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t attr_cpl = -1; /* Attribute creation property list */
+ H5A_t *attr = NULL; /* Internal attribute pointer */
+ H5F_t *f = NULL; /* Internal file pointer */
+ H5F_libver_t low, high; /* Low and high bounds */
+ herr_t ret; /* Return value */
+
+ /* Retrieve the low/high bounds from the input fapl */
+ ret = H5Pget_libver_bounds(fapl, &low, &high);
+ CHECK(ret, FAIL, "H5Pget_libver_bounds");
+
+ /* Create the file */
+ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Integer datatpye */
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ CHECK(tid, FAIL, "H5Tcopy");
+
+ /* Create a committed datatype */
+ ret = H5Tcommit2(fid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Tcommit2");
+
+ /* Create dataspace */
+ sid = H5Screate(H5S_SCALAR);
+ CHECK(sid, FAIL, "H5Screate");
+
+ /* Create a group */
+ gid = H5Gcreate2(fid, GRP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(gid, FAIL, "H5Gcreate2");
+
+ /* Attach an attribute to the group with the committed datatype */
+ aid = H5Acreate2(gid, "attr1", tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(aid, FAIL, "H5Acreate2");
+
+ /* Get the internal attribute pointer */
+ attr = (H5A_t *)H5I_object(aid);
+ CHECK(attr, NULL, "H5I_object");
+
+ /* Verify the attribute version */
+ if(low == H5F_LIBVER_EARLIEST)
+ /* The earliest version the library can set for an attribute with committed datatype is 2 */
+ VERIFY(attr->shared->version, H5O_ATTR_VERSION_2, "H5O_attr_ver_bounds");
+ else
+ VERIFY(attr->shared->version, H5O_attr_ver_bounds[low], "H5O_attr_ver_bounds");
+
+ /* Close the attribute */
+ ret = H5Aclose(aid);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Create an attribute to the group with integer type */
+ aid = H5Acreate2(gid, "attr2", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(aid, FAIL, "H5Acreate2");
+
+ /* Get the internal attribute pointer */
+ attr = (H5A_t *)H5I_object(aid);
+ CHECK(attr, NULL, "H5I_object");
+
+ /* Verify attribute version */
+ VERIFY(attr->shared->version, H5O_attr_ver_bounds[low], "H5O_attr_ver_bounds");
+
+ /* Close the attribute */
+ ret = H5Aclose(aid);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Enable character encoding in attribute creation property list */
+ attr_cpl = H5Pcreate(H5P_ATTRIBUTE_CREATE);
+ CHECK(attr_cpl, FAIL, "H5Pcreate");
+ ret = H5Pset_char_encoding(attr_cpl, H5T_CSET_UTF8);
+ CHECK(ret, FAIL, "H5Pset_char_encoding");
+
+ /* Attach an attribute to the group with character encoding set */
+ aid = H5Acreate2(gid, "attr3", H5T_NATIVE_INT, sid, attr_cpl, H5P_DEFAULT);
+ CHECK(aid, FAIL, "H5Acreate2");
+
+ /* Get internal attribute pointer */
+ attr = (H5A_t *)H5I_object(aid);
+ CHECK(attr, NULL, "H5I_object");
+
+ /* Verify attribute version */
+ if(low == H5F_LIBVER_EARLIEST)
+ /* The earliest version the library can set for an attribute with character encoding is 3 */
+ VERIFY(attr->shared->version, H5O_ATTR_VERSION_3, "H5O_attr_ver_bounds");
+ else
+ VERIFY(attr->shared->version, H5O_attr_ver_bounds[low], "H5O_attr_ver_bounds");
+
+ /* Close the attribute */
+ ret = H5Aclose(aid);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Close the attribute creation property list */
+ ret = H5Pclose(attr_cpl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close the group */
+ ret = H5Gclose(gid);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Close the dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close the datatype */
+ ret = H5Tclose(tid);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Create a copy of the file creation property list */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+ CHECK(fcpl, FAIL, "H5Pcreate");
+
+ /* Enable shared datatype message */
+ ret = H5Pset_shared_mesg_nindexes(fcpl, 1);
+ CHECK(ret, FAIL, "H5Pset_shared_mesg_nindexes");
+ ret = H5Pset_shared_mesg_index(fcpl, 0, H5O_SHMESG_DTYPE_FLAG, 2);
+ CHECK(ret, FAIL, "H5Pset_shared_mesg_index");
+
+ /* Create the file with shared datatype message enabled */
+ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Create an integer datatye */
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ CHECK(tid, FAIL, "H5Tcopy");
+
+ /* Create dataspace */
+ sid = H5Screate(H5S_SCALAR);
+ CHECK(sid, FAIL, "H5Screate");
+
+ /* Create a group */
+ gid = H5Gcreate2(fid, GRP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(gid, FAIL, "H5Gcreate2");
+
+ /* Attach an attribute to the group with shared integer datatype */
+ aid = H5Acreate2(gid, ATTR_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(aid, FAIL, "H5Acreate2");
+
+ /* Get the internal attribute pointer */
+ attr = (H5A_t *)H5I_object(aid);
+ CHECK(attr, NULL, "H5I_object");
+
+ /* Verify the attribute version */
+ if(low == H5F_LIBVER_EARLIEST)
+ /* The earliest version the library can set for an attribute with shared datatype is 2 */
+ VERIFY(attr->shared->version, H5O_ATTR_VERSION_2, "H5O_attr_ver_bounds");
+ else
+ VERIFY(attr->shared->version, H5O_attr_ver_bounds[low], "H5O_attr_ver_bounds");
+
+ /* Close the attribute */
+ ret = H5Aclose(aid);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Close the group */
+ ret = H5Gclose(gid);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Close the dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close the datatype */
+ ret = H5Tclose(tid);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Create a default file access property list */
+ new_fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(new_fapl, FAIL, "H5Pcreate");
+
+ /* Create a scalar dataspace to be used later for the attribute */
+ sid = H5Screate(H5S_SCALAR);
+ CHECK(sid, FAIL, "H5Screate");
+
+ /* Loop through all the combinations of low/high bounds */
+ /* Open the file and group and attach an attribute to the group */
+ /* Verify the attribute version */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+ H5E_BEGIN_TRY {
+ ret = H5Pset_libver_bounds(new_fapl, low, high);
+ } H5E_END_TRY;
+
+ if(ret < 0) /* Invalid low/high combinations */
+ continue;
+
+ /* Open the file */
+ H5E_BEGIN_TRY {
+ fid = H5Fopen(FILE8, H5F_ACC_RDWR, new_fapl);
+ } H5E_END_TRY;
+
+ if(fid >=0 ) { /* The file open succeeds */
+
+ /* Get the internal file pointer */
+ f = (H5F_t *)H5I_object(fid);
+ CHECK(f, NULL, "H5I_object");
+
+ /* Open the group */
+ gid = H5Gopen2(fid, GRP_NAME, H5P_DEFAULT);
+ CHECK(gid, FAIL, "H5Gopen2");
+
+ /* Attach an attribute to the group */
+ aid = H5Acreate2(gid, "attr1", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(aid, FAIL, "H5Acreate2");
+
+ /* Get the internal attribute pointer */
+ attr = (H5A_t *)H5I_object(aid);
+ CHECK(attr, NULL, "H5I_object");
+
+ /* Verify the attribute message version */
+ VERIFY(attr->shared->version, H5O_attr_ver_bounds[f->shared->low_bound], "H5O_attr_ver_bounds");
+
+ /* Close the attribute */
+ ret = H5Aclose(aid);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Delete the attribute */
+ ret = H5Adelete(gid, "attr1");
+ CHECK(ret, FAIL, "H5Adelete");
+
+ /* Close the group */
+ ret = H5Gclose(gid);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Close the file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ } /* end if */
+ } /* end for */
+ } /* end for */
+
+ /* Close the file access property list */
+ ret = H5Pclose(new_fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close the dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+} /* end test_libver_bounds_attributes() */
+
/****************************************************************
**
** test_libver_macros():
@@ -5333,6 +7203,7 @@ test_file(void)
test_filespace_round_compatible(); /* Testing file space compatibility for files from trunk to 1_8 to trunk */
test_filespace_1_10_0_compatible(); /* Testing file space compatibility for files from release 1.10.0 */
test_libver_bounds(); /* Test compatibility for file space management */
+ test_libver_bounds_low_high();
test_libver_macros(); /* Test the macros for library version comparison */
test_libver_macros2(); /* Test the macros for library version comparison */
#ifndef H5_NO_DEPRECATED_SYMBOLS
diff --git a/test/th5o.c b/test/th5o.c
index 144ea4c..00d706c 100644
--- a/test/th5o.c
+++ b/test/th5o.c
@@ -774,7 +774,7 @@ test_h5o_link(void)
hid_t lcpl_id=-1;
hsize_t dims[2] = {TEST6_DIM1, TEST6_DIM2};
htri_t committed; /* Whether the named datatype is committed */
- unsigned new_format; /* Whether to use the new format or not */
+ H5F_libver_t low, high; /* File format bounds */
int *wdata;
int *rdata;
int i, n;
@@ -801,98 +801,103 @@ test_h5o_link(void)
ret = H5Pset_create_intermediate_group(lcpl_id, TRUE);
CHECK(ret, FAIL, "H5Pset_create_intermediate_group");
- /* Loop over using new group format */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
-
- /* Make a FAPL that uses the "use the latest version of the format" bounds */
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- CHECK(fapl_id, FAIL, "H5Pcreate");
-
- /* Set the "use the latest version of the format" bounds for creating objects in the file */
- ret = H5Pset_libver_bounds(fapl_id, (new_format ? H5F_LIBVER_LATEST : H5F_LIBVER_EARLIEST), H5F_LIBVER_LATEST);
- CHECK(ret, FAIL, "H5Pset_libver_bounds");
-
- /* Create a new HDF5 file */
- file_id = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
- CHECK(file_id, FAIL, "H5Fcreate");
-
- /* Close the FAPL */
- ret = H5Pclose(fapl_id);
- CHECK(ret, FAIL, "H5Pclose");
-
-
- /* Create and commit a datatype with no name */
- type_id = H5Tcopy(H5T_NATIVE_INT);
- CHECK(type_id, FAIL, "H5Fcreate");
- ret = H5Tcommit_anon(file_id, type_id, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Tcommit_anon");
- committed = H5Tcommitted(type_id);
- VERIFY(committed, TRUE, "H5Tcommitted");
-
- /* Create a dataset with no name using the committed datatype*/
- dset_id = H5Dcreate_anon(file_id, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dset_id, FAIL, "H5Dcreate_anon");
-
- /* Verify that we can write to and read from the dataset */
-
- /* Write the data to the dataset */
- ret = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
- CHECK(ret, FAIL, "H5Dwrite");
-
- /* Read the data back */
- ret = H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
- CHECK(ret, FAIL, "H5Dread");
-
- /* Verify the data */
- for(i = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++)
- VERIFY(wdata[i], rdata[i], "H5Dread");
-
- /* Create a group with no name*/
- group_id = H5Gcreate_anon(file_id, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(group_id, FAIL, "H5Gcreate_anon");
-
- /* Link nameless datatype into nameless group */
- ret = H5Olink(type_id, group_id, "datatype", H5P_DEFAULT, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Olink");
-
- /* Link nameless dataset into nameless group with intermediate group */
- ret = H5Olink(dset_id, group_id, "inter_group/dataset", lcpl_id, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Olink");
-
- /* Close IDs for dataset and datatype */
- ret = H5Dclose(dset_id);
- CHECK(ret, FAIL, "H5Dclose");
- ret = H5Tclose(type_id);
- CHECK(ret, FAIL, "H5Tclose");
-
- /* Re-open datatype using new link */
- type_id = H5Topen2(group_id, "datatype", H5P_DEFAULT);
- CHECK(type_id, FAIL, "H5Topen2");
-
- /* Link nameless group to root group and close the group ID*/
- ret = H5Olink(group_id, file_id, "/group", H5P_DEFAULT, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Olink");
- ret = H5Gclose(group_id);
- CHECK(ret, FAIL, "H5Gclose");
-
- /* Open dataset through root group and verify its data */
- dset_id = H5Dopen2(file_id, "/group/inter_group/dataset", H5P_DEFAULT);
- CHECK(dset_id, FAIL, "H5Dopen2");
-
- /* Read data from dataset */
- ret = H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
- CHECK(ret, FAIL, "H5Dread");
- for(i = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++)
- VERIFY(wdata[i], rdata[i], "H5Dread");
-
- /* Close open IDs */
- ret = H5Dclose(dset_id);
- CHECK(ret, FAIL, "H5Dclose");
- ret = H5Tclose(type_id);
- CHECK(ret, FAIL, "H5Tclose");
- ret = H5Fclose(file_id);
- CHECK(ret, FAIL, "H5Fclose");
- } /* end for */
+ /* Create a file access property list */
+ fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl_id, FAIL, "H5Pcreate");
+
+ /* Loop through all the combinations of low/high library format bounds */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+
+ /* Set version bounds */
+ H5E_BEGIN_TRY {
+ ret = H5Pset_libver_bounds(fapl_id, low, high);
+ } H5E_END_TRY;
+
+ if (ret < 0) /* Invalid low/high combinations */
+ continue;
+
+ /* Create a new HDF5 file */
+ file_id = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ CHECK(file_id, FAIL, "H5Fcreate");
+
+ /* Close the FAPL */
+ ret = H5Pclose(fapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Create and commit a datatype with no name */
+ type_id = H5Tcopy(H5T_NATIVE_INT);
+ CHECK(type_id, FAIL, "H5Fcreate");
+ ret = H5Tcommit_anon(file_id, type_id, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Tcommit_anon");
+ committed = H5Tcommitted(type_id);
+ VERIFY(committed, TRUE, "H5Tcommitted");
+
+ /* Create a dataset with no name using the committed datatype*/
+ dset_id = H5Dcreate_anon(file_id, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset_id, FAIL, "H5Dcreate_anon");
+
+ /* Verify that we can write to and read from the dataset */
+
+ /* Write the data to the dataset */
+ ret = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Read the data back */
+ ret = H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Verify the data */
+ for(i = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++)
+ VERIFY(wdata[i], rdata[i], "H5Dread");
+
+ /* Create a group with no name*/
+ group_id = H5Gcreate_anon(file_id, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(group_id, FAIL, "H5Gcreate_anon");
+
+ /* Link nameless datatype into nameless group */
+ ret = H5Olink(type_id, group_id, "datatype", H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Olink");
+
+ /* Link nameless dataset into nameless group with intermediate group */
+ ret = H5Olink(dset_id, group_id, "inter_group/dataset", lcpl_id, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Olink");
+
+ /* Close IDs for dataset and datatype */
+ ret = H5Dclose(dset_id);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Tclose(type_id);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* Re-open datatype using new link */
+ type_id = H5Topen2(group_id, "datatype", H5P_DEFAULT);
+ CHECK(type_id, FAIL, "H5Topen2");
+
+ /* Link nameless group to root group and close the group ID*/
+ ret = H5Olink(group_id, file_id, "/group", H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Olink");
+ ret = H5Gclose(group_id);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Open dataset through root group and verify its data */
+ dset_id = H5Dopen2(file_id, "/group/inter_group/dataset", H5P_DEFAULT);
+ CHECK(dset_id, FAIL, "H5Dopen2");
+
+ /* Read data from dataset */
+ ret = H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
+ CHECK(ret, FAIL, "H5Dread");
+ for(i = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++)
+ VERIFY(wdata[i], rdata[i], "H5Dread");
+
+ /* Close open IDs */
+ ret = H5Dclose(dset_id);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Tclose(type_id);
+ CHECK(ret, FAIL, "H5Tclose");
+ ret = H5Fclose(file_id);
+ CHECK(ret, FAIL, "H5Fclose");
+ } /* for high */
+ } /* for low */
/* Close remaining IDs */
ret = H5Sclose(space_id);
diff --git a/test/th5s.c b/test/th5s.c
index c63320a..4154c5f 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -19,9 +19,29 @@
*
*************************************************************/
+#include "hdf5.h"
#include "testhdf5.h"
#include "H5srcdir.h"
+#include "H5Bprivate.h"
+#include "H5Iprivate.h"
+#include "H5Pprivate.h"
+
+/*
+ * This file needs to access private information from the H5S package.
+ * This file also needs to access the dataspace testing code.
+ */
+#define H5S_FRIEND /*suppress error about including H5Spkg */
+#include "H5Spkg.h" /* Dataspaces */
+
+/*
+ * This file needs to access private information from the H5O package.
+ * This file also needs to access the dataspace testing code.
+ */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
+#define H5O_TESTING
+#include "H5Opkg.h" /* Object header */
+
#include "H5private.h"
#include "H5Bprivate.h"
#include "H5Sprivate.h"
@@ -2364,6 +2384,130 @@ test_h5s_bug1(void)
CHECK(ret, FAIL, "H5Sclose");
} /* test_h5s_bug1() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_versionbounds
+ *
+ * Purpose: Tests version bounds with dataspace.
+ *
+ * Description:
+ * This function creates a file with lower bounds then later
+ * reopens it with higher bounds to show that the dataspace
+ * version is upgraded appropriately.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ *-------------------------------------------------------------------------
+ */
+#define VERBFNAME "tverbounds_dspace.h5"
+#define BASIC_DSET "Basic Dataset"
+#define LATEST_DSET "Latest Dataset"
+static void
+test_versionbounds(void)
+{
+ hid_t file = -1; /* File ID */
+ hid_t space = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t fapl = -1; /* File access property list ID */
+ hid_t dset_space = -1; /* Retrieved dataset's dataspace ID */
+ hsize_t dim[1]; /* Dataset dimensions */
+ H5F_libver_t low, high; /* File format bounds */
+ H5S_t *spacep = NULL; /* Pointer to internal dataspace */
+ herr_t ret = 0; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Version Bounds\n"));
+
+ /* Create a file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Create dataspace */
+ dim[0] = 10;
+ space = H5Screate_simple(1, dim, NULL);
+ CHECK(space, FAIL, "H5Screate");
+
+ /* Its version should be H5O_SDSPACE_VERSION_1 */
+ spacep = (H5S_t *)H5I_object(space);
+ CHECK(spacep, NULL, "H5I_object");
+ VERIFY(spacep->extent.version, H5O_SDSPACE_VERSION_1, "basic dataspace version bound");
+
+ /* Set high bound to V18 */
+ low = H5F_LIBVER_EARLIEST;
+ high = H5F_LIBVER_V18;
+ ret = H5Pset_libver_bounds(fapl, low, high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create the file */
+ file = H5Fcreate(VERBFNAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ CHECK(file, FAIL, "H5Fcreate");
+
+ /* Create a basic dataset */
+ dset = H5Dcreate2(file, BASIC_DSET, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dset > 0) /* dataset created successfully */
+ {
+ /* Get the internal dataspace pointer */
+ dset_space = H5Dget_space(dset);
+ CHECK(dset_space, FAIL, "H5Dget_space");
+ spacep = (H5S_t *)H5I_object(dset_space);
+ CHECK(spacep, NULL, "H5I_object");
+
+ /* Dataspace version should remain as H5O_SDSPACE_VERSION_1 */
+ VERIFY(spacep->extent.version, H5O_SDSPACE_VERSION_1, "basic dataspace version bound");
+
+ /* Close dataspace */
+ ret = H5Sclose(dset_space);
+ CHECK(ret, FAIL, "H5Sclose");
+ }
+
+ /* Close basic dataset and the file */
+ ret = H5Dclose(dset);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Fclose(file);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Set low and high bounds to latest to trigger the increment of the
+ dataspace version */
+ low = H5F_LIBVER_LATEST;
+ high = H5F_LIBVER_LATEST;
+ ret = H5Pset_libver_bounds(fapl, low, high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Reopen the file with new version bounds, LATEST/LATEST */
+ file = H5Fopen(VERBFNAME, H5F_ACC_RDWR, fapl);
+
+ /* Create another dataset using the same dspace as the previous dataset */
+ dset = H5Dcreate2(file, LATEST_DSET, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset, FAIL, "H5Dcreate2");
+
+ /* Dataset created successfully. Verify that dataspace version has been
+ upgraded per the low bound */
+
+ /* Get the internal dataspace pointer */
+ dset_space = H5Dget_space(dset);
+ CHECK(dset_space, FAIL, "H5Dget_space");
+ spacep = (H5S_t *)H5I_object(dset_space);
+ CHECK(spacep, NULL, "H5I_object");
+
+ /* Verify the dataspace version */
+ VERIFY(spacep->extent.version, H5O_sdspace_ver_bounds[low], "upgraded dataspace version");
+
+ /* Close everything */
+ ret = H5Sclose(dset_space);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Dclose(dset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ ret = H5Sclose(space);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Fclose(file);
+ CHECK(ret, FAIL, "H5Fclose");
+} /* end test_versionbounds() */
+
+
/****************************************************************
**
** test_h5s(): Main H5S (dataspace) testing routine.
@@ -2391,6 +2535,7 @@ test_h5s(void)
test_h5s_extent_equal(); /* Test extent comparison code */
test_h5s_extent_copy(); /* Test extent copy code */
test_h5s_bug1(); /* Test bug in offset initialization */
+ test_versionbounds(); /* Test version bounds with dataspace */
} /* test_h5s() */
@@ -2415,4 +2560,5 @@ cleanup_h5s(void)
remove(NULLFILE);
remove(BASICFILE);
remove(ZEROFILE);
+ remove(VERBFNAME);
}
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index c98575c..e7f4aae 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -75,6 +75,8 @@ h5repack_init(pack_opt_t *options, int verbose, hbool_t latest)
options->verbose = verbose;
options->latest = latest;
options->layout_g = H5D_LAYOUT_ERROR;
+ options->low_bound = H5F_LIBVER_EARLIEST;
+ options->high_bound = H5F_LIBVER_LATEST;
for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) {
options->filter_g[n].filtn = -1;
diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h
index 0252768..a0e0387 100644
--- a/tools/src/h5repack/h5repack.h
+++ b/tools/src/h5repack/h5repack.h
@@ -101,21 +101,23 @@ typedef struct {
/* all the above, ready to go to the hrepack call */
typedef struct {
- pack_opttbl_t *op_tbl; /*table with all -c and -f options */
- int all_layout; /*apply the layout to all objects */
- int all_filter; /*apply the filter to all objects */
+ pack_opttbl_t *op_tbl; /*table with all -c and -f options */
+ int all_layout; /*apply the layout to all objects */
+ int all_filter; /*apply the filter to all objects */
filter_info_t filter_g[H5_REPACK_MAX_NFILTERS]; /*global filter array for the ALL case */
- int n_filter_g; /*number of global filters */
- chunk_info_t chunk_g; /*global chunk INFO for the ALL case */
- H5D_layout_t layout_g; /*global layout information for the ALL case */
- int verbose; /*verbose mode */
- hsize_t min_comp; /*minimum size to compress, in bytes */
- int use_native; /*use a native type in write */
- hbool_t latest; /*pack file with the latest file format */
- int grp_compact; /* Set the maximum number of links to store as header messages in the group */
- int grp_indexed; /* Set the minimum number of links to store in the indexed format */
- int msg_size[8]; /* Minimum size of shared messages: dataspace,
- datatype, fill value, filter pipleline, attribute */
+ int n_filter_g; /*number of global filters */
+ chunk_info_t chunk_g; /*global chunk INFO for the ALL case */
+ H5D_layout_t layout_g; /*global layout information for the ALL case */
+ int verbose; /*verbose mode */
+ hsize_t min_comp; /*minimum size to compress, in bytes */
+ int use_native; /*use a native type in write */
+ hbool_t latest; /*pack file with the latest file format */
+ H5F_libver_t low_bound; /* The file's low bound as in H5Fset_libver_bounds() */
+ H5F_libver_t high_bound; /* The file's high bound as in H5Fset_libver_bounds() */
+ int grp_compact; /* Set the maximum number of links to store as header messages in the group */
+ int grp_indexed; /* Set the minimum number of links to store in the indexed format */
+ int msg_size[8]; /* Minimum size of shared messages: dataspace,
+ datatype, fill value, filter pipleline, attribute */
const char *ublock_filename; /* user block file name */
hsize_t ublock_size; /* user block size */
hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index e205fba..b279cf9 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -142,8 +142,18 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed to close property list");
}
+ if(options->latest)
+ options->low_bound = options->high_bound = H5F_LIBVER_LATEST;
+ /* Create file access property list */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list");
+
+ /* It can be default, latest or other settings by users */
+ if(H5Pset_libver_bounds(fapl, options->low_bound, options->high_bound) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_libver_bounds failed to set format version bounds");
+
/* Check if we need to create a non-default file creation property list */
- if (options->latest || ub_size > 0) {
+ if (options->low_bound >= H5F_LIBVER_V18 || ub_size > 0) {
/* Create file creation property list */
if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list");
@@ -152,7 +162,7 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
if (H5Pset_userblock(fcpl, ub_size) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_userblock failed to set non-default userblock size");
- if (options->latest) {
+ if (options->low_bound >= H5F_LIBVER_V18) {
unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5];
/* Adjust group creation parameters for root group */
@@ -203,12 +213,6 @@ int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shared_mesg_index failed to configure the specified shared object header message index");
} /* if (nindex>0) */
- /* Create file access property list */
- if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list");
-
- if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_libver_bounds failed to set property for using latest version of the format");
} /* end if */
} /* end if */
#if defined (H5REPACK_DEBUG_USER_BLOCK)
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index d34c394..0fa268e 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -31,7 +31,7 @@ const char *outfile = NULL;
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "hVvf:l:m:e:nLc:d:s:u:b:M:t:a:i:o:S:P:T:G:q:z:E";
+static const char *s_opts = "hVvf:l:m:e:nLj:k:c:d:s:u:b:M:t:a:i:o:S:P:T:G:q:z:E";
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
{ "version", no_arg, 'V' },
@@ -42,6 +42,8 @@ static struct long_options l_opts[] = {
{ "file", require_arg, 'e' },
{ "native", no_arg, 'n' },
{ "latest", no_arg, 'L' },
+ { "low", require_arg, 'j' },
+ { "high", require_arg, 'k' },
{ "compact", require_arg, 'c' },
{ "indexed", require_arg, 'd' },
{ "ssize", require_arg, 's' },
@@ -81,7 +83,13 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, " -v, --verbose Verbose mode, print object information\n");
PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
PRINTVALSTREAM(rawoutstream, " -n, --native Use a native HDF5 type when repacking\n");
+ PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n");
PRINTVALSTREAM(rawoutstream, " -L, --latest Use latest version of file format\n");
+ PRINTVALSTREAM(rawoutstream, " This option will take precedence over the -j and -k options\n");
+ PRINTVALSTREAM(rawoutstream, " --low=BOUND The low bound for library release versions to use when creating\n");
+ PRINTVALSTREAM(rawoutstream, " objects in the file (default is H5F_LIBVER_EARLIEST)\n");
+ PRINTVALSTREAM(rawoutstream, " --high=BOUND The high bound for library release versions to use when creating\n");
+ PRINTVALSTREAM(rawoutstream, " objects in the file (default is H5F_LIBVER_LATEST)\n");
PRINTVALSTREAM(rawoutstream, " -c L1, --compact=L1 Maximum number of links in header messages\n");
PRINTVALSTREAM(rawoutstream, " -d L2, --indexed=L2 Minimum number of links in the indexed format\n");
PRINTVALSTREAM(rawoutstream, " -s S[:F], --ssize=S[:F] Shared object header message minimum size\n");
@@ -114,8 +122,12 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, " F - is the shared object header message type, any of <dspace|dtype|fill|\n");
PRINTVALSTREAM(rawoutstream, " pline|attr>. If F is not specified, S applies to all messages\n");
PRINTVALSTREAM(rawoutstream, "\n");
- PRINTVALSTREAM(rawoutstream, " --enable-error-stack Prints messages from the HDF5 error stack as they\n");
- PRINTVALSTREAM(rawoutstream, " occur.\n");
+ PRINTVALSTREAM(rawoutstream, " BOUND is an integer indicating the library release versions to use when creating\n");
+ PRINTVALSTREAM(rawoutstream, " objects in the file (see H5Pset_libver_bounds()):\n");
+ PRINTVALSTREAM(rawoutstream, " 0: This is H5F_LIBVER_EARLIEST in H5F_libver_t struct\n");
+ PRINTVALSTREAM(rawoutstream, " 1: This is H5F_LIBVER_V18 in H5F_libver_t struct\n");
+ PRINTVALSTREAM(rawoutstream, " 2: This is H5F_LIBVER_V110 in H5F_libver_t struct\n");
+ PRINTVALSTREAM(rawoutstream, " (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V110 for this release\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " FS_STRATEGY is a string indicating the file space strategy used:\n");
PRINTVALSTREAM(rawoutstream, " FSM_AGGR:\n");
@@ -205,6 +217,11 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, " Using latest file format with maximum compact group size of 10 and\n");
PRINTVALSTREAM(rawoutstream, " and minimum shared datatype size of 20\n");
PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, "5) h5repack --low=0 --high=1 file1 file2\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " Set low=H5F_LIBVER_EARLIEST and high=H5F_LIBVER_V18 via H5Pset_libver_bounds() when\n");
+ PRINTVALSTREAM(rawoutstream, " creating the repacked file: file2\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, "5) h5repack -f SHUF -f GZIP=1 file1 file2\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " Add both filters SHUF and GZIP in this order to all datasets\n");
@@ -500,6 +517,22 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
options->latest = TRUE;
break;
+ case 'j':
+ options->low_bound = (H5F_libver_t)HDatoi(opt_arg);
+ if(options->low_bound < H5F_LIBVER_EARLIEST || options->low_bound > H5F_LIBVER_LATEST) {
+ error_msg("in parsing low bound\n");
+ goto done;
+ }
+ break;
+
+ case 'k':
+ options->high_bound = (H5F_libver_t)HDatoi(opt_arg);
+ if(options->high_bound < H5F_LIBVER_EARLIEST || options->high_bound > H5F_LIBVER_LATEST) {
+ error_msg("in parsing high bound\n");
+ goto done;
+ }
+ break;
+
case 'c':
options->grp_compact = HDatoi( opt_arg );
if (options->grp_compact > 0)
@@ -634,7 +667,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
break;
case 'E':
- enable_error_stack = TRUE;
+ enable_error_stack = TRUE;
break;
default:
diff --git a/tools/test/h5repack/testfiles/h5repack-help.txt b/tools/test/h5repack/testfiles/h5repack-help.txt
index 1ff5b73..0eef0f5 100644
--- a/tools/test/h5repack/testfiles/h5repack-help.txt
+++ b/tools/test/h5repack/testfiles/h5repack-help.txt
@@ -6,7 +6,13 @@ usage: h5repack [OPTIONS] file1 file2
-v, --verbose Verbose mode, print object information
-V, --version Print version number and exit
-n, --native Use a native HDF5 type when repacking
+ --enable-error-stack Prints messages from the HDF5 error stack as they occur
-L, --latest Use latest version of file format
+ This option will take precedence over the -j and -k options
+ --low=BOUND The low bound for library release versions to use when creating
+ objects in the file (default is H5F_LIBVER_EARLIEST)
+ --high=BOUND The high bound for library release versions to use when creating
+ objects in the file (default is H5F_LIBVER_LATEST)
-c L1, --compact=L1 Maximum number of links in header messages
-d L2, --indexed=L2 Minimum number of links in the indexed format
-s S[:F], --ssize=S[:F] Shared object header message minimum size
@@ -39,8 +45,12 @@ usage: h5repack [OPTIONS] file1 file2
F - is the shared object header message type, any of <dspace|dtype|fill|
pline|attr>. If F is not specified, S applies to all messages
- --enable-error-stack Prints messages from the HDF5 error stack as they
- occur.
+ BOUND is an integer indicating the library release versions to use when creating
+ objects in the file (see H5Pset_libver_bounds()):
+ 0: This is H5F_LIBVER_EARLIEST in H5F_libver_t struct
+ 1: This is H5F_LIBVER_V18 in H5F_libver_t struct
+ 2: This is H5F_LIBVER_V110 in H5F_libver_t struct
+ (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V110 for this release
FS_STRATEGY is a string indicating the file space strategy used:
FSM_AGGR:
@@ -130,6 +140,11 @@ Examples of use:
Using latest file format with maximum compact group size of 10 and
and minimum shared datatype size of 20
+5) h5repack --low=0 --high=1 file1 file2
+
+ Set low=H5F_LIBVER_EARLIEST and high=H5F_LIBVER_V18 via H5Pset_libver_bounds() when
+ creating the repacked file: file2
+
5) h5repack -f SHUF -f GZIP=1 file1 file2
Add both filters SHUF and GZIP in this order to all datasets