summaryrefslogtreecommitdiffstats
path: root/src/H5FD.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2015-06-17 11:48:34 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2015-06-17 11:48:34 (GMT)
commitfb27787c2abb889a2184bb39eead626a144117d0 (patch)
tree7ad16361ac8b2382f0ccf72ce47aae020fed688c /src/H5FD.c
parent984ecb72c2fa62d233383b24047e04061754ae34 (diff)
parent6e9e9e0dd200979642de8d2a2bce2f66f9728237 (diff)
downloadhdf5-fb27787c2abb889a2184bb39eead626a144117d0.zip
hdf5-fb27787c2abb889a2184bb39eead626a144117d0.tar.gz
hdf5-fb27787c2abb889a2184bb39eead626a144117d0.tar.bz2
[svn-r27222] Merge of r27035-27221 from the trunk.
Tested on 64-bit linux VM: Serial: C++ and Fortran 2003 Parallel: Fortran
Diffstat (limited to 'src/H5FD.c')
-rw-r--r--src/H5FD.c53
1 files changed, 47 insertions, 6 deletions
diff --git a/src/H5FD.c b/src/H5FD.c
index 0e4d840..c4ee11f 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -540,11 +540,11 @@ H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf)
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD_sb_encode() */
/*-------------------------------------------------------------------------
- * Function: H5FD_sb_decode
+ * Function: H5FD__sb_decode
*
* Purpose: Decodes the driver information block.
*
@@ -556,20 +556,61 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
-H5FD_sb_decode(H5FD_t *file, const char *name, const uint8_t *buf)
+static herr_t
+H5FD__sb_decode(H5FD_t *file, const char *name, const uint8_t *buf)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_STATIC
HDassert(file && file->cls);
+
+ /* Decode driver information */
if(file->cls->sb_decode && (file->cls->sb_decode)(file, name, buf) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_decode request failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5FD_sb_decode() */
+} /* end H5FD__sb_decode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_sb_load
+ *
+ * Purpose: Validate and decode the driver information block.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, July 19, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(file && file->cls);
+
+ /* Check if driver matches driver information saved. Unfortunately, we can't push this
+ * function to each specific driver because we're checking if the driver is correct.
+ */
+ if(!HDstrncmp(name, "NCSAfami", (size_t)8) && HDstrcmp(file->cls->name, "family"))
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "family driver should be used")
+ if(!HDstrncmp(name, "NCSAmult", (size_t)8) && HDstrcmp(file->cls->name, "multi"))
+ HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "multi driver should be used")
+
+ /* Decode driver information */
+ if(H5FD__sb_decode(file, name, buf) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "unable to decode driver information")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5FD_sb_load() */
/*-------------------------------------------------------------------------