diff options
77 files changed, 4142 insertions, 4727 deletions
@@ -489,7 +489,6 @@ ./src/H5Apublic.h ./src/H5AC.c ./src/H5ACdbg.c -./src/H5AClog.c ./src/H5ACmodule.h ./src/H5ACmpio.c ./src/H5ACpkg.h @@ -519,6 +518,9 @@ ./src/H5Cepoch.c ./src/H5Cimage.c ./src/H5Clog.c +./src/H5Clog.h +./src/H5Clog_json.c +./src/H5Clog_trace.c ./src/H5Cmodule.h ./src/H5Cmpio.c ./src/H5Cpkg.h diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 6d1e3ce..459346e 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -28,15 +28,6 @@ if (HDF5_STRICT_FORMAT_CHECKS) endif () MARK_AS_ADVANCED (HDF5_STRICT_FORMAT_CHECKS) -#----------------------------------------------------------------------------- -# Option for --enable-metadata-trace-file -#----------------------------------------------------------------------------- -option (HDF5_METADATA_TRACE_FILE "Enable metadata trace file collection" OFF) -if (HDF5_METADATA_TRACE_FILE) - set (${HDF_PREFIX}_METADATA_TRACE_FILE 1) -endif () -MARK_AS_ADVANCED (HDF5_METADATA_TRACE_FILE) - # ---------------------------------------------------------------------- # Decide whether the data accuracy has higher priority during data # conversions. If not, some hard conversions will still be prefered even diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 1d73bba..b079297 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -466,9 +466,6 @@ /* Define to enable internal memory allocation sanity checking. */ /* #cmakedefine H5_MEMORY_ALLOC_SANITY_CHECK @H5_MEMORY_ALLOC_SANITY_CHECK@ ** Define in CMakeLists.txt */ -/* Define if the metadata trace file code is to be compiled in */ -#cmakedefine H5_METADATA_TRACE_FILE @H5_METADATA_TRACE_FILE@ - /* Define if we can violate pointer alignment restrictions */ #cmakedefine H5_NO_ALIGNMENT_RESTRICTIONS @H5_NO_ALIGNMENT_RESTRICTIONS@ diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index 6a489e7..9a534df 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -79,7 +79,6 @@ Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@ API Tracing: @HDF5_ENABLE_TRACE@ Using memory checker: @HDF5_ENABLE_USING_MEMCHECKER@ Memory allocation sanity checks: @HDF5_MEMORY_ALLOC_SANITY_CHECK@ - Metadata trace file: @METADATATRACEFILE@ Function Stack Tracing: @HDF5_ENABLE_CODESTACK@ Strict File Format Checks: @HDF5_STRICT_FORMAT_CHECKS@ Optimization Instrumentation: @HDF5_Enable_Instrument@ diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 8181ff0..026131b 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -97,10 +97,10 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") if (NOT ERROR_APPEND) - # append error output to the stdout output file + # write back to original .err file file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") else () - # write back to original .err file + # append error output to the stdout output file file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") endif () endif () @@ -125,8 +125,11 @@ message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") -file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") +string (FIND TEST_STREAM "_pmi_alps" "${TEST_FIND_RESULT}") +if ("${TEST_FIND_RESULT}" GREATER "0") + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +endif () # if the output file needs Storage text removed if (TEST_MASK) diff --git a/configure.ac b/configure.ac index e88fc58..572fbe5 100644 --- a/configure.ac +++ b/configure.ac @@ -2290,40 +2290,6 @@ case "X-$CODESTACK" in esac ## ---------------------------------------------------------------------- -## Check if they would like the metadata trace file code compiled in -## -AC_MSG_CHECKING([whether metadata trace file code is enabled]) -AC_ARG_ENABLE([metadata-trace-file], - [AS_HELP_STRING([--enable-metadata-trace-file], - [Enable metadata trace file collection. - [default=no] - ])], - [METADATATRACEFILE=$enableval]) - -## Set the default level. -if test "X-$METADATATRACEFILE" = X- ; then - METADATATRACEFILE=no -fi - -## Allow this variable to be substituted in -## other files (src/libhdf5.settings.in, etc.) -AC_SUBST([METADATATRACEFILE]) - -case "X-$METADATATRACEFILE" in - X-yes) - AC_MSG_RESULT([yes]) - AC_DEFINE([METADATA_TRACE_FILE], [1], - [Define if the metadata trace file code is to be compiled in]) - ;; - X-no) - AC_MSG_RESULT([no]) - ;; - *) - AC_MSG_ERROR([Unrecognized value: $METADATATRACEFILE]) - ;; -esac - -## ---------------------------------------------------------------------- ## Enable tracing of the API ## AC_MSG_CHECKING([for API tracing]); diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c index 9d68290..20c22c3 100644 --- a/java/src/jni/h5fImp.c +++ b/java/src/jni/h5fImp.c @@ -177,7 +177,7 @@ Java_hdf_hdf5lib_H5__1H5Fget_1create_1plist { hid_t retVal = -1; - retVal = H5Fget_create_plist((hid_t)file_id ); + retVal = H5Fget_create_plist((hid_t)file_id); if (retVal < 0) h5libraryError(env); diff --git a/java/test/testfiles/JUnit-TestH5Edefault.txt b/java/test/testfiles/JUnit-TestH5Edefault.txt index 62497f9..b39dbef 100644 --- a/java/test/testfiles/JUnit-TestH5Edefault.txt +++ b/java/test/testfiles/JUnit-TestH5Edefault.txt @@ -36,25 +36,19 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Fopen(): unable to open file major: File accessibilty minor: Unable to open file - #001: (file name) line (number) in H5F__open(): unable to open file - major: File accessibilty - minor: Unable to open file - #002: (file name) line (number) in H5F_open(): unable to retrieve VFL class + #001: (file name) line (number) in H5F_open(): unable to retrieve VFL class major: File accessibilty minor: Can't get value - #003: (file name) line (number) in H5FD_get_class(): can't find object for ID + #002: (file name) line (number) in H5FD_get_class(): can't find object for ID major: Object atom minor: Unable to find atom information (already closed?) HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Fopen(): unable to open file major: File accessibilty minor: Unable to open file - #001: (file name) line (number) in H5F__open(): unable to open file - major: File accessibilty - minor: Unable to open file - #002: (file name) line (number) in H5F_open(): unable to retrieve VFL class + #001: (file name) line (number) in H5F_open(): unable to retrieve VFL class major: File accessibilty minor: Can't get value - #003: (file name) line (number) in H5FD_get_class(): can't find object for ID + #002: (file name) line (number) in H5FD_get_class(): can't find object for ID major: Object atom minor: Unable to find atom information (already closed?) diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index edd876a..f3a84e2 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -641,7 +641,6 @@ HDF5_GENERATE_HEADERS "Rebuild Generated Files" HDF5_BUILD_GENERATORS "Build Test Generators" OFF HDF5_JAVA_PACK_JRE "Package a JRE installer directory" OFF HDF5_MEMORY_ALLOC_SANITY_CHECK "Indicate that internal memory allocation sanity checks are enabled" OFF -HDF5_METADATA_TRACE_FILE "Enable metadata trace file collection" OFF HDF5_NO_PACKAGES "Do not include CPack Packaging" OFF HDF5_PACK_EXAMPLES "Package the HDF5 Library Examples Compressed File" OFF HDF5_PACK_MACOSX_FRAMEWORK "Package the HDF5 Library in a Frameworks" OFF diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 333f742..228ee43 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -147,7 +147,13 @@ New Features Parallel Library: ----------------- - - + - All MPI-1 API calls have been replaced with MPI-2 equivalents. + + This was done to better support OpenMPI, as default builds no longer + include MPI-1 support (as of OpenMPI 4.0). + + (DER - 2018/12/30, HDFFV-10566) + Fortran Library: ---------------- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a0acdab..47b4989 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,7 +39,6 @@ IDE_GENERATED_PROPERTIES ("H5A" "${H5A_HDRS}" "${H5A_SOURCES}" ) set (H5AC_SOURCES ${HDF5_SRC_DIR}/H5AC.c ${HDF5_SRC_DIR}/H5ACdbg.c - ${HDF5_SRC_DIR}/H5AClog.c ${HDF5_SRC_DIR}/H5ACmpio.c ${HDF5_SRC_DIR}/H5ACproxy_entry.c ) @@ -81,6 +80,8 @@ set (H5C_SOURCES ${HDF5_SRC_DIR}/H5Cepoch.c ${HDF5_SRC_DIR}/H5Cimage.c ${HDF5_SRC_DIR}/H5Clog.c + ${HDF5_SRC_DIR}/H5Clog_json.c + ${HDF5_SRC_DIR}/H5Clog_trace.c ${HDF5_SRC_DIR}/H5Cmpio.c ${HDF5_SRC_DIR}/H5Cprefetched.c ${HDF5_SRC_DIR}/H5Cquery.c @@ -747,6 +748,7 @@ set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5B2pkg.h ${HDF5_SRC_DIR}/H5B2private.h + ${HDF5_SRC_DIR}/H5Clog.h ${HDF5_SRC_DIR}/H5Cpkg.h ${HDF5_SRC_DIR}/H5Cprivate.h @@ -138,7 +138,7 @@ H5_init_library(void) if (mpi_initialized && !mpi_finalized) { int key_val; - if(MPI_SUCCESS != (mpi_code = MPI_Comm_create_keyval(MPI_NULL_COPY_FN, + if(MPI_SUCCESS != (mpi_code = MPI_Comm_create_keyval(MPI_COMM_NULL_COPY_FN, (MPI_Comm_delete_attr_function *)H5_mpi_delete_cb, &key_val, NULL))) HMPI_GOTO_ERROR(FAIL, "MPI_Comm_create_keyval failed", mpi_code) @@ -1133,7 +1133,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Call private attribute rename routine */ - if(H5A__rename(&loc, old_name, new_name) < 0) + if(H5O__attr_rename(loc.oloc, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } /* end if */ @@ -1379,7 +1379,7 @@ H5Adelete(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Delete the attribute from the location */ - if(H5A__delete(&loc, name) < 0) + if(H5O__attr_remove(loc.oloc, name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1563,7 +1563,7 @@ H5Aexists(hid_t obj_id, const char *attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Check if the attribute exists */ - if((ret_value = H5A__exists(&loc, attr_name)) < 0) + if((ret_value = H5O__attr_exists(loc.oloc, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: @@ -30,22 +30,24 @@ /****************/ #include "H5ACmodule.h" /* This source code file is part of the H5AC module */ -#define H5F_FRIEND /* Suppress error about including H5Fpkg */ +#define H5C_FRIEND /* Suppress error about including H5Cpkg */ +#define H5F_FRIEND /* Suppress error about including H5Fpkg */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACpkg.h" /* Metadata cache */ -#include "H5Cprivate.h" /* Cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* Files */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Pprivate.h" /* Property lists */ -#include "H5SLprivate.h" /* Skip Lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACpkg.h" /* Metadata cache */ +#include "H5Clog.h" /* Cache logging */ +#include "H5Cpkg.h" /* Cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* Files */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5SLprivate.h" /* Skip Lists */ /****************/ @@ -128,7 +130,7 @@ static const H5AC_class_t *const H5AC_class_s[] = { H5AC_DRVRINFO, /* (26) driver info block (supplements superblock) */ H5AC_EPOCH_MARKER, /* (27) epoch marker - always internal to cache */ H5AC_PROXY_ENTRY, /* (28) cache entry proxy */ - H5AC_PREFETCHED_ENTRY /* (29) prefetched entry - always internal to cache */ + H5AC_PREFETCHED_ENTRY /* (29) prefetched entry - always internal to cache */ }; @@ -178,13 +180,16 @@ H5AC__init_package(void) #ifdef H5_HAVE_PARALLEL /* check whether to enable strict collective function calling - sanity checks using MPI barriers */ + * sanity checks using MPI barriers + */ { const char *s; /* String for environment variables */ s = HDgetenv("H5_COLL_API_SANITY_CHECK"); - if(s && HDisdigit(*s)) - H5_coll_api_sanity_check_g = (hbool_t)HDstrtol(s, NULL, 0); + if(s && HDisdigit(*s)) { + long env_val = HDstrtol(s, NULL, 0); + H5_coll_api_sanity_check_g = (0 == env_val) ? FALSE : TRUE; + } } #endif /* H5_HAVE_PARALLEL */ @@ -403,15 +408,13 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "H5C_set_prefix() failed") #endif /* H5_HAVE_PARALLEL */ - /* Turn on metadata cache logging, if being used */ - if(H5F_USE_MDC_LOGGING(f)) { - if(H5C_set_up_logging(f->shared->cache, H5F_MDC_LOG_LOCATION(f), H5F_START_MDC_LOG_ON_ACCESS(f)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINIT, FAIL, "mdc logging setup failed") - - /* Write the log header regardless of current logging status */ - if(H5AC__write_create_cache_log_msg(f->shared->cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - } /* end if */ + /* Turn on metadata cache logging, if being used + * This will be JSON until we create a special API call. Trace output + * is generated when logging is controlled by the struct. + */ + if(H5F_USE_MDC_LOGGING(f)) + if(H5C_log_set_up(f->shared->cache, H5F_MDC_LOG_LOCATION(f), H5C_LOG_STYLE_JSON, H5F_START_MDC_LOG_ON_ACCESS(f)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging setup failed") /* Set the cache parameters */ if(H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0) @@ -431,6 +434,11 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "auto resize configuration failed") done: + /* If currently logging, generate a message */ + if(f->shared->cache->log_info->logging) + if(H5C_log_write_create_cache_msg(f->shared->cache, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + #ifdef H5_HAVE_PARALLEL /* if there is a failure, try to tidy up the auxiliary structure */ if(ret_value < 0) { @@ -469,6 +477,8 @@ done: herr_t H5AC_dest(H5F_t *f) { + hbool_t log_enabled; /* TRUE if logging was set up */ + hbool_t curr_logging; /* TRUE if currently logging */ #ifdef H5_HAVE_PARALLEL H5AC_aux_t * aux_ptr = NULL; #endif /* H5_HAVE_PARALLEL */ @@ -486,18 +496,16 @@ H5AC_dest(H5F_t *f) H5AC_stats(f); #endif /* H5AC_DUMP_STATS_ON_CLOSE */ -#if H5AC__TRACE_FILE_ENABLED - if(H5AC__close_trace_file(f->shared->cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__close_trace_file() failed") -#endif /* H5AC__TRACE_FILE_ENABLED */ - - if(H5F_USE_MDC_LOGGING(f)) { - /* Write the log footer regardless of current logging status */ - if(H5AC__write_destroy_cache_log_msg(f->shared->cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - if(H5C_tear_down_logging(f->shared->cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "mdc logging tear-down failed") - } /* end if */ + /* Check if log messages are being emitted */ + if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to get logging status") + if(log_enabled && curr_logging) + if(H5C_log_write_destroy_cache_msg(f->shared->cache) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + /* Tear down logging */ + if(log_enabled) + if(H5C_log_tear_down(f->shared->cache) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging tear-down failed") #ifdef H5_HAVE_PARALLEL /* destroying the cache, so clear all collective entries */ @@ -565,8 +573,6 @@ done: herr_t H5AC_evict(H5F_t *f) { - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -576,10 +582,6 @@ H5AC_evict(H5F_t *f) HDassert(f->shared); HDassert(f->shared->cache); - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status") - /* Evict all entries in the cache except the pinned superblock entry */ if(H5C_evict(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't evict cache") @@ -587,9 +589,9 @@ H5AC_evict(H5F_t *f) done: /* If currently logging, generate a message */ - if(curr_logging) - if(H5AC__write_evict_cache_log_msg(f->shared->cache, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message") + if(f->shared->cache->log_info->logging) + if(H5C_log_write_evict_cache_msg(f->shared->cache, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_evict() */ @@ -613,12 +615,6 @@ herr_t H5AC_expunge_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, unsigned flags) { -#if H5AC__TRACE_FILE_ENABLED - char trace[128] = ""; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -631,36 +627,14 @@ H5AC_expunge_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, HDassert(type->serialize); HDassert(H5F_addr_defined(addr)); - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status") - -#if H5AC__TRACE_FILE_ENABLED -{ - H5AC_t * cache_ptr = f->shared->cache; - - /* For the expunge entry call, only the addr, and type id are really - * necessary in the trace file. Write the return value to catch occult - * errors. - */ - if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr))) - sprintf(trace, "%s 0x%lx %d", FUNC, (unsigned long)addr, (int)(type->id)); -} -#endif /* H5AC__TRACE_FILE_ENABLED */ - if(H5C_expunge_entry(f, type, addr, flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "H5C_expunge_entry() failed") done: -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr != NULL) - HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); -#endif /* H5AC__TRACE_FILE_ENABLED */ - /* If currently logging, generate a message */ - if(curr_logging) - if(H5AC__write_expunge_entry_log_msg(f->shared->cache, addr, type->id, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message") + if(f->shared->cache->log_info->logging) + if(H5C_log_write_expunge_entry_msg(f->shared->cache, addr, type->id, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_expunge_entry() */ @@ -689,12 +663,6 @@ done: herr_t H5AC_flush(H5F_t *f) { -#if H5AC__TRACE_FILE_ENABLED - char trace[128] = ""; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -704,18 +672,6 @@ H5AC_flush(H5F_t *f) HDassert(f->shared); HDassert(f->shared->cache); - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status") - -#if H5AC__TRACE_FILE_ENABLED - /* For the flush, only the flags are really necessary in the trace file. - * Write the result to catch occult errors. - */ - if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr))) - sprintf(trace, "%s", FUNC); -#endif /* H5AC__TRACE_FILE_ENABLED */ - #ifdef H5_HAVE_PARALLEL /* flushing the cache, so clear all collective entries */ if(H5C_clear_coll_entries(f->shared->cache, FALSE) < 0) @@ -732,15 +688,10 @@ H5AC_flush(H5F_t *f) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache") done: -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr != NULL) - HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); -#endif /* H5AC__TRACE_FILE_ENABLED */ - /* If currently logging, generate a message */ - if(curr_logging) - if(H5AC__write_flush_cache_log_msg(f->shared->cache, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message") + if(f->shared->cache->log_info->logging) + if(H5C_log_write_flush_cache_msg(f->shared->cache, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_flush() */ @@ -873,13 +824,6 @@ herr_t H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned int flags) { -#if H5AC__TRACE_FILE_ENABLED - char trace[128] = ""; - size_t trace_entry_size = 0; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -893,26 +837,9 @@ H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, HDassert(H5F_addr_defined(addr)); HDassert(thing); - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status") - /* Check for invalid access request */ if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file") - -#if H5AC__TRACE_FILE_ENABLED - /* For the insert, only the addr, size, type id and flags are really - * necessary in the trace file. Write the result to catch occult - * errors. - * - * Note that some data is not available right now -- put what we can - * in the trace buffer now, and fill in the rest at the end. - */ - if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr))) - sprintf(trace, "%s 0x%lx %d 0x%x", FUNC, (unsigned long)addr, type->id, - flags); -#endif /* H5AC__TRACE_FILE_ENABLED */ + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file") #if H5AC_DO_TAGGING_SANITY_CHECKS if(!H5C_get_ignore_tags(f->shared->cache) && H5AC__verify_tag(type) < 0) @@ -923,12 +850,6 @@ H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, if(H5C_insert_entry(f, type, addr, thing, flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C_insert_entry() failed") -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr != NULL) - /* make note of the entry size */ - trace_entry_size = ((H5C_cache_entry_t *)thing)->size; -#endif /* H5AC__TRACE_FILE_ENABLED */ - #ifdef H5_HAVE_PARALLEL { H5AC_aux_t *aux_ptr; @@ -947,14 +868,10 @@ H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, #endif /* H5_HAVE_PARALLEL */ done: -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr != NULL) - HDfprintf(trace_file_ptr, "%s %d %d\n", trace, (int)trace_entry_size, (int)ret_value); -#endif /* H5AC__TRACE_FILE_ENABLED */ /* If currently logging, generate a message */ - if(curr_logging) - if(H5AC__write_insert_entry_log_msg(f->shared->cache, addr, type->id, flags, ((H5C_cache_entry_t *)thing)->size, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message") + if(f->shared->cache->log_info->logging) + if(H5C_log_write_insert_entry_msg(f->shared->cache, addr, type->id, flags, ((H5C_cache_entry_t *)thing)->size, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_insert_entry() */ @@ -1011,12 +928,6 @@ done: herr_t H5AC_mark_entry_dirty(void *thing) { -#if H5AC__TRACE_FILE_ENABLED - char trace[128] = ""; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */ H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1030,19 +941,6 @@ H5AC_mark_entry_dirty(void *thing) entry_ptr = (H5AC_info_t *)thing; cache_ptr = entry_ptr->cache_ptr; -#if H5AC__TRACE_FILE_ENABLED - /* For the mark pinned or protected entry dirty call, only the addr - * is really necessary in the trace file. Write the result to catch - * occult errors. - */ - if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing))) - sprintf(trace, "%s 0x%lx", FUNC, (unsigned long)(entry_ptr->addr)); -#endif /* H5AC__TRACE_FILE_ENABLED */ - - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status") - #ifdef H5_HAVE_PARALLEL { H5AC_aux_t *aux_ptr; @@ -1059,15 +957,10 @@ H5AC_mark_entry_dirty(void *thing) HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't mark pinned or protected entry dirty") done: -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr) - HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); -#endif /* H5AC__TRACE_FILE_ENABLED */ - /* If currently logging, generate a message */ - if(curr_logging) - if(H5AC__write_mark_dirty_entry_log_msg(cache_ptr, entry_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message") + if(cache_ptr->log_info->logging) + if(H5C_log_write_mark_entry_dirty_msg(cache_ptr, entry_ptr, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_mark_entry_dirty() */ @@ -1076,7 +969,7 @@ done: /*------------------------------------------------------------------------- * Function: H5AC_mark_entry_clean * - * Purpose: Mark a pinned entry as dirty. The target + * Purpose: Mark a pinned entry as clean. The target * entry MUST be pinned. * * Return: Non-negative on success/Negative on failure @@ -1089,12 +982,6 @@ done: herr_t H5AC_mark_entry_clean(void *thing) { -#if H5AC__TRACE_FILE_ENABLED - char trace[128] = ""; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */ H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1104,23 +991,9 @@ H5AC_mark_entry_clean(void *thing) /* Sanity check */ HDassert(thing); -#if H5AC__TRACE_FILE_ENABLED - /* For the mark pinned or protected entry clean call, only the addr - * is really necessary in the trace file. Write the result to catch - * occult errors. - */ - if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing))) - sprintf(trace, "%s 0x%lx", FUNC, - (unsigned long)(((H5C_cache_entry_t *)thing)->addr)); -#endif /* H5AC__TRACE_FILE_ENABLED */ - entry_ptr = (H5AC_info_t *)thing; cache_ptr = entry_ptr->cache_ptr; - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status") - #ifdef H5_HAVE_PARALLEL { H5AC_aux_t *aux_ptr; @@ -1137,15 +1010,10 @@ H5AC_mark_entry_clean(void *thing) HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "can't mark pinned or protected entry clean") done: -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr) - HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); -#endif /* H5AC__TRACE_FILE_ENABLED */ - /* If currently logging, generate a message */ - if(curr_logging) - if(H5AC__write_mark_clean_entry_log_msg(cache_ptr, entry_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message") + if(cache_ptr->log_info->logging) + if(H5C_log_write_mark_entry_clean_msg(cache_ptr, entry_ptr, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_mark_entry_clean() */ @@ -1167,12 +1035,6 @@ done: herr_t H5AC_mark_entry_unserialized(void *thing) { -#if H5AC__TRACE_FILE_ENABLED - char trace[128] = ""; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */ H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1186,32 +1048,14 @@ H5AC_mark_entry_unserialized(void *thing) entry_ptr = (H5AC_info_t *)thing; cache_ptr = entry_ptr->cache_ptr; -#if H5AC__TRACE_FILE_ENABLED - /* For the mark entry unserialized call, only the addr - * is really necessary in the trace file. Write the result to catch - * occult errors. - */ - if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing))) - sprintf(trace, "%s 0x%lx", FUNC, (unsigned long)(entry_ptr->addr)); -#endif /* H5AC__TRACE_FILE_ENABLED */ - - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to get logging status") - if(H5C_mark_entry_unserialized(thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKUNSERIALIZED, FAIL, "can't mark entry unserialized") done: -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr) - HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); -#endif /* H5AC__TRACE_FILE_ENABLED */ - /* If currently logging, generate a message */ - if(curr_logging) - if(H5AC__write_mark_unserialized_entry_log_msg(cache_ptr, entry_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message") + if(cache_ptr->log_info->logging) + if(H5C_log_write_mark_unserialized_entry_msg(cache_ptr, entry_ptr, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_mark_entry_unserialized() */ @@ -1233,12 +1077,6 @@ done: herr_t H5AC_mark_entry_serialized(void *thing) { -#if H5AC__TRACE_FILE_ENABLED - char trace[128] = ""; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */ H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1248,36 +1086,17 @@ H5AC_mark_entry_serialized(void *thing) /* Sanity check */ HDassert(thing); -#if H5AC__TRACE_FILE_ENABLED - /* For the mark entry serializedn call, only the addr - * is really necessary in the trace file. Write the result to catch - * occult errors. - */ - if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing))) - sprintf(trace, "%s 0x%lx", FUNC, - (unsigned long)(((H5C_cache_entry_t *)thing)->addr)); -#endif /* H5AC__TRACE_FILE_ENABLED */ - entry_ptr = (H5AC_info_t *)thing; cache_ptr = entry_ptr->cache_ptr; - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to get logging status") - if(H5C_mark_entry_serialized(thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKSERIALIZED, FAIL, "can't mark entry serialized") done: -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr) - HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); -#endif /* H5AC__TRACE_FILE_ENABLED */ - /* If currently logging, generate a message */ - if(curr_logging) - if(H5AC__write_mark_serialized_entry_log_msg(cache_ptr, entry_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message") + if(cache_ptr->log_info->logging) + if(H5C_log_write_mark_serialized_entry_msg(cache_ptr, entry_ptr, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_mark_entry_serialized() */ @@ -1300,15 +1119,9 @@ done: herr_t H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_addr) { -#if H5AC__TRACE_FILE_ENABLED - char trace[128] = ""; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ #ifdef H5_HAVE_PARALLEL H5AC_aux_t *aux_ptr; #endif /* H5_HAVE_PARALLEL */ - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1321,20 +1134,6 @@ H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t ne HDassert(H5F_addr_defined(new_addr)); HDassert(H5F_addr_ne(old_addr, new_addr)); - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status") - -#if H5AC__TRACE_FILE_ENABLED - /* For the move call, only the old addr and new addr are really - * necessary in the trace file. Include the type id so we don't have to - * look it up. Also write the result to catch occult errors. - */ - if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr))) - sprintf(trace, "%s 0x%lx 0x%lx %d", FUNC, (unsigned long)old_addr, - (unsigned long)new_addr, (int)(type->id)); -#endif /* H5AC__TRACE_FILE_ENABLED */ - #ifdef H5_HAVE_PARALLEL /* Log moving the entry */ if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache))) @@ -1353,15 +1152,10 @@ H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t ne #endif /* H5_HAVE_PARALLEL */ done: -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr != NULL) - HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); -#endif /* H5AC__TRACE_FILE_ENABLED */ - /* If currently logging, generate a message */ - if(curr_logging) - if(H5AC__write_move_entry_log_msg(f->shared->cache, old_addr, new_addr, type->id, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message") + if(f->shared->cache->log_info->logging) + if(H5C_log_write_move_entry_msg(f->shared->cache, old_addr, new_addr, type->id, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_move_entry() */ @@ -1383,12 +1177,6 @@ done: herr_t H5AC_pin_protected_entry(void *thing) { -#if H5AC__TRACE_FILE_ENABLED - char trace[128] = ""; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */ H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1398,37 +1186,19 @@ H5AC_pin_protected_entry(void *thing) /* Sanity check */ HDassert(thing); -#if H5AC__TRACE_FILE_ENABLED - /* For the pin protected entry call, only the addr is really necessary - * in the trace file. Also write the result to catch occult errors. - */ - if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing))) - sprintf(trace, "%s 0x%lx", FUNC, - (unsigned long)(((H5C_cache_entry_t *)thing)->addr)); -#endif /* H5AC__TRACE_FILE_ENABLED */ - entry_ptr = (H5AC_info_t *)thing; cache_ptr = entry_ptr->cache_ptr; HDassert(cache_ptr); - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status") - /* Pin entry */ if(H5C_pin_protected_entry(thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "can't pin entry") done: -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr) - HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); -#endif /* H5AC__TRACE_FILE_ENABLED */ - /* If currently logging, generate a message */ - if(curr_logging) - if(H5AC__write_pin_entry_log_msg(cache_ptr, entry_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message") + if(cache_ptr->log_info->logging) + if(H5C_log_write_pin_entry_msg(cache_ptr, entry_ptr, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_pin_protected_entry() */ @@ -1488,12 +1258,6 @@ done: herr_t H5AC_create_flush_dependency(void * parent_thing, void * child_thing) { -#if H5AC__TRACE_FILE_ENABLED - char trace[128] = ""; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */ H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1504,35 +1268,19 @@ H5AC_create_flush_dependency(void * parent_thing, void * child_thing) HDassert(parent_thing); HDassert(child_thing); -#if H5AC__TRACE_FILE_ENABLED - if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(parent_thing))) - sprintf(trace, "%s %lx %lx", FUNC, - (unsigned long)(((H5C_cache_entry_t *)parent_thing)->addr), - (unsigned long)(((H5C_cache_entry_t *)child_thing)->addr)); -#endif /* H5AC__TRACE_FILE_ENABLED */ - entry_ptr = (H5AC_info_t *)parent_thing; cache_ptr = entry_ptr->cache_ptr; HDassert(cache_ptr); - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status") - /* Create the flush dependency */ if(H5C_create_flush_dependency(parent_thing, child_thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "H5C_create_flush_dependency() failed") done: -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr != NULL) - HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); -#endif /* H5AC__TRACE_FILE_ENABLED */ - /* If currently logging, generate a message */ - if(curr_logging) - if(H5AC__write_create_fd_log_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message") + if(cache_ptr->log_info->logging) + if(H5C_log_write_create_fd_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_create_flush_dependency() */ @@ -1566,14 +1314,7 @@ void * H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata, unsigned flags) { -#if H5AC__TRACE_FILE_ENABLED - char trace[128] = ""; - size_t trace_entry_size = 0; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ void * thing = NULL; /* Pointer to native data structure for entry */ - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1586,10 +1327,6 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata, HDassert(type->serialize); HDassert(H5F_addr_defined(addr)); - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "unable to get logging status") - /* Check for unexpected flags -- H5C__FLUSH_COLLECTIVELY_FLAG * only permitted in the parallel case. */ @@ -1606,16 +1343,6 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata, if((0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) && (0 == (flags & H5C__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "no write intent on file") -#if H5AC__TRACE_FILE_ENABLED - /* For the protect call, only the addr, size, type id, and flags are - * necessary in the trace file. Also indicate whether the call was - * successful to catch occult errors. - */ - if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr))) - sprintf(trace, "%s 0x%lx %d 0x%x", FUNC, (unsigned long)addr, - (int)(type->id), flags); -#endif /* H5AC__TRACE_FILE_ENABLED */ - #if H5AC_DO_TAGGING_SANITY_CHECKS if(!H5C_get_ignore_tags(f->shared->cache) && H5AC__verify_tag(type) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, NULL, "Bad tag value") @@ -1624,28 +1351,18 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata, if(NULL == (thing = H5C_protect(f, type, addr, udata, flags))) HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C_protect() failed") -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr != NULL) - /* Make note of the entry size */ - trace_entry_size = ((H5C_cache_entry_t *)thing)->size; -#endif /* H5AC__TRACE_FILE_ENABLED */ - /* Set return value */ ret_value = thing; done: -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr != NULL) - HDfprintf(trace_file_ptr, "%s %d %d\n", trace, (int)trace_entry_size, (int)(ret_value != NULL)); -#endif /* H5AC__TRACE_FILE_ENABLED */ - /* If currently logging, generate a message */ - if(curr_logging) { + { herr_t fake_ret_value = (NULL == ret_value) ? FAIL : SUCCEED; - if(H5AC__write_protect_entry_log_msg(f->shared->cache, (H5AC_info_t *)thing, flags, fake_ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, NULL, "unable to emit log message") - } /* end if */ + if(f->shared->cache->log_info->logging) + if(H5C_log_write_protect_entry_msg(f->shared->cache, (H5AC_info_t *)thing, type->id, flags, fake_ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, NULL, "unable to emit log message") + } FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_protect() */ @@ -1666,12 +1383,6 @@ done: herr_t H5AC_resize_entry(void *thing, size_t new_size) { -#if H5AC__TRACE_FILE_ENABLED - char trace[128] = ""; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */ H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1681,25 +1392,10 @@ H5AC_resize_entry(void *thing, size_t new_size) /* Sanity check */ HDassert(thing); -#if H5AC__TRACE_FILE_ENABLED - /* For the resize pinned entry call, only the addr, and new_size are - * really necessary in the trace file. Write the result to catch - * occult errors. - */ - if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing))) - sprintf(trace, "%s 0x%lx %d", FUNC, - (unsigned long)(((H5C_cache_entry_t *)thing)->addr), - (int)new_size); -#endif /* H5AC__TRACE_FILE_ENABLED */ - entry_ptr = (H5AC_info_t *)thing; cache_ptr = entry_ptr->cache_ptr; HDassert(cache_ptr); - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status") - /* Resize the entry */ if(H5C_resize_entry(thing, new_size) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "can't resize entry") @@ -1716,15 +1412,10 @@ H5AC_resize_entry(void *thing, size_t new_size) #endif /* H5_HAVE_PARALLEL */ done: -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr) - HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); -#endif /* H5AC__TRACE_FILE_ENABLED */ - /* If currently logging, generate a message */ - if(curr_logging) - if(H5AC__write_resize_entry_log_msg(cache_ptr, entry_ptr, new_size, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message") + if(cache_ptr->log_info->logging) + if(H5C_log_write_resize_entry_msg(cache_ptr, entry_ptr, new_size, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_resize_entry() */ @@ -1746,12 +1437,6 @@ done: herr_t H5AC_unpin_entry(void *thing) { -#if H5AC__TRACE_FILE_ENABLED - char trace[128] = ""; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */ H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1761,37 +1446,19 @@ H5AC_unpin_entry(void *thing) /* Sanity check */ HDassert(thing); -#if H5AC__TRACE_FILE_ENABLED - /* For the unpin entry call, only the addr is really necessary - * in the trace file. Also write the result to catch occult errors. - */ - if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing))) - sprintf(trace, "%s 0x%lx", FUNC, - (unsigned long)(((H5C_cache_entry_t *)thing)->addr)); -#endif /* H5AC__TRACE_FILE_ENABLED */ - entry_ptr = (H5AC_info_t *)thing; cache_ptr = entry_ptr->cache_ptr; HDassert(cache_ptr); - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status") - /* Unpin the entry */ if(H5C_unpin_entry(thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry") done: -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr) - HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); -#endif /* H5AC__TRACE_FILE_ENABLED */ - /* If currently logging, generate a message */ - if(curr_logging) - if(H5AC__write_unpin_entry_log_msg(cache_ptr, entry_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message") + if(cache_ptr->log_info->logging) + if(H5C_log_write_unpin_entry_msg(cache_ptr, entry_ptr, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_unpin_entry() */ @@ -1812,12 +1479,6 @@ done: herr_t H5AC_destroy_flush_dependency(void * parent_thing, void * child_thing) { -#if H5AC__TRACE_FILE_ENABLED - char trace[128] = ""; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */ H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1828,35 +1489,19 @@ H5AC_destroy_flush_dependency(void * parent_thing, void * child_thing) HDassert(parent_thing); HDassert(child_thing); -#if H5AC__TRACE_FILE_ENABLED - if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(parent_thing))) - sprintf(trace, "%s %llx %llx", FUNC, - (unsigned long long)(((H5C_cache_entry_t *)parent_thing)->addr), - (unsigned long long)(((H5C_cache_entry_t *)child_thing)->addr)); -#endif /* H5AC__TRACE_FILE_ENABLED */ - entry_ptr = (H5AC_info_t *)parent_thing; cache_ptr = entry_ptr->cache_ptr; HDassert(cache_ptr); - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status") - /* Destroy the flush dependency */ if(H5C_destroy_flush_dependency(parent_thing, child_thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "H5C_destroy_flush_dependency() failed") done: -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr != NULL) - HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); -#endif /* H5AC__TRACE_FILE_ENABLED */ - /* If currently logging, generate a message */ - if(curr_logging) - if(H5AC__write_destroy_fd_log_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message") + if(cache_ptr->log_info->logging) + if(H5C_log_write_destroy_fd_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_destroy_flush_dependency() */ @@ -1904,17 +1549,11 @@ herr_t H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, unsigned flags) { -#if H5AC__TRACE_FILE_ENABLED - char trace[128] = ""; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ hbool_t dirtied; hbool_t deleted; #ifdef H5_HAVE_PARALLEL H5AC_aux_t * aux_ptr = NULL; #endif /* H5_HAVE_PARALLEL */ - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1931,19 +1570,6 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, HDassert( ((H5AC_info_t *)thing)->addr == addr ); HDassert( ((H5AC_info_t *)thing)->type == type ); - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status") - -#if H5AC__TRACE_FILE_ENABLED - /* For the unprotect call, only the addr, type id, flags, and possible - * new size are really necessary in the trace file. Write the return - * value to catch occult errors. - */ - if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr))) - sprintf(trace, "%s 0x%lx %d", FUNC, (unsigned long)addr, (int)(type->id)); -#endif /* H5AC__TRACE_FILE_ENABLED */ - dirtied = (hbool_t)(((flags & H5AC__DIRTIED_FLAG) == H5AC__DIRTIED_FLAG) || (((H5AC_info_t *)thing)->dirtied)); deleted = (hbool_t)((flags & H5C__DELETED_FLAG) == H5C__DELETED_FLAG); @@ -1984,15 +1610,10 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, #endif /* H5_HAVE_PARALLEL */ done: -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr != NULL) - HDfprintf(trace_file_ptr, "%s 0x%x %d\n", trace, (unsigned)flags, (int)ret_value); -#endif /* H5AC__TRACE_FILE_ENABLED */ - /* If currently logging, generate a message */ - if(curr_logging) - if(H5AC__write_unprotect_entry_log_msg(f->shared->cache, (H5AC_info_t *)thing, type->id, flags, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message") + if(f->shared->cache->log_info->logging) + if(H5C_log_write_unprotect_entry_msg(f->shared->cache, (H5AC_info_t *)thing, type->id, flags, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_unprotect() */ @@ -2191,12 +1812,6 @@ done: herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr) { -#if H5AC__TRACE_FILE_ENABLED - H5AC_cache_config_t trace_config = H5AC__DEFAULT_CACHE_CONFIG; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ H5C_auto_size_ctl_t internal_config; herr_t ret_value = SUCCEED; /* Return value */ @@ -2205,18 +1820,6 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config /* Sanity checks */ HDassert(cache_ptr); - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status") - -#if H5AC__TRACE_FILE_ENABLED - /* Make note of the new configuration. Don't look up the trace file - * pointer, as that may change before we use it. - */ - if(config_ptr != NULL) - trace_config = *config_ptr; -#endif /* H5AC__TRACE_FILE_ENABLED */ - if(cache_ptr == NULL) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad cache_ptr on entry") #ifdef H5_HAVE_PARALLEL @@ -2233,23 +1836,25 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config if(H5AC_validate_config(config_ptr) != SUCCEED) HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache configuration") - if(config_ptr->open_trace_file) { - FILE * file_ptr; - - if(NULL == (file_ptr = H5C_get_trace_file_ptr(cache_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_trace_file_ptr() failed") - - if((!(config_ptr->close_trace_file)) && (file_ptr != NULL)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Trace file already open") - } /* end if */ - - /* Close & reopen trace file, if requested */ + /* If the cache config struct is being used to control logging, perform + * the open/close operations. Note that this is the only place where the + * struct-based control opens and closes the log files so we also have + * to write start/stop messages. + */ + /* close */ if(config_ptr->close_trace_file) - if(H5AC__close_trace_file(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__close_trace_file() failed") - if(config_ptr->open_trace_file) - if(H5AC__open_trace_file(cache_ptr, config_ptr->trace_file_name) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "H5AC__open_trace_file() failed") + if(H5C_log_tear_down((H5C_t *)cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging tear-down failed") + + /* open */ + if(config_ptr->open_trace_file) { + /* Turn on metadata cache logging. + * This will be trace output until we create a special API call. JSON + * output is generated when logging is controlled by the H5P calls. + */ + if(H5C_log_set_up((H5C_t *)cache_ptr, config_ptr->trace_file_name, H5C_LOG_STYLE_TRACE, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging setup failed") + } /* Convert external configuration to internal representation */ if(H5AC__ext_config_2_int_config(config_ptr, &internal_config) < 0) @@ -2275,52 +1880,10 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config #endif /* H5_HAVE_PARALLEL */ done: -#if H5AC__TRACE_FILE_ENABLED - /* For the set cache auto resize config call, only the contents - * of the config is necessary in the trace file. Write the return - * value to catch occult errors. - */ - if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr))) - HDfprintf(trace_file_ptr, - "%s %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %f %f %d %d %d %f %f %d %d %d %d %f %zu %d %d\n", - "H5AC_set_cache_auto_resize_config", - trace_config.version, - (int)(trace_config.rpt_fcn_enabled), - (int)(trace_config.open_trace_file), - (int)(trace_config.close_trace_file), - trace_config.trace_file_name, - (int)(trace_config.evictions_enabled), - (int)(trace_config.set_initial_size), - (int)(trace_config.initial_size), - trace_config.min_clean_fraction, - (int)(trace_config.max_size), - (int)(trace_config.min_size), - trace_config.epoch_length, - (int)(trace_config.incr_mode), - trace_config.lower_hr_threshold, - trace_config.increment, - (int)(trace_config.flash_incr_mode), - trace_config.flash_multiple, - trace_config.flash_threshold, - (int)(trace_config.apply_max_increment), - (int)(trace_config.max_increment), - (int)(trace_config.decr_mode), - trace_config.upper_hr_threshold, - trace_config.decrement, - (int)(trace_config.apply_max_decrement), - (int)(trace_config.max_decrement), - trace_config.epochs_before_eviction, - (int)(trace_config.apply_empty_reserve), - trace_config.empty_reserve, - trace_config.dirty_bytes_threshold, - trace_config.metadata_write_strategy, - (int)ret_value); -#endif /* H5AC__TRACE_FILE_ENABLED */ - /* If currently logging, generate a message */ - if(curr_logging) - if(H5AC__write_set_cache_config_log_msg(cache_ptr, config_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message") + if(cache_ptr->log_info->logging) + if(H5C_log_write_set_cache_config_msg(cache_ptr, config_ptr, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_set_cache_auto_resize_config() */ @@ -2366,12 +1929,12 @@ H5AC_validate_config(H5AC_cache_config_t *config_ptr) if(config_ptr->open_trace_file) { size_t name_len; - /* Can't really test the trace_file_name field without trying to - * open the file, so we will content ourselves with a couple of - * sanity checks on the length of the file name. - */ - name_len = HDstrlen(config_ptr->trace_file_name); - if(name_len == 0) + /* Can't really test the trace_file_name field without trying to + * open the file, so we will content ourselves with a couple of + * sanity checks on the length of the file name. + */ + name_len = HDstrlen(config_ptr->trace_file_name); + if(name_len == 0) HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name is empty") else if(name_len > H5AC__MAX_TRACE_FILE_NAME_LEN) HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name too long") @@ -3061,12 +2624,6 @@ H5AC_remove_entry(void *_entry) { H5AC_info_t *entry = (H5AC_info_t *)_entry; /* Entry to remove */ H5C_t *cache = NULL; /* Pointer to the entry's associated metadata cache */ -#if H5AC__TRACE_FILE_ENABLED - char trace[128] = ""; - FILE * trace_file_ptr = NULL; -#endif /* H5AC__TRACE_FILE_ENABLED */ - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3076,32 +2633,15 @@ H5AC_remove_entry(void *_entry) cache = entry->cache_ptr; HDassert(cache); -#if H5AC__TRACE_FILE_ENABLED - /* For the remove entry call, only the addr is really necessary - * in the trace file. Also write the result to catch occult errors. - */ - if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(entry))) - sprintf(trace, "%s 0x%lx", FUNC, (unsigned long)(entry->addr)); -#endif /* H5AC__TRACE_FILE_ENABLED */ - - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(cache, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to get logging status") - /* Remove the entry from the cache*/ if(H5C_remove_entry(entry) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry") done: -#if H5AC__TRACE_FILE_ENABLED - if(trace_file_ptr) - HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value); -#endif /* H5AC__TRACE_FILE_ENABLED */ - /* If currently logging, generate a message */ - if(curr_logging) - if(H5AC__write_remove_entry_log_msg(cache, entry, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message") + if(cache->log_info->logging) + if(H5C_log_write_remove_entry_msg(cache, entry, ret_value) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_remove_entry() */ diff --git a/src/H5ACdbg.c b/src/H5ACdbg.c index c6d71a8..1235206 100644 --- a/src/H5ACdbg.c +++ b/src/H5ACdbg.c @@ -136,121 +136,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5AC__close_trace_file() - * - * Purpose: If a trace file is open, stop logging calls to the cache, - * and close the file. - * - * Note that the function does nothing if there is no trace - * file. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 6/2/06 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__close_trace_file(H5AC_t *cache_ptr) -{ - FILE * trace_file_ptr; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - if(cache_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "NULL cache_ptr on entry.") - - if(NULL == (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_trace_file_ptr() failed.") - - if(trace_file_ptr != NULL) { - if(H5C_set_trace_file_ptr(cache_ptr, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_trace_file_ptr() failed.") - - if(HDfclose(trace_file_ptr) != 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close metadata cache trace file") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__close_trace_file() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__open_trace_file() - * - * Purpose: Open a trace file, and start logging calls to the cache. - * - * This logging is done at the H5C level, and will only take - * place if H5C_TRACE_FILE_ENABLED (defined in H5Cprivate.h) - * is TRUE. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 6/1/06 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__open_trace_file(H5AC_t *cache_ptr, const char *trace_file_name) -{ - char file_name[H5AC__MAX_TRACE_FILE_NAME_LEN + H5C__PREFIX_LEN + 2]; - FILE * file_ptr; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - HDassert(cache_ptr); - - /* Check args */ - if(cache_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "cache_ptr NULL on entry.") - if(trace_file_name == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "NULL trace_file_name on entry.") - if(HDstrlen(trace_file_name) > H5AC__MAX_TRACE_FILE_NAME_LEN) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "trace file name too long.") - if(NULL != (file_ptr = H5C_get_trace_file_ptr(cache_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_FILEOPEN, FAIL, "trace file already open.") - -#ifdef H5_HAVE_PARALLEL -{ - H5AC_aux_t * aux_ptr; - - aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - if(aux_ptr == NULL) - sprintf(file_name, "%s", trace_file_name); - else { - if(aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad aux_ptr->magic.") - - sprintf(file_name, "%s.%d", trace_file_name, aux_ptr->mpi_rank); - } /* end else */ - - if(HDstrlen(file_name) > H5AC__MAX_TRACE_FILE_NAME_LEN + H5C__PREFIX_LEN + 1) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "cooked trace file name too long.") -} -#else /* H5_HAVE_PARALLEL */ - HDsnprintf(file_name, (size_t)(H5AC__MAX_TRACE_FILE_NAME_LEN + H5C__PREFIX_LEN + 1), - "%s", trace_file_name); -#endif /* H5_HAVE_PARALLEL */ - - if((file_ptr = HDfopen(file_name, "w")) == NULL) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "trace file open failed.") - - HDfprintf(file_ptr, "### HDF5 metadata cache trace file version 1 ###\n"); - - if(H5C_set_trace_file_ptr(cache_ptr, file_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_trace_file_ptr() failed.") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__open_trace_file() */ - - -/*------------------------------------------------------------------------- * * Function: H5AC_get_entry_ptr_from_addr() * diff --git a/src/H5AClog.c b/src/H5AClog.c deleted file mode 100644 index 51a2050..0000000 --- a/src/H5AClog.c +++ /dev/null @@ -1,1105 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * 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. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/*------------------------------------------------------------------------- - * - * Created: H5AClog.c - * - * Purpose: Functions for metadata cache logging in JSON format - * - *------------------------------------------------------------------------- - */ - -/****************/ -/* Module Setup */ -/****************/ -#include "H5ACmodule.h" /* This source code file is part of the H5AC module */ - -/***********/ -/* Headers */ -/***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACpkg.h" /* Metadata cache */ -#include "H5Cprivate.h" /* Cache */ -#include "H5Eprivate.h" /* Error handling */ - - -/****************/ -/* Local Macros */ -/****************/ - -#define MSG_SIZE 128 - - -/******************/ -/* Local Typedefs */ -/******************/ - - -/********************/ -/* Package Typedefs */ -/********************/ - - -/********************/ -/* Local Prototypes */ -/********************/ - - -/*********************/ -/* Package Variables */ -/*********************/ - - -/*****************************/ -/* Library Private Variables */ -/*****************************/ - - -/*******************/ -/* Local Variables */ -/*******************/ - - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_create_cache_log_msg - * - * Purpose: Write a log message for cache creation. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_create_cache_log_msg(H5AC_t *cache) -{ - char msg[MSG_SIZE]; - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(cache, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status") - - /* Since we're about to override the current logging flag, - * check the "log enabled" flag to see if we didn't get here - * by mistake. - */ - if(!log_enabled) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "attempt to write opening log message when logging is disabled") - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\n\ -\"create_time\":%lld,\n\ -\"messages\":\n\ -[\n\ -" - , (long long)HDtime(NULL)); - - /* Have to temporarily enable logging, if it isn't currently */ - if(!curr_logging) - if(H5C_start_logging(cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to start mdc logging") - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - - /* Stop logging, if it wasn't started originally */ - if(!curr_logging) - if(H5C_stop_logging(cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_create_cache_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_destroy_cache_log_msg - * - * Purpose: Write a log message for cache destruction. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_destroy_cache_log_msg(H5AC_t *cache) -{ - char msg[MSG_SIZE]; - hbool_t log_enabled; /* TRUE if logging was set up */ - hbool_t curr_logging; /* TRUE if currently logging */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - - /* Check if log messages are being emitted */ - if(H5C_get_logging_status(cache, &log_enabled, &curr_logging) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status") - - /* Since we're about to override the current logging flag, - * check the "log enabled" flag to see if we didn't get here - * by mistake. - */ - if(!log_enabled) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "attempt to write closing log message when logging is disabled") - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -],\n\ -\"close_time\":%lld,\n\ -}\n\ -" - , (long long)HDtime(NULL)); - - /* Have to temporarily enable logging, if it isn't currently */ - if(!curr_logging) - if(H5C_start_logging(cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to start mdc logging") - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - - /* Stop logging, if it wasn't started originally */ - if(!curr_logging) - if(H5C_stop_logging(cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_destroy_cache_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_evict_cache_log_msg - * - * Purpose: Write a log message for eviction of cache entries. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_evict_cache_log_msg(const H5AC_t *cache, - herr_t fxn_ret_value) -{ - char msg[MSG_SIZE]; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\ -\"timestamp\":%lld,\ -\"action\":\"evict\",\ -\"returned\":%d\ -},\n\ -" - , (long long)HDtime(NULL), (int)fxn_ret_value); - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_evict_cache_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_expunge_entry_log_msg - * - * Purpose: Write a log message for expunge of cache entries. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_expunge_entry_log_msg(const H5AC_t *cache, - haddr_t address, - int type_id, - herr_t fxn_ret_value) -{ - char msg[MSG_SIZE]; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\ -\"timestamp\":%lld,\ -\"action\":\"expunge\",\ -\"address\":0x%lx,\ -\"type_id\":%d,\ -\"returned\":%d\ -},\n\ -" - , (long long)HDtime(NULL), (unsigned long)address, (int)type_id, (int)fxn_ret_value); - - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_expunge_entry_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_flush_cache_log_msg - * - * Purpose: Write a log message for cache flushes. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_flush_cache_log_msg(const H5AC_t *cache, - herr_t fxn_ret_value) -{ - char msg[MSG_SIZE]; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\ -\"timestamp\":%lld,\ -\"action\":\"flush\",\ -\"returned\":%d\ -},\n\ -" - , (long long)HDtime(NULL), (int)fxn_ret_value); - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_flush_cache_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_insert_entry_log_msg - * - * Purpose: Write a log message for insertion of cache entries. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_insert_entry_log_msg(const H5AC_t *cache, - haddr_t address, - int type_id, - unsigned flags, - size_t size, - herr_t fxn_ret_value) -{ - char msg[MSG_SIZE]; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\ -\"timestamp\":%lld,\ -\"action\":\"insert\",\ -\"address\":0x%lx,\ -\"flags\":0x%x,\ -\"type_id\":%d,\ -\"size\":%d,\ -\"returned\":%d\ -},\n\ -" - , (long long)HDtime(NULL), (unsigned long)address, flags, type_id, - (int)size, (int)fxn_ret_value); - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_insert_entry_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_mark_dirty_entry_log_msg - * - * Purpose: Write a log message for marking cache entries as dirty. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_mark_dirty_entry_log_msg(const H5AC_t *cache, - const H5AC_info_t *entry, - herr_t fxn_ret_value) -{ - char msg[MSG_SIZE]; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - HDassert(entry); - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\ -\"timestamp\":%lld,\ -\"action\":\"dirty\",\ -\"address\":0x%lx,\ -\"returned\":%d\ -},\n\ -" - , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_mark_dirty_entry_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_mark_clean_entry_log_msg - * - * Purpose: Write a log message for marking cache entries as clean. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Saturday, July 23, 2016 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_mark_clean_entry_log_msg(const H5AC_t *cache, const H5AC_info_t *entry, - herr_t fxn_ret_value) -{ - char msg[MSG_SIZE]; /* Log message buffer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - HDassert(entry); - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\ -\"timestamp\":%lld,\ -\"action\":\"clean\",\ -\"address\":0x%lx,\ -\"returned\":%d\ -},\n\ -" - , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_mark_clean_entry_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_mark_unserialized_entry_log_msg - * - * Purpose: Write a log message for marking cache entries as unserialized. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Thursday, December 22, 2016 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_mark_unserialized_entry_log_msg(const H5AC_t *cache, - const H5AC_info_t *entry, - herr_t fxn_ret_value) -{ - char msg[MSG_SIZE]; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - HDassert(entry); - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\ -\"timestamp\":%lld,\ -\"action\":\"unserialized\",\ -\"address\":0x%lx,\ -\"returned\":%d\ -},\n\ -" - , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_mark_unserialized_entry_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_mark_serialize_entry_log_msg - * - * Purpose: Write a log message for marking cache entries as serialize. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Thursday, December 22, 2016 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_mark_serialized_entry_log_msg(const H5AC_t *cache, const H5AC_info_t *entry, - herr_t fxn_ret_value) -{ - char msg[MSG_SIZE]; /* Log message buffer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - HDassert(entry); - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\ -\"timestamp\":%lld,\ -\"action\":\"serialized\",\ -\"address\":0x%lx,\ -\"returned\":%d\ -},\n\ -" - , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_mark_serialized_entry_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_move_entry_log_msg - * - * Purpose: Write a log message for moving a cache entry. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_move_entry_log_msg(const H5AC_t *cache, - haddr_t old_addr, - haddr_t new_addr, - int type_id, - herr_t fxn_ret_value) -{ - char msg[MSG_SIZE]; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\ -\"timestamp\":%lld,\ -\"action\":\"move\",\ -\"old_address\":0x%lx,\ -\"new_address\":0x%lx,\ -\"type_id\":%d,\ -\"returned\":%d\ -},\n\ -" - , (long long)HDtime(NULL), (unsigned long)old_addr, - (unsigned long)new_addr, type_id, (int)fxn_ret_value); - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_move_entry_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_pin_entry_log_msg - * - * Purpose: Write a log message for pinning a cache entry. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_pin_entry_log_msg(const H5AC_t *cache, - const H5AC_info_t *entry, - herr_t fxn_ret_value) -{ - char msg[MSG_SIZE]; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - HDassert(entry); - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\ -\"timestamp\":%lld,\ -\"action\":\"pin\",\ -\"address\":0x%lx,\ -\"returned\":%d\ -},\n\ -" - , (long long)HDtime(NULL), (unsigned long)entry->addr, - (int)fxn_ret_value); - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_pin_entry_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_create_fd_log_msg - * - * Purpose: Write a log message for creating a flush dependency between - * two cache entries. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_create_fd_log_msg(const H5AC_t *cache, - const H5AC_info_t *parent, - const H5AC_info_t *child, - herr_t fxn_ret_value) -{ - char msg[MSG_SIZE]; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - HDassert(parent); - HDassert(child); - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\ -\"timestamp\":%lld,\ -\"action\":\"create_fd\",\ -\"parent_addr\":0x%lx,\ -\"child_addr\":0x%lx,\ -\"returned\":%d\ -},\n\ -" - , (long long)HDtime(NULL), (unsigned long)parent->addr, - (unsigned long)child->addr, (int)fxn_ret_value); - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_create_fd_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_protect_entry_log_msg - * - * Purpose: Write a log message for protecting a cache entry. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_protect_entry_log_msg(const H5AC_t *cache, - const H5AC_info_t *entry, - unsigned flags, - herr_t fxn_ret_value) -{ - char msg[MSG_SIZE]; - char rw_s[16]; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - HDassert(entry); - - if(H5AC__READ_ONLY_FLAG == flags) - HDstrcpy(rw_s, "READ"); - else - HDstrcpy(rw_s, "WRITE"); - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\ -\"timestamp\":%lld,\ -\"action\":\"protect\",\ -\"address\":0x%lx,\ -\"readwrite\":\"%s\",\ -\"size\":%d,\ -\"returned\":%d\ -},\n\ -" - , (long long)HDtime(NULL), (unsigned long)entry->addr, - rw_s, (int)entry->size, (int)fxn_ret_value); - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_protect_entry_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_resize_entry_log_msg - * - * Purpose: Write a log message for resizing a cache entry. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_resize_entry_log_msg(const H5AC_t *cache, - const H5AC_info_t *entry, - size_t new_size, - herr_t fxn_ret_value) -{ - char msg[MSG_SIZE]; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - HDassert(entry); - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\ -\"timestamp\":%lld,\ -\"action\":\"resize\",\ -\"address\":0x%lx,\ -\"new_size\":%d,\ -\"returned\":%d\ -},\n\ -" - , (long long)HDtime(NULL), (unsigned long)entry->addr, - (int)new_size, (int)fxn_ret_value); - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_resize_entry_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_unpin_entry_log_msg - * - * Purpose: Write a log message for unpinning a cache entry. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_unpin_entry_log_msg(const H5AC_t *cache, - const H5AC_info_t *entry, - herr_t fxn_ret_value) -{ - char msg[MSG_SIZE]; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - HDassert(entry); - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\ -\"timestamp\":%lld,\ -\"action\":\"unpin\",\ -\"address\":0x%lx,\ -\"returned\":%d\ -},\n\ -" - , (long long)HDtime(NULL), (unsigned long)entry->addr, - (int)fxn_ret_value); - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_unpin_entry_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_destroy_fd_log_msg - * - * Purpose: Write a log message for destroying a flush dependency - * between two cache entries. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_destroy_fd_log_msg(const H5AC_t *cache, - const H5AC_info_t *parent, - const H5AC_info_t *child, - herr_t fxn_ret_value) -{ - char msg[MSG_SIZE]; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - HDassert(parent); - HDassert(child); - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\ -\"timestamp\":%lld,\ -\"action\":\"destroy_fd\",\ -\"parent_addr\":0x%lx,\ -\"child_addr\":0x%lx,\ -\"returned\":%d\ -},\n\ -" - , (long long)HDtime(NULL), (unsigned long)parent->addr, - (unsigned long)child->addr, (int)fxn_ret_value); - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_destroy_fd_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_unprotect_entry_log_msg - * - * Purpose: Write a log message for unprotecting a cache entry. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_unprotect_entry_log_msg(const H5AC_t *cache, - const H5AC_info_t *entry, - int type_id, - unsigned flags, - herr_t fxn_ret_value) -{ - char msg[MSG_SIZE]; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - HDassert(entry); - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\ -\"timestamp\":%lld,\ -\"action\":\"unprotect\",\ -\"address\":0x%lx,\ -\"id\":%d,\ -\"flags\":%x,\ -\"returned\":%d\ -},\n\ -" - , (long long)HDtime(NULL), (unsigned long)entry->addr, - type_id, flags, (int)fxn_ret_value); - - HDsnprintf(msg, MSG_SIZE, " "); - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_unprotect_entry_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_set_cache_config_log_msg - * - * Purpose: Write a log message for setting the cache configuration. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_set_cache_config_log_msg(const H5AC_t *cache, - const H5AC_cache_config_t *config, - herr_t fxn_ret_value) -{ - char msg[MSG_SIZE]; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - HDassert(config); - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\ -\"timestamp\":%lld,\ -\"action\":\"set_config\",\ -\"returned\":%d\ -},\n\ -" - , (long long)HDtime(NULL), (int)fxn_ret_value); - - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_set_cache_config_log_msg() */ - - -/*------------------------------------------------------------------------- - * Function: H5AC__write_remove_entry_log_msg - * - * Purpose: Write a log message for removing a cache entry. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * September 17, 2016 - * - *------------------------------------------------------------------------- - */ -herr_t -H5AC__write_remove_entry_log_msg(const H5AC_t *cache, const H5AC_info_t *entry, - herr_t fxn_ret_value) -{ - char msg[MSG_SIZE]; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(cache); - HDassert(entry); - - /* Create the log message string */ - HDsnprintf(msg, MSG_SIZE, -"\ -{\ -\"timestamp\":%lld,\ -\"action\":\"remove\",\ -\"address\":0x%lx,\ -\"returned\":%d\ -},\n\ -" - , (long long)HDtime(NULL), (unsigned long)entry->addr, - (int)fxn_ret_value); - - /* Write the log message to the file */ - if(H5C_write_log_message(cache, msg) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__write_remove_entry_log_msg() */ - diff --git a/src/H5ACpkg.h b/src/H5ACpkg.h index 9bf84bf..8997382 100644 --- a/src/H5ACpkg.h +++ b/src/H5ACpkg.h @@ -433,74 +433,5 @@ H5_DLL herr_t H5AC__set_write_done_callback(H5C_t * cache_ptr, void (* write_done)(void)); #endif /* H5_HAVE_PARALLEL */ -/* Trace file routines */ -H5_DLL herr_t H5AC__close_trace_file(H5AC_t *cache_ptr); -H5_DLL herr_t H5AC__open_trace_file(H5AC_t *cache_ptr, const char *trace_file_name); - -/* Cache logging routines */ -H5_DLL herr_t H5AC__write_create_cache_log_msg(H5AC_t *cache); -H5_DLL herr_t H5AC__write_destroy_cache_log_msg(H5AC_t *cache); -H5_DLL herr_t H5AC__write_evict_cache_log_msg(const H5AC_t *cache, - herr_t fxn_ret_value); -H5_DLL herr_t H5AC__write_expunge_entry_log_msg(const H5AC_t *cache, - haddr_t address, - int type_id, - herr_t fxn_ret_value); -H5_DLL herr_t H5AC__write_flush_cache_log_msg(const H5AC_t *cache, - herr_t fxn_ret_value); -H5_DLL herr_t H5AC__write_insert_entry_log_msg(const H5AC_t *cache, - haddr_t address, - int type_id, - unsigned flags, - size_t size, - herr_t fxn_ret_value); -H5_DLL herr_t H5AC__write_mark_dirty_entry_log_msg(const H5AC_t *cache, - const H5AC_info_t *entry, - herr_t fxn_ret_value); -H5_DLL herr_t H5AC__write_mark_clean_entry_log_msg(const H5AC_t *cache, - const H5AC_info_t *entry, herr_t fxn_ret_value); -H5_DLL herr_t H5AC__write_mark_unserialized_entry_log_msg(const H5AC_t *cache, - const H5AC_info_t *entry, herr_t fxn_ret_value); -H5_DLL herr_t H5AC__write_mark_serialized_entry_log_msg(const H5AC_t *cache, - const H5AC_info_t *entry, herr_t fxn_ret_value); -H5_DLL herr_t H5AC__write_move_entry_log_msg(const H5AC_t *cache, - haddr_t old_addr, - haddr_t new_addr, - int type_id, - herr_t fxn_ret_value); -H5_DLL herr_t H5AC__write_pin_entry_log_msg(const H5AC_t *cache, - const H5AC_info_t *entry, - herr_t fxn_ret_value); -H5_DLL herr_t H5AC__write_create_fd_log_msg(const H5AC_t *cache, - const H5AC_info_t *parent, - const H5AC_info_t *child, - herr_t fxn_ret_value); -H5_DLL herr_t H5AC__write_protect_entry_log_msg(const H5AC_t *cache, - const H5AC_info_t *entry, - unsigned flags, - herr_t fxn_ret_value); -H5_DLL herr_t H5AC__write_resize_entry_log_msg(const H5AC_t *cache, - const H5AC_info_t *entry, - size_t new_size, - herr_t fxn_ret_value); -H5_DLL herr_t H5AC__write_unpin_entry_log_msg(const H5AC_t *cache, - const H5AC_info_t *entry, - herr_t fxn_ret_value); -H5_DLL herr_t H5AC__write_destroy_fd_log_msg(const H5AC_t *cache, - const H5AC_info_t *parent, - const H5AC_info_t *child, - herr_t fxn_ret_value); -H5_DLL herr_t H5AC__write_unprotect_entry_log_msg(const H5AC_t *cache, - const H5AC_info_t *entry, - int type_id, - unsigned flags, - herr_t fxn_ret_value); -H5_DLL herr_t H5AC__write_set_cache_config_log_msg(const H5AC_t *cache, - const H5AC_cache_config_t *config, - herr_t fxn_ret_value); -H5_DLL herr_t H5AC__write_remove_entry_log_msg(const H5AC_t *cache, - const H5AC_info_t *entry, - herr_t fxn_ret_value); - #endif /* _H5ACpkg_H */ diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 99cc0e9..7d2d4ad 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -35,12 +35,6 @@ #include "H5Pprivate.h" /* Property lists */ #include "H5SLprivate.h" /* Skip lists */ -#ifdef H5_METADATA_TRACE_FILE -#define H5AC__TRACE_FILE_ENABLED 1 -#else /* H5_METADATA_TRACE_FILE */ -#define H5AC__TRACE_FILE_ENABLED 0 -#endif /* H5_METADATA_TRACE_FILE */ - /* Global metadata tag values */ #define H5AC__INVALID_TAG (haddr_t)0 #define H5AC__IGNORE_TAG (haddr_t)1 diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 9b592b0..99c1c0c 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -340,7 +340,7 @@ H5Aget_num_attrs(hid_t loc_id) } /*lint !e788 All appropriate cases are covered */ /* Look up the # of attributes for the object */ - if((ret_value = H5A__get_num_attrs(loc)) < 0) + if((ret_value = H5O__attr_count(loc)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object") done: diff --git a/src/H5Aint.c b/src/H5Aint.c index 55560c7..807c67e 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -87,8 +87,6 @@ typedef struct { /* Local Prototypes */ /********************/ -static H5A_t *H5A__create_common(const H5G_loc_t *loc, const char *name, - const H5T_t *type, const H5S_t *space, hid_t acpl_id); static herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr); static herr_t H5A__compact_build_table_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, unsigned *oh_flags_ptr, void *_udata/*in,out*/); @@ -127,7 +125,7 @@ H5FL_SEQ_DEFINE(H5A_t_ptr); /*------------------------------------------------------------------------- - * Function: H5A__create_common + * Function: H5A__create * * Purpose: This is the guts of creating an attribute. * @@ -138,8 +136,8 @@ H5FL_SEQ_DEFINE(H5A_t_ptr); * *------------------------------------------------------------------------- */ -static H5A_t * -H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type, +H5A_t * +H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, const H5S_t *space, hid_t acpl_id) { H5A_t *attr = NULL; /* Attribute created */ @@ -148,7 +146,7 @@ H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type, htri_t exists; /* Whether attribute exists */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_STATIC_TAG(loc->oloc->addr) + FUNC_ENTER_PACKAGE_TAG(loc->oloc->addr) /* Check args */ HDassert(loc); @@ -285,45 +283,6 @@ done: HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* H5A__create_common() */ - - -/*------------------------------------------------------------------------- - * Function: H5A__create - * - * Purpose: Entry point for creating attribute on an object - * - * Note: This routine is needed so that there's a non-API routine for - * creating attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Attribute structure on success, NULL on Failure. - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -H5A_t * -H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type, - const H5S_t *space, hid_t acpl_id) -{ - H5A_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check args */ - HDassert(loc); - HDassert(name); - HDassert(type); - HDassert(space); - - /* Go do the real work for attaching the attribute to the object */ - if(NULL == (ret_value = H5A__create_common(loc, name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, NULL, "unable to create attribute") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) } /* H5A__create() */ @@ -350,7 +309,7 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -368,8 +327,8 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr loc_found = TRUE; /* Go do the real work for attaching the attribute to the object */ - if(NULL == (attr = H5A__create_common(&obj_loc, attr_name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") + if(NULL == (attr = H5A__create(&obj_loc, attr_name, type, space, acpl_id))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") /* Set return value */ ret_value = attr; @@ -384,7 +343,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__create_by_name() */ @@ -450,10 +409,6 @@ done: * * Purpose: Open an attribute in an object header * - * Note: This routine is needed so that there's a non-API routine for - * creating attributes that can set up VOL / SWMR info - * (which need a DXPL). - * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol @@ -467,7 +422,7 @@ H5A__open(const H5G_loc_t *loc, const char *attr_name) H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -490,7 +445,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open() */ @@ -517,7 +472,7 @@ H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -554,7 +509,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_by_idx() */ @@ -580,7 +535,7 @@ H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_n H5A_t *attr = NULL; /* Attribute from object header */ H5A_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* check args */ HDassert(loc); @@ -618,7 +573,7 @@ done: if(attr && H5A__close(attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_by_name() */ @@ -652,7 +607,7 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf) size_t buf_size; /* desired buffer size */ herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE_VOL_TAG(attr->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr) HDassert(attr); HDassert(mem_type); @@ -721,7 +676,7 @@ done: if(bkg_buf) bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5A__read() */ @@ -756,7 +711,7 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf) size_t buf_size; /* desired buffer size */ herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE_VOL_TAG(attr->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr) HDassert(attr); HDassert(mem_type); @@ -835,7 +790,7 @@ done: if(bkg_buf) bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5A__write() */ @@ -939,7 +894,7 @@ H5A__get_type(H5A_t *attr) H5T_t *dt = NULL; hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(attr); @@ -970,7 +925,7 @@ done: if(H5I_INVALID_HID == ret_value && dt && (H5T_close(dt) < 0)) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__get_type() */ @@ -1192,7 +1147,7 @@ H5A__close_cb(H5A_t *attr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(attr); @@ -1203,7 +1158,7 @@ H5A__close_cb(H5A_t *attr) HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "problem closing attribute") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__close_cb() */ @@ -1355,39 +1310,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__exists - * - * Purpose: Private version of H5Aexists - * - * Note: This routine is needed so that there's a non-API routine for - * detecting attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: TRUE/FALSE - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -htri_t -H5A__exists(const H5G_loc_t *loc, const char *name) -{ - htri_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check if the attribute exists */ - if((ret_value = H5O__attr_exists(loc->oloc, name)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__exists() */ - - -/*------------------------------------------------------------------------- * Function: H5A__exists_by_name * * Purpose: Private version of H5Aexists_by_name @@ -1409,7 +1331,7 @@ H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name) hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1430,7 +1352,7 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__exists_by_name() */ @@ -2599,39 +2521,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5A__rename - * - * Purpose: Private version of H5Arename - * - * Note: This routine is needed so that there's a non-API routine for - * renaming attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5A__rename(const H5G_loc_t *loc, const char *old_name, const char *new_name) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Call object header attribute rename routine */ - if(H5O__attr_rename(loc->oloc, old_name, new_name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__rename() */ - - -/*------------------------------------------------------------------------- * Function: H5A__rename_by_name * * Purpose: Private version of H5Arename_by_name @@ -2654,7 +2543,7 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -2675,44 +2564,9 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__rename_by_name() */ -#ifndef H5_NO_DEPRECATED_SYMBOLS - -/*------------------------------------------------------------------------- - * Function: H5A__get_num_attrs - * - * Purpose: Private version of deprecated H5Aget_num_attrs - * - * Note: This routine is needed so that there's a non-API routine for - * querying the attribute count that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -int -H5A__get_num_attrs(const H5O_loc_t *loc) -{ - int ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Look up the # of attributes for the object */ - if((ret_value = H5O__attr_count(loc)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__get_num_attrs() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - /*------------------------------------------------------------------------- * Function: H5A__iterate_common @@ -2755,10 +2609,6 @@ H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, * * Purpose: Private version of H5Aiterate2 * - * Note: This routine is needed so that there's a non-API routine for - * iterating over attributes that can set up VOL / SWMR info - * (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -2774,7 +2624,7 @@ H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, H5A_attr_iter_op_t attr_op; /* Attribute operator */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Build attribute operator info */ attr_op.op_type = H5A_ATTR_OP_APP2; @@ -2785,7 +2635,7 @@ H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__iterate() */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -2811,7 +2661,7 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, hsize_t idx; /* Index of attribute to start iterating at */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Build attribute operator info */ attr_op.op_type = H5A_ATTR_OP_APP; @@ -2829,7 +2679,7 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, *attr_num = (unsigned)idx; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__iterate_old() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -2839,10 +2689,6 @@ done: * * Purpose: Private version of H5Aiterate_by_name * - * Note: This routine is needed so that there's a non-API routine for - * iterating over attributes that can set up VOL / SWMR info - * (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -2863,7 +2709,7 @@ H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_ H5A_attr_iter_op_t attr_op; /* Attribute operator */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -2896,44 +2742,11 @@ done: else if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__iterate_by_name() */ /*------------------------------------------------------------------------- - * Function: H5A__delete - * - * Purpose: Private version of H5Adelete - * - * Note: This routine is needed so that there's a non-API routine for - * deleting attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 6, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5A__delete(const H5G_loc_t *loc, const char *name) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Call object header attribute delete attribute routine */ - if(H5O__attr_remove(loc->oloc, name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5A__delete() */ - - -/*------------------------------------------------------------------------- * Function: H5A__delete_by_name * * Purpose: Private version of H5Adelete_by_name @@ -2955,7 +2768,7 @@ H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -2976,7 +2789,7 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__delete_by_name() */ @@ -3003,7 +2816,7 @@ H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_ty hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -3024,6 +2837,6 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5A__delete_by_idx() */ diff --git a/src/H5Apkg.h b/src/H5Apkg.h index af16b55..0bb6d8f 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -200,13 +200,8 @@ H5_DLL herr_t H5A__close(H5A_t *attr); H5_DLL herr_t H5A__close_cb(H5A_t *attr); H5_DLL htri_t H5A__get_ainfo(H5F_t *f, H5O_t *oh, H5O_ainfo_t *ainfo); H5_DLL herr_t H5A__set_version(const H5F_t *f, H5A_t *attr); -H5_DLL herr_t H5A__rename(const H5G_loc_t *loc, const char *old_name, - const char *new_name); H5_DLL herr_t H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_name, const char *new_attr_name); -#ifndef H5_NO_DEPRECATED_SYMBOLS -H5_DLL int H5A__get_num_attrs(const H5O_loc_t *loc); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ H5_DLL herr_t H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data); H5_DLL herr_t H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, @@ -216,12 +211,10 @@ H5_DLL herr_t H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, H5_DLL herr_t H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data); #endif /* H5_NO_DEPRECATED_SYMBOLS */ -H5_DLL herr_t H5A__delete(const H5G_loc_t *loc, const char *name); H5_DLL herr_t H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name); H5_DLL herr_t H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n); -H5_DLL htri_t H5A__exists(const H5G_loc_t *loc, const char *name); H5_DLL htri_t H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name); H5_DLL herr_t H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf); H5_DLL herr_t H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf); @@ -282,13 +282,8 @@ H5C_create(size_t max_cache_size, cache_ptr->flush_in_progress = FALSE; - cache_ptr->logging_enabled = FALSE; - - cache_ptr->currently_logging = FALSE; - - cache_ptr->log_file_ptr = NULL; - - cache_ptr->trace_file_ptr = NULL; + if(NULL == (cache_ptr->log_info = (H5C_log_info_t *)H5MM_calloc(sizeof(H5C_log_info_t)))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed") cache_ptr->aux_ptr = aux_ptr; @@ -493,6 +488,9 @@ done: if(cache_ptr->tag_list != NULL) H5SL_close(cache_ptr->tag_list); + if(cache_ptr->log_info != NULL) + H5MM_xfree(cache_ptr->log_info); + cache_ptr->magic = 0; cache_ptr = H5FL_FREE(H5C_t, cache_ptr); } /* end if */ @@ -865,6 +863,9 @@ H5C_dest(H5F_t * f) cache_ptr->tag_list = NULL; } /* end if */ + if(cache_ptr->log_info != NULL) + H5MM_xfree(cache_ptr->log_info); + #ifndef NDEBUG #if H5C_DO_SANITY_CHECKS if(cache_ptr->get_entry_ptr_from_addr_counter > 0) diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c index 08c70d9..1f55e86 100644 --- a/src/H5Cdbg.c +++ b/src/H5Cdbg.c @@ -476,42 +476,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5C_set_trace_file_ptr - * - * Purpose: Set the trace_file_ptr field for the cache. - * - * This field must either be NULL (which turns of trace - * file logging), or be a pointer to an open file to which - * trace file data is to be written. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 1/20/06 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_set_trace_file_ptr(H5C_t * cache_ptr, FILE * trace_file_ptr) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* This would normally be an assert, but we need to use an HGOTO_ERROR - * call to shut up the compiler. - */ - if((NULL == cache_ptr) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr") - - cache_ptr->trace_file_ptr = trace_file_ptr; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_set_trace_file_ptr() */ - - -/*------------------------------------------------------------------------- * Function: H5C_stats * * Purpose: Prints statistics about the cache. diff --git a/src/H5Clog.c b/src/H5Clog.c index 3353619..0ae7f13 100644 --- a/src/H5Clog.c +++ b/src/H5Clog.c @@ -13,11 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5Clog.c - * May 30 2016 - * Quincey Koziol + * Created: H5Clog.c * - * Purpose: Functions for generic cache logging in JSON format + * Purpose: Functions for metadata cache logging * *------------------------------------------------------------------------- */ @@ -30,14 +28,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#ifdef H5_HAVE_PARALLEL -#define H5AC_FRIEND /*suppress error about including H5ACpkg */ -#include "H5ACpkg.h" /* Metadata cache */ -#endif /* H5_HAVE_PARALLEL */ -#include "H5Cpkg.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#define H5AC_FRIEND /* Suppress error about including H5ACpkg */ +#include "H5ACpkg.h" /* Metadata cache */ +#include "H5Cpkg.h" /* Cache */ +#include "H5Clog.h" /* Cache logging */ +#include "H5Eprivate.h" /* Error handling */ /****************/ @@ -77,133 +73,109 @@ /*------------------------------------------------------------------------- - * Function: H5C_set_up_logging + * Function: H5C_log_set_up * * Purpose: Setup for metadata cache logging. * - * Metadata logging is enabled and disabled at two levels. This - * function and the associated tear_down function open and close - * the log file. the start_ and stop_logging functions are then - * used to switch logging on/off. Optionally, logging can begin - * as soon as the log file is opened (set via the start_immediately - * parameter to this function). - * - * The log functionality is split between the H5C and H5AC - * packages. Log state and direct log manipulation resides in - * H5C. Log messages are generated in H5AC and sent to - * the H5C_write_log_message function. + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 + * Programmer: Dana Robinson + * Fall 2018 * *------------------------------------------------------------------------- */ herr_t -H5C_set_up_logging(H5C_t *cache_ptr, const char log_location[], - hbool_t start_immediately) +H5C_log_set_up(H5C_t *cache, const char log_location[], H5C_log_style_t style, hbool_t start_immediately) { -#ifdef H5_HAVE_PARALLEL - H5AC_aux_t *aux_ptr = NULL; -#endif /*H5_HAVE_PARALLEL*/ - char *file_name = NULL; - size_t n_chars; - herr_t ret_value = SUCCEED; /* Return value */ + int mpi_rank = -1; /* -1 indicates serial (no MPI rank) */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - if(NULL == cache_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache_ptr == NULL") - if(H5C__H5C_T_MAGIC != cache_ptr->magic) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect") - if(cache_ptr->logging_enabled) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "logging already set up") - if(NULL == log_location) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL log location not allowed") - - /* Possibly fix up the log file name. - * The extra 39 characters are for adding the rank to the file name - * under parallel HDF5. 39 characters allows > 2^127 processes which - * should be enough for anybody. - * - * allocation size = <path length> + dot + <rank # length> + \0 - */ - n_chars = HDstrlen(log_location) + 1 + 39 + 1; - if(NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate memory for mdc log file name manipulation") + HDassert(cache); + HDassert(log_location); + /* Check logging flags */ + if(cache->log_info->enabled) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging already set up") + + /* Get the rank when MPI is in use. Logging clients will usually + * use that to create per-process logs. + */ #ifdef H5_HAVE_PARALLEL - /* Add the rank to the log file name when MPI is in use */ - aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr); - - if(NULL == aux_ptr) - HDsnprintf(file_name, n_chars, "%s", log_location); - else { - if(aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad aux_ptr->magic") - HDsnprintf(file_name, n_chars, "%s.%d", log_location, aux_ptr->mpi_rank); - } /* end else */ -#else /* H5_HAVE_PARALLEL */ - HDsnprintf(file_name, n_chars, "%s", log_location); -#endif /* H5_HAVE_PARALLEL */ - - /* Open log file */ - if(NULL == (cache_ptr->log_file_ptr = HDfopen(file_name, "w"))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't create mdc log file") + if(NULL != cache->aux_ptr) + mpi_rank = ((H5AC_aux_t *)(cache->aux_ptr))->mpi_rank; +#endif /*H5_HAVE_PARALLEL*/ + + /* Set up logging */ + if(H5C_LOG_STYLE_JSON == style) { + if(H5C_log_json_set_up(cache->log_info, log_location, mpi_rank) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to set up json logging") + } + else if(H5C_LOG_STYLE_TRACE == style) { + if(H5C_log_trace_set_up(cache->log_info, log_location, mpi_rank) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to set up trace logging") + } + else + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unknown logging style") /* Set logging flags */ - cache_ptr->logging_enabled = TRUE; - cache_ptr->currently_logging = start_immediately; + cache->log_info->enabled = TRUE; + + /* Start logging if requested */ + if(start_immediately) + if(H5C_start_logging(cache) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to start logging") done: - if(file_name) - file_name = (char *)H5MM_xfree(file_name); FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_set_up_logging() */ +} /* H5C_log_set_up() */ /*------------------------------------------------------------------------- - * Function: H5C_tear_down_logging + * Function: H5C_log_tear_down * * Purpose: Tear-down for metadata cache logging. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 + * Programmer: Dana Robinson + * Fall 2018 * *------------------------------------------------------------------------- */ herr_t -H5C_tear_down_logging(H5C_t *cache_ptr) +H5C_log_tear_down(H5C_t *cache) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - if(NULL == cache_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache_ptr == NULL") - if(H5C__H5C_T_MAGIC != cache_ptr->magic) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect") - if(FALSE == cache_ptr->logging_enabled) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "logging not enabled") + HDassert(cache); - /* Unset logging flags */ - cache_ptr->logging_enabled = FALSE; - cache_ptr->currently_logging = FALSE; + /* Check logging flags */ + if(FALSE == cache->log_info->enabled) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not enabled") - /* Close log file */ - if(EOF == HDfclose(cache_ptr->log_file_ptr)) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problem closing mdc log file") - cache_ptr->log_file_ptr = NULL; + /* Stop logging if that's going on */ + if(cache->log_info->logging) + if(H5C_stop_logging(cache) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to stop logging") + + /* Tear down logging */ + if(cache->log_info->cls->tear_down_logging) + if(cache->log_info->cls->tear_down_logging(cache->log_info) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific tear down call failed") + + /* Unset logging flags */ + cache->log_info->enabled = FALSE; done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_tear_down_logging() */ +} /* H5C_log_tear_down() */ /*------------------------------------------------------------------------- @@ -211,37 +183,39 @@ H5C_tear_down_logging(H5C_t *cache_ptr) * * Purpose: Start logging metadata cache operations. * - * TODO: Add a function that dumps the current state of the - * metadata cache. + * Return: SUCCEED/FAIL * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 + * Programmer: Dana Robinson + * Fall 2018 * *------------------------------------------------------------------------- */ herr_t -H5C_start_logging(H5C_t *cache_ptr) +H5C_start_logging(H5C_t *cache) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - if(NULL == cache_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache_ptr == NULL") - if(H5C__H5C_T_MAGIC != cache_ptr->magic) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect") - if(FALSE == cache_ptr->logging_enabled) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "logging not enabled") - if(cache_ptr->currently_logging) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "logging already in progress") + HDassert(cache); + + /* Check logging flags */ + if(FALSE == cache->log_info->enabled) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not enabled") + + /* Start logging */ + if(cache->log_info->cls->start_logging) + if(cache->log_info->cls->start_logging(cache->log_info) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific start call failed") /* Set logging flags */ - cache_ptr->currently_logging = TRUE; + cache->log_info->logging = TRUE; - /* TODO - Dump cache state */ + /* Write a log message */ + if(cache->log_info->cls->write_start_log_msg) + if(cache->log_info->cls->write_start_log_msg(cache->log_info->udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write start call failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -253,32 +227,41 @@ H5C_start_logging(H5C_t *cache_ptr) * * Purpose: Stop logging metadata cache operations. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 + * Programmer: Dana Robinson + * Fall 2018 * *------------------------------------------------------------------------- */ herr_t -H5C_stop_logging(H5C_t *cache_ptr) +H5C_stop_logging(H5C_t *cache) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - if(NULL == cache_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache_ptr == NULL") - if(H5C__H5C_T_MAGIC != cache_ptr->magic) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect") - if(FALSE == cache_ptr->logging_enabled) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "logging not enabled") - if(FALSE == cache_ptr->currently_logging) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "logging not in progress") + HDassert(cache); + + /* Check logging flags */ + if(FALSE == cache->log_info->enabled) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not enabled") + if(FALSE == cache->log_info->logging) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not in progress") + + /* Write a log message */ + if(cache->log_info->cls->write_stop_log_msg) + if(cache->log_info->cls->write_stop_log_msg(cache->log_info->udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write stop call failed") + + /* Stop logging */ + if(cache->log_info->cls->stop_logging) + if(cache->log_info->cls->stop_logging(cache->log_info) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific stop call failed") /* Set logging flags */ - cache_ptr->currently_logging = FALSE; + cache->log_info->logging = FALSE; done: FUNC_LEAVE_NOAPI(ret_value) @@ -289,80 +272,706 @@ H5C_stop_logging(H5C_t *cache_ptr) * Function: H5C_get_logging_status * * Purpose: Determines if the cache is actively logging (via the OUT - * parameter). + * parameters). * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 + * Programmer: Dana Robinson + * Fall 2018 * *------------------------------------------------------------------------- */ herr_t -H5C_get_logging_status(const H5C_t *cache_ptr, /*OUT*/ hbool_t *is_enabled, +H5C_get_logging_status(const H5C_t *cache, /*OUT*/ hbool_t *is_enabled, /*OUT*/ hbool_t *is_currently_logging) { - herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_NOAPI_NOERR + + /* Sanity checks */ + HDassert(cache); + HDassert(is_enabled); + HDassert(is_currently_logging); + + /* Get logging flags */ + *is_enabled = cache->log_info->enabled; + *is_currently_logging = cache->log_info->logging; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5C_get_logging_status() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_create_cache_msg + * + * Purpose: Write a log message for cache creation. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_create_cache_msg(H5C_t *cache, herr_t fxn_ret_value) +{ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - if(NULL == cache_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache_ptr == NULL") - if(H5C__H5C_T_MAGIC != cache_ptr->magic) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect") - if(NULL == is_enabled) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect") - if(NULL == is_currently_logging) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect") - - *is_enabled = cache_ptr->logging_enabled; - *is_currently_logging = cache_ptr->currently_logging; + HDassert(cache); + + /* Write a log message */ + if(cache->log_info->cls->write_create_cache_log_msg) + if(cache->log_info->cls->write_create_cache_log_msg(cache->log_info->udata, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write create cache call failed") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_get_logging_status() */ +} /* H5C_log_write_create_cache_msg() */ + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_destroy_cache_msg + * + * Purpose: Write a log message for cache destruction. + * + * NOTE: This can't print out the H5AC call return value, since we + * won't know that until the cache is destroyed and at that + * point we no longer have pointers to the logging information. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_destroy_cache_msg(H5C_t *cache) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache); + + /* Write a log message */ + if(cache->log_info->cls->write_destroy_cache_log_msg) + if(cache->log_info->cls->write_destroy_cache_log_msg(cache->log_info->udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write destroy cache call failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_write_destroy_cache_msg() */ /*------------------------------------------------------------------------- - * Function: H5C_write_log_message + * Function: H5C_log_write_evict_cache_msg * - * Purpose: Write a message to the log file and flush the file. - * The message string is neither modified nor freed. + * Purpose: Write a log message for eviction of cache entries. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Sunday, March 16, 2014 + * Programmer: Dana Robinson + * Fall 2018 * *------------------------------------------------------------------------- */ herr_t -H5C_write_log_message(const H5C_t *cache_ptr, const char message[]) +H5C_log_write_evict_cache_msg(H5C_t *cache, herr_t fxn_ret_value) { - size_t n_chars; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache); + + /* Write a log message */ + if(cache->log_info->cls->write_evict_cache_log_msg) + if(cache->log_info->cls->write_evict_cache_log_msg(cache->log_info->udata, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write evict cache call failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_write_evict_cache_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_expunge_entry_msg + * + * Purpose: Write a log message for expunge of cache entries. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_expunge_entry_msg(H5C_t *cache, haddr_t address, + int type_id, herr_t fxn_ret_value) +{ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - if(NULL == cache_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache_ptr == NULL") - if(H5C__H5C_T_MAGIC != cache_ptr->magic) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect") - if(FALSE == cache_ptr->currently_logging) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "not currently logging") - if(NULL == message) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL log message not allowed") - - /* Write the log message and flush */ - n_chars = HDstrlen(message); - if((int)n_chars != HDfprintf(cache_ptr->log_file_ptr, message)) - HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error writing log message") - if(EOF == HDfflush(cache_ptr->log_file_ptr)) - HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error flushing log message") + HDassert(cache); + + /* Write a log message */ + if(cache->log_info->cls->write_expunge_entry_log_msg) + if(cache->log_info->cls->write_expunge_entry_log_msg(cache->log_info->udata, address, type_id, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write expunge entry call failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_write_expunge_entry_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_flush_cache_msg + * + * Purpose: Write a log message for cache flushes. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_flush_cache_msg(H5C_t *cache, herr_t fxn_ret_value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache); + + /* Write a log message */ + if(cache->log_info->cls->write_flush_cache_log_msg) + if(cache->log_info->cls->write_flush_cache_log_msg(cache->log_info->udata, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific flush cache call failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_write_flush_cache_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_insert_entry_msg + * + * Purpose: Write a log message for insertion of cache entries. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_insert_entry_msg(H5C_t *cache, haddr_t address, + int type_id, unsigned flags, size_t size, herr_t fxn_ret_value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache); + + /* Write a log message */ + if(cache->log_info->cls->write_insert_entry_log_msg) + if(cache->log_info->cls->write_insert_entry_log_msg(cache->log_info->udata, address, type_id, flags, size, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific insert entry call failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_write_insert_entry_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_mark_entry_dirty_msg + * + * Purpose: Write a log message for marking cache entries as dirty. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_mark_entry_dirty_msg(H5C_t *cache, const H5C_cache_entry_t *entry, + herr_t fxn_ret_value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache); + + /* Write a log message */ + HDassert(entry); + if(cache->log_info->cls->write_mark_entry_dirty_log_msg) + if(cache->log_info->cls->write_mark_entry_dirty_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark dirty entry call failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_write_mark_entry_dirty_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_mark_entry_clean_msg + * + * Purpose: Write a log message for marking cache entries as clean. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_mark_entry_clean_msg(H5C_t *cache, const H5C_cache_entry_t *entry, + herr_t fxn_ret_value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache); + + /* Write a log message */ + HDassert(entry); + if(cache->log_info->cls->write_mark_entry_clean_log_msg) + if(cache->log_info->cls->write_mark_entry_clean_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark clean entry call failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_write_mark_entry_clean_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_mark_unserialized_entry_msg + * + * Purpose: Write a log message for marking cache entries as unserialized. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_mark_unserialized_entry_msg(H5C_t *cache, + const H5C_cache_entry_t *entry, herr_t fxn_ret_value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache); + + /* Write a log message */ + HDassert(entry); + if(cache->log_info->cls->write_mark_unserialized_entry_log_msg) + if(cache->log_info->cls->write_mark_unserialized_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark unserialized entry call failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_write_mark_unserialized_entry_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_mark_serialized_entry_msg + * + * Purpose: Write a log message for marking cache entries as serialize. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_mark_serialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, + herr_t fxn_ret_value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache); + + /* Write a log message */ + HDassert(entry); + if(cache->log_info->cls->write_mark_serialized_entry_log_msg) + if(cache->log_info->cls->write_mark_serialized_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark serialized entry call failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_write_mark_serialized_entry_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_move_entry_msg + * + * Purpose: Write a log message for moving a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_move_entry_msg(H5C_t *cache, haddr_t old_addr, haddr_t new_addr, + int type_id, herr_t fxn_ret_value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache); + + /* Write a log message */ + if(cache->log_info->cls->write_move_entry_log_msg) + if(cache->log_info->cls->write_move_entry_log_msg(cache->log_info->udata, old_addr, new_addr, type_id, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific move entry call failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_write_move_entry_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_pin_entry_msg + * + * Purpose: Write a log message for pinning a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_pin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, + herr_t fxn_ret_value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache); + + /* Write a log message */ + HDassert(entry); + if(cache->log_info->cls->write_pin_entry_log_msg) + if(cache->log_info->cls->write_pin_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific pin entry call failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_write_pin_entry_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_create_fd_msg + * + * Purpose: Write a log message for creating a flush dependency between + * two cache entries. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_create_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent, + const H5C_cache_entry_t *child, herr_t fxn_ret_value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache); + + /* Write a log message */ + HDassert(parent); + HDassert(child); + if(cache->log_info->cls->write_create_fd_log_msg) + if(cache->log_info->cls->write_create_fd_log_msg(cache->log_info->udata, parent, child, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific create fd call failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_write_create_fd_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_protect_entry_msg + * + * Purpose: Write a log message for protecting a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_protect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, + int type_id, unsigned flags, herr_t fxn_ret_value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache); + + /* Write a log message */ + HDassert(entry); + if(cache->log_info->cls->write_protect_entry_log_msg) + if(cache->log_info->cls->write_protect_entry_log_msg(cache->log_info->udata, entry, type_id, flags, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific protect entry call failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_write_protect_entry_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_resize_entry_msg + * + * Purpose: Write a log message for resizing a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_resize_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, + size_t new_size, herr_t fxn_ret_value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache); + + /* Write a log message */ + HDassert(entry); + if(cache->log_info->cls->write_resize_entry_log_msg) + if(cache->log_info->cls->write_resize_entry_log_msg(cache->log_info->udata, entry, new_size, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific resize entry call failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_write_resize_entry_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_unpin_entry_msg + * + * Purpose: Write a log message for unpinning a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_unpin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, + herr_t fxn_ret_value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache); + + /* Write a log message */ + HDassert(entry); + if(cache->log_info->cls->write_unpin_entry_log_msg) + if(cache->log_info->cls->write_unpin_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific unpin entry call failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_write_unpin_entry_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_destroy_fd_msg + * + * Purpose: Write a log message for destroying a flush dependency + * between two cache entries. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_destroy_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent, + const H5C_cache_entry_t *child, herr_t fxn_ret_value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache); + + /* Write a log message */ + HDassert(parent); + HDassert(child); + if(cache->log_info->cls->write_destroy_fd_log_msg) + if(cache->log_info->cls->write_destroy_fd_log_msg(cache->log_info->udata, parent, child, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific destroy fd call failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_write_destroy_fd_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_unprotect_entry_msg + * + * Purpose: Write a log message for unprotecting a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_unprotect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, + int type_id, unsigned flags, herr_t fxn_ret_value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache); + + /* Write a log message */ + HDassert(entry); + if(cache->log_info->cls->write_unprotect_entry_log_msg) + if(cache->log_info->cls->write_unprotect_entry_log_msg(cache->log_info->udata, entry, type_id, flags, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific unprotect entry call failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_write_unprotect_entry_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_set_cache_config_msg + * + * Purpose: Write a log message for setting the cache configuration. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_set_cache_config_msg(H5C_t *cache, const H5AC_cache_config_t *config, + herr_t fxn_ret_value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache); + + /* Write a log message */ + HDassert(config); + if(cache->log_info->cls->write_set_cache_config_log_msg) + if(cache->log_info->cls->write_set_cache_config_log_msg(cache->log_info->udata, config, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific set cache config call failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_write_set_cache_config_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_write_remove_entry_msg + * + * Purpose: Write a log message for removing a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_write_remove_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, + herr_t fxn_ret_value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(cache); + + /* Write a log message */ + HDassert(entry); + if(cache->log_info->cls->write_remove_entry_log_msg) + if(cache->log_info->cls->write_remove_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific remove entry call failed") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_write_log_message() */ +} /* H5C_log_write_remove_entry_msg() */ diff --git a/src/H5Clog.h b/src/H5Clog.h new file mode 100644 index 0000000..9ba6786 --- /dev/null +++ b/src/H5Clog.h @@ -0,0 +1,114 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * 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. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Cache logging header file + */ + +#ifndef _H5Clog_H +#define _H5Clog_H + +/* Get package's private header */ +#include "H5Cprivate.h" /* Cache */ + +/**************************/ +/* Package Private Macros */ +/**************************/ + +/****************************/ +/* Package Private Typedefs */ +/****************************/ + +/* Forward declaration for class struct */ +typedef struct H5C_log_info_t H5C_log_info_t; + +/* Class for generating logging messages */ +typedef struct H5C_log_class_t { + const char *name; /* String for debugging */ + + /* Callbacks for writing log messages */ + herr_t (*tear_down_logging)(H5C_log_info_t *log_info); + herr_t (*start_logging)(H5C_log_info_t *log_info); + herr_t (*stop_logging)(H5C_log_info_t *log_info); + herr_t (*write_start_log_msg)(void *udata); + herr_t (*write_stop_log_msg)(void *udata); + herr_t (*write_create_cache_log_msg)(void *udata, herr_t fxn_ret_value); + herr_t (*write_destroy_cache_log_msg)(void *udata); + herr_t (*write_evict_cache_log_msg)(void *udata, herr_t fxn_ret_value); + herr_t (*write_expunge_entry_log_msg)(void *udata, haddr_t address, int type_id, herr_t fxn_ret_value); + herr_t (*write_flush_cache_log_msg)(void *udata, herr_t fxn_ret_value); + herr_t (*write_insert_entry_log_msg)(void *udata, haddr_t address, int type_id, unsigned flags, size_t size, herr_t fxn_ret_value); + herr_t (*write_mark_entry_dirty_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); + herr_t (*write_mark_entry_clean_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); + herr_t (*write_mark_unserialized_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); + herr_t (*write_mark_serialized_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); + herr_t (*write_move_entry_log_msg)(void *udata, haddr_t old_addr, haddr_t new_addr, int type_id, herr_t fxn_ret_value); + herr_t (*write_pin_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); + herr_t (*write_create_fd_log_msg)(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value); + herr_t (*write_protect_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value); + herr_t (*write_resize_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value); + herr_t (*write_unpin_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); + herr_t (*write_destroy_fd_log_msg)(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value); + herr_t (*write_unprotect_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value); + herr_t (*write_set_cache_config_log_msg)(void *udata, const H5AC_cache_config_t *config, herr_t fxn_ret_value); + herr_t (*write_remove_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); + +} H5C_log_class_t; + +/* Logging information */ +struct H5C_log_info_t { + hbool_t enabled; /* Was the logging set up? */ + hbool_t logging; /* Are we currently logging? */ + H5C_log_class_t *cls; /* Callbacks for writing log messages */ + void *udata; /* Log-specific data */ +}; + + +/*****************************/ +/* Package Private Variables */ +/*****************************/ + + +/******************************/ +/* Package Private Prototypes */ +/******************************/ +H5_DLL herr_t H5C_log_set_up(H5C_t *cache, const char log_location[], H5C_log_style_t style, hbool_t start_immediately); +H5_DLL herr_t H5C_log_tear_down(H5C_t *cache); + +H5_DLL herr_t H5C_log_write_create_cache_msg(H5C_t *cache, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_destroy_cache_msg(H5C_t *cache); +H5_DLL herr_t H5C_log_write_evict_cache_msg(H5C_t *cache, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_expunge_entry_msg(H5C_t *cache, haddr_t address, int type_id, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_flush_cache_msg(H5C_t *cache, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_insert_entry_msg(H5C_t *cache, haddr_t address, int type_id, unsigned flags, size_t size, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_mark_entry_dirty_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_mark_entry_clean_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_mark_unserialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_mark_serialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_move_entry_msg(H5C_t *cache, haddr_t old_addr, haddr_t new_addr, int type_id, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_pin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_create_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_protect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_resize_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_unpin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_destroy_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_unprotect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_set_cache_config_msg(H5C_t *cache, const H5AC_cache_config_t *config, herr_t fxn_ret_value); +H5_DLL herr_t H5C_log_write_remove_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); + +/* Logging-specific setup functions */ +H5_DLL herr_t H5C_log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank); +H5_DLL herr_t H5C_log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank); + +#endif /* _H5Clog_H */ + diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c new file mode 100644 index 0000000..ccfa222 --- /dev/null +++ b/src/H5Clog_json.c @@ -0,0 +1,1365 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * 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. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Created: H5Clog_json.c + * + * Purpose: Cache log implementation that emits JSON-formatted log + * entries for consumption by new-fangled data analysis tools. + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ +#include "H5Cmodule.h" /* This source code file is part of the H5C module */ + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Cpkg.h" /* Cache */ +#include "H5Clog.h" /* Cache logging */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory management */ + + +/****************/ +/* Local Macros */ +/****************/ + +/* Max log message size */ +#define H5C_MAX_JSON_LOG_MSG_SIZE 128 + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + +typedef struct H5C_log_json_udata_t { + FILE *outfile; + char *message; +} H5C_log_json_udata_t; + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* Internal message handling calls */ +static herr_t H5C__json_write_log_message(H5C_log_json_udata_t *json_udata); + +/* Log message callbacks */ +static herr_t H5C__json_tear_down_logging(H5C_log_info_t *log_info); +static herr_t H5C__json_write_start_log_msg(void *udata); +static herr_t H5C__json_write_stop_log_msg(void *udata); +static herr_t H5C__json_write_create_cache_log_msg(void *udata, herr_t fxn_ret_value); +static herr_t H5C__json_write_destroy_cache_log_msg(void *udata); +static herr_t H5C__json_write_evict_cache_log_msg(void *udata, herr_t fxn_ret_value); +static herr_t H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id, herr_t fxn_ret_value); +static herr_t H5C__json_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value); +static herr_t H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, size_t size, herr_t fxn_ret_value); +static herr_t H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); +static herr_t H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); +static herr_t H5C__json_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); +static herr_t H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); +static herr_t H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr, int type_id, herr_t fxn_ret_value); +static herr_t H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); +static herr_t H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value); +static herr_t H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value); +static herr_t H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value); +static herr_t H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); +static herr_t H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value); +static herr_t H5C__json_write_unprotect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value); +static herr_t H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config, herr_t fxn_ret_value); +static herr_t H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + +/* Note that there's no cache set up call since that's the + * place where this struct is wired into the cache. + */ +static H5C_log_class_t H5C_json_log_class_g = { + "json", + H5C__json_tear_down_logging, + NULL, /* start logging */ + NULL, /* stop logging */ + H5C__json_write_start_log_msg, + H5C__json_write_stop_log_msg, + H5C__json_write_create_cache_log_msg, + H5C__json_write_destroy_cache_log_msg, + H5C__json_write_evict_cache_log_msg, + H5C__json_write_expunge_entry_log_msg, + H5C__json_write_flush_cache_log_msg, + H5C__json_write_insert_entry_log_msg, + H5C__json_write_mark_entry_dirty_log_msg, + H5C__json_write_mark_entry_clean_log_msg, + H5C__json_write_mark_unserialized_entry_log_msg, + H5C__json_write_mark_serialized_entry_log_msg, + H5C__json_write_move_entry_log_msg, + H5C__json_write_pin_entry_log_msg, + H5C__json_write_create_fd_log_msg, + H5C__json_write_protect_entry_log_msg, + H5C__json_write_resize_entry_log_msg, + H5C__json_write_unpin_entry_log_msg, + H5C__json_write_destroy_fd_log_msg, + H5C__json_write_unprotect_entry_log_msg, + H5C__json_write_set_cache_config_log_msg, + H5C__json_write_remove_entry_log_msg +}; + + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_log_message + * + * Purpose: Write a message to the log file and flush the file. + * The message string is neither modified nor freed. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_log_message(H5C_log_json_udata_t *json_udata) +{ + size_t n_chars; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->outfile); + HDassert(json_udata->message); + + /* Write the log message and flush */ + n_chars = HDstrlen(json_udata->message); + if((int)n_chars != HDfprintf(json_udata->outfile, json_udata->message)) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message") + HDmemset((void *)(json_udata->message), 0, (size_t)(n_chars * sizeof(char))); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_log_message() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_json_set_up + * + * Purpose: Setup for metadata cache logging. + * + * Metadata logging is enabled and disabled at two levels. This + * function and the associated tear_down function open and close + * the log file. the start_ and stop_logging functions are then + * used to switch logging on/off. Optionally, logging can begin + * as soon as the log file is opened (set via the start_immediately + * parameter to this function). + * + * The log functionality is split between the H5C and H5AC + * packages. Log state and direct log manipulation resides in + * H5C. Log messages are generated in H5AC and sent to + * the H5C__json_write_log_message function. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank) +{ + H5C_log_json_udata_t *json_udata = NULL; + char *file_name = NULL; + size_t n_chars; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(log_info); + HDassert(log_location); + + /* Set up the class struct */ + log_info->cls = &H5C_json_log_class_g; + + /* Allocate memory for the JSON-specific data */ + if(NULL == (log_info->udata = H5MM_calloc(sizeof(H5C_log_json_udata_t)))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed") + json_udata = (H5C_log_json_udata_t *)(log_info->udata); + + /* Allocate memory for the message buffer */ + if(NULL == (json_udata->message = (char *)H5MM_calloc(H5C_MAX_JSON_LOG_MSG_SIZE * sizeof(char)))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed") + + /* Possibly fix up the log file name. + * The extra 39 characters are for adding the rank to the file name + * under parallel HDF5. 39 characters allows > 2^127 processes which + * should be enough for anybody. + * + * allocation size = "RANK_" + <rank # length> + dot + <path length> + \0 + */ + n_chars = 5 + 39 + 1 + HDstrlen(log_location) + 1; + if(NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char)))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate memory for mdc log file name manipulation") + + /* Add the rank to the log file name when MPI is in use */ + if(-1 == mpi_rank) + HDsnprintf(file_name, n_chars, "%s", log_location); + else + HDsnprintf(file_name, n_chars, "RANK_%d.%s", mpi_rank, log_location); + + /* Open log file and set it to be unbuffered */ + if(NULL == (json_udata->outfile = HDfopen(file_name, "w"))) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "can't create mdc log file") + HDsetbuf(json_udata->outfile, NULL); + + done: + if(file_name) + H5MM_xfree(file_name); + + /* Free and reset the log info struct on errors */ + if(FAIL == ret_value) { + /* Free */ + if(json_udata && json_udata->message) + H5MM_xfree(json_udata->message); + if(json_udata) + H5MM_xfree(json_udata); + + /* Reset */ + log_info->udata = NULL; + log_info->cls = NULL; + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_json_set_up() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_tear_down_logging + * + * Purpose: Tear-down for metadata cache logging. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_tear_down_logging(H5C_log_info_t *log_info) +{ + H5C_log_json_udata_t *json_udata = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(log_info); + + /* Alias */ + json_udata = (H5C_log_json_udata_t *)(log_info->udata); + + /* Free the message buffer */ + H5MM_xfree(json_udata->message); + + /* Close log file */ + if(EOF == HDfclose(json_udata->outfile)) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "problem closing mdc log file") + json_udata->outfile = NULL; + + /* Fre the udata */ + H5MM_xfree(json_udata); + + /* Reset the log class info and udata */ + log_info->cls = NULL; + log_info->udata = NULL; + + done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_tear_down_logging() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_start_log_msg + * + * Purpose: Write a log message when logging starts. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_start_log_msg(void *udata) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + + /* Create the log message string (opens the JSON array) */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\n\ +\"HDF5 metadata cache log messages\" : [\n\ +{\ +\"timestamp\":%lld,\ +\"action\":\"logging start\"\ +},\n\ +" + , (long long)HDtime(NULL)); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_start_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_stop_log_msg + * + * Purpose: Write a log message when logging ends. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_stop_log_msg(void *udata) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + + /* Create the log message string (closes the JSON array) */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"logging stop\"\ +}\n\ +]}\n\ +" + , (long long)HDtime(NULL)); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_stop_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_create_cache_log_msg + * + * Purpose: Write a log message for cache creation. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_create_cache_log_msg(void *udata, herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"create\",\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_create_cache_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_destroy_cache_log_msg + * + * Purpose: Write a log message for cache destruction. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_destroy_cache_log_msg(void *udata) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"destroy\"\ +},\n\ +" + , (long long)HDtime(NULL)); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_destroy_cache_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_evict_cache_log_msg + * + * Purpose: Write a log message for eviction of cache entries. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_evict_cache_log_msg(void *udata, herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"evict\",\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_evict_cache_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_expunge_entry_log_msg + * + * Purpose: Write a log message for expunge of cache entries. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address, + int type_id, herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"expunge\",\ +\"address\":0x%lx,\ +\"type_id\":%d,\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (unsigned long)address, (int)type_id, (int)fxn_ret_value); + + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_expunge_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_flush_cache_log_msg + * + * Purpose: Write a log message for cache flushes. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"flush\",\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_flush_cache_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_insert_entry_log_msg + * + * Purpose: Write a log message for insertion of cache entries. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address, + int type_id, unsigned flags, size_t size, herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"insert\",\ +\"address\":0x%lx,\ +\"type_id\":%d,\ +\"flags\":0x%x,\ +\"size\":%d,\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (unsigned long)address, type_id, flags, + (int)size, (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_insert_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_mark_entry_dirty_log_msg + * + * Purpose: Write a log message for marking cache entries as dirty. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry, + herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"dirty\",\ +\"address\":0x%lx,\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_mark_entry_dirty_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_mark_entry_clean_log_msg + * + * Purpose: Write a log message for marking cache entries as clean. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry, + herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"clean\",\ +\"address\":0x%lx,\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_mark_entry_clean_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_mark_unserialized_entry_log_msg + * + * Purpose: Write a log message for marking cache entries as unserialized. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_mark_unserialized_entry_log_msg(void *udata, + const H5C_cache_entry_t *entry, herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"unserialized\",\ +\"address\":0x%lx,\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_mark_unserialized_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_mark_serialize_entry_log_msg + * + * Purpose: Write a log message for marking cache entries as serialize. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, + herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"serialized\",\ +\"address\":0x%lx,\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_mark_serialized_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_move_entry_log_msg + * + * Purpose: Write a log message for moving a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr, + int type_id, herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"move\",\ +\"old_address\":0x%lx,\ +\"new_address\":0x%lx,\ +\"type_id\":%d,\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (unsigned long)old_addr, + (unsigned long)new_addr, type_id, (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_move_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_pin_entry_log_msg + * + * Purpose: Write a log message for pinning a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, + herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"pin\",\ +\"address\":0x%lx,\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (unsigned long)entry->addr, + (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_pin_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_create_fd_log_msg + * + * Purpose: Write a log message for creating a flush dependency between + * two cache entries. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, + const H5C_cache_entry_t *child, herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + HDassert(parent); + HDassert(child); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"create_fd\",\ +\"parent_addr\":0x%lx,\ +\"child_addr\":0x%lx,\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (unsigned long)parent->addr, + (unsigned long)child->addr, (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_create_fd_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_protect_entry_log_msg + * + * Purpose: Write a log message for protecting a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, + int type_id, unsigned flags, herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + char rw_s[16]; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + HDassert(entry); + + if(H5C__READ_ONLY_FLAG == flags) + HDstrcpy(rw_s, "READ"); + else + HDstrcpy(rw_s, "WRITE"); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"protect\",\ +\"address\":0x%lx,\ +\"type_id\":%d,\ +\"readwrite\":\"%s\",\ +\"size\":%d,\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (unsigned long)entry->addr, + type_id, rw_s, (int)entry->size, (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_protect_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_resize_entry_log_msg + * + * Purpose: Write a log message for resizing a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, + size_t new_size, herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"resize\",\ +\"address\":0x%lx,\ +\"new_size\":%d,\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (unsigned long)entry->addr, + (int)new_size, (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_resize_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_unpin_entry_log_msg + * + * Purpose: Write a log message for unpinning a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, + herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"unpin\",\ +\"address\":0x%lx,\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (unsigned long)entry->addr, + (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_unpin_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_destroy_fd_log_msg + * + * Purpose: Write a log message for destroying a flush dependency + * between two cache entries. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, + const H5C_cache_entry_t *child, herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + HDassert(parent); + HDassert(child); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"destroy_fd\",\ +\"parent_addr\":0x%lx,\ +\"child_addr\":0x%lx,\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (unsigned long)parent->addr, + (unsigned long)child->addr, (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_destroy_fd_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_unprotect_entry_log_msg + * + * Purpose: Write a log message for unprotecting a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_unprotect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, + int type_id, unsigned flags, herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"unprotect\",\ +\"address\":0x%lx,\ +\"id\":%d,\ +\"flags\":%x,\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (unsigned long)entry->addr, + type_id, flags, (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_unprotect_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_set_cache_config_log_msg + * + * Purpose: Write a log message for setting the cache configuration. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config, + herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + HDassert(config); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"set_config\",\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (int)fxn_ret_value); + + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_set_cache_config_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__json_write_remove_entry_log_msg + * + * Purpose: Write a log message for removing a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, + herr_t fxn_ret_value) +{ + H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(json_udata); + HDassert(json_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, +"\ +{\ +\"timestamp\":%lld,\ +\"action\":\"remove\",\ +\"address\":0x%lx,\ +\"returned\":%d\ +},\n\ +" + , (long long)HDtime(NULL), (unsigned long)entry->addr, + (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__json_write_log_message(json_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__json_write_remove_entry_log_msg() */ + diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c new file mode 100644 index 0000000..f7d6889 --- /dev/null +++ b/src/H5Clog_trace.c @@ -0,0 +1,1008 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * 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. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Created: H5Clog_trace.c + * + * Purpose: Cache log implementation that emits trace entries intended + * for consumption by a future 'cache replay' feature. + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ +#include "H5Cmodule.h" /* This source code file is part of the H5C module */ + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Cpkg.h" /* Cache */ +#include "H5Clog.h" /* Cache logging */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory management */ + + +/****************/ +/* Local Macros */ +/****************/ + +/* Max log message size */ +#define H5C_MAX_TRACE_LOG_MSG_SIZE 2048 + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + +typedef struct H5C_log_trace_udata_t { + FILE *outfile; + char *message; +} H5C_log_trace_udata_t; + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* Internal message handling calls */ +static herr_t H5C__trace_write_log_message(H5C_log_trace_udata_t *trace_udata); + +/* Log message callbacks */ +static herr_t H5C__trace_tear_down_logging(H5C_log_info_t *log_info); +static herr_t H5C__trace_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id, herr_t fxn_ret_value); +static herr_t H5C__trace_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value); +static herr_t H5C__trace_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, size_t size, herr_t fxn_ret_value); +static herr_t H5C__trace_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); +static herr_t H5C__trace_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); +static herr_t H5C__trace_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); +static herr_t H5C__trace_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); +static herr_t H5C__trace_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr, int type_id, herr_t fxn_ret_value); +static herr_t H5C__trace_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); +static herr_t H5C__trace_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value); +static herr_t H5C__trace_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value); +static herr_t H5C__trace_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value); +static herr_t H5C__trace_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); +static herr_t H5C__trace_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value); +static herr_t H5C__trace_write_unprotect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value); +static herr_t H5C__trace_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config, herr_t fxn_ret_value); +static herr_t H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value); + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + +/* Note that there's no cache set up call since that's the + * place where this struct is wired into the cache. + */ +static H5C_log_class_t H5C_trace_log_class_g = { + "trace", + H5C__trace_tear_down_logging, + NULL, /* start logging */ + NULL, /* stop logging */ + NULL, /* write start message */ + NULL, /* write stop message */ + NULL, /* write create cache message */ + NULL, /* write destroy cache message */ + NULL, /* write evict cache message */ + H5C__trace_write_expunge_entry_log_msg, + H5C__trace_write_flush_cache_log_msg, + H5C__trace_write_insert_entry_log_msg, + H5C__trace_write_mark_entry_dirty_log_msg, + H5C__trace_write_mark_entry_clean_log_msg, + H5C__trace_write_mark_unserialized_entry_log_msg, + H5C__trace_write_mark_serialized_entry_log_msg, + H5C__trace_write_move_entry_log_msg, + H5C__trace_write_pin_entry_log_msg, + H5C__trace_write_create_fd_log_msg, + H5C__trace_write_protect_entry_log_msg, + H5C__trace_write_resize_entry_log_msg, + H5C__trace_write_unpin_entry_log_msg, + H5C__trace_write_destroy_fd_log_msg, + H5C__trace_write_unprotect_entry_log_msg, + H5C__trace_write_set_cache_config_log_msg, + H5C__trace_write_remove_entry_log_msg +}; + + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_write_log_message + * + * Purpose: Write a message to the log file and flush the file. + * The message string is neither modified nor freed. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_write_log_message(H5C_log_trace_udata_t *trace_udata) +{ + size_t n_chars; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(trace_udata); + HDassert(trace_udata->outfile); + HDassert(trace_udata->message); + + /* Write the log message and flush */ + n_chars = HDstrlen(trace_udata->message); + if((int)n_chars != HDfprintf(trace_udata->outfile, trace_udata->message)) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message") + HDmemset((void *)(trace_udata->message), 0, (size_t)(n_chars * sizeof(char))); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_write_log_message() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_log_trace_set_up + * + * Purpose: Setup for metadata cache logging. + * + * Metadata logging is enabled and disabled at two levels. This + * function and the associated tear_down function open and close + * the log file. the start_ and stop_logging functions are then + * used to switch logging on/off. Optionally, logging can begin + * as soon as the log file is opened (set via the start_immediately + * parameter to this function). + * + * The log functionality is split between the H5C and H5AC + * packages. Log state and direct log manipulation resides in + * H5C. Log messages are generated in H5AC and sent to + * the H5C__trace_write_log_message function. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank) +{ + H5C_log_trace_udata_t *trace_udata = NULL; + char *file_name = NULL; + size_t n_chars; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(log_info); + HDassert(log_location); + + /* Set up the class struct */ + log_info->cls = &H5C_trace_log_class_g; + + /* Allocate memory for the JSON-specific data */ + if(NULL == (log_info->udata = H5MM_calloc(sizeof(H5C_log_trace_udata_t)))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed") + trace_udata = (H5C_log_trace_udata_t *)(log_info->udata); + + /* Allocate memory for the message buffer */ + if(NULL == (trace_udata->message = (char *)H5MM_calloc(H5C_MAX_TRACE_LOG_MSG_SIZE * sizeof(char)))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed") + + /* Possibly fix up the log file name. + * The extra 39 characters are for adding the rank to the file name + * under parallel HDF5. 39 characters allows > 2^127 processes which + * should be enough for anybody. + * + * allocation size = <path length> + dot + <rank # length> + \0 + */ + n_chars = HDstrlen(log_location) + 1 + 39 + 1; + if(NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char)))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate memory for mdc log file name manipulation") + + /* Add the rank to the log file name when MPI is in use */ + if(-1 == mpi_rank) + HDsnprintf(file_name, n_chars, "%s", log_location); + else + HDsnprintf(file_name, n_chars, "%s.%d", log_location, mpi_rank); + + /* Open log file and set it to be unbuffered */ + if(NULL == (trace_udata->outfile = HDfopen(file_name, "w"))) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "can't create mdc log file") + HDsetbuf(trace_udata->outfile, NULL); + + /* Write the header */ + HDfprintf(trace_udata->outfile, "### HDF5 metadata cache trace file version 1 ###\n"); + + done: + if(file_name) + H5MM_xfree(file_name); + + /* Free and reset the log info struct on errors */ + if(FAIL == ret_value) { + /* Free */ + if(trace_udata && trace_udata->message) + H5MM_xfree(trace_udata->message); + if(trace_udata) + H5MM_xfree(trace_udata); + + /* Reset */ + log_info->udata = NULL; + log_info->cls = NULL; + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_log_trace_set_up() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_tear_down_logging + * + * Purpose: Tear-down for metadata cache logging. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_tear_down_logging(H5C_log_info_t *log_info) +{ + H5C_log_trace_udata_t *trace_udata = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(log_info); + + /* Alias */ + trace_udata = (H5C_log_trace_udata_t *)(log_info->udata); + + /* Free the message buffer */ + H5MM_xfree(trace_udata->message); + + /* Close log file */ + if(EOF == HDfclose(trace_udata->outfile)) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "problem closing mdc log file") + trace_udata->outfile = NULL; + + /* Fre the udata */ + H5MM_xfree(trace_udata); + + /* Reset the log class info and udata */ + log_info->cls = NULL; + log_info->udata = NULL; + + done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_tear_down_logging() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_write_expunge_entry_log_msg + * + * Purpose: Write a log message for expunge of cache entries. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_write_expunge_entry_log_msg(void *udata, haddr_t address, + int type_id, herr_t fxn_ret_value) +{ + H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(trace_udata); + HDassert(trace_udata->message); + + /* Create the log message string */ + HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_expunge_entry 0x%lx %d %d\n", + (unsigned long)address, type_id, (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__trace_write_log_message(trace_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_write_expunge_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_write_flush_cache_log_msg + * + * Purpose: Write a log message for cache flushes. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value) +{ + H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(trace_udata); + HDassert(trace_udata->message); + + /* Create the log message string */ + HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_flush %d\n", + (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__trace_write_log_message(trace_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_write_flush_cache_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_write_insert_entry_log_msg + * + * Purpose: Write a log message for insertion of cache entries. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_write_insert_entry_log_msg(void *udata, haddr_t address, + int type_id, unsigned flags, size_t size, herr_t fxn_ret_value) +{ + H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(trace_udata); + HDassert(trace_udata->message); + + /* Create the log message string */ + HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_insert_entry 0x%lx %d 0x%x %d %d\n", + (unsigned long)address, type_id, flags, (int)size, (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__trace_write_log_message(trace_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_write_insert_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_write_mark_entry_dirty_log_msg + * + * Purpose: Write a log message for marking cache entries as dirty. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry, + herr_t fxn_ret_value) +{ + H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(trace_udata); + HDassert(trace_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_dirty 0x%lx %d\n", + (unsigned long)(entry->addr), (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__trace_write_log_message(trace_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_write_mark_entry_dirty_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_write_mark_entry_clean_log_msg + * + * Purpose: Write a log message for marking cache entries as clean. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry, + herr_t fxn_ret_value) +{ + H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata); + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(trace_udata); + HDassert(trace_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_clean 0x%lx %d\n", + (unsigned long)(entry->addr), (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__trace_write_log_message(trace_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_write_mark_entry_clean_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_write_mark_unserialized_entry_log_msg + * + * Purpose: Write a log message for marking cache entries as unserialized. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_write_mark_unserialized_entry_log_msg(void *udata, + const H5C_cache_entry_t *entry, herr_t fxn_ret_value) +{ + H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(trace_udata); + HDassert(trace_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_unserialized 0x%lx %d\n", + (unsigned long)(entry->addr), (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__trace_write_log_message(trace_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_write_mark_unserialized_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_write_mark_serialized_entry_log_msg + * + * Purpose: Write a log message for marking cache entries as serialize. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, + herr_t fxn_ret_value) +{ + H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata); + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(trace_udata); + HDassert(trace_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_serialized 0x%lx %d\n", + (unsigned long)(entry->addr), (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__trace_write_log_message(trace_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_write_mark_serialized_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_write_move_entry_log_msg + * + * Purpose: Write a log message for moving a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr, + int type_id, herr_t fxn_ret_value) +{ + H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(trace_udata); + HDassert(trace_udata->message); + + /* Create the log message string */ + HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_move_entry 0x%lx 0x%lx %d %d\n", + (unsigned long)old_addr, (unsigned long)new_addr, type_id, (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__trace_write_log_message(trace_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_write_move_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_write_pin_entry_log_msg + * + * Purpose: Write a log message for pinning a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, + herr_t fxn_ret_value) +{ + H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(trace_udata); + HDassert(trace_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_pin_protected_entry 0x%lx %d\n", + (unsigned long)(entry->addr), (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__trace_write_log_message(trace_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_write_pin_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_write_create_fd_log_msg + * + * Purpose: Write a log message for creating a flush dependency between + * two cache entries. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, + const H5C_cache_entry_t *child, herr_t fxn_ret_value) +{ + H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(trace_udata); + HDassert(trace_udata->message); + HDassert(parent); + HDassert(child); + + /* Create the log message string */ + HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_create_flush_dependency 0x%lx 0x%lx %d\n", + (unsigned long)(parent->addr), (unsigned long)(child->addr), (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__trace_write_log_message(trace_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_write_create_fd_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_write_protect_entry_log_msg + * + * Purpose: Write a log message for protecting a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, + int type_id, unsigned flags, herr_t fxn_ret_value) +{ + H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(trace_udata); + HDassert(trace_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_protect 0x%lx %d 0x%x %d %d\n", + (unsigned long)(entry->addr), type_id, flags, (int)(entry->size), (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__trace_write_log_message(trace_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_write_protect_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_write_resize_entry_log_msg + * + * Purpose: Write a log message for resizing a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, + size_t new_size, herr_t fxn_ret_value) +{ + H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(trace_udata); + HDassert(trace_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_resize_entry 0x%lx %d %d\n", + (unsigned long)(entry->addr), (int)new_size, (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__trace_write_log_message(trace_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_write_resize_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_write_unpin_entry_log_msg + * + * Purpose: Write a log message for unpinning a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, + herr_t fxn_ret_value) +{ + H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(trace_udata); + HDassert(trace_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unpin_entry 0x%lx %d\n", + (unsigned long)(entry->addr), (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__trace_write_log_message(trace_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_write_unpin_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_write_destroy_fd_log_msg + * + * Purpose: Write a log message for destroying a flush dependency + * between two cache entries. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, + const H5C_cache_entry_t *child, herr_t fxn_ret_value) +{ + H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(trace_udata); + HDassert(trace_udata->message); + HDassert(parent); + HDassert(child); + + /* Create the log message string */ + HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_destroy_flush_dependency 0x%lx 0x%lx %d\n", + (unsigned long)(parent->addr), (unsigned long)(child->addr), (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__trace_write_log_message(trace_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_write_destroy_fd_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_write_unprotect_entry_log_msg + * + * Purpose: Write a log message for unprotecting a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_write_unprotect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, + int type_id, unsigned flags, herr_t fxn_ret_value) +{ + H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(trace_udata); + HDassert(trace_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unprotect 0x%lx %d 0x%x %d\n", + (unsigned long)(entry->addr), type_id, flags, (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__trace_write_log_message(trace_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_write_unprotect_entry_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_write_set_cache_config_log_msg + * + * Purpose: Write a log message for setting the cache configuration. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config, + herr_t fxn_ret_value) +{ + H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(trace_udata); + HDassert(trace_udata->message); + HDassert(config); + + /* Create the log message string */ + HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, + "H5AC_set_cache_auto_resize_config %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %f %f %d %d %d %f %f %d %d %d %d %f %zu %d %d\n", + config->version, + (int)(config->rpt_fcn_enabled), + (int)(config->open_trace_file), + (int)(config->close_trace_file), + config->trace_file_name, + (int)(config->evictions_enabled), + (int)(config->set_initial_size), + (int)(config->initial_size), + config->min_clean_fraction, + (int)(config->max_size), + (int)(config->min_size), + config->epoch_length, + (int)(config->incr_mode), + config->lower_hr_threshold, + config->increment, + (int)(config->flash_incr_mode), + config->flash_multiple, + config->flash_threshold, + (int)(config->apply_max_increment), + (int)(config->max_increment), + (int)(config->decr_mode), + config->upper_hr_threshold, + config->decrement, + (int)(config->apply_max_decrement), + (int)(config->max_decrement), + config->epochs_before_eviction, + (int)(config->apply_empty_reserve), + config->empty_reserve, + config->dirty_bytes_threshold, + config->metadata_write_strategy, + (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__trace_write_log_message(trace_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_write_set_cache_config_log_msg() */ + + +/*------------------------------------------------------------------------- + * Function: H5C__trace_write_remove_entry_log_msg + * + * Purpose: Write a log message for removing a cache entry. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, + herr_t fxn_ret_value) +{ + H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata); + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(trace_udata); + HDassert(trace_udata->message); + HDassert(entry); + + /* Create the log message string */ + HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_remove_entry 0x%lx %d\n", + (unsigned long)(entry->addr), (int)fxn_ret_value); + + /* Write the log message to the file */ + if(H5C__trace_write_log_message(trace_udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__trace_write_remove_entry_log_msg() */ + diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 98d7a01..9201afb 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -37,6 +37,7 @@ #include "H5Cprivate.h" /* Other private headers needed by this file */ +#include "H5Clog.h" /* Cache logging */ #include "H5SLprivate.h" /* Skip lists */ /**************************/ @@ -3497,40 +3498,8 @@ typedef struct H5C_tag_info_t { * flush_in_progress: Boolean flag indicating whether a flush is in * progress. * - * trace_file_ptr: File pointer pointing to the trace file, which is used - * to record cache operations for use in simulations and design - * studies. This field will usually be NULL, indicating that - * no trace file should be recorded. - * - * Since much of the code supporting the parallel metadata - * cache is in H5AC, we don't write the trace file from - * H5C. Instead, H5AC reads the trace_file_ptr as needed. - * - * When we get to using H5C in other places, we may add - * code to write trace file data at the H5C level as well. - * - * logging_enabled: Boolean flag indicating whether cache logging - * which is used to record cache operations for use in - * debugging and performance analysis. When this flag is set - * to TRUE, it means that the log file is open and ready to - * receive log entries. It does NOT mean that cache operations - * are currently being recorded. That is controlled by the - * currently_logging flag (below). - * - * Since much of the code supporting the parallel metadata - * cache is in H5AC, we don't write the trace file from - * H5C. Instead, H5AC reads the trace_file_ptr as needed. - * - * When we get to using H5C in other places, we may add - * code to write trace file data at the H5C level as well. - * - * currently_logging: Boolean flag that indicates if cache operations are - * currently being logged. This flag is flipped by the - * H5Fstart/stop_mdc_logging functions. - * - * log_file_ptr: File pointer pointing to the log file. The I/O functions - * in stdio.h are used to write to the log file regardless of - * the VFD selected. + * log_info: Information used by the MDC logging functionality. + * Described in H5Clog.h. * * aux_ptr: Pointer to void used to allow wrapper code to associate * its data with an instance of H5C_t. The H5C cache code @@ -4676,10 +4645,7 @@ typedef struct H5C_tag_info_t { struct H5C_t { uint32_t magic; hbool_t flush_in_progress; - FILE * trace_file_ptr; - hbool_t logging_enabled; - hbool_t currently_logging; - FILE * log_file_ptr; + H5C_log_info_t *log_info; void * aux_ptr; int32_t max_type_id; const H5C_class_t * const *class_table_ptr; diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 38a86ee..c39c1df 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -2219,6 +2219,12 @@ typedef struct H5C_cache_image_ctl_t { unsigned flags; } H5C_cache_image_ctl_t; +/* The cache logging output style */ +typedef enum H5C_log_style_t { + H5C_LOG_STYLE_JSON, + H5C_LOG_STYLE_TRACE +} H5C_log_style_t; + /***************************************/ /* Library-private Function Prototypes */ /***************************************/ @@ -2227,13 +2233,6 @@ H5_DLL H5C_t *H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, const H5C_class_t * const *class_table_ptr, H5C_write_permitted_func_t check_write_permitted, hbool_t write_permitted, H5C_log_flush_func_t log_flush, void *aux_ptr); -H5_DLL herr_t H5C_set_up_logging(H5C_t *cache_ptr, const char log_location[], hbool_t start_immediately); -H5_DLL herr_t H5C_tear_down_logging(H5C_t *cache_ptr); -H5_DLL herr_t H5C_start_logging(H5C_t *cache_ptr); -H5_DLL herr_t H5C_stop_logging(H5C_t *cache_ptr); -H5_DLL herr_t H5C_get_logging_status(const H5C_t *cache_ptr, /*OUT*/ hbool_t *is_enabled, - /*OUT*/ hbool_t *is_currently_logging); -H5_DLL herr_t H5C_write_log_message(const H5C_t *cache_ptr, const char message[]); H5_DLL void H5C_def_auto_resize_rpt_fcn(H5C_t *cache_ptr, int32_t version, double hit_rate, enum H5C_resize_status status, size_t old_max_cache_size, size_t new_max_cache_size, @@ -2267,8 +2266,6 @@ H5_DLL herr_t H5C_get_entry_status(const H5F_t *f, haddr_t addr, hbool_t *image_up_to_date_ptr); H5_DLL herr_t H5C_get_evictions_enabled(const H5C_t *cache_ptr, hbool_t *evictions_enabled_ptr); H5_DLL void * H5C_get_aux_ptr(const H5C_t *cache_ptr); -H5_DLL FILE *H5C_get_trace_file_ptr(const H5C_t *cache_ptr); -H5_DLL FILE *H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr); H5_DLL herr_t H5C_image_stats(H5C_t * cache_ptr, hbool_t print_header); H5_DLL herr_t H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, unsigned int flags); @@ -2292,7 +2289,6 @@ H5_DLL herr_t H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_image_ctl_t *config_ptr); H5_DLL herr_t H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled); H5_DLL herr_t H5C_set_prefix(H5C_t *cache_ptr, char *prefix); -H5_DLL herr_t H5C_set_trace_file_ptr(H5C_t *cache_ptr, FILE *trace_file_ptr); H5_DLL herr_t H5C_stats(H5C_t *cache_ptr, const char *cache_name, hbool_t display_detailed_stats); H5_DLL void H5C_stats__reset(H5C_t *cache_ptr); @@ -2316,6 +2312,11 @@ H5_DLL herr_t H5C_cache_image_status(H5F_t * f, hbool_t *load_ci_ptr, H5_DLL hbool_t H5C_cache_image_pending(const H5C_t *cache_ptr); H5_DLL herr_t H5C_get_mdc_image_info(H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len); +/* Logging functions */ +H5_DLL herr_t H5C_start_logging(H5C_t *cache); +H5_DLL herr_t H5C_stop_logging(H5C_t *cache); +H5_DLL herr_t H5C_get_logging_status(const H5C_t *cache, /*OUT*/ hbool_t *is_enabled, /*OUT*/ hbool_t *is_currently_logging); + #ifdef H5_HAVE_PARALLEL H5_DLL herr_t H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, haddr_t *candidates_list_ptr, int mpi_rank, diff --git a/src/H5Cquery.c b/src/H5Cquery.c index 6c927b0..68258a6 100644 --- a/src/H5Cquery.c +++ b/src/H5Cquery.c @@ -351,64 +351,6 @@ H5C_get_aux_ptr(const H5C_t *cache_ptr) /*------------------------------------------------------------------------- - * Function: H5C_get_trace_file_ptr - * - * Purpose: Get the trace_file_ptr field from the cache. - * - * This field will either be NULL (which indicates that trace - * file logging is turned off), or contain a pointer to the - * open file to which trace file data is to be written. - * - * Return: Non-NULL trace file pointer (can't fail) - * - * Programmer: John Mainzer - * 1/20/06 - * - *------------------------------------------------------------------------- - */ -FILE * -H5C_get_trace_file_ptr(const H5C_t *cache_ptr) -{ - FUNC_ENTER_NOAPI_NOERR - - /* Check arguments */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - - FUNC_LEAVE_NOAPI(cache_ptr->trace_file_ptr) -} /* H5C_get_trace_file_ptr() */ - - -/*------------------------------------------------------------------------- - * Function: H5C_get_trace_file_ptr_from_entry - * - * Purpose: Get the trace_file_ptr field from the cache, via an entry. - * - * This field will either be NULL (which indicates that trace - * file logging is turned off), or contain a pointer to the - * open file to which trace file data is to be written. - * - * Return: Non-NULL trace file pointer (can't fail) - * - * Programmer: Quincey Koziol - * 6/9/08 - * - *------------------------------------------------------------------------- - */ -FILE * -H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr) -{ - FUNC_ENTER_NOAPI_NOERR - - /* Sanity checks */ - HDassert(entry_ptr); - HDassert(entry_ptr->cache_ptr); - - FUNC_LEAVE_NOAPI(H5C_get_trace_file_ptr(entry_ptr->cache_ptr)) -} /* H5C_get_trace_file_ptr_from_entry() */ - - -/*------------------------------------------------------------------------- * Function: H5C_get_entry_ring * * Purpose: Given a file address, retrieve the ring for an entry at that @@ -220,8 +220,8 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* build and open the new dataset */ - if(NULL == (dset = H5D__create_anon(loc.oloc->file, type_id, space, dcpl_id, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") + if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") /* Register the new dataset to get an ID for it */ if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) @@ -481,8 +481,8 @@ H5Dget_create_plist(hid_t dset_id) if(NULL == (dataset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset") - if((ret_value = H5D__get_create_plist(dataset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "Can't get creation plist") + if((ret_value = H5D_get_create_plist(dataset)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "Can't get creation plist") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 3722475..a611440 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -513,7 +513,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters, hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Check args */ HDassert(dset && H5D_CHUNKED == layout->type); @@ -583,7 +583,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters, *filters = udata.filter_mask; done: - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__chunk_direct_read() */ @@ -608,7 +608,7 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage H5D_chunk_ud_t udata; /* User data for querying chunk info */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Check args */ HDassert(dset && H5D_CHUNKED == layout->type); @@ -681,7 +681,7 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage *storage_size = dset->shared->layout.u.chunk.size; done: - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5D__get_chunk_storage_size */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 5a90c94..ea4245b 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -59,7 +59,6 @@ static herr_t H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id, static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id); static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]); -static herr_t H5D__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size); static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id); static herr_t H5D__close_cb(H5D_t *dataset); static herr_t H5D__use_minimized_dset_headers(H5F_t *file, H5D_t *dset, hbool_t *minimize); @@ -303,7 +302,7 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, H5D_obj_create_t dcrt_info; /* Information for dataset creation */ H5D_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -334,52 +333,11 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, ret_value = (H5D_t *)ocrt_info.new_obj; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__create_named() */ /*------------------------------------------------------------------------- - * Function: H5D__create_anon - * - * Purpose: Internal routine to create a new anonymous dataset. - * - * Note: This routine is needed so that there's a non-API routine for - * creating datasets that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-NULL, pointer to new dataset object. - * Failure: NULL - * - * Programmer: Quincey Koziol - * December 9, 2017 - * - *------------------------------------------------------------------------- - */ -H5D_t * -H5D__create_anon(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, - hid_t dapl_id) -{ - H5D_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(file); - HDassert(type_id != H5P_DEFAULT); - HDassert(space); - HDassert(dcpl_id != H5P_DEFAULT); - HDassert(dapl_id != H5P_DEFAULT); - - /* Build and open the dataset */ - if(NULL == (ret_value = H5D__create(file, type_id, space, dcpl_id, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5D__create_anon() */ - - -/*------------------------------------------------------------------------- * Function: H5D__get_space_status * * Purpose: Returns the status of dataspace allocation. @@ -394,7 +352,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation) { herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(dset); @@ -427,7 +385,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation) HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed") /* Difficult to error check, since the error value is 0 and 0 is a valid value... :-/ */ - if(H5D__get_storage_size_real(dset, &space_allocated) < 0) + if(H5D__get_storage_size(dset, &space_allocated) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage") /* Decide on how much of the space is allocated */ @@ -448,7 +406,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation) } /* end else */ done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__get_space_status() */ @@ -1410,7 +1368,7 @@ H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id) hbool_t loc_found = FALSE; /* Location at 'name' found */ H5D_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(loc); @@ -1444,7 +1402,7 @@ done: if(loc_found && H5G_loc_free(&dset_loc) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__open_name() */ @@ -1838,7 +1796,7 @@ H5D__close_cb(H5D_t *dataset) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* check args */ HDassert(dataset && dataset->oloc.file && dataset->shared); @@ -1849,7 +1807,7 @@ H5D__close_cb(H5D_t *dataset) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close dataset"); done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__close_cb() */ @@ -2483,7 +2441,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__get_storage_size_real + * Function: H5D__get_storage_size * * Purpose: Determines how much space has been reserved to store the raw * data of a dataset. @@ -2491,8 +2449,8 @@ done: * Return: Non-negative on success, negative on failure *------------------------------------------------------------------------- */ -static herr_t -H5D__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size) +herr_t +H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2534,35 +2492,6 @@ H5D__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size) done: FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5D__get_storage_size_real() */ - - -/*------------------------------------------------------------------------- - * Function: H5D__get_storage_size - * - * Purpose: Determines how much space has been reserved to store the raw - * data of a dataset. - * - * Note: This routine is needed so that there's a non-API routine for - * creating attributes that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Non-negative on success, negative on failure - *------------------------------------------------------------------------- - */ -herr_t -H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Difficult to error check, since the error value is 0 and 0 is a valid value... :-/ */ - if(H5D__get_storage_size_real(dset, storage_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) } /* end H5D__get_storage_size() */ @@ -2807,7 +2736,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) unsigned dim_idx; /* Dimension index */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Check args */ HDassert(dset); @@ -2968,7 +2897,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) } /* end if */ done: - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__set_extent() */ @@ -3054,7 +2983,7 @@ H5D__flush(H5D_t *dset, hid_t dset_id) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(dset); @@ -3069,7 +2998,7 @@ H5D__flush(H5D_t *dset, hid_t dset_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset and object flush callback") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__flush() */ @@ -3094,7 +3023,7 @@ H5D__format_convert(H5D_t *dataset) hbool_t add_new_layout = FALSE; /* Indicate that the new layout message is added */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dataset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr) /* Check args */ HDassert(dataset); @@ -3220,7 +3149,7 @@ done: if(newlayout != NULL) newlayout = (H5O_layout_t *)H5MM_xfree(newlayout); - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__format_convert() */ @@ -3347,44 +3276,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__get_create_plist - * - * Purpose: Internal routine to retrieve a dataset's creation property list. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: ID for a copy of the dataset creation property - * list. The property list ID should be released - * by calling H5Pclose(). - * - * Failure: FAIL - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -hid_t -H5D__get_create_plist(const H5D_t *dset) -{ - hid_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(dset); - - /* Retrieve the DCPL */ - if((ret_value = H5D_get_create_plist(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset's creation property list") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5D__get_create_plist() */ - - -/*------------------------------------------------------------------------- * Function: H5D_get_create_plist * * Purpose: Private function for H5Dget_create_plist @@ -3643,7 +3534,7 @@ H5D__get_space(const H5D_t *dset) H5S_t *space = NULL; hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* If the layout is virtual, update the extent */ if(dset->shared->layout.type == H5D_VIRTUAL) @@ -3664,7 +3555,7 @@ done: if(H5S_close(space) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__get_space() */ @@ -3729,7 +3620,7 @@ H5D__refresh(hid_t dset_id, H5D_t *dset) hbool_t virt_dsets_held = FALSE; /* Whether virtual datasets' files are held open */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(dset); @@ -3757,6 +3648,6 @@ done: if(H5D__virtual_release_source_dset_files(head) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't release VDS source files held open") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__refresh() */ diff --git a/src/H5Dio.c b/src/H5Dio.c index 5fea91f..ed384ca 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -449,7 +449,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, char fake_char; /* Temporary variable for NULL buffer pointers */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL_TAG(dataset->oloc.addr) + FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr) /* check args */ HDassert(dataset && dataset->oloc.file); @@ -616,7 +616,7 @@ done: if(H5S_close(projected_mem_space) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down projected memory dataspace") - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__read() */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index ee70bae..4409142 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -555,8 +555,6 @@ H5_DLL H5D_t *H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, H5_DLL H5D_t *H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, const H5S_t *space, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id); -H5_DLL H5D_t *H5D__create_anon(H5F_t *file, hid_t type_id, const H5S_t *space, - hid_t dcpl_id, hid_t dapl_id); H5_DLL H5D_t *H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id); H5_DLL hid_t H5D__get_space(const H5D_t *dset); H5_DLL hid_t H5D__get_type(const H5D_t *dset); @@ -578,7 +576,6 @@ H5_DLL herr_t H5D__set_extent(H5D_t *dataset, const hsize_t *size); H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset); H5_DLL herr_t H5D__flush_real(H5D_t *dataset); H5_DLL herr_t H5D__flush(H5D_t *dset, hid_t dset_id); -H5_DLL hid_t H5D__get_create_plist(const H5D_t *dset); H5_DLL herr_t H5D__mark(const H5D_t *dataset, unsigned flags); H5_DLL herr_t H5D__refresh(hid_t dset_id, H5D_t *dataset); @@ -440,7 +440,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; /* Create a new file or truncate an existing file. */ - if (NULL == (new_file = H5F__create(filename, flags, fcpl_id, fapl_id))) + if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") /* Get an atom for the file */ @@ -505,7 +505,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Open the file */ - if(NULL == (new_file = H5F__open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) + if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") /* Get an atom for the file */ @@ -621,15 +621,22 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) * to be flushed. */ if(H5F_ACC_RDWR & H5F_INTENT(f)) { - hid_t fapl_id = H5P_DEFAULT; /* FAPL to use */ + hid_t fapl_id = H5P_DEFAULT; /* FAPL to use */ /* Verify access property list and set up collective metadata if appropriate */ if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, object_id, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access property list info") - /* Flush the file */ - if(H5F__flush(f, scope) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") + /* Flush other files, depending on scope */ + if(H5F_SCOPE_GLOBAL == scope) { + /* Call the flush routine for mounted file hierarchies */ + if(H5F_flush_mounts(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") + } /* end if */ + else + /* Call the flush routine, for this file */ + if(H5F__flush(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") } /* end if */ done: @@ -796,9 +803,9 @@ H5Fget_freespace(hid_t file_id) if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - /* Get the free space in the file */ - if(H5F__get_freespace(file, &tot_space) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + /* Go get the actual amount of free space in the file */ + if(H5MF_get_freespace(file, &tot_space, NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free space for file") ret_value = (hssize_t)tot_space; @@ -1273,7 +1280,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "nsects must be > 0") /* Get the free-space section information in the file */ - if((ret_value = H5F__get_free_sections(file, type, nsects, sect_info)) < 0) + if((ret_value = H5MF_get_free_sections(file, type, nsects, sect_info)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") done: @@ -1375,7 +1382,7 @@ H5Fstart_mdc_logging(hid_t file_id) /* Call mdc logging function */ if(H5C_start_logging(file->shared->cache) < 0) - HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging") + HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to start mdc logging") done: FUNC_LEAVE_API(ret_value) @@ -1407,7 +1414,7 @@ H5Fstop_mdc_logging(hid_t file_id) /* Call mdc logging function */ if(H5C_stop_logging(file->shared->cache) < 0) - HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging") + HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to stop mdc logging") done: FUNC_LEAVE_API(ret_value) @@ -1438,9 +1445,9 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") - /* Call mdc logging function */ + /* Call MDC logging function */ if(H5C_get_logging_status(file->shared->cache, is_enabled, is_currently_logging) < 0) - HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status") + HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to get logging status") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Fefc.c b/src/H5Fefc.c index 07bb644..a394071 100644 --- a/src/H5Fefc.c +++ b/src/H5Fefc.c @@ -481,7 +481,7 @@ H5F__efc_release(H5F_efc_t *efc) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(efc); @@ -491,7 +491,7 @@ H5F__efc_release(H5F_efc_t *efc) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't remove entry from external file cache") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_efc_release() */ diff --git a/src/H5Fint.c b/src/H5Fint.c index 08f993a..39dc1c5 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -822,7 +822,7 @@ H5F__is_hdf5(const char *name) haddr_t sig_addr; /* Addess of hdf5 file signature */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Open the file at the virtual file layer */ if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF))) @@ -839,7 +839,7 @@ done: if(H5FD_close(file) < 0 && ret_value >= 0) HDONE_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__is_hdf5() */ @@ -1360,78 +1360,6 @@ H5F__dest(H5F_t *f, hbool_t flush) /*------------------------------------------------------------------------- - * Function: H5F__create - * - * Purpose: Internal routine to create a file. - * - * Note: This routine is needed so that there's a non-API routine for - * creating files that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-NULL, pointer to new file object. - * Failure: NULL - * - * Programmer: Quincey Koziol - * December 13, 2017 - * - *------------------------------------------------------------------------- - */ -H5F_t * -H5F__create(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) -{ - H5F_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(filename); - - /* Create a new file or truncate an existing file. */ - if(NULL == (ret_value = H5F_open(filename, flags, fcpl_id, fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5F__create() */ - - -/*------------------------------------------------------------------------- - * Function: H5F__open - * - * Purpose: Internal routine to open a file. - * - * Note: This routine is needed so that there's a non-API routine for - * opening files that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-NULL, pointer to new file object. - * Failure: NULL - * - * Programmer: Quincey Koziol - * December 13, 2017 - * - *------------------------------------------------------------------------- - */ -H5F_t * -H5F__open(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) -{ - H5F_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(filename); - - /* Open the file */ - if(NULL == (ret_value = H5F_open(filename, flags, fcpl_id, fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5F__open() */ - - -/*------------------------------------------------------------------------- * Function: H5F_open * * Purpose: Opens (or creates) a file. This function understands the @@ -1953,7 +1881,7 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) /*------------------------------------------------------------------------- - * Function: H5F__flush_real + * Function: H5F__flush * * Purpose: Flushes cached data. * @@ -1961,7 +1889,7 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) *------------------------------------------------------------------------- */ herr_t -H5F__flush_real(H5F_t *f) +H5F__flush(H5F_t *f) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1981,49 +1909,6 @@ H5F__flush_real(H5F_t *f) HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush file data") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F__flush_real() */ - - -/*------------------------------------------------------------------------- - * Function: H5F__flush - * - * Purpose: Internal routine to flush a file. - * - * Note: This routine is needed so that there's a non-API routine for - * flushing files that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * December 13, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5F__flush(H5F_t *f, H5F_scope_t scope) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(f); - HDassert(f->shared); - - /* Flush other files, depending on scope */ - if(H5F_SCOPE_GLOBAL == scope) { - /* Call the flush routine for mounted file hierarchies */ - if(H5F_flush_mounts(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") - } /* end if */ - else - /* Call the flush routine, for this file */ - if(H5F__flush_real(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) } /* end H5F__flush() */ @@ -2032,10 +1917,6 @@ done: * * Purpose: Internal routine to close a file. * - * Note: This routine is needed so that there's a non-API routine for - * closing files that can set up VOL / SWMR info - * (which need a DXPL). - * * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol @@ -2049,7 +1930,7 @@ H5F__close(hid_t file_id) H5F_t *f; /* File pointer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Flush file if this is the last reference to this id and we have write * intent, unless it will be flushed by the "shared" file being closed. @@ -2064,7 +1945,7 @@ H5F__close(hid_t file_id) if((nref = H5I_get_ref(file_id, FALSE)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get ID ref count") if(nref == 1) - if(H5F__flush_real(f) < 0) + if(H5F__flush(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cache") } /* end if */ @@ -2074,7 +1955,7 @@ H5F__close(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "decrementing file ID failed") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__close() */ @@ -2100,7 +1981,7 @@ H5F__close_cb(H5F_t *f) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -2132,7 +2013,7 @@ H5F__close_cb(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__close_cb() */ @@ -2807,7 +2688,7 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(f); @@ -2835,7 +2716,7 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high) * * QAK - April, 2018 */ - if(H5F__flush_real(f) < 0) + if(H5F__flush(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") /* Set the new bounds */ @@ -2849,45 +2730,10 @@ done: /*------------------------------------------------------------------------- - * Function: H5F__get_freespace - * - * Purpose: Private version of H5Fget_freespace - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: SUCCEED - * Failure: FAIL - *------------------------------------------------------------------------- - */ -herr_t -H5F__get_freespace(H5F_t *f, hsize_t *tot_space) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(f); - HDassert(f->shared); - - /* Go get the actual amount of free space in the file */ - if(H5MF_get_freespace(f, tot_space, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5F__get_freespace() */ - - -/*------------------------------------------------------------------------- * Function: H5F__get_file_image * * Purpose: Private version of H5Fget_file_image * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Bytes copied / number of bytes needed. * Failure: negative value *------------------------------------------------------------------------- @@ -2899,7 +2745,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) haddr_t eoa; /* End of file address */ ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ if(!file || !file->shared || !file->shared->lf) @@ -2986,7 +2832,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) } /* end if */ done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5F__get_file_image() */ @@ -2995,9 +2841,6 @@ done: * * Purpose: Private version of H5Fget_info * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: SUCCEED * Failure: FAIL *------------------------------------------------------------------------- @@ -3007,7 +2850,7 @@ H5F__get_info(H5F_t *f, H5F_info2_t *finfo) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -3036,7 +2879,7 @@ H5F__get_info(H5F_t *f, H5F_info2_t *finfo) finfo->free.version = HDF5_FREESPACE_VERSION; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5F__get_info() */ @@ -3125,39 +2968,6 @@ H5F_set_retries(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F__get_free_sections - * - * Purpose: Private version of H5Fget_free_sections - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: non-negative, the total # of free space sections - * Failure: negative - *------------------------------------------------------------------------- - */ -ssize_t -H5F__get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, - H5F_sect_info_t *sect_info) -{ - ssize_t ret_value = -1; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(f); - HDassert(f->shared); - - /* Go get the actual amount of free space in the file */ - if((ret_value = H5MF_get_free_sections(f, type, nsects, sect_info)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free space sections for file") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5F__get_free_sections() */ - - -/*------------------------------------------------------------------------- * Function: H5F_object_flush_cb * * Purpose: To invoke the callback function for object flush that is set @@ -3453,9 +3263,6 @@ done: * set up flush dependency/proxy even for file opened without * SWMR to resolve issues with opened objects. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: SUCCEED * Failure: FAIL *------------------------------------------------------------------------- @@ -3475,7 +3282,7 @@ H5F__start_swmr_write(H5F_t *f) hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -3508,7 +3315,7 @@ H5F__start_swmr_write(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock extension") /* Flush data buffers */ - if(H5F__flush_real(f) < 0) + if(H5F__flush(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush f's cached information") /* Get the # of opened named datatypes and attributes */ @@ -3644,7 +3451,7 @@ done: if(obj_paths) H5MM_xfree(obj_paths); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5F__start_swmr_write() */ @@ -3653,9 +3460,6 @@ done: * * Purpose: Private version of H5Fformat_convert * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: SUCCEED * Failure: FAIL *------------------------------------------------------------------------- @@ -3666,7 +3470,7 @@ H5F__format_convert(H5F_t *f) hbool_t mark_dirty = FALSE; /* Whether to mark the file's superblock dirty */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(f); @@ -3709,6 +3513,6 @@ H5F__format_convert(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5F__format_convert() */ diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 4cd1edf..b04bd3a 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -112,7 +112,7 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED H5G_loc_t root_loc; /* Group location of root of file to mount */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(loc); HDassert(name && *name); @@ -240,7 +240,7 @@ done: } } - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__mount() */ @@ -277,7 +277,7 @@ H5F__unmount(H5G_loc_t *loc, const char *name) int child_idx; /* Index of child in parent's mtab */ herr_t ret_value = SUCCEED; /*return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(loc); HDassert(name && *name); @@ -390,7 +390,7 @@ done: if(mp_loc_setup) H5G_loc_free(&mp_loc); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__unmount() */ @@ -651,7 +651,7 @@ H5F_flush_mounts_recurse(H5F_t *f) nerrors++; /* Call the "real" flush routine, for this file */ - if(H5F__flush_real(f) < 0) + if(H5F__flush(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") /* Check flush errors for children - errors are already on the stack */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 6dfabbd..663f84e 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -395,16 +395,11 @@ H5FL_EXTERN(H5F_file_t); /* General routines */ H5_DLL H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush); -H5_DLL H5F_t *H5F__create(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id); -H5_DLL H5F_t *H5F__open(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id); -H5_DLL herr_t H5F__flush(H5F_t *f, H5F_scope_t scope); -H5_DLL herr_t H5F__flush_real(H5F_t *f); +H5_DLL herr_t H5F__flush(H5F_t *f); H5_DLL htri_t H5F__is_hdf5(const char *name); H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); -H5_DLL herr_t H5F__get_freespace(H5F_t *f, hsize_t *tot_space); H5_DLL ssize_t H5F__get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len); H5_DLL herr_t H5F__get_info(H5F_t *f, H5F_info2_t *finfo); -H5_DLL ssize_t H5F__get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info); H5_DLL herr_t H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info); H5_DLL herr_t H5F__format_convert(H5F_t *f); H5_DLL herr_t H5F__start_swmr_write(H5F_t *f); @@ -400,10 +400,10 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); /* Create the new group & get its ID */ - if(NULL == (grp = H5G__create_anon(loc.oloc->file, &gcrt_info))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") + if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info))) + HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create group") if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: /* Release the group's object header, if it was created */ @@ -509,10 +509,11 @@ H5Gget_create_plist(hid_t group_id) /* Check args */ if(NULL == (group = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group") - if((ret_value = H5G__get_create_plist(group)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") + /* Retrieve the GCPL */ + if((ret_value = H5G_get_create_plist(group)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") done: FUNC_LEAVE_API(ret_value) @@ -554,7 +555,7 @@ H5Gget_info(hid_t grp_id, H5G_info_t *grp_info) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Retrieve the group's information */ - if(H5G__get_info(&loc, grp_info/*out*/) < 0) + if(H5G__obj_info(loc.oloc, grp_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -722,9 +723,9 @@ H5Gflush(hid_t group_id) if(H5CX_set_loc(group_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Flush group's metadata to file */ - if(H5G__flush(grp, group_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") + /* Flush metadata to file */ + if(H5O_flush_common(&grp->oloc, group_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group and object flush callback") done: FUNC_LEAVE_API(ret_value) @@ -761,7 +762,7 @@ H5Grefresh(hid_t group_id) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Call private function to refresh group object */ - if((H5G__refresh(grp, group_id)) < 0) + if((H5O_refresh_metadata(group_id, grp->oloc)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") done: diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index f6c6d8f..57bbcd9 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -76,24 +76,11 @@ static herr_t H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_id, const char *new_name, hid_t lcpl_id); static herr_t H5G__move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, hid_t lcpl_id); -static herr_t H5G__unlink(H5G_loc_t *loc, const char *name); -static herr_t H5G__get_linkval(const H5G_loc_t *loc, const char *name, size_t size, - char *buf/*out*/); -static herr_t H5G__set_comment(const H5G_loc_t *loc, const char *name, - const char *comment); -static int H5G__get_comment(const H5G_loc_t *loc, const char *name, char *buf, - size_t bufsize); -static herr_t H5G__iterate(hid_t loc_id, const char *name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, hsize_t *last_lnk, - const H5G_link_iterate_t *lnk_op, void *op_data); -static herr_t H5G__get_num_objs(const H5O_loc_t *oloc, H5G_info_t *grp_info); static herr_t H5G__get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); static herr_t H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, H5G_stat_t *statbuf/*out*/); -static ssize_t H5G__get_objname_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, char *name, size_t size); static H5G_obj_t H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx); #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -197,9 +184,9 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") /* Check if we need to create a non-standard GCPL */ if(size_hint > 0) { @@ -238,7 +225,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) if(NULL == (grp = H5G__create_named(&loc, name, H5P_LINK_CREATE_DEFAULT, tmp_gcpl))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") done: if(tmp_gcpl > 0 && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT) @@ -321,9 +308,9 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new /* Check arguments */ if(!cur_name || !*cur_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") if(!new_name || !*new_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(cur_loc_id) < 0) @@ -357,9 +344,9 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, /* Check arguments */ if(!cur_name || !*cur_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") if(!new_name || !*new_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(cur_loc_id) < 0) @@ -393,7 +380,7 @@ H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, H5G_loc_t new_loc; /* Information about new link's group */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Create the appropriate kind of link */ if(type == H5L_TYPE_HARD) { @@ -441,7 +428,7 @@ H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "Not a valid link type") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__link() */ @@ -531,7 +518,7 @@ H5G__move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5G_loc_t dst_loc, *dst_loc_p; /* Group info for destination location */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0) @@ -553,10 +540,10 @@ H5G__move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Move the link */ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") + HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__move() */ @@ -578,16 +565,16 @@ H5Gunlink(hid_t loc_id, const char *name) /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine */ - if(H5G__unlink(&loc, name) < 0) + /* Call H5L routine... */ + if(H5L_delete(&loc, name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") done: @@ -596,37 +583,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__unlink - * - * Purpose: Internal version of H5Gunlink. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__unlink(H5G_loc_t *loc, const char *name) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Call H5L routine... */ - if(H5L_delete(loc, name) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__unlink() */ - - -/*------------------------------------------------------------------------- * Function: H5Gget_linkval * * Purpose: Retrieve's a soft link's data. The new API is @@ -645,53 +601,21 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) /* Check arguments */ if(H5G_loc(loc_id, &loc)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine */ - if(H5G__get_linkval(&loc, name, size, buf) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Gget_linkval() */ - - -/*------------------------------------------------------------------------- - * Function: H5G__get_linkval - * - * Purpose: Internal version of H5Gget_linkval. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__get_linkval(const H5G_loc_t *loc, const char *name, size_t size, - char *buf/*out*/) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - /* Call the link routine which provides this capability */ - if(H5L_get_val(loc, name, buf, size) < 0) + if(H5L_get_val(&loc, name, buf, size) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_linkval() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Gget_linkval() */ /*------------------------------------------------------------------------- @@ -721,17 +645,17 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) H5TRACE3("e", "i*s*s", loc_id, name, comment); if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine */ - if(H5G__set_comment(&loc, name, comment) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") + /* Call the common routine which provides this capability */ + if(H5G_loc_set_comment(&loc, name, comment) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") done: FUNC_LEAVE_API(ret_value) @@ -739,37 +663,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__set_comment - * - * Purpose: Internal version of H5Gset_comment. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__set_comment(const H5G_loc_t *loc, const char *name, const char *comment) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Call the common routine which provides this capability */ - if(H5G_loc_set_comment(loc, name, comment) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__set_comment() */ - - -/*------------------------------------------------------------------------- * Function: H5Gget_comment * * Purpose: Return at most BUFSIZE characters of the comment for the @@ -802,19 +695,19 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) H5TRACE4("Is", "i*sz*s", loc_id, name, bufsize, buf); if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") if(bufsize > 0 && !buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified") /* Set up collective metadata if appropriate */ if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal routine */ - if((ret_value = H5G__get_comment(&loc, name, buf, bufsize)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value") + /* Call the common routine which provides this capability */ + if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value") done: FUNC_LEAVE_API(ret_value) @@ -822,38 +715,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__get_comment - * - * Purpose: Internal version of H5Gget_comment. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static int -H5G__get_comment(const H5G_loc_t *loc, const char *name, char *buf, - size_t bufsize) -{ - int ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Call the common routine which provides this capability */ - if((ret_value = (int)H5G_loc_get_comment(loc, name, buf, bufsize)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_comment() */ - - -/*------------------------------------------------------------------------- * Function: H5Giterate * * Purpose: Iterates over the entries of a group. The LOC_ID and NAME @@ -905,8 +766,8 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, lnk_op.op_type = H5G_LINK_OP_OLD; lnk_op.op_func.op_old = op; - /* Call private function. */ - if((ret_value = H5G__iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0) + /* Call the common routine which provides this capability */ + if((ret_value = H5G_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") /* Set the index we stopped at */ @@ -919,39 +780,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__iterate - * - * Purpose: Internal version of H5Giterate. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__iterate(hid_t loc_id, const char *name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, hsize_t *last_lnk, - const H5G_link_iterate_t *lnk_op, void *op_data) -{ - herr_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Call the common routine which provides this capability */ - if((ret_value = H5G_iterate(loc_id, name, idx_type, order, idx, last_lnk, lnk_op, op_data)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__iterate() */ - - -/*------------------------------------------------------------------------- * Function: H5Gget_num_objs * * Purpose: Returns the number of objects in the group. It iterates @@ -970,22 +798,27 @@ done: herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) { - H5G_loc_t loc; /* Location of object */ - H5G_info_t grp_info; /* Group information */ - herr_t ret_value = SUCCEED; + H5G_loc_t loc; /* Location of object */ + H5G_info_t grp_info; /* Group information */ + H5O_type_t obj_type; /* Type of object at location */ + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", loc_id, num_objs); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") + if(H5O_obj_type(loc.oloc, &obj_type) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") + if(obj_type != H5O_TYPE_GROUP) + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") if(!num_objs) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "bad pointer to # of objects") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "bad pointer to # of objects") - /* Call the internal routine */ - if(H5G__get_num_objs(loc.oloc, &grp_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine") + /* Retrieve information about the group */ + if(H5G__obj_info(loc.oloc, &grp_info) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine # of objects") /* Set the number of objects [sic: links] in the group */ *num_objs = grp_info.nlinks; @@ -996,44 +829,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__get_num_objs - * - * Purpose: Internal version of H5Gget_num_objs. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G__get_num_objs(const H5O_loc_t *oloc, H5G_info_t *grp_info) -{ - H5O_type_t obj_type; /* Type of object at location */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check args */ - if(H5O_obj_type(oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") - if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") - - /* Retrieve information about the group */ - if(H5G__obj_info(oloc, grp_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine # of objects") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_num_objs() */ - - -/*------------------------------------------------------------------------- * Function: H5Gget_objinfo * * Purpose: Returns information about an object. If FOLLOW_LINK is @@ -1062,13 +857,13 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, /* Check arguments */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified") /* Get info */ if(H5G__get_objinfo(&loc, name, follow_link, statbuf) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object") done: FUNC_LEAVE_API(ret_value) @@ -1177,7 +972,7 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, H5G_trav_goi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Sanity checks */ HDassert(loc); @@ -1220,7 +1015,7 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, } /* end if */ done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__get_objinfo() */ @@ -1250,62 +1045,28 @@ done: ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) { - H5G_loc_t loc; /* Object location */ - ssize_t ret_value; + H5G_loc_t loc; /* Object location */ + H5O_type_t obj_type; /* Type of object at location */ + ssize_t ret_value; FUNC_ENTER_API(FAIL) H5TRACE4("Zs", "ih*sz", loc_id, idx, name, size); /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") - - /* Call internal function */ - if((ret_value = H5G__get_objname_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "can't get object name") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Gget_objname_by_idx() */ - - -/*------------------------------------------------------------------------- - * Function: H5G__get_objname_by_idx - * - * Purpose: Internal version of H5Gget_objname_by_idx. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Saturday, December 23, 2017 - * - *------------------------------------------------------------------------- - */ -static ssize_t -H5G__get_objname_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, - H5_iter_order_t order, hsize_t idx, char *name, size_t size) -{ - H5O_type_t obj_type; /* Type of object at location */ - ssize_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check args */ - if(H5O_obj_type(oloc, &obj_type) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID") + if(H5O_obj_type(loc.oloc, &obj_type) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") if(obj_type != H5O_TYPE_GROUP) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") /* Call common routine */ - if((ret_value = H5G_obj_get_name_by_idx(oloc, idx_type, order, idx, name, size)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object name") + if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object name") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_objname_by_idx() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Gget_objname_by_idx() */ /*------------------------------------------------------------------------- @@ -1334,11 +1095,11 @@ H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID") /* Call internal function*/ if(H5G_UNKNOWN == (ret_value = H5G__obj_get_type_by_idx(loc.oloc, idx))) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object type") + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object type") done: FUNC_LEAVE_API(ret_value) @@ -1368,7 +1129,7 @@ H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx) H5O_type_t obj_type; /* Type of object at location */ H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ - FUNC_ENTER_STATIC_VOL_TAG(oloc->addr) + FUNC_ENTER_STATIC_TAG(oloc->addr) /* Sanity check */ HDassert(oloc); @@ -1401,7 +1162,7 @@ H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx) } /* end else */ done: - FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5G__obj_get_type_by_idx() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Gint.c b/src/H5Gint.c index 3b5de44..8fd7514 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -134,7 +134,7 @@ H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, H5G_obj_create_t gcrt_info; /* Information for group creation */ H5G_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -161,48 +161,11 @@ H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, ret_value = (H5G_t *)ocrt_info.new_obj; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__create_named() */ /*------------------------------------------------------------------------- - * Function: H5G__create_anon - * - * Purpose: Internal routine to create a new anonymous group. - * - * Note: This routine is needed so that there's a non-API routine for - * creating groups that can set up VOL / SWMR info - * (which need a DXPL). - * - * Return: Success: Non-NULL, pointer to new group object. - * Failure: NULL - * - * Programmer: Quincey Koziol - * December 17, 2017 - * - *------------------------------------------------------------------------- - */ -H5G_t * -H5G__create_anon(H5F_t *file, H5G_obj_create_t *gcrt_info) -{ - H5G_t *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(file); - HDassert(gcrt_info); - - /* Create the new group & get its ID */ - if(NULL == (ret_value = H5G__create(file, gcrt_info))) - HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, NULL, "unable to create group") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__create_anon() */ - - -/*------------------------------------------------------------------------- * Function: H5G__create * * Purpose: Creates a new empty group with the specified name. The name @@ -302,7 +265,7 @@ H5G__open_name(const H5G_loc_t *loc, const char *name) H5O_type_t obj_type; /* Type of object at location */ H5G_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(loc); @@ -336,7 +299,7 @@ done: if(loc_found && H5G_loc_free(&grp_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, NULL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__open_name() */ @@ -502,7 +465,7 @@ H5G__close_cb(H5G_t *grp) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(grp && grp->shared); @@ -513,7 +476,7 @@ H5G__close_cb(H5G_t *grp) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "problem closing group") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__close_cb() */ @@ -1239,44 +1202,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__get_create_plist - * - * Purpose: Internal routine to retrieve a group's creation property list. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: ID for a copy of the group creation property - * list. The property list ID should be released - * by calling H5Pclose(). - * - * Failure: H5I_INVALID_HID - * - * Programmer: Quincey Koziol - * December 17, 2017 - * - *------------------------------------------------------------------------- - */ -hid_t -H5G__get_create_plist(const H5G_t *grp) -{ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(grp); - - /* Retrieve the GCPL */ - if((ret_value = H5G_get_create_plist(grp)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_create_plist() */ - - -/*------------------------------------------------------------------------- * Function: H5G_get_create_plist * * Purpose: Private function for H5Gget_create_plist @@ -1372,51 +1297,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__get_info - * - * Purpose: Internal routine to retrieve the info for a group. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__get_info(const H5G_loc_t *loc, H5G_info_t *grp_info) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(grp_info); - - /* Retrieve the group's information */ - if(H5G__obj_info(loc->oloc, grp_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5G__get_info() */ - - -/*------------------------------------------------------------------------- * Function: H5G__get_info_by_name * * Purpose: Internal routine to retrieve the info for a group, by name. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 18, 2017 @@ -1432,7 +1317,7 @@ H5G__get_info_by_name(const H5G_loc_t *loc, const char *name, H5G_info_t *grp_in hbool_t loc_found = FALSE; /* Location at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -1457,7 +1342,7 @@ done: if(loc_found && H5G_loc_free(&grp_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__get_info_by_name() */ @@ -1466,11 +1351,7 @@ done: * * Purpose: Internal routine to retrieve the info for a group, by index. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * December 18, 2017 @@ -1487,7 +1368,7 @@ H5G__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, hbool_t loc_found = FALSE; /* Location at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -1512,76 +1393,6 @@ done: if(loc_found && H5G_loc_free(&grp_loc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__get_info_by_idx() */ - -/*------------------------------------------------------------------------- - * Function: H5G__flush - * - * Purpose: Internal routine to flushes a group to disk. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__flush(H5G_t *grp, hid_t group_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(grp); - - /* Flush metadata to file */ - if(H5O_flush_common(&grp->oloc, group_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group and object flush callback") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5G__flush */ - - -/*------------------------------------------------------------------------- - * Function: H5G__refresh - * - * Purpose: Internal routine to refresh a group. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__refresh(H5G_t *grp, hid_t group_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Sanity check */ - HDassert(grp); - - /* Call private function to refresh group object */ - if((H5O_refresh_metadata(group_id, grp->oloc)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5G__refresh */ - diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index f0a9aea..b89777d 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -331,16 +331,11 @@ H5FL_EXTERN(H5G_shared_t); H5_DLL H5G_t *H5G__create(H5F_t *file, H5G_obj_create_t *gcrt_info); H5_DLL H5G_t *H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, hid_t gcpl_id); -H5_DLL H5G_t *H5G__create_anon(H5F_t *file, H5G_obj_create_t *gcrt_info); H5_DLL H5G_t *H5G__open_name(const H5G_loc_t *loc, const char *name); -H5_DLL hid_t H5G__get_create_plist(const H5G_t *grp); -H5_DLL herr_t H5G__get_info(const H5G_loc_t *loc, H5G_info_t *grp_info); H5_DLL herr_t H5G__get_info_by_name(const H5G_loc_t *loc, const char *name, H5G_info_t *grp_info); H5_DLL herr_t H5G__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5G_info_t *grp_info); -H5_DLL herr_t H5G__flush(H5G_t *grp, hid_t group_id); -H5_DLL herr_t H5G__refresh(H5G_t *grp, hid_t group_id); H5_DLL herr_t H5G__close_cb(H5G_t *grp); /* @@ -26,28 +26,22 @@ */ #include "H5Imodule.h" /* This source code file is part of the H5I module */ +#define H5T_FRIEND /* Suppress error about including H5Tpkg */ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ #include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ +#include "H5Gprivate.h" /* Groups */ #include "H5Ipkg.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* Object headers */ #include "H5SLprivate.h" /* Skip Lists */ +#include "H5Tpkg.h" /* Datatypes */ -/* Define this to compile in support for dumping ID information */ -/* #define H5I_DEBUG_OUTPUT */ -#ifndef H5I_DEBUG_OUTPUT -#include "H5Gprivate.h" /* Groups */ -#else /* H5I_DEBUG_OUTPUT */ -#define H5G_FRIEND /* Suppress error about including H5Gpkg */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Tprivate.h" /* Datatypes */ -#endif /* H5I_DEBUG_OUTPUT */ /* Local Macros */ @@ -128,11 +122,8 @@ static int H5I__inc_type_ref(H5I_type_t type); static int H5I__get_type_ref(H5I_type_t type); static int H5I__search_cb(void *obj, hid_t id, void *_udata); static H5I_id_info_t *H5I__find_id(hid_t id); -static ssize_t H5I__get_name(const H5G_loc_t *loc, char *name, size_t size); -#ifdef H5I_DEBUG_OUTPUT static int H5I__debug_cb(void *_item, void *_key, void *_udata); -static herr_t H5I__debug(H5I_type_t type); -#endif /* H5I_DEBUG_OUTPUT */ +static int H5I__id_dump_cb(void *_item, void *_key, void *_udata); /*------------------------------------------------------------------------- @@ -2021,8 +2012,8 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) if(H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") - /* Call internal routine to retrieve object's name */ - if((ret_value = H5I__get_name(&loc, name, size)) < 0) + /* Retrieve object's name */ + if((ret_value = H5G_get_name(&loc, name, size, NULL)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: @@ -2031,41 +2022,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5I__get_name - * - * Purpose: Internal routine to retrieve the name for an object - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: The length of the name - * Failure: -1 - * - * Programmer: Quincey Koziol - * January 9, 2018 - * - *------------------------------------------------------------------------- - */ -static ssize_t -H5I__get_name(const H5G_loc_t *loc, char *name, size_t size) -{ - ssize_t ret_value = -1; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(loc); - - /* Retrieve object's name */ - if((ret_value = H5G_get_name(loc, name, size, NULL)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5I__get_name() */ - - -/*------------------------------------------------------------------------- * Function: H5Iget_file_id * * Purpose: The public version of H5I_get_file_id(), obtains the file @@ -2145,10 +2101,9 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_get_file_id() */ -#ifdef H5I_DEBUG_OUTPUT /*------------------------------------------------------------------------- - * Function: H5I__debug_cb + * Function: H5I__id_dump_cb * * Purpose: Dump the contents of an ID to stderr for debugging. * @@ -2157,7 +2112,7 @@ done: *------------------------------------------------------------------------- */ static int -H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) +H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) { H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ @@ -2170,7 +2125,7 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) HDfprintf(stderr, " obj = 0x%08lx\n", (unsigned long)(item->obj_ptr)); /* Get the group location, so we get get the name */ - switch (type) { + switch(type) { case H5I_GROUP: { path = H5G_nameof((H5G_t*)item->obj_ptr); @@ -2201,9 +2156,9 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) case H5I_NTYPES: default: break; /* Other types of IDs are not stored in files */ - } + } /* end switch */ - if (path) { + if(path) { if (path->user_path_r) HDfprintf(stderr, " user_path = %s\n", H5RS_get_str(path->user_path_r)); if (path->full_path_r) @@ -2211,11 +2166,11 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) } FUNC_LEAVE_NOAPI(H5_ITER_CONT) -} /* end H5I__debug_cb() */ +} /* end H5I__id_dump_cb() */ /*------------------------------------------------------------------------- - * Function: H5I__debug + * Function: H5I_dump_ids_for_type * * Purpose: Dump the contents of a type to stderr for debugging. * @@ -2223,27 +2178,33 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) * *------------------------------------------------------------------------- */ -static herr_t -H5I__debug(H5I_type_t type) +herr_t +H5I_dump_ids_for_type(H5I_type_t type) { - H5I_id_type_t *type_ptr; + H5I_id_type_t *type_ptr = NULL; - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_NOAPI_NOERR HDfprintf(stderr, "Dumping ID type %d\n", (int)type); type_ptr = H5I_id_type_list_g[type]; - /* Header */ - HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count); - HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved); - HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count); - HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid); + if(type_ptr) { - /* List */ - HDfprintf(stderr, " List:\n"); - H5SL_iterate(type_ptr->ids, H5I__debug_cb, &type); + /* Header */ + HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count); + HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved); + HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count); + HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid); + + /* List */ + if(type_ptr->id_count > 0) { + HDfprintf(stderr, " List:\n"); + H5SL_iterate(type_ptr->ids, H5I__id_dump_cb, &type); + } + } + else + HDfprintf(stderr, "Global type info/tracking pointer for that type is NULL\n"); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5I__debug() */ -#endif /* H5I_DEBUG_OUTPUT */ +} /* end H5I_dump_ids_for_type() */ diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h index 3bfde93..25a0572 100644 --- a/src/H5Iprivate.h +++ b/src/H5Iprivate.h @@ -82,5 +82,8 @@ H5_DLL int H5I_dec_app_ref(hid_t id); H5_DLL int H5I_dec_app_ref_always_close(hid_t id); H5_DLL int H5I_dec_type_ref(H5I_type_t type); +/* Debugging functions */ +H5_DLL herr_t H5I_dump_ids_for_type(H5I_type_t type); + #endif /* _H5Iprivate_H */ @@ -102,16 +102,10 @@ static herr_t H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, static herr_t H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path, H5F_t *obj_file, H5O_link_t *lnk, H5O_obj_create_t *ocrt_info, hid_t lcpl_id); -static herr_t H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, - const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id); -static herr_t H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc, - const char *link_name, hid_t lcpl_id); static herr_t H5L__get_val_real(const H5O_link_t *lnk, void *buf, size_t size); static herr_t H5L__get_val_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__get_val(const H5G_loc_t *loc, const char *name, - void *buf/*out*/, size_t size); static herr_t H5L__get_val_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -121,7 +115,6 @@ static herr_t H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, static herr_t H5L__delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__delete(const H5G_loc_t *loc, const char *name); static herr_t H5L__delete_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -133,8 +126,6 @@ static herr_t H5L__move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, static herr_t H5L__move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__move(const H5G_loc_t *src_loc, const char *src_name, - H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag, hid_t lcpl_id); static herr_t H5L__exists_final_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -145,8 +136,6 @@ static htri_t H5L__exists(const H5G_loc_t *loc, const char *name); static herr_t H5L__get_info_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L__get_info(const H5G_loc_t *loc, const char *name, - H5L_info_t *linfo/*out*/); static herr_t H5L__get_info_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -162,10 +151,6 @@ static ssize_t H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name static herr_t H5L__iterate(hid_t grp_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate_t op, void *op_data); -static herr_t H5L__visit(hid_t grp_id, const char *group_name, - H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, - void *op_data); - /*********************/ /* Package Variables */ @@ -338,8 +323,8 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, dst_loc_p = src_loc_p; /* Move the link */ - if(H5L__move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") + if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: FUNC_LEAVE_API(ret_value) @@ -400,8 +385,8 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, dst_loc_p = src_loc_p; /* Copy the link */ - if(H5L__move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") + if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: FUNC_LEAVE_API(ret_value) @@ -451,8 +436,8 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Create the link */ - if(H5L__create_soft(link_target, &link_loc, link_name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") + if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") done: FUNC_LEAVE_API(ret_value) @@ -516,8 +501,8 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.") /* Create the link */ - if(H5L__create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") + if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") done: FUNC_LEAVE_API(ret_value) @@ -617,8 +602,8 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Unlink */ - if(H5L__delete(&loc, name) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + if(H5L_delete(&loc, name) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: FUNC_LEAVE_API(ret_value) @@ -670,7 +655,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, /* Delete the link */ if(H5L__delete_by_idx(&loc, group_name, idx_type, order, n) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: FUNC_LEAVE_API(ret_value) @@ -717,8 +702,8 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the link value */ - if(H5L__get_val(&loc, name, buf, size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) + if(H5L_get_val(&loc, name, buf, size) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) done: FUNC_LEAVE_API(ret_value) @@ -854,8 +839,8 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Get the link information */ - if(H5L__get_info(&loc, name, linfo) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + if(H5L_get_info(&loc, name, linfo) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -904,7 +889,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, /* Get the link information */ if(H5L__get_info_by_idx(&loc, group_name, idx_type, order, n, linfo) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -1087,7 +1072,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, /* Get the link information */ if((ret_value = H5L__get_name_by_idx(&loc, group_name, idx_type, order, n, name, size)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link name") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link name") done: FUNC_LEAVE_API(ret_value) @@ -1135,7 +1120,7 @@ H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, /* Iterate over the links */ if((ret_value = H5L__iterate(grp_id, ".", idx_type, order, idx_p, op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: FUNC_LEAVE_API(ret_value) @@ -1191,7 +1176,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, /* Iterate over the links */ if((ret_value = H5L__iterate(loc_id, group_name, idx_type, order, idx_p, op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: FUNC_LEAVE_API(ret_value) @@ -1248,8 +1233,8 @@ H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") /* Call internal routine */ - if((ret_value = H5L__visit(grp_id, ".", idx_type, order, op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + if((ret_value = H5G_visit(grp_id, ".", idx_type, order, op, op_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: FUNC_LEAVE_API(ret_value) @@ -1309,8 +1294,8 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") /* Call internal routine */ - if((ret_value = H5L__visit(loc_id, group_name, idx_type, order, op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data)) < 0) + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: FUNC_LEAVE_API(ret_value) @@ -1895,45 +1880,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__create_hard - * - * Purpose: Internal routine to create a hard link - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 25, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, - const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(cur_loc); - HDassert(cur_name); - HDassert(link_loc); - HDassert(link_name); - - /* Create the link */ - if(H5L_create_hard(cur_loc, cur_name, link_loc, link_name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__create_hard() */ - - -/*------------------------------------------------------------------------- * Function: H5L_create_soft * * Purpose: Creates a soft link from LINK_NAME to TARGET_PATH. @@ -1982,44 +1928,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__create_soft - * - * Purpose: Internal routine to create a soft link - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 25, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc, - const char *link_name, hid_t lcpl_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(target_path); - HDassert(link_loc); - HDassert(link_name); - - /* Create the link */ - if(H5L_create_soft(target_path, link_loc, link_name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__create_soft() */ - - -/*------------------------------------------------------------------------- * Function: H5L__create_ud * * Purpose: Creates a user-defined link. See H5Lcreate_ud for @@ -2039,7 +1947,7 @@ H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, H5O_link_t lnk; /* Link to insert */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(type >= H5L_TYPE_UD_MIN && type <= H5L_TYPE_MAX); @@ -2073,7 +1981,7 @@ done: /* Free the link's udata buffer if it's been allocated */ H5MM_xfree(lnk.u.ud.udata); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__create_ud() */ @@ -2216,42 +2124,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__get_val - * - * Purpose: Internal routine to query a link value - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, size_t size) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Get the link value */ - if(H5L_get_val(loc, name, buf, size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__get_val() */ - - -/*------------------------------------------------------------------------- * Function: H5L__get_val_by_idx_cb * * Purpose: Callback for retrieving a link's value according to an @@ -2308,9 +2180,6 @@ done: * Purpose: Internal routine to query a link value according to the * index within a group * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -2326,7 +2195,7 @@ H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5L_trav_gvbi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ HDassert(loc); @@ -2344,7 +2213,7 @@ H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info for index: %llu", (unsigned long long)n) done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__get_val_by_idx() */ @@ -2439,42 +2308,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__delete - * - * Purpose: Internal routine to delete a link - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__delete(const H5G_loc_t *loc, const char *name) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Delete the link */ - if(H5L_delete(loc, name) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link: %s", name) - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__delete() */ - - -/*------------------------------------------------------------------------- * Function: H5L__delete_by_idx_cb * * Purpose: Callback for removing a link according to an index's order. @@ -2519,9 +2352,6 @@ done: * Purpose: Internal routine to delete a link according to its index * within a group. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -2537,7 +2367,7 @@ H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5L_trav_rmbi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ HDassert(loc); @@ -2553,8 +2383,8 @@ H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "link doesn't exist") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__delete() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__delete_by_idx() */ /*------------------------------------------------------------------------- @@ -2864,45 +2694,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__move - * - * Purpose: Internal routine to move / copy a link - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 25, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__move(const H5G_loc_t *src_loc, const char *src_name, H5G_loc_t *dst_loc, - const char *dst_name, hbool_t copy_flag, hid_t lcpl_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(src_loc); - HDassert(src_name); - HDassert(dst_loc); - HDassert(dst_name); - - /* Move the link */ - if(H5L_move(src_loc, src_name, dst_loc, dst_name, copy_flag, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__move() */ - - -/*------------------------------------------------------------------------- * Function: H5L__exists_final_cb * * Purpose: Callback for checking whether a link exists, as the final @@ -3083,7 +2874,7 @@ H5L__exists(const H5G_loc_t *loc, const char *name) H5L_trav_le_t udata; /* User data for traversal */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* A path of "/" will always exist in a file */ if(0 == HDstrcmp(name, "/")) @@ -3098,7 +2889,7 @@ H5L__exists(const H5G_loc_t *loc, const char *name) ret_value = (htri_t)udata.exists; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5L__exists() */ @@ -3173,42 +2964,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L__get_info - * - * Purpose: Internal routine to retrieve link info - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 27, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__get_info(const H5G_loc_t *loc, const char *name, H5L_info_t *linfo/*out*/) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Get the link information */ - if(H5L_get_info(loc, name, linfo) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info for: '%s'", name) - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__get_info() */ - - -/*------------------------------------------------------------------------- * Function: H5L__get_info_by_idx_cb * * Purpose: Callback for retrieving a link's metadata according to an @@ -3265,9 +3020,6 @@ done: * Purpose: Internal routine to retrieve link info according to an * index's order. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -3283,7 +3035,7 @@ H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type H5L_trav_gibi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ HDassert(loc); @@ -3298,10 +3050,10 @@ H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type /* Traverse the group hierarchy to locate the object to get info about */ if(H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_info_by_idx_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__get_info_by_idx() */ @@ -3351,9 +3103,6 @@ done: * Purpose: Internal routine to retrieve link name according to an * index's order. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -3370,7 +3119,7 @@ H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5L_trav_gnbi_t udata; /* User data for callback */ ssize_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ HDassert(loc); @@ -3392,7 +3141,7 @@ H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, ret_value = udata.name_len; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__get_name_by_idx() */ @@ -3401,9 +3150,6 @@ done: * * Purpose: Internal routine to iterate over links * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -3421,7 +3167,7 @@ H5L__iterate(hid_t grp_id, const char *group_name, H5_index_t idx_type, hsize_t idx; /* Internal location to hold index */ herr_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ HDassert(group_name); @@ -3444,48 +3190,11 @@ H5L__iterate(hid_t grp_id, const char *group_name, H5_index_t idx_type, *idx_p = last_lnk; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__iterate() */ /*------------------------------------------------------------------------- - * Function: H5L__visit - * - * Purpose: Internal routine to visit links - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L__visit(hid_t grp_id, const char *group_name, H5_index_t idx_type, - H5_iter_order_t order, H5L_iterate_t op, void *op_data) -{ - herr_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check arguments */ - HDassert(group_name); - HDassert(op); - - /* Call internal group visitation routine */ - if((ret_value = H5G_visit(grp_id, group_name, idx_type, order, op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5L__visit() */ - - -/*------------------------------------------------------------------------- * Function: H5L__link_copy_file * * Purpose: Copy a link and the object it points to from one file to @@ -116,7 +116,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") /* Open the object */ - if((ret_value = H5O__open_name(&loc, name)) < 0) + if((ret_value = H5O_open_name(&loc, name, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: @@ -292,9 +292,9 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, obj_id, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") - /* Create a link to the object */ - if(H5O__create_link(&new_loc, new_name, &obj_loc, lcpl_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link") + /* Link to the object */ + if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link") done: FUNC_LEAVE_API(ret_value) @@ -339,7 +339,7 @@ H5Oincr_refcount(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's refcount */ - if(H5O__link(oloc, 1) < 0) + if(H5O_link(oloc, 1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -385,7 +385,7 @@ H5Odecr_refcount(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's refcount */ - if(H5O__link(oloc, -1) < 0) + if(H5O_link(oloc, -1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -426,7 +426,7 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Check if the object exists */ - if((ret_value = H5O__exists_by_name(&loc, name)) < 0) + if((ret_value = H5G_loc_exists(&loc, name)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) done: @@ -467,7 +467,7 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") /* Retrieve the object's information */ - if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/, fields) < 0) + if(H5G_loc_info(&loc, ".", oinfo/*out*/, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: @@ -515,7 +515,7 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the object's information */ - if(H5O__get_info_by_name(&loc, name, oinfo/*out*/, fields) < 0) + if(H5G_loc_info(&loc, name, oinfo/*out*/, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: @@ -612,7 +612,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* (Re)set the object's comment */ - if(H5O__set_comment_by_name(&loc, ".", comment) < 0) + if(H5G_loc_set_comment(&loc, ".", comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object") done: @@ -658,7 +658,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* (Re)set the object's comment */ - if(H5O__set_comment_by_name(&loc, name, comment) < 0) + if(H5G_loc_set_comment(&loc, name, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name) done: @@ -696,7 +696,7 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Retrieve the object's comment */ - if((ret_value = H5O__get_comment_by_name(&loc, ".", comment/*out*/, bufsize)) < 0) + if((ret_value = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object") done: @@ -741,7 +741,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the object's comment */ - if((ret_value = H5O__get_comment_by_name(&loc, name, comment/*out*/, bufsize)) < 0) + if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object: '%s'", name) done: diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 2e628f4..b57eaf6 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -242,9 +242,6 @@ done: * * Purpose: Internal routine to copy an object * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -265,7 +262,7 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, hbool_t obj_open = FALSE; /* Entry at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check arguments */ HDassert(loc); @@ -322,7 +319,7 @@ done: if(obj_open && H5O_close(&src_oloc, NULL) < 0) HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, FAIL, "unable to release object header") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__copy() */ diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index 2600ea3..9f0babc 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -31,9 +31,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Opkg.h" /* Object headers */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Opkg.h" /* Object headers */ /****************/ @@ -102,8 +103,8 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Retrieve the object's information */ - if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") + if(H5G_loc_info(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") done: FUNC_LEAVE_API(ret_value) @@ -142,7 +143,7 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Retrieve the object's information */ - if(H5O__get_info_by_name(&loc, name, oinfo/*out*/, H5O_INFO_ALL) < 0) + if(H5G_loc_info(&loc, name, oinfo/*out*/, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: diff --git a/src/H5Oflush.c b/src/H5Oflush.c index e8e077e..d8c9530 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -49,7 +49,6 @@ static herr_t H5O__flush(hid_t obj_id); static herr_t H5O__oh_tag(const H5O_loc_t *oloc, haddr_t *tag); static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc); -static herr_t H5O__refresh(hid_t obj_id); /*************/ @@ -133,9 +132,6 @@ done: * * Purpose: Internal routine to flush an object * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -152,7 +148,7 @@ H5O__flush(hid_t obj_id) const H5O_obj_class_t *obj_class; /* Class of object */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Check args */ if(NULL == (oloc = H5O_get_loc(obj_id))) @@ -175,7 +171,7 @@ H5O__flush(hid_t obj_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object and object flush callback") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__flush() */ @@ -235,17 +231,22 @@ done: herr_t H5Orefresh(hid_t oid) { - herr_t ret_value = SUCCEED; /* Return value */ + H5O_loc_t *oloc; /* object location */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", oid); + /* Check args */ + if(NULL == (oloc = H5O_get_loc(oid))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object") + /* Set up collective metadata if appropriate */ if(H5CX_set_loc(oid) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Call internal routine */ - if(H5O__refresh(oid) < 0) + if(H5O_refresh_metadata(oid, *oloc) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") done: @@ -460,40 +461,3 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5O_refresh_metadata_reopen() */ - -/*------------------------------------------------------------------------- - * Function: H5O__refresh - * - * Purpose: Internal routine to refresh an object - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 29, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5O__refresh(hid_t obj_id) -{ - H5O_loc_t *oloc; /* Object location */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Check args */ - if(NULL == (oloc = H5O_get_loc(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object") - - /* Private function */ - if(H5O_refresh_metadata(obj_id, *oloc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__refresh() */ - diff --git a/src/H5Oint.c b/src/H5Oint.c index a300697..38d73c0 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -644,49 +644,10 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__open_name - * - * Purpose: Internal routine to open an object by name - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -hid_t -H5O__open_name(const H5G_loc_t *loc, const char *name) -{ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name); - - /* Open the object */ - if((ret_value = H5O_open_name(loc, name, TRUE)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__open_name() */ - - -/*------------------------------------------------------------------------- * Function: H5O__open_by_idx * * Purpose: Internal routine to open an object by index within group * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -705,7 +666,7 @@ H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, hbool_t loc_found = FALSE; /* Entry at 'name' found */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -730,7 +691,7 @@ done: if(H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__open_by_idx() */ @@ -739,9 +700,6 @@ done: * * Purpose: Internal routine to open an object by its address * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * * Return: Success: Non-negative * Failure: Negative * @@ -758,7 +716,7 @@ H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr) H5O_loc_t obj_oloc; /* Opened object object location */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -776,7 +734,7 @@ H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__open_by_addr() */ @@ -818,44 +776,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__create_link - * - * Purpose: Internal routine to create a link from a group to an object - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O__create_link(const H5G_loc_t *new_loc, const char *new_name, - H5G_loc_t *obj_loc, hid_t lcpl_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(new_loc); - HDassert(new_name && *new_name); - HDassert(obj_loc); - - /* Link to the object */ - if(H5L_link(new_loc, new_name, obj_loc, lcpl_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__create_link() */ - - -/*------------------------------------------------------------------------- * Function: H5O_close * * Purpose: Closes an object header that was previously open. @@ -1083,41 +1003,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__link - * - * Purpose: Internal routine to change the refcount for an object - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O__link(const H5O_loc_t *oloc, int adjust) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(oloc); - - /* Change the object's refcount */ - if(H5O_link(oloc, adjust) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__link() */ - - -/*------------------------------------------------------------------------- * Function: H5O_protect * * Purpose: Wrapper around H5AC_protect for use during a H5O_protect-> @@ -2130,42 +2015,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__exists_by_name - * - * Purpose: Internal routine to check if an object exists - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -htri_t -H5O__exists_by_name(const H5G_loc_t *loc, const char *name) -{ - htri_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Check if the object exists */ - if((ret_value = H5G_loc_exists(loc, name)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__exists_by_name() */ - - -/*------------------------------------------------------------------------- * Function: H5O_get_hdr_info * * Purpose: Retrieve the object header information for an object @@ -2421,52 +2270,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5O__get_info_by_name - * - * Purpose: Internal routine to retrieve an object's info - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Note: Add a parameter "fields" to indicate selection of object info. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O__get_info_by_name(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo, unsigned fields) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - HDassert(oinfo); - - /* Retrieve the object's information */ - if(H5G_loc_info(loc, name, oinfo/*out*/, fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__get_info_by_name() */ - - -/*------------------------------------------------------------------------- * Function: H5O__get_info_by_idx * * Purpose: Internal routine to retrieve an object's info according to * an index within a group. * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). * * Note: Add a parameter "fields" to indicate selection of object info. * @@ -2488,7 +2296,7 @@ H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id hbool_t loc_found = FALSE; /* Entry at 'name' found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check arguments */ HDassert(loc); @@ -2514,85 +2322,11 @@ done: if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__get_info_by_idx() */ /*------------------------------------------------------------------------- - * Function: H5O__set_comment_by_name - * - * Purpose: Internal routine to set an object's "comment" - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O__set_comment_by_name(const H5G_loc_t *loc, const char *name, - const char *comment) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* (Re)set the object's comment */ - if(H5G_loc_set_comment(loc, name, comment) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__set_comment_by_name() */ - - -/*------------------------------------------------------------------------- - * Function: H5O__get_comment_by_name - * - * Purpose: Internal routine to retrieve an object's "comment" - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 28, 2017 - * - *------------------------------------------------------------------------- - */ -ssize_t -H5O__get_comment_by_name(const H5G_loc_t *loc, const char *name, - char *comment, size_t bufsize) -{ - ssize_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE_VOL - - /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - - /* Retrieve the object's comment */ - if((ret_value = H5G_loc_get_comment(loc, name, comment/*out*/, bufsize)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* end H5O__get_comment_by_name() */ - - -/*------------------------------------------------------------------------- * Function: H5O_get_create_plist * * Purpose: Retrieve the object creation properties for an object @@ -3029,7 +2763,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, hid_t obj_id = (-1); /* ID of object */ herr_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Portably initialize user data struct to zeros */ HDmemset(&udata, 0, sizeof(udata)); @@ -3117,7 +2851,7 @@ done: if(udata.visited) H5SL_destroy(udata.visited, H5O__free_visit_visited, NULL); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__visit() */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 616f96b..19d90c5 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -555,25 +555,14 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATASET[1]; H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1]; /* Package-local function prototypes */ -H5_DLL hid_t H5O__open_name(const H5G_loc_t *loc, const char *name); H5_DLL hid_t H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n); H5_DLL hid_t H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr); H5_DLL hid_t H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref); -H5_DLL herr_t H5O__create_link(const H5G_loc_t *new_loc, const char *new_name, - H5G_loc_t *obj_loc, hid_t lcpl_id); H5_DLL const H5O_obj_class_t *H5O__obj_class(const H5O_loc_t *loc); H5_DLL int H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted); -H5_DLL herr_t H5O__link(const H5O_loc_t *loc, int adjust); -H5_DLL htri_t H5O__exists_by_name(const H5G_loc_t *loc, const char *name); -H5_DLL herr_t H5O__get_info_by_name(const H5G_loc_t *loc, const char *name, - H5O_info_t *oinfo, unsigned fields); H5_DLL herr_t H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields); -H5_DLL herr_t H5O__set_comment_by_name(const H5G_loc_t *loc, const char *name, - const char *comment); -H5_DLL ssize_t H5O__get_comment_by_name(const H5G_loc_t *loc, const char *name, - char *comment, size_t bufsize); H5_DLL herr_t H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields); H5_DLL herr_t H5O__inc_rc(H5O_t *oh); @@ -62,8 +62,8 @@ * Purpose: Control the loading of dynamic plugin types. * * The plugin_control_mask parameter is a bitfield that controls - * whether certain classes of plugins (e.g.: filters, - * VOL drivers) will be loaded by the library. + * whether certain classes of plugins (e.g.: filters) + * will be loaded by the library. * * plugin bit = 0, will prevent the use of that dynamic plugin type. * plugin bit = 1, will allow the use of that dynamic plugin type. @@ -101,8 +101,7 @@ done: * Function: H5PLget_loading_state * * Purpose: Get the bitmask that controls whether certain classes - * of plugins (e.g.: filters, VOL drivers) will be loaded - * by the library. + * of plugins (e.g.: filters) will be loaded by the library. * * Zero if all plugin types are disabled * Negative if all plugin types are enabled diff --git a/src/H5PLint.c b/src/H5PLint.c index b190746..8b649d2 100644 --- a/src/H5PLint.c +++ b/src/H5PLint.c @@ -66,7 +66,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /*******************/ /* Bitmask that controls whether classes of plugins - * (e.g.: filters, VOL drivers) can be loaded. + * (e.g.: filters) can be loaded. */ static unsigned int H5PL_plugin_control_mask_g = H5PL_ALL_PLUGIN; diff --git a/src/H5Rint.c b/src/H5Rint.c index 12b4878..1465ee1 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -230,7 +230,7 @@ H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, hbool_t obj_found = FALSE; /* Object location found */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(_ref); HDassert(loc); @@ -335,7 +335,7 @@ done: if (obj_found) H5G_loc_free(&obj_loc); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__create() */ @@ -381,7 +381,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, H5O_type_t obj_type; /* Type of object */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(_ref); HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE); @@ -504,7 +504,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, } /* end switch */ done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__dereference() */ @@ -538,7 +538,7 @@ H5R__get_region(H5F_t *file, const void *_ref) uint8_t *buf = NULL; /* Buffer to store serialized selection in */ H5S_t *ret_value; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(_ref); HDassert(file); @@ -573,7 +573,7 @@ done: if(buf) H5MM_xfree(buf); - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__get_region() */ @@ -607,7 +607,7 @@ H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref, unsigned rc; /* Reference count of object */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE HDassert(file); HDassert(_ref); @@ -662,7 +662,7 @@ H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref, HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__get_obj_type() */ @@ -701,7 +701,7 @@ H5R__get_name(H5F_t *f, hid_t id, H5R_type_t ref_type, const void *_ref, H5O_loc_t oloc; /* Object location describing object for reference */ ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Check args */ HDassert(f); @@ -763,6 +763,6 @@ done: if (file_id > 0 && H5I_dec_ref(file_id) < 0) HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, (-1), "can't decrement ref count of temp ID") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__get_name() */ diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 2bd275a..935d279 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -879,7 +879,14 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size, HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) } - MPI_Type_extent (inner_type, &inner_extent); + /* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default, + * so we're using the MPI-2 version even though we don't need the lb + * value. + */ + { + MPI_Aint unused_lb_arg; + MPI_Type_get_extent(inner_type, &unused_lb_arg, &inner_extent); + } stride_in_bytes = inner_extent * (MPI_Aint)d[i].strid; /* If the element count is larger than what a 32 bit integer can hold, @@ -1500,7 +1507,14 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements, } } - MPI_Type_extent (old_type, &old_extent); + /* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default, + * so we're using the MPI-2 version even though we don't need the lb + * value. + */ + { + MPI_Aint unused_lb_arg; + MPI_Type_get_extent(old_type, &unused_lb_arg, &old_extent); + } /* Set up the arguments for MPI_Type_struct constructor */ type[0] = outer_type; @@ -3714,7 +3714,7 @@ H5T__close_cb(H5T_t *dt) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* check args */ HDassert(dt && dt->shared); @@ -3724,7 +3724,7 @@ H5T__close_cb(H5T_t *dt) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "can't close datatype"); done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__close_cb() */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 1719f8f..649bd2e 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -59,8 +59,6 @@ static herr_t H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id); static hid_t H5T__get_create_plist(const H5T_t *type); static H5T_t *H5T__open_oid(const H5G_loc_t *loc); -static herr_t H5T__flush(H5T_t *dt, hid_t type_id); -static herr_t H5T__refresh(H5T_t *dt, hid_t type_id); /*********************/ @@ -165,7 +163,7 @@ H5T__commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, H5T_state_t old_state; /* The state of the datatype before H5T__commit. */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(loc); @@ -219,7 +217,7 @@ done: } /* end if */ } /* end if */ - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__commit_named() */ @@ -296,7 +294,7 @@ H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id) H5O_loc_t *oloc; /* Object location for datatype */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Sanity checks */ HDassert(file); @@ -318,7 +316,7 @@ H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* H5T__commit_anon() */ @@ -667,8 +665,8 @@ H5Tflush(hid_t type_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Flush metadata for named datatype */ - if(H5T__flush(dt, type_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") + if(H5O_flush_common(&dt->oloc, type_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype and object flush callback") done: FUNC_LEAVE_API(ret_value) @@ -707,7 +705,7 @@ H5Trefresh(hid_t type_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") /* Call private function to refresh datatype object */ - if((H5T__refresh(dt, type_id)) < 0) + if((H5O_refresh_metadata(type_id, dt->oloc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") done: @@ -742,7 +740,7 @@ H5T__get_create_plist(const H5T_t *type) hid_t new_tcpl_id = FAIL; /* New datatype creation property list */ hid_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_STATIC_VOL + FUNC_ENTER_STATIC /* Sanity check */ HDassert(type); @@ -770,7 +768,7 @@ done: if(H5I_dec_app_ref(new_tcpl_id) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to close temporary object") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_create_plist() */ @@ -798,7 +796,7 @@ H5T__open_name(const H5G_loc_t *loc, const char *name) hbool_t obj_found = FALSE; /* Object at 'name' found */ H5T_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(loc); @@ -836,7 +834,7 @@ done: if(H5G_loc_free(&type_loc) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, NULL, "can't free location") - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__open_name() */ @@ -1040,73 +1038,3 @@ H5T_update_shared(H5T_t *dt) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5T_update_shared() */ - -/*------------------------------------------------------------------------- - * Function: H5T__flush - * - * Purpose: Internal routine to flushes a named datatype to disk. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5T__flush(H5T_t *dt, hid_t type_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Sanity check */ - HDassert(dt); - - /* To flush metadata and invoke flush callback if there is */ - if(H5O_flush_common(&dt->oloc, type_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype and object flush callback") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5T__flush */ - - -/*------------------------------------------------------------------------- - * Function: H5T__refresh - * - * Purpose: Internal routine to refresh a named datatype. - * - * Note: This routine is needed so that there's a non-API routine - * that can set up VOL / SWMR info (which need a DXPL). - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * December 18, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5T__refresh(H5T_t *dt, hid_t type_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC_VOL - - /* Sanity check */ - HDassert(dt); - - /* Call private function to refresh datatype object */ - if((H5O_refresh_metadata(type_id, dt->oloc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") - -done: - FUNC_LEAVE_NOAPI_VOL(ret_value) -} /* H5T__refresh */ - @@ -387,9 +387,9 @@ H5Z__unregister(H5Z_filter_t filter_id) H5Z_object_t object; /* Object to pass to callbacks */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_VOL + FUNC_ENTER_PACKAGE - HDassert(filter_id>=0 && filter_id<=H5Z_FILTER_MAX); + HDassert(filter_id >= 0 && filter_id <= H5Z_FILTER_MAX); /* Is the filter already registered? */ for (filter_index = 0; filter_index < H5Z_table_used_g; filter_index++) @@ -434,7 +434,7 @@ H5Z__unregister(H5Z_filter_t filter_id) H5Z_table_used_g--; done: - FUNC_LEAVE_NOAPI_VOL(ret_value) + FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z__unregister() */ diff --git a/src/H5err.txt b/src/H5err.txt index 19374cd..3eeb38a 100644 --- a/src/H5err.txt +++ b/src/H5err.txt @@ -180,7 +180,7 @@ MINOR, CACHE, H5E_CANTRESIZE, Unable to resize a metadata cache entry MINOR, CACHE, H5E_CANTDEPEND, Unable to create a flush dependency MINOR, CACHE, H5E_CANTUNDEPEND, Unable to destroy a flush dependency MINOR, CACHE, H5E_CANTNOTIFY, Unable to notify object about action -MINOR, CACHE, H5E_LOGFAIL, Failure in the cache logging framework +MINOR, CACHE, H5E_LOGGING, Failure in the cache logging framework MINOR, CACHE, H5E_CANTCORK, Unable to cork an object MINOR, CACHE, H5E_CANTUNCORK, Unable to uncork an object diff --git a/src/H5private.h b/src/H5private.h index 8974e46..196d001 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2199,12 +2199,6 @@ H5_DLL herr_t H5CX_pop(void); H5_PUSH_FUNC \ if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { -/* Use this macro for all package-level functions that are VOL entry-points */ -#define FUNC_ENTER_PACKAGE_VOL { \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ - H5_PUSH_FUNC \ - if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { - /* Use this macro for package-level functions which propgate errors, but don't issue them */ #define FUNC_ENTER_PACKAGE_NOERR { \ FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ @@ -2221,29 +2215,12 @@ H5_DLL herr_t H5CX_pop(void); H5_PUSH_FUNC \ if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { -/* Use the following macro as replacement for the FUNC_ENTER_PACKAGE - * macro when the function needs to set up a metadata tag and is also a - * VOL entry-point. */ -#define FUNC_ENTER_PACKAGE_VOL_TAG(tag) { \ - haddr_t prev_tag = HADDR_UNDEF; \ - \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ - H5AC_tag(tag, &prev_tag); \ - H5_PUSH_FUNC \ - if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { - /* Use this macro for all "normal" staticly-scoped functions */ #define FUNC_ENTER_STATIC { \ FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ H5_PUSH_FUNC \ if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { -/* Use this macro for all "normal" staticly-scoped functions that are VOL entry-points */ -#define FUNC_ENTER_STATIC_VOL { \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ - H5_PUSH_FUNC \ - if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { - /* Use this macro for staticly-scoped functions which propgate errors, but don't issue them */ #define FUNC_ENTER_STATIC_NOERR { \ FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ @@ -2266,17 +2243,6 @@ H5_DLL herr_t H5CX_pop(void); H5_PUSH_FUNC \ if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { -/* Use the following macro as replacement for the FUNC_ENTER_STATIC - * macro when the function needs to set up a metadata tag and is a VOL - * entry-point. */ -#define FUNC_ENTER_STATIC_VOL_TAG(tag) { \ - haddr_t prev_tag = HADDR_UNDEF; \ - \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ - H5AC_tag(tag, &prev_tag); \ - H5_PUSH_FUNC \ - if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { - /*------------------------------------------------------------------------- * Purpose: Register function exit for code profiling. This should be @@ -2331,13 +2297,6 @@ H5_DLL herr_t H5CX_pop(void); return(ret_value); \ } /*end scope from beginning of FUNC_ENTER*/ -#define FUNC_LEAVE_NOAPI_VOL(ret_value) \ - ; \ - } /*end scope from end of FUNC_ENTER*/ \ - H5_POP_FUNC \ - return(ret_value); \ -} /*end scope from beginning of FUNC_ENTER*/ - #define FUNC_LEAVE_NOAPI_VOID \ ; \ } /*end scope from end of FUNC_ENTER*/ \ @@ -2365,15 +2324,6 @@ H5_DLL herr_t H5CX_pop(void); return(ret_value); \ } /*end scope from beginning of FUNC_ENTER*/ -/* Use this macro when exiting a VOL entry-point function that set up a metadata tag */ -#define FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) \ - ; \ - } /*end scope from end of FUNC_ENTER*/ \ - H5AC_tag(prev_tag, NULL); \ - H5_POP_FUNC \ - return(ret_value); \ -} /*end scope from beginning of FUNC_ENTER*/ - /****************************************/ /* Revisions to FUNC_ENTER/LEAVE Macros */ diff --git a/src/Makefile.am b/src/Makefile.am index 7505fea..10ef8c6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -40,12 +40,12 @@ DISTCLEANFILES=H5pubconf.h # library sources libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5A.c H5Abtree2.c H5Adense.c H5Adeprec.c H5Aint.c H5Atest.c \ - H5AC.c H5ACdbg.c H5AClog.c H5ACproxy_entry.c \ + H5AC.c H5ACdbg.c H5ACproxy_entry.c \ H5B.c H5Bcache.c H5Bdbg.c \ H5B2.c H5B2cache.c H5B2dbg.c H5B2hdr.c H5B2int.c H5B2internal.c \ H5B2leaf.c H5B2stat.c H5B2test.c \ - H5C.c H5Cdbg.c H5Cepoch.c H5Cimage.c H5Clog.c H5Cprefetched.c \ - H5Cquery.c H5Ctag.c H5Ctest.c \ + H5C.c H5Cdbg.c H5Cepoch.c H5Cimage.c H5Clog.c H5Clog_json.c H5Clog_trace.c \ + H5Cprefetched.c H5Cquery.c H5Ctag.c H5Ctest.c \ H5CS.c \ H5CX.c \ H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \ diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 531cd00..9d0e29f 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -82,7 +82,6 @@ Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@ API tracing: @TRACE_API@ Using memory checker: @USINGMEMCHECKER@ Memory allocation sanity checks: @MEMORYALLOCSANITYCHECK@ - Metadata trace file: @METADATATRACEFILE@ Function stack tracing: @CODESTACK@ Strict file format checks: @STRICT_FORMAT_CHECKS@ Optimization instrumentation: @INSTRUMENT_LIBRARY@ diff --git a/testpar/t_cache.c b/testpar/t_cache.c index c27fc23..1447cda 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -467,9 +467,7 @@ static void lock_and_unlock_random_entry(H5F_t * file_ptr, static void lock_entry(H5F_t * file_ptr, int32_t idx); static void mark_entry_dirty(int32_t idx); static void pin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global, hbool_t dirty); -#ifdef H5_METADATA_TRACE_FILE static void pin_protected_entry(int32_t idx, hbool_t global); -#endif /* H5_METADATA_TRACE_FILE */ static void move_entry(H5F_t * file_ptr, int32_t old_idx, int32_t new_idx); static hbool_t reset_server_counts(void); static void resize_entry(int32_t idx, size_t new_size); @@ -1217,20 +1215,20 @@ setup_derived_types(void) struct mssg_t sample; /* used to compute displacements */ /* setup the displacements array */ - if ( ( MPI_SUCCESS != MPI_Address(&sample.req, &displs[0]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.src, &displs[1]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.dest, &displs[2]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.mssg_num, &displs[3]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.base_addr, &displs[4]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.len, &displs[5]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.ver, &displs[6]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.count, &displs[7]) ) || - ( MPI_SUCCESS != MPI_Address(&sample.magic, &displs[8]) ) ) { + if ( ( MPI_SUCCESS != MPI_Get_address(&sample.req, &displs[0]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.src, &displs[1]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.dest, &displs[2]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.mssg_num, &displs[3]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.base_addr, &displs[4]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.len, &displs[5]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.ver, &displs[6]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.count, &displs[7]) ) || + ( MPI_SUCCESS != MPI_Get_address(&sample.magic, &displs[8]) ) ) { nerrors++; success = FALSE; if ( verbose ) { - HDfprintf(stdout, "%d:%s: MPI_Address() call failed.\n", + HDfprintf(stdout, "%d:%s: MPI_Get_Address() call failed.\n", world_mpi_rank, FUNC); } @@ -1245,7 +1243,7 @@ setup_derived_types(void) if ( success ) { - result = MPI_Type_struct(9, block_len, displs, mpi_types, &mpi_mssg_t); + result = MPI_Type_create_struct(9, block_len, displs, mpi_types, &mpi_mssg_t); if ( result != MPI_SUCCESS ) { @@ -3693,7 +3691,6 @@ pin_entry(H5F_t * file_ptr, } /* pin_entry() */ -#ifdef H5_METADATA_TRACE_FILE /***************************************************************************** * Function: pin_protected_entry() @@ -3762,7 +3759,6 @@ pin_protected_entry(int32_t idx, return; } /* pin_protected_entry() */ -#endif /* H5_METADATA_TRACE_FILE */ /***************************************************************************** @@ -6809,8 +6805,6 @@ smoke_check_5(int metadata_write_strategy) * - H5AC_expunge_entry() * - H5AC_resize_entry() * - * This test is skipped if H5_METADATA_TRACE_FILE is undefined. - * * Return: Success: TRUE * * Failure: FALSE @@ -6823,63 +6817,63 @@ trace_file_check(int metadata_write_strategy) { hbool_t success = TRUE; -#ifdef H5_METADATA_TRACE_FILE - const char *((* expected_output)[]) = NULL; const char * expected_output_0[] = { "### HDF5 metadata cache trace file version 1 ###\n", - "H5AC_set_cache_auto_resize_config 1 0 1 0 \"t_cache_trace.txt\" 1 0 2097152 0.300000 33554432 1048576 50000 1 0.900000 2.000000 1 1.000000 0.250000 1 4194304 3 0.999000 0.900000 1 1048576 3 1 0.100000 262144 0 0\n", - "H5AC_insert_entry 0x400 27 0x0 2 0\n", - "H5AC_insert_entry 0x402 27 0x0 2 0\n", - "H5AC_insert_entry 0x404 27 0x0 4 0\n", - "H5AC_insert_entry 0x408 27 0x0 6 0\n", - "H5AC_protect 0x400 27 0x0 2 1\n", - "H5AC_mark_entry_dirty 0x400 0\n", - "H5AC_unprotect 0x400 27 0x0 0\n", - "H5AC_protect 0x402 27 0x0 2 1\n", - "H5AC_pin_protected_entry 0x402 0\n", - "H5AC_unprotect 0x402 27 0x0 0\n", - "H5AC_unpin_entry 0x402 0\n", - "H5AC_expunge_entry 0x402 27 0\n", - "H5AC_protect 0x404 27 0x0 4 1\n", - "H5AC_pin_protected_entry 0x404 0\n", - "H5AC_unprotect 0x404 27 0x0 0\n", - "H5AC_mark_entry_dirty 0x404 0\n", - "H5AC_resize_entry 0x404 2 0\n", - "H5AC_resize_entry 0x404 4 0\n", - "H5AC_unpin_entry 0x404 0\n", - "H5AC_move_entry 0x400 0x8e65 27 0\n", - "H5AC_move_entry 0x8e65 0x400 27 0\n", - "H5AC_flush 0\n", + "H5AC_set_cache_auto_resize_config", + "H5AC_insert_entry", + "H5AC_insert_entry", + "H5AC_insert_entry", + "H5AC_insert_entry", + "H5AC_protect", + "H5AC_mark_entry_dirty", + "H5AC_unprotect", + "H5AC_protect", + "H5AC_pin_protected_entry", + "H5AC_unprotect", + "H5AC_unpin_entry", + "H5AC_expunge_entry", + "H5AC_protect", + "H5AC_pin_protected_entry", + "H5AC_unprotect", + "H5AC_mark_entry_dirty", + "H5AC_resize_entry", + "H5AC_resize_entry", + "H5AC_unpin_entry", + "H5AC_move_entry", + "H5AC_move_entry", + "H5AC_flush", + "H5AC_flush", NULL }; const char * expected_output_1[] = { "### HDF5 metadata cache trace file version 1 ###\n", - "H5AC_set_cache_auto_resize_config 1 0 1 0 \"t_cache_trace.txt\" 1 0 2097152 0.300000 33554432 1048576 50000 1 0.900000 2.000000 1 1.000000 0.250000 1 4194304 3 0.999000 0.900000 1 1048576 3 1 0.100000 262144 1 0\n", - "H5AC_insert_entry 0x400 27 0x0 2 0\n", - "H5AC_insert_entry 0x402 27 0x0 2 0\n", - "H5AC_insert_entry 0x404 27 0x0 4 0\n", - "H5AC_insert_entry 0x408 27 0x0 6 0\n", - "H5AC_protect 0x400 27 0x0 2 1\n", - "H5AC_mark_entry_dirty 0x400 0\n", - "H5AC_unprotect 0x400 27 0x0 0\n", - "H5AC_protect 0x402 27 0x0 2 1\n", - "H5AC_pin_protected_entry 0x402 0\n", - "H5AC_unprotect 0x402 27 0x0 0\n", - "H5AC_unpin_entry 0x402 0\n", - "H5AC_expunge_entry 0x402 27 0\n", - "H5AC_protect 0x404 27 0x0 4 1\n", - "H5AC_pin_protected_entry 0x404 0\n", - "H5AC_unprotect 0x404 27 0x0 0\n", - "H5AC_mark_entry_dirty 0x404 0\n", - "H5AC_resize_entry 0x404 2 0\n", - "H5AC_resize_entry 0x404 4 0\n", - "H5AC_unpin_entry 0x404 0\n", - "H5AC_move_entry 0x400 0x8e65 27 0\n", - "H5AC_move_entry 0x8e65 0x400 27 0\n", - "H5AC_flush 0\n", + "H5AC_set_cache_auto_resize_config", + "H5AC_insert_entry", + "H5AC_insert_entry", + "H5AC_insert_entry", + "H5AC_insert_entry", + "H5AC_protect", + "H5AC_mark_entry_dirty", + "H5AC_unprotect", + "H5AC_protect", + "H5AC_pin_protected_entry", + "H5AC_unprotect", + "H5AC_unpin_entry", + "H5AC_expunge_entry", + "H5AC_protect", + "H5AC_pin_protected_entry", + "H5AC_unprotect", + "H5AC_mark_entry_dirty", + "H5AC_resize_entry", + "H5AC_resize_entry", + "H5AC_unpin_entry", + "H5AC_move_entry", + "H5AC_move_entry", + "H5AC_flush", + "H5AC_flush", NULL }; char buffer[256]; @@ -6887,8 +6881,8 @@ trace_file_check(int metadata_write_strategy) hbool_t done = FALSE; int i; int max_nerrors; - int expected_line_len; - int actual_line_len; + size_t expected_line_len; + size_t actual_line_len; hid_t fid = -1; H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; @@ -6896,188 +6890,151 @@ trace_file_check(int metadata_write_strategy) H5AC_cache_config_t config; struct mssg_t mssg; -#endif /* H5_METADATA_TRACE_FILE */ - switch ( metadata_write_strategy ) { + switch(metadata_write_strategy) { + + case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY: - case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY: -#ifdef H5_METADATA_TRACE_FILE expected_output = &expected_output_0; -#endif /* H5_METADATA_TRACE_FILE */ - if ( world_mpi_rank == 0 ) { - TESTING( - "trace file collection -- process 0 only md write strategy"); - } - break; - case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED: -#ifdef H5_METADATA_TRACE_FILE + if(world_mpi_rank == 0) + TESTING("trace file collection -- process 0 only md write strategy"); + break; + + case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED: + expected_output = &expected_output_1; -#endif /* H5_METADATA_TRACE_FILE */ - if ( world_mpi_rank == 0 ) { - TESTING( - "trace file collection -- distributed md write strategy"); - } - break; + + if(world_mpi_rank == 0) + TESTING("trace file collection -- distributed md write strategy"); + break; default: -#ifdef H5_METADATA_TRACE_FILE + /* this will almost certainly cause a failure, but it keeps us * from de-referenceing a NULL pointer. */ expected_output = &expected_output_0; -#endif /* H5_METADATA_TRACE_FILE */ - if ( world_mpi_rank == 0 ) { - TESTING("trace file collection -- unknown md write strategy"); - } - break; - } -#ifdef H5_METADATA_TRACE_FILE + if(world_mpi_rank == 0) + TESTING("trace file collection -- unknown md write strategy"); + break; + } /* end switch */ + nerrors = 0; init_data(); reset_stats(); - if ( world_mpi_rank == world_server_mpi_rank ) { + if(world_mpi_rank == world_server_mpi_rank) { - if ( ! server_main() ) { + if(!server_main()) { /* some error occured in the server -- report failure */ nerrors++; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: server_main() failed.\n", - world_mpi_rank, FUNC); - } + if ( verbose ) + HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, FUNC); } } - else /* run the clients */ - { + else { + /* run the clients */ - if ( ! setup_cache_for_test(&fid, &file_ptr, &cache_ptr, - metadata_write_strategy) ) { + if(!setup_cache_for_test(&fid, &file_ptr, &cache_ptr, metadata_write_strategy) ) { nerrors++; fid = -1; cache_ptr = NULL; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", - world_mpi_rank, FUNC); - } + if(verbose) + HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, FUNC); } - if ( nerrors == 0 ) { + if(nerrors == 0) { config.version = H5AC__CURR_CACHE_CONFIG_VERSION; - if ( H5AC_get_cache_auto_resize_config(cache_ptr, &config) - != SUCCEED ) { - - nerrors++; - HDfprintf(stdout, - "%d:%s: H5AC_get_cache_auto_resize_config() failed.\n", - world_mpi_rank, FUNC); - - } else { - + if(H5AC_get_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) { + nerrors++; + HDfprintf(stdout, "%d:%s: H5AC_get_cache_auto_resize_config() failed.\n", world_mpi_rank, FUNC); + } + else { config.open_trace_file = TRUE; - strcpy(config.trace_file_name, "t_cache_trace.txt"); + strcpy(config.trace_file_name, "t_cache_trace.txt"); - if ( H5AC_set_cache_auto_resize_config(cache_ptr, &config) - != SUCCEED ) { - - nerrors++; - HDfprintf(stdout, - "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n", - world_mpi_rank, FUNC); + if(H5AC_set_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) { + nerrors++; + HDfprintf(stdout, "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n", world_mpi_rank, FUNC); } } - } + } /* end if */ - insert_entry(cache_ptr, file_ptr, 0, H5AC__NO_FLAGS_SET); - insert_entry(cache_ptr, file_ptr, 1, H5AC__NO_FLAGS_SET); - insert_entry(cache_ptr, file_ptr, 2, H5AC__NO_FLAGS_SET); - insert_entry(cache_ptr, file_ptr, 3, H5AC__NO_FLAGS_SET); + insert_entry(cache_ptr, file_ptr, 0, H5AC__NO_FLAGS_SET); + insert_entry(cache_ptr, file_ptr, 1, H5AC__NO_FLAGS_SET); + insert_entry(cache_ptr, file_ptr, 2, H5AC__NO_FLAGS_SET); + insert_entry(cache_ptr, file_ptr, 3, H5AC__NO_FLAGS_SET); - lock_entry(file_ptr, 0); - mark_entry_dirty(0); - unlock_entry(file_ptr, 0, H5AC__NO_FLAGS_SET); + lock_entry(file_ptr, 0); + mark_entry_dirty(0); + unlock_entry(file_ptr, 0, H5AC__NO_FLAGS_SET); - lock_entry(file_ptr, 1); + lock_entry(file_ptr, 1); pin_protected_entry(1, TRUE); - unlock_entry(file_ptr, 1, H5AC__NO_FLAGS_SET); + unlock_entry(file_ptr, 1, H5AC__NO_FLAGS_SET); unpin_entry(file_ptr, 1, TRUE, FALSE, FALSE); expunge_entry(file_ptr, 1); - lock_entry(file_ptr, 2); + lock_entry(file_ptr, 2); pin_protected_entry(2, TRUE); - unlock_entry(file_ptr, 2, H5AC__NO_FLAGS_SET); - mark_entry_dirty(2); + unlock_entry(file_ptr, 2, H5AC__NO_FLAGS_SET); + mark_entry_dirty(2); resize_entry(2, data[2].len / 2); resize_entry(2, data[2].len); unpin_entry(file_ptr, 2, TRUE, FALSE, FALSE); - move_entry(file_ptr, 0, 20); - move_entry(file_ptr, 0, 20); + move_entry(file_ptr, 0, 20); + move_entry(file_ptr, 0, 20); - if ( H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0 ) { + if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) { nerrors++; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", - world_mpi_rank, FUNC); - } + if(verbose) + HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, FUNC); } - if ( nerrors == 0 ) { - + if(nerrors == 0) { config.version = H5AC__CURR_CACHE_CONFIG_VERSION; - if ( H5AC_get_cache_auto_resize_config(cache_ptr, &config) - != SUCCEED ) { - - nerrors++; - HDfprintf(stdout, - "%d:%s: H5AC_get_cache_auto_resize_config() failed.\n", - world_mpi_rank, FUNC); - - } else { - + if(H5AC_get_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) { + nerrors++; + HDfprintf(stdout, "%d:%s: H5AC_get_cache_auto_resize_config() failed.\n", world_mpi_rank, FUNC); + } + else { config.open_trace_file = FALSE; config.close_trace_file = TRUE; - config.trace_file_name[0] = '\0'; + config.trace_file_name[0] = '\0'; - if ( H5AC_set_cache_auto_resize_config(cache_ptr, &config) - != SUCCEED ) { - - nerrors++; - HDfprintf(stdout, - "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n", - world_mpi_rank, FUNC); + if(H5AC_set_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) { + nerrors++; + HDfprintf(stdout, "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n", world_mpi_rank, FUNC); } } - } - - if ( fid >= 0 ) { + } /* end if */ - if ( ! take_down_cache(fid, cache_ptr) ) { + if(fid >= 0) { + if(!take_down_cache(fid, cache_ptr)) { nerrors++; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", - world_mpi_rank, FUNC); - } + if(verbose) + HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, FUNC); } - } + } /* end if */ /* verify that all instance of datum are back where the started * and are clean. */ - for ( i = 0; i < NUM_DATA_ENTRIES; i++ ) - { - HDassert( data_index[i] == i ); - HDassert( ! (data[i].dirty) ); + for(i = 0; i < NUM_DATA_ENTRIES; i++) { + HDassert(data_index[i] == i); + HDassert(!(data[i].dirty)); } /* compose the done message */ @@ -7091,117 +7048,121 @@ trace_file_check(int metadata_write_strategy) mssg.count = 0; /* not used */ mssg.magic = MSSG_MAGIC; - if ( success ) { - + if(success) { success = send_mssg(&mssg, FALSE); - if ( ! success ) { - + if(!success) { nerrors++; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", - world_mpi_rank, FUNC); - } + if(verbose) + HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, FUNC); } - } + } /* end if */ - if ( nerrors == 0 ) { + if(nerrors == 0) { + HDsprintf(trace_file_name, "t_cache_trace.txt.%d", (int)file_mpi_rank); - sprintf(trace_file_name, "t_cache_trace.txt.%d", - (int)file_mpi_rank); - - if ( (trace_file_ptr = HDfopen(trace_file_name, "r")) == NULL ) { + if((trace_file_ptr = HDfopen(trace_file_name, "r")) == NULL ) { nerrors++; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: HDfopen failed.\n", - world_mpi_rank, FUNC); - } + if(verbose) + HDfprintf(stdout, "%d:%s: HDfopen failed.\n", world_mpi_rank, FUNC); } - } - - i = 0; - while ( ( nerrors == 0 ) && ( ! done ) ) - { - if ( (*expected_output)[i] == NULL ) { - - expected_line_len = 0; - - } else { - - expected_line_len = HDstrlen((*expected_output)[i]); - } + } /* end if */ - if ( HDfgets(buffer, 255, trace_file_ptr) != NULL ) { - actual_line_len = HDstrlen(buffer); - - } else { - - actual_line_len = 0; - } + i = 0; + while((nerrors == 0) && (!done)) { + /* Get lines of actual and expected data */ + if((*expected_output)[i] == NULL) + expected_line_len = (size_t)0; + else + expected_line_len = HDstrlen((*expected_output)[i]); + + if(HDfgets(buffer, 255, trace_file_ptr) != NULL) + actual_line_len = HDstrlen(buffer); + else + actual_line_len = (size_t)0; + + /* Compare the lines */ + /* Handle running out of data */ + if((actual_line_len == 0) || (expected_line_len == 0)) { + if((actual_line_len == 0) && (expected_line_len == 0)) { + /* Both ran out at the same time - we're done */ + done = TRUE; + } + else { + /* One ran out before the other - BADNESS */ + nerrors++; + if(verbose) { + HDfprintf(stdout, "%d:%s: Unexpected data in trace file line %d.\n", world_mpi_rank, FUNC, i); + if(expected_line_len == 0) { + HDfprintf(stdout, "%d:%s: expected = \"%s\" %d\n", world_mpi_rank, FUNC, "<EMPTY>", expected_line_len); + HDfprintf(stdout, "%d:%s: actual = \"%s\" %d\n", world_mpi_rank, FUNC, buffer, actual_line_len); + } + if(actual_line_len == 0) { + HDfprintf(stdout, "%d:%s: expected = \"%s\" %d\n", world_mpi_rank, FUNC, (*expected_output)[i], expected_line_len); + HDfprintf(stdout, "%d:%s: actual = \"%s\" %d\n", world_mpi_rank, FUNC, "<EMPTY>", actual_line_len); + } + } + HDfprintf(stdout, "BADNESS BADNESS BADNESS\n"); + } + } + /* We directly compare the header line (line 0) */ + else if(0 == i) { + if((actual_line_len != expected_line_len) || (HDstrcmp(buffer, (*expected_output)[i]) != 0 )) { - if ( ( actual_line_len == 0 ) && ( expected_line_len == 0 ) ) { + nerrors++; + if(verbose) { + HDfprintf(stdout, "%d:%s: Unexpected data in trace file line %d.\n", world_mpi_rank, FUNC, i); + HDfprintf(stdout, "%d:%s: expected = \"%s\" %d\n", world_mpi_rank, FUNC, (*expected_output)[i], expected_line_len); + HDfprintf(stdout, "%d:%s: actual = \"%s\" %d\n", world_mpi_rank, FUNC, buffer, actual_line_len); + } + } + } + /* All other lines we tokenize and just compare the function name. This + * keeps the test from being too fragile. + */ + else { + char *tok = NULL; /* token for actual line */ - done = TRUE; + tok = HDstrtok(buffer, " "); - } else if ( ( actual_line_len != expected_line_len ) || - ( HDstrcmp(buffer, (*expected_output)[i]) != 0 ) ) { + if(HDstrcmp(tok, (*expected_output)[i]) != 0 ) { - nerrors++; - if ( verbose ) { - HDfprintf(stdout, - "%d:%s: Unexpected data in trace file line %d.\n", - world_mpi_rank, FUNC, i); - HDfprintf(stdout, "%d:%s: expected = \"%s\" %d\n", - world_mpi_rank, FUNC, (*expected_output)[i], - expected_line_len); - HDfprintf(stdout, "%d:%s: actual = \"%s\" %d\n", - world_mpi_rank, FUNC, buffer, - actual_line_len); + nerrors++; + if(verbose) { + HDfprintf(stdout, "%d:%s: Unexpected data in trace file line %d.\n", world_mpi_rank, FUNC, i); + HDfprintf(stdout, "%d:%s: expected = \"%s\"\n", world_mpi_rank, FUNC, (*expected_output)[i]); + HDfprintf(stdout, "%d:%s: actual = \"%s\"\n", world_mpi_rank, FUNC, tok); + } } - } else { - i++; - } - } + } /* end else */ - if ( trace_file_ptr != NULL ) { + i++; + } /* end while */ - HDfclose(trace_file_ptr); - trace_file_ptr = NULL; -#if 1 - HDremove(trace_file_name); -#endif + /* Clean up the trace file */ + if(trace_file_ptr != NULL) { + HDfclose(trace_file_ptr); + trace_file_ptr = NULL; + HDremove(trace_file_name); } - } + } /* end giant else that runs clients */ max_nerrors = get_max_nerrors(); - if ( world_mpi_rank == 0 ) { - - if ( max_nerrors == 0 ) { - - PASSED(); - - } else { + if(world_mpi_rank == 0) { + if(max_nerrors == 0) { + PASSED(); + } + else { failures++; H5_FAILED(); } } - success = ( ( success ) && ( max_nerrors == 0 ) ); - -#else /* H5_METADATA_TRACE_FILE */ - - if ( world_mpi_rank == 0 ) { - - SKIPPED(); - - HDfprintf(stdout, " trace file support disabled.\n"); - } - -#endif /* H5_METADATA_TRACE_FILE */ + success = ((success) && (max_nerrors == 0)); return(success); diff --git a/tools/test/h5dump/errfiles/tall-1.err b/tools/test/h5dump/errfiles/tall-1.err index 9733453..f4c2d91 100644 --- a/tools/test/h5dump/errfiles/tall-1.err +++ b/tools/test/h5dump/errfiles/tall-1.err @@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A.err b/tools/test/h5dump/errfiles/tall-2A.err index 9733453..f4c2d91 100644 --- a/tools/test/h5dump/errfiles/tall-2A.err +++ b/tools/test/h5dump/errfiles/tall-2A.err @@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A0.err b/tools/test/h5dump/errfiles/tall-2A0.err index 9733453..f4c2d91 100644 --- a/tools/test/h5dump/errfiles/tall-2A0.err +++ b/tools/test/h5dump/errfiles/tall-2A0.err @@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2B.err b/tools/test/h5dump/errfiles/tall-2B.err index 9733453..f4c2d91 100644 --- a/tools/test/h5dump/errfiles/tall-2B.err +++ b/tools/test/h5dump/errfiles/tall-2B.err @@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tdset-2.err b/tools/test/h5dump/errfiles/tdset-2.err index d00a92b..e61966f 100644 --- a/tools/test/h5dump/errfiles/tdset-2.err +++ b/tools/test/h5dump/errfiles/tdset-2.err @@ -21,19 +21,16 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info major: Links minor: Can't get value - #001: (file name) line (number) in H5L__get_info(): unable to get link info for: 'dset3' - major: Links - minor: Can't get value - #002: (file name) line (number) in H5L_get_info(): name doesn't exist + #001: (file name) line (number) in H5L_get_info(): name doesn't exist major: Links minor: Object already exists - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #002: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #005: (file name) line (number) in H5L__get_info_cb(): name doesn't exist + #004: (file name) line (number) in H5L__get_info_cb(): name doesn't exist major: Links minor: Object not found h5dump error: unable to get link info from "dset3" diff --git a/tools/test/h5dump/errfiles/textlink.err b/tools/test/h5dump/errfiles/textlink.err index 99e8530..4a5f545 100644 --- a/tools/test/h5dump/errfiles/textlink.err +++ b/tools/test/h5dump/errfiles/textlink.err @@ -2,61 +2,55 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename' major: File accessibilty minor: Unable to open file HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/textlinkfar.err b/tools/test/h5dump/errfiles/textlinkfar.err index a888ba9..1f9241a 100644 --- a/tools/test/h5dump/errfiles/textlinkfar.err +++ b/tools/test/h5dump/errfiles/textlinkfar.err @@ -2,52 +2,49 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open object + #007: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object - #009: (file name) line (number) in H5O_open_name(): object not found + #008: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #010: (file name) line (number) in H5G_loc_find(): can't find object + #009: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #011: (file name) line (number) in H5G_traverse(): internal path traversal failed + #010: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #012: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #011: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #013: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + #012: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed major: Links minor: Link traversal failure - #014: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link + #013: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link major: Symbol table minor: Object not found - #015: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #014: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #016: (file name) line (number) in H5G__traverse_slink_cb(): component not found + #015: (file name) line (number) in H5G__traverse_slink_cb(): component not found major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/textlinksrc.err b/tools/test/h5dump/errfiles/textlinksrc.err index a888ba9..1f9241a 100644 --- a/tools/test/h5dump/errfiles/textlinksrc.err +++ b/tools/test/h5dump/errfiles/textlinksrc.err @@ -2,52 +2,49 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open object + #007: (file name) line (number) in H5L__extern_traverse(): unable to open object major: Links minor: Can't open object - #009: (file name) line (number) in H5O_open_name(): object not found + #008: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #010: (file name) line (number) in H5G_loc_find(): can't find object + #009: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #011: (file name) line (number) in H5G_traverse(): internal path traversal failed + #010: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #012: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #011: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #013: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + #012: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed major: Links minor: Link traversal failure - #014: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link + #013: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link major: Symbol table minor: Object not found - #015: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #014: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #016: (file name) line (number) in H5G__traverse_slink_cb(): component not found + #015: (file name) line (number) in H5G__traverse_slink_cb(): component not found major: Symbol table minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): diff --git a/tools/test/h5dump/errfiles/torderlinks1.err b/tools/test/h5dump/errfiles/torderlinks1.err index 22b4318..648906b 100644 --- a/tools/test/h5dump/errfiles/torderlinks1.err +++ b/tools/test/h5dump/errfiles/torderlinks1.err @@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/torderlinks2.err b/tools/test/h5dump/errfiles/torderlinks2.err index 22b4318..648906b 100644 --- a/tools/test/h5dump/errfiles/torderlinks2.err +++ b/tools/test/h5dump/errfiles/torderlinks2.err @@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header minor: Can't open object - #001: (file name) line (number) in H5O__open_name(): unable to open object - major: Object header - minor: Can't open object - #002: (file name) line (number) in H5O_open_name(): object not found + #001: (file name) line (number) in H5O_open_name(): object not found major: Object header minor: Object not found - #003: (file name) line (number) in H5G_loc_find(): can't find object + #002: (file name) line (number) in H5G_loc_find(): can't find object major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G_traverse(): internal path traversal failed + #003: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed + #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed major: Links minor: Link traversal failure - #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed + #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed major: Links minor: Link traversal failure - #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID + #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID major: Symbol table minor: Unable to find atom information (already closed?) - #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' + #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file - #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' + #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' major: File accessibilty minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tperror.err b/tools/test/h5dump/errfiles/tperror.err index 55aeb4a..733b652 100644 --- a/tools/test/h5dump/errfiles/tperror.err +++ b/tools/test/h5dump/errfiles/tperror.err @@ -21,19 +21,16 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info major: Links minor: Can't get value - #001: (file name) line (number) in H5L__get_info(): unable to get link info for: 'bogus' - major: Links - minor: Can't get value - #002: (file name) line (number) in H5L_get_info(): name doesn't exist + #001: (file name) line (number) in H5L_get_info(): name doesn't exist major: Links minor: Object already exists - #003: (file name) line (number) in H5G_traverse(): internal path traversal failed + #002: (file name) line (number) in H5G_traverse(): internal path traversal failed major: Symbol table minor: Object not found - #004: (file name) line (number) in H5G__traverse_real(): traversal operator failed + #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed major: Symbol table minor: Callback failed - #005: (file name) line (number) in H5L__get_info_cb(): name doesn't exist + #004: (file name) line (number) in H5L__get_info_cb(): name doesn't exist major: Links minor: Object not found h5dump error: unable to get link info from "bogus" diff --git a/tools/test/h5jam/tellub.c b/tools/test/h5jam/tellub.c index 1c6ed3c..ea362f5 100644 --- a/tools/test/h5jam/tellub.c +++ b/tools/test/h5jam/tellub.c @@ -53,7 +53,7 @@ usage (const char *prog) /*------------------------------------------------------------------------- * Function: parse_command_line * - * Purpose: Parse the command line for the h5dumper. + * Purpose: Parse the command line. * * Return: Success: void * Failure: Exits program with EXIT_FAILURE value. @@ -89,7 +89,7 @@ parse_command_line (int argc, const char *argv[]) /*------------------------------------------------------------------------- * Function: main * - * Purpose: HDF5 user block unjammer + * Purpose: HDF5 user block tell size * * Return: EXIT_SUCCESS/EXIT_FAILURE *------------------------------------------------------------------------- |