summaryrefslogtreecommitdiffstats
path: root/test/cache_common.h
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2021-07-06 18:21:42 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2021-07-06 18:21:42 (GMT)
commit820695a78e3a277daea1bdcbb8ad54b8ee6650a5 (patch)
treefe7545305c0a77db3b9671e5a82fdffc4b2cc82e /test/cache_common.h
parent9f13ecfa2e93840d1cc45dbf0bfcf8b955814931 (diff)
parent18bbd3f0a7f14adeebf8f342ed242ff191f9b7c5 (diff)
downloadhdf5-hdf5-1_12_1.zip
hdf5-hdf5-1_12_1.tar.gz
hdf5-hdf5-1_12_1.tar.bz2
Merge remote-tracking branch 'origin/hdf5_1_12_1' into 1.12/master forhdf5-1_12_1
HDF5 1.12.1 release.
Diffstat (limited to 'test/cache_common.h')
-rw-r--r--test/cache_common.h64
1 files changed, 60 insertions, 4 deletions
diff --git a/test/cache_common.h b/test/cache_common.h
index f466f8e..126a8b3 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -17,8 +17,8 @@
* This file contains common #defines, type definitions, and
* externs for tests of the cache implemented in H5C.c
*/
-#ifndef _CACHE_COMMON_H
-#define _CACHE_COMMON_H
+#ifndef CACHE_COMMON_H
+#define CACHE_COMMON_H
#define H5C_FRIEND /*suppress error about including H5Cpkg */
#define H5F_FRIEND /*suppress error about including H5Fpkg */
@@ -116,6 +116,62 @@
#define MAX_ADDR (haddr_t)(NOTIFY_ALT_BASE_ADDR + (NOTIFY_ENTRY_SIZE * NUM_NOTIFY_ENTRIES))
#define ADDR_SPACE_SIZE (haddr_t)(MAX_ADDR - BASE_ADDR)
+/***********************************************************************
+ *
+ * Macro: H5C_FLUSH_CACHE
+ *
+ * Purpose: Wrap a call to H5C_flush_cache() in calls to
+ * H5C_set_slist_enabled() to setup and take down the slist.
+ *
+ * This is necessary, as H5C_flush_cache() needs the
+ * slist to be active. Further, since it is called
+ * repeatedly during file flush, it would be inefficient
+ * for it to setup the slist on entry, and take it down
+ * on exit.
+ *
+ * Note that the slist need not be empty if the flags
+ * indicate a partial flush (i.e.
+ * H5C__FLUSH_MARKED_ENTRIES_FLAG). Compute clear_slist
+ * and pass it into H5C_set_slist_enabled as appropriate.
+ *
+ * On error, set pass to FALSE, and set failure_mssg
+ * to the supplied error message.
+ *
+ * Return: N/A
+ *
+ * Programmer: John Mainzer
+ * 5/14/20
+ *
+ * Changes: None.
+ *
+ ***********************************************************************/
+
+#define H5C_FLUSH_CACHE(file, flags, fail_mssg) \
+ { \
+ hbool_t clear_slist; \
+ herr_t rslt; \
+ \
+ clear_slist = ((flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0); \
+ \
+ rslt = H5C_set_slist_enabled((file)->shared->cache, TRUE, FALSE); \
+ \
+ if (rslt >= 0) { \
+ \
+ rslt = H5C_flush_cache((file), (flags)); \
+ } \
+ \
+ if (rslt >= 0) { \
+ \
+ rslt = H5C_set_slist_enabled((file)->shared->cache, FALSE, clear_slist); \
+ } \
+ \
+ if (rslt < 0) { \
+ \
+ pass = FALSE; \
+ failure_mssg = (fail_mssg); \
+ } \
+ } /* H5C_FLUSH_CACHE */
+
#define MAX_PINS \
8 /* Maximum number of entries that can be \
* directly pinned by a single entry. \
@@ -638,4 +694,4 @@ H5TEST_DLL void dump_LRU(H5F_t * file_ptr);
}
#endif
-#endif /* _CACHE_COMMON_H */
+#endif /* CACHE_COMMON_H */