summaryrefslogtreecommitdiffstats
path: root/src/H5Fpkg.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Fpkg.h')
-rw-r--r--src/H5Fpkg.h69
1 files changed, 68 insertions, 1 deletions
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index c94c5af..706e41d 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -468,7 +468,17 @@ struct H5F_shared_t {
H5F_fs_state_t fs_state_md; /* State of the free space
* manager
*/
-
+ /* Log file for VFD SWMR */
+ FILE *vfd_swmr_log_file_ptr; /* File pointer for the
+ * log file.
+ */
+ hbool_t vfd_swmr_log_on; /* flag to indicate if
+ * the log file is
+ * created. */
+ H5_timer_t vfd_swmr_log_start_time; /* The starting time for
+ * calculating the time
+ * stamp of a log message.
+ */
/* Delayed free space release doubly linked list */
shadow_defree_queue_t shadow_defrees;
@@ -608,4 +618,61 @@ H5_DLL htri_t H5F__same_file_test(hid_t file_id1, hid_t file_id2);
H5_DLL herr_t H5F__reparse_file_lock_variable_test(void);
#endif /* H5F_TESTING */
+/* VFD SMWR LOG REPORTING MACROS */
+
+/* H5F_POST_VFD_SWMR_LOG_ENTRY is the macro that can help the developers debug VFD SWMR features.
+ * It calls an internal reporting function H5F_post_vfd_swmr_log_entry() that receives
+ * a log entry_type_code, which generates a log tag, and the message log_info, which
+ * the developers want to save into a log file.
+ *
+ * The macro H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(f, c, number_entry_production, m) is
+ * called by H5F_POST_VFD_SWMR_LOG_ENTRY when the HDF5 library is built with the
+ * production mode. Number_entry_production will control the number of entry tags that
+ * applications can receive. Currently this number is set to 1 and is subject to change
+ * when more tags are useful to be present to applications.
+ *
+ * The first argument of the macro is the HDF5 file pointer(H5F_t *).
+ * Its value needs to be checked to avoid a failure caused by "Low-Level File I/O "
+ * in the testhdf5 program, which involves the test of a non-existing HDF5 file.
+ */
+
+H5_DLL void H5F_post_vfd_swmr_log_entry(H5F_t *f, int entry_type_code, char *log_info);
+
+#define H5F_POST_VFD_SWMR_LOG_ENTRY_INTERNAL(fp, entry_type_code, log_info) \
+ do { \
+ if (fp != NULL) { \
+ if (fp->shared != NULL) { \
+ if (fp->shared->vfd_swmr_log_on == TRUE) { \
+ H5F_post_vfd_swmr_log_entry(fp, entry_type_code, log_info); \
+ } \
+ } \
+ } \
+ } while (0)
+
+#define H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(fp, entry_type_code, max_code, log_info) \
+ do { \
+ if (entry_type_code < max_code) { \
+ H5F_POST_VFD_SWMR_LOG_ENTRY_INTERNAL(fp, entry_type_code, log_info); \
+ } \
+ } while (0)
+
+/* Note: change H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(f, c, 1, m) on the following lines to
+ * H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(f, c, your_number_entry_production, m)
+ * as necessary.
+ */
+#ifndef NDEBUG
+#define H5F_POST_VFD_SWMR_LOG_ENTRY(f, c, m) H5F_POST_VFD_SWMR_LOG_ENTRY_INTERNAL(f, c, m)
+#else
+#define H5F_POST_VFD_SWMR_LOG_ENTRY(f, c, m) H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(f, c, 1, m)
+#endif
+
+/* Macros for VFD SWMR log entry code
+ * Note: this should be consistent with const char *H5Fvfd_swmr_log_tags[] declared at
+ * H5Fvfd_swmr.c .
+ */
+#define EOT_PROCESSING_TIME 0
+#define FILE_OPEN 1
+#define FILE_CLOSE 2
+#define EOT_TRIGGER_TIME 3
+#define EOT_META_FILE_INDEX 4
#endif /* H5Fpkg_H */