summaryrefslogtreecommitdiffstats
path: root/src/H5Ofsinfo.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@koziol.gov>2019-06-28 21:13:36 (GMT)
committerQuincey Koziol <koziol@koziol.gov>2019-06-28 21:13:36 (GMT)
commit2042c775f0d9240609527e621d84e4911ad7f6a5 (patch)
treeb90dd86bd7d25534102b6e929d9cbbdf01c77389 /src/H5Ofsinfo.c
parentd5130bb57332ce0049302c5836bbf666b23513cd (diff)
parent13d951d37205bcd48723330a898e5d67c5e1ecb2 (diff)
downloadhdf5-2042c775f0d9240609527e621d84e4911ad7f6a5.zip
hdf5-2042c775f0d9240609527e621d84e4911ad7f6a5.tar.gz
hdf5-2042c775f0d9240609527e621d84e4911ad7f6a5.tar.bz2
Merge branch 'develop' into feature/update_gcc_flags
Diffstat (limited to 'src/H5Ofsinfo.c')
-rw-r--r--src/H5Ofsinfo.c85
1 files changed, 84 insertions, 1 deletions
diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c
index ec2328c..2a71b05 100644
--- a/src/H5Ofsinfo.c
+++ b/src/H5Ofsinfo.c
@@ -65,6 +65,16 @@ const H5O_msg_class_t H5O_MSG_FSINFO[1] = {{
H5O__fsinfo_debug /* debug the message */
}};
+/* Format version bounds for fsinfo message */
+/* This message exists starting library release v1.10 */
+static const unsigned H5O_fsinfo_ver_bounds[] = {
+ H5O_INVALID_VERSION, /* H5F_LIBVER_EARLIEST */
+ H5O_INVALID_VERSION, /* H5F_LIBVER_V18 */
+ H5O_FSINFO_VERSION_1, /* H5F_LIBVER_V110 */
+ H5O_FSINFO_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
+#define N_FSINFO_VERSION_BOUNDS 4
+
/* Declare a free list to manage the H5O_fsinfo_t struct */
H5FL_DEFINE_STATIC(H5O_fsinfo_t);
@@ -257,7 +267,7 @@ H5O_fsinfo_copy(const void *_mesg, void *_dest)
/* check args */
HDassert(fsinfo);
if(!dest && NULL == (dest = H5FL_CALLOC(H5O_fsinfo_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* copy */
*dest = *fsinfo;
@@ -331,6 +341,79 @@ H5O__fsinfo_free(void *mesg)
/*-------------------------------------------------------------------------
+ * Function: H5O_fsinfo_set_version
+ *
+ * Purpose: Set the version to encode the fsinfo message with.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Vailin Choi; June 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_fsinfo_set_version(H5F_libver_t low, H5F_libver_t high, H5O_fsinfo_t *fsinfo)
+{
+ unsigned version; /* Message version */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDcompile_assert(N_FSINFO_VERSION_BOUNDS == H5F_LIBVER_NBOUNDS);
+ HDassert(fsinfo);
+
+ version = H5O_FSINFO_VERSION_1;
+
+ /* Upgrade to the version indicated by the file's low bound if higher */
+ if(H5O_fsinfo_ver_bounds[low] != H5O_INVALID_VERSION)
+ version = MAX(version, H5O_fsinfo_ver_bounds[low]);
+
+ /* Version bounds check */
+ if(H5O_fsinfo_ver_bounds[high] == H5O_INVALID_VERSION || version > H5O_fsinfo_ver_bounds[high])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "File space info message's version out of bounds")
+
+ /* Set the message version */
+ fsinfo->version = version;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_fsinfo_set_version() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_fsinfo_check_version
+ *
+ * Purpose: Validate the fsinfo message version
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Summer 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_fsinfo_check_version(H5F_libver_t high, H5O_fsinfo_t *fsinfo)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDcompile_assert(N_FSINFO_VERSION_BOUNDS == H5F_LIBVER_NBOUNDS);
+ HDassert(fsinfo);
+
+ /* Check the version */
+ if(H5O_fsinfo_ver_bounds[high] == H5O_INVALID_VERSION || fsinfo->version > H5O_fsinfo_ver_bounds[high])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "File space info message's version out of bounds")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_fsinfo_check_version() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O__fsinfo_debug
*
* Purpose: Prints debugging info for a message.