summaryrefslogtreecommitdiffstats
path: root/src/H5T.c
diff options
context:
space:
mode:
authorMike McGreevy <mamcgree@hdfgroup.org>2010-11-02 19:00:56 (GMT)
committerMike McGreevy <mamcgree@hdfgroup.org>2010-11-02 19:00:56 (GMT)
commita9ca88d1564351db7ca9371eeede12473b26a6a6 (patch)
treecaff74657cad616101e47989359faac2c53dbc26 /src/H5T.c
parent8e04644abdc73446e85bac72bcced171a927b1f0 (diff)
downloadhdf5-a9ca88d1564351db7ca9371eeede12473b26a6a6.zip
hdf5-a9ca88d1564351db7ca9371eeede12473b26a6a6.tar.gz
hdf5-a9ca88d1564351db7ca9371eeede12473b26a6a6.tar.bz2
[svn-r19714] Purpose:
Add API and supporting code to allow single object flushes and refreshes. Description: Added the following API calls: H5Dflush / H5Drefresh H5Gflush / H5Grefresh H5Tflush / H5Trefresh H5Oflush / H5Orefresh Each H5*flush API flushes the targeted object's metadata, while each H5*refresh evicts all metadata related to an object and reopens the object (re-loading needed metadata from disk). New files include src/H5Oflush.c, containing new internal H5O_* functions used by the above API calls. Also, a test file and test script template have been added, test/flushrefresh.c and test/testflushrefresh.sh.in. There is not (yet) a corresponding test script for windows as the current one isn't quite portable. Several H5C and H5AC-level functions have been added to support single object flushing and eviction, and the previously committed 'metadata tagging' code has been tweaked slightly to pull H5AC__* macros out of H5C.c and a few other fixes as necessary as well. Tag globality has been added to better encapsulate the meaning of global tags in the H5C layer of the code. Tested: h5committested.
Diffstat (limited to 'src/H5T.c')
-rw-r--r--src/H5T.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/H5T.c b/src/H5T.c
index 1f962f0..130921c 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -5273,3 +5273,71 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T_set_latest_version() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Tflush
+ *
+ * Purpose: Flushes all buffers associated with a named datatype to disk.
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ * Programmer: Mike McGreevy
+ * May 19, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Tflush(hid_t type_id)
+{
+ H5T_t *dt; /* Datatype for this operation */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Tflush, FAIL)
+ H5TRACE1("e", "i", type_id);
+
+ /* Check args */
+ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
+ /* Call private function to flush datatype object */
+ if (H5O_flush_metadata(&dt->oloc, H5AC_dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Tflush */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Trefresh
+ *
+ * Purpose: Refreshes all buffers associated with a named datatype.
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ * Programmer: Mike McGreevy
+ * July 21, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Trefresh(hid_t type_id)
+{
+ H5T_t * dt = NULL;
+ hid_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Trefresh, FAIL)
+ H5TRACE1("e", "i", type_id);
+
+ /* Check args */
+ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
+ /* Call private function to refresh datatype object */
+ if ((H5O_refresh_metadata(type_id, dt->oloc, H5AC_dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Trefresh */
+