summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5FDlog.c48
-rw-r--r--src/H5FDlog.h4
-rw-r--r--test/h5test.c13
3 files changed, 65 insertions, 0 deletions
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 27359b2..6a3d077 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -252,6 +252,53 @@ H5FD_log_init(void)
FUNC_LEAVE(H5FD_LOG_g);
}
+#ifdef H5_WANT_H5_V1_4_COMPAT
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_fapl_log
+ *
+ * Purpose: Modify the file access property list to use the H5FD_LOG
+ * driver defined in this source file. There are no driver
+ * specific properties.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Thursday, February 19, 1998
+ *
+ * Modifications:
+ * We copy the LOGFILE value into our own access properties.
+ *
+ * Raymond Lu, 2001-10-25
+ * Changed the file access list to the new generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_fapl_log(hid_t fapl_id, char *logfile, int verbosity)
+{
+ H5FD_log_fapl_t fa; /* File access property list information */
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=FAIL;
+
+ FUNC_ENTER(H5Pset_fapl_log, FAIL);
+ H5TRACE3("e","isIs",fapl_id,logfile,verbosity);
+
+ if(TRUE!=H5P_isa_class(fapl_id,H5P_FILE_ACCESS) || NULL == (plist = H5I_object(fapl_id)))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
+
+ fa.logfile=logfile;
+ if(verbosity>0) {
+ fa.flags=H5FD_LOG_LOC_IO|H5FD_LOG_FLAVOR;
+ if(verbosity>1)
+ fa.flags|=H5FD_LOG_FILE_IO;
+ } /* end if */
+ fa.buf_size=32*(1024*1024);
+ ret_value= H5P_set_driver(plist, H5FD_LOG, &fa);
+
+ FUNC_LEAVE(ret_value);
+}
+#else /* H5_WANT_H5_V1_4_COMPAT */
/*-------------------------------------------------------------------------
* Function: H5Pset_fapl_log
@@ -293,6 +340,7 @@ H5Pset_fapl_log(hid_t fapl_id, char *logfile, unsigned flags, size_t buf_size)
FUNC_LEAVE(ret_value);
}
+#endif /* H5_WANT_H5_V1_4_COMPAT */
/*-------------------------------------------------------------------------
diff --git a/src/H5FDlog.h b/src/H5FDlog.h
index 9319999..07f43ae 100644
--- a/src/H5FDlog.h
+++ b/src/H5FDlog.h
@@ -47,7 +47,11 @@ extern "C" {
#endif
__DLL__ hid_t H5FD_log_init(void);
+#ifdef H5_WANT_H5_V1_4_COMPAT
+__DLL__ herr_t H5Pset_fapl_log(hid_t fapl_id, char *logfile, int verbosity);
+#else /* H5_WANT_H5_V1_4_COMPAT */
__DLL__ herr_t H5Pset_fapl_log(hid_t fapl_id, char *logfile, unsigned flags, size_t buf_size);
+#endif /* H5_WANT_H5_V1_4_COMPAT */
#ifdef __cplusplus
}
diff --git a/test/h5test.c b/test/h5test.c
index 62fdc90..da4c02f 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -393,7 +393,11 @@ h5_fileaccess(void)
char s[1024];
hid_t fapl = -1;
hsize_t fam_size = 100*1024*1024; /*100 MB*/
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ long verbosity = 1;
+#else /* H5_WANT_H5_V1_4_COMPAT */
long log_flags = H5FD_LOG_LOC_IO;
+#endif /* H5_WANT_H5_V1_4_COMPAT */
H5FD_mem_t mt;
/* First use the environment variable, then the constant */
@@ -456,12 +460,21 @@ h5_fileaccess(void)
}
if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0) return -1;
} else if (!HDstrcmp(name, "log")) {
+#ifdef H5_WANT_H5_V1_4_COMPAT
+ /* Log file access */
+ if ((val = strtok(NULL, " \t\n\r")))
+ verbosity = strtol(val, NULL, 0);
+
+ if (H5Pset_fapl_log(fapl, NULL, (int)verbosity) < 0)
+ return -1;
+#else /* H5_WANT_H5_V1_4_COMPAT */
/* Log file access */
if ((val = HDstrtok(NULL, " \t\n\r")))
log_flags = HDstrtol(val, NULL, 0);
if (H5Pset_fapl_log(fapl, NULL, log_flags, 0) < 0)
return -1;
+#endif /* H5_WANT_H5_V1_4_COMPAT */
} else {
/* Unknown driver */
return -1;