summaryrefslogtreecommitdiffstats
path: root/src/H5FD.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2015-05-15 02:02:54 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2015-05-15 02:02:54 (GMT)
commitcd1620238c73d616c8ec3c773337e7733b47d3f2 (patch)
tree574eef3ac674ab5ff6acb5d03bab1043343aece4 /src/H5FD.c
parent71bc00a0b50e803a7d4076c6f2249fa1c2c3670e (diff)
downloadhdf5-cd1620238c73d616c8ec3c773337e7733b47d3f2.zip
hdf5-cd1620238c73d616c8ec3c773337e7733b47d3f2.tar.gz
hdf5-cd1620238c73d616c8ec3c773337e7733b47d3f2.tar.bz2
[svn-r27077] Description:
Clean up H5FD interface, to align w/v3 metadata cache changes Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.* (jam) w/serial & parallel
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() */
/*-------------------------------------------------------------------------