diff options
Diffstat (limited to 'src')
336 files changed, 10314 insertions, 14608 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dc6ba0a..6d74939 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,8 +22,8 @@ set (H5_HDRS ${HDF5_SRC_DIR}/hdf5.h ${HDF5_SRC_DIR}/H5api_adpt.h ${HDF5_SRC_DIR}/H5public.h - ${HDF5_SRC_DIR}/H5version.h - ${HDF5_SRC_DIR}/H5overflow.h + #${HDF5_SRC_DIR}/H5version.h + #${HDF5_SRC_DIR}/H5overflow.h ) IDE_GENERATED_PROPERTIES ("H5" "${H5_HDRS}" "${H5_SRCS}" ) @@ -133,12 +133,12 @@ set (H5E_SRCS ) set (H5E_HDRS - ${HDF5_SRC_DIR}/H5Edefin.h - ${HDF5_SRC_DIR}/H5Einit.h + #${HDF5_SRC_DIR}/H5Edefin.h + #${HDF5_SRC_DIR}/H5Einit.h ${HDF5_SRC_DIR}/H5Epkg.h - ${HDF5_SRC_DIR}/H5Epubgen.h + #${HDF5_SRC_DIR}/H5Epubgen.h ${HDF5_SRC_DIR}/H5Epublic.h - ${HDF5_SRC_DIR}/H5Eterm.h + #${HDF5_SRC_DIR}/H5Eterm.h ) IDE_GENERATED_PROPERTIES ("H5E" "${H5E_HDRS}" "${H5E_SRCS}" ) @@ -721,7 +721,6 @@ set (H5_PUBLIC_HEADERS ${H5Z_HDRS} ) - set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5private.h ${HDF5_SRC_DIR}/H5Aprivate.h @@ -768,6 +767,55 @@ set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5win32defs.h ) +set (H5_GENERATED_HEADERS + ${HDF5_SRC_DIR}/H5Edefin.h + ${HDF5_SRC_DIR}/H5Einit.h + ${HDF5_SRC_DIR}/H5Epubgen.h + ${HDF5_SRC_DIR}/H5Eterm.h + ${HDF5_SRC_DIR}/H5version.h + ${HDF5_SRC_DIR}/H5overflow.h +) + +option (HDF5_GENERATE_HEADERS "Rebuild Generated Files" ON) +mark_as_advanced (HDF5_GENERATE_HEADERS) +if (HDF5_GENERATE_HEADERS) + find_package (Perl) + if (PERL_FOUND) + add_custom_command ( + OUTPUT ${HDF5_SRC_DIR}/H5Edefin.h ${HDF5_SRC_DIR}/H5Einit.h ${HDF5_SRC_DIR}/H5Epubgen.h ${HDF5_SRC_DIR}/H5Eterm.h + PRE_BUILD + COMMAND ${PERL_EXECUTABLE} + ARGS ${HDF5_SOURCE_DIR}/bin/make_err ${HDF5_SRC_DIR}/H5err.txt + DEPENDS ${HDF5_SRC_DIR}/H5err.txt + COMMENT " Creating err header" + ) + + add_custom_command ( + OUTPUT ${HDF5_SRC_DIR}/H5version.h + PRE_BUILD + COMMAND ${PERL_EXECUTABLE} + ARGS ${HDF5_SOURCE_DIR}/bin/make_vers ${HDF5_SRC_DIR}/H5vers.txt + DEPENDS ${HDF5_SRC_DIR}/H5vers.txt + COMMENT " Creating API version macro" + ) + + add_custom_command ( + OUTPUT ${HDF5_SRC_DIR}/H5overflow.h + PRE_BUILD + COMMAND ${PERL_EXECUTABLE} + ARGS ${HDF5_SOURCE_DIR}/bin/make_overflow ${HDF5_SRC_DIR}/H5overflow.txt + DEPENDS ${HDF5_SRC_DIR}/H5overflow.txt + COMMENT " Creating Assignment overflow macro" + ) + + add_custom_target(run_perl_scripts ALL + DEPENDS ${HDF5_SRC_DIR}/H5Edefin.h ${HDF5_SRC_DIR}/H5Einit.h ${HDF5_SRC_DIR}/H5Epubgen.h ${HDF5_SRC_DIR}/H5Eterm.h ${HDF5_SRC_DIR}/H5version.h ${HDF5_SRC_DIR}/H5overflow.h + ) + else (PERL_FOUND) + message (STATUS "Cannot generate headers - perl not found") + endif (PERL_FOUND) +endif (HDF5_GENERATE_HEADERS) + #----------------------------------------------------------------------------- # Setup the H5Detect utility which generates H5Tinit with platform # specific type checks inside @@ -777,6 +825,11 @@ TARGET_C_PROPERTIES (H5detect STATIC " " " ") if (MSVC OR MINGW) target_link_libraries (H5detect "ws2_32.lib") endif (MSVC OR MINGW) +if (HDF5_GENERATE_HEADERS) + add_dependencies(H5detect run_perl_scripts) +else (HDF5_GENERATE_HEADERS) + add_dependencies(H5detect "${H5_GENERATED_HEADERS}") +endif (HDF5_GENERATE_HEADERS) set (CMD $<TARGET_FILE:H5detect>) add_custom_command ( @@ -791,6 +844,11 @@ TARGET_C_PROPERTIES (H5make_libsettings STATIC " " " ") if (MSVC OR MINGW) target_link_libraries (H5make_libsettings "ws2_32.lib") endif (MSVC OR MINGW) +if (HDF5_GENERATE_HEADERS) + add_dependencies(H5make_libsettings run_perl_scripts) +else (HDF5_GENERATE_HEADERS) + add_dependencies(H5make_libsettings "${H5_GENERATED_HEADERS}") +endif (HDF5_GENERATE_HEADERS) set (CMD $<TARGET_FILE:H5make_libsettings>) add_custom_command ( @@ -801,59 +859,13 @@ add_custom_command ( WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) -if (GENERATE_ERROR_HEADERS) - find_package (Perl) - if (PERL_FOUND) - add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/H5Edefin.h - PRE_BUILD - COMMAND ${PERL_EXECUTABLE} - ARGS ${HDF5_SOURCE_DIR}/bin/make_err ${HDF5_SOURCE_DIR}/src/H5err.txt - DEPENDS ${HDF5_SOURCE_DIR}/src/H5err.txt - COMMENT " Creating err header" - ) - - add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/H5version.h - PRE_BUILD - COMMAND ${PERL_EXECUTABLE} - ARGS ${HDF5_SOURCE_DIR}/bin/make_vers ${HDF5_SOURCE_DIR}/src/H5vers.txt - DEPENDS ${HDF5_SOURCE_DIR}/src/H5vers.txt - COMMENT " Creating API version macro" - ) - - add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/H5overflow.h - PRE_BUILD - COMMAND ${PERL_EXECUTABLE} - ARGS ${HDF5_SOURCE_DIR}/bin/make_overflow ${HDF5_SOURCE_DIR}/src/H5overflow.txt - DEPENDS ${HDF5_SOURCE_DIR}/src/H5overflow.txt - COMMENT " Creating Assignment overflow macro" - ) - - add_custom_target(run_perl_scripts ALL - DEPENDS ${HDF5_BINARY_DIR}/H5Edefin.h ${HDF5_BINARY_DIR}/H5version.h ${HDF5_BINARY_DIR}/H5overflow.h - ) - else (PERL_FOUND) - message (STATUS "Cannot generate headers - perl not found") - endif (PERL_FOUND) -endif (GENERATE_ERROR_HEADERS) - #----------------------------------------------------------------------------- # Add H5Tinit source to build - generated by H5Detect/CMake at configure time #----------------------------------------------------------------------------- set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5Tinit.c) -set_source_files_properties (${HDF5_BINARY_DIR}/H5Tinit.c GENERATED) set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5lib_settings.c) -set_source_files_properties (${HDF5_BINARY_DIR}/H5lib_settings.c GENERATED) -set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5Edefin.h) -set_source_files_properties (${HDF5_BINARY_DIR}/H5Edefin.h GENERATED) -set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5version.h) -set_source_files_properties (${HDF5_BINARY_DIR}/H5version.h GENERATED) -set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5overflow.h) -set_source_files_properties (${HDF5_BINARY_DIR}/H5overflow.h GENERATED) - -add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS}) + +add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_LIB_TARGET} ${LINK_LIBS}) if (NOT WIN32) @@ -868,6 +880,11 @@ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" ) +if (HDF5_GENERATE_HEADERS) + add_dependencies(${HDF5_LIB_TARGET} run_perl_scripts) +else (HDF5_GENERATE_HEADERS) + add_dependencies(${HDF5_LIB_TARGET} "${HDF5_SRC_DIR}/H5Edefin.h;${HDF5_SRC_DIR}/H5Einit.h;${HDF5_SRC_DIR}/H5Epubgen.h;${HDF5_SRC_DIR}/H5Eterm.h") +endif (HDF5_GENERATE_HEADERS) option (HDF5_ENABLE_DEBUG_APIS "Turn on debugging in all packages" OFF) if (HDF5_ENABLE_DEBUG_APIS) @@ -879,7 +896,7 @@ endif (HDF5_ENABLE_DEBUG_APIS) set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) - add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS}) + add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_LIBSH_TARGET} ${LINK_SHARED_LIBS}) if (NOT WIN32) @@ -896,6 +913,11 @@ if (BUILD_SHARED_LIBS) INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 ) + if (HDF5_GENERATE_HEADERS) + add_dependencies(${HDF5_LIBSH_TARGET} run_perl_scripts) + else (HDF5_GENERATE_HEADERS) + add_dependencies(${HDF5_LIBSH_TARGET} "${HDF5_SRC_DIR}/H5Edefin.h;${HDF5_SRC_DIR}/H5Einit.h;${HDF5_SRC_DIR}/H5Epubgen.h;${HDF5_SRC_DIR}/H5Eterm.h") + endif (HDF5_GENERATE_HEADERS) if (HDF5_ENABLE_THREADSAFE) set_property (TARGET ${HDF5_LIBSH_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS @@ -919,6 +941,7 @@ if (NOT HDF5_INSTALL_NO_DEVELOPMENT) install ( FILES ${H5_PUBLIC_HEADERS} + ${H5_GENERATED_HEADERS} DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} COMPONENT @@ -74,6 +74,7 @@ hbool_t H5_api_entered_g = FALSE; H5_api_t H5_g; #else hbool_t H5_libinit_g = FALSE; /* Library hasn't been initialized */ +hbool_t H5_libterm_g = FALSE; /* Library isn't being shutdown */ #endif #ifdef H5_HAVE_MPE @@ -261,6 +262,9 @@ H5_term_library(void) if(!(H5_INIT_GLOBAL)) goto done; + /* Indicate that the library is being shut down */ + H5_TERM_GLOBAL = TRUE; + /* Check if we should display error output */ (void)H5Eget_auto2(H5E_DEFAULT, &func, NULL); @@ -270,7 +274,7 @@ H5_term_library(void) * way that would necessitate some cleanup work in the other interface. */ #define DOWN(F) \ - (((n = H5##F##_term_interface()) && (at + 8) < sizeof loop)? \ + (((n = H5##F##_term_package()) && (at + 8) < sizeof loop)? \ (sprintf(loop + at, "%s%s", (at ? "," : ""), #F), \ at += HDstrlen(loop + at), \ n): \ @@ -281,20 +285,46 @@ H5_term_library(void) do { pending = 0; + /* Try to organize these so the "higher" level components get shut * down before "lower" level components that they might rely on. -QAK */ - pending += DOWN(R); - pending += DOWN(D); pending += DOWN(L); - pending += DOWN(G); - pending += DOWN(A); - pending += DOWN(S); - pending += DOWN(T); + + /* Close the "top" of various interfaces (IDs, etc) but don't shut + * down the whole interface yet, so that the object header messages + * get serialized correctly for entries in the metadata cache and the + * symbol table entry in the superblock gets serialized correctly, etc. + * all of which is performed in the 'F' shutdown. + */ + pending += DOWN(A_top); + pending += DOWN(D_top); + pending += DOWN(G_top); + pending += DOWN(R_top); + pending += DOWN(S_top); + pending += DOWN(T_top); + /* Don't shut down the file code until objects in files are shut down */ if(pending == 0) pending += DOWN(F); + /* Wait to shut down the "bottom" of various interfaces until the + * files are closed, so pieces of the file can be serialized + * correctly. + */ + if(pending == 0) { + /* Shut down the "bottom" of the attribute, dataset, group, + * reference, dataspace, and datatype interfaces, fully closing + * out the interfaces now. + */ + pending += DOWN(A); + pending += DOWN(D); + pending += DOWN(G); + pending += DOWN(R); + pending += DOWN(S); + pending += DOWN(T); + } /* end if */ + /* Don't shut down "low-level" components until "high-level" components * have successfully shut down. This prevents property lists and IDs * from being closed "out from underneath" of the high-level objects @@ -303,8 +333,8 @@ H5_term_library(void) if(pending == 0) { pending += DOWN(AC); pending += DOWN(Z); - pending += DOWN(FD); pending += DOWN(P); + pending += DOWN(FD); pending += DOWN(PL); /* Don't shut down the error code until other APIs which use it are shut down */ if(pending == 0) @@ -318,7 +348,7 @@ H5_term_library(void) /* Don't shut down the free list code until _everything_ else is down */ if(pending == 0) pending += DOWN(FL); - } + } /* end if */ } while(pending && ntries++ < 100); if(pending) { @@ -362,12 +392,17 @@ H5_term_library(void) (void)H5MM_free(tmp_open_stream); } /* end while */ + /* Reset flag indicating that the library is being shut down */ + H5_TERM_GLOBAL = FALSE; + /* Mark library as closed */ H5_INIT_GLOBAL = FALSE; + done: #ifdef H5_HAVE_THREADSAFE H5_API_UNLOCK #endif /* H5_HAVE_THREADSAFE */ + return; } /* end H5_term_library() */ @@ -17,11 +17,8 @@ /* Module Setup */ /****************/ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5A__init_interface +#include "H5Amodule.h" /* This source code file is part of the H5A module */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ /***********/ @@ -37,6 +34,7 @@ #include "H5Sprivate.h" /* Dataspace functions */ #include "H5SMprivate.h" /* Shared Object Header Messages */ + /****************/ /* Local Macros */ /****************/ @@ -68,6 +66,9 @@ typedef struct H5A_iter_cb1 { /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -95,39 +96,16 @@ static const H5I_class_t H5I_ATTR_CLS[1] = {{ (H5I_free_t)H5A_close /* Callback routine for closing objects of this class */ }}; +/* Flag indicating "top" of interface has been initialized */ +static hbool_t H5A_top_package_initialize_s = FALSE; - -/*------------------------------------------------------------------------- - * Function: H5A_init - * - * Purpose: Initialize the interface from some other package. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Quincey Koziol - * Monday, November 27, 2006 - * - *------------------------------------------------------------------------- - */ -herr_t -H5A_init(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - /* FUNC_ENTER() does all the work */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5A_init() */ /*-------------------------------------------------------------------------- NAME - H5A__init_interface -- Initialize interface-specific information + H5A__init_package -- Initialize interface-specific information USAGE - herr_t H5A__init_interface() + herr_t H5A__init_package() RETURNS Non-negative on success/Negative on failure @@ -135,12 +113,12 @@ DESCRIPTION Initializes any interface-specific data or routines. --------------------------------------------------------------------------*/ -static herr_t -H5A__init_interface(void) +herr_t +H5A__init_package(void) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_PACKAGE /* * Create attribute ID type. @@ -148,21 +126,25 @@ H5A__init_interface(void) if(H5I_register_type(H5I_ATTR_CLS) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to initialize interface") + /* Mark "top" of interface as initialized, too */ + H5A_top_package_initialize_s = TRUE; + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5A__init_interface() */ +} /* end H5A__init_package() */ /*-------------------------------------------------------------------------- NAME - H5A_term_interface + H5A_top_term_package PURPOSE Terminate various H5A objects USAGE - void H5A_term_interface() + void H5A_top_term_package() RETURNS DESCRIPTION - Release any other resources allocated. + Release IDs for the atom group, deferring full interface shutdown + until later (in H5A_term_package). GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS Can't report errors... @@ -170,32 +152,68 @@ done: REVISION LOG --------------------------------------------------------------------------*/ int -H5A_term_interface(void) +H5A_top_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5A_top_package_initialize_s) { if(H5I_nmembers(H5I_ATTR) > 0) { (void)H5I_clear_type(H5I_ATTR, FALSE, FALSE); n++; /*H5I*/ } /* end if */ - else { - /* Close deprecated interface */ - n += H5A__term_deprec_interface(); - /* Destroy the attribute object id group */ - (void)H5I_dec_type_ref(H5I_ATTR); - n++; /*H5I*/ + /* Mark closed */ + if(0 == n) + H5A_top_package_initialize_s = FALSE; + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* H5A_top_term_package() */ + + +/*-------------------------------------------------------------------------- + NAME + H5A_term_package + PURPOSE + Terminate various H5A objects + USAGE + void H5A_term_package() + RETURNS + DESCRIPTION + Release any other resources allocated. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Can't report errors... + + Finishes shutting down the interface, after H5A_top_term_package() + is called + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +int +H5A_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + /* Sanity checks */ + HDassert(0 == H5I_nmembers(H5I_ATTR)); + HDassert(FALSE == H5A_top_package_initialize_s); + + /* Destroy the attribute object id group */ + n += (H5I_dec_type_ref(H5I_ATTR) > 0); - /* Mark closed */ - H5_interface_initialize_g = 0; - } /* end else */ + /* Mark closed */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* H5A_term_interface() */ +} /* H5A_term_package() */ /*-------------------------------------------------------------------------- @@ -31,11 +31,9 @@ /* Module Setup */ /****************/ -#define H5AC_PACKAGE /*suppress error about including H5ACpkg */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5ACmodule.h" /* This source code file is part of the H5AC module */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5AC_init_interface /***********/ /* Headers */ @@ -74,6 +72,9 @@ static herr_t H5AC__ext_config_2_int_config(H5AC_cache_config_t *ext_conf_ptr, /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -136,7 +137,6 @@ static const char *H5AC_entry_type_names[H5AC_NTYPES] = * Purpose: Initialize the interface from some other layer. * * Return: Success: non-negative - * * Failure: negative * * Programmer: Quincey Koziol @@ -147,7 +147,7 @@ static const char *H5AC_entry_type_names[H5AC_NTYPES] = herr_t H5AC_init(void) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* FUNC_ENTER() does all the work */ @@ -158,7 +158,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5AC_init_interface + * Function: H5AC__init_package * * Purpose: Initialize interface-specific information * @@ -169,8 +169,8 @@ done: * *------------------------------------------------------------------------- */ -static herr_t -H5AC_init_interface(void) +herr_t +H5AC__init_package(void) { #ifdef H5_HAVE_PARALLEL H5P_genplist_t *xfer_plist; /* Dataset transfer property list object */ @@ -179,7 +179,7 @@ H5AC_init_interface(void) #endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE #ifdef H5_HAVE_PARALLEL /* Sanity check */ @@ -268,17 +268,16 @@ H5AC_init_interface(void) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5AC_init_interface() */ +} /* end H5AC__init_package() */ /*------------------------------------------------------------------------- - * Function: H5AC_term_interface + * Function: H5AC_term_package * * Purpose: Terminate this interface. * * Return: Success: Positive if anything was done that might * affect other interfaces; zero otherwise. - * * Failure: Negative. * * Programmer: Quincey Koziol @@ -287,13 +286,13 @@ done: *------------------------------------------------------------------------- */ int -H5AC_term_interface(void) +H5AC_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5_PKG_INIT_VAR) { #ifdef H5_HAVE_PARALLEL if(H5AC_dxpl_id > 0 || H5AC_ind_dxpl_id > 0 || H5AC_coll_write_coll_read_dxpl_id > 0 || @@ -306,34 +305,24 @@ H5AC_term_interface(void) H5I_dec_ref(H5AC_coll_write_coll_read_dxpl_id) < 0 || H5I_dec_ref(H5AC_ind_write_coll_read_dxpl_id) < 0) H5E_clear_stack(NULL); /*ignore error*/ - else { - /* Reset static IDs */ - H5AC_dxpl_id = (-1); - H5AC_ind_dxpl_id = (-1); - H5AC_coll_write_coll_read_dxpl_id = (-1); - H5AC_ind_write_coll_read_dxpl_id = (-1); - - /* Reset interface initialization flag */ - H5_interface_initialize_g = 0; - } /* end else */ } /* end if */ - else { #endif /* H5_HAVE_PARALLEL */ - /* Reset static IDs */ - H5AC_dxpl_id = (-1); - H5AC_ind_dxpl_id = (-1); + + /* Reset static IDs */ + H5AC_dxpl_id = (-1); + H5AC_ind_dxpl_id = (-1); #ifdef H5_HAVE_PARALLEL - } /* end else */ - H5AC_coll_write_coll_read_dxpl_id = (-1); - H5AC_ind_write_coll_read_dxpl_id = (-1); + H5AC_coll_write_coll_read_dxpl_id = (-1); + H5AC_ind_write_coll_read_dxpl_id = (-1); #endif /* H5_HAVE_PARALLEL */ /* Reset interface initialization flag */ - H5_interface_initialize_g = 0; + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5AC_term_interface() */ +} /* end H5AC_term_package() */ /*------------------------------------------------------------------------- @@ -1126,7 +1115,7 @@ H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, size_t trace_entry_size = 0; FILE * trace_file_ptr = NULL; #endif /* H5AC__TRACE_FILE_ENABLED */ - void * ret_value; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -2381,3 +2370,113 @@ H5AC_retag_copied_metadata(const H5F_t *f, haddr_t metadata_tag) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5AC_retag_copied_metadata */ + +/*------------------------------------------------------------------------- + * Function: H5AC_get_entry_ring + * + * Purpose: Given a file address, retrieve the ring for an entry at that + * address. + * + * On error, the value of *ring is not modified. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * 9/8/15 + * + *------------------------------------------------------------------------- + */ +herr_t +H5AC_get_entry_ring(const H5F_t *f, haddr_t addr, H5AC_ring_t *ring) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(ring); + + /* Retrieve the ring value for the entry at address */ + if(H5C_get_entry_ring(f, addr, ring) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "Can't retrieve ring for entry") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5AC_get_entry_ring() */ + + +/*------------------------------------------------------------------------- + * Function: H5AC_set_ring + * + * Purpose: Routine to set the ring on a DXPL (for passing through + * to the metadata cache). + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, September 8, 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5AC_set_ring(hid_t dxpl_id, H5AC_ring_t ring, H5P_genplist_t **dxpl, + H5AC_ring_t *orig_ring) +{ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(dxpl); + HDassert(orig_ring); + + /* Set the ring type in the DXPL */ + if(NULL == ((*dxpl) = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + if((H5P_get((*dxpl), H5AC_RING_NAME, orig_ring)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get original ring value") + if((H5P_set((*dxpl), H5AC_RING_NAME, &ring)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set ring value") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5AC_set_ring() */ + + +/*------------------------------------------------------------------------- + * Function: H5AC_reset_ring + * + * Purpose: Routine to reset the original ring on a DXPL (after passing + * through to the metadata cache). + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, September 8, 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5AC_reset_ring(H5P_genplist_t *dxpl, H5AC_ring_t orig_ring) +{ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Reset the ring in the DXPL, if it's been changed */ + if(orig_ring) { + /* Sanity check */ + HDassert(dxpl); + + if((H5P_set(dxpl, H5AC_RING_NAME, &orig_ring)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set property value") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5AC_reset_ring() */ + diff --git a/src/H5ACmodule.h b/src/H5ACmodule.h new file mode 100644 index 0000000..a8dba59 --- /dev/null +++ b/src/H5ACmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5AC package. Including this header means that the source file + * is part of the H5AC package. + */ +#ifndef _H5ACmodule_H +#define _H5ACmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5AC_MODULE +#define H5_MY_PKG H5AC +#define H5_MY_PKG_ERR H5E_CACHE +#define H5_MY_PKG_INIT YES + +#endif /* _H5ACmodule_H */ + diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index 78a2485..3331613 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -29,11 +29,9 @@ /* Module Setup */ /****************/ -#define H5AC_PACKAGE /*suppress error about including H5ACpkg */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5ACmodule.h" /* This source code file is part of the H5AC module */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5AC__init_mpio_interface /***********/ /* Headers */ @@ -135,33 +133,6 @@ H5FL_DEFINE(H5AC_aux_t); H5FL_DEFINE_STATIC(H5AC_slist_entry_t); -/*------------------------------------------------------------------------- - * Function: H5AC__init_mpio_interface - * - * Purpose: Initialize interface-specific information - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * 6/20/15 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5AC__init_mpio_interface(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Funnel all work to H5AC_init() */ - if(H5AC_init() < 0) - HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "interface initialization failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC__init_mpio_interface() */ - /*------------------------------------------------------------------------- * Function: H5AC__set_sync_point_done_callback diff --git a/src/H5ACpkg.h b/src/H5ACpkg.h index 74bf079..050e21c 100644 --- a/src/H5ACpkg.h +++ b/src/H5ACpkg.h @@ -28,7 +28,7 @@ * */ -#ifndef H5AC_PACKAGE +#if !(defined H5AC_FRIEND || defined H5AC_MODULE) #error "Do not include this file outside the H5AC package!" #endif diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 7a5a4d9..8ebbb67 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -132,6 +132,15 @@ typedef enum { #define H5AC__SERIALIZE_MOVED_FLAG H5C__SERIALIZE_MOVED_FLAG #define H5AC__SERIALIZE_COMPRESSED_FLAG H5C__SERIALIZE_COMPRESSED_FLAG +/* Aliases for the "ring" type and values */ +typedef H5C_ring_t H5AC_ring_t; +#define H5AC_RING_INV H5C_RING_UNDEFINED +#define H5AC_RING_US H5C_RING_USER +#define H5AC_RING_FSM H5C_RING_FSM +#define H5AC_RING_SBE H5C_RING_SBE +#define H5AC_RING_SB H5C_RING_SB +#define H5AC_RING_NTYPES H5C_RING_NTYPES + /* Aliases for 'notify action' type & values */ typedef H5C_notify_action_t H5AC_notify_action_t; #define H5AC_NOTIFY_ACTION_AFTER_INSERT H5C_NOTIFY_ACTION_AFTER_INSERT @@ -185,6 +194,8 @@ typedef H5C_t H5AC_t; #define H5AC_METADATA_TAG_SIZE sizeof(haddr_t) #define H5AC_METADATA_TAG_DEF H5AC__INVALID_TAG +#define H5AC_RING_NAME "H5AC_ring_type" + /* Dataset transfer property list for flush calls */ /* (Collective set, "block before metadata write" set and "library internal" set) */ /* (Global variable declaration, definition is in H5AC.c) */ @@ -353,9 +364,16 @@ H5_DLL herr_t H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5_DLL herr_t H5AC_validate_config(H5AC_cache_config_t *config_ptr); 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); + +/* Tag & Ring routines */ H5_DLL herr_t H5AC_tag(hid_t dxpl_id, haddr_t metadata_tag, haddr_t *prev_tag); H5_DLL herr_t H5AC_retag_copied_metadata(const H5F_t *f, haddr_t metadata_tag); H5_DLL herr_t H5AC_ignore_tags(const H5F_t *f); +H5_DLL herr_t H5AC_get_entry_ring(const H5F_t *f, haddr_t addr, H5AC_ring_t *ring); +H5_DLL herr_t H5AC_set_ring(hid_t dxpl_id, H5AC_ring_t ring, H5P_genplist_t **dxpl, + H5AC_ring_t *orig_ring); +H5_DLL herr_t H5AC_reset_ring(H5P_genplist_t *dxpl, H5AC_ring_t orig_ring); + #ifdef H5_HAVE_PARALLEL H5_DLL herr_t H5AC_add_candidate(H5AC_t * cache_ptr, haddr_t addr); diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c index 5e29d3f..28e49a6 100644 --- a/src/H5Abtree2.c +++ b/src/H5Abtree2.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ +#include "H5Amodule.h" /* This source code file is part of the H5A module */ /***********/ @@ -247,7 +247,7 @@ H5A__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec) { const H5A_bt2_ud_common_t *bt2_udata = (const H5A_bt2_ud_common_t *)_bt2_udata; const H5A_dense_bt2_name_rec_t *bt2_rec = (const H5A_dense_bt2_name_rec_t *)_bt2_rec; - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -438,7 +438,7 @@ H5A__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec) { const H5A_bt2_ud_common_t *bt2_udata = (const H5A_bt2_ud_common_t *)_bt2_udata; const H5A_dense_bt2_corder_rec_t *bt2_rec = (const H5A_dense_bt2_corder_rec_t *)_bt2_rec; - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_STATIC_NOERR diff --git a/src/H5Adense.c b/src/H5Adense.c index 6d18249..3dc3a42 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -29,8 +29,8 @@ /* Module Setup */ /****************/ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Amodule.h" /* This source code file is part of the H5A module */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ /***********/ @@ -1149,7 +1149,7 @@ H5A_dense_iterate(H5F_t *f, hid_t dxpl_id, hid_t loc_id, const H5O_ainfo_t *ainf H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */ haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */ - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1701,7 +1701,7 @@ H5A_dense_exists(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char * htri_t attr_sharable; /* Flag indicating attributes are sharable */ htri_t ret_value = TRUE; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_NOAPI(FAIL) /* * Check arguments. diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index ccc7659..ae0f041 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -31,11 +31,8 @@ /* Module Setup */ /****************/ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5A__init_deprec_interface +#include "H5Amodule.h" /* This source code file is part of the H5A module */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ /***********/ @@ -84,51 +81,6 @@ /*******************/ - -/*-------------------------------------------------------------------------- -NAME - H5A__init_deprec_interface -- Initialize interface-specific information -USAGE - herr_t H5A__init_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5A_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5A__init_deprec_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5A_init()) -} /* H5A__init_deprec_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5A__term_deprec_interface -- Terminate interface -USAGE - herr_t H5A__term_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5A__term_deprec_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5A__term_deprec_interface() */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /*-------------------------------------------------------------------------- diff --git a/src/H5Aint.c b/src/H5Aint.c index 91bbc24..193e8f4 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -28,8 +28,8 @@ /* Module Setup */ /****************/ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Amodule.h" /* This source code file is part of the H5A module */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ /***********/ @@ -142,11 +142,11 @@ H5A_t * H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, const H5S_t *space, hid_t acpl_id, hid_t dxpl_id) { - H5A_t *attr = NULL; /* Attribute created */ - hssize_t snelmts; /* elements in attribute */ - size_t nelmts; /* elements in attribute */ - htri_t tri_ret; /* htri_t return value */ - H5A_t *ret_value; /* Return value */ + H5A_t *attr = NULL; /* Attribute created */ + hssize_t snelmts; /* elements in attribute */ + size_t nelmts; /* elements in attribute */ + htri_t exists; /* Whether attribute exists */ + H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->oloc->addr, NULL) @@ -161,9 +161,9 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, * name, but it's going to be hard to unwind all the special cases on * failure, so just check first, for now - QAK) */ - if((tri_ret = H5O_attr_exists(loc->oloc, name, H5AC_ind_dxpl_id)) < 0) + if((exists = H5O_attr_exists(loc->oloc, name, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "error checking attributes") - else if(tri_ret > 0) + else if(exists > 0) HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, NULL, "attribute already exists") /* Check if the dataspace has an extent set (or is NULL) */ @@ -360,7 +360,7 @@ H5A_open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ H5A_t *attr = NULL; /* Attribute from object header */ - H5A_t *ret_value; /* Return value */ + H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -424,7 +424,7 @@ H5A_open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_na H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ H5A_t *attr = NULL; /* Attribute from object header */ - H5A_t *ret_value; /* Return value */ + H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -705,7 +705,7 @@ ssize_t H5A__get_name(H5A_t *attr, size_t buf_size, char *buf) { size_t copy_len, nbytes; - ssize_t ret_value; + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -849,7 +849,8 @@ H5A_get_create_plist(H5A_t* attr) H5P_genplist_t *plist; /* Default property list */ hid_t new_plist_id; /* ID of ACPL to return */ H5P_genplist_t *new_plist; /* ACPL to return */ - hid_t ret_value; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + FUNC_ENTER_NOAPI_NOINIT if(NULL == (plist = (H5P_genplist_t *)H5I_object(H5P_LST_ATTRIBUTE_CREATE_ID_g))) @@ -888,7 +889,9 @@ done: herr_t H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo) { - FUNC_ENTER_NOAPI_NOERR + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) /* Check args */ HDassert(attr); @@ -906,7 +909,8 @@ H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo) ainfo->corder = attr->shared->crt_idx; } /* end else */ - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__get_info() */ @@ -1099,15 +1103,16 @@ done: H5O_loc_t * H5A_oloc(H5A_t *attr) { - H5O_loc_t *ret_value; /* Return value */ + H5O_loc_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(NULL) HDassert(attr); /* Set return value */ ret_value = &(attr->oloc); +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_oloc() */ @@ -1130,15 +1135,16 @@ H5A_oloc(H5A_t *attr) H5G_name_t * H5A_nameof(H5A_t *attr) { - H5G_name_t *ret_value; /* Return value */ + H5G_name_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(NULL) HDassert(attr); /* Set return value */ - ret_value=&(attr->path); + ret_value = &(attr->path); +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_nameof() */ @@ -1159,15 +1165,16 @@ H5A_nameof(H5A_t *attr) H5T_t * H5A_type(const H5A_t *attr) { - H5T_t *ret_value; /* Return value */ + H5T_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(NULL) HDassert(attr); /* Set return value */ ret_value = attr->shared->dt; +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_type() */ @@ -1193,7 +1200,7 @@ H5A_exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name, H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1552,7 +1559,7 @@ H5A__attr_cmp_name_dec(const void *attr1, const void *attr2) static int H5A__attr_cmp_corder_inc(const void *attr1, const void *attr2) { - int ret_value; /* Return value */ + int ret_value = 0; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -1587,7 +1594,7 @@ H5A__attr_cmp_corder_inc(const void *attr1, const void *attr2) static int H5A__attr_cmp_corder_dec(const void *attr1, const void *attr2) { - int ret_value; /* Return value */ + int ret_value = 0; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -1790,8 +1797,8 @@ done: htri_t H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_ainfo_t *ainfo) { - H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ - htri_t ret_value; /* Return value */ + H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, oh->cache_info.addr, FAIL) @@ -1857,8 +1864,9 @@ H5A_set_version(const H5F_t *f, H5A_t *attr) { hbool_t type_shared, space_shared; /* Flags to indicate that shared messages are used for this attribute */ hbool_t use_latest_format; /* Flag indicating the newest file format should be used */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(FAIL) /* check arguments */ HDassert(f); @@ -1888,7 +1896,8 @@ H5A_set_version(const H5F_t *f, H5A_t *attr) else attr->shared->version = H5O_ATTR_VERSION_1; /* Write out basic version */ - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_set_version() */ @@ -1925,8 +1934,7 @@ H5A_attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_si void *buf = NULL; /* Buffer for copying data */ void *reclaim_buf = NULL; /* Buffer for reclaiming data */ hid_t buf_sid = -1; /* ID for buffer dataspace */ - - H5A_t *ret_value; /* Return value */ + H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Amodule.h b/src/H5Amodule.h new file mode 100644 index 0000000..e347fe1 --- /dev/null +++ b/src/H5Amodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5A package. Including this header means that the source file + * is part of the H5A package. + */ +#ifndef _H5Amodule_H +#define _H5Amodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5A_MODULE +#define H5_MY_PKG H5A +#define H5_MY_PKG_ERR H5E_ATTR +#define H5_MY_PKG_INIT YES + +#endif /* _H5Amodule_H */ + diff --git a/src/H5Apkg.h b/src/H5Apkg.h index d3fcd53..b815d11 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -21,7 +21,7 @@ * the H5A package. Source files outside the H5A package should * include H5Aprivate.h instead. */ -#ifndef H5A_PACKAGE +#if !(defined H5A_FRIEND || defined H5A_MODULE) #error "Do not include this file outside the H5A package!" #endif @@ -184,8 +184,6 @@ H5_DLLVAR const H5B2_class_t H5A_BT2_CORDER[1]; /******************************/ /* Function prototypes for H5A package scope */ -H5_DLL herr_t H5A_init(void); -H5_DLL herr_t H5A__term_deprec_interface(void); H5_DLL H5A_t *H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, const H5S_t *space, hid_t acpl_id, hid_t dxpl_id); H5_DLL H5A_t *H5A_open_by_name(const H5G_loc_t *loc, const char *obj_name, diff --git a/src/H5Atest.c b/src/H5Atest.c index 19b5547..d57bbe1 100644 --- a/src/H5Atest.c +++ b/src/H5Atest.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ +#include "H5Amodule.h" /* This source code file is part of the H5A module */ #define H5A_TESTING /*suppress warning about H5A testing funcs*/ @@ -95,7 +95,7 @@ htri_t H5A_is_shared_test(hid_t attr_id) { H5A_t *attr; /* Attribute object for ID */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -97,7 +97,7 @@ /* Module Setup */ /****************/ -#define H5B_PACKAGE /*suppress error about including H5Bpkg */ +#include "H5Bmodule.h" /* This source code file is part of the H5B module */ /***********/ @@ -166,6 +166,9 @@ static H5B_t * H5B__copy(const H5B_t *old_bt); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Declare a free list to manage the haddr_t sequence information */ H5FL_SEQ_DEFINE(haddr_t); @@ -309,7 +312,7 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u H5B_cache_ud_t cache_udata; /* User-data for metadata cache callback */ unsigned idx = 0, lt = 0, rt; /* Final, left & right key indices */ int cmp = 1; /* Key comparison value */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1203,7 +1206,7 @@ herr_t H5B_iterate(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, H5B_operator_t op, void *udata) { - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOERR @@ -1700,7 +1703,7 @@ H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey) { H5B_shared_t *shared = NULL; /* New shared B-tree struct */ size_t u; /* Local index variable */ - H5B_shared_t *ret_value; /* Return value */ + H5B_shared_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1808,7 +1811,7 @@ H5B__copy(const H5B_t *old_bt) { H5B_t *new_node = NULL; H5B_shared_t *shared; /* Pointer to shared B-tree info */ - H5B_t *ret_value; + H5B_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -33,7 +33,8 @@ /* Module Setup */ /****************/ -#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ +#include "H5B2module.h" /* This source code file is part of the H5B2 module */ + /***********/ /* Headers */ @@ -67,6 +68,9 @@ /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* v2 B-tree client ID to class mapping */ /* Remember to add client ID to H5B2_subid_t in H5B2private.h when adding a new @@ -132,7 +136,7 @@ H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, void *ctx_udat H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ haddr_t hdr_addr; /* B-tree header address */ - H5B2_t *ret_value; /* Return value */ + H5B2_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -206,7 +210,7 @@ H5B2_open(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *ctx_udata) H5B2_t *bt2 = NULL; /* Pointer to the B-tree */ H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */ H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */ - H5B2_t *ret_value; /* Return value */ + H5B2_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 9e43ff8..421e24b 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ +#include "H5B2module.h" /* This source code file is part of the H5B2 module */ /***********/ @@ -216,7 +216,7 @@ H5B2__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ - H5B2_hdr_t *ret_value; /* Return value */ + H5B2_hdr_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -490,7 +490,7 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ unsigned u; /* Local index variable */ - H5B2_internal_t *ret_value; /* Return value */ + H5B2_internal_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -798,7 +798,7 @@ H5B2__cache_leaf_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ unsigned u; /* Local index variable */ - H5B2_leaf_t *ret_value; /* Return value */ + H5B2_leaf_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index d3b5014..f723d10 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ +#include "H5B2module.h" /* This source code file is part of the H5B2 module */ + /***********/ /* Headers */ diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index d873cf6..16d8467 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ +#include "H5B2module.h" /* This source code file is part of the H5B2 module */ + /***********/ /* Headers */ @@ -239,7 +240,7 @@ H5B2_hdr_t * H5B2__hdr_alloc(H5F_t *f) { H5B2_hdr_t *hdr = NULL; /* v2 B-tree header */ - H5B2_hdr_t *ret_value; /* Return value */ + H5B2_hdr_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -285,8 +286,8 @@ haddr_t H5B2__hdr_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam, void *ctx_udata) { - H5B2_hdr_t *hdr = NULL; /* The new v2 B-tree header information */ - haddr_t ret_value; /* Return value */ + H5B2_hdr_t *hdr = NULL; /* The new v2 B-tree header information */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5B2int.c b/src/H5B2int.c index 0f884c2..f412260 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ +#include "H5B2module.h" /* This source code file is part of the H5B2 module */ + /***********/ /* Headers */ @@ -1837,7 +1838,7 @@ H5B2__protect_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, haddr_t addr, uint16_t nrec, unsigned flags) { H5B2_leaf_cache_ud_t udata; /* User-data for callback */ - H5B2_leaf_t *ret_value; /* Return value */ + H5B2_leaf_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -1959,7 +1960,7 @@ H5B2__protect_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, haddr_t addr, uint16_t nrec, uint16_t depth, unsigned flags) { H5B2_internal_cache_ud_t udata; /* User data to pass through to cache 'deserialize' callback */ - H5B2_internal_t *ret_value; /* Return value */ + H5B2_internal_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5B2module.h b/src/H5B2module.h new file mode 100644 index 0000000..0fc30a5 --- /dev/null +++ b/src/H5B2module.h @@ -0,0 +1,36 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5B2 package. Including this header means that the source file + * is part of the H5B2 package. + */ +#ifndef _H5B2module_H +#define _H5B2module_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5B2_MODULE +#define H5_MY_PKG H5B2 +#define H5_MY_PKG_ERR H5E_BTREE +#define H5_MY_PKG_INIT NO + +#endif /* _H5B2module_H */ + + diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index b13c58d..d661efa 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -21,7 +21,7 @@ * the H5B2 package. Source files outside the H5B2 package should * include H5B2private.h instead. */ -#ifndef H5B2_PACKAGE +#if !(defined H5B2_FRIEND || defined H5B2_MODULE) #error "Do not include this file outside the H5B2 package!" #endif diff --git a/src/H5B2stat.c b/src/H5B2stat.c index bdb4a1f..10c692e 100644 --- a/src/H5B2stat.c +++ b/src/H5B2stat.c @@ -24,7 +24,7 @@ /* Module Setup */ /****************/ -#define H5B2_PACKAGE /* Suppress error about including H5B2pkg */ +#include "H5B2module.h" /* This source code file is part of the H5B2 module */ /***********/ diff --git a/src/H5B2test.c b/src/H5B2test.c index 31cf8e1..8ed364e 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -25,7 +25,7 @@ /* Module Setup */ /****************/ -#define H5B2_PACKAGE /*suppress error about including H5B2pkg */ +#include "H5B2module.h" /* This source code file is part of the H5B2 module */ #define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/ @@ -120,7 +120,7 @@ H5B2__test_crt_context(void *_f) { H5F_t *f = (H5F_t *)_f; /* User data for building callback context */ H5B2_test_ctx_t *ctx; /* Callback context structure */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -469,7 +469,7 @@ int H5B2_get_node_depth_test(H5B2_t *bt2, hid_t dxpl_id, void *udata) { H5B2_node_info_test_t ninfo; /* Node information */ - int ret_value; /* Return information */ + int ret_value = -1; /* Return information */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Bcache.c b/src/H5Bcache.c index d071712..d08f1bc 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5B_PACKAGE /*suppress error about including H5Bpkg */ +#include "H5Bmodule.h" /* This source code file is part of the H5B module */ /***********/ @@ -151,7 +151,7 @@ H5B__deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_udata, const uint8_t *image = (const uint8_t *)_image; /* Pointer into image buffer */ uint8_t *native; /* Pointer to native keys */ unsigned u; /* Local index variable */ - H5B_t *ret_value; /* Return value */ + H5B_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c index e6d54dc..d92a24b 100644 --- a/src/H5Bdbg.c +++ b/src/H5Bdbg.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5B_PACKAGE /*suppress error about including H5Bpkg */ +#include "H5Bmodule.h" /* This source code file is part of the H5B module */ /***********/ diff --git a/src/H5Bmodule.h b/src/H5Bmodule.h new file mode 100644 index 0000000..6800b26 --- /dev/null +++ b/src/H5Bmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5B package. Including this header means that the source file + * is part of the H5B package. + */ +#ifndef _H5Bmodule_H +#define _H5Bmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5B_MODULE +#define H5_MY_PKG H5B +#define H5_MY_PKG_ERR H5E_BTREE +#define H5_MY_PKG_INIT NO + +#endif /* _H5Bmodule_H */ + diff --git a/src/H5Bpkg.h b/src/H5Bpkg.h index 374fcb5..e645626 100644 --- a/src/H5Bpkg.h +++ b/src/H5Bpkg.h @@ -21,7 +21,7 @@ * the H5B package. Source files outside the H5B package should * include H5Bprivate.h instead. */ -#ifndef H5B_PACKAGE +#if !(defined H5B_FRIEND || defined H5B_MODULE) #error "Do not include this file outside the H5B package!" #endif @@ -74,8 +74,8 @@ /* Module Setup */ /****************/ -#define H5C_PACKAGE /*suppress error about including H5Cpkg */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Cmodule.h" /* This source code file is part of the H5C module */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ /***********/ @@ -106,6 +106,7 @@ #define H5C_IMAGE_EXTRA_SPACE 0 #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + /******************/ /* Local Typedefs */ /******************/ @@ -146,6 +147,12 @@ static herr_t H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags); +static herr_t H5C_flush_invalidate_ring(const H5F_t * f, hid_t dxpl_id, + H5C_ring_t ring, unsigned flags); + +static herr_t H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, + unsigned flags); + static void * H5C_load_entry(H5F_t * f, hid_t dxpl_id, #ifdef H5_HAVE_PARALLEL @@ -202,6 +209,9 @@ herr_t H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -501,6 +511,16 @@ H5C_create(size_t max_cache_size, cache_ptr->clean_index_size = (size_t)0; cache_ptr->dirty_index_size = (size_t)0; + for(i = 0; i < H5C_RING_NTYPES; i++) { + cache_ptr->index_ring_len[i] = 0; + cache_ptr->index_ring_size[i] = (size_t)0; + cache_ptr->clean_index_ring_size[i] = (size_t)0; + cache_ptr->dirty_index_ring_size[i] = (size_t)0; + + cache_ptr->slist_ring_len[i] = 0; + cache_ptr->slist_ring_size[i] = (size_t)0; + } /* end for */ + /* Tagging Field Initializations */ cache_ptr->ignore_tags = FALSE; @@ -515,10 +535,8 @@ H5C_create(size_t max_cache_size, cache_ptr->slist_size_increase = 0; #endif /* H5C_DO_SANITY_CHECKS */ - for ( i = 0; i < H5C__HASH_TABLE_LEN; i++ ) - { + for(i = 0; i < H5C__HASH_TABLE_LEN; i++) (cache_ptr->index)[i] = NULL; - } cache_ptr->entries_removed_counter = 0; cache_ptr->last_entry_removed_ptr = NULL; @@ -1027,13 +1045,6 @@ done: * all unprotected entries should be flushed before the * function returns failure. * - * The primary_dxpl_id and secondary_dxpl_id parameters - * specify the dxpl_ids used on the first write occasioned - * by the flush (primary_dxpl_id), and on all subsequent - * writes (secondary_dxpl_id). This is useful in the metadata - * cache, but may not be needed elsewhere. If so, just use the - * same dxpl_id for both parameters. - * * Return: Non-negative on success/Negative on failure or if there was * a request to flush all items and something was protected. * @@ -1054,408 +1065,105 @@ done: * * JRM -- 12/13/14 * + * Modified function to support rings. Basic idea is that + * every entry in the cache is assigned to a ring. Entries + * in the outermost ring are flushed first, followed by + * those in the next outermost ring, and so on until the + * innermost ring is flushed. See header comment on + * H5C_ring_t in H5Cprivate.h for a more detailed + * discussion. + * + * JRM -- 8/30/15 + * *------------------------------------------------------------------------- */ herr_t H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) { - H5C_t * cache_ptr = f->shared->cache; - herr_t ret_value = SUCCEED; - hbool_t destroy; - hbool_t flushed_entries_last_pass; - hbool_t flush_marked_entries; - hbool_t ignore_protected; - hbool_t tried_to_flush_protected_entry = FALSE; - hbool_t restart_slist_scan; - int32_t passes = 0; - int32_t protected_entries = 0; - H5SL_node_t * node_ptr = NULL; - H5C_cache_entry_t * entry_ptr = NULL; - H5C_cache_entry_t * next_entry_ptr = NULL; #if H5C_DO_SANITY_CHECKS - int64_t flushed_entries_count = 0; - int64_t flushed_entries_size = 0; - int64_t initial_slist_len = 0; - size_t initial_slist_size = 0; - int64_t entry_size_change; - int64_t * entry_size_change_ptr = &entry_size_change; -#else /* H5C_DO_SANITY_CHECKS */ - int64_t * entry_size_change_ptr = NULL; + int i; + int32_t index_len = 0; + size_t index_size = (size_t)0; + size_t clean_index_size = (size_t)0; + size_t dirty_index_size = (size_t)0; + size_t slist_size = (size_t)0; + int32_t slist_len = 0; #endif /* H5C_DO_SANITY_CHECKS */ + H5C_ring_t ring; + H5C_t * cache_ptr; + hbool_t destroy; + hbool_t ignore_protected; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( cache_ptr->slist_ptr ); + HDassert(f); + HDassert(f->shared); + cache_ptr = f->shared->cache; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->slist_ptr); -#if H5C_DO_EXTREME_SANITY_CHECKS - if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { +#if H5C_DO_SANITY_CHECKS + HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0); + HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0); + HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + + for(i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) { + index_len += cache_ptr->index_ring_len[i]; + index_size += cache_ptr->index_ring_size[i]; + clean_index_size += cache_ptr->clean_index_ring_size[i]; + dirty_index_size += cache_ptr->dirty_index_ring_size[i]; + + slist_len += cache_ptr->slist_ring_len[i]; + slist_size += cache_ptr->slist_ring_size[i]; + } /* end for */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed on entry.\n"); - } + HDassert(cache_ptr->index_len == index_len); + HDassert(cache_ptr->index_size == index_size); + HDassert(cache_ptr->clean_index_size == clean_index_size); + HDassert(cache_ptr->dirty_index_size == dirty_index_size); + HDassert(cache_ptr->slist_len == slist_len); + HDassert(cache_ptr->slist_size == slist_size); +#endif /* H5C_DO_SANITY_CHECKS */ + +#if H5C_DO_EXTREME_SANITY_CHECKS + if((H5C_validate_protected_entry_list(cache_ptr) < 0) || + (H5C_validate_pinned_entry_list(cache_ptr) < 0) || + (H5C_validate_lru_list(cache_ptr) < 0)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry.\n"); #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 ); - destroy = ( (flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 ); - - /* note that flush_marked_entries is set to FALSE if destroy is TRUE */ - flush_marked_entries = ( ( (flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0 ) - && - ( ! destroy ) - ); - HDassert( ! ( destroy && ignore_protected ) ); - HDassert( ! ( cache_ptr->flush_in_progress ) ); cache_ptr->flush_in_progress = TRUE; - if ( destroy ) { + if(destroy) { if(H5C_flush_invalidate_cache(f, dxpl_id, flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate failed.") - } else { - /* When we are only flushing marked entries, the slist will usually - * still contain entries when we have flushed everything we should. - * Thus we track whether we have flushed any entries in the last - * pass, and terminate if we haven't. - */ - - flushed_entries_last_pass = TRUE; - - /* set the cache_ptr->slist_change_in_pre_serialize and - * cache_ptr->slist_change_in_serialize to false. - * - * These flags are set to TRUE by H5C__flush_single_entry if the - * slist is modified by a pre_serialize or serialize call respectively. - * H5C_flush_cache uses these flags to detect any modifications - * to the slist that might corrupt the scan of the slist -- and - * restart the scan in this event. + } /* end if */ + else { + /* flush each ring, starting from the outermost ring and + * working inward. */ - cache_ptr->slist_change_in_pre_serialize = FALSE; - cache_ptr->slist_change_in_serialize = FALSE; - - while ( ( passes < H5C__MAX_PASSES_ON_FLUSH ) && - ( cache_ptr->slist_len != 0 ) && - ( protected_entries == 0 ) && - ( flushed_entries_last_pass ) ) - { - unsigned curr_flush_dep_height = 0; - unsigned flush_dep_passes = 0; - - flushed_entries_last_pass = FALSE; - - /* Loop over all flush dependency heights of entries */ - while((curr_flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS) && - (cache_ptr->slist_len != 0) && - (flush_dep_passes < H5C__MAX_PASSES_ON_FLUSH) ) - { - hbool_t flushed_during_dep_loop = FALSE; - -#if H5C_DO_SANITY_CHECKS - /* For sanity checking, try to verify that the skip list has - * the expected size and number of entries at the end of each - * internal while loop (see below). - * - * Doing this get a bit tricky, as depending on flags, we may - * or may not flush all the entries in the slist. - * - * To make things more entertaining, with the advent of the - * fractal heap, the entry serialize callback can cause entries - * to be dirtied, resized, and/or moved. Also, the - * pre_serialize callback can result in an entry being - * removed from the cache via the take ownership flag. - * - * To deal with this, we first make note of the initial - * skip list length and size: - */ - initial_slist_len = cache_ptr->slist_len; - initial_slist_size = cache_ptr->slist_size; - - /* We then zero counters that we use to track the number - * and total size of entries flushed: - */ - flushed_entries_count = 0; - flushed_entries_size = 0; - - /* As mentioned above, there is the possibility that - * entries will be dirtied, resized, flushed, or removed - * from the cache via the take ownership flag during - * our pass through the skip list. To capture the number - * of entries added, and the skip list size delta, - * zero the slist_len_increase and slist_size_increase of - * the cache's instance of H5C_t. These fields will be - * updated elsewhere to account for slist insertions and/or - * dirty entry size changes. - */ - cache_ptr->slist_len_increase = 0; - cache_ptr->slist_size_increase = 0; - - /* at the end of the loop, use these values to compute the - * expected slist length and size and compare this with the - * value recorded in the cache's instance of H5C_t. - */ -#endif /* H5C_DO_SANITY_CHECKS */ - - restart_slist_scan = TRUE; - - while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) - { - if ( restart_slist_scan ) - { - restart_slist_scan = FALSE; - - /* Start at beginning of skip list */ - node_ptr = H5SL_first(cache_ptr->slist_ptr); - - if ( node_ptr == NULL ) - { - /* the slist is empty -- break out of inner loop */ - break; - } - HDassert( node_ptr != NULL ); - - /* Get cache entry for this node */ - next_entry_ptr = - (H5C_cache_entry_t *)H5SL_item(node_ptr); - - if(NULL == next_entry_ptr) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "next_entry_ptr == NULL ?!?!") - - HDassert( next_entry_ptr->magic == \ - H5C__H5C_CACHE_ENTRY_T_MAGIC ); - HDassert( next_entry_ptr->is_dirty ); - HDassert( next_entry_ptr->in_slist ); - } - - entry_ptr = next_entry_ptr; - - /* With the advent of the fractal heap, the free space - * manager, and the version 3 cache, it is possible - * that the pre-serialize or serialize callback will - * dirty, resize, or take ownership of other entries - * in the cache. - * - * To deal with this, I have inserted code to detect any - * change in the skip list not directly under the control - * of this function. If such modifications are detected, - * we must re-start the scan of the skip list to avoid - * the possibility that the target of the next_entry_ptr - * may have been flushed or deleted from the cache. - * - * To verify that all such possibilities have been dealt - * with, we do a bit of extra sanity checking on - * entry_ptr. - */ - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->in_slist); - HDassert(entry_ptr->is_dirty); - - /* increment node pointer now, before we delete its target - * from the slist. - */ - node_ptr = H5SL_next(node_ptr); - - if ( node_ptr != NULL ) { - next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - if ( NULL == next_entry_ptr ) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") - HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); - HDassert( next_entry_ptr->is_dirty ); - HDassert( next_entry_ptr->in_slist ); - HDassert( entry_ptr != next_entry_ptr ); - } else { - next_entry_ptr = NULL; - } - - HDassert( entry_ptr != NULL ); - HDassert( entry_ptr->in_slist ); - - if ( ( ( ! flush_marked_entries ) || - ( entry_ptr->flush_marker ) ) && - ( ( ! entry_ptr->flush_me_last ) || - ( ( entry_ptr->flush_me_last ) && - ( cache_ptr->num_last_entries >= - cache_ptr->slist_len ) ) ) ) { - - if ( entry_ptr->is_protected ) { - - /* we probably have major problems -- but lets - * flush everything we can before we decide - * whether to flag an error. - */ - tried_to_flush_protected_entry = TRUE; - protected_entries++; - - } else if ( entry_ptr->is_pinned ) { - /* Test to see if we are can flush the entry now. - * If we can, go ahead and flush. Note that we - * aren't trying to do a destroy here, so that - * is not an issue. - */ - if(entry_ptr->flush_dep_height == curr_flush_dep_height ) { -#if H5C_DO_SANITY_CHECKS - flushed_entries_count++; - flushed_entries_size += (int64_t)entry_ptr->size; - entry_size_change = 0; -#endif /* H5C_DO_SANITY_CHECKS */ - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr, NULL) < 0 ) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed.") - -#if H5C_DO_SANITY_CHECKS - /* it is possible that the entry size changed - * during flush -- update flushed_entries_size - * to account for this. - */ - flushed_entries_size += entry_size_change; -#endif /* H5C_DO_SANITY_CHECKS */ - - flushed_during_dep_loop = TRUE; - - if ((cache_ptr->slist_change_in_serialize) || - (cache_ptr->slist_change_in_pre_serialize)) - { - /* The slist has been modified by something - * other than the simple removal of the - * of the flushed entry after the flush. - * - * This has the potential to corrupt the - * scan through the slist, so restart it. - */ - restart_slist_scan = TRUE; - cache_ptr->slist_change_in_pre_serialize - = FALSE; - cache_ptr->slist_change_in_serialize - = FALSE; - - H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) - } - } /* end if */ - else if(entry_ptr->flush_dep_height < curr_flush_dep_height) - /* This shouldn't happen -- if it does, just scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") - } /* end if */ - else { - /* Test to see if we are can flush the entry now. - * If we can, go ahead and flush. Note that we - * aren't trying to do a destroy here, so that - * is not an issue. - */ - if(entry_ptr->flush_dep_height == curr_flush_dep_height ) { -#if H5C_DO_SANITY_CHECKS - flushed_entries_count++; - flushed_entries_size += (int64_t)entry_ptr->size; - entry_size_change = 0; -#endif /* H5C_DO_SANITY_CHECKS */ - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry.") - -#if H5C_DO_SANITY_CHECKS - /* it is possible that the entry size changed - * during flush -- update flushed_entries_size - * to account for this. - */ - flushed_entries_size += entry_size_change; -#endif /* H5C_DO_SANITY_CHECKS */ - - flushed_during_dep_loop = TRUE; - - if ((cache_ptr->slist_change_in_serialize) || - (cache_ptr->slist_change_in_pre_serialize)) - { - /* The slist has been modified by something - * other than the simple removal of the - * of the flushed entry after the flush. - * - * This has the potential to corrupt the - * scan through the slist, so restart it. - */ - restart_slist_scan = TRUE; - cache_ptr->slist_change_in_pre_serialize - = FALSE; - cache_ptr->slist_change_in_serialize - = FALSE; - - H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) - } - } /* end if */ - else if(entry_ptr->flush_dep_height < curr_flush_dep_height) - /* This shouldn't happen -- if it does, just scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") - } /* end else */ - } /* end if */ - } /* while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) */ - - /* Check for incrementing flush dependency height */ - if(flushed_during_dep_loop) { - /* If we flushed an entry at this flush dependency height - * start over at the bottom level of the flush dependencies - */ - curr_flush_dep_height = 0; - - /* Make certain we don't get stuck in an infinite loop */ - flush_dep_passes++; - - /* Set flag for outer loop */ - flushed_entries_last_pass = TRUE; - } /* end if */ - else - curr_flush_dep_height++; - - } /* while ( curr_flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS) */ - - passes++; - -#if H5C_DO_SANITY_CHECKS - /* Verify that the slist size and length are as expected. */ - - HDassert( (initial_slist_len + cache_ptr->slist_len_increase - - flushed_entries_count) == cache_ptr->slist_len ); - HDassert( (size_t)((int64_t)initial_slist_size + - cache_ptr->slist_size_increase - - flushed_entries_size) == cache_ptr->slist_size ); -#endif /* H5C_DO_SANITY_CHECKS */ - - } /* while */ - - HDassert( protected_entries <= cache_ptr->pl_len ); - - if ( ( ( cache_ptr->pl_len > 0 ) && ( !ignore_protected ) ) - || - ( tried_to_flush_protected_entry ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "cache has protected items") - } - - if ( ( cache_ptr->slist_len != 0 ) && - ( passes >= H5C__MAX_PASSES_ON_FLUSH ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "flush pass limit exceeded.") - } - -#if H5C_DO_SANITY_CHECKS - if ( ! flush_marked_entries ) { - - HDassert( cache_ptr->slist_len == 0 ); - HDassert( cache_ptr->slist_size == 0 ); - } -#endif /* H5C_DO_SANITY_CHECKS */ - - } + ring = H5C_RING_USER; + while(ring < H5C_RING_NTYPES) { + if(H5C_flush_ring(f, dxpl_id, ring, flags) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush ring failed.") + ring++; + } /* end while */ + } /* end else */ done: - cache_ptr->flush_in_progress = FALSE; FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_flush_cache() */ @@ -2062,20 +1770,20 @@ H5C_insert_entry(H5F_t * f, void * thing, unsigned int flags) { - H5C_t * cache_ptr; - herr_t result; + H5C_t *cache_ptr; + H5P_genplist_t *dxpl; + H5AC_ring_t ring = H5C_RING_UNDEFINED; hbool_t insert_pinned; hbool_t flush_last; #ifdef H5_HAVE_PARALLEL hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */ hbool_t flush_collectively; - H5P_genplist_t * dxpl; /* dataset transfer property list */ #endif /* H5_HAVE_PARALLEL */ hbool_t set_flush_marker; hbool_t write_permitted = TRUE; size_t empty_space; - H5C_cache_entry_t * entry_ptr; - H5C_cache_entry_t * test_entry_ptr; + H5C_cache_entry_t *entry_ptr; + H5C_cache_entry_t *test_entry_ptr; unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2112,6 +1820,14 @@ H5C_insert_entry(H5F_t * f, flush_collectively = ( (flags & H5C__FLUSH_COLLECTIVELY_FLAG) != 0 ); #endif /* H5_HAVE_PARALLEL */ + /* Get the dataset transfer property list */ + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "not a property list") + + /* Get the ring type from the DXPL */ + if((H5P_get(dxpl, H5AC_RING_NAME, &ring)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to query ring value") + entry_ptr = (H5C_cache_entry_t *)thing; /* verify that the new entry isn't already in the hash table -- scream @@ -2189,6 +1905,8 @@ H5C_insert_entry(H5F_t * f, entry_ptr->flush_in_progress = FALSE; entry_ptr->destroy_in_progress = FALSE; + entry_ptr->ring = ring; + /* Initialize flush dependency height fields */ entry_ptr->flush_dep_parent = NULL; for(u = 0; u < H5C__NUM_FLUSH_DEP_HEIGHTS; u++) @@ -2212,13 +1930,8 @@ H5C_insert_entry(H5F_t * f, if ( ( cache_ptr->flash_size_increase_possible ) && ( entry_ptr->size > cache_ptr->flash_size_increase_threshold ) ) { - result = H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \ - "H5C__flash_increase_cache_size failed.") - } + if(H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C__flash_increase_cache_size failed.") } if(cache_ptr->index_size >= cache_ptr->max_cache_size) @@ -2235,33 +1948,20 @@ H5C_insert_entry(H5F_t * f, size_t space_needed; - if ( empty_space <= entry_ptr->size ) { - + if(empty_space <= entry_ptr->size) cache_ptr->cache_full = TRUE; - } - - if ( cache_ptr->check_write_permitted != NULL ) { - - result = (cache_ptr->check_write_permitted)(f, &write_permitted); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \ - "Can't get write_permitted") - } - } else { + if(cache_ptr->check_write_permitted != NULL) { + if((cache_ptr->check_write_permitted)(f, &write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "Can't get write_permitted") + } /* end if */ + else write_permitted = cache_ptr->write_permitted; - } - - HDassert( entry_ptr->size <= H5C_MAX_ENTRY_SIZE ); + HDassert(entry_ptr->size <= H5C_MAX_ENTRY_SIZE); space_needed = entry_ptr->size; - - if ( space_needed > cache_ptr->max_cache_size ) { - + if(space_needed > cache_ptr->max_cache_size) space_needed = cache_ptr->max_cache_size; - } /* Note that space_needed is just the amount of space that * needed to insert the new entry without exceeding the cache @@ -2288,16 +1988,8 @@ H5C_insert_entry(H5F_t * f, * no point in worrying about the third. */ - result = H5C_make_space_in_cache(f, - dxpl_id, - space_needed, - write_permitted); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \ - "H5C_make_space_in_cache failed.") - } + if(H5C_make_space_in_cache(f, dxpl_id, space_needed, write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C_make_space_in_cache failed.") } H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL) @@ -2970,6 +2662,7 @@ H5C_protect(H5F_t * f, unsigned flags) { H5C_t * cache_ptr; + H5AC_ring_t ring = H5C_RING_UNDEFINED; hbool_t hit; hbool_t have_write_permitted = FALSE; hbool_t read_only = FALSE; @@ -2979,12 +2672,11 @@ H5C_protect(H5F_t * f, hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */ #endif /* H5_HAVE_PARALLEL */ hbool_t write_permitted; - herr_t result; size_t empty_space; void * thing; H5C_cache_entry_t * entry_ptr; H5P_genplist_t * dxpl; /* dataset transfer property list */ - void * ret_value; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -3016,8 +2708,12 @@ H5C_protect(H5F_t * f, #endif /* H5_HAVE_PARALLEL */ /* Get the dataset transfer property list */ - if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list"); + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, NULL, "not a property list") + + /* Get the ring type from the DXPL */ + if((H5P_get(dxpl, H5AC_RING_NAME, &ring)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "unable to query ring value") #ifdef H5_HAVE_PARALLEL if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { @@ -3040,6 +2736,9 @@ H5C_protect(H5F_t * f, H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, NULL) if ( entry_ptr != NULL ) { + if(entry_ptr->ring != ring) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "ring type mismatch occured for cache entry\n"); + /* Check for trying to load the wrong type of entry from an address */ if(entry_ptr->type != type) HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, NULL, "incorrect cache entry type") @@ -3120,16 +2819,14 @@ H5C_protect(H5F_t * f, from disk. */ /* Get the tag from the DXPL */ - if( (H5P_get(dxpl, "H5AC_metadata_tag", &tag)) < 0 ) + if((H5P_get(dxpl, "H5AC_metadata_tag", &tag)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to query property value"); /* Verify tag value */ - if (cache_ptr->ignore_tags != TRUE) { - + if(cache_ptr->ignore_tags != TRUE) { /* Verify legal tag value */ - if ( (H5C_verify_tag(entry_ptr->type->id, tag)) < 0 ) + if((H5C_verify_tag(entry_ptr->type->id, tag)) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "tag verification failed"); - } /* end if */ } #endif @@ -3155,7 +2852,7 @@ H5C_protect(H5F_t * f, } entry_ptr = (H5C_cache_entry_t *)thing; - + entry_ptr->ring = ring; #ifdef H5_HAVE_PARALLEL if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { if(entry_ptr->coll_access) { @@ -3176,14 +2873,8 @@ H5C_protect(H5F_t * f, if ( ( cache_ptr->flash_size_increase_possible ) && ( entry_ptr->size > cache_ptr->flash_size_increase_threshold ) ) { - result = H5C__flash_increase_cache_size(cache_ptr, 0, - entry_ptr->size); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \ - "H5C__flash_increase_cache_size failed.") - } + if(H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C__flash_increase_cache_size failed.") } if(cache_ptr->index_size >= cache_ptr->max_cache_size) @@ -3209,20 +2900,11 @@ H5C_protect(H5F_t * f, if(empty_space <= entry_ptr->size) cache_ptr->cache_full = TRUE; - if ( cache_ptr->check_write_permitted != NULL ) { - - result = (cache_ptr->check_write_permitted)(f, &write_permitted); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \ - "Can't get write_permitted 1") - - } else { - + if(cache_ptr->check_write_permitted != NULL) { + if((cache_ptr->check_write_permitted)(f, &write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Can't get write_permitted 1") + else have_write_permitted = TRUE; - - } } else { write_permitted = cache_ptr->write_permitted; @@ -3269,16 +2951,8 @@ H5C_protect(H5F_t * f, * see no point in worrying about the fourth. */ - result = H5C_make_space_in_cache(f, - dxpl_id, - space_needed, - write_permitted); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \ - "H5C_make_space_in_cache failed 1.") - } + if(H5C_make_space_in_cache(f, dxpl_id, space_needed, write_permitted) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C_make_space_in_cache failed 1.") } /* Insert the entry in the hash table. It can't be dirty yet, so @@ -3372,19 +3046,10 @@ H5C_protect(H5F_t * f, if ( ! have_write_permitted ) { if ( cache_ptr->check_write_permitted != NULL ) { - - result = (cache_ptr->check_write_permitted)(f, &write_permitted); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \ - "Can't get write_permitted 2") - - } else { - + if((cache_ptr->check_write_permitted)(f, &write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Can't get write_permitted 2") + else have_write_permitted = TRUE; - - } } else { write_permitted = cache_ptr->write_permitted; @@ -3398,14 +3063,8 @@ H5C_protect(H5F_t * f, ( cache_ptr->cache_accesses >= (cache_ptr->resize_ctl).epoch_length ) ) { - result = H5C__auto_adjust_cache_size(f, - dxpl_id, - write_permitted); - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \ - "Cache auto-resize failed.") - } + if(H5C__auto_adjust_cache_size(f, dxpl_id, write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Cache auto-resize failed.") } if ( cache_ptr->size_decreased ) { @@ -3434,16 +3093,8 @@ H5C_protect(H5F_t * f, if(cache_ptr->index_size > cache_ptr->max_cache_size) cache_ptr->cache_full = TRUE; - result = H5C_make_space_in_cache(f, - dxpl_id, - (size_t)0, - write_permitted); - - if ( result < 0 ) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, \ - "H5C_make_space_in_cache failed 2.") - } + if(H5C_make_space_in_cache(f, dxpl_id, (size_t)0, write_permitted) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C_make_space_in_cache failed 2.") } } } @@ -5587,6 +5238,7 @@ H5C_create_flush_dependency(void * parent_thing, void * child_thing) HDassert(H5F_addr_defined(child_entry->addr)); HDassert(child_entry->flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS); cache_ptr = parent_entry->cache_ptr; + HDassert(parent_entry->ring == child_entry->ring); HDassert(cache_ptr); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(cache_ptr == child_entry->cache_ptr); @@ -7052,48 +6704,139 @@ done: * Programmer: John Mainzer * 3/24/065 * - * Changes: Modified function to test for slist chamges in - * pre_serialize and serialize callbacks, and re-start - * scans through the slist when such changes occur. - * - * This has been a potential problem for some time, - * and there has been code in this function to deal - * with elements of this issue. However the shift - * to the V3 cache in combination with the activities - * of some of the cache clients (in particular the - * free space manager and the fractal heap) have - * made this re-work necessary in H5C_flush_cache. - * - * At present, this issue doesn't seem to be causing problems - * in H5C_flush_invalidate_cache(). However, it seems - * prudent to port the H5C_flush_cache changes to this - * function as well. - * - * JRM -- 12/14/14 - * - * Added code to track entry size change during flush single - * entry. This didn't used to be a problem, as the entry - * was largely removed from the cache data structures before - * the flush proper. However, re-entrant calls to the cache - * in the parallel case required a re-factoring of the - * H5C__flush_single_entry() function to keep entries fully - * in the cache until after the pre-serialize and serialize - * calls. - * JRM -- 12/25/14 + *------------------------------------------------------------------------- + */ +static herr_t +H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, unsigned flags) +{ + H5C_t * cache_ptr; + H5C_ring_t ring; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(f); + HDassert(f->shared); + cache_ptr = f->shared->cache; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->slist_ptr); + +#if H5C_DO_SANITY_CHECKS +{ + int32_t i; + int32_t index_len = 0; + int32_t slist_len = 0; + size_t index_size = (size_t)0; + size_t clean_index_size = (size_t)0; + size_t dirty_index_size = (size_t)0; + size_t slist_size = (size_t)0; + + HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0); + HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0); + HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + + for(i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) { + index_len += cache_ptr->index_ring_len[i]; + index_size += cache_ptr->index_ring_size[i]; + clean_index_size += cache_ptr->clean_index_ring_size[i]; + dirty_index_size += cache_ptr->dirty_index_ring_size[i]; + + slist_len += cache_ptr->slist_ring_len[i]; + slist_size += cache_ptr->slist_ring_size[i]; + } /* end for */ + + HDassert(cache_ptr->index_len == index_len); + HDassert(cache_ptr->index_size == index_size); + HDassert(cache_ptr->clean_index_size == clean_index_size); + HDassert(cache_ptr->dirty_index_size == dirty_index_size); + HDassert(cache_ptr->slist_len == slist_len); + HDassert(cache_ptr->slist_size == slist_size); +} +#endif /* H5C_DO_SANITY_CHECKS */ + + /* remove ageout markers if present */ + if(cache_ptr->epoch_markers_active > 0) + if(H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers.") + + /* flush invalidate each ring, starting from the outermost ring and + * working inward. + */ + ring = H5C_RING_USER; + while(ring < H5C_RING_NTYPES) { + if(H5C_flush_invalidate_ring(f, dxpl_id, ring, flags) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate ring failed.") + ring++; + } /* end while */ + + /* Invariants, after destroying all entries in the hash table */ + HDassert(cache_ptr->index_size == 0); + HDassert(cache_ptr->clean_index_size == 0); + HDassert(cache_ptr->dirty_index_size == 0); + HDassert(cache_ptr->slist_len == 0); + HDassert(cache_ptr->slist_size == 0); + HDassert(cache_ptr->pel_len == 0); + HDassert(cache_ptr->pel_size == 0); + HDassert(cache_ptr->pl_len == 0); + HDassert(cache_ptr->pl_size == 0); + HDassert(cache_ptr->LRU_list_len == 0); + HDassert(cache_ptr->LRU_list_size == 0); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_flush_invalidate_cache() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_flush_invalidate_ring + * + * Purpose: Flush and destroy the entries contained in the target + * cache and ring. + * + * If the ring contains protected entries, the function will + * fail, as protected entries cannot be either flushed or + * destroyed. However all unprotected entries should be + * flushed and destroyed before the function returns failure. + * + * While pinned entries can usually be flushed, they cannot + * be destroyed. However, they should be unpinned when all + * the entries that reference them have been destroyed (thus + * reduding the pinned entry's reference count to 0, allowing + * it to be unpinned). + * + * If pinned entries are present, the function makes repeated + * passes through the cache, flushing all dirty entries + * (including the pinned dirty entries where permitted) and + * destroying all unpinned entries. This process is repeated + * until either the cache is empty, or the number of pinned + * entries stops decreasing on each pass. + * + * If flush dependencies appear in the target ring, the + * function makes repeated passes through the cache flushing + * entries in flush dependency order. + * + * Return: Non-negative on success/Negative on failure or if there was + * a request to flush all items and something was protected. + * + * Programmer: John Mainzer + * 9/1/15 * *------------------------------------------------------------------------- */ static herr_t -H5C_flush_invalidate_cache(const H5F_t * f, - hid_t dxpl_id, - unsigned flags) +H5C_flush_invalidate_ring(const H5F_t * f, hid_t dxpl_id, H5C_ring_t ring, + unsigned flags) { - H5C_t * cache_ptr = f->shared->cache; + H5C_t * cache_ptr; hbool_t restart_slist_scan; int32_t protected_entries = 0; int32_t i; - int32_t cur_pel_len; - int32_t old_pel_len; + int32_t cur_ring_pel_len; + int32_t old_ring_pel_len; int32_t passes = 0; unsigned cooked_flags; H5SL_node_t * node_ptr = NULL; @@ -7113,27 +6856,29 @@ H5C_flush_invalidate_cache(const H5F_t * f, FUNC_ENTER_NOAPI(FAIL) - HDassert( f ); - HDassert( cache_ptr ); - HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( cache_ptr->slist_ptr ); + HDassert(f); + HDassert(f->shared); + cache_ptr = f->shared->cache; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->slist_ptr); + HDassert(ring > H5C_RING_UNDEFINED); + HDassert(ring < H5C_RING_NTYPES); + + HDassert(cache_ptr->epoch_markers_active == 0); /* Filter out the flags that are not relevant to the flush/invalidate. * At present, only the H5C__FLUSH_CLEAR_ONLY_FLAG is kept. */ cooked_flags = flags & H5C__FLUSH_CLEAR_ONLY_FLAG; - /* remove ageout markers if present */ - if(cache_ptr->epoch_markers_active > 0) - if(H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers.") /* The flush proceedure here is a bit strange. * * In the outer while loop we make at least one pass through the - * cache, and then repeat until either all the pinned entries - * unpin themselves, or until the number of pinned entries stops - * declining. In this later case, we scream and die. + * cache, and then repeat until either all the pinned entries in + * the ring unpin themselves, or until the number of pinned entries + * in the ring stops declining. In this later case, we scream and die. * * Since the fractal heap can dirty, resize, and/or move entries * in is flush callback, it is possible that the cache will still @@ -7159,19 +6904,27 @@ H5C_flush_invalidate_cache(const H5F_t * f, * to increasing address order, but there are no guarantees. */ - cur_pel_len = cache_ptr->pel_len; - old_pel_len = cache_ptr->pel_len; + /* compute the number of pinned entries in this ring */ + entry_ptr = cache_ptr->pel_head_ptr; + cur_ring_pel_len = 0; + while(entry_ptr != NULL) { + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->ring >= ring); + if(entry_ptr->ring == ring) + cur_ring_pel_len++; - while ( cache_ptr->index_len > 0 ) - { + entry_ptr = entry_ptr->next; + } /* end while */ + + old_ring_pel_len = cur_ring_pel_len; + while(cache_ptr->index_ring_len[ring] > 0) { unsigned curr_flush_dep_height = 0; unsigned flush_dep_passes = 0; /* Loop over all flush dependency heights of entries */ while((curr_flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS) && - (cache_ptr->index_len > 0 ) && - (flush_dep_passes < H5C__MAX_PASSES_ON_FLUSH) ) - { + (cache_ptr->index_ring_len[ring] > 0) && + (flush_dep_passes < H5C__MAX_PASSES_ON_FLUSH)) { hbool_t flushed_during_dep_loop = FALSE; /* first, try to flush-destroy any dirty entries. Do this by @@ -7226,37 +6979,27 @@ H5C_flush_invalidate_cache(const H5F_t * f, cache_ptr->slist_change_in_serialize = FALSE; /* this done, start the scan of the slist */ - restart_slist_scan = TRUE; - - while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) - { - if ( restart_slist_scan ) - { + while(restart_slist_scan || (node_ptr != NULL)) { + if(restart_slist_scan) { restart_slist_scan = FALSE; /* Start at beginning of skip list */ node_ptr = H5SL_first(cache_ptr->slist_ptr); - - if ( node_ptr == NULL ) - { + if(node_ptr == NULL) /* the slist is empty -- break out of inner loop */ break; - } - HDassert( node_ptr != NULL ); /* Get cache entry for this node */ next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + if ( NULL == next_entry_ptr ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") - if(NULL == next_entry_ptr) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "next_entry_ptr == NULL ?!?!") - - HDassert( next_entry_ptr->magic == \ - H5C__H5C_CACHE_ENTRY_T_MAGIC ); - HDassert( next_entry_ptr->is_dirty ); - HDassert( next_entry_ptr->in_slist ); - } + HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(next_entry_ptr->is_dirty); + HDassert(next_entry_ptr->in_slist); + HDassert(next_entry_ptr->ring >= ring); + } /* end if */ entry_ptr = next_entry_ptr; @@ -7271,27 +7014,27 @@ H5C_flush_invalidate_cache(const H5F_t * f, * slist if we find them. However, best we do some extra * sanity checking just in case. */ - - HDassert( entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); - HDassert( entry_ptr->in_slist ); - HDassert( entry_ptr->is_dirty ); + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->in_slist); + HDassert(entry_ptr->is_dirty); + HDassert(entry_ptr->ring >= ring); /* increment node pointer now, before we delete its target * from the slist. */ - node_ptr = H5SL_next(node_ptr); - if ( node_ptr != NULL ) { + if(node_ptr != NULL) { next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - if ( NULL == next_entry_ptr ) + if(NULL == next_entry_ptr) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") - HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); - HDassert( next_entry_ptr->is_dirty ); - HDassert( next_entry_ptr->in_slist ); - HDassert( entry_ptr != next_entry_ptr ); - } else { + HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(next_entry_ptr->is_dirty); + HDassert(next_entry_ptr->in_slist); + HDassert(next_entry_ptr->ring >= ring); + HDassert(entry_ptr != next_entry_ptr); + } /* end if */ + else next_entry_ptr = NULL; - } /* Note that we now remove nodes from the slist as we flush * the associated entries, instead of leaving them there @@ -7303,30 +7046,26 @@ H5C_flush_invalidate_cache(const H5F_t * f, * flush, we must keep the slist in cannonical form at all * times. */ - - HDassert( entry_ptr != NULL ); - HDassert( entry_ptr->in_slist ); - - if ( ( ! entry_ptr->flush_me_last ) || - ( ( entry_ptr->flush_me_last ) && - ( cache_ptr->num_last_entries >= - cache_ptr->slist_len ) ) ) { - - if ( entry_ptr->is_protected ) { - + HDassert(entry_ptr != NULL); + HDassert(entry_ptr->in_slist); + + if(((!entry_ptr->flush_me_last) || + ((entry_ptr->flush_me_last) && + (cache_ptr->num_last_entries >= cache_ptr->slist_len))) && + (entry_ptr->ring == ring)) { + if(entry_ptr->is_protected) { /* we have major problems -- but lets flush * everything we can before we flag an error. */ protected_entries++; - - } else if ( entry_ptr->is_pinned ) { + } else if(entry_ptr->is_pinned) { /* Test to see if we are can flush the entry now. * If we can, go ahead and flush, but don't tell * H5C__flush_single_entry() to destroy the entry * as pinned entries can't be evicted. */ - if(entry_ptr->flush_dep_height == curr_flush_dep_height ) { + if(entry_ptr->flush_dep_height == curr_flush_dep_height) { #if H5C_DO_SANITY_CHECKS /* update flushed_slist_len & flushed_slist_size * before the flush. Note that the entry will @@ -7343,7 +7082,6 @@ H5C_flush_invalidate_cache(const H5F_t * f, if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__NO_FLAGS_SET, entry_size_change_ptr, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed.") - #if H5C_DO_SANITY_CHECKS /* entry size may have changed during the flush. * Update flushed_slist_size to account for this. @@ -7352,10 +7090,8 @@ H5C_flush_invalidate_cache(const H5F_t * f, #endif /* H5C_DO_SANITY_CHECKS */ flushed_during_dep_loop = TRUE; - - if ( ( cache_ptr->slist_change_in_serialize ) || - ( cache_ptr->slist_change_in_pre_serialize ) ) - { + if((cache_ptr->slist_change_in_serialize) || + (cache_ptr->slist_change_in_pre_serialize)) { /* The slist has been modified by something * other than the simple removal of the * of the flushed entry after the flush. @@ -7364,18 +7100,17 @@ H5C_flush_invalidate_cache(const H5F_t * f, * scan through the slist, so restart it. */ restart_slist_scan = TRUE; - cache_ptr->slist_change_in_pre_serialize - = FALSE; + cache_ptr->slist_change_in_pre_serialize = FALSE; cache_ptr->slist_change_in_serialize = FALSE; H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr); - } + } /* end if */ } /* end if */ else if(entry_ptr->flush_dep_height < curr_flush_dep_height) /* This shouldn't happen -- if it does, just scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") } /* end if */ else { - if(entry_ptr->flush_dep_height == curr_flush_dep_height ){ + if(entry_ptr->flush_dep_height == curr_flush_dep_height) { #if H5C_DO_SANITY_CHECKS /* update flushed_slist_len & flushed_slist_size * before the flush. Note that the entry will @@ -7390,9 +7125,10 @@ H5C_flush_invalidate_cache(const H5F_t * f, entry_size_change = 0; #endif /* H5C_DO_SANITY_CHECKS */ - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG), entry_size_change_ptr, NULL) < 0) + if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, + (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG), + entry_size_change_ptr, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry flush destroy failed.") - #if H5C_DO_SANITY_CHECKS /* entry size may have changed during the flush. * Update flushed_slist_size to account for this. @@ -7402,9 +7138,8 @@ H5C_flush_invalidate_cache(const H5F_t * f, flushed_during_dep_loop = TRUE; - if ((cache_ptr->slist_change_in_serialize) || - (cache_ptr->slist_change_in_pre_serialize)) - { + if((cache_ptr->slist_change_in_serialize) || + (cache_ptr->slist_change_in_pre_serialize)) { /* The slist has been modified by something * other than the simple removal of the * of the flushed entry after the flush. @@ -7413,15 +7148,14 @@ H5C_flush_invalidate_cache(const H5F_t * f, * scan through the slist, so restart it. */ restart_slist_scan = TRUE; - cache_ptr->slist_change_in_pre_serialize - = FALSE; + cache_ptr->slist_change_in_pre_serialize = FALSE; cache_ptr->slist_change_in_serialize = FALSE; H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) - } + } /* end if */ } /* end if */ else if(entry_ptr->flush_dep_height < curr_flush_dep_height) /* This shouldn't happen -- if it does, just scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") } /* end else */ } /* end if */ } /* end while loop scanning skip list */ @@ -7436,13 +7170,12 @@ H5C_flush_invalidate_cache(const H5F_t * f, * out from under us. */ - if ( node_ptr == NULL ) { - - HDassert( (flushed_slist_len + cache_ptr->slist_len) == - (initial_slist_len + cache_ptr->slist_len_increase) ); - HDassert( (flushed_slist_size + (int64_t)cache_ptr->slist_size) == - ((int64_t)initial_slist_size + cache_ptr->slist_size_increase) ); - } + if(node_ptr == NULL) { + HDassert((flushed_slist_len + cache_ptr->slist_len) == + (initial_slist_len + cache_ptr->slist_len_increase)); + HDassert((flushed_slist_size + (int64_t)cache_ptr->slist_size) == + ((int64_t)initial_slist_size + cache_ptr->slist_size_increase)); + } /* end if */ #endif /* H5C_DO_SANITY_CHECKS */ /* Since we are doing a destroy, we must make a pass through @@ -7456,42 +7189,37 @@ H5C_flush_invalidate_cache(const H5F_t * f, * * Writes to disk are possible here. */ - for ( i = 0; i < H5C__HASH_TABLE_LEN; i++ ) - { + for(i = 0; i < H5C__HASH_TABLE_LEN; i++) { next_entry_ptr = cache_ptr->index[i]; - while ( next_entry_ptr != NULL ) - { + while(next_entry_ptr != NULL) { entry_ptr = next_entry_ptr; - HDassert( entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->ring >= ring); next_entry_ptr = entry_ptr->ht_next; - HDassert ( ( next_entry_ptr == NULL ) || - ( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ) ); - - if ( ( ! entry_ptr->flush_me_last ) || - ( ( entry_ptr->flush_me_last ) && - ( cache_ptr->num_last_entries >= - cache_ptr->slist_len ) ) ) { + HDassert((next_entry_ptr == NULL) || + (next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC)); - if ( entry_ptr->is_protected ) { + if(((!entry_ptr->flush_me_last) || + ((entry_ptr->flush_me_last) && + (cache_ptr->num_last_entries >= cache_ptr->slist_len))) && + (entry_ptr->ring == ring)) { + if(entry_ptr->is_protected) { /* we have major problems -- but lets flush and * destroy everything we can before we flag an * error. */ protected_entries++; - - if ( ! entry_ptr->in_slist ) { - - HDassert( !(entry_ptr->is_dirty) ); - } - } else if ( ! ( entry_ptr->is_pinned ) ) { + if(!entry_ptr->in_slist) + HDassert(!(entry_ptr->is_dirty)); + } else if(!(entry_ptr->is_pinned)) { /* Test to see if we are can flush the entry now. * If we can, go ahead and flush. */ - if(entry_ptr->flush_dep_height == curr_flush_dep_height ){ + if(entry_ptr->flush_dep_height == curr_flush_dep_height) { /* if *entry_ptr is dirty, it is possible * that one or more other entries may be * either removed from the cache, loaded @@ -7519,24 +7247,25 @@ H5C_flush_invalidate_cache(const H5F_t * f, entry_was_dirty = entry_ptr->is_dirty; - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG), NULL, NULL) < 0) + if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, + (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG), + NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Entry flush destroy failed.") - if ( entry_was_dirty ) { - + if(entry_was_dirty) { /* update stats for hash bucket scan * restart here. * -- JRM */ next_entry_ptr = cache_ptr->index[i]; H5C__UPDATE_STATS_FOR_HASH_BUCKET_SCAN_RESTART(cache_ptr) - } + } /* end if */ flushed_during_dep_loop = TRUE; } /* end if */ else if(entry_ptr->flush_dep_height < curr_flush_dep_height) /* This shouldn't happen -- if it does, just scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") } /* end if */ } /* end if */ /* We can't do anything if the entry is pinned. The @@ -7563,16 +7292,11 @@ H5C_flush_invalidate_cache(const H5F_t * f, * in case I am wrong. * -- JRM */ - if ( ( next_entry_ptr != NULL ) && - ( next_entry_ptr->magic != - H5C__H5C_CACHE_ENTRY_T_MAGIC ) ) { - + if((next_entry_ptr != NULL) && (next_entry_ptr->magic != H5C__H5C_CACHE_ENTRY_T_MAGIC)) /* Something horrible has happened to * *next_entry_ptr -- scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "next_entry_ptr->magic is invalid?!?!?.") - } + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr->magic is invalid?!?!?.") } /* end while loop scanning hash table bin */ } /* end for loop scanning hash table */ @@ -7591,68 +7315,439 @@ H5C_flush_invalidate_cache(const H5F_t * f, } /* end while loop over flush dependency heights */ - old_pel_len = cur_pel_len; - cur_pel_len = cache_ptr->pel_len; - - if ( ( cur_pel_len > 0 ) && ( cur_pel_len >= old_pel_len ) ) { - - /* The number of pinned entries is positive, and it is not - * declining. Scream and die. - */ + old_ring_pel_len = cur_ring_pel_len; + entry_ptr = cache_ptr->pel_head_ptr; + cur_ring_pel_len = 0; + while(entry_ptr != NULL) { + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->ring >= ring); - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "Pinned entry count not decreasing, cur_pel_len = %d, old_pel_len = %d", (int)cur_pel_len, (int)old_pel_len) + if(entry_ptr->ring == ring) + cur_ring_pel_len++; - } else if ( ( cur_pel_len == 0 ) && ( old_pel_len == 0 ) ) { + entry_ptr = entry_ptr->next; + } /* end while */ + if((cur_ring_pel_len > 0) && (cur_ring_pel_len >= old_ring_pel_len)) { + /* The number of pinned entries in the ring is positive, and + * it is not declining. Scream and die. + */ + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Pinned entry count not decreasing, cur_ring_pel_len = %d, old_ring_pel_len = %d, ring = %d", (int)cur_ring_pel_len, (int)old_ring_pel_len, (int)ring) + } else if((cur_ring_pel_len == 0) && (old_ring_pel_len == 0)) { /* increment the pass count */ passes++; } - if ( passes >= H5C__MAX_PASSES_ON_FLUSH ) { - + if(passes >= H5C__MAX_PASSES_ON_FLUSH) /* we have exceeded the maximum number of passes through the * cache to flush and destroy all entries. Scream and die. */ - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "Maximum passes on flush exceeded.") - } + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Maximum passes on flush exceeded.") } /* main while loop */ - /* Invariants, after destroying all entries in the hash table */ - HDassert( cache_ptr->index_size == 0 ); - HDassert( cache_ptr->clean_index_size == 0 ); - HDassert( cache_ptr->dirty_index_size == 0 ); - HDassert( cache_ptr->slist_len == 0 ); - HDassert( cache_ptr->slist_size == 0 ); - HDassert( cache_ptr->pel_len == 0 ); - HDassert( cache_ptr->pel_size == 0 ); - HDassert( cache_ptr->pl_len == 0 ); - HDassert( cache_ptr->pl_size == 0 ); - HDassert( cache_ptr->LRU_list_len == 0 ); - HDassert( cache_ptr->LRU_list_size == 0 ); + /* Invariants, after destroying all entries in the ring */ + for(i = (int)H5C_RING_UNDEFINED; i <= (int)ring; i++) { + HDassert(cache_ptr->index_ring_len[i] == 0); + HDassert(cache_ptr->index_ring_size[i] == (size_t)0); + HDassert(cache_ptr->clean_index_ring_size[i] == (size_t)0); + HDassert(cache_ptr->dirty_index_ring_size[i] == (size_t)0); + HDassert(cache_ptr->slist_ring_len[i] == 0); + HDassert(cache_ptr->slist_ring_size[i] == (size_t)0); + } /* end for */ - HDassert( protected_entries <= cache_ptr->pl_len ); + HDassert(protected_entries <= cache_ptr->pl_len); - if ( protected_entries > 0 ) { + if(protected_entries > 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cache has protected entries.") + else if(cur_ring_pel_len > 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't unpin all pinned entries in ring.") - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "Cache has protected entries.") +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_flush_invalidate_ring() */ + + +/*------------------------------------------------------------------------- + * Function: H5C_flush_ring + * + * Purpose: Flush the entries contained in the specified cache and + * ring. All entries in rings outside the specified ring + * must have been flushed on entry. + * + * If the cache contains protected entries in the specified + * ring, the function will fail, as protected entries cannot + * be flushed. However all unprotected entries in the target + * ring should be flushed before the function returns failure. + * + * If flush dependencies appear in the target ring, the + * function makes repeated passes through the slist flushing + * entries in flush dependency order. + * + * Return: Non-negative on success/Negative on failure or if there was + * a request to flush all items and something was protected. + * + * Programmer: John Mainzer + * 9/1/15 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_flush_ring(H5F_t *f, hid_t dxpl_id, H5C_ring_t ring, unsigned flags) +{ + H5C_t * cache_ptr = f->shared->cache; + hbool_t flushed_entries_last_pass; + hbool_t flush_marked_entries; + hbool_t ignore_protected; + hbool_t tried_to_flush_protected_entry = FALSE; + hbool_t restart_slist_scan; + int32_t passes = 0; + int32_t protected_entries = 0; + H5SL_node_t * node_ptr = NULL; + H5C_cache_entry_t * entry_ptr = NULL; + H5C_cache_entry_t * next_entry_ptr = NULL; +#if H5C_DO_SANITY_CHECKS + int64_t flushed_entries_count = 0; + int64_t flushed_entries_size = 0; + int64_t initial_slist_len = 0; + size_t initial_slist_size = 0; + int64_t entry_size_change; + int64_t * entry_size_change_ptr = &entry_size_change; +#else /* H5C_DO_SANITY_CHECKS */ + int64_t * entry_size_change_ptr = NULL; +#endif /* H5C_DO_SANITY_CHECKS */ + int i; + herr_t ret_value = SUCCEED; - } else if ( cur_pel_len > 0 ) { + FUNC_ENTER_NOAPI(FAIL) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "Can't unpin all pinned entries.") + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->slist_ptr); + HDassert((flags & H5C__FLUSH_INVALIDATE_FLAG) == 0); + HDassert(ring > H5C_RING_UNDEFINED); + HDassert(ring < H5C_RING_NTYPES); - } +#if H5C_DO_EXTREME_SANITY_CHECKS + if((H5C_validate_protected_entry_list(cache_ptr) < 0) || + (H5C_validate_pinned_entry_list(cache_ptr) < 0 || + (H5C_validate_lru_list(cache_ptr) < 0)) { + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry.\n"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ -done: + ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 ); + flush_marked_entries = ( (flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0 ); - FUNC_LEAVE_NOAPI(ret_value) + if(!flush_marked_entries) + for(i = (int)H5C_RING_UNDEFINED; i < (int)ring; i++) + HDassert(cache_ptr->slist_ring_len[i] == 0); -} /* H5C_flush_invalidate_cache() */ + HDassert(cache_ptr->flush_in_progress); + + /* When we are only flushing marked entries, the slist will usually + * still contain entries when we have flushed everything we should. + * Thus we track whether we have flushed any entries in the last + * pass, and terminate if we haven't. + */ + flushed_entries_last_pass = TRUE; + + /* set the cache_ptr->slist_change_in_pre_serialize and + * cache_ptr->slist_change_in_serialize to false. + * + * These flags are set to TRUE by H5C__flush_single_entry if the + * slist is modified by a pre_serialize or serialize call respectively. + * H5C_flush_cache uses these flags to detect any modifications + * to the slist that might corrupt the scan of the slist -- and + * restart the scan in this event. + */ + cache_ptr->slist_change_in_pre_serialize = FALSE; + cache_ptr->slist_change_in_serialize = FALSE; + + while((passes < H5C__MAX_PASSES_ON_FLUSH) && + (cache_ptr->slist_ring_len[ring] > 0) && + (protected_entries == 0) && + (flushed_entries_last_pass)) { + unsigned curr_flush_dep_height = 0; + unsigned flush_dep_passes = 0; + + flushed_entries_last_pass = FALSE; + + /* Loop over all flush dependency heights of entries */ + while((curr_flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS) && + (cache_ptr->slist_ring_len[ring] > 0) && + (flush_dep_passes < H5C__MAX_PASSES_ON_FLUSH)) { + hbool_t flushed_during_dep_loop = FALSE; + +#if H5C_DO_SANITY_CHECKS + /* For sanity checking, try to verify that the skip list has + * the expected size and number of entries at the end of each + * internal while loop (see below). + * + * Doing this get a bit tricky, as depending on flags, we may + * or may not flush all the entries in the slist. + * + * To make things more entertaining, with the advent of the + * fractal heap, the entry serialize callback can cause entries + * to be dirtied, resized, and/or moved. Also, the + * pre_serialize callback can result in an entry being + * removed from the cache via the take ownership flag. + * + * To deal with this, we first make note of the initial + * skip list length and size: + */ + initial_slist_len = cache_ptr->slist_len; + initial_slist_size = cache_ptr->slist_size; + + /* We then zero counters that we use to track the number + * and total size of entries flushed: + */ + flushed_entries_count = 0; + flushed_entries_size = 0; + + /* As mentioned above, there is the possibility that + * entries will be dirtied, resized, flushed, or removed + * from the cache via the take ownership flag during + * our pass through the skip list. To capture the number + * of entries added, and the skip list size delta, + * zero the slist_len_increase and slist_size_increase of + * the cache's instance of H5C_t. These fields will be + * updated elsewhere to account for slist insertions and/or + * dirty entry size changes. + */ + cache_ptr->slist_len_increase = 0; + cache_ptr->slist_size_increase = 0; + + /* at the end of the loop, use these values to compute the + * expected slist length and size and compare this with the + * value recorded in the cache's instance of H5C_t. + */ +#endif /* H5C_DO_SANITY_CHECKS */ + + restart_slist_scan = TRUE; + + while((restart_slist_scan ) || (node_ptr != NULL)) { + if(restart_slist_scan) { + restart_slist_scan = FALSE; + + /* Start at beginning of skip list */ + node_ptr = H5SL_first(cache_ptr->slist_ptr); + + if(node_ptr == NULL) + /* the slist is empty -- break out of inner loop */ + break; + + /* Get cache entry for this node */ + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + + if(NULL == next_entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") + + HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(next_entry_ptr->is_dirty); + HDassert(next_entry_ptr->in_slist); + } /* end if */ + + entry_ptr = next_entry_ptr; + + /* With the advent of the fractal heap, the free space + * manager, and the version 3 cache, it is possible + * that the pre-serialize or serialize callback will + * dirty, resize, or take ownership of other entries + * in the cache. + * + * To deal with this, I have inserted code to detect any + * change in the skip list not directly under the control + * of this function. If such modifications are detected, + * we must re-start the scan of the skip list to avoid + * the possibility that the target of the next_entry_ptr + * may have been flushed or deleted from the cache. + * + * To verify that all such possibilities have been dealt + * with, we do a bit of extra sanity checking on + * entry_ptr. + */ + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->in_slist); + HDassert(entry_ptr->is_dirty); + HDassert(entry_ptr->ring >= ring); + + /* increment node pointer now, before we delete its target + * from the slist. + */ + node_ptr = H5SL_next(node_ptr); + if(node_ptr != NULL) { + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + if(NULL == next_entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") + + HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(next_entry_ptr->is_dirty); + HDassert(next_entry_ptr->in_slist); + HDassert(next_entry_ptr->ring >= ring); + HDassert(entry_ptr != next_entry_ptr); + } /* end if */ + else + next_entry_ptr = NULL; + + HDassert(entry_ptr != NULL); + HDassert(entry_ptr->in_slist); + + if(((!flush_marked_entries) || (entry_ptr->flush_marker)) && + ((!entry_ptr->flush_me_last) || + ((entry_ptr->flush_me_last) && + (cache_ptr->num_last_entries >= cache_ptr->slist_len))) && + (entry_ptr->ring == ring)) { + if(entry_ptr->is_protected) { + /* we probably have major problems -- but lets + * flush everything we can before we decide + * whether to flag an error. + */ + tried_to_flush_protected_entry = TRUE; + protected_entries++; + } /* end if */ + else if(entry_ptr->is_pinned) { + + /* Test to see if we are can flush the entry now. + * If we can, go ahead and flush. Note that we + * aren't trying to do a destroy here, so that + * is not an issue. + */ + if(entry_ptr->flush_dep_height == curr_flush_dep_height) { +#if H5C_DO_SANITY_CHECKS + flushed_entries_count++; + flushed_entries_size += (int64_t)entry_ptr->size; + entry_size_change = 0; +#endif /* H5C_DO_SANITY_CHECKS */ + + if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed.") + +#if H5C_DO_SANITY_CHECKS + /* it is possible that the entry size changed + * during flush -- update flushed_entries_size + * to account for this. + */ + flushed_entries_size += entry_size_change; +#endif /* H5C_DO_SANITY_CHECKS */ + + flushed_during_dep_loop = TRUE; + + if((cache_ptr->slist_change_in_serialize) || + (cache_ptr->slist_change_in_pre_serialize)) { + /* The slist has been modified by something + * other than the simple removal of the + * of the flushed entry after the flush. + * + * This has the potential to corrupt the + * scan through the slist, so restart it. + */ + restart_slist_scan = TRUE; + cache_ptr->slist_change_in_pre_serialize = FALSE; + cache_ptr->slist_change_in_serialize = FALSE; + + H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) + } /* end if */ + } /* end if */ + else if(entry_ptr->flush_dep_height < curr_flush_dep_height) + /* This shouldn't happen -- if it does, just scream and die. */ + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") + } /* end else-if */ + else { + /* Test to see if we are can flush the entry now. + * If we can, go ahead and flush. Note that we + * aren't trying to do a destroy here, so that + * is not an issue. + */ + if(entry_ptr->flush_dep_height == curr_flush_dep_height) { +#if H5C_DO_SANITY_CHECKS + flushed_entries_count++; + flushed_entries_size += (int64_t)entry_ptr->size; + entry_size_change = 0; +#endif /* H5C_DO_SANITY_CHECKS */ + if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flags, entry_size_change_ptr, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry.") + +#if H5C_DO_SANITY_CHECKS + /* it is possible that the entry size changed + * during flush -- update flushed_entries_size + * to account for this. + */ + flushed_entries_size += entry_size_change; +#endif /* H5C_DO_SANITY_CHECKS */ + + flushed_during_dep_loop = TRUE; + + if((cache_ptr->slist_change_in_serialize) || + (cache_ptr->slist_change_in_pre_serialize)) { + /* The slist has been modified by something + * other than the simple removal of the + * of the flushed entry after the flush. + * + * This has the potential to corrupt the + * scan through the slist, so restart it. + */ + restart_slist_scan = TRUE; + cache_ptr->slist_change_in_pre_serialize = FALSE; + cache_ptr->slist_change_in_serialize = FALSE; + + H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) + } /* end if */ + } /* end if */ + else if(entry_ptr->flush_dep_height < curr_flush_dep_height) + /* This shouldn't happen -- if it does, just scream and die. */ + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry below current flush dep. height.") + } /* end else */ + } /* end if */ + } /* while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) */ + + /* Check for incrementing flush dependency height */ + if(flushed_during_dep_loop) { + + /* If we flushed an entry at this flush dependency height + * start over at the bottom level of the flush dependencies + */ + curr_flush_dep_height = 0; + + /* Make certain we don't get stuck in an infinite loop */ + flush_dep_passes++; + + /* Set flag for outer loop */ + flushed_entries_last_pass = TRUE; + } /* end if */ + else + curr_flush_dep_height++; + } /* while ( curr_flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS) */ + + passes++; + +#if H5C_DO_SANITY_CHECKS + /* Verify that the slist size and length are as expected. */ + HDassert((initial_slist_len + cache_ptr->slist_len_increase - + flushed_entries_count) == cache_ptr->slist_len); + HDassert((size_t)((int64_t)initial_slist_size + + cache_ptr->slist_size_increase - + flushed_entries_size) == cache_ptr->slist_size); +#endif /* H5C_DO_SANITY_CHECKS */ + } /* while */ + + HDassert(protected_entries <= cache_ptr->pl_len); + + if(((cache_ptr->pl_len > 0) && (!ignore_protected)) || (tried_to_flush_protected_entry)) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "cache has protected items") + + if((cache_ptr->slist_len != 0) && (passes >= H5C__MAX_PASSES_ON_FLUSH)) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush pass limit exceeded.") + +#if H5C_DO_SANITY_CHECKS + if(!flush_marked_entries) { + HDassert(cache_ptr->slist_ring_len[ring] == 0); + HDassert(cache_ptr->slist_ring_size[ring] == 0); + } /* end if */ +#endif /* H5C_DO_SANITY_CHECKS */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_flush_ring() */ /*------------------------------------------------------------------------- @@ -7742,6 +7837,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ HDassert(cache_ptr); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); HDassert(entry_ptr); + HDassert(entry_ptr->ring != H5C_RING_UNDEFINED); /* If defined, initialize *entry_size_change_ptr to 0 */ if(entry_size_change_ptr != NULL) @@ -8420,7 +8516,7 @@ H5C_load_entry(H5F_t * f, MPI_Comm comm; /* File MPI Communicator */ int mpi_code; /* MPI error code */ #endif /* H5_HAVE_PARALLEL */ - void * ret_value; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -8822,6 +8918,8 @@ H5C_load_entry(H5F_t * f, entry->flush_in_progress = FALSE; entry->destroy_in_progress = FALSE; + entry->ring = H5C_RING_UNDEFINED; + /* Initialize flush dependency height fields */ entry->flush_dep_parent = NULL; for(u = 0; u < H5C__NUM_FLUSH_DEP_HEIGHTS; u++) @@ -10213,6 +10311,50 @@ H5C_retag_copied_metadata(H5C_t * cache_ptr, haddr_t metadata_tag) FUNC_LEAVE_NOAPI_VOID } /* H5C_retag_copied_metadata */ + +/*------------------------------------------------------------------------- + * Function: H5C_get_entry_ring + * + * Purpose: Given a file address, retrieve the ring for an entry at that + * address. + * + * On error, the value of *ring is not modified. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * 9/8/15 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring) +{ + H5C_t *cache_ptr; /* Pointer to cache */ + H5C_cache_entry_t *entry_ptr; /* Pointer to cache entry at address */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(f); + HDassert(f->shared); + cache_ptr = f->shared->cache; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(H5F_addr_defined(addr)); + + /* Locate the entry at the address */ + H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) + HDassert(entry_ptr); + + /* Return the ring value */ + *ring = entry_ptr->ring; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_get_entry_ring() */ + static herr_t H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, hid_t dxpl_id, int64_t *entry_size_change_ptr) @@ -30,10 +30,19 @@ #include "H5private.h" /* Generic Functions */ #include "H5CSprivate.h" /* Function stack */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5Eprivate.h" /* Error handling */ #ifdef H5_HAVE_CODESTACK +#define H5CS_MIN_NSLOTS 16 /* Minimum number of records in an function stack */ + +/* A function stack */ +typedef struct H5CS_t { + unsigned nused; /* Number of records currently used in stack */ + unsigned nalloc; /* Number of records current allocated for stack */ + const char **rec; /* Array of function records */ +} H5CS_t; + #ifdef H5_HAVE_THREADSAFE /* * The per-thread function stack. pthread_once() initializes a special @@ -44,8 +53,8 @@ * In order for this macro to work, H5CS_get_my_stack() must be preceeded * by "H5CS_t *fstack =". */ -static H5CS_t *H5CS_get_stack(void); -#define H5CS_get_my_stack() H5CS_get_stack() +static H5CS_t *H5CS__get_stack(void); +#define H5CS_get_my_stack() H5CS__get_stack() #else /* H5_HAVE_THREADSAFE */ /* * The function stack. Eventually we'll have some sort of global table so each @@ -58,7 +67,7 @@ H5CS_t H5CS_stack_g[1]; #ifdef H5_HAVE_THREADSAFE /*------------------------------------------------------------------------- - * Function: H5CS_get_stack + * Function: H5CS__get_stack * * Purpose: Support function for H5CS_get_my_stack() to initialize and * acquire per-thread function stack. @@ -70,19 +79,17 @@ H5CS_t H5CS_stack_g[1]; * Programmer: Quincey Koziol * February 6, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5CS_t * -H5CS_get_stack(void) +H5CS__get_stack(void) { H5CS_t *fstack; - FUNC_ENTER_NOAPI_NOERR_NOFS + FUNC_ENTER_STATIC_NOERR_NOFS fstack = H5TS_get_thread_local_value(H5TS_funcstk_key_g); - if (!fstack) { + if(!fstack) { /* No associated value with current thread - create one */ #ifdef H5_HAVE_WIN_THREADS fstack = (H5CS_t *)LocalAlloc(LPTR, sizeof(H5CS_t)); /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */ @@ -92,17 +99,19 @@ H5CS_get_stack(void) HDassert(fstack); /* Set the thread-specific info */ - fstack->nused=0; + fstack->nused = 0; + fstack->nalloc = 0; + fstack->rec = NULL; /* (It's not necessary to release this in this API, it is * released by the "key destructor" set up in the H5TS * routines. See calls to pthread_key_create() in H5TS.c -QAK) */ H5TS_set_thread_local_value(H5TS_funcstk_key_g, (void *)fstack); - } + } /* end if */ - FUNC_LEAVE_NOAPI_NOFS(fstack); -} /* end H5CS_get_stack() */ + FUNC_LEAVE_NOAPI_NOFS(fstack) +} /* end H5CS__get_stack() */ #endif /* H5_HAVE_THREADSAFE */ @@ -133,59 +142,28 @@ H5CS_print_stack(const H5CS_t *fstack, FILE *stream) HDassert(fstack); /* Default to outputting information to stderr */ - if (!stream) + if(!stream) stream = stderr; - HDfprintf (stream, "HDF5-DIAG: Function stack from %s ", H5_lib_vers_info_g); + HDfprintf(stream, "HDF5-DIAG: Function stack from %s ", H5_lib_vers_info_g); /* try show the process or thread id in multiple processes cases*/ #ifdef H5_HAVE_THREADSAFE - HDfprintf (stream, "thread %lu.", HDpthread_self_ulong()); + HDfprintf(stream, "thread %lu.", HDpthread_self_ulong()); #else /* H5_HAVE_THREADSAFE */ - HDfprintf (stream, "thread 0."); + HDfprintf(stream, "thread 0."); #endif /* H5_HAVE_THREADSAFE */ - if (fstack && fstack->nused>0) - HDfprintf (stream, " Back trace follows."); - HDfputc ('\n', stream); + if(fstack && fstack->nused>0) + HDfprintf(stream, " Back trace follows."); + HDfputc('\n', stream); - for (i=fstack->nused-1; i>=0; --i) - HDfprintf(stream, "%*s#%03d: Routine: %s\n", indent, "", i, fstack->slot[i]); + for(i = fstack->nused - 1; i >= 0; --i) + HDfprintf(stream, "%*s#%03d: Routine: %s\n", indent, "", i, fstack->rec[i]); - FUNC_LEAVE_NOAPI_NOFS(SUCCEED); + FUNC_LEAVE_NOAPI_NOFS(SUCCEED) } /* end H5CS_print_stack() */ /*------------------------------------------------------------------------- - * Function: H5CS_print - * - * Purpose: Prints the default function stack in some default way. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Thursday, February 6, 2003 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5CS_print(FILE *stream) -{ - H5CS_t *fstack = H5CS_get_my_stack (); /* Get the correct function stack */ - - /* Don't push this function on the function stack... :-) */ - FUNC_ENTER_NOAPI_NOERR_NOFS - - /* Sanity check */ - HDassert(fstack); - - H5CS_print_stack(fstack, stream); - - FUNC_LEAVE_NOAPI_NOFS(SUCCEED); -} /* end H5CS_print() */ - - -/*------------------------------------------------------------------------- * Function: H5CS_push * * Purpose: Pushes a new record onto function stack for the current @@ -196,30 +174,37 @@ H5CS_print(FILE *stream) * Programmer: Quincey Koziol * Thursday, February 6, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5CS_push(const char *func_name) { - H5CS_t *fstack = H5CS_get_my_stack (); + H5CS_t *fstack = H5CS_get_my_stack(); /* Current function stack for library */ /* Don't push this function on the function stack... :-) */ FUNC_ENTER_NOAPI_NOERR_NOFS /* Sanity check */ HDassert(fstack); + HDassert(fstack->nused <= fstack->nalloc); HDassert(func_name); - /* - * Push the function if there's room. Otherwise just increment count - */ - if (fstack->nused<H5CS_NSLOTS) - fstack->slot[fstack->nused] = func_name; + /* Check if we need to expand the stack of records */ + if(fstack->nused == fstack->nalloc) { + size_t na = MAX((fstack->nalloc * 2), H5CS_MIN_NSLOTS); + const char **x = (const char **)HDrealloc(fstack->rec, na * sizeof(const char *)); + + /* (Avoid returning an error from this routine, currently -QAK) */ + HDassert(x); + fstack->rec = x; + fstack->nalloc = na; + } /* end if */ + + /* Push the function name */ + fstack->rec[fstack->nused] = func_name; fstack->nused++; - FUNC_LEAVE_NOAPI_NOFS(SUCCEED); + FUNC_LEAVE_NOAPI_NOFS(SUCCEED) } /* end H5CS_push() */ @@ -240,14 +225,14 @@ H5CS_push(const char *func_name) herr_t H5CS_pop(void) { - H5CS_t *fstack = H5CS_get_my_stack (); + H5CS_t *fstack = H5CS_get_my_stack(); /* Don't push this function on the function stack... :-) */ FUNC_ENTER_NOAPI_NOERR_NOFS /* Sanity check */ HDassert(fstack); - HDassert(fstack->nused>0); + HDassert(fstack->nused > 0); /* Pop the function. */ fstack->nused--; @@ -266,43 +251,52 @@ H5CS_pop(void) * Programmer: Quincey Koziol * Tuesday, August 9, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ -herr_t -H5CS_copy_stack(H5CS_t *new_stack) +H5CS_t * +H5CS_copy_stack(void) { - H5CS_t *old_stack = H5CS_get_my_stack (); + H5CS_t *old_stack = H5CS_get_my_stack(); /* Existing function stack for library */ + H5CS_t *new_stack; /* New function stack, for copy */ unsigned u; /* Local index variable */ + H5CS_t *ret_value = NULL; /* Return value */ /* Don't push this function on the function stack... :-) */ - FUNC_ENTER_NOAPI_NOERR_NOFS + FUNC_ENTER_NOAPI_NOFS /* Sanity check */ HDassert(old_stack); + /* Allocate a new stack */ + /* (Don't use library allocate code, since this code stack supports it) */ + if(NULL == (new_stack = HDcalloc(1, sizeof(H5CS_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate function stack") + if(NULL == (new_stack->rec = HDcalloc(old_stack->nused, sizeof(const char *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate function stack records") + /* Copy old stack to new one, duplicating the strings */ for(u = 0; u < old_stack->nused; u++) - new_stack->slot[u] = H5MM_strdup(old_stack->slot[u]); - new_stack->nused = old_stack->nused; + new_stack->rec[u] = HDstrdup(old_stack->rec[u]); + new_stack->nused = new_stack->nalloc = old_stack->nused; - FUNC_LEAVE_NOAPI_NOFS(SUCCEED); + /* Set the return value */ + ret_value = new_stack; + +done: + FUNC_LEAVE_NOAPI_NOFS(ret_value) } /* end H5CS_copy_stack() */ /*------------------------------------------------------------------------- * Function: H5CS_close_stack * - * Purpose: Closes a copy of a stack + * Purpose: Closes and frees a copy of a stack * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Tuesday, August 9, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -316,11 +310,20 @@ H5CS_close_stack(H5CS_t *stack) /* Sanity check */ HDassert(stack); - /* Free strings on stack */ - for(u = 0; u < stack->nused; u++) - stack->slot[u] = H5MM_xfree((void *)stack->slot[u]); - - FUNC_LEAVE_NOAPI_NOFS(SUCCEED); + /* Free stack */ + for(u = 0; u < stack->nused; u++) { + if(stack->rec[u]) + HDfree((void *)stack->rec[u]); + stack->rec[u] = NULL; + } /* end for */ + if(stack->rec) { + HDfree(stack->rec); + stack->rec = NULL; + } /* end if */ + if(stack) + HDfree(stack); + + FUNC_LEAVE_NOAPI_NOFS(SUCCEED) } /* end H5CS_close_stack() */ #endif /* H5_HAVE_CODESTACK */ diff --git a/src/H5CSprivate.h b/src/H5CSprivate.h index 13f3b66..ab7f993 100644 --- a/src/H5CSprivate.h +++ b/src/H5CSprivate.h @@ -26,19 +26,13 @@ /* Private headers needed by this file */ #include "H5private.h" -#define H5CS_NSLOTS 48 /*number of slots in an function stack */ - -/* A function stack */ -typedef struct H5CS_t { - unsigned nused; /*num slots currently used in stack */ - const char *slot[H5CS_NSLOTS]; /*array of function records */ -} H5CS_t; - -H5_DLL herr_t H5CS_push (const char *func_name); -H5_DLL herr_t H5CS_pop (void); -H5_DLL herr_t H5CS_print (FILE *stream); -H5_DLL herr_t H5CS_print_stack (const H5CS_t *stack, FILE *stream); -H5_DLL herr_t H5CS_copy_stack (H5CS_t *stack); -H5_DLL herr_t H5CS_close_stack (H5CS_t *stack); +/* Forward declarations for structure fields */ +struct H5CS_t; +H5_DLL herr_t H5CS_push(const char *func_name); +H5_DLL herr_t H5CS_pop(void); +H5_DLL herr_t H5CS_print_stack(const struct H5CS_t *stack, FILE *stream); +H5_DLL struct H5CS_t *H5CS_copy_stack(void); +H5_DLL herr_t H5CS_close_stack(struct H5CS_t *stack); #endif /* _H5CSprivate_H */ + diff --git a/src/H5Cmodule.h b/src/H5Cmodule.h new file mode 100644 index 0000000..2c39eab --- /dev/null +++ b/src/H5Cmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5C package. Including this header means that the source file + * is part of the H5C package. + */ +#ifndef _H5Cmodule_H +#define _H5Cmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5C_MODULE +#define H5_MY_PKG H5C +#define H5_MY_PKG_ERR H5E_CACHE +#define H5_MY_PKG_INIT NO + +#endif /* _H5Cmodule_H */ + diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index aa6b49a..604a991 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -29,8 +29,8 @@ /* Module Setup */ /****************/ -#define H5C_PACKAGE /*suppress error about including H5Cpkg */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Cmodule.h" /* This source code file is part of the H5C module */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ /***********/ diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 22a964e..bf2e5a3 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -28,7 +28,7 @@ * reason why this file was created. */ -#ifndef H5C_PACKAGE +#if !(defined H5C_FRIEND || defined H5C_MODULE) #error "Do not include this file outside the H5C package!" #endif @@ -824,13 +824,19 @@ if ( ( (entry_ptr) == NULL ) || \ * * JRM -- 11/5/08 * + * - Updated existing index macros and sanity check macros to maintain + * the index_ring_len, index_ring_size, clean_index_ring_size, and + * dirty_index_ring_size fields of H5C_t. + * + * JRM -- 9/1/15 + * ***********************************************************************/ /* H5C__HASH_TABLE_LEN is defined in H5Cpkg.h. It mut be a power of two. */ #define H5C__HASH_MASK ((size_t)(H5C__HASH_TABLE_LEN - 1) << 3) -#define H5C__HASH_FCN(x) (int)(((x) & H5C__HASH_MASK) >> 3) +#define H5C__HASH_FCN(x) (int)((unsigned)((x) & H5C__HASH_MASK) >> 3) #if H5C_DO_SANITY_CHECKS @@ -848,7 +854,17 @@ if ( ( (cache_ptr) == NULL ) || \ ((cache_ptr)->clean_index_size + \ (cache_ptr)->dirty_index_size) ) || \ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \ + ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ + ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \ + ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, \ "Pre HT insert SC failed") \ } @@ -860,7 +876,16 @@ if ( ( (cache_ptr) == NULL ) || \ ((cache_ptr)->clean_index_size + \ (cache_ptr)->dirty_index_size) ) || \ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \ + ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] == 0 ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, \ "Post HT insert SC failed") \ } @@ -887,7 +912,20 @@ if ( ( (cache_ptr) == NULL ) || \ ((cache_ptr)->clean_index_size + \ (cache_ptr)->dirty_index_size) ) || \ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \ + ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ + ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \ + ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] < \ + (entry_ptr)->size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Pre HT remove SC failed") \ } @@ -903,7 +941,15 @@ if ( ( (cache_ptr) == NULL ) || \ ((cache_ptr)->clean_index_size + \ (cache_ptr)->dirty_index_size) ) || \ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \ + ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Post HT remove SC failed") \ } @@ -971,7 +1017,18 @@ if ( ( (cache_ptr) == NULL ) || \ ( (cache_ptr)->clean_index_size < (old_size) ) ) && \ ( ( (was_clean) ) || \ ( (cache_ptr)->dirty_index_size < (old_size) ) ) ) || \ - ( (entry_ptr) == NULL ) ) { \ + ( (entry_ptr) == NULL ) || \ + ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \ + ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "Pre HT entry size change SC failed") \ } @@ -992,7 +1049,15 @@ if ( ( (cache_ptr) == NULL ) || \ ( ( ((entry_ptr)->is_dirty) ) || \ ( (cache_ptr)->clean_index_size < (new_size) ) ) ) || \ ( ( (cache_ptr)->index_len == 1 ) && \ - ( (cache_ptr)->index_size != (new_size) ) ) ) { \ + ( (cache_ptr)->index_size != (new_size) ) ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "Post HT entry size change SC failed") \ } @@ -1009,7 +1074,18 @@ if ( \ ( (cache_ptr)->index_size != \ ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \ + ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ + ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \ + ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "Pre HT update for entry clean SC failed") \ } @@ -1026,7 +1102,18 @@ if ( \ ( (cache_ptr)->index_size != \ ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \ + ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ + ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \ + ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "Pre HT update for entry dirty SC failed") \ } @@ -1035,7 +1122,15 @@ if ( \ if ( ( (cache_ptr)->index_size != \ ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \ + ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "Post HT update for entry clean SC failed") \ } @@ -1044,7 +1139,15 @@ if ( ( (cache_ptr)->index_size != \ if ( ( (cache_ptr)->index_size != \ ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \ ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) ) { \ + ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ + ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ + (cache_ptr)->index_len ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ + (cache_ptr)->index_size ) || \ + ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ + HDassert(FALSE); \ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "Post HT update for entry dirty SC failed") \ } @@ -1070,30 +1173,38 @@ if ( ( (cache_ptr)->index_size != \ #endif /* H5C_DO_SANITY_CHECKS */ -#define H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, fail_val) \ -{ \ - int k; \ - H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \ - k = H5C__HASH_FCN((entry_ptr)->addr); \ - if ( ((cache_ptr)->index)[k] == NULL ) \ - ((cache_ptr)->index)[k] = (entry_ptr); \ - else { \ - (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \ - (entry_ptr)->ht_next->ht_prev = (entry_ptr); \ - ((cache_ptr)->index)[k] = (entry_ptr); \ - } \ - (cache_ptr)->index_len++; \ - (cache_ptr)->index_size += (entry_ptr)->size; \ - if ( (entry_ptr)->is_dirty ) \ - (cache_ptr)->dirty_index_size += (entry_ptr)->size; \ - else \ - (cache_ptr)->clean_index_size += (entry_ptr)->size; \ - if ((entry_ptr)->flush_me_last) { \ - (cache_ptr)->num_last_entries++; \ - HDassert((cache_ptr)->num_last_entries <= 2); \ - } \ - H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) \ - H5C__POST_HT_INSERT_SC(cache_ptr, fail_val) \ +#define H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, fail_val) \ +{ \ + int k; \ + H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \ + k = H5C__HASH_FCN((entry_ptr)->addr); \ + if ( ((cache_ptr)->index)[k] == NULL ) \ + ((cache_ptr)->index)[k] = (entry_ptr); \ + else { \ + (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \ + (entry_ptr)->ht_next->ht_prev = (entry_ptr); \ + ((cache_ptr)->index)[k] = (entry_ptr); \ + } \ + (cache_ptr)->index_len++; \ + (cache_ptr)->index_size += (entry_ptr)->size; \ + ((cache_ptr)->index_ring_len[entry_ptr->ring])++; \ + ((cache_ptr)->index_ring_size[entry_ptr->ring]) \ + += (entry_ptr)->size; \ + if ( (entry_ptr)->is_dirty ) { \ + (cache_ptr)->dirty_index_size += (entry_ptr)->size; \ + ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \ + += (entry_ptr)->size; \ + } else { \ + (cache_ptr)->clean_index_size += (entry_ptr)->size; \ + ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \ + += (entry_ptr)->size; \ + } \ + if ((entry_ptr)->flush_me_last) { \ + (cache_ptr)->num_last_entries++; \ + HDassert((cache_ptr)->num_last_entries <= 2); \ + } \ + H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) \ + H5C__POST_HT_INSERT_SC(cache_ptr, fail_val) \ } #define H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr) \ @@ -1111,10 +1222,18 @@ if ( ( (cache_ptr)->index_size != \ (entry_ptr)->ht_prev = NULL; \ (cache_ptr)->index_len--; \ (cache_ptr)->index_size -= (entry_ptr)->size; \ - if ( (entry_ptr)->is_dirty ) \ + ((cache_ptr)->index_ring_len[entry_ptr->ring])--; \ + ((cache_ptr)->index_ring_size[entry_ptr->ring]) \ + -= (entry_ptr)->size; \ + if ( (entry_ptr)->is_dirty ) { \ (cache_ptr)->dirty_index_size -= (entry_ptr)->size; \ - else \ + ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \ + -= (entry_ptr)->size; \ + } else { \ (cache_ptr)->clean_index_size -= (entry_ptr)->size; \ + ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \ + -= (entry_ptr)->size; \ + } \ if ((entry_ptr)->flush_me_last) { \ (cache_ptr)->num_last_entries--; \ HDassert((cache_ptr)->num_last_entries <= 1); \ @@ -1182,7 +1301,11 @@ if ( ( (cache_ptr)->index_size != \ { \ H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr); \ (cache_ptr)->dirty_index_size -= (entry_ptr)->size; \ + ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \ + -= (entry_ptr)->size; \ (cache_ptr)->clean_index_size += (entry_ptr)->size; \ + ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \ + += (entry_ptr)->size; \ H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr); \ } @@ -1190,27 +1313,39 @@ if ( ( (cache_ptr)->index_size != \ { \ H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr); \ (cache_ptr)->clean_index_size -= (entry_ptr)->size; \ + ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \ + -= (entry_ptr)->size; \ (cache_ptr)->dirty_index_size += (entry_ptr)->size; \ + ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \ + += (entry_ptr)->size; \ H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr); \ } -#define H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size, \ - entry_ptr, was_clean) \ -{ \ - H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ - entry_ptr, was_clean) \ - (cache_ptr)->index_size -= (old_size); \ - (cache_ptr)->index_size += (new_size); \ - if ( was_clean ) \ - (cache_ptr)->clean_index_size -= (old_size); \ - else \ - (cache_ptr)->dirty_index_size -= (old_size); \ - if ( (entry_ptr)->is_dirty ) \ - (cache_ptr)->dirty_index_size += (new_size); \ - else \ - (cache_ptr)->clean_index_size += (new_size); \ - H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ - entry_ptr) \ +#define H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size, \ + entry_ptr, was_clean) \ +{ \ + H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ + entry_ptr, was_clean) \ + (cache_ptr)->index_size -= (old_size); \ + (cache_ptr)->index_size += (new_size); \ + ((cache_ptr)->index_ring_size[entry_ptr->ring]) -= (old_size); \ + ((cache_ptr)->index_ring_size[entry_ptr->ring]) += (new_size); \ + if ( was_clean ) { \ + (cache_ptr)->clean_index_size -= (old_size); \ + ((cache_ptr)->clean_index_ring_size[entry_ptr->ring])-= (old_size); \ + } else { \ + (cache_ptr)->dirty_index_size -= (old_size); \ + ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring])-= (old_size); \ + } \ + if ( (entry_ptr)->is_dirty ) { \ + (cache_ptr)->dirty_index_size += (new_size); \ + ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring])+= (new_size); \ + } else { \ + (cache_ptr)->clean_index_size += (new_size); \ + ((cache_ptr)->clean_index_ring_size[entry_ptr->ring])+= (new_size); \ + } \ + H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ + entry_ptr) \ } @@ -1275,6 +1410,10 @@ if ( ( (cache_ptr)->index_size != \ * Added code to set cache_ptr->slist_changed to TRUE * when an entry is inserted in the slist. * + * JRM -- 9/1/15 + * Added code to maintain the cache_ptr->slist_ring_len + * and cache_ptr->slist_ring_size arrays. + * *------------------------------------------------------------------------- */ @@ -1296,6 +1435,12 @@ if ( ( (cache_ptr)->index_size != \ HDassert( H5F_addr_defined((entry_ptr)->addr) ); \ HDassert( !((entry_ptr)->in_slist) ); \ HDassert( !ENTRY_IN_SLIST((cache_ptr), (entry_ptr)) ); \ + HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ + HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ + HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len ); \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size ); \ \ if(H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, &(entry_ptr)->addr) < 0) \ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), \ @@ -1305,6 +1450,8 @@ if ( ( (cache_ptr)->index_size != \ (cache_ptr)->slist_changed = TRUE; \ (cache_ptr)->slist_len++; \ (cache_ptr)->slist_size += (entry_ptr)->size; \ + ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])++; \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (entry_ptr)->size; \ (cache_ptr)->slist_len_increase++; \ (cache_ptr)->slist_size_increase += (int64_t)((entry_ptr)->size); \ \ @@ -1324,6 +1471,12 @@ if ( ( (cache_ptr)->index_size != \ HDassert( H5F_addr_defined((entry_ptr)->addr) ); \ HDassert( !((entry_ptr)->in_slist) ); \ HDassert( !ENTRY_IN_SLIST((cache_ptr), (entry_ptr)) ); \ + HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ + HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ + HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len ); \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size ); \ \ if(H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, &(entry_ptr)->addr) < 0) \ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), \ @@ -1333,6 +1486,8 @@ if ( ( (cache_ptr)->index_size != \ (cache_ptr)->slist_changed = TRUE; \ (cache_ptr)->slist_len++; \ (cache_ptr)->slist_size += (entry_ptr)->size; \ + ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])++; \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (entry_ptr)->size; \ \ HDassert( (cache_ptr)->slist_len > 0 ); \ HDassert( (cache_ptr)->slist_size > 0 ); \ @@ -1375,32 +1530,46 @@ if ( ( (cache_ptr)->index_size != \ * Added code to set cache_ptr->slist_changed to TRUE * when an entry is removed from the slist. * + * JRM -- 9/1/15 + * Added code to maintain the cache_ptr->slist_ring_len + * and cache_ptr->slist_ring_size arrays. + * *------------------------------------------------------------------------- */ -#define H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_protected) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->size > 0 ); \ - HDassert( (entry_ptr)->in_slist ); \ - HDassert( (cache_ptr)->slist_ptr ); \ - \ - if ( H5SL_remove((cache_ptr)->slist_ptr, &(entry_ptr)->addr) \ - != (entry_ptr) ) \ - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, \ - "Can't delete entry from skip list.") \ - \ - HDassert( (cache_ptr)->slist_len > 0 ); \ - (cache_ptr)->slist_changed = TRUE; \ - (cache_ptr)->slist_len--; \ - HDassert( (cache_ptr)->slist_size >= (entry_ptr)->size ); \ - (cache_ptr)->slist_size -= (entry_ptr)->size; \ - (entry_ptr)->in_slist = FALSE; \ +#define H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr) \ +{ \ + HDassert( (cache_ptr) ); \ + HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ + HDassert( (entry_ptr) ); \ + HDassert( !((entry_ptr)->is_protected) ); \ + HDassert( !((entry_ptr)->is_read_only) ); \ + HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ + HDassert( (entry_ptr)->size > 0 ); \ + HDassert( (entry_ptr)->in_slist ); \ + HDassert( (cache_ptr)->slist_ptr ); \ + HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ + HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ + HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len ); \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size ); \ + \ + if ( H5SL_remove((cache_ptr)->slist_ptr, &(entry_ptr)->addr) \ + != (entry_ptr) ) \ + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, \ + "Can't delete entry from skip list.") \ + \ + HDassert( (cache_ptr)->slist_len > 0 ); \ + (cache_ptr)->slist_changed = TRUE; \ + (cache_ptr)->slist_len--; \ + HDassert( (cache_ptr)->slist_size >= (entry_ptr)->size ); \ + (cache_ptr)->slist_size -= (entry_ptr)->size; \ + ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])--; \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >= \ + (entry_ptr)->size ); \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (entry_ptr)->size; \ + (entry_ptr)->in_slist = FALSE; \ } /* H5C__REMOVE_ENTRY_FROM_SLIST */ @@ -1432,52 +1601,76 @@ if ( ( (cache_ptr)->index_size != \ * in this case, as the structure of the slist is not * modified. * + * JRM -- 9/1/15 + * Added code to maintain the cache_ptr->slist_ring_len + * and cache_ptr->slist_ring_size arrays. + * *------------------------------------------------------------------------- */ #if H5C_DO_SANITY_CHECKS -#define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (old_size) > 0 ); \ - HDassert( (new_size) > 0 ); \ - HDassert( (old_size) <= (cache_ptr)->slist_size ); \ - HDassert( (cache_ptr)->slist_len > 0 ); \ - HDassert( ((cache_ptr)->slist_len > 1) || \ - ( (cache_ptr)->slist_size == (old_size) ) ); \ - \ - (cache_ptr)->slist_size -= (old_size); \ - (cache_ptr)->slist_size += (new_size); \ - \ - (cache_ptr)->slist_size_increase -= (int64_t)(old_size); \ - (cache_ptr)->slist_size_increase += (int64_t)(new_size); \ - \ - HDassert( (new_size) <= (cache_ptr)->slist_size ); \ - HDassert( ( (cache_ptr)->slist_len > 1 ) || \ - ( (cache_ptr)->slist_size == (new_size) ) ); \ +#define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \ +{ \ + HDassert( (cache_ptr) ); \ + HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ + HDassert( (old_size) > 0 ); \ + HDassert( (new_size) > 0 ); \ + HDassert( (old_size) <= (cache_ptr)->slist_size ); \ + HDassert( (cache_ptr)->slist_len > 0 ); \ + HDassert( ((cache_ptr)->slist_len > 1) || \ + ( (cache_ptr)->slist_size == (old_size) ) ); \ + HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ + HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ + HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len ); \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size ); \ + \ + (cache_ptr)->slist_size -= (old_size); \ + (cache_ptr)->slist_size += (new_size); \ + \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >=(old_size) ); \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (old_size); \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (new_size); \ + \ + (cache_ptr)->slist_size_increase -= (int64_t)(old_size); \ + (cache_ptr)->slist_size_increase += (int64_t)(new_size); \ + \ + HDassert( (new_size) <= (cache_ptr)->slist_size ); \ + HDassert( ( (cache_ptr)->slist_len > 1 ) || \ + ( (cache_ptr)->slist_size == (new_size) ) ); \ } /* H5C__UPDATE_SLIST_FOR_SIZE_CHANGE */ #else /* H5C_DO_SANITY_CHECKS */ -#define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (old_size) > 0 ); \ - HDassert( (new_size) > 0 ); \ - HDassert( (old_size) <= (cache_ptr)->slist_size ); \ - HDassert( (cache_ptr)->slist_len > 0 ); \ - HDassert( ((cache_ptr)->slist_len > 1) || \ - ( (cache_ptr)->slist_size == (old_size) ) ); \ - \ - (cache_ptr)->slist_size -= (old_size); \ - (cache_ptr)->slist_size += (new_size); \ - \ - HDassert( (new_size) <= (cache_ptr)->slist_size ); \ - HDassert( ( (cache_ptr)->slist_len > 1 ) || \ - ( (cache_ptr)->slist_size == (new_size) ) ); \ +#define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \ +{ \ + HDassert( (cache_ptr) ); \ + HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ + HDassert( (old_size) > 0 ); \ + HDassert( (new_size) > 0 ); \ + HDassert( (old_size) <= (cache_ptr)->slist_size ); \ + HDassert( (cache_ptr)->slist_len > 0 ); \ + HDassert( ((cache_ptr)->slist_len > 1) || \ + ( (cache_ptr)->slist_size == (old_size) ) ); \ + HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ + HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ + HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len ); \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size ); \ + \ + (cache_ptr)->slist_size -= (old_size); \ + (cache_ptr)->slist_size += (new_size); \ + \ + HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >=(old_size) ); \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (old_size); \ + ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (new_size); \ + \ + HDassert( (new_size) <= (cache_ptr)->slist_size ); \ + HDassert( ( (cache_ptr)->slist_len > 1 ) || \ + ( (cache_ptr)->slist_size == (new_size) ) ); \ } /* H5C__UPDATE_SLIST_FOR_SIZE_CHANGE */ #endif /* H5C_DO_SANITY_CHECKS */ @@ -3104,6 +3297,16 @@ if ( ( (entry_ptr) == NULL ) || \ * index_size by three should yield a conservative estimate * of the cache's memory footprint. * + * index_ring_len: Array of integer of length H5C_RING_NTYPES used to + * maintain a count of entries in the index by ring. Note + * that the sum of all the cells in this array must equal + * the value stored in index_len above. + * + * index_ring_size: Array of size_t of length H5C_RING_NTYPES used to + * maintain the sum of the sizes of all entries in the index + * by ring. Note that the sum of all cells in this array must + * equal the value stored in index_size above. + * * clean_index_size: Number of bytes of clean entries currently stored in * the hash table. Note that the index_size field (above) * is also the sum of the sizes of all entries in the cache. @@ -3118,12 +3321,22 @@ if ( ( (entry_ptr) == NULL ) || \ * clean_index_size plus the amount of empty space (if any) * in the cache. * + * clean_index_ring_size: Array of size_t of length H5C_RING_NTYPES used to + * maintain the sum of the sizes of all clean entries in the + * index by ring. Note that the sum of all cells in this array + * must equal the value stored in clean_index_size above. + * * dirty_index_size: Number of bytes of dirty entries currently stored in * the hash table. Note that the index_size field (above) * is also the sum of the sizes of all entries in the cache. * Thus we should have the invariant that clean_index_size + * dirty_index_size == index_size. * + * dirty_index_ring_size: Array of size_t of length H5C_RING_NTYPES used to + * maintain the sum of the sizes of all dirty entries in the + * index by ring. Note that the sum of all cells in this array + * must equal the value stored in dirty_index_size above. + * * index: Array of pointer to H5C_cache_entry_t of size * H5C__HASH_TABLE_LEN. At present, this value is a power * of two, not the usual prime number. @@ -3212,6 +3425,16 @@ if ( ( (entry_ptr) == NULL ) || \ * skip list used to maintain a sorted list of * dirty entries in the cache. * + * slist_ring_len: Array of integer of length H5C_RING_NTYPES used to + * maintain a count of entries in the slist by ring. Note + * that the sum of all the cells in this array must equal + * the value stored in slist_len above. + * + * slist_ring_size: Array of size_t of length H5C_RING_NTYPES used to + * maintain the sum of the sizes of all entries in the + * slist by ring. Note that the sum of all cells in this + * array must equal the value stored in slist_size above. + * * slist_ptr: pointer to the instance of H5SL_t used maintain a sorted * list of dirty entries in the cache. This sorted list has * two uses: @@ -3852,8 +4075,12 @@ struct H5C_t { /* Fields for maintaining [hash table] index of entries */ int32_t index_len; size_t index_size; + int32_t index_ring_len[H5C_RING_NTYPES]; + size_t index_ring_size[H5C_RING_NTYPES]; size_t clean_index_size; + size_t clean_index_ring_size[H5C_RING_NTYPES]; size_t dirty_index_size; + size_t dirty_index_ring_size[H5C_RING_NTYPES]; H5C_cache_entry_t * (index[H5C__HASH_TABLE_LEN]); /* Fields to detect entries removed during scans */ @@ -3869,6 +4096,8 @@ struct H5C_t { hbool_t slist_change_in_serialize; int32_t slist_len; size_t slist_size; + int32_t slist_ring_len[H5C_RING_NTYPES]; + size_t slist_ring_size[H5C_RING_NTYPES]; H5SL_t * slist_ptr; int32_t num_last_entries; #if H5C_DO_SANITY_CHECKS diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 2ad2c6a..a6ff106 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -1115,6 +1115,60 @@ typedef herr_t (*H5C_log_flush_func_t)(H5C_t *cache_ptr, haddr_t addr, /**************************************************************************** * + * H5C_ring_t & associated #defines + * + * The metadata cache uses the concept of rings to order the flushes of + * classes of entries. In this arrangement, each entry in the cache is + * assigned to a ring, and on flush, the members of the outermost ring + * are flushed first, followed by the next outermost, and so on with the + * members of the innermost ring being flushed last. + * + * Note that flush dependencies are used to order flushes within rings. + * + * Note also that at the conceptual level, rings are argueably superfluous, + * as a similar effect could be obtained via the flush dependency mechanism. + * However, this would require all entries in the cache to participate in a + * flush dependency -- with the implied setup and takedown overhead and + * added complexity. Further, the flush ordering between rings need only + * be enforced on flush operations, and thus the use of flush dependencies + * instead would apply unecessary constraints on flushes under normal + * operating circumstances. + * + * As of this writing, all metadata entries pretaining to data sets and + * groups must be flushed first, and are thus assigned to the outermost + * ring. + * + * Free space managers managing file space must be flushed next, + * and are assigned to the second outermost ring. + * + * The object header and associated chunks used to implement superblock + * extension messages must be flushed next, and are thus assigned to + * the third outermost ring. + * + * The superblock proper must be flushed last, and is thus assigned to + * the innermost ring. + * + * The H5C_ring_t and the associated #defines below are used to define + * the rings. Each entry must be assigned to the appropriate ring on + * insertion or protect. + * + * Note that H5C_ring_t was originally an enumerated type. It was + * converted to an integer and a set of #defines for convenience in + * debugging. + */ + +#define H5C_RING_UNDEFINED 0 /* shouldn't appear in the cache */ +#define H5C_RING_USER 1 /* outermost ring */ +#define H5C_RING_FSM 2 +#define H5C_RING_SBE 4 /* temporarily merged with H5C_RING_SB */ +#define H5C_RING_SB 4 /* innermost ring */ +#define H5C_RING_NTYPES 5 + +typedef int H5C_ring_t; + + +/**************************************************************************** + * * structure H5C_cache_entry_t * * Instances of the H5C_cache_entry_t structure are used to store cache @@ -1376,6 +1430,25 @@ typedef herr_t (*H5C_log_flush_func_t)(H5C_t *cache_ptr, haddr_t addr, * is in the process of being flushed and destroyed. * * + * Fields supporting rings for flush ordering: + * + * All entries in the metadata cache are assigned to a ring. On cache + * flush, all entries in the outermost ring are flushed first, followed + * by all members of the next outermost ring, and so on until the + * innermost ring is flushed. Note that this ordering is ONLY applied + * in flush and serialize calls. Rings are ignored during normal operations + * in which entries are flushed as directed by the replacement policy. + * + * See the header comment on H5C_ring_t above for further details. + * + * Note that flush dependencies (see below) are used to order flushes + * within rings. Unlike rings, flush dependencies are applied to ALL + * writes, not just those triggered by flush or serialize calls. + * + * ring: Instance of H5C_ring_t indicating the ring to which this + * entry is assigned. + * + * * Fields supporting the 'flush dependency' feature: * * Entries in the cache may have a 'flush dependency' on another entry in the @@ -1545,6 +1618,9 @@ typedef struct H5C_cache_entry_t { hbool_t flush_in_progress; hbool_t destroy_in_progress; + /* fields supporting rings for purposes of flush ordering */ + H5C_ring_t ring; + /* fields supporting the 'flush dependency' feature: */ struct H5C_cache_entry_t * flush_dep_parent; uint64_t child_flush_dep_height_rc[H5C__NUM_FLUSH_DEP_HEIGHTS]; @@ -1921,6 +1997,7 @@ H5_DLL herr_t H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests); H5_DLL herr_t H5C_ignore_tags(H5C_t *cache_ptr); H5_DLL void H5C_retag_copied_metadata(H5C_t *cache_ptr, haddr_t metadata_tag); +H5_DLL herr_t H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring); #ifdef H5_HAVE_PARALLEL H5_DLL herr_t H5C_apply_candidate_list(H5F_t *f, hid_t dxpl_id, @@ -17,10 +17,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5D__init_pub_interface +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -52,6 +49,9 @@ /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Declare extern the free list to manage blocks of VL data */ H5FL_BLK_EXTERN(vlen_vl_buf); @@ -73,51 +73,6 @@ H5FL_BLK_EXTERN(type_conv); -/*-------------------------------------------------------------------------- -NAME - H5D__init_pub_interface -- Initialize interface-specific information -USAGE - herr_t H5D__init_pub_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5D_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5D__init_pub_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5D_init()) -} /* H5D__init_pub_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5D__term_pub_interface -- Terminate interface -USAGE - herr_t H5D__term_pub_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5D__term_pub_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5D__term_pub_interface() */ - - /*------------------------------------------------------------------------- * Function: H5Dcreate2 * @@ -319,14 +274,9 @@ hid_t H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) { H5D_t *dset = NULL; - H5G_loc_t loc; /* Object location of group */ - H5G_loc_t dset_loc; /* Object location of dataset */ - H5G_name_t path; /* Dataset group hier. path */ - H5O_loc_t oloc; /* Dataset object location */ - H5O_type_t obj_type; /* Type of object at location */ - hbool_t loc_found = FALSE; /* Location at 'name' found */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datset */ - hid_t ret_value; + H5G_loc_t loc; /* Object location of group */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datset */ + hid_t ret_value; FUNC_ENTER_API(FAIL) H5TRACE3("i", "i*si", loc_id, name, dapl_id); @@ -341,41 +291,18 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) if(H5P_verify_and_set_dxpl(&dapl_id, H5P_DATASET_ACCESS, H5P_DATASET_ACCESS_DEFAULT, &dxpl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - /* Set up dataset location to fill in */ - dset_loc.oloc = &oloc; - dset_loc.path = &path; - H5G_loc_reset(&dset_loc); - - /* Find the dataset object */ - if(H5G_loc_find(&loc, name, &dset_loc, dapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found") - loc_found = TRUE; - - /* Check that the object found is the correct type */ - if(H5O_obj_type(&oloc, &obj_type, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object type") - if(obj_type != H5O_TYPE_DATASET) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") - /* Open the dataset */ - if(NULL == (dset = H5D_open(&dset_loc, dapl_id, dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open dataset") + if(NULL == (dset = H5D__open_name(&loc, name, dapl_id, dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") /* Register an atom for the dataset */ if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "can't register dataset atom") done: - if(ret_value < 0) { - if(dset) { - if(H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") - } /* end if */ - else { - if(loc_found && H5G_loc_free(&dset_loc) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't free location") - } /* end else */ - } /* end if */ + if(ret_value < 0) + if(dset && H5D_close(dset) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dopen2() */ diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index a4009a9..762c252 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -26,7 +26,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -331,7 +331,7 @@ H5D__btree_cmp2(void *_lt_key, void *_udata, void *_rt_key) H5D_btree_key_t *lt_key = (H5D_btree_key_t *) _lt_key; H5D_btree_key_t *rt_key = (H5D_btree_key_t *) _rt_key; H5D_chunk_common_ud_t *udata = (H5D_chunk_common_ud_t *) _udata; - int ret_value; + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -553,7 +553,7 @@ H5D__btree_insert(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, void *_l H5D_chunk_ud_t *udata = (H5D_chunk_ud_t *) _udata; int cmp; unsigned u; - H5B_ins_t ret_value; + H5B_ins_t ret_value = H5B_INS_ERROR; /* Return value */ FUNC_ENTER_STATIC @@ -969,7 +969,7 @@ done: static hbool_t H5D__btree_idx_is_space_alloc(const H5O_storage_chunk_t *storage) { - hbool_t ret_value; /* Return value */ + hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -1085,7 +1085,7 @@ H5D__btree_idx_iterate_cb(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5D_btree_it_ud_t *udata = (H5D_btree_it_ud_t *)_udata; /* User data */ const H5D_btree_key_t *lt_key = (const H5D_btree_key_t *)_lt_key; /* B-tree key for chunk */ H5D_chunk_rec_t chunk_rec; /* Generic chunk record for callback */ - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -1127,7 +1127,7 @@ H5D__btree_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb, void *chunk_udata) { H5D_btree_it_ud_t udata; /* User data for B-tree iterator callback */ - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC_NOERR diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index ca7bda5..a0cd399 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -44,9 +44,8 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ - +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ /***********/ /* Headers */ @@ -194,6 +193,8 @@ typedef struct H5D_chunk_coll_info_t { /* Chunked layout operation callbacks */ static herr_t H5D__chunk_construct(H5F_t *f, H5D_t *dset); +static herr_t H5D__chunk_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, + hid_t dapl_id); static herr_t H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm); @@ -205,6 +206,7 @@ static herr_t H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *ty H5D_chunk_map_t *fm); static herr_t H5D__chunk_flush(H5D_t *dset, hid_t dxpl_id); static herr_t H5D__chunk_io_term(const H5D_chunk_map_t *fm); +static herr_t H5D__chunk_dest(H5D_t *dset, hid_t dxpl_id); /* "Nonexistent" layout operation callback */ static ssize_t @@ -268,7 +270,8 @@ const H5D_layout_ops_t H5D_LOPS_CHUNK[1] = {{ NULL, NULL, H5D__chunk_flush, - H5D__chunk_io_term + H5D__chunk_io_term, + H5D__chunk_dest }}; @@ -291,6 +294,7 @@ const H5D_layout_ops_t H5D_LOPS_NONEXISTENT[1] = {{ H5D__nonexistent_readvv, NULL, NULL, + NULL, NULL }}; @@ -587,7 +591,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5D__chunk_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, hid_t dapl_id) { H5D_chk_idx_info_t idx_info; /* Chunked index info */ @@ -595,7 +599,7 @@ H5D__chunk_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, hid_t dapl_id) H5P_genplist_t *dapl; /* Data access property list object pointer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -683,7 +687,7 @@ done: hbool_t H5D__chunk_is_space_alloc(const H5O_storage_t *storage) { - hbool_t ret_value; /* Return value */ + hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_PACKAGE_NOERR @@ -2120,10 +2124,6 @@ H5D__chunk_flush(H5D_t *dset, hid_t dxpl_id) /* Sanity check */ HDassert(dset); - /* Flush any data caught in sieve buffer */ - if(H5D__flush_sieve_buf(dset, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush sieve buffer") - /* Fill the DXPL cache values for later use */ if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") @@ -2194,6 +2194,72 @@ done: /*------------------------------------------------------------------------- + * Function: H5D__chunk_dest + * + * Purpose: Destroy the entire chunk cache by flushing dirty entries, + * preempting all entries, and freeing the cache itself. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Thursday, May 21, 1998 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__chunk_dest(H5D_t *dset, hid_t dxpl_id) +{ + H5D_chk_idx_info_t idx_info; /* Chunked index info */ + H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ + H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ + H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Dataset's chunk cache */ + H5D_rdcc_ent_t *ent = NULL, *next = NULL; /* Pointer to current & next cache entries */ + int nerrors = 0; /* Accumulated count of errors */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC_TAG(dxpl_id, dset->oloc.addr, FAIL) + + /* Sanity check */ + HDassert(dset); + + /* Fill the DXPL cache values for later use */ + if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) + nerrors++; + + /* Flush all the cached chunks */ + for(ent = rdcc->head; ent; ent = next) { + next = ent->next; + if(H5D__chunk_cache_evict(dset, dxpl_id, dxpl_cache, ent, TRUE) < 0) + nerrors++; + } /* end for */ + + /* Continue even if there are failures. */ + if(nerrors) + HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") + + /* Release cache structures */ + if(rdcc->slot) + rdcc->slot = H5FL_SEQ_FREE(H5D_rdcc_ent_ptr_t, rdcc->slot); + HDmemset(rdcc, 0, sizeof(H5D_rdcc_t)); + + /* Compose chunked index info struct */ + idx_info.f = dset->oloc.file; + idx_info.dxpl_id = dxpl_id; + idx_info.pline = &dset->shared->dcpl_cache.pline; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; + + /* Free any index structures */ + if(dset->shared->layout.storage.u.chunk.ops->dest && + (dset->shared->layout.storage.u.chunk.ops->dest)(&idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") + +done: + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) +} /* end H5D__chunk_dest() */ + + +/*------------------------------------------------------------------------- * Function: H5D_chunk_idx_reset * * Purpose: Reset index information @@ -2405,7 +2471,7 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled) { hsize_t val; /* Intermediate value */ unsigned ndims = shared->ndims; /* Rank of dataset */ - unsigned ret; /* Value to return */ + unsigned ret = 0; /* Value to return */ FUNC_ENTER_STATIC_NOERR @@ -2918,7 +2984,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, H5D_rdcc_ent_t *ent; /*cache entry */ size_t chunk_size; /*size of a chunk */ void *chunk = NULL; /*the file chunk */ - void *ret_value; /*return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -5182,72 +5248,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_dump_index() */ - -/*------------------------------------------------------------------------- - * Function: H5D__chunk_dest - * - * Purpose: Destroy the entire chunk cache by flushing dirty entries, - * preempting all entries, and freeing the cache itself. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Thursday, May 21, 1998 - * - *------------------------------------------------------------------------- - */ -herr_t -H5D__chunk_dest(H5F_t *f, hid_t dxpl_id, H5D_t *dset) -{ - H5D_chk_idx_info_t idx_info; /* Chunked index info */ - H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ - H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ - H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Dataset's chunk cache */ - H5D_rdcc_ent_t *ent = NULL, *next = NULL; /* Pointer to current & next cache entries */ - int nerrors = 0; /* Accumulated count of errors */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_TAG(dxpl_id, dset->oloc.addr, FAIL) - - HDassert(f); - HDassert(dset); - - /* Fill the DXPL cache values for later use */ - if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") - - /* Flush all the cached chunks */ - for(ent = rdcc->head; ent; ent = next) { - next = ent->next; - if(H5D__chunk_cache_evict(dset, dxpl_id, dxpl_cache, ent, TRUE) < 0) - nerrors++; - } /* end for */ - - /* Continue even if there are failures. */ - if(nerrors) - HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") - - /* Release cache structures */ - if(rdcc->slot) - rdcc->slot = H5FL_SEQ_FREE(H5D_rdcc_ent_ptr_t, rdcc->slot); - HDmemset(rdcc, 0, sizeof(H5D_rdcc_t)); - - /* Compose chunked index info struct */ - idx_info.f = f; - idx_info.dxpl_id = dxpl_id; - idx_info.pline = &dset->shared->dcpl_cache.pline; - idx_info.layout = &dset->shared->layout.u.chunk; - idx_info.storage = &dset->shared->layout.storage.u.chunk; - - /* Free any index structures */ - if(dset->shared->layout.storage.u.chunk.ops->dest && - (dset->shared->layout.storage.u.chunk.ops->dest)(&idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") - -done: - FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) -} /* end H5D__chunk_dest() */ - #ifdef H5D_CHUNK_DEBUG /*------------------------------------------------------------------------- @@ -5388,7 +5388,7 @@ H5D__nonexistent_readvv(const H5D_io_info_t *io_info, size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { H5D_chunk_readvv_ud_t udata; /* User data for H5VM_opvv() operator */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index acb4541..ebe75bd 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -25,7 +25,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -70,6 +70,7 @@ static ssize_t H5D__compact_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]); static herr_t H5D__compact_flush(H5D_t *dset, hid_t dxpl_id); +static herr_t H5D__compact_dest(H5D_t *dset, hid_t dxpl_id); /*********************/ @@ -91,7 +92,8 @@ const H5D_layout_ops_t H5D_LOPS_COMPACT[1] = {{ H5D__compact_readvv, H5D__compact_writevv, H5D__compact_flush, - NULL + NULL, + H5D__compact_dest }}; @@ -285,7 +287,7 @@ H5D__compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]) { - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -326,7 +328,7 @@ H5D__compact_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]) { - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -379,6 +381,33 @@ done: /*------------------------------------------------------------------------- + * Function: H5D__compact_dest + * + * Purpose: Free the compact buffer + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, Sept 3, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__compact_dest(H5D_t *dset, hid_t H5_ATTR_UNUSED dxpl_id) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(dset); + + /* Free the buffer for the raw data for compact datasets */ + dset->shared->layout.storage.u.compact.buf = H5MM_xfree(dset->shared->layout.storage.u.compact.buf); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__compact_dest() */ + + +/*------------------------------------------------------------------------- * Function: H5D__compact_copy * * Purpose: Copy compact storage raw data from SRC file to DST file. diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 29ab1ff..988bb61 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -27,7 +27,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -96,6 +96,8 @@ typedef struct H5D_contig_writevv_ud_t { /* Layout operation callbacks */ static herr_t H5D__contig_construct(H5F_t *f, H5D_t *dset); +static herr_t H5D__contig_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, + hid_t dapl_id); static herr_t H5D__contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *cm); @@ -119,7 +121,7 @@ static herr_t H5D__contig_write_one(H5D_io_info_t *io_info, hsize_t offset, /* Contiguous storage layout I/O ops */ const H5D_layout_ops_t H5D_LOPS_CONTIG[1] = {{ H5D__contig_construct, - NULL, + H5D__contig_init, H5D__contig_is_space_alloc, H5D__contig_io_init, H5D__contig_read, @@ -131,6 +133,7 @@ const H5D_layout_ops_t H5D_LOPS_CONTIG[1] = {{ H5D__contig_readvv, H5D__contig_writevv, H5D__contig_flush, + NULL, NULL }}; @@ -451,6 +454,79 @@ done: /*------------------------------------------------------------------------- + * Function: H5D__contig_init + * + * Purpose: Initialize the contiguous info for a dataset. This is + * called when the dataset is initialized. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Friday, August 28, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__contig_init(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, + const H5D_t *dset, hid_t H5_ATTR_UNUSED dapl_id) +{ + hsize_t tmp_size; /* Temporary holder for raw data size */ + size_t tmp_sieve_buf_size; /* Temporary holder for sieve buffer size */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(f); + HDassert(dset); + + /* Compute the size of the contiguous storage for versions of the + * layout message less than version 3 because versions 1 & 2 would + * truncate the dimension sizes to 32-bits of information. - QAK 5/26/04 + */ + if(dset->shared->layout.version < 3) { + hssize_t snelmts; /* Temporary holder for number of elements in dataspace */ + hsize_t nelmts; /* Number of elements in dataspace */ + size_t dt_size; /* Size of datatype */ + + /* Retrieve the number of elements in the dataspace */ + if((snelmts = H5S_GET_EXTENT_NPOINTS(dset->shared->space)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve number of elements in dataspace") + nelmts = (hsize_t)snelmts; + + /* Get the datatype's size */ + if(0 == (dt_size = H5T_GET_SIZE(dset->shared->type))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve size of datatype") + + /* Compute the size of the dataset's contiguous storage */ + tmp_size = nelmts * dt_size; + + /* Check for overflow during multiplication */ + if(nelmts != (tmp_size / dt_size)) + HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed") + + /* Assign the dataset's contiguous storage size */ + dset->shared->layout.storage.u.contig.size = tmp_size; + } /* end if */ + else + tmp_size = dset->shared->layout.storage.u.contig.size; + + /* Get the sieve buffer size for the file */ + tmp_sieve_buf_size = H5F_SIEVE_BUF_SIZE(dset->oloc.file); + + /* Adjust the sieve buffer size to the smaller one between the dataset size and the buffer size + * from the file access property. (SLU - 2012/3/30) */ + if(tmp_size < tmp_sieve_buf_size) + dset->shared->cache.contig.sieve_buf_size = tmp_size; + else + dset->shared->cache.contig.sieve_buf_size = tmp_sieve_buf_size; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__contig_init() */ + + +/*------------------------------------------------------------------------- * Function: H5D__contig_is_space_alloc * * Purpose: Query if space is allocated for layout @@ -465,7 +541,7 @@ done: hbool_t H5D__contig_is_space_alloc(const H5O_storage_t *storage) { - hbool_t ret_value; /* Return value */ + hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_PACKAGE_NOERR @@ -843,7 +919,7 @@ H5D__contig_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -1170,7 +1246,7 @@ H5D__contig_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { - ssize_t ret_value; /* Return value (Size of sequence in bytes) */ + ssize_t ret_value = -1; /* Return value (Size of sequence in bytes) */ FUNC_ENTER_STATIC diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c index 4e934f2..34e0ae9 100644 --- a/src/H5Ddbg.c +++ b/src/H5Ddbg.c @@ -17,10 +17,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5D__init_dbg_interface +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -61,26 +58,6 @@ /* Local Variables */ /*******************/ - -/*-------------------------------------------------------------------------- -NAME - H5D__init_dbg_interface -- Initialize interface-specific information -USAGE - herr_t H5D__init_dbg_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5D_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5D__init_dbg_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5D_init()) -} /* H5D__init_dbg_interface() */ /*------------------------------------------------------------------------- diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index dd02907..f5e3996 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -31,10 +31,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5D__init_deprec_interface +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -85,51 +82,6 @@ static herr_t H5D__extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id); /*******************/ - -/*-------------------------------------------------------------------------- -NAME - H5D__init_deprec_interface -- Initialize interface-specific information -USAGE - herr_t H5D__init_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5D_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5D__init_deprec_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5D_init()) -} /* H5D__init_deprec_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5D__term_deprec_interface -- Terminate interface -USAGE - herr_t H5D__term_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5D__term_deprec_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5D__term_deprec_interface() */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- @@ -227,15 +179,10 @@ hid_t H5Dopen1(hid_t loc_id, const char *name) { H5D_t *dset = NULL; - H5G_loc_t loc; /* Object location of group */ - H5G_loc_t dset_loc; /* Object location of dataset */ - H5G_name_t path; /* Dataset group hier. path */ - H5O_loc_t oloc; /* Dataset object location */ - H5O_type_t obj_type; /* Type of object at location */ - hbool_t loc_found = FALSE; /* Location at 'name' found */ - hid_t dapl_id = H5P_DATASET_ACCESS_DEFAULT; /* dapl to use to open dataset */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datset */ - hid_t ret_value; + H5G_loc_t loc; /* Object location of group */ + hid_t dapl_id = H5P_DATASET_ACCESS_DEFAULT; /* dapl to use to open dataset */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datset */ + hid_t ret_value; FUNC_ENTER_API(FAIL) H5TRACE2("i", "i*s", loc_id, name); @@ -246,41 +193,18 @@ H5Dopen1(hid_t loc_id, const char *name) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - /* Set up dataset location to fill in */ - dset_loc.oloc = &oloc; - dset_loc.path = &path; - H5G_loc_reset(&dset_loc); - - /* Find the dataset object */ - if(H5G_loc_find(&loc, name, &dset_loc, H5P_DEFAULT, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found") - loc_found = TRUE; - - /* Check that the object found is the correct type */ - if(H5O_obj_type(&oloc, &obj_type, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object type") - if(obj_type != H5O_TYPE_DATASET) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") - /* Open the dataset */ - if(NULL == (dset = H5D_open(&dset_loc, dapl_id, dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open dataset") + if(NULL == (dset = H5D__open_name(&loc, name, dapl_id, dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") /* Register an atom for the dataset */ if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "can't register dataset atom") done: - if(ret_value < 0) { - if(dset != NULL) { - if(H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") - } /* end if */ - else { - if(loc_found && H5G_loc_free(&dset_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") - } /* end else */ - } /* end if */ + if(ret_value < 0) + if(dset && H5D_close(dset) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dopen1() */ diff --git a/src/H5Defl.c b/src/H5Defl.c index 9e5872a..ec96ae7 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -22,7 +22,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -100,6 +100,7 @@ const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{ H5D__efl_readvv, H5D__efl_writevv, NULL, + NULL, NULL }}; @@ -455,7 +456,7 @@ H5D__efl_readvv(const H5D_io_info_t *io_info, size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { H5D_efl_readvv_ud_t udata; /* User data for H5VM_opvv() operator */ - ssize_t ret_value; /* Return value (Total size of sequence in bytes) */ + ssize_t ret_value = -1; /* Return value (Total size of sequence in bytes) */ FUNC_ENTER_STATIC @@ -535,7 +536,7 @@ H5D__efl_writevv(const H5D_io_info_t *io_info, size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { H5D_efl_writevv_ud_t udata; /* User data for H5VM_opvv() operator */ - ssize_t ret_value; /* Return value (Total size of sequence in bytes) */ + ssize_t ret_value = -1; /* Return value (Total size of sequence in bytes) */ FUNC_ENTER_STATIC diff --git a/src/H5Dfill.c b/src/H5Dfill.c index 484c362..947a177 100644 --- a/src/H5Dfill.c +++ b/src/H5Dfill.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ + /***********/ /* Headers */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 53cd86a..86d241b 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -17,10 +17,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5D__init_interface +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -118,6 +115,9 @@ static const H5I_class_t H5I_DATASET_CLS[1] = {{ (H5I_free_t)H5D_close /* Callback routine for closing objects of this class */ }}; +/* Flag indicating "top" of interface has been initialized */ +static hbool_t H5D_top_package_initialize_s = FALSE; + /*------------------------------------------------------------------------- @@ -149,9 +149,9 @@ done: /*-------------------------------------------------------------------------- NAME - H5D__init_interface -- Initialize interface-specific information + H5D__init_package -- Initialize interface-specific information USAGE - herr_t H5D__init_interface() + herr_t H5D__init_package() RETURNS Non-negative on success/Negative on failure @@ -162,13 +162,13 @@ NOTES a deadlock in the library when the library is attempting to terminate -QAK --------------------------------------------------------------------------*/ -static herr_t -H5D__init_interface(void) +herr_t +H5D__init_package(void) { - H5P_genplist_t *def_dcpl; /* Default Dataset Creation Property list */ - herr_t ret_value = SUCCEED; /* Return value */ + H5P_genplist_t *def_dcpl; /* Default Dataset Creation Property list */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_PACKAGE /* Initialize the atom group for the dataset IDs */ if(H5I_register_type(H5I_DATASET_CLS) < 0) @@ -202,34 +202,36 @@ H5D__init_interface(void) if(H5D__get_dxpl_cache_real(H5P_DATASET_XFER_DEFAULT, &H5D_def_dxpl_cache) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve default DXPL info") + /* Mark "top" of interface as initialized, too */ + H5D_top_package_initialize_s = TRUE; + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__init_interface() */ +} /* end H5D__init_package() */ /*------------------------------------------------------------------------- - * Function: H5D_term_interface + * Function: H5D_top_term_package * - * Purpose: Terminate this interface. + * Purpose: Close the "top" of the interface, releasing IDs, etc. * * Return: Success: Positive if anything was done that might * affect other interfaces; zero otherwise. - * * Failure: Negative. * - * Programmer: Robb Matzke - * Friday, November 20, 1998 + * Programmer: Quincey Koziol + * Sunday, September 13, 2015 * *------------------------------------------------------------------------- */ int -H5D_term_interface(void) +H5D_top_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5D_top_package_initialize_s) { if(H5I_nmembers(H5I_DATASET) > 0) { /* The dataset API uses the "force" flag set to true because it * is using the "file objects" (H5FO) API functions to track open @@ -256,24 +258,55 @@ H5D_term_interface(void) (void)H5I_clear_type(H5I_DATASET, TRUE, FALSE); n++; /*H5I*/ } /* end if */ - else { - /* Close public interface */ - n += H5D__term_pub_interface(); - /* Close deprecated interface */ - n += H5D__term_deprec_interface(); + /* Mark closed */ + if(0 == n) + H5D_top_package_initialize_s = FALSE; + } /* end if */ - /* Destroy the dataset object id group */ - (void)H5I_dec_type_ref(H5I_DATASET); - n++; /*H5I*/ + FUNC_LEAVE_NOAPI(n) +} /* end H5D_top_term_package() */ - /* Mark closed */ - H5_interface_initialize_g = 0; - } /* end else */ + +/*------------------------------------------------------------------------- + * Function: H5D_term_package + * + * Purpose: Terminate this interface. + * + * Note: Finishes shutting down the interface, after + * H5D_top_term_package() is called + * + * Return: Success: Positive if anything was done that might + * affect other interfaces; zero otherwise. + * Failure: Negative. + * + * Programmer: Robb Matzke + * Friday, November 20, 1998 + * + *------------------------------------------------------------------------- + */ +int +H5D_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + /* Sanity checks */ + HDassert(0 == H5I_nmembers(H5I_DATASET)); + HDassert(FALSE == H5D_top_package_initialize_s); + + /* Destroy the dataset object id group */ + n += (H5I_dec_type_ref(H5I_DATASET) > 0); + + /* Mark closed */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5D_term_interface() */ +} /* end H5D_term_package() */ /*-------------------------------------------------------------------------- @@ -350,8 +383,11 @@ H5D__get_dxpl_cache_real(hid_t dxpl_id, H5D_dxpl_cache_t *cache) if(H5P_get(dx_plist, H5D_XFER_FILTER_CB_NAME, &cache->filter_cb) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve filter callback function") - /* Get the data transform property */ - if(H5P_get(dx_plist, H5D_XFER_XFORM_NAME, &cache->data_xform_prop) < 0) + /* Look at the data transform property */ + /* (Note: 'peek', not 'get' - if this turns out to be a problem, we should + * add a H5D__free_dxpl_cache() routine. -QAK) + */ + if(H5P_peek(dx_plist, H5D_XFER_XFORM_NAME, &cache->data_xform_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve data transform info") done: @@ -424,7 +460,7 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, { H5O_obj_create_t ocrt_info; /* Information for object creation */ H5D_obj_create_t dcrt_info; /* Information for dataset creation */ - H5D_t *ret_value; /* Return value */ + H5D_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -549,7 +585,7 @@ H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type) { H5D_shared_t *new_dset = NULL; /* New dataset object */ H5P_genplist_t *plist; /* Property list created */ - H5D_shared_t *ret_value; /* Return value */ + H5D_shared_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -931,12 +967,11 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header") /* Error cleanup */ - if(ret_value < 0) { - if(dset->shared->layout.type == H5D_CHUNKED && layout_init) { - if(H5D__chunk_dest(file, dxpl_id, dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy chunk cache") - } /* end if */ - } /* end if */ + if(ret_value < 0) + if(layout_init) + /* Destroy the layout information for the dataset */ + if(dset->shared->layout.ops->dest && (dset->shared->layout.ops->dest)(dset, dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__update_oh_info() */ @@ -971,8 +1006,12 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, H5P_genplist_t *dc_plist = NULL; /* New Property list */ hbool_t has_vl_type = FALSE; /* Flag to indicate a VL-type for dataset */ hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */ + hbool_t layout_copied = FALSE; /* Flag to indicate that layout message was copied */ + hbool_t fill_copied = FALSE; /* Flag to indicate that fill-value message was copied */ + hbool_t pline_copied = FALSE; /* Flag to indicate that pipeline message was copied */ + hbool_t efl_copied = FALSE; /* Flag to indicate that external file list message was copied */ H5G_loc_t dset_loc; /* Dataset location */ - H5D_t *ret_value; /* Return value */ + H5D_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -1028,6 +1067,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, H5O_layout_t *layout; /* Dataset's layout information */ H5O_pline_t *pline; /* Dataset's I/O pipeline information */ H5O_fill_t *fill; /* Dataset's fill value info */ + H5O_efl_t *efl; /* Dataset's external file list info */ /* Check if the filters in the DCPL can be applied to this dataset */ if(H5Z_can_apply(new_dset->shared->dcpl_id, new_dset->shared->type_id) < 0) @@ -1044,15 +1084,24 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* Retrieve the properties we need */ pline = &new_dset->shared->dcpl_cache.pline; if(H5P_get(dc_plist, H5O_CRT_PIPELINE_NAME, pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve pipeline filter") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve pipeline filter") + pline_copied = TRUE; layout = &new_dset->shared->layout; if(H5P_get(dc_plist, H5D_CRT_LAYOUT_NAME, layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve layout") - if(pline->nused > 0 && H5D_CHUNKED != layout->type) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "filters can only be used with chunked layout") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve layout") + layout_copied = TRUE; fill = &new_dset->shared->dcpl_cache.fill; if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve fill value info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve fill value info") + fill_copied = TRUE; + efl = &new_dset->shared->dcpl_cache.efl; + if(H5P_get(dc_plist, H5D_CRT_EXT_FILE_LIST_NAME, efl) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve external file list") + efl_copied = TRUE; + + /* Check that chunked layout is used if filters are enabled */ + if(pline->nused > 0 && H5D_CHUNKED != layout->type) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "filters can only be used with chunked layout") /* Check if the alloc_time is the default and error out */ if(fill->alloc_time == H5D_ALLOC_TIME_DEFAULT) @@ -1065,10 +1114,6 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* If MPI VFD is used, no filter support yet. */ if(H5F_HAS_FEATURE(file, H5FD_FEAT_HAS_MPI) && pline->nused > 0) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "Parallel I/O does not support filters yet") - - /* Get the dataset's external file list information */ - if(H5P_get(dc_plist, H5D_CRT_EXT_FILE_LIST_NAME, &new_dset->shared->dcpl_cache.efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't retrieve external file list") } /* end if */ /* Set the latest version of the layout, pline & fill messages, if requested */ @@ -1091,7 +1136,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize I/O operations") /* Create the layout information for the new dataset */ - if((new_dset->shared->layout.ops->construct)(file, new_dset) < 0) + if(new_dset->shared->layout.ops->construct && (new_dset->shared->layout.ops->construct)(file, new_dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to construct layout information") /* Update the dataset's object header info. */ @@ -1114,10 +1159,21 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, done: if(!ret_value && new_dset && new_dset->shared) { if(new_dset->shared) { - if(new_dset->shared->layout.type == H5D_CHUNKED && layout_init) { - if(H5D__chunk_dest(file, dxpl_id, new_dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "unable to destroy chunk cache") - } /* end if */ + if(layout_init) + if(new_dset->shared->layout.ops->dest && (new_dset->shared->layout.ops->dest)(new_dset, dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "unable to destroy layout info") + if(pline_copied) + if(H5O_msg_reset(H5O_PLINE_ID, &new_dset->shared->dcpl_cache.pline) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset I/O pipeline info") + if(layout_copied) + if(H5O_msg_reset(H5O_LAYOUT_ID, &new_dset->shared->layout) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset layout info") + if(fill_copied) + if(H5O_msg_reset(H5O_FILL_ID, &new_dset->shared->dcpl_cache.fill) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset fill-value info") + if(efl_copied) + if(H5O_msg_reset(H5O_EFL_ID, &new_dset->shared->dcpl_cache.efl) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset external file list info") if(new_dset->shared->space && H5S_close(new_dset->shared->space) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataspace") if(new_dset->shared->type && H5I_dec_ref(new_dset->shared->type_id) < 0) @@ -1144,6 +1200,69 @@ done: } /* end H5D__create() */ +/*------------------------------------------------------------------------- + * Function: H5D__open_name + * + * Purpose: Opens an existing dataset by name. + * + * Return: Success: Ptr to a new dataset. + * Failure: NULL + * + * Programmer: Neil Fortner + * Friday, March 6, 2015 + * + *------------------------------------------------------------------------- + */ +H5D_t * +H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id, + hid_t dxpl_id) +{ + H5D_t *dset = NULL; + H5G_loc_t dset_loc; /* Object location of dataset */ + H5G_name_t path; /* Dataset group hier. path */ + H5O_loc_t oloc; /* Dataset object location */ + H5O_type_t obj_type; /* Type of object at location */ + hbool_t loc_found = FALSE; /* Location at 'name' found */ + H5D_t *ret_value = NULL; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check args */ + HDassert(loc); + HDassert(name); + + /* Set up dataset location to fill in */ + dset_loc.oloc = &oloc; + dset_loc.path = &path; + H5G_loc_reset(&dset_loc); + + /* Find the dataset object */ + if(H5G_loc_find(loc, name, &dset_loc, dapl_id, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, NULL, "not found") + loc_found = TRUE; + + /* Check that the object found is the correct type */ + if(H5O_obj_type(&oloc, &obj_type, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get object type") + if(obj_type != H5O_TYPE_DATASET) + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, NULL, "not a dataset") + + /* Open the dataset */ + if(NULL == (dset = H5D_open(&dset_loc, dapl_id, dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't open dataset") + + /* Set return value */ + ret_value = dset; + +done: + if(!ret_value) + if(loc_found && H5G_loc_free(&dset_loc) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "can't free location") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__open_name() */ + + /* *------------------------------------------------------------------------- * Function: H5D_open @@ -1164,7 +1283,7 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) { H5D_shared_t *shared_fo = NULL; H5D_t *dataset = NULL; - H5D_t *ret_value; /* Return value */ + H5D_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1384,9 +1503,9 @@ done: if(H5F_addr_defined(dataset->oloc.addr) && H5O_close(&(dataset->oloc)) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header") if(dataset->shared) { - if(dataset->shared->layout.type == H5D_CHUNKED && layout_init) - if(H5D__chunk_dest(dataset->oloc.file, dxpl_id, dataset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy chunk cache") + if(layout_init) + if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset, dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") if(dataset->shared->space && H5S_close(dataset->shared->space) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") if(dataset->shared->type) { @@ -1423,7 +1542,7 @@ done: herr_t H5D_close(H5D_t *dataset) { - unsigned free_failed = FALSE; + hbool_t free_failed = FALSE; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1443,16 +1562,18 @@ H5D_close(H5D_t *dataset) if(H5D__flush_real(dataset, H5AC_dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info") - /* Free the data sieve buffer, if it's been allocated */ - if(dataset->shared->cache.contig.sieve_buf) { - HDassert(dataset->shared->layout.type != H5D_COMPACT); /* We should never have a sieve buffer for compact storage */ - - dataset->shared->cache.contig.sieve_buf = (unsigned char *)H5FL_BLK_FREE(sieve_buf,dataset->shared->cache.contig.sieve_buf); - } /* end if */ + /* Set a flag to indicate the dataset is closing, before we start freeing things */ + /* (Avoids problems with flushing datasets twice, when one is holding + * the file open and it iterates through dataset to flush them -QAK) + */ + dataset->shared->closing = TRUE; /* Free cached information for each kind of dataset */ switch(dataset->shared->layout.type) { case H5D_CONTIGUOUS: + /* Free the data sieve buffer, if it's been allocated */ + if(dataset->shared->cache.contig.sieve_buf) + dataset->shared->cache.contig.sieve_buf = (unsigned char *)H5FL_BLK_FREE(sieve_buf,dataset->shared->cache.contig.sieve_buf); break; case H5D_CHUNKED: @@ -1474,16 +1595,10 @@ H5D_close(H5D_t *dataset) dataset->shared->cache.chunk.single_chunk_info = H5FL_FREE(H5D_chunk_info_t, dataset->shared->cache.chunk.single_chunk_info); dataset->shared->cache.chunk.single_chunk_info = NULL; } /* end if */ - - /* Flush and destroy chunks in the cache. Continue to close even if - * it fails. */ - if(H5D__chunk_dest(dataset->oloc.file, H5AC_dxpl_id, dataset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy chunk cache") break; case H5D_COMPACT: - /* Free the buffer for the raw data for compact datasets */ - dataset->shared->layout.storage.u.compact.buf = H5MM_xfree(dataset->shared->layout.storage.u.compact.buf); + /* Nothing special to do (info freed in the layout destroy) */ break; case H5D_LAYOUT_ERROR: @@ -1495,12 +1610,24 @@ H5D_close(H5D_t *dataset) #endif /* NDEBUG */ } /* end switch */ /*lint !e788 All appropriate cases are covered */ + /* Destroy any cached layout information for the dataset */ + if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset, H5AC_dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") + + /* Release layout, fill-value, efl & pipeline messages */ + if(dataset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT) + free_failed |= (H5O_msg_reset(H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline) < 0) || + (H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0) || + (H5O_msg_reset(H5O_FILL_ID, &dataset->shared->dcpl_cache.fill) < 0) || + (H5O_msg_reset(H5O_EFL_ID, &dataset->shared->dcpl_cache.efl) < 0); + /* - * Release datatype, dataspace and creation property list -- there isn't - * much we can do if one of these fails, so we just continue. - */ - free_failed = (unsigned)(H5I_dec_ref(dataset->shared->type_id) < 0 || H5S_close(dataset->shared->space) < 0 || - H5I_dec_ref(dataset->shared->dcpl_id) < 0); + * Release datatype, dataspace and creation property list -- there isn't + * much we can do if one of these fails, so we just continue. + */ + free_failed |= (H5I_dec_ref(dataset->shared->type_id) < 0) || + (H5S_close(dataset->shared->space) < 0) || + (H5I_dec_ref(dataset->shared->dcpl_id) < 0); /* Remove the dataset from the list of opened objects in the file */ if(H5FO_top_decr(dataset->oloc.file, dataset->oloc.addr) < 0) @@ -1982,7 +2109,7 @@ herr_t H5D__iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t op, void *operator_data) { - herr_t ret_value; + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE_NOERR @@ -2019,7 +2146,7 @@ H5D_vlen_reclaim(hid_t type_id, H5S_t *space, hid_t plist_id, void *buf) { H5T_vlen_alloc_info_t _vl_alloc_info; /* VL allocation info buffer */ H5T_vlen_alloc_info_t *vl_alloc_info = &_vl_alloc_info; /* VL allocation info */ - herr_t ret_value; + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2060,7 +2187,7 @@ void * H5D__vlen_get_buf_size_alloc(size_t size, void *info) { H5D_vlen_bufsize_t *vlen_bufsize = (H5D_vlen_bufsize_t *)info; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE_NOERR @@ -2206,6 +2333,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) { hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */ htri_t changed; /* Whether the dataspace changed size */ + size_t u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, dset->oloc.addr, FAIL) @@ -2241,10 +2369,9 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) hbool_t shrink = FALSE; /* Flag to indicate a dimension has shrank */ hbool_t expand = FALSE; /* Flag to indicate a dimension has grown */ hbool_t update_chunks = FALSE; /* Flag to indicate chunk cache update is needed */ - unsigned u; /* Local index variable */ /* Determine if we are shrinking and/or expanding any dimensions */ - for(u = 0; u < dset->shared->ndims; u++) { + for(u = 0; u < (size_t)dset->shared->ndims; u++) { /* Check for various status changes */ if(size[u] < curr_dims[u]) shrink = TRUE; @@ -2396,44 +2523,48 @@ H5D__flush_real(H5D_t *dataset, hid_t dxpl_id) /* Check args */ HDassert(dataset); + HDassert(dataset->shared); + + /* Avoid flushing the dataset (again) if it's closing */ + if(!dataset->shared->closing) { + /* Check for metadata changes that will require updating the object's modification time */ + if(dataset->shared->layout_dirty || dataset->shared->space_dirty) { + unsigned update_flags = H5O_UPDATE_TIME; /* Modification time flag */ + + /* Pin the object header */ + if(NULL == (oh = H5O_pin(&dataset->oloc, dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header") + + /* Update the layout on disk, if it's been changed */ + if(dataset->shared->layout_dirty) { + if(H5D__layout_oh_write(dataset, dxpl_id, oh, update_flags) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout/pline/efl info") + dataset->shared->layout_dirty = FALSE; + + /* Reset the "update the modification time" flag, so we only do it once */ + update_flags = 0; + } /* end if */ - /* Check for metadata changes that will require updating the object's modification time */ - if(dataset->shared->layout_dirty || dataset->shared->space_dirty) { - unsigned update_flags = H5O_UPDATE_TIME; /* Modification time flag */ - - /* Pin the object header */ - if(NULL == (oh = H5O_pin(&dataset->oloc, dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header") - - /* Update the layout on disk, if it's been changed */ - if(dataset->shared->layout_dirty) { - if(H5D__layout_oh_write(dataset, dxpl_id, oh, update_flags) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout/pline/efl info") - dataset->shared->layout_dirty = FALSE; - - /* Reset the "update the modification time" flag, so we only do it once */ - update_flags = 0; - } /* end if */ + /* Update the dataspace on disk, if it's been changed */ + if(dataset->shared->space_dirty) { + if(H5S_write(dataset->oloc.file, dxpl_id, oh, update_flags, dataset->shared->space) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update file with new dataspace") + dataset->shared->space_dirty = FALSE; - /* Update the dataspace on disk, if it's been changed */ - if(dataset->shared->space_dirty) { - if(H5S_write(dataset->oloc.file, dxpl_id, oh, update_flags, dataset->shared->space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update file with new dataspace") - dataset->shared->space_dirty = FALSE; + /* Reset the "update the modification time" flag, so we only do it once */ + update_flags = 0; + } /* end if */ - /* Reset the "update the modification time" flag, so we only do it once */ - update_flags = 0; + /* _Somebody_ should have update the modification time! */ + HDassert(update_flags == 0); } /* end if */ - /* _Somebody_ should have update the modification time! */ - HDassert(update_flags == 0); + /* Flush cached raw data for each kind of dataset layout */ + if(dataset->shared->layout.ops->flush && + (dataset->shared->layout.ops->flush)(dataset, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush raw data") } /* end if */ - /* Flush cached raw data for each kind of dataset layout */ - if(dataset->shared->layout.ops->flush && - (dataset->shared->layout.ops->flush)(dataset, dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush raw data") - done: /* Release pointer to object header */ if(oh != NULL) @@ -2573,29 +2704,72 @@ H5D_get_create_plist(H5D_t *dset) { H5P_genplist_t *dcpl_plist; /* Dataset's DCPL */ H5P_genplist_t *new_plist; /* Copy of dataset's DCPL */ + H5O_layout_t copied_layout; /* Layout to tweak */ H5O_fill_t copied_fill; /* Fill value to tweak */ + H5O_efl_t copied_efl; /* External file list to tweak */ hid_t new_dcpl_id = FAIL; - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Check args */ if(NULL == (dcpl_plist = (H5P_genplist_t *)H5I_object(dset->shared->dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list") /* Copy the creation property list */ if((new_dcpl_id = H5P_copy_plist(dcpl_plist, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to copy the creation property list") if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list") /* Retrieve any object creation properties */ if(H5O_get_create_plist(&dset->oloc, H5AC_ind_dxpl_id, new_plist) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object creation info") + /* Get the layout property */ + if(H5P_peek(new_plist, H5D_CRT_LAYOUT_NAME, &copied_layout) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get layout") + + /* Reset layout values set when dataset is created */ + copied_layout.ops = NULL; + switch(copied_layout.type) { + case H5D_COMPACT: + copied_layout.storage.u.compact.buf = H5MM_xfree(copied_layout.storage.u.compact.buf); + HDmemset(&copied_layout.storage.u.compact, 0, sizeof(copied_layout.storage.u.compact)); + break; + + case H5D_CONTIGUOUS: + copied_layout.storage.u.contig.addr = HADDR_UNDEF; + copied_layout.storage.u.contig.size = 0; + break; + + case H5D_CHUNKED: + /* Reset chunk size */ + copied_layout.u.chunk.size = 0; + + /* Reset index info, if the chunk ops are set */ + if(copied_layout.storage.u.chunk.ops) + /* Reset address and pointer of the array struct for the chunked storage index */ + if(H5D_chunk_idx_reset(&copied_layout.storage.u.chunk, TRUE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index in dest") + + /* Reset chunk index ops */ + copied_layout.storage.u.chunk.ops = NULL; + break; + + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: + default: + HDassert(0 && "Unknown layout type!"); + } /* end switch */ + + /* Set back the (possibly modified) layout property to property list */ + if(H5P_poke(new_plist, H5D_CRT_LAYOUT_NAME, &copied_layout) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set layout") + /* Get the fill value property */ - if(H5P_get(new_plist, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") + if(H5P_peek(new_plist, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill value") /* Check if there is a fill value, but no type yet */ if(copied_fill.buf != NULL && copied_fill.type == NULL) { @@ -2622,7 +2796,7 @@ H5D_get_create_plist(H5D_t *dset) src_id = H5I_register(H5I_DATATYPE, H5T_copy(dset->shared->type, H5T_COPY_ALL), FALSE); if(src_id < 0) { H5I_dec_ref(dst_id); - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy/register datatype") } /* end if */ /* Allocate a background buffer */ @@ -2630,7 +2804,7 @@ H5D_get_create_plist(H5D_t *dset) if(H5T_path_bkg(tpath) && NULL == (bkg_buf = H5FL_BLK_CALLOC(type_conv, bkg_size))) { H5I_dec_ref(src_id); H5I_dec_ref(dst_id); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed") } /* end if */ /* Convert fill value */ @@ -2652,9 +2826,26 @@ H5D_get_create_plist(H5D_t *dset) } /* end if */ } /* end if */ - /* Set back the fill value property to property list */ - if(H5P_set(new_plist, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property list fill value") + /* Set back the (possibly modified) fill value property to property list */ + if(H5P_poke(new_plist, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set fill value") + + /* Get the fill value property */ + if(H5P_peek(new_plist, H5D_CRT_EXT_FILE_LIST_NAME, &copied_efl) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get external file list") + + /* Reset efl name_offset and heap_addr, these are the values when the dataset is created */ + if(copied_efl.slot) { + unsigned u; + + copied_efl.heap_addr = HADDR_UNDEF; + for(u = 0; u < copied_efl.nused; u++) + copied_efl.slot[u].name_offset = 0; + } /* end if */ + + /* Set back the (possibly modified) external file list property to property list */ + if(H5P_poke(new_plist, H5D_CRT_EXT_FILE_LIST_NAME, &copied_efl) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set external file list") /* Set the return value */ ret_value = new_dcpl_id; @@ -2815,3 +3006,4 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_get_type() */ + diff --git a/src/H5Dio.c b/src/H5Dio.c index f9e8f37..d85632a 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -17,7 +17,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index 01898f2..c2d547f 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -17,7 +17,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -133,7 +133,7 @@ done: size_t H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t include_compact_data) { - size_t ret_value; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_PACKAGE @@ -273,7 +273,6 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset, } /* end if */ /* Store EFL file name offset */ - HDassert(0 == efl->slot[u].name_offset); efl->slot[u].name_offset = offset; } /* end for */ @@ -295,12 +294,11 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset, done: /* Error cleanup */ - if(ret_value < 0) { - if(dset->shared->layout.type == H5D_CHUNKED && layout_init) { - if(H5D__chunk_dest(file, dxpl_id, dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy chunk cache") - } /* end if */ - } /* end if */ + if(ret_value < 0) + if(layout_init) + /* Destroy any cached layout information for the dataset */ + if(dset->shared->layout.ops->dest && (dset->shared->layout.ops->dest)(dset, dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D__layout_oh_create() */ @@ -372,6 +370,10 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t /* Sanity check that the layout operations are set up */ HDassert(dataset->shared->layout.ops); + /* Initialize the layout information for the dataset */ + if(dataset->shared->layout.ops->init && (dataset->shared->layout.ops->init)(dataset->oloc.file, dxpl_id, dataset, dapl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize layout information") + /* Adjust chunk dimensions to omit datatype size (in last dimension) for creation property */ if(H5D_CHUNKED == dataset->shared->layout.type) dataset->shared->layout.u.chunk.ndims--; @@ -382,69 +384,6 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t if(H5D_CHUNKED == dataset->shared->layout.type) dataset->shared->layout.u.chunk.ndims++; - switch(dataset->shared->layout.type) { - case H5D_CONTIGUOUS: - { - hsize_t tmp_size; /* Temporary holder for raw data size */ - size_t tmp_sieve_buf_size; /* Temporary holder for sieve buffer size */ - - /* Compute the size of the contiguous storage for versions of the - * layout message less than version 3 because versions 1 & 2 would - * truncate the dimension sizes to 32-bits of information. - QAK 5/26/04 - */ - if(dataset->shared->layout.version < 3) { - hssize_t snelmts; /* Temporary holder for number of elements in dataspace */ - hsize_t nelmts; /* Number of elements in dataspace */ - size_t dt_size; /* Size of datatype */ - - /* Retrieve the number of elements in the dataspace */ - if((snelmts = H5S_GET_EXTENT_NPOINTS(dataset->shared->space)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve number of elements in dataspace") - nelmts = (hsize_t)snelmts; - - /* Get the datatype's size */ - if(0 == (dt_size = H5T_GET_SIZE(dataset->shared->type))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve size of datatype") - - /* Compute the size of the dataset's contiguous storage */ - tmp_size = nelmts * dt_size; - - /* Check for overflow during multiplication */ - if(nelmts != (tmp_size / dt_size)) - HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed") - - /* Assign the dataset's contiguous storage size */ - dataset->shared->layout.storage.u.contig.size = tmp_size; - } else - tmp_size = dataset->shared->layout.storage.u.contig.size; - - /* Get the sieve buffer size for the file */ - tmp_sieve_buf_size = H5F_SIEVE_BUF_SIZE(dataset->oloc.file); - - /* Adjust the sieve buffer size to the smaller one between the dataset size and the buffer size - * from the file access property. (SLU - 2012/3/30) */ - if(tmp_size < tmp_sieve_buf_size) - dataset->shared->cache.contig.sieve_buf_size = tmp_size; - else - dataset->shared->cache.contig.sieve_buf_size = tmp_sieve_buf_size; - } - break; - - case H5D_CHUNKED: - /* Initialize the chunk cache for the dataset */ - if(H5D__chunk_init(dataset->oloc.file, dxpl_id, dataset, dapl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize chunk cache") - break; - - case H5D_COMPACT: - break; - - case H5D_LAYOUT_ERROR: - case H5D_NLAYOUTS: - default: - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown storage method") - } /* end switch */ /*lint !e788 All appropriate cases are covered */ - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__layout_oh_read() */ diff --git a/src/H5Dmodule.h b/src/H5Dmodule.h new file mode 100644 index 0000000..9b0c411 --- /dev/null +++ b/src/H5Dmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5D package. Including this header means that the source file + * is part of the H5D package. + */ +#ifndef _H5Dmodule_H +#define _H5Dmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5D_MODULE +#define H5_MY_PKG H5D +#define H5_MY_PKG_ERR H5E_DATASET +#define H5_MY_PKG_INIT YES + +#endif /* _H5Dmodule_H */ + diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 289e12b..a5f34d1 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -27,7 +27,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /* suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ @@ -605,7 +605,8 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") /* Check the optional property list on what to do with collective chunk IO. */ - chunk_opt_mode = (H5FD_mpio_chunk_opt_t)H5P_peek_unsigned(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME); + if(H5P_get(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, &chunk_opt_mode) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't get chunk optimization option") if(H5FD_MPIO_CHUNK_ONE_IO == chunk_opt_mode) io_option = H5D_ONE_LINK_CHUNK_IO; /*no opt*/ /* direct request to multi-chunk-io */ @@ -621,7 +622,9 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf if((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0) HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain mpi size") - one_link_chunk_io_threshold = H5P_peek_unsigned(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME); + /* Get the chunk optimization option */ + if(H5P_get(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, &one_link_chunk_io_threshold) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't get chunk optimization option") /* step 1: choose an IO option */ /* If the average number of chunk per process is greater than a threshold, we will do one link chunked IO. */ @@ -1698,7 +1701,8 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, /* Setup parameters */ H5_CHECKED_ASSIGN(total_chunks, int, fm->layout->u.chunk.nchunks, hsize_t); - percent_nproc_per_chunk = H5P_peek_unsigned(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME); + if(H5P_get(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, &percent_nproc_per_chunk) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't get percent nproc per chunk") /* if ratio is 0, perform collective io */ if(0 == percent_nproc_per_chunk) { if(H5D__chunk_addrmap(io_info, chunk_addr) < 0) diff --git a/src/H5Doh.c b/src/H5Doh.c index abf76d0..057c904 100644 --- a/src/H5Doh.c +++ b/src/H5Doh.c @@ -17,8 +17,8 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ /***********/ @@ -108,7 +108,7 @@ H5FL_DEFINE(H5D_copy_file_ud_t); static void * H5O__dset_get_copy_file_udata(void) { - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -223,10 +223,10 @@ done: static hid_t H5O__dset_open(const H5G_loc_t *obj_loc, hid_t lapl_id, hid_t dxpl_id, hbool_t app_ref) { - H5D_t *dset = NULL; /* Dataset opened */ - htri_t isdapl; /* lapl_id is a dapl */ - hid_t dapl_id; /* dapl to use to open this dataset */ - hid_t ret_value; /* Return value */ + H5D_t *dset = NULL; /* Dataset opened */ + htri_t isdapl; /* lapl_id is a dapl */ + hid_t dapl_id; /* dapl to use to open this dataset */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_STATIC @@ -279,7 +279,7 @@ H5O__dset_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc, hid_t dxpl_id) { H5D_obj_create_t *crt_info = (H5D_obj_create_t *)_crt_info; /* Dataset creation parameters */ H5D_t *dset = NULL; /* New dataset created */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -327,7 +327,7 @@ static H5O_loc_t * H5O__dset_get_oloc(hid_t obj_id) { H5D_t *dset; /* Dataset opened */ - H5O_loc_t *ret_value; /* Return value */ + H5O_loc_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 1476229..c779eea 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -21,7 +21,7 @@ * the H5D package. Source files outside the H5D package should * include H5Dprivate.h instead. */ -#ifndef H5D_PACKAGE +#if !(defined H5D_FRIEND || defined H5D_MODULE) #error "Do not include this file outside the H5D package!" #endif @@ -121,6 +121,7 @@ typedef ssize_t (*H5D_layout_writevv_func_t)(const struct H5D_io_info_t *io_info size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); typedef herr_t (*H5D_layout_flush_func_t)(H5D_t *dataset, hid_t dxpl_id); typedef herr_t (*H5D_layout_io_term_func_t)(const struct H5D_chunk_map_t *cm); +typedef herr_t (*H5D_layout_dest_func_t)(H5D_t *dataset, hid_t dxpl_id); /* Typedef for grouping layout I/O routines */ typedef struct H5D_layout_ops_t { @@ -138,6 +139,7 @@ typedef struct H5D_layout_ops_t { H5D_layout_writevv_func_t writevv; /* Low-level I/O routine for writing data */ H5D_layout_flush_func_t flush; /* Low-level I/O routine for flushing raw data */ H5D_layout_io_term_func_t io_term; /* I/O shutdown routine */ + H5D_layout_dest_func_t dest; /* Destroy layout info */ } H5D_layout_ops_t; /* Function pointers for either multiple or single block I/O access */ @@ -408,6 +410,7 @@ typedef struct H5D_rdcdc_t { */ typedef struct H5D_shared_t { size_t fo_count; /* Reference count */ + hbool_t closing; /* Flag to indicate dataset is closing */ hid_t type_id; /* ID for dataset's datatype */ H5T_t *type; /* Datatype for this dataset */ H5S_t *space; /* Dataspace of this dataset */ @@ -528,13 +531,13 @@ H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_BTREE[1]; /* Package Private Prototypes */ /******************************/ -H5_DLL herr_t H5D__term_pub_interface(void); -H5_DLL herr_t H5D__term_deprec_interface(void); H5_DLL H5D_t *H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id); 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, hid_t dxpl_id); +H5_DLL H5D_t *H5D__open_name(const H5G_loc_t *loc, const char *name, + hid_t dapl_id, hid_t dxpl_id); H5_DLL herr_t H5D__get_space_status(H5D_t *dset, H5D_space_status_t *allocation, hid_t dxpl_id); H5_DLL herr_t H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc, @@ -605,14 +608,11 @@ H5_DLL herr_t H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage H5_DLL herr_t H5D__contig_delete(H5F_t *f, hid_t dxpl_id, const H5O_storage_t *store); - /* Functions that operate on chunked dataset storage */ H5_DLL htri_t H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, hbool_t write_op); H5_DLL herr_t H5D__chunk_create(const H5D_t *dset /*in,out*/, hid_t dxpl_id); H5_DLL herr_t H5D__chunk_set_info(const H5D_t *dset); -H5_DLL herr_t H5D__chunk_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, - hid_t dapl_id); H5_DLL hbool_t H5D__chunk_is_space_alloc(const H5O_storage_t *storage); H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, H5D_chunk_ud_t *udata); @@ -637,7 +637,6 @@ H5_DLL herr_t H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5_DLL herr_t H5D__chunk_bh_info(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout, const H5O_pline_t *pline, hsize_t *btree_size); H5_DLL herr_t H5D__chunk_dump_index(H5D_t *dset, hid_t dxpl_id, FILE *stream); -H5_DLL herr_t H5D__chunk_dest(H5F_t *f, hid_t dxpl_id, H5D_t *dset); H5_DLL herr_t H5D__chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_storage_t *store); H5_DLL herr_t H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c index 4b0846f..9902b7b 100644 --- a/src/H5Dscatgath.c +++ b/src/H5Dscatgath.c @@ -17,7 +17,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ diff --git a/src/H5Dselect.c b/src/H5Dselect.c index 38f8bc4..ce6073c 100644 --- a/src/H5Dselect.c +++ b/src/H5Dselect.c @@ -23,7 +23,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ /***********/ diff --git a/src/H5Dtest.c b/src/H5Dtest.c index eef3c91..fd8ff71 100644 --- a/src/H5Dtest.c +++ b/src/H5Dtest.c @@ -23,7 +23,7 @@ /* Module Setup */ /****************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ #define H5D_TESTING /*suppress warning about H5D testing funcs*/ @@ -45,10 +45,7 @@ /* Module Setup */ /****************/ -#define H5E_PACKAGE /*suppress error about including H5Epkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5E_init_interface +#include "H5Emodule.h" /* This source code file is part of the H5E module */ /***********/ @@ -83,6 +80,7 @@ /* Local Prototypes */ /********************/ /* Static function declarations */ +static herr_t H5E_set_default_auto(H5E_t *stk); static H5E_cls_t *H5E_register_class(const char *cls_name, const char *lib_name, const char *version); static herr_t H5E_unregister_class(H5E_cls_t *cls); @@ -100,6 +98,9 @@ static ssize_t H5E_get_num(const H5E_t *err_stack); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -173,45 +174,7 @@ done: /*-------------------------------------------------------------------------- - * Function: H5E_set_default_auto - * - * Purpose: Initialize "automatic" error stack reporting info to library - * default - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Thursday, November 1, 2007 - * - *-------------------------------------------------------------------------- - */ -static herr_t -H5E_set_default_auto(H5E_t *stk) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#ifndef H5_NO_DEPRECATED_SYMBOLS -#ifdef H5_USE_16_API_DEFAULT - stk->auto_op.vers = 1; -#else /* H5_USE_16_API */ - stk->auto_op.vers = 2; -#endif /* H5_USE_16_API_DEFAULT */ - - stk->auto_op.func1 = stk->auto_op.func1_default = (H5E_auto1_t)H5Eprint1; - stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5Eprint2; - stk->auto_op.is_default = TRUE; -#else /* H5_NO_DEPRECATED_SYMBOLS */ - stk->auto_op.func2 = (H5E_auto2_t)H5Eprint2; -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - - stk->auto_data = NULL; - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5E_set_default_auto() */ - - -/*-------------------------------------------------------------------------- - * Function: H5E_init_interface + * Function: H5E__init_package * * Purpose: Initialize interface-specific information * @@ -222,15 +185,15 @@ H5E_set_default_auto(H5E_t *stk) * *-------------------------------------------------------------------------- */ -static herr_t -H5E_init_interface(void) +herr_t +H5E__init_package(void) { H5E_cls_t *cls; /* Pointer to error class */ H5E_msg_t *msg; /* Pointer to new error message */ char lib_vers[128]; /* Buffer to constructu library version within */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Initialize the atom group for the error class IDs */ if(H5I_register_type(H5I_ERRCLS_CLS) < 0) @@ -262,11 +225,11 @@ H5E_init_interface(void) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5E_init_interface() */ +} /* end H5E__init_package() */ /*------------------------------------------------------------------------- - * Function: H5E_term_interface + * Function: H5E_term_package * * Purpose: Terminates the H5E interface * @@ -281,13 +244,13 @@ done: *------------------------------------------------------------------------- */ int -H5E_term_interface(void) +H5E_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5_PKG_INIT_VAR) { int64_t ncls, nmsg, nstk; /* Check if there are any open error stacks, classes or messages */ @@ -323,22 +286,57 @@ H5E_term_interface(void) n++; /*H5I*/ } /* end if */ else { - /* Close deprecated interface */ - n += H5E__term_deprec_interface(); - /* Destroy the error class, message, and stack id groups */ - (void)H5I_dec_type_ref(H5I_ERROR_STACK); - (void)H5I_dec_type_ref(H5I_ERROR_CLASS); - (void)H5I_dec_type_ref(H5I_ERROR_MSG); - n++; /*H5I*/ + n += (H5I_dec_type_ref(H5I_ERROR_STACK) > 0); + n += (H5I_dec_type_ref(H5I_ERROR_CLASS) > 0); + n += (H5I_dec_type_ref(H5I_ERROR_MSG) > 0); /* Mark closed */ - H5_interface_initialize_g = 0; + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5E_term_interface() */ +} /* end H5E_term_package() */ + + +/*-------------------------------------------------------------------------- + * Function: H5E_set_default_auto + * + * Purpose: Initialize "automatic" error stack reporting info to library + * default + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, November 1, 2007 + * + *-------------------------------------------------------------------------- + */ +static herr_t +H5E_set_default_auto(H5E_t *stk) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#ifndef H5_NO_DEPRECATED_SYMBOLS +#ifdef H5_USE_16_API_DEFAULT + stk->auto_op.vers = 1; +#else /* H5_USE_16_API */ + stk->auto_op.vers = 2; +#endif /* H5_USE_16_API_DEFAULT */ + + stk->auto_op.func1 = stk->auto_op.func1_default = (H5E_auto1_t)H5Eprint1; + stk->auto_op.func2 = stk->auto_op.func2_default = (H5E_auto2_t)H5Eprint2; + stk->auto_op.is_default = TRUE; +#else /* H5_NO_DEPRECATED_SYMBOLS */ + stk->auto_op.func2 = (H5E_auto2_t)H5Eprint2; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + stk->auto_data = NULL; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5E_set_default_auto() */ #ifdef H5_HAVE_THREADSAFE @@ -360,7 +358,7 @@ H5E_term_interface(void) H5E_t * H5E_get_stack(void) { - H5E_t *estack; + H5E_t *estack = NULL; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -371,7 +369,7 @@ H5E_get_stack(void) #ifdef H5_HAVE_WIN_THREADS estack = (H5E_t *)LocalAlloc(LPTR, sizeof(H5E_t)); /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */ #else - estack = (H5E_t *)H5FL_MALLOC(H5E_t); + estack = (H5E_t *)HDmalloc(sizeof(H5E_t)); #endif /* H5_HAVE_WIN_THREADS */ HDassert(estack); @@ -475,8 +473,8 @@ done: static H5E_cls_t * H5E_register_class(const char *cls_name, const char *lib_name, const char *version) { - H5E_cls_t *cls = NULL; /* Pointer to error class */ - H5E_cls_t *ret_value; /* Return value */ + H5E_cls_t *cls = NULL; /* Pointer to error class */ + H5E_cls_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -631,7 +629,7 @@ done: static ssize_t H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size) { - ssize_t len; /* Length of error class's name */ + ssize_t len = 0; /* Length of error class's name */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -812,8 +810,8 @@ done: static H5E_msg_t * H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str) { - H5E_msg_t *msg = NULL; /* Pointer to new error message */ - H5E_msg_t *ret_value; /* Return value */ + H5E_msg_t *msg = NULL; /* Pointer to new error message */ + H5E_msg_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -967,10 +965,10 @@ done: static H5E_t * H5E_get_current_stack(void) { - H5E_t *current_stack; /* Pointer to the current error stack */ - H5E_t *estack_copy=NULL; /* Pointer to new error stack to return */ - unsigned u; /* Local index variable */ - H5E_t *ret_value; /* Return value */ + H5E_t *current_stack; /* Pointer to the current error stack */ + H5E_t *estack_copy = NULL; /* Pointer to new error stack to return */ + unsigned u; /* Local index variable */ + H5E_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -33,7 +33,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ @@ -79,6 +79,9 @@ typedef herr_t (*H5EA__unprotect_func_t)(void *thing, hid_t dxpl_id, /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Extensible array client ID to class mapping */ /* Remember to add client ID to H5EA_cls_id_t in H5EAprivate.h when adding a new diff --git a/src/H5EAcache.c b/src/H5EAcache.c index 8a05282..e9c93d4 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c index 9c3ce6d..ef45881 100644 --- a/src/H5EAdbg.c +++ b/src/H5EAdbg.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c index 5d188c2..15bad43 100644 --- a/src/H5EAdblkpage.c +++ b/src/H5EAdblkpage.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ diff --git a/src/H5EAdblock.c b/src/H5EAdblock.c index 24be87a..cd20bba 100644 --- a/src/H5EAdblock.c +++ b/src/H5EAdblock.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index e30bbac..eff4b54 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ diff --git a/src/H5EAiblock.c b/src/H5EAiblock.c index 364b443..3f49d0d 100644 --- a/src/H5EAiblock.c +++ b/src/H5EAiblock.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ diff --git a/src/H5EAint.c b/src/H5EAint.c index 12a9cda..9f910d0 100644 --- a/src/H5EAint.c +++ b/src/H5EAint.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ diff --git a/src/H5EAmodule.h b/src/H5EAmodule.h new file mode 100644 index 0000000..405b232 --- /dev/null +++ b/src/H5EAmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5EA package. Including this header means that the source file + * is part of the H5EA package. + */ +#ifndef _H5EAmodule_H +#define _H5EAmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5EA_MODULE +#define H5_MY_PKG H5EA +#define H5_MY_PKG_ERR H5E_EARRAY +#define H5_MY_PKG_INIT NO + +#endif /* _H5EAmodule_H */ + diff --git a/src/H5EApkg.h b/src/H5EApkg.h index d328c05..3af1b2c 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -21,7 +21,7 @@ * the H5EA package. Source files outside the H5EA package should * include H5EAprivate.h instead. */ -#if !(defined(H5EA_PACKAGE) | defined(H5EA_MODULE)) +#if !(defined(H5EA_FRIEND) | defined(H5EA_MODULE)) #error "Do not include this file outside the H5EA package!" #endif @@ -39,16 +39,6 @@ /* Package Private Macros */ /**************************/ -/* If this package header is being included in one of the H5EA modules, define - * the proper control macros for the generic FUNC_ENTER/LEAVE and error - * reporting macros. - */ -#ifdef H5EA_MODULE -#define H5_MY_PKG H5EA -#define H5_MY_PKG_ERR H5E_EARRAY -#define H5_MY_PKG_INIT NO -#endif /* H5EA_MODULE */ - /* Fill value for extensible array test class */ #ifdef H5EA_TESTING #define H5EA_TEST_FILL ((uint64_t)ULLONG_MAX) diff --git a/src/H5EAsblock.c b/src/H5EAsblock.c index 33f34c9..7753f0e 100644 --- a/src/H5EAsblock.c +++ b/src/H5EAsblock.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ diff --git a/src/H5EAstat.c b/src/H5EAstat.c index 8a26e34..0c27681 100644 --- a/src/H5EAstat.c +++ b/src/H5EAstat.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ /***********************/ diff --git a/src/H5EAtest.c b/src/H5EAtest.c index b3942ca..905aa7f 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -24,7 +24,7 @@ /* Module Declaration */ /**********************/ -#define H5EA_MODULE +#include "H5EAmodule.h" /* This source code file is part of the H5EA module */ #define H5EA_TESTING diff --git a/src/H5Edefin.h b/src/H5Edefin.h deleted file mode 100644 index 183f72c..0000000 --- a/src/H5Edefin.h +++ /dev/null @@ -1,222 +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 files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* Generated automatically by bin/make_err -- do not edit */ -/* Add new errors to H5err.txt file */ - - -#ifndef _H5Edefin_H -#define _H5Edefin_H - -/* Major error IDs */ -hid_t H5E_FUNC_g = FAIL; /* Function entry/exit */ -hid_t H5E_FILE_g = FAIL; /* File accessibilty */ -hid_t H5E_SOHM_g = FAIL; /* Shared Object Header Messages */ -hid_t H5E_SYM_g = FAIL; /* Symbol table */ -hid_t H5E_PLUGIN_g = FAIL; /* Plugin for dynamically loaded library */ -hid_t H5E_VFL_g = FAIL; /* Virtual File Layer */ -hid_t H5E_INTERNAL_g = FAIL; /* Internal error (too specific to document in detail) */ -hid_t H5E_BTREE_g = FAIL; /* B-Tree node */ -hid_t H5E_REFERENCE_g = FAIL; /* References */ -hid_t H5E_DATASPACE_g = FAIL; /* Dataspace */ -hid_t H5E_RESOURCE_g = FAIL; /* Resource unavailable */ -hid_t H5E_RS_g = FAIL; /* Reference Counted Strings */ -hid_t H5E_FARRAY_g = FAIL; /* Fixed Array */ -hid_t H5E_HEAP_g = FAIL; /* Heap */ -hid_t H5E_ATTR_g = FAIL; /* Attribute */ -hid_t H5E_IO_g = FAIL; /* Low-level I/O */ -hid_t H5E_EFL_g = FAIL; /* External file list */ -hid_t H5E_TST_g = FAIL; /* Ternary Search Trees */ -hid_t H5E_FSPACE_g = FAIL; /* Free Space Manager */ -hid_t H5E_DATASET_g = FAIL; /* Dataset */ -hid_t H5E_STORAGE_g = FAIL; /* Data storage */ -hid_t H5E_LINK_g = FAIL; /* Links */ -hid_t H5E_PLIST_g = FAIL; /* Property lists */ -hid_t H5E_DATATYPE_g = FAIL; /* Datatype */ -hid_t H5E_OHDR_g = FAIL; /* Object header */ -hid_t H5E_ATOM_g = FAIL; /* Object atom */ -hid_t H5E_NONE_MAJOR_g = FAIL; /* No error */ -hid_t H5E_SLIST_g = FAIL; /* Skip Lists */ -hid_t H5E_ARGS_g = FAIL; /* Invalid arguments to routine */ -hid_t H5E_EARRAY_g = FAIL; /* Extensible Array */ -hid_t H5E_PLINE_g = FAIL; /* Data filters */ -hid_t H5E_ERROR_g = FAIL; /* Error API */ -hid_t H5E_CACHE_g = FAIL; /* Object cache */ - -/* Minor error IDs */ - -/* Generic low-level file I/O errors */ -hid_t H5E_SEEKERROR_g = FAIL; /* Seek failed */ -hid_t H5E_READERROR_g = FAIL; /* Read failed */ -hid_t H5E_WRITEERROR_g = FAIL; /* Write failed */ -hid_t H5E_CLOSEERROR_g = FAIL; /* Close failed */ -hid_t H5E_OVERFLOW_g = FAIL; /* Address overflowed */ -hid_t H5E_FCNTL_g = FAIL; /* File control (fcntl) failed */ - -/* Resource errors */ -hid_t H5E_NOSPACE_g = FAIL; /* No space available for allocation */ -hid_t H5E_CANTALLOC_g = FAIL; /* Can't allocate space */ -hid_t H5E_CANTCOPY_g = FAIL; /* Unable to copy object */ -hid_t H5E_CANTFREE_g = FAIL; /* Unable to free object */ -hid_t H5E_ALREADYEXISTS_g = FAIL; /* Object already exists */ -hid_t H5E_CANTLOCK_g = FAIL; /* Unable to lock object */ -hid_t H5E_CANTUNLOCK_g = FAIL; /* Unable to unlock object */ -hid_t H5E_CANTGC_g = FAIL; /* Unable to garbage collect */ -hid_t H5E_CANTGETSIZE_g = FAIL; /* Unable to compute size */ -hid_t H5E_OBJOPEN_g = FAIL; /* Object is already open */ - -/* Heap errors */ -hid_t H5E_CANTRESTORE_g = FAIL; /* Can't restore condition */ -hid_t H5E_CANTCOMPUTE_g = FAIL; /* Can't compute value */ -hid_t H5E_CANTEXTEND_g = FAIL; /* Can't extend heap's space */ -hid_t H5E_CANTATTACH_g = FAIL; /* Can't attach object */ -hid_t H5E_CANTUPDATE_g = FAIL; /* Can't update object */ -hid_t H5E_CANTOPERATE_g = FAIL; /* Can't operate on object */ - -/* Function entry/exit interface errors */ -hid_t H5E_CANTINIT_g = FAIL; /* Unable to initialize object */ -hid_t H5E_ALREADYINIT_g = FAIL; /* Object already initialized */ -hid_t H5E_CANTRELEASE_g = FAIL; /* Unable to release object */ - -/* Property list errors */ -hid_t H5E_CANTGET_g = FAIL; /* Can't get value */ -hid_t H5E_CANTSET_g = FAIL; /* Can't set value */ -hid_t H5E_DUPCLASS_g = FAIL; /* Duplicate class name in parent class */ -hid_t H5E_SETDISALLOWED_g = FAIL; /* Disallowed operation */ - -/* Free space errors */ -hid_t H5E_CANTMERGE_g = FAIL; /* Can't merge objects */ -hid_t H5E_CANTREVIVE_g = FAIL; /* Can't revive object */ -hid_t H5E_CANTSHRINK_g = FAIL; /* Can't shrink container */ - -/* Object header related errors */ -hid_t H5E_LINKCOUNT_g = FAIL; /* Bad object header link count */ -hid_t H5E_VERSION_g = FAIL; /* Wrong version number */ -hid_t H5E_ALIGNMENT_g = FAIL; /* Alignment error */ -hid_t H5E_BADMESG_g = FAIL; /* Unrecognized message */ -hid_t H5E_CANTDELETE_g = FAIL; /* Can't delete message */ -hid_t H5E_BADITER_g = FAIL; /* Iteration failed */ -hid_t H5E_CANTPACK_g = FAIL; /* Can't pack messages */ -hid_t H5E_CANTRESET_g = FAIL; /* Can't reset object */ -hid_t H5E_CANTRENAME_g = FAIL; /* Unable to rename object */ - -/* System level errors */ -hid_t H5E_SYSERRSTR_g = FAIL; /* System error message */ - -/* I/O pipeline errors */ -hid_t H5E_NOFILTER_g = FAIL; /* Requested filter is not available */ -hid_t H5E_CALLBACK_g = FAIL; /* Callback failed */ -hid_t H5E_CANAPPLY_g = FAIL; /* Error from filter 'can apply' callback */ -hid_t H5E_SETLOCAL_g = FAIL; /* Error from filter 'set local' callback */ -hid_t H5E_NOENCODER_g = FAIL; /* Filter present but encoding disabled */ -hid_t H5E_CANTFILTER_g = FAIL; /* Filter operation failed */ - -/* Group related errors */ -hid_t H5E_CANTOPENOBJ_g = FAIL; /* Can't open object */ -hid_t H5E_CANTCLOSEOBJ_g = FAIL; /* Can't close object */ -hid_t H5E_COMPLEN_g = FAIL; /* Name component is too long */ -hid_t H5E_PATH_g = FAIL; /* Problem with path to object */ - -/* No error */ -hid_t H5E_NONE_MINOR_g = FAIL; /* No error */ - -/* Plugin errors */ -hid_t H5E_OPENERROR_g = FAIL; /* Can't open directory or file */ - -/* File accessibilty errors */ -hid_t H5E_FILEEXISTS_g = FAIL; /* File already exists */ -hid_t H5E_FILEOPEN_g = FAIL; /* File already open */ -hid_t H5E_CANTCREATE_g = FAIL; /* Unable to create file */ -hid_t H5E_CANTOPENFILE_g = FAIL; /* Unable to open file */ -hid_t H5E_CANTCLOSEFILE_g = FAIL; /* Unable to close file */ -hid_t H5E_NOTHDF5_g = FAIL; /* Not an HDF5 file */ -hid_t H5E_BADFILE_g = FAIL; /* Bad file ID accessed */ -hid_t H5E_TRUNCATED_g = FAIL; /* File has been truncated */ -hid_t H5E_MOUNT_g = FAIL; /* File mount error */ - -/* Object atom related errors */ -hid_t H5E_BADATOM_g = FAIL; /* Unable to find atom information (already closed?) */ -hid_t H5E_BADGROUP_g = FAIL; /* Unable to find ID group information */ -hid_t H5E_CANTREGISTER_g = FAIL; /* Unable to register new atom */ -hid_t H5E_CANTINC_g = FAIL; /* Unable to increment reference count */ -hid_t H5E_CANTDEC_g = FAIL; /* Unable to decrement reference count */ -hid_t H5E_NOIDS_g = FAIL; /* Out of IDs for group */ - -/* Cache related errors */ -hid_t H5E_CANTFLUSH_g = FAIL; /* Unable to flush data from cache */ -hid_t H5E_CANTSERIALIZE_g = FAIL; /* Unable to serialize data from cache */ -hid_t H5E_CANTTAG_g = FAIL; /* Unable to tag metadata in the cache */ -hid_t H5E_CANTLOAD_g = FAIL; /* Unable to load metadata into cache */ -hid_t H5E_PROTECT_g = FAIL; /* Protected metadata error */ -hid_t H5E_NOTCACHED_g = FAIL; /* Metadata not currently cached */ -hid_t H5E_SYSTEM_g = FAIL; /* Internal error detected */ -hid_t H5E_CANTINS_g = FAIL; /* Unable to insert metadata into cache */ -hid_t H5E_CANTPROTECT_g = FAIL; /* Unable to protect metadata */ -hid_t H5E_CANTUNPROTECT_g = FAIL; /* Unable to unprotect metadata */ -hid_t H5E_CANTPIN_g = FAIL; /* Unable to pin cache entry */ -hid_t H5E_CANTUNPIN_g = FAIL; /* Unable to un-pin cache entry */ -hid_t H5E_CANTMARKDIRTY_g = FAIL; /* Unable to mark a pinned entry as dirty */ -hid_t H5E_CANTDIRTY_g = FAIL; /* Unable to mark metadata as dirty */ -hid_t H5E_CANTEXPUNGE_g = FAIL; /* Unable to expunge a metadata cache entry */ -hid_t H5E_CANTRESIZE_g = FAIL; /* Unable to resize a metadata cache entry */ -hid_t H5E_CANTDEPEND_g = FAIL; /* Unable to create a flush dependency */ -hid_t H5E_CANTUNDEPEND_g = FAIL; /* Unable to destroy a flush dependency */ -hid_t H5E_CANTNOTIFY_g = FAIL; /* Unable to notify object about action */ - -/* Link related errors */ -hid_t H5E_TRAVERSE_g = FAIL; /* Link traversal failure */ -hid_t H5E_NLINKS_g = FAIL; /* Too many soft links in path */ -hid_t H5E_NOTREGISTERED_g = FAIL; /* Link class not registered */ -hid_t H5E_CANTMOVE_g = FAIL; /* Can't move object */ -hid_t H5E_CANTSORT_g = FAIL; /* Can't sort objects */ - -/* Parallel MPI errors */ -hid_t H5E_MPI_g = FAIL; /* Some MPI function failed */ -hid_t H5E_MPIERRSTR_g = FAIL; /* MPI Error String */ -hid_t H5E_CANTRECV_g = FAIL; /* Can't receive data */ - -/* Dataspace errors */ -hid_t H5E_CANTCLIP_g = FAIL; /* Can't clip hyperslab region */ -hid_t H5E_CANTCOUNT_g = FAIL; /* Can't count elements */ -hid_t H5E_CANTSELECT_g = FAIL; /* Can't select hyperslab */ -hid_t H5E_CANTNEXT_g = FAIL; /* Can't move to next iterator location */ -hid_t H5E_BADSELECT_g = FAIL; /* Invalid selection */ -hid_t H5E_CANTCOMPARE_g = FAIL; /* Can't compare objects */ - -/* Argument errors */ -hid_t H5E_UNINITIALIZED_g = FAIL; /* Information is uinitialized */ -hid_t H5E_UNSUPPORTED_g = FAIL; /* Feature is unsupported */ -hid_t H5E_BADTYPE_g = FAIL; /* Inappropriate type */ -hid_t H5E_BADRANGE_g = FAIL; /* Out of range */ -hid_t H5E_BADVALUE_g = FAIL; /* Bad value */ - -/* B-tree related errors */ -hid_t H5E_NOTFOUND_g = FAIL; /* Object not found */ -hid_t H5E_EXISTS_g = FAIL; /* Object already exists */ -hid_t H5E_CANTENCODE_g = FAIL; /* Unable to encode value */ -hid_t H5E_CANTDECODE_g = FAIL; /* Unable to decode value */ -hid_t H5E_CANTSPLIT_g = FAIL; /* Unable to split node */ -hid_t H5E_CANTREDISTRIBUTE_g = FAIL; /* Unable to redistribute records */ -hid_t H5E_CANTSWAP_g = FAIL; /* Unable to swap records */ -hid_t H5E_CANTINSERT_g = FAIL; /* Unable to insert object */ -hid_t H5E_CANTLIST_g = FAIL; /* Unable to list node */ -hid_t H5E_CANTMODIFY_g = FAIL; /* Unable to modify record */ -hid_t H5E_CANTREMOVE_g = FAIL; /* Unable to remove object */ - -/* Datatype conversion errors */ -hid_t H5E_CANTCONVERT_g = FAIL; /* Can't convert datatypes */ -hid_t H5E_BADSIZE_g = FAIL; /* Bad size for object */ - -#endif /* H5Edefin_H */ diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index 6a83745..1a13c01 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -31,10 +31,7 @@ /* Module Setup */ /****************/ -#define H5E_PACKAGE /*suppress error about including H5Epkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5E__init_deprec_interface +#include "H5Emodule.h" /* This source code file is part of the H5E module */ /***********/ @@ -82,51 +79,6 @@ /*******************/ - -/*-------------------------------------------------------------------------- -NAME - H5E__init_deprec_interface -- Initialize interface-specific information -USAGE - herr_t H5E__init_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5E_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5E__init_deprec_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5E_init()) -} /* H5E__init_deprec_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5E__term_deprec_interface -- Terminate interface -USAGE - herr_t H5E__term_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5E__term_deprec_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5E__term_deprec_interface() */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- diff --git a/src/H5Einit.h b/src/H5Einit.h deleted file mode 100644 index 9724748..0000000 --- a/src/H5Einit.h +++ /dev/null @@ -1,840 +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 files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* Generated automatically by bin/make_err -- do not edit */ -/* Add new errors to H5err.txt file */ - - -#ifndef _H5Einit_H -#define _H5Einit_H - -/*********************/ -/* Major error codes */ -/*********************/ - -assert(H5E_FUNC_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Function entry/exit"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FUNC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_FILE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "File accessibilty"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_SOHM_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Shared Object Header Messages"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SOHM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_SYM_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Symbol table"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SYM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_PLUGIN_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Plugin for dynamically loaded library"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_PLUGIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_VFL_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Virtual File Layer"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_VFL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_INTERNAL_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Internal error (too specific to document in detail)"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_INTERNAL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BTREE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "B-Tree node"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BTREE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_REFERENCE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "References"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_REFERENCE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_DATASPACE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Dataspace"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_DATASPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_RESOURCE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Resource unavailable"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_RESOURCE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_RS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Reference Counted Strings"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_RS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_FARRAY_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Fixed Array"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FARRAY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_HEAP_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Heap"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_HEAP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_ATTR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Attribute"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ATTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_IO_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Low-level I/O"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_IO_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_EFL_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "External file list"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_EFL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_TST_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Ternary Search Trees"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_TST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_FSPACE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Free Space Manager"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FSPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_DATASET_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Dataset"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_DATASET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_STORAGE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Data storage"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_STORAGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_LINK_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Links"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_LINK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_PLIST_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Property lists"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_PLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_DATATYPE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Datatype"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_DATATYPE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_OHDR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object header"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_OHDR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_ATOM_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object atom"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ATOM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_NONE_MAJOR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "No error"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NONE_MAJOR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_SLIST_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Skip Lists"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_ARGS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Invalid arguments to routine"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ARGS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_EARRAY_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Extensible Array"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_EARRAY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_PLINE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Data filters"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_PLINE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_ERROR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Error API"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CACHE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MAJOR, "Object cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CACHE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/*********************/ -/* Minor error codes */ -/*********************/ - - -/* Generic low-level file I/O errors */ -assert(H5E_SEEKERROR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Seek failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SEEKERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_READERROR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Read failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_READERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_WRITEERROR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Write failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_WRITEERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CLOSEERROR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Close failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CLOSEERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_OVERFLOW_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Address overflowed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_OVERFLOW_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_FCNTL_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "File control (fcntl) failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FCNTL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Resource errors */ -assert(H5E_NOSPACE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "No space available for allocation"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOSPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTALLOC_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't allocate space"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTALLOC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCOPY_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to copy object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCOPY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTFREE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to free object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTFREE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_ALREADYEXISTS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Object already exists"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ALREADYEXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTLOCK_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to lock object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTLOCK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTUNLOCK_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to unlock object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTUNLOCK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTGC_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to garbage collect"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTGC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTGETSIZE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to compute size"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTGETSIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_OBJOPEN_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Object is already open"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_OBJOPEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Heap errors */ -assert(H5E_CANTRESTORE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't restore condition"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTRESTORE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCOMPUTE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't compute value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCOMPUTE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTEXTEND_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't extend heap's space"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTEXTEND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTATTACH_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't attach object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTATTACH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTUPDATE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't update object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTUPDATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTOPERATE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't operate on object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTOPERATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Function entry/exit interface errors */ -assert(H5E_CANTINIT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to initialize object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTINIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_ALREADYINIT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Object already initialized"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ALREADYINIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTRELEASE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to release object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTRELEASE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Property list errors */ -assert(H5E_CANTGET_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't get value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTGET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTSET_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't set value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTSET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_DUPCLASS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Duplicate class name in parent class"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_DUPCLASS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_SETDISALLOWED_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Disallowed operation"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SETDISALLOWED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Free space errors */ -assert(H5E_CANTMERGE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't merge objects"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTMERGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTREVIVE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't revive object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTREVIVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTSHRINK_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't shrink container"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTSHRINK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Object header related errors */ -assert(H5E_LINKCOUNT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad object header link count"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_LINKCOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_VERSION_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Wrong version number"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_VERSION_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_ALIGNMENT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Alignment error"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_ALIGNMENT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADMESG_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unrecognized message"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADMESG_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTDELETE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't delete message"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTDELETE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADITER_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Iteration failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADITER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTPACK_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't pack messages"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTPACK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTRESET_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't reset object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTRESET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTRENAME_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to rename object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTRENAME_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* System level errors */ -assert(H5E_SYSERRSTR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "System error message"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SYSERRSTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* I/O pipeline errors */ -assert(H5E_NOFILTER_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Requested filter is not available"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOFILTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CALLBACK_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Callback failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CALLBACK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANAPPLY_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Error from filter 'can apply' callback"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANAPPLY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_SETLOCAL_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Error from filter 'set local' callback"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SETLOCAL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_NOENCODER_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Filter present but encoding disabled"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOENCODER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTFILTER_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Filter operation failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTFILTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Group related errors */ -assert(H5E_CANTOPENOBJ_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't open object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTOPENOBJ_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCLOSEOBJ_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't close object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCLOSEOBJ_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_COMPLEN_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Name component is too long"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_COMPLEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_PATH_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Problem with path to object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_PATH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* No error */ -assert(H5E_NONE_MINOR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "No error"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NONE_MINOR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Plugin errors */ -assert(H5E_OPENERROR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't open directory or file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_OPENERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* File accessibilty errors */ -assert(H5E_FILEEXISTS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "File already exists"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FILEEXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_FILEOPEN_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "File already open"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_FILEOPEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCREATE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to create file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCREATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTOPENFILE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to open file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTOPENFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCLOSEFILE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to close file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCLOSEFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_NOTHDF5_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Not an HDF5 file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOTHDF5_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADFILE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad file ID accessed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_TRUNCATED_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "File has been truncated"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_TRUNCATED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_MOUNT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "File mount error"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_MOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Object atom related errors */ -assert(H5E_BADATOM_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to find atom information (already closed?)"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADATOM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADGROUP_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to find ID group information"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADGROUP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTREGISTER_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to register new atom"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTREGISTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTINC_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to increment reference count"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTINC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTDEC_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to decrement reference count"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTDEC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_NOIDS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Out of IDs for group"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOIDS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Cache related errors */ -assert(H5E_CANTFLUSH_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to flush data from cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTFLUSH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTSERIALIZE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to serialize data from cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTSERIALIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTTAG_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to tag metadata in the cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTTAG_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTLOAD_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to load metadata into cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTLOAD_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_PROTECT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Protected metadata error"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_PROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_NOTCACHED_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Metadata not currently cached"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOTCACHED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_SYSTEM_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Internal error detected"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_SYSTEM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTINS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to insert metadata into cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTINS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTPROTECT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to protect metadata"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTPROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTUNPROTECT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to unprotect metadata"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTUNPROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTPIN_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to pin cache entry"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTPIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTUNPIN_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to un-pin cache entry"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTUNPIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTMARKDIRTY_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to mark a pinned entry as dirty"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTMARKDIRTY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTDIRTY_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to mark metadata as dirty"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTDIRTY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTEXPUNGE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to expunge a metadata cache entry"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTEXPUNGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTRESIZE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to resize a metadata cache entry"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTRESIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTDEPEND_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to create a flush dependency"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTDEPEND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTUNDEPEND_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to destroy a flush dependency"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTUNDEPEND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTNOTIFY_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to notify object about action"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTNOTIFY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Link related errors */ -assert(H5E_TRAVERSE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Link traversal failure"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_TRAVERSE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_NLINKS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Too many soft links in path"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NLINKS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_NOTREGISTERED_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Link class not registered"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOTREGISTERED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTMOVE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't move object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTMOVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTSORT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't sort objects"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTSORT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Parallel MPI errors */ -assert(H5E_MPI_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Some MPI function failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_MPI_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_MPIERRSTR_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "MPI Error String"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_MPIERRSTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTRECV_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't receive data"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTRECV_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Dataspace errors */ -assert(H5E_CANTCLIP_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't clip hyperslab region"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCLIP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCOUNT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't count elements"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTSELECT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't select hyperslab"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTSELECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTNEXT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't move to next iterator location"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTNEXT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADSELECT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Invalid selection"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADSELECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTCOMPARE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't compare objects"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCOMPARE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Argument errors */ -assert(H5E_UNINITIALIZED_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Information is uinitialized"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_UNINITIALIZED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_UNSUPPORTED_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Feature is unsupported"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_UNSUPPORTED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADTYPE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Inappropriate type"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADTYPE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADRANGE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Out of range"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADRANGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADVALUE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADVALUE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* B-tree related errors */ -assert(H5E_NOTFOUND_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Object not found"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_NOTFOUND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_EXISTS_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Object already exists"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_EXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTENCODE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to encode value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTENCODE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTDECODE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to decode value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTDECODE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTSPLIT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to split node"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTSPLIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTREDISTRIBUTE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to redistribute records"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTREDISTRIBUTE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTSWAP_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to swap records"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTSWAP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTINSERT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to insert object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTINSERT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTLIST_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to list node"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTMODIFY_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to modify record"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTMODIFY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_CANTREMOVE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to remove object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTREMOVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -/* Datatype conversion errors */ -assert(H5E_CANTCONVERT_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't convert datatypes"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_CANTCONVERT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -assert(H5E_BADSIZE_g==(-1)); -if((msg = H5E_create_msg(cls, H5E_MINOR, "Bad size for object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") -if((H5E_BADSIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") - -#endif /* H5Einit_H */ diff --git a/src/H5Eint.c b/src/H5Eint.c index 07d1e46..6e84a09 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -28,10 +28,7 @@ /* Module Setup */ /****************/ -#define H5E_PACKAGE /*suppress error about including H5Epkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5E_init_int_interface +#include "H5Emodule.h" /* This source code file is part of the H5E module */ /***********/ @@ -117,27 +114,6 @@ int H5E_mpi_error_str_len; -/*-------------------------------------------------------------------------- -NAME - H5E_init_int_interface -- Initialize interface-specific information -USAGE - herr_t H5E_init_int_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5E_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5E_init_int_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5E_init()) -} /* H5E_init_int_interface() */ - - /*------------------------------------------------------------------------- * Function: H5E_get_msg * @@ -154,7 +130,7 @@ H5E_init_int_interface(void) ssize_t H5E_get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) { - ssize_t len; /* Length of error message */ + ssize_t len = -1; /* Length of error message */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Emodule.h b/src/H5Emodule.h new file mode 100644 index 0000000..d624409 --- /dev/null +++ b/src/H5Emodule.h @@ -0,0 +1,36 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5E package. Including this header means that the source file + * is part of the H5E package. + */ +#ifndef _H5Emodule_H +#define _H5Emodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5E_MODULE +#define H5_MY_PKG H5E +#define H5_MY_PKG_ERR H5E_ERROR +#define H5_MY_PKG_INIT YES + +#endif /* _H5Emodule_H */ + + diff --git a/src/H5Epkg.h b/src/H5Epkg.h index bfaaf9d..3af653a 100644 --- a/src/H5Epkg.h +++ b/src/H5Epkg.h @@ -21,7 +21,7 @@ * the H5E package. Source files outside the H5E package should * include H5Eprivate.h instead. */ -#ifndef H5E_PACKAGE +#if !(defined H5E_FRIEND || defined H5E_MODULE) #error "Do not include this file outside the H5E package!" #endif diff --git a/src/H5Epubgen.h b/src/H5Epubgen.h deleted file mode 100644 index e79106f..0000000 --- a/src/H5Epubgen.h +++ /dev/null @@ -1,380 +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 files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* Generated automatically by bin/make_err -- do not edit */ -/* Add new errors to H5err.txt file */ - - -#ifndef _H5Epubgen_H -#define _H5Epubgen_H - -/*********************/ -/* Major error codes */ -/*********************/ - -#define H5E_FUNC (H5OPEN H5E_FUNC_g) -#define H5E_FILE (H5OPEN H5E_FILE_g) -#define H5E_SOHM (H5OPEN H5E_SOHM_g) -#define H5E_SYM (H5OPEN H5E_SYM_g) -#define H5E_PLUGIN (H5OPEN H5E_PLUGIN_g) -#define H5E_VFL (H5OPEN H5E_VFL_g) -#define H5E_INTERNAL (H5OPEN H5E_INTERNAL_g) -#define H5E_BTREE (H5OPEN H5E_BTREE_g) -#define H5E_REFERENCE (H5OPEN H5E_REFERENCE_g) -#define H5E_DATASPACE (H5OPEN H5E_DATASPACE_g) -#define H5E_RESOURCE (H5OPEN H5E_RESOURCE_g) -#define H5E_RS (H5OPEN H5E_RS_g) -#define H5E_FARRAY (H5OPEN H5E_FARRAY_g) -#define H5E_HEAP (H5OPEN H5E_HEAP_g) -#define H5E_ATTR (H5OPEN H5E_ATTR_g) -#define H5E_IO (H5OPEN H5E_IO_g) -#define H5E_EFL (H5OPEN H5E_EFL_g) -#define H5E_TST (H5OPEN H5E_TST_g) -#define H5E_FSPACE (H5OPEN H5E_FSPACE_g) -#define H5E_DATASET (H5OPEN H5E_DATASET_g) -#define H5E_STORAGE (H5OPEN H5E_STORAGE_g) -#define H5E_LINK (H5OPEN H5E_LINK_g) -#define H5E_PLIST (H5OPEN H5E_PLIST_g) -#define H5E_DATATYPE (H5OPEN H5E_DATATYPE_g) -#define H5E_OHDR (H5OPEN H5E_OHDR_g) -#define H5E_ATOM (H5OPEN H5E_ATOM_g) -#define H5E_NONE_MAJOR (H5OPEN H5E_NONE_MAJOR_g) -#define H5E_SLIST (H5OPEN H5E_SLIST_g) -#define H5E_ARGS (H5OPEN H5E_ARGS_g) -#define H5E_EARRAY (H5OPEN H5E_EARRAY_g) -#define H5E_PLINE (H5OPEN H5E_PLINE_g) -#define H5E_ERROR (H5OPEN H5E_ERROR_g) -#define H5E_CACHE (H5OPEN H5E_CACHE_g) -H5_DLLVAR hid_t H5E_FUNC_g; /* Function entry/exit */ -H5_DLLVAR hid_t H5E_FILE_g; /* File accessibilty */ -H5_DLLVAR hid_t H5E_SOHM_g; /* Shared Object Header Messages */ -H5_DLLVAR hid_t H5E_SYM_g; /* Symbol table */ -H5_DLLVAR hid_t H5E_PLUGIN_g; /* Plugin for dynamically loaded library */ -H5_DLLVAR hid_t H5E_VFL_g; /* Virtual File Layer */ -H5_DLLVAR hid_t H5E_INTERNAL_g; /* Internal error (too specific to document in detail) */ -H5_DLLVAR hid_t H5E_BTREE_g; /* B-Tree node */ -H5_DLLVAR hid_t H5E_REFERENCE_g; /* References */ -H5_DLLVAR hid_t H5E_DATASPACE_g; /* Dataspace */ -H5_DLLVAR hid_t H5E_RESOURCE_g; /* Resource unavailable */ -H5_DLLVAR hid_t H5E_RS_g; /* Reference Counted Strings */ -H5_DLLVAR hid_t H5E_FARRAY_g; /* Fixed Array */ -H5_DLLVAR hid_t H5E_HEAP_g; /* Heap */ -H5_DLLVAR hid_t H5E_ATTR_g; /* Attribute */ -H5_DLLVAR hid_t H5E_IO_g; /* Low-level I/O */ -H5_DLLVAR hid_t H5E_EFL_g; /* External file list */ -H5_DLLVAR hid_t H5E_TST_g; /* Ternary Search Trees */ -H5_DLLVAR hid_t H5E_FSPACE_g; /* Free Space Manager */ -H5_DLLVAR hid_t H5E_DATASET_g; /* Dataset */ -H5_DLLVAR hid_t H5E_STORAGE_g; /* Data storage */ -H5_DLLVAR hid_t H5E_LINK_g; /* Links */ -H5_DLLVAR hid_t H5E_PLIST_g; /* Property lists */ -H5_DLLVAR hid_t H5E_DATATYPE_g; /* Datatype */ -H5_DLLVAR hid_t H5E_OHDR_g; /* Object header */ -H5_DLLVAR hid_t H5E_ATOM_g; /* Object atom */ -H5_DLLVAR hid_t H5E_NONE_MAJOR_g; /* No error */ -H5_DLLVAR hid_t H5E_SLIST_g; /* Skip Lists */ -H5_DLLVAR hid_t H5E_ARGS_g; /* Invalid arguments to routine */ -H5_DLLVAR hid_t H5E_EARRAY_g; /* Extensible Array */ -H5_DLLVAR hid_t H5E_PLINE_g; /* Data filters */ -H5_DLLVAR hid_t H5E_ERROR_g; /* Error API */ -H5_DLLVAR hid_t H5E_CACHE_g; /* Object cache */ - -/*********************/ -/* Minor error codes */ -/*********************/ - -/* Generic low-level file I/O errors */ -#define H5E_SEEKERROR (H5OPEN H5E_SEEKERROR_g) -#define H5E_READERROR (H5OPEN H5E_READERROR_g) -#define H5E_WRITEERROR (H5OPEN H5E_WRITEERROR_g) -#define H5E_CLOSEERROR (H5OPEN H5E_CLOSEERROR_g) -#define H5E_OVERFLOW (H5OPEN H5E_OVERFLOW_g) -#define H5E_FCNTL (H5OPEN H5E_FCNTL_g) -H5_DLLVAR hid_t H5E_SEEKERROR_g; /* Seek failed */ -H5_DLLVAR hid_t H5E_READERROR_g; /* Read failed */ -H5_DLLVAR hid_t H5E_WRITEERROR_g; /* Write failed */ -H5_DLLVAR hid_t H5E_CLOSEERROR_g; /* Close failed */ -H5_DLLVAR hid_t H5E_OVERFLOW_g; /* Address overflowed */ -H5_DLLVAR hid_t H5E_FCNTL_g; /* File control (fcntl) failed */ - -/* Resource errors */ -#define H5E_NOSPACE (H5OPEN H5E_NOSPACE_g) -#define H5E_CANTALLOC (H5OPEN H5E_CANTALLOC_g) -#define H5E_CANTCOPY (H5OPEN H5E_CANTCOPY_g) -#define H5E_CANTFREE (H5OPEN H5E_CANTFREE_g) -#define H5E_ALREADYEXISTS (H5OPEN H5E_ALREADYEXISTS_g) -#define H5E_CANTLOCK (H5OPEN H5E_CANTLOCK_g) -#define H5E_CANTUNLOCK (H5OPEN H5E_CANTUNLOCK_g) -#define H5E_CANTGC (H5OPEN H5E_CANTGC_g) -#define H5E_CANTGETSIZE (H5OPEN H5E_CANTGETSIZE_g) -#define H5E_OBJOPEN (H5OPEN H5E_OBJOPEN_g) -H5_DLLVAR hid_t H5E_NOSPACE_g; /* No space available for allocation */ -H5_DLLVAR hid_t H5E_CANTALLOC_g; /* Can't allocate space */ -H5_DLLVAR hid_t H5E_CANTCOPY_g; /* Unable to copy object */ -H5_DLLVAR hid_t H5E_CANTFREE_g; /* Unable to free object */ -H5_DLLVAR hid_t H5E_ALREADYEXISTS_g; /* Object already exists */ -H5_DLLVAR hid_t H5E_CANTLOCK_g; /* Unable to lock object */ -H5_DLLVAR hid_t H5E_CANTUNLOCK_g; /* Unable to unlock object */ -H5_DLLVAR hid_t H5E_CANTGC_g; /* Unable to garbage collect */ -H5_DLLVAR hid_t H5E_CANTGETSIZE_g; /* Unable to compute size */ -H5_DLLVAR hid_t H5E_OBJOPEN_g; /* Object is already open */ - -/* Heap errors */ -#define H5E_CANTRESTORE (H5OPEN H5E_CANTRESTORE_g) -#define H5E_CANTCOMPUTE (H5OPEN H5E_CANTCOMPUTE_g) -#define H5E_CANTEXTEND (H5OPEN H5E_CANTEXTEND_g) -#define H5E_CANTATTACH (H5OPEN H5E_CANTATTACH_g) -#define H5E_CANTUPDATE (H5OPEN H5E_CANTUPDATE_g) -#define H5E_CANTOPERATE (H5OPEN H5E_CANTOPERATE_g) -H5_DLLVAR hid_t H5E_CANTRESTORE_g; /* Can't restore condition */ -H5_DLLVAR hid_t H5E_CANTCOMPUTE_g; /* Can't compute value */ -H5_DLLVAR hid_t H5E_CANTEXTEND_g; /* Can't extend heap's space */ -H5_DLLVAR hid_t H5E_CANTATTACH_g; /* Can't attach object */ -H5_DLLVAR hid_t H5E_CANTUPDATE_g; /* Can't update object */ -H5_DLLVAR hid_t H5E_CANTOPERATE_g; /* Can't operate on object */ - -/* Function entry/exit interface errors */ -#define H5E_CANTINIT (H5OPEN H5E_CANTINIT_g) -#define H5E_ALREADYINIT (H5OPEN H5E_ALREADYINIT_g) -#define H5E_CANTRELEASE (H5OPEN H5E_CANTRELEASE_g) -H5_DLLVAR hid_t H5E_CANTINIT_g; /* Unable to initialize object */ -H5_DLLVAR hid_t H5E_ALREADYINIT_g; /* Object already initialized */ -H5_DLLVAR hid_t H5E_CANTRELEASE_g; /* Unable to release object */ - -/* Property list errors */ -#define H5E_CANTGET (H5OPEN H5E_CANTGET_g) -#define H5E_CANTSET (H5OPEN H5E_CANTSET_g) -#define H5E_DUPCLASS (H5OPEN H5E_DUPCLASS_g) -#define H5E_SETDISALLOWED (H5OPEN H5E_SETDISALLOWED_g) -H5_DLLVAR hid_t H5E_CANTGET_g; /* Can't get value */ -H5_DLLVAR hid_t H5E_CANTSET_g; /* Can't set value */ -H5_DLLVAR hid_t H5E_DUPCLASS_g; /* Duplicate class name in parent class */ -H5_DLLVAR hid_t H5E_SETDISALLOWED_g; /* Disallowed operation */ - -/* Free space errors */ -#define H5E_CANTMERGE (H5OPEN H5E_CANTMERGE_g) -#define H5E_CANTREVIVE (H5OPEN H5E_CANTREVIVE_g) -#define H5E_CANTSHRINK (H5OPEN H5E_CANTSHRINK_g) -H5_DLLVAR hid_t H5E_CANTMERGE_g; /* Can't merge objects */ -H5_DLLVAR hid_t H5E_CANTREVIVE_g; /* Can't revive object */ -H5_DLLVAR hid_t H5E_CANTSHRINK_g; /* Can't shrink container */ - -/* Object header related errors */ -#define H5E_LINKCOUNT (H5OPEN H5E_LINKCOUNT_g) -#define H5E_VERSION (H5OPEN H5E_VERSION_g) -#define H5E_ALIGNMENT (H5OPEN H5E_ALIGNMENT_g) -#define H5E_BADMESG (H5OPEN H5E_BADMESG_g) -#define H5E_CANTDELETE (H5OPEN H5E_CANTDELETE_g) -#define H5E_BADITER (H5OPEN H5E_BADITER_g) -#define H5E_CANTPACK (H5OPEN H5E_CANTPACK_g) -#define H5E_CANTRESET (H5OPEN H5E_CANTRESET_g) -#define H5E_CANTRENAME (H5OPEN H5E_CANTRENAME_g) -H5_DLLVAR hid_t H5E_LINKCOUNT_g; /* Bad object header link count */ -H5_DLLVAR hid_t H5E_VERSION_g; /* Wrong version number */ -H5_DLLVAR hid_t H5E_ALIGNMENT_g; /* Alignment error */ -H5_DLLVAR hid_t H5E_BADMESG_g; /* Unrecognized message */ -H5_DLLVAR hid_t H5E_CANTDELETE_g; /* Can't delete message */ -H5_DLLVAR hid_t H5E_BADITER_g; /* Iteration failed */ -H5_DLLVAR hid_t H5E_CANTPACK_g; /* Can't pack messages */ -H5_DLLVAR hid_t H5E_CANTRESET_g; /* Can't reset object */ -H5_DLLVAR hid_t H5E_CANTRENAME_g; /* Unable to rename object */ - -/* System level errors */ -#define H5E_SYSERRSTR (H5OPEN H5E_SYSERRSTR_g) -H5_DLLVAR hid_t H5E_SYSERRSTR_g; /* System error message */ - -/* I/O pipeline errors */ -#define H5E_NOFILTER (H5OPEN H5E_NOFILTER_g) -#define H5E_CALLBACK (H5OPEN H5E_CALLBACK_g) -#define H5E_CANAPPLY (H5OPEN H5E_CANAPPLY_g) -#define H5E_SETLOCAL (H5OPEN H5E_SETLOCAL_g) -#define H5E_NOENCODER (H5OPEN H5E_NOENCODER_g) -#define H5E_CANTFILTER (H5OPEN H5E_CANTFILTER_g) -H5_DLLVAR hid_t H5E_NOFILTER_g; /* Requested filter is not available */ -H5_DLLVAR hid_t H5E_CALLBACK_g; /* Callback failed */ -H5_DLLVAR hid_t H5E_CANAPPLY_g; /* Error from filter 'can apply' callback */ -H5_DLLVAR hid_t H5E_SETLOCAL_g; /* Error from filter 'set local' callback */ -H5_DLLVAR hid_t H5E_NOENCODER_g; /* Filter present but encoding disabled */ -H5_DLLVAR hid_t H5E_CANTFILTER_g; /* Filter operation failed */ - -/* Group related errors */ -#define H5E_CANTOPENOBJ (H5OPEN H5E_CANTOPENOBJ_g) -#define H5E_CANTCLOSEOBJ (H5OPEN H5E_CANTCLOSEOBJ_g) -#define H5E_COMPLEN (H5OPEN H5E_COMPLEN_g) -#define H5E_PATH (H5OPEN H5E_PATH_g) -H5_DLLVAR hid_t H5E_CANTOPENOBJ_g; /* Can't open object */ -H5_DLLVAR hid_t H5E_CANTCLOSEOBJ_g; /* Can't close object */ -H5_DLLVAR hid_t H5E_COMPLEN_g; /* Name component is too long */ -H5_DLLVAR hid_t H5E_PATH_g; /* Problem with path to object */ - -/* No error */ -#define H5E_NONE_MINOR (H5OPEN H5E_NONE_MINOR_g) -H5_DLLVAR hid_t H5E_NONE_MINOR_g; /* No error */ - -/* Plugin errors */ -#define H5E_OPENERROR (H5OPEN H5E_OPENERROR_g) -H5_DLLVAR hid_t H5E_OPENERROR_g; /* Can't open directory or file */ - -/* File accessibilty errors */ -#define H5E_FILEEXISTS (H5OPEN H5E_FILEEXISTS_g) -#define H5E_FILEOPEN (H5OPEN H5E_FILEOPEN_g) -#define H5E_CANTCREATE (H5OPEN H5E_CANTCREATE_g) -#define H5E_CANTOPENFILE (H5OPEN H5E_CANTOPENFILE_g) -#define H5E_CANTCLOSEFILE (H5OPEN H5E_CANTCLOSEFILE_g) -#define H5E_NOTHDF5 (H5OPEN H5E_NOTHDF5_g) -#define H5E_BADFILE (H5OPEN H5E_BADFILE_g) -#define H5E_TRUNCATED (H5OPEN H5E_TRUNCATED_g) -#define H5E_MOUNT (H5OPEN H5E_MOUNT_g) -H5_DLLVAR hid_t H5E_FILEEXISTS_g; /* File already exists */ -H5_DLLVAR hid_t H5E_FILEOPEN_g; /* File already open */ -H5_DLLVAR hid_t H5E_CANTCREATE_g; /* Unable to create file */ -H5_DLLVAR hid_t H5E_CANTOPENFILE_g; /* Unable to open file */ -H5_DLLVAR hid_t H5E_CANTCLOSEFILE_g; /* Unable to close file */ -H5_DLLVAR hid_t H5E_NOTHDF5_g; /* Not an HDF5 file */ -H5_DLLVAR hid_t H5E_BADFILE_g; /* Bad file ID accessed */ -H5_DLLVAR hid_t H5E_TRUNCATED_g; /* File has been truncated */ -H5_DLLVAR hid_t H5E_MOUNT_g; /* File mount error */ - -/* Object atom related errors */ -#define H5E_BADATOM (H5OPEN H5E_BADATOM_g) -#define H5E_BADGROUP (H5OPEN H5E_BADGROUP_g) -#define H5E_CANTREGISTER (H5OPEN H5E_CANTREGISTER_g) -#define H5E_CANTINC (H5OPEN H5E_CANTINC_g) -#define H5E_CANTDEC (H5OPEN H5E_CANTDEC_g) -#define H5E_NOIDS (H5OPEN H5E_NOIDS_g) -H5_DLLVAR hid_t H5E_BADATOM_g; /* Unable to find atom information (already closed?) */ -H5_DLLVAR hid_t H5E_BADGROUP_g; /* Unable to find ID group information */ -H5_DLLVAR hid_t H5E_CANTREGISTER_g; /* Unable to register new atom */ -H5_DLLVAR hid_t H5E_CANTINC_g; /* Unable to increment reference count */ -H5_DLLVAR hid_t H5E_CANTDEC_g; /* Unable to decrement reference count */ -H5_DLLVAR hid_t H5E_NOIDS_g; /* Out of IDs for group */ - -/* Cache related errors */ -#define H5E_CANTFLUSH (H5OPEN H5E_CANTFLUSH_g) -#define H5E_CANTSERIALIZE (H5OPEN H5E_CANTSERIALIZE_g) -#define H5E_CANTTAG (H5OPEN H5E_CANTTAG_g) -#define H5E_CANTLOAD (H5OPEN H5E_CANTLOAD_g) -#define H5E_PROTECT (H5OPEN H5E_PROTECT_g) -#define H5E_NOTCACHED (H5OPEN H5E_NOTCACHED_g) -#define H5E_SYSTEM (H5OPEN H5E_SYSTEM_g) -#define H5E_CANTINS (H5OPEN H5E_CANTINS_g) -#define H5E_CANTPROTECT (H5OPEN H5E_CANTPROTECT_g) -#define H5E_CANTUNPROTECT (H5OPEN H5E_CANTUNPROTECT_g) -#define H5E_CANTPIN (H5OPEN H5E_CANTPIN_g) -#define H5E_CANTUNPIN (H5OPEN H5E_CANTUNPIN_g) -#define H5E_CANTMARKDIRTY (H5OPEN H5E_CANTMARKDIRTY_g) -#define H5E_CANTDIRTY (H5OPEN H5E_CANTDIRTY_g) -#define H5E_CANTEXPUNGE (H5OPEN H5E_CANTEXPUNGE_g) -#define H5E_CANTRESIZE (H5OPEN H5E_CANTRESIZE_g) -#define H5E_CANTDEPEND (H5OPEN H5E_CANTDEPEND_g) -#define H5E_CANTUNDEPEND (H5OPEN H5E_CANTUNDEPEND_g) -#define H5E_CANTNOTIFY (H5OPEN H5E_CANTNOTIFY_g) -H5_DLLVAR hid_t H5E_CANTFLUSH_g; /* Unable to flush data from cache */ -H5_DLLVAR hid_t H5E_CANTSERIALIZE_g; /* Unable to serialize data from cache */ -H5_DLLVAR hid_t H5E_CANTTAG_g; /* Unable to tag metadata in the cache */ -H5_DLLVAR hid_t H5E_CANTLOAD_g; /* Unable to load metadata into cache */ -H5_DLLVAR hid_t H5E_PROTECT_g; /* Protected metadata error */ -H5_DLLVAR hid_t H5E_NOTCACHED_g; /* Metadata not currently cached */ -H5_DLLVAR hid_t H5E_SYSTEM_g; /* Internal error detected */ -H5_DLLVAR hid_t H5E_CANTINS_g; /* Unable to insert metadata into cache */ -H5_DLLVAR hid_t H5E_CANTPROTECT_g; /* Unable to protect metadata */ -H5_DLLVAR hid_t H5E_CANTUNPROTECT_g; /* Unable to unprotect metadata */ -H5_DLLVAR hid_t H5E_CANTPIN_g; /* Unable to pin cache entry */ -H5_DLLVAR hid_t H5E_CANTUNPIN_g; /* Unable to un-pin cache entry */ -H5_DLLVAR hid_t H5E_CANTMARKDIRTY_g; /* Unable to mark a pinned entry as dirty */ -H5_DLLVAR hid_t H5E_CANTDIRTY_g; /* Unable to mark metadata as dirty */ -H5_DLLVAR hid_t H5E_CANTEXPUNGE_g; /* Unable to expunge a metadata cache entry */ -H5_DLLVAR hid_t H5E_CANTRESIZE_g; /* Unable to resize a metadata cache entry */ -H5_DLLVAR hid_t H5E_CANTDEPEND_g; /* Unable to create a flush dependency */ -H5_DLLVAR hid_t H5E_CANTUNDEPEND_g; /* Unable to destroy a flush dependency */ -H5_DLLVAR hid_t H5E_CANTNOTIFY_g; /* Unable to notify object about action */ - -/* Link related errors */ -#define H5E_TRAVERSE (H5OPEN H5E_TRAVERSE_g) -#define H5E_NLINKS (H5OPEN H5E_NLINKS_g) -#define H5E_NOTREGISTERED (H5OPEN H5E_NOTREGISTERED_g) -#define H5E_CANTMOVE (H5OPEN H5E_CANTMOVE_g) -#define H5E_CANTSORT (H5OPEN H5E_CANTSORT_g) -H5_DLLVAR hid_t H5E_TRAVERSE_g; /* Link traversal failure */ -H5_DLLVAR hid_t H5E_NLINKS_g; /* Too many soft links in path */ -H5_DLLVAR hid_t H5E_NOTREGISTERED_g; /* Link class not registered */ -H5_DLLVAR hid_t H5E_CANTMOVE_g; /* Can't move object */ -H5_DLLVAR hid_t H5E_CANTSORT_g; /* Can't sort objects */ - -/* Parallel MPI errors */ -#define H5E_MPI (H5OPEN H5E_MPI_g) -#define H5E_MPIERRSTR (H5OPEN H5E_MPIERRSTR_g) -#define H5E_CANTRECV (H5OPEN H5E_CANTRECV_g) -H5_DLLVAR hid_t H5E_MPI_g; /* Some MPI function failed */ -H5_DLLVAR hid_t H5E_MPIERRSTR_g; /* MPI Error String */ -H5_DLLVAR hid_t H5E_CANTRECV_g; /* Can't receive data */ - -/* Dataspace errors */ -#define H5E_CANTCLIP (H5OPEN H5E_CANTCLIP_g) -#define H5E_CANTCOUNT (H5OPEN H5E_CANTCOUNT_g) -#define H5E_CANTSELECT (H5OPEN H5E_CANTSELECT_g) -#define H5E_CANTNEXT (H5OPEN H5E_CANTNEXT_g) -#define H5E_BADSELECT (H5OPEN H5E_BADSELECT_g) -#define H5E_CANTCOMPARE (H5OPEN H5E_CANTCOMPARE_g) -H5_DLLVAR hid_t H5E_CANTCLIP_g; /* Can't clip hyperslab region */ -H5_DLLVAR hid_t H5E_CANTCOUNT_g; /* Can't count elements */ -H5_DLLVAR hid_t H5E_CANTSELECT_g; /* Can't select hyperslab */ -H5_DLLVAR hid_t H5E_CANTNEXT_g; /* Can't move to next iterator location */ -H5_DLLVAR hid_t H5E_BADSELECT_g; /* Invalid selection */ -H5_DLLVAR hid_t H5E_CANTCOMPARE_g; /* Can't compare objects */ - -/* Argument errors */ -#define H5E_UNINITIALIZED (H5OPEN H5E_UNINITIALIZED_g) -#define H5E_UNSUPPORTED (H5OPEN H5E_UNSUPPORTED_g) -#define H5E_BADTYPE (H5OPEN H5E_BADTYPE_g) -#define H5E_BADRANGE (H5OPEN H5E_BADRANGE_g) -#define H5E_BADVALUE (H5OPEN H5E_BADVALUE_g) -H5_DLLVAR hid_t H5E_UNINITIALIZED_g; /* Information is uinitialized */ -H5_DLLVAR hid_t H5E_UNSUPPORTED_g; /* Feature is unsupported */ -H5_DLLVAR hid_t H5E_BADTYPE_g; /* Inappropriate type */ -H5_DLLVAR hid_t H5E_BADRANGE_g; /* Out of range */ -H5_DLLVAR hid_t H5E_BADVALUE_g; /* Bad value */ - -/* B-tree related errors */ -#define H5E_NOTFOUND (H5OPEN H5E_NOTFOUND_g) -#define H5E_EXISTS (H5OPEN H5E_EXISTS_g) -#define H5E_CANTENCODE (H5OPEN H5E_CANTENCODE_g) -#define H5E_CANTDECODE (H5OPEN H5E_CANTDECODE_g) -#define H5E_CANTSPLIT (H5OPEN H5E_CANTSPLIT_g) -#define H5E_CANTREDISTRIBUTE (H5OPEN H5E_CANTREDISTRIBUTE_g) -#define H5E_CANTSWAP (H5OPEN H5E_CANTSWAP_g) -#define H5E_CANTINSERT (H5OPEN H5E_CANTINSERT_g) -#define H5E_CANTLIST (H5OPEN H5E_CANTLIST_g) -#define H5E_CANTMODIFY (H5OPEN H5E_CANTMODIFY_g) -#define H5E_CANTREMOVE (H5OPEN H5E_CANTREMOVE_g) -H5_DLLVAR hid_t H5E_NOTFOUND_g; /* Object not found */ -H5_DLLVAR hid_t H5E_EXISTS_g; /* Object already exists */ -H5_DLLVAR hid_t H5E_CANTENCODE_g; /* Unable to encode value */ -H5_DLLVAR hid_t H5E_CANTDECODE_g; /* Unable to decode value */ -H5_DLLVAR hid_t H5E_CANTSPLIT_g; /* Unable to split node */ -H5_DLLVAR hid_t H5E_CANTREDISTRIBUTE_g; /* Unable to redistribute records */ -H5_DLLVAR hid_t H5E_CANTSWAP_g; /* Unable to swap records */ -H5_DLLVAR hid_t H5E_CANTINSERT_g; /* Unable to insert object */ -H5_DLLVAR hid_t H5E_CANTLIST_g; /* Unable to list node */ -H5_DLLVAR hid_t H5E_CANTMODIFY_g; /* Unable to modify record */ -H5_DLLVAR hid_t H5E_CANTREMOVE_g; /* Unable to remove object */ - -/* Datatype conversion errors */ -#define H5E_CANTCONVERT (H5OPEN H5E_CANTCONVERT_g) -#define H5E_BADSIZE (H5OPEN H5E_BADSIZE_g) -H5_DLLVAR hid_t H5E_CANTCONVERT_g; /* Can't convert datatypes */ -H5_DLLVAR hid_t H5E_BADSIZE_g; /* Bad size for object */ - -#endif /* H5Epubgen_H */ diff --git a/src/H5Eterm.h b/src/H5Eterm.h deleted file mode 100644 index 5db503c..0000000 --- a/src/H5Eterm.h +++ /dev/null @@ -1,224 +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 files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* Generated automatically by bin/make_err -- do not edit */ -/* Add new errors to H5err.txt file */ - - -#ifndef _H5Eterm_H -#define _H5Eterm_H - -/* Reset major error IDs */ - -H5E_FUNC_g= -H5E_FILE_g= -H5E_SOHM_g= -H5E_SYM_g= -H5E_PLUGIN_g= -H5E_VFL_g= -H5E_INTERNAL_g= -H5E_BTREE_g= -H5E_REFERENCE_g= -H5E_DATASPACE_g= -H5E_RESOURCE_g= -H5E_RS_g= -H5E_FARRAY_g= -H5E_HEAP_g= -H5E_ATTR_g= -H5E_IO_g= -H5E_EFL_g= -H5E_TST_g= -H5E_FSPACE_g= -H5E_DATASET_g= -H5E_STORAGE_g= -H5E_LINK_g= -H5E_PLIST_g= -H5E_DATATYPE_g= -H5E_OHDR_g= -H5E_ATOM_g= -H5E_NONE_MAJOR_g= -H5E_SLIST_g= -H5E_ARGS_g= -H5E_EARRAY_g= -H5E_PLINE_g= -H5E_ERROR_g= -H5E_CACHE_g= (-1); - -/* Reset minor error IDs */ - - -/* Generic low-level file I/O errors */ -H5E_SEEKERROR_g= -H5E_READERROR_g= -H5E_WRITEERROR_g= -H5E_CLOSEERROR_g= -H5E_OVERFLOW_g= -H5E_FCNTL_g= - -/* Resource errors */ -H5E_NOSPACE_g= -H5E_CANTALLOC_g= -H5E_CANTCOPY_g= -H5E_CANTFREE_g= -H5E_ALREADYEXISTS_g= -H5E_CANTLOCK_g= -H5E_CANTUNLOCK_g= -H5E_CANTGC_g= -H5E_CANTGETSIZE_g= -H5E_OBJOPEN_g= - -/* Heap errors */ -H5E_CANTRESTORE_g= -H5E_CANTCOMPUTE_g= -H5E_CANTEXTEND_g= -H5E_CANTATTACH_g= -H5E_CANTUPDATE_g= -H5E_CANTOPERATE_g= - -/* Function entry/exit interface errors */ -H5E_CANTINIT_g= -H5E_ALREADYINIT_g= -H5E_CANTRELEASE_g= - -/* Property list errors */ -H5E_CANTGET_g= -H5E_CANTSET_g= -H5E_DUPCLASS_g= -H5E_SETDISALLOWED_g= - -/* Free space errors */ -H5E_CANTMERGE_g= -H5E_CANTREVIVE_g= -H5E_CANTSHRINK_g= - -/* Object header related errors */ -H5E_LINKCOUNT_g= -H5E_VERSION_g= -H5E_ALIGNMENT_g= -H5E_BADMESG_g= -H5E_CANTDELETE_g= -H5E_BADITER_g= -H5E_CANTPACK_g= -H5E_CANTRESET_g= -H5E_CANTRENAME_g= - -/* System level errors */ -H5E_SYSERRSTR_g= - -/* I/O pipeline errors */ -H5E_NOFILTER_g= -H5E_CALLBACK_g= -H5E_CANAPPLY_g= -H5E_SETLOCAL_g= -H5E_NOENCODER_g= -H5E_CANTFILTER_g= - -/* Group related errors */ -H5E_CANTOPENOBJ_g= -H5E_CANTCLOSEOBJ_g= -H5E_COMPLEN_g= -H5E_PATH_g= - -/* No error */ -H5E_NONE_MINOR_g= - -/* Plugin errors */ -H5E_OPENERROR_g= - -/* File accessibilty errors */ -H5E_FILEEXISTS_g= -H5E_FILEOPEN_g= -H5E_CANTCREATE_g= -H5E_CANTOPENFILE_g= -H5E_CANTCLOSEFILE_g= -H5E_NOTHDF5_g= -H5E_BADFILE_g= -H5E_TRUNCATED_g= -H5E_MOUNT_g= - -/* Object atom related errors */ -H5E_BADATOM_g= -H5E_BADGROUP_g= -H5E_CANTREGISTER_g= -H5E_CANTINC_g= -H5E_CANTDEC_g= -H5E_NOIDS_g= - -/* Cache related errors */ -H5E_CANTFLUSH_g= -H5E_CANTSERIALIZE_g= -H5E_CANTTAG_g= -H5E_CANTLOAD_g= -H5E_PROTECT_g= -H5E_NOTCACHED_g= -H5E_SYSTEM_g= -H5E_CANTINS_g= -H5E_CANTPROTECT_g= -H5E_CANTUNPROTECT_g= -H5E_CANTPIN_g= -H5E_CANTUNPIN_g= -H5E_CANTMARKDIRTY_g= -H5E_CANTDIRTY_g= -H5E_CANTEXPUNGE_g= -H5E_CANTRESIZE_g= -H5E_CANTDEPEND_g= -H5E_CANTUNDEPEND_g= -H5E_CANTNOTIFY_g= - -/* Link related errors */ -H5E_TRAVERSE_g= -H5E_NLINKS_g= -H5E_NOTREGISTERED_g= -H5E_CANTMOVE_g= -H5E_CANTSORT_g= - -/* Parallel MPI errors */ -H5E_MPI_g= -H5E_MPIERRSTR_g= -H5E_CANTRECV_g= - -/* Dataspace errors */ -H5E_CANTCLIP_g= -H5E_CANTCOUNT_g= -H5E_CANTSELECT_g= -H5E_CANTNEXT_g= -H5E_BADSELECT_g= -H5E_CANTCOMPARE_g= - -/* Argument errors */ -H5E_UNINITIALIZED_g= -H5E_UNSUPPORTED_g= -H5E_BADTYPE_g= -H5E_BADRANGE_g= -H5E_BADVALUE_g= - -/* B-tree related errors */ -H5E_NOTFOUND_g= -H5E_EXISTS_g= -H5E_CANTENCODE_g= -H5E_CANTDECODE_g= -H5E_CANTSPLIT_g= -H5E_CANTREDISTRIBUTE_g= -H5E_CANTSWAP_g= -H5E_CANTINSERT_g= -H5E_CANTLIST_g= -H5E_CANTMODIFY_g= -H5E_CANTREMOVE_g= - -/* Datatype conversion errors */ -H5E_CANTCONVERT_g= -H5E_BADSIZE_g= (-1); - -#endif /* H5Eterm_H */ @@ -17,10 +17,7 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5F__init_pub_interface +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ @@ -66,6 +63,9 @@ /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -88,21 +88,21 @@ static const H5I_class_t H5I_FILE_CLS[1] = {{ /*-------------------------------------------------------------------------- NAME - H5F__init_pub_interface -- Initialize interface-specific information + H5F__init_package -- Initialize interface-specific information USAGE - herr_t H5F__init_pub_interface() + herr_t H5F__init_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5F_init() currently). + Initializes any interface-specific data or routines. --------------------------------------------------------------------------*/ -static herr_t -H5F__init_pub_interface(void) +herr_t +H5F__init_package(void) { - herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE /* * Initialize the atom group for the file IDs. @@ -110,40 +110,13 @@ H5F__init_pub_interface(void) if(H5I_register_type(H5I_FILE_CLS) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to initialize interface") - ret_value = H5F_init(); -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5F__init_pub_interface() */ - - -/*------------------------------------------------------------------------- - * Function: H5F_init - * - * Purpose: Initialize the interface from some other layer. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Robb Matzke - * Wednesday, December 16, 1998 - * - *------------------------------------------------------------------------- - */ -herr_t -H5F_init(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - /* FUNC_ENTER() does all the work */ - done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_init() */ +} /* H5F__init_package() */ /*------------------------------------------------------------------------- - * Function: H5F_term_interface + * Function: H5F_term_package * * Purpose: Terminate this interface: free all memory and reset global * variables to their initial values. Release all ID groups @@ -161,13 +134,13 @@ done: *------------------------------------------------------------------------- */ int -H5F_term_interface(void) +H5F_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5_PKG_INIT_VAR) { if(H5I_nmembers(H5I_FILE) > 0) { (void)H5I_clear_type(H5I_FILE, FALSE, FALSE); n++; /*H5I*/ @@ -176,20 +149,17 @@ H5F_term_interface(void) /* Make certain we've cleaned up all the shared file objects */ H5F_sfile_assert_num(0); - /* Close deprecated interface */ - n += H5F__term_deprec_interface(); - /* Destroy the file object id group */ - (void)H5I_dec_type_ref(H5I_FILE); - n++; /*H5I*/ + n += (H5I_dec_type_ref(H5I_FILE) > 0); /* Mark closed */ - H5_interface_initialize_g = 0; + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5F_term_interface() */ +} /* end H5F_term_package() */ /*------------------------------------------------------------------------- @@ -29,7 +29,7 @@ /* Module Declaration */ /**********************/ -#define H5FA_MODULE +#include "H5FAmodule.h" /* This source code file is part of the H5FA module */ /***********************/ /* Other Packages Used */ @@ -70,6 +70,9 @@ /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Fixed array client ID to class mapping */ /* Remember to add client ID to H5FA_cls_id_t in H5FAprivate.h when adding a new diff --git a/src/H5FAcache.c b/src/H5FAcache.c index b95da40..f3396be 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -28,7 +28,7 @@ /* Module Declaration */ /**********************/ -#define H5FA_MODULE +#include "H5FAmodule.h" /* This source code file is part of the H5FA module */ /***********************/ diff --git a/src/H5FAdbg.c b/src/H5FAdbg.c index 6a84fc9..2f8fda2 100644 --- a/src/H5FAdbg.c +++ b/src/H5FAdbg.c @@ -26,7 +26,7 @@ /* Module Declaration */ /**********************/ -#define H5FA_MODULE +#include "H5FAmodule.h" /* This source code file is part of the H5FA module */ /***********************/ diff --git a/src/H5FAdblkpage.c b/src/H5FAdblkpage.c index e1ea3ac..00eb398 100644 --- a/src/H5FAdblkpage.c +++ b/src/H5FAdblkpage.c @@ -26,7 +26,7 @@ /* Module Declaration */ /**********************/ -#define H5FA_MODULE +#include "H5FAmodule.h" /* This source code file is part of the H5FA module */ /***********************/ diff --git a/src/H5FAdblock.c b/src/H5FAdblock.c index 42dafeb..71b618c 100644 --- a/src/H5FAdblock.c +++ b/src/H5FAdblock.c @@ -26,7 +26,7 @@ /* Module Declaration */ /**********************/ -#define H5FA_MODULE +#include "H5FAmodule.h" /* This source code file is part of the H5FA module */ /***********************/ diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c index 9083a52..49d22f3 100644 --- a/src/H5FAhdr.c +++ b/src/H5FAhdr.c @@ -26,7 +26,7 @@ /* Module Declaration */ /**********************/ -#define H5FA_MODULE +#include "H5FAmodule.h" /* This source code file is part of the H5FA module */ /***********************/ diff --git a/src/H5FAmodule.h b/src/H5FAmodule.h new file mode 100644 index 0000000..e46b071 --- /dev/null +++ b/src/H5FAmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5FA package. Including this header means that the source file + * is part of the H5FA package. + */ +#ifndef _H5FAmodule_H +#define _H5FAmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5FA_MODULE +#define H5_MY_PKG H5FA +#define H5_MY_PKG_ERR H5E_FARRAY +#define H5_MY_PKG_INIT NO + +#endif /* _H5FAmodule_H */ + diff --git a/src/H5FApkg.h b/src/H5FApkg.h index bed9c83..ddf3a07 100644 --- a/src/H5FApkg.h +++ b/src/H5FApkg.h @@ -20,7 +20,7 @@ * the H5FA package. Source files outside the H5FA package should * include H5FAprivate.h instead. */ -#if !(defined(H5FA_PACKAGE) | defined(H5FA_MODULE)) +#if !(defined(H5FA_FRIEND) | defined(H5FA_MODULE)) #error "Do not include this file outside the H5FA package!" #endif @@ -43,16 +43,6 @@ /* #define H5FA_DEBUG */ -/* If this package header is being included in one of the H5FA modules, define - * the proper control macros for the generic FUNC_ENTER/LEAVE and error - * reporting macros. - */ -#ifdef H5FA_MODULE -#define H5_MY_PKG H5FA -#define H5_MY_PKG_ERR H5E_FARRAY -#define H5_MY_PKG_INIT NO -#endif /* H5FA_MODULE */ - /* Fill value for fixed array test class */ #ifdef H5FA_TESTING #define H5FA_TEST_FILL ((uint64_t)ULLONG_MAX) diff --git a/src/H5FAstat.c b/src/H5FAstat.c index bed6c6e..4ded4c1 100644 --- a/src/H5FAstat.c +++ b/src/H5FAstat.c @@ -26,7 +26,7 @@ /* Module Declaration */ /**********************/ -#define H5FA_MODULE +#include "H5FAmodule.h" /* This source code file is part of the H5FA module */ /***********************/ diff --git a/src/H5FAtest.c b/src/H5FAtest.c index acb2d06..528f550 100644 --- a/src/H5FAtest.c +++ b/src/H5FAtest.c @@ -24,7 +24,7 @@ /* Module Declaration */ /**********************/ -#define H5FA_MODULE +#include "H5FAmodule.h" /* This source code file is part of the H5FA module */ #define H5FA_TESTING @@ -28,11 +28,8 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5FD_PACKAGE /*suppress error about including H5FDpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_init_interface +#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#include "H5FDmodule.h" /* This source code file is part of the H5FD module */ /***********/ @@ -65,12 +62,7 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5FD_pl_copy(void *(*copy_func)(const void *), size_t pl_size, - const void *old_pl, void **copied_pl); -static herr_t H5FD_pl_close(hid_t driver_id, herr_t (*free_func)(void *), - void *pl); static herr_t H5FD_free_cls(H5FD_class_t *cls); -static herr_t H5FD_fapl_copy(hid_t driver_id, const void *fapl, void **copied_fapl); static int H5FD_query(const H5FD_t *f, unsigned long *flags/*out*/); static int H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*out*/); @@ -78,6 +70,9 @@ static int H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*o /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -113,53 +108,24 @@ static const H5I_class_t H5I_VFL_CLS[1] = {{ /*------------------------------------------------------------------------- - * Function: H5FD_init - * - * Purpose: Initialize the interface from some other package. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Quincey Koziol - * Thursday, January 3, 2007 - * - *------------------------------------------------------------------------- - */ -herr_t -H5FD_init(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - /* FUNC_ENTER() does all the work */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_init() */ - - -/*------------------------------------------------------------------------- - * Function: H5FD_init_interface + * Function: H5FD__init_package * * Purpose: Initialize the virtual file layer. * * Return: Success: Non-negative - * * Failure: Negative * * Programmer: Robb Matzke * Monday, July 26, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ -static herr_t -H5FD_init_interface(void) +herr_t +H5FD__init_package(void) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE if(H5I_register_type(H5I_VFL_CLS) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface") @@ -169,11 +135,11 @@ H5FD_init_interface(void) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_init_interface() */ +} /* end H5FD__init_package() */ /*------------------------------------------------------------------------- - * Function: H5FD_term_interface + * Function: H5FD_term_package * * Purpose: Terminate this interface: free all memory and reset global * variables to their initial values. Release all ID groups @@ -182,40 +148,37 @@ done: * Return: Success: Positive if anything was done that might * have affected other interfaces; zero * otherwise. - * * Failure: Never fails. * * Programmer: Robb Matzke * Friday, February 19, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ int -H5FD_term_interface(void) +H5FD_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5_PKG_INIT_VAR) { if(H5I_nmembers(H5I_VFL) > 0) { (void)H5I_clear_type(H5I_VFL, FALSE, FALSE); n++; /*H5I*/ } /* end if */ else { /* Destroy the VFL driver id group */ - (void)H5I_dec_type_ref(H5I_VFL); - n++; /*H5I*/ + n += (H5I_dec_type_ref(H5I_VFL) > 0); /* Mark closed */ - H5_interface_initialize_g = 0; + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5FD_term_interface() */ +} /* end H5FD_term_package() */ /*------------------------------------------------------------------------- @@ -223,7 +186,7 @@ H5FD_term_interface(void) * * Purpose: Frees a file driver class struct and returns an indication of * success. This function is used as the free callback for the - * virtual file layer object identifiers (cf H5FD_init_interface). + * virtual file layer object identifiers (cf H5FD__init_package). * * Return: Success: Non-negative * @@ -350,7 +313,7 @@ H5FD_register(const void *_cls, size_t size, hbool_t app_ref) const H5FD_class_t *cls = (const H5FD_class_t *)_cls; H5FD_class_t *saved = NULL; H5FD_mem_t type; - hid_t ret_value; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -450,16 +413,17 @@ H5FD_get_class(hid_t id) ret_value = (H5FD_class_t *)H5I_object(id); else { H5P_genplist_t *plist; /* Property list pointer */ - hid_t driver_id = -1; /* Get the plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID") if(TRUE == H5P_isa_class(id, H5P_FILE_ACCESS)) { - if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID") - ret_value = H5FD_get_class(driver_id); + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ + + if(H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID & info") + ret_value = H5FD_get_class(driver_prop.driver_id); } /* end if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a driver id or file access property list") @@ -614,96 +578,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_pl_copy - * - * Purpose: Copies the driver-specific part of the a property list. - * This is common code, used by both the dataset transfer and - * file access property list routines. - * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Quincey Koziol - * Thursday, October 23, 2003 - * - * Modifications: - * Pedro Vicente Nunes, Wednesday, July 26, 2006 - * added a HGOTO_ERROR call in the case the copy function returns NULL - * - *------------------------------------------------------------------------- - */ -static herr_t -H5FD_pl_copy(void *(*copy_func)(const void *), size_t pl_size, const void *old_pl, void **copied_pl) -{ - void *new_pl = NULL; /* Copy of property list */ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Copy old pl, if one exists */ - if(old_pl) { - /* Allow the driver to copy or do it ourselves */ - if(copy_func) { - new_pl = (copy_func)(old_pl); - if(new_pl==NULL) - HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, FAIL, "property list copy failed") - } else if(pl_size>0) { - if((new_pl = H5MM_malloc(pl_size))==NULL) - HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, FAIL, "property list allocation failed") - HDmemcpy(new_pl, old_pl, pl_size); - } else - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "no way to copy driver property list") - } /* end if */ - - /* Set copied value */ - *copied_pl=new_pl; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_pl_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5FD_pl_close - * - * Purpose: Closes a driver for a property list - * This is common code, used by both the dataset transfer and - * file access property list routines. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Quincey Koziol - * Thursday, October 23, 2003 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5FD_pl_close(hid_t driver_id, herr_t (*free_func)(void *), void *pl) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Allow driver to free or do it ourselves */ - if(pl && free_func) { - if((free_func)(pl) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver free request failed") - } /* end if */ - else - H5MM_xfree(pl); - - /* Decrement reference count for driver */ - if(H5I_dec_ref(driver_id) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't decrement reference count for driver") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_pl_close() */ - - -/*------------------------------------------------------------------------- * Function: H5FD_fapl_get * * Purpose: Gets the file access property list associated with a file. @@ -725,8 +599,6 @@ done: * Programmer: Robb Matzke * Friday, August 13, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -747,88 +619,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_fapl_open - * - * Purpose: Mark a driver as used by a file access property list - * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Quincey Koziol - * Thursday, October 23, 2003 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5FD_fapl_open(H5P_genplist_t *plist, hid_t driver_id, const void *driver_info) -{ - void *copied_driver_info = NULL; /* Temporary VFL driver info */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Increment the reference count on driver and copy driver info */ - if(H5I_inc_ref(driver_id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver") - if(H5FD_fapl_copy(driver_id, driver_info, &copied_driver_info) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "can't copy VFL driver info") - - /* Set the driver properties for the list */ - if(H5P_set(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set driver ID") - if(H5P_set(plist, H5F_ACS_FILE_DRV_INFO_NAME, &copied_driver_info) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set driver info") - copied_driver_info = NULL; - -done: - if(ret_value < 0) - if(copied_driver_info && H5FD_fapl_close(driver_id, copied_driver_info) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close copy of driver info") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_fapl_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5FD_fapl_copy - * - * Purpose: Copies the driver-specific part of the file access property - * list. - * - * Return: Success: non-negative - * - * Failure: negative - * - * Programmer: Robb Matzke - * Tuesday, August 3, 1999 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5FD_fapl_copy(hid_t driver_id, const void *old_fapl, void **copied_fapl) -{ - H5FD_class_t *driver; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Check args */ - if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID") - - /* Copy the file access property list */ - if(H5FD_pl_copy(driver->fapl_copy, driver->fapl_size, old_fapl, copied_fapl) < 0) - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "can't copy driver file access property list") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - - -/*------------------------------------------------------------------------- * Function: H5FD_fapl_close * * Purpose: Closes a driver for a dataset transfer property list @@ -839,26 +629,32 @@ done: * Programmer: Robb Matzke * Tuesday, August 3, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5FD_fapl_close(hid_t driver_id, void *fapl) +H5FD_fapl_close(hid_t driver_id, const void *driver_info) { - H5FD_class_t *driver = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Check args */ if(driver_id > 0) { + H5FD_class_t *driver; + + /* Retrieve the driver for the ID */ if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID") - /* Close the driver for the property list */ - if(H5FD_pl_close(driver_id, driver->fapl_free, fapl) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver fapl_free request failed") + /* Allow driver to free info or do it ourselves */ + if(driver_info) { + if(driver->fapl_free) { + if((driver->fapl_free)((void *)driver_info) < 0) /* Casting away const OK -QAK */ + HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed") + } /* end if */ + else + H5MM_xfree((void *)driver_info); /* Casting away const OK -QAK */ + } /* end if */ } /* end if */ done: @@ -970,11 +766,11 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { H5FD_class_t *driver; /* VFD for file */ H5FD_t *file = NULL; /* VFD file struct */ - hid_t driver_id = -1; /* VFD ID */ + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ H5P_genplist_t *plist; /* Property list pointer */ unsigned long driver_flags = 0; /* File-inspecific driver feature flags */ H5FD_file_image_info_t file_image_info; /* Initial file image */ - H5FD_t *ret_value; /* Return value */ + H5FD_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -987,11 +783,11 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") /* Get the VFD to open the file with */ - if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID") + if(H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID & info") /* Get driver info */ - if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_id))) + if(NULL == (driver = (H5FD_class_t *)H5I_object(driver_prop.driver_id))) HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list") if(NULL == driver->open) HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method") @@ -1000,7 +796,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5FD_driver_query(driver, &driver_flags); /* Get initial file image info */ - if(H5P_get(plist, H5F_ACS_FILE_IMAGE_INFO_NAME, &file_image_info) < 0) + if(H5P_peek(plist, H5F_ACS_FILE_IMAGE_INFO_NAME, &file_image_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file image info") /* If an image is provided, make sure the driver supports this feature */ @@ -1019,7 +815,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) * Fill in public fields. We must increment the reference count on the * driver ID to prevent it from being freed while this file is open. */ - file->driver_id = driver_id; + file->driver_id = driver_prop.driver_id; if(H5I_inc_ref(file->driver_id, FALSE) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver") file->cls = driver; @@ -1189,7 +985,7 @@ done: int H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2) { - int ret_value; + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(-1) /*return value is arbitrary*/ @@ -1602,7 +1398,7 @@ done: haddr_t H5FD_get_maxaddr(const H5FD_t *file) { - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) diff --git a/src/H5FDcore.c b/src/H5FDcore.c index e553f6b..17ec07c 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -22,8 +22,7 @@ * access to small, temporary hdf5 files. */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_core_init_interface +#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -122,57 +121,57 @@ typedef struct H5FD_core_fapl_t { (size_t)((A)+(Z))<(size_t)(A)) /* Prototypes */ -static herr_t H5FD_core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end); -static herr_t H5FD_core_destroy_dirty_list(H5FD_core_t *file); -static herr_t H5FD_core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size); -static herr_t H5FD_core_term(void); -static void *H5FD_core_fapl_get(H5FD_t *_file); -static H5FD_t *H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, +static herr_t H5FD__core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end); +static herr_t H5FD__core_destroy_dirty_list(H5FD_core_t *file); +static herr_t H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size); +static herr_t H5FD__core_term(void); +static void *H5FD__core_fapl_get(H5FD_t *_file); +static H5FD_t *H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); -static herr_t H5FD_core_close(H5FD_t *_file); -static int H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static herr_t H5FD_core_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_core_get_eoa(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_core_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); -static haddr_t H5FD_core_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); -static herr_t H5FD_core_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, +static herr_t H5FD__core_close(H5FD_t *_file); +static int H5FD__core_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD__core_query(const H5FD_t *_f1, unsigned long *flags); +static haddr_t H5FD__core_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__core_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD__core_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD__core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); +static herr_t H5FD__core_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_core_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, +static herr_t H5FD__core_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_core_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); -static herr_t H5FD_core_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__core_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); +static herr_t H5FD__core_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static const H5FD_class_t H5FD_core_g = { "core", /* name */ MAXADDR, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ - H5FD_core_term, /* terminate */ + H5FD__core_term, /* terminate */ NULL, /* sb_size */ NULL, /* sb_encode */ NULL, /* sb_decode */ sizeof(H5FD_core_fapl_t), /* fapl_size */ - H5FD_core_fapl_get, /* fapl_get */ + H5FD__core_fapl_get, /* fapl_get */ NULL, /* fapl_copy */ NULL, /* fapl_free */ 0, /* dxpl_size */ NULL, /* dxpl_copy */ NULL, /* dxpl_free */ - H5FD_core_open, /* open */ - H5FD_core_close, /* close */ - H5FD_core_cmp, /* cmp */ - H5FD_core_query, /* query */ + H5FD__core_open, /* open */ + H5FD__core_close, /* close */ + H5FD__core_cmp, /* cmp */ + H5FD__core_query, /* query */ NULL, /* get_type_map */ NULL, /* alloc */ NULL, /* free */ - H5FD_core_get_eoa, /* get_eoa */ - H5FD_core_set_eoa, /* set_eoa */ - H5FD_core_get_eof, /* get_eof */ - H5FD_core_get_handle, /* get_handle */ - H5FD_core_read, /* read */ - H5FD_core_write, /* write */ - H5FD_core_flush, /* flush */ - H5FD_core_truncate, /* truncate */ + H5FD__core_get_eoa, /* get_eoa */ + H5FD__core_set_eoa, /* set_eoa */ + H5FD__core_get_eof, /* get_eof */ + H5FD__core_get_handle, /* get_handle */ + H5FD__core_read, /* read */ + H5FD__core_write, /* write */ + H5FD__core_flush, /* flush */ + H5FD__core_truncate, /* truncate */ NULL, /* lock */ NULL, /* unlock */ H5FD_FLMAP_DICHOTOMY /* fl_map */ @@ -183,7 +182,7 @@ H5FL_DEFINE(H5FD_core_region_t); /*------------------------------------------------------------------------- - * Function: H5FD_core_add_dirty_region + * Function: H5FD__core_add_dirty_region * * Purpose: Add a new dirty region to the list for later flushing * to the backing store. @@ -193,7 +192,7 @@ H5FL_DEFINE(H5FD_core_region_t); *------------------------------------------------------------------------- */ static herr_t -H5FD_core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end) +H5FD__core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end) { H5FD_core_region_t *b_item = NULL; H5FD_core_region_t *a_item = NULL; @@ -206,7 +205,7 @@ H5FD_core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end) hbool_t was_adjusted = FALSE; #endif - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); HDassert(file->dirty_list); @@ -310,11 +309,11 @@ if(was_adjusted) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_add_dirty_region() */ +} /* end H5FD__core_add_dirty_region() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_destroy_dirty_list + * Function: H5FD__core_destroy_dirty_list * * Purpose: Completely destroy the dirty list. * @@ -323,11 +322,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_destroy_dirty_list(H5FD_core_t *file) +H5FD__core_destroy_dirty_list(H5FD_core_t *file) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -352,11 +351,11 @@ if(count != 0) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_destroy_dirty_list() */ +} /* end H5FD__core_destroy_dirty_list() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_write_to_bstore + * Function: H5FD__core_write_to_bstore * * Purpose: Write data to the backing store. * @@ -364,7 +363,8 @@ done: * *------------------------------------------------------------------------- */ -static herr_t H5FD_core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) +static herr_t +H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) { unsigned char *ptr = file->mem + addr; /* mutable pointer into the * buffer (can't change mem) @@ -420,12 +420,11 @@ fprintf(stderr, "bytes wrote: %lu\n", bytes_wrote); done: FUNC_LEAVE_NOAPI(ret_value) - -} /* end H5FD_core_write_to_bstore() */ +} /* end H5FD__core_write_to_bstore() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_init_interface + * Function: H5FD__init_package * * Purpose: Initializes any interface-specific data or routines. * @@ -434,7 +433,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_init_interface(void) +H5FD__init_package(void) { herr_t ret_value = SUCCEED; @@ -445,7 +444,7 @@ H5FD_core_init_interface(void) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_core_init_interface() */ +} /* H5FD__init_package() */ /*------------------------------------------------------------------------- @@ -465,23 +464,23 @@ done: hid_t H5FD_core_init(void) { - hid_t ret_value = H5FD_CORE_g; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(FAIL) if(H5I_VFL != H5I_get_type(H5FD_CORE_g)) - H5FD_CORE_g = H5FD_register(&H5FD_core_g,sizeof(H5FD_class_t),FALSE); + H5FD_CORE_g = H5FD_register(&H5FD_core_g, sizeof(H5FD_class_t), FALSE); /* Set return value */ ret_value = H5FD_CORE_g; done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_core_init() */ /*--------------------------------------------------------------------------- - * Function: H5FD_core_term + * Function: H5FD__core_term * * Purpose: Shut down the VFD * @@ -493,15 +492,15 @@ done: *--------------------------------------------------------------------------- */ static herr_t -H5FD_core_term(void) +H5FD__core_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Reset VFL ID */ H5FD_CORE_g = 0; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_core_term() */ +} /* end H5FD__core_term() */ /*------------------------------------------------------------------------- @@ -535,11 +534,11 @@ H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store) fa.increment = increment; fa.backing_store = backing_store; - ret_value= H5P_set_driver(plist, H5FD_CORE, &fa); + ret_value = H5P_set_driver(plist, H5FD_CORE, &fa); done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pset_fapl_core() */ /*------------------------------------------------------------------------- @@ -557,8 +556,8 @@ done: herr_t H5Pget_fapl_core(hid_t fapl_id, size_t *increment /*out*/, hbool_t *backing_store /*out*/) { - H5FD_core_fapl_t *fa; H5P_genplist_t *plist; /* Property list pointer */ + const H5FD_core_fapl_t *fa; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -566,28 +565,27 @@ H5Pget_fapl_core(hid_t fapl_id, size_t *increment /*out*/, hbool_t *backing_stor if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if(H5FD_CORE != H5P_get_driver(plist)) + if(H5FD_CORE != H5P_peek_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - if(NULL == (fa = (H5FD_core_fapl_t *)H5P_get_driver_info(plist))) + if(NULL == (fa = (const H5FD_core_fapl_t *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") - if (increment) + if(increment) *increment = fa->increment; - if (backing_store) + if(backing_store) *backing_store = fa->backing_store; done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_fapl_core() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_fapl_get + * Function: H5FD__core_fapl_get * * Purpose: Returns a copy of the file access properties. * * Return: Success: Ptr to new file access properties. - * * Failure: NULL * * Programmer: Robb Matzke @@ -596,13 +594,13 @@ done: *------------------------------------------------------------------------- */ static void * -H5FD_core_fapl_get(H5FD_t *_file) +H5FD__core_fapl_get(H5FD_t *_file) { H5FD_core_t *file = (H5FD_core_t*)_file; H5FD_core_fapl_t *fa; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(NULL == (fa = (H5FD_core_fapl_t *)H5MM_calloc(sizeof(H5FD_core_fapl_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -615,18 +613,17 @@ H5FD_core_fapl_get(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD__core_fapl_get() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_open + * Function: H5FD___core_open * * Purpose: Create memory as an HDF5 file. * * Return: Success: A pointer to a new file data structure. The * public fields will be initialized by the * caller, which is always H5FD_open(). - * * Failure: NULL * * Programmer: Robb Matzke @@ -635,7 +632,7 @@ done: *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) +H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { int o_flags; H5FD_core_t *file = NULL; @@ -647,9 +644,9 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) h5_stat_t sb; int fd = -1; H5FD_file_image_info_t file_image_info; - H5FD_t *ret_value; + H5FD_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ if(!name || !*name) @@ -661,7 +658,7 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) HDassert(H5P_DEFAULT != fapl_id); if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(NULL == (fa = (H5FD_core_fapl_t *)H5P_get_driver_info(plist))) + if(NULL == (fa = (H5FD_core_fapl_t *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") /* Build the open flags */ @@ -671,7 +668,7 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) if(H5F_ACC_EXCL & flags) o_flags |= O_EXCL; /* Retrieve initial file image info */ - if(H5P_get(plist, H5F_ACS_FILE_IMAGE_INFO_NAME, &file_image_info) < 0) + if(H5P_peek(plist, H5F_ACS_FILE_IMAGE_INFO_NAME, &file_image_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get initial file image info") /* If the file image exists and this is an open, make sure the file doesn't exist */ @@ -864,11 +861,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_open() */ +} /* end H5FD__core_open() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_close + * Function: H5FD__core_close * * Purpose: Closes the file. * @@ -880,20 +877,20 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_close(H5FD_t *_file) +H5FD__core_close(H5FD_t *_file) { H5FD_core_t *file = (H5FD_core_t*)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Flush any changed buffers */ - if(H5FD_core_flush(_file, (hid_t)-1, TRUE) < 0) + if(H5FD__core_flush(_file, (hid_t)-1, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush core vfd backing store") /* Destroy the dirty region list */ if(file->dirty_list) - if(H5FD_core_destroy_dirty_list(file) != SUCCEED) + if(H5FD__core_destroy_dirty_list(file) != SUCCEED) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free core vfd dirty region list") /* Release resources */ @@ -915,11 +912,11 @@ H5FD_core_close(H5FD_t *_file) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_close() */ +} /* end H5FD__core_close() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_cmp + * Function: H5FD__core_cmp * * Purpose: Compares two files belonging to this driver by name. If one * file doesn't have a name then it is less than the other file. @@ -927,7 +924,6 @@ done: * address. * * Return: Success: A value like strcmp() - * * Failure: never fails (arguments were checked by the * caller). * @@ -937,13 +933,13 @@ done: *------------------------------------------------------------------------- */ static int -H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2) +H5FD__core_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { const H5FD_core_t *f1 = (const H5FD_core_t*)_f1; const H5FD_core_t *f2 = (const H5FD_core_t*)_f2; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(f1->fd >= 0 && f2->fd >= 0) { /* Compare low level file information for backing store */ @@ -994,11 +990,11 @@ H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_cmp() */ +} /* end H5FD__core_cmp() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_query + * Function: H5FD__core_query * * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) @@ -1011,11 +1007,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_query(const H5FD_t * _file, unsigned long *flags /* out */) +H5FD__core_query(const H5FD_t * _file, unsigned long *flags /* out */) { const H5FD_core_t *file = (const H5FD_core_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set the VFL feature flags that this driver supports */ if(flags) { @@ -1033,11 +1029,11 @@ H5FD_core_query(const H5FD_t * _file, unsigned long *flags /* out */) } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD_core_query() */ +} /* end H5FD__core_query() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_get_eoa + * Function: H5FD__core_get_eoa * * Purpose: Gets the end-of-address marker for the file. The EOA marker * is the first address past the last byte allocated in the @@ -1051,18 +1047,18 @@ H5FD_core_query(const H5FD_t * _file, unsigned long *flags /* out */) *------------------------------------------------------------------------- */ static haddr_t -H5FD_core_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__core_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_core_t *file = (const H5FD_core_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(file->eoa) -} +} /* end H5FD__core_get_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_set_eoa + * Function: H5FD__core_set_eoa * * Purpose: Set the end-of-address marker for the file. This function is * called shortly after an existing HDF5 file is opened in order @@ -1076,12 +1072,12 @@ H5FD_core_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) *------------------------------------------------------------------------- */ static herr_t -H5FD_core_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) +H5FD__core_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { H5FD_core_t *file = (H5FD_core_t*)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(ADDR_OVERFLOW(addr)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "address overflow") @@ -1090,11 +1086,11 @@ H5FD_core_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_set_eoa() */ +} /* end H5FD__core_set_eoa() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_get_eof + * Function: H5FD__core_get_eof * * Purpose: Returns the end-of-file marker, which is the greater of * either the size of the underlying memory or the HDF5 @@ -1110,18 +1106,18 @@ done: *------------------------------------------------------------------------- */ static haddr_t -H5FD_core_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) +H5FD__core_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_core_t *file = (const H5FD_core_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(file->eof) -} +} /* end H5FD__core_get_eof() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_get_handle + * Function: H5FD__core_get_handle * * Purpose: Gets the file handle of CORE file driver. * @@ -1133,12 +1129,12 @@ H5FD_core_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) *------------------------------------------------------------------------- */ static herr_t -H5FD_core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) +H5FD__core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) { H5FD_core_t *file = (H5FD_core_t *)_file; /* core VFD info */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ if(!file_handle) @@ -1177,11 +1173,11 @@ H5FD_core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_get_handle() */ +} /* end H5FD__core_get_handle() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_read + * Function: H5FD__core_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR * into buffer BUF according to data transfer properties in @@ -1189,7 +1185,6 @@ done: * * Return: Success: SUCCEED. Result is stored in caller-supplied * buffer BUF. - * * Failure: FAIL, Contents of buffer BUF are undefined. * * Programmer: Robb Matzke @@ -1198,13 +1193,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, +H5FD__core_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf/*out*/) { H5FD_core_t *file = (H5FD_core_t*)_file; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file && file->pub.cls); HDassert(buf); @@ -1240,11 +1235,11 @@ H5FD_core_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD__core_read() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_write + * Function: H5FD__core_write * * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR * from buffer BUF according to data transfer properties in @@ -1258,13 +1253,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, +H5FD__core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, const void *buf) { H5FD_core_t *file = (H5FD_core_t*)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file && file->pub.cls); HDassert(buf); @@ -1310,7 +1305,8 @@ H5FD_core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU if(file->dirty_list) { haddr_t start = addr; haddr_t end = addr + (haddr_t)size - 1; - if(H5FD_core_add_dirty_region(file, start, end) != SUCCEED) + + if(H5FD__core_add_dirty_region(file, start, end) != SUCCEED) HGOTO_ERROR(H5E_VFL, H5E_CANTINSERT, FAIL, "unable to add core VFD dirty region during write call - addresses: start=%llu end=%llu", start, end) } @@ -1322,11 +1318,11 @@ H5FD_core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_write() */ +} /* end H5FD__core_write() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_flush + * Function: H5FD__core_flush * * Purpose: Flushes the file to backing store if there is any and if the * dirty flag is set. @@ -1339,12 +1335,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, unsigned H5_ATTR_UNUSED closing) +H5FD__core_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, unsigned H5_ATTR_UNUSED closing) { H5FD_core_t *file = (H5FD_core_t*)_file; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Write to backing store */ if (file->dirty && file->fd >= 0 && file->backing_store) { @@ -1371,7 +1367,7 @@ H5FD_core_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, unsigned H5_ATTR_UN #ifdef DER fprintf(stderr, "(%llu, %llu : %lu)\n", item->start, item->end, size); #endif - if(H5FD_core_write_to_bstore(file, item->start, size) != SUCCEED) + if(H5FD__core_write_to_bstore(file, item->start, size) != SUCCEED) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write to backing store") } /* end if */ @@ -1385,24 +1381,23 @@ if(file->eoa > file->eof) fprintf(stderr, "*** EOA BADNESS ***\n"); fprintf(stderr, "\n"); #endif - } + } /* end if */ /* Otherwise, write the entire file out at once */ else { - if(H5FD_core_write_to_bstore(file, (haddr_t)0, (size_t)file->eof) != SUCCEED) + if(H5FD__core_write_to_bstore(file, (haddr_t)0, (size_t)file->eof) != SUCCEED) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write to backing store") - - } /* end while */ + } /* end else */ file->dirty = FALSE; } done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD__core_flush() */ /*------------------------------------------------------------------------- - * Function: H5FD_core_truncate + * Function: H5FD__core_truncate * * Purpose: Makes sure that the true file size is the same (or larger) * than the end-of-address. @@ -1437,13 +1432,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_core_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) +H5FD__core_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) { H5FD_core_t *file = (H5FD_core_t*)_file; size_t new_eof; /* New size of memory buffer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(file); @@ -1523,5 +1518,5 @@ fprintf(stderr, "OLD: Truncated to: %llu\n", file->eoa); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_core_truncate() */ +} /* end H5FD__core_truncate() */ diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index f4ee910..de64923 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -22,12 +22,8 @@ * buffer. The main system support this feature is Linux. */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_direct_init_interface +#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */ -/* For system function posix_memalign - Commented it out because copper isn't able to compile - * this file. */ -/* #define _XOPEN_SOURCE 600 */ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -182,10 +178,9 @@ H5FL_DEFINE_STATIC(H5FD_direct_t); /*-------------------------------------------------------------------------- NAME - H5FD_direct_init_interface -- Initialize interface-specific information + H5FD__init_package -- Initialize interface-specific information USAGE - herr_t H5FD_direct_init_interface() - + herr_t H5FD__init_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -194,18 +189,18 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5FD_direct_init_interface(void) +H5FD__init_package(void) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5FD_direct_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize direct VFD") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_direct_init_interface() */ +} /* H5FD__init_package() */ /*------------------------------------------------------------------------- @@ -236,7 +231,7 @@ H5FD_direct_init(void) H5FD_DIRECT_g = H5FD_register(&H5FD_direct_g,sizeof(H5FD_class_t),FALSE); /* Set return value */ - ret_value=H5FD_DIRECT_g; + ret_value = H5FD_DIRECT_g; done: FUNC_LEAVE_NOAPI(ret_value) @@ -279,8 +274,6 @@ H5FD_direct_term(void) * Programmer: Raymond Lu * Wednesday, 20 September 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -297,17 +290,17 @@ H5Pset_fapl_direct(hid_t fapl_id, size_t boundary, size_t block_size, size_t cbu HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") if(boundary != 0) - fa.mboundary = boundary; + fa.mboundary = boundary; else - fa.mboundary = MBOUNDARY_DEF; + fa.mboundary = MBOUNDARY_DEF; if(block_size != 0) - fa.fbsize = block_size; + fa.fbsize = block_size; else - fa.fbsize = FBSIZE_DEF; + fa.fbsize = FBSIZE_DEF; if(cbuf_size != 0) - fa.cbsize = cbuf_size; + fa.cbsize = cbuf_size; else - fa.cbsize = CBSIZE_DEF; + fa.cbsize = CBSIZE_DEF; /* Set the default to be true for data alignment */ fa.must_align = TRUE; @@ -316,7 +309,7 @@ H5Pset_fapl_direct(hid_t fapl_id, size_t boundary, size_t block_size, size_t cbu if(fa.cbsize % fa.fbsize != 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "copy buffer size must be a multiple of block size") - ret_value= H5P_set_driver(plist, H5FD_DIRECT, &fa); + ret_value = H5P_set_driver(plist, H5FD_DIRECT, &fa); done: FUNC_LEAVE_API(ret_value) @@ -336,37 +329,35 @@ done: * Programmer: Raymond Lu * Wednesday, October 18, 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5Pget_fapl_direct(hid_t fapl_id, size_t *boundary/*out*/, size_t *block_size/*out*/, size_t *cbuf_size/*out*/) { - H5FD_direct_fapl_t *fa; H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* Return value */ + const H5FD_direct_fapl_t *fa; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE4("e", "ixxx", fapl_id, boundary, block_size, cbuf_size); if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") - if (H5FD_DIRECT!=H5P_get_driver(plist)) + if(H5FD_DIRECT != H5P_peek_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - if (NULL==(fa=H5P_get_driver_info(plist))) + if(NULL == (fa = H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") - if (boundary) + if(boundary) *boundary = fa->mboundary; - if (block_size) - *block_size = fa->fbsize; + if(block_size) + *block_size = fa->fbsize; if (cbuf_size) - *cbuf_size = fa->cbsize; + *cbuf_size = fa->cbsize; done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_fapl_direct() */ /*------------------------------------------------------------------------- @@ -507,7 +498,7 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd /* Get the driver specific information */ if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(NULL == (fa = (H5FD_direct_fapl_t *)H5P_get_driver_info(plist))) + if(NULL == (fa = (H5FD_direct_fapl_t *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") file->fd = fd; diff --git a/src/H5FDdrvr_module.h b/src/H5FDdrvr_module.h new file mode 100644 index 0000000..8bb83a1 --- /dev/null +++ b/src/H5FDdrvr_module.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5FD driver package. Including this header means that the source file + * is part of the H5FD driver package. + */ +#ifndef _H5FDdrvr_module_H +#define _H5FDdrvr_module_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5_MY_PKG H5FD +#define H5_MY_PKG_ERR H5E_FILE +#define H5_MY_PKG_INIT YES +#define H5_PKG_SINGLE_SOURCE + +#endif /* _H5FDdrvr_module_H */ + diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 9edbc72..7a35612 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -34,8 +34,7 @@ * */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_family_init_interface +#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */ #include "H5private.h" /* Generic Functions */ @@ -147,10 +146,9 @@ static const H5FD_class_t H5FD_family_g = { /*-------------------------------------------------------------------------- NAME - H5FD_family_init_interface -- Initialize interface-specific information + H5FD__init_package -- Initialize interface-specific information USAGE - herr_t H5FD_family_init_interface() - + herr_t H5FD__init_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -159,18 +157,18 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5FD_family_init_interface(void) +H5FD__init_package(void) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5FD_family_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize family VFD") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_family_init_interface() */ +} /* H5FD__init_package() */ /*------------------------------------------------------------------------- @@ -267,7 +265,6 @@ H5Pset_fapl_family(hid_t fapl_id, hsize_t msize, hid_t memb_fapl_id) FUNC_ENTER_API(FAIL) H5TRACE3("e", "ihi", fapl_id, msize, memb_fapl_id); - /* Check arguments */ if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") @@ -277,16 +274,13 @@ H5Pset_fapl_family(hid_t fapl_id, hsize_t msize, hid_t memb_fapl_id) if(TRUE != H5P_isa_class(memb_fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") - /* - * Initialize driver specific information. No need to copy it into the FA - * struct since all members will be copied by H5P_set_driver(). - */ + /* Initialize driver specific information. */ fa.memb_size = msize; fa.memb_fapl_id = memb_fapl_id; if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - ret_value= H5P_set_driver(plist, H5FD_FAMILY, &fa); + ret_value = H5P_set_driver(plist, H5FD_FAMILY, &fa); done: FUNC_LEAVE_API(ret_value) @@ -316,21 +310,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_fapl_family(hid_t fapl_id, hsize_t *msize/*out*/, - hid_t *memb_fapl_id/*out*/) +H5Pget_fapl_family(hid_t fapl_id, hsize_t *msize/*out*/, hid_t *memb_fapl_id/*out*/) { - H5FD_family_fapl_t *fa; H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* Return value */ + const H5FD_family_fapl_t *fa; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "ixx", fapl_id, msize, memb_fapl_id); if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") - if(H5FD_FAMILY != H5P_get_driver(plist)) + if(H5FD_FAMILY != H5P_peek_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - if(NULL == (fa = (H5FD_family_fapl_t *)H5P_get_driver_info(plist))) + if(NULL == (fa = (const H5FD_family_fapl_t *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") if(msize) *msize = fa->memb_size; @@ -368,7 +361,7 @@ H5FD_family_fapl_get(H5FD_t *_file) H5FD_family_t *file = (H5FD_family_t*)_file; H5FD_family_fapl_t *fa = NULL; H5P_genplist_t *plist; /* Property list pointer */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -414,7 +407,7 @@ H5FD_family_fapl_copy(const void *_old_fa) const H5FD_family_fapl_t *old_fa = (const H5FD_family_fapl_t*)_old_fa; H5FD_family_fapl_t *new_fa = NULL; H5P_genplist_t *plist; /* Property list pointer */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -595,12 +588,8 @@ H5FD_family_sb_decode(H5FD_t *_file, const char H5_ATTR_UNUSED *name, const unsi file->pmem_size = msize; /* Check if member size from file access property is correct */ - if(msize != file->pmem_size) { - char err_msg[128]; - - HDsnprintf(err_msg, sizeof(err_msg), "Family member size should be %lu. But the size from file access property is %lu", (unsigned long)msize, (unsigned long)file->pmem_size); - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, err_msg) - } /* end if */ + if(msize != file->pmem_size) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "Family member size should be %lu. But the size from file access property is %lu", (unsigned long)msize, (unsigned long)file->pmem_size) /* Update member file size to the size saved in the superblock. * That's the size intended to be. */ @@ -626,23 +615,6 @@ done: * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * Raymond Lu - * Thursday, November 18, 2004 - * When file is re-opened, member size passed in from access property - * is checked to see if it's reasonable. If there is only 1 member - * file, member size can't be smaller than current member size. - * If there are at least 2 member files, member size can only be equal - * the 1st member size. - * - * Raymond Lu - * Tuesday, May 24, 2005 - * The modification described above has been changed. The major checking - * is done in H5F_read_superblock. Member file size is saved in the - * superblock now. H5F_read_superblock() reads this saved size and compare - * to the size passed in from file access property. Wrong size will - * result in a failure. - * *------------------------------------------------------------------------- */ static H5FD_t * @@ -666,7 +638,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, /* Initialize file from file access properties */ if(NULL == (file = (H5FD_family_t *)H5MM_calloc(sizeof(H5FD_family_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") - if(H5P_FILE_ACCESS_DEFAULT==fapl_id) { + if(H5P_FILE_ACCESS_DEFAULT == fapl_id) { file->memb_fapl_id = H5P_FILE_ACCESS_DEFAULT; if(H5I_inc_ref(file->memb_fapl_id, FALSE) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver") @@ -676,11 +648,11 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, } /* end if */ else { H5P_genplist_t *plist; /* Property list pointer */ - H5FD_family_fapl_t *fa; + const H5FD_family_fapl_t *fa; if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(NULL == (fa = (H5FD_family_fapl_t *)H5P_get_driver_info(plist))) + if(NULL == (fa = (const H5FD_family_fapl_t *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") /* Check for new family file size. It's used by h5repart only. */ @@ -693,8 +665,8 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, file->repart_members = TRUE; } /* end if */ - if(fa->memb_fapl_id==H5P_FILE_ACCESS_DEFAULT) { - if(H5I_inc_ref(fa->memb_fapl_id, FALSE)<0) + if(fa->memb_fapl_id == H5P_FILE_ACCESS_DEFAULT) { + if(H5I_inc_ref(fa->memb_fapl_id, FALSE) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver") file->memb_fapl_id = fa->memb_fapl_id; } /* end if */ @@ -1048,7 +1020,7 @@ H5FD_family_get_eof(const H5FD_t *_file, H5FD_mem_t type) const H5FD_family_t *file = (const H5FD_family_t*)_file; haddr_t eof=0; int i; /* Local index variable */ - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1102,7 +1074,7 @@ H5FD_family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) H5P_genplist_t *plist; hsize_t offset; int memb; - herr_t ret_value; + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5FDint.c b/src/H5FDint.c index 13bc68a..e7cb2c0 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -28,10 +28,7 @@ /* Module Setup */ /****************/ -#define H5FD_PACKAGE /*suppress error about including H5FDpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_int_init_interface +#include "H5FDmodule.h" /* This source code file is part of the H5FD module */ /***********/ @@ -80,28 +77,6 @@ -/*-------------------------------------------------------------------------- -NAME - H5FD_int_init_interface -- Initialize interface-specific information -USAGE - herr_t H5FD_int_init_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5FD_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5FD_int_init_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5FD_init()) -} /* H5FD_int_init_interface() */ - - /*------------------------------------------------------------------------- * Function: H5FD_locate_signature * @@ -325,7 +300,7 @@ done: haddr_t H5FD_get_eoa(const H5FD_t *file, H5FD_mem_t type) { - haddr_t ret_value; + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) @@ -367,7 +342,7 @@ done: haddr_t H5FD_get_eof(const H5FD_t *file, H5FD_mem_t type) { - haddr_t ret_value; + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) diff --git a/src/H5FDlog.c b/src/H5FDlog.c index e8695c5..eb2c0e3 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -26,8 +26,7 @@ * With custom modifications... */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_log_init_interface +#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */ #include "H5private.h" /* Generic Functions */ @@ -221,7 +220,7 @@ H5FL_DEFINE_STATIC(H5FD_log_t); /*------------------------------------------------------------------------- - * Function: H5FD_log_init_interface + * Function: H5FD__init_package * * Purpose: Initializes any interface-specific data or routines. * @@ -230,18 +229,18 @@ H5FL_DEFINE_STATIC(H5FD_log_t); *------------------------------------------------------------------------- */ static herr_t -H5FD_log_init_interface(void) +H5FD__init_package(void) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5FD_log_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize log VFD") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_log_init_interface() */ +} /* H5FD__init_package() */ /*------------------------------------------------------------------------- @@ -261,7 +260,7 @@ done: hid_t H5FD_log_init(void) { - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -361,7 +360,7 @@ static void * H5FD_log_fapl_get(H5FD_t *_file) { H5FD_log_t *file = (H5FD_log_t *)_file; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -390,7 +389,7 @@ H5FD_log_fapl_copy(const void *_old_fa) { const H5FD_log_fapl_t *old_fa = (const H5FD_log_fapl_t*)_old_fa; H5FD_log_fapl_t *new_fa = NULL; /* New FAPL info */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -471,7 +470,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { H5FD_log_t *file = NULL; H5P_genplist_t *plist; /* Property list */ - H5FD_log_fapl_t *fa; /* File access property list information */ + const H5FD_log_fapl_t *fa; /* File access property list information */ int fd = -1; /* File descriptor */ int o_flags; /* Flags for open() call */ #ifdef H5_HAVE_WIN32_API @@ -483,7 +482,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) struct timeval stat_timeval_diff; #endif /* H5_HAVE_GETTIMEOFDAY */ h5_stat_t sb; - H5FD_t *ret_value; /* Return value */ + H5FD_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -510,7 +509,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Get the driver specific information */ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(NULL == (fa = (H5FD_log_fapl_t *)H5P_get_driver_info(plist))) + if(NULL == (fa = (const H5FD_log_fapl_t *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") #ifdef H5_HAVE_GETTIMEOFDAY @@ -922,7 +921,7 @@ H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hsi { H5FD_log_t *file = (H5FD_log_t *)_file; haddr_t addr; - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5FDmodule.h b/src/H5FDmodule.h new file mode 100644 index 0000000..6358e86 --- /dev/null +++ b/src/H5FDmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5FD package. Including this header means that the source file + * is part of the H5FD package. + */ +#ifndef _H5FDmodule_H +#define _H5FDmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5FD_MODULE +#define H5_MY_PKG H5FD +#define H5_MY_PKG_ERR H5E_VFL +#define H5_MY_PKG_INIT YES + +#endif /* _H5FDmodule_H */ + diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c index 86a5d39..fdc4eca 100644 --- a/src/H5FDmpi.c +++ b/src/H5FDmpi.c @@ -452,24 +452,13 @@ done: * Programmer: Robb Matzke * Monday, August 9, 1999 * - * Modifications: - * - * Quincey Koziol - 2002/06/17 - * Removed 'disp' parameter, read & write routines will use - * the address of the dataset in MPI_File_set_view() calls, as - * necessary. - * - * Quincey Koziol - 2002/06/17 - * Changed to set temporary properties in a dxpl, instead of - * flags in the file struct, which will make this more threadsafe. - * *------------------------------------------------------------------------- */ herr_t H5FD_mpi_setup_collective(hid_t dxpl_id, MPI_Datatype *btype, MPI_Datatype *ftype) { H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 366a247..7148615 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -21,8 +21,7 @@ * */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_mpio_init_interface +#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */ #include "H5private.h" /* Generic Functions */ @@ -167,10 +166,9 @@ static int H5FD_mpio_Debug[256] = /*-------------------------------------------------------------------------- NAME - H5FD_mpio_init_interface -- Initialize interface-specific information + H5FD__init_package -- Initialize interface-specific information USAGE - herr_t H5FD_mpio_init_interface() - + herr_t H5FD__init_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -179,18 +177,18 @@ DESCRIPTION --------------------------------------------------------------------------*/ static herr_t -H5FD_mpio_init_interface(void) +H5FD__init_package(void) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5FD_mpio_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize mpio VFD") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_mpio_init_interface() */ +} /* H5FD__init_package() */ /*------------------------------------------------------------------------- @@ -304,33 +302,6 @@ H5FD_mpio_term(void) * Programmer: Albert Cheng * Feb 3, 1998 * - * Modifications: - * Robb Matzke, 1998-02-18 - * Check all arguments before the property list is updated so we - * don't leave the property list in a bad state if something - * goes wrong. Also, the property list data type changed to - * allow more generality so all the mpi-related stuff is in the - * `u.mpi' member. The `access_mode' will contain only - * mpi-related flags defined in H5Fpublic.h. - * - * Albert Cheng, 1998-04-16 - * Removed the ACCESS_MODE argument. The access mode is changed - * to be controlled by data transfer property list during data - * read/write calls. - * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. - * - * Raymond Lu, 2001-10-23 - * Changed the file access list to the new generic property - * list. - * - * Albert Cheng, 2003-04-17 - * Modified the description of the function that it now stores - * a duplicate of the communicator and INFO object. Free the - * old duplicates if previously set. (Work is actually done - * by H5P_set_driver.) - * *------------------------------------------------------------------------- */ herr_t @@ -357,11 +328,11 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) fa.info = info; /* duplication is done during driver setting. */ - ret_value= H5P_set_driver(plist, H5FD_MPIO, &fa); + ret_value = H5P_set_driver(plist, H5FD_MPIO, &fa); done: FUNC_LEAVE_API(ret_value) -} +} /* H5Pset_fapl_mpio() */ /*------------------------------------------------------------------------- @@ -386,71 +357,60 @@ done: * Programmer: Robb Matzke * Thursday, February 26, 1998 * - * Modifications: - * - * Albert Cheng, Apr 16, 1998 - * Removed the access_mode argument. The access_mode is changed - * to be controlled by data transfer property list during data - * read/write calls. - * - * Raymond Lu, 2001-10-23 - * Changed the file access list to the new generic property - * list. - * - * Albert Cheng, 2003-04-17 - * Return duplicates of the stored communicator and Info object. - * *------------------------------------------------------------------------- */ herr_t H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/) { - H5FD_mpio_fapl_t *fa; H5P_genplist_t *plist; /* Property list pointer */ - MPI_Comm comm_tmp=MPI_COMM_NULL; - int mpi_code; /* mpi return code */ - herr_t ret_value=SUCCEED; /* Return value */ + const H5FD_mpio_fapl_t *fa; /* MPIO fapl info */ + MPI_Comm comm_tmp = MPI_COMM_NULL; + hbool_t comm_copied = FALSE; /* MPI Comm has been duplicated */ + int mpi_code; /* MPI return code */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "ixx", fapl_id, comm, info); if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") - if(H5FD_MPIO != H5P_get_driver(plist)) + if(H5FD_MPIO != H5P_peek_driver(plist)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - if(NULL == (fa = (H5FD_mpio_fapl_t *)H5P_get_driver_info(plist))) + if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") /* Store the duplicated communicator in a temporary variable for error */ - /* recovery in case the INFO duplication fails. We cannot attempt to */ - /* the value into *comm yet since if MPI_Comm_dup fails, we will end */ - /* up freeing whatever *comm holds and that could be invalid. */ - if (comm){ - if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(fa->comm, &comm_tmp))) + /* recovery in case the INFO duplication fails. */ + if(comm) { + if(MPI_SUCCESS != (mpi_code = MPI_Comm_dup(fa->comm, &comm_tmp))) HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code) - } + comm_copied = TRUE; + } /* end if */ - if (info){ - if (MPI_INFO_NULL != fa->info){ - if (MPI_SUCCESS != (mpi_code=MPI_Info_dup(fa->info, info))) + if(info) { + if(MPI_INFO_NULL != fa->info) { + if(MPI_SUCCESS != (mpi_code = MPI_Info_dup(fa->info, info))) HMPI_GOTO_ERROR(FAIL, "MPI_Info_dup failed", mpi_code) - }else{ + } /* end if */ + else /* do not dup it */ *info = MPI_INFO_NULL; - } - } + } /* end if */ - if (comm) + /* Store the copied communicator, now that the Info object has been + * successfully copied. + */ + if(comm) *comm = comm_tmp; done: - if (FAIL==ret_value){ + if(ret_value < 0) /* need to free anything created here */ - if (comm_tmp != MPI_COMM_NULL) + if(comm_copied) MPI_Comm_free(&comm_tmp); - } + FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_fapl_mpio() */ /*------------------------------------------------------------------------- @@ -965,32 +925,6 @@ done: * Programmer: * January 30, 1998 * - * Modifications: - * Robb Matzke, 1998-02-18 - * Added the ACCESS_PARMS argument. Moved some error checking - * here from elsewhere. - * - * rky, 1998-01-11 - * Added H5FD_mpio_Debug debug flags controlled by MPI_Info. - * - * rky, 1998-08-28 - * Init flag controlling redundant metadata writes to disk. - * - * rky, 1998-12-07 - * Added barrier after MPI_File_set_size to prevent race - * condition -- subsequent writes were being truncated, causing - * holes in file. - * - * Robb Matzke, 1999-08-06 - * Modified to work with the virtual file layer. - * - * rky & ppw, 1999-11-07 - * Modified "H5FD_mpio_open" so that file-truncation is - * avoided for brand-new files (with zero filesize). - * - * Albert Cheng, 2003-04-17 - * Duplicate the communicator and Info object so that file is - * insulated from the old one. *------------------------------------------------------------------------- */ static H5FD_t * @@ -1005,11 +939,11 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, int mpi_size; /* Total number of MPI processes */ int mpi_code; /* mpi return code */ MPI_Offset size; - const H5FD_mpio_fapl_t *fa=NULL; + const H5FD_mpio_fapl_t *fa = NULL; H5FD_mpio_fapl_t _fa; H5P_genplist_t *plist; /* Property list pointer */ - MPI_Comm comm_dup=MPI_COMM_NULL; - MPI_Info info_dup=MPI_INFO_NULL; + MPI_Comm comm_dup = MPI_COMM_NULL; + MPI_Info info_dup = MPI_INFO_NULL; H5FD_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1024,39 +958,42 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, /* Obtain a pointer to mpio-specific file access properties */ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MPIO != H5P_get_driver(plist)) { + if(H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MPIO != H5P_peek_driver(plist)) { _fa.comm = MPI_COMM_SELF; /*default*/ _fa.info = MPI_INFO_NULL; /*default*/ fa = &_fa; - } else { - if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_get_driver_info(plist))) + } /* end if */ + else { + if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") - } + } /* end else */ /* Duplicate communicator and Info object for use by this file. */ - if (FAIL==H5FD_mpi_comm_info_dup(fa->comm, fa->info, &comm_dup, &info_dup)) + if(FAIL == H5FD_mpi_comm_info_dup(fa->comm, fa->info, &comm_dup, &info_dup)) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed") /* convert HDF5 flags to MPI-IO flags */ /* some combinations are illegal; let MPI-IO figure it out */ - mpi_amode = (flags&H5F_ACC_RDWR) ? MPI_MODE_RDWR : MPI_MODE_RDONLY; - if (flags&H5F_ACC_CREAT) mpi_amode |= MPI_MODE_CREATE; - if (flags&H5F_ACC_EXCL) mpi_amode |= MPI_MODE_EXCL; + mpi_amode = (flags & H5F_ACC_RDWR) ? MPI_MODE_RDWR : MPI_MODE_RDONLY; + if(flags & H5F_ACC_CREAT) + mpi_amode |= MPI_MODE_CREATE; + if(flags & H5F_ACC_EXCL) + mpi_amode |= MPI_MODE_EXCL; #ifdef H5FDmpio_DEBUG /* Check for debug commands in the info parameter */ { - char debug_str[128]; - int flag, i; - if (MPI_INFO_NULL != info_dup) { - MPI_Info_get(fa->info, H5F_MPIO_DEBUG_KEY, sizeof(debug_str)-1, debug_str, &flag); - if (flag) { - fprintf(stdout, "H5FD_mpio debug flags=%s\n", debug_str ); - for (i=0; - debug_str[i]/*end of string*/ && i<128/*just in case*/; - ++i) { + if(MPI_INFO_NULL != info_dup) { + char debug_str[128]; + int flag; + + MPI_Info_get(fa->info, H5F_MPIO_DEBUG_KEY, sizeof(debug_str) - 1, debug_str, &flag); + if(flag) { + int i; + + fprintf(stdout, "H5FD_mpio debug flags = '%s'\n", debug_str); + for(i = 0; debug_str[i]/*end of string*/ && i < 128/*just in case*/; ++i) H5FD_mpio_Debug[(int)debug_str[i]] = 1; - } } } } @@ -1523,21 +1460,21 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t dxpl_id, had use_view_this_time = TRUE; /* prepare for a full-blown xfer using btype, ftype, and disp */ - if(H5P_get(plist, H5FD_MPI_XFER_MEM_MPI_TYPE_NAME, &buf_type)<0) + if(H5P_get(plist, H5FD_MPI_XFER_MEM_MPI_TYPE_NAME, &buf_type) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") - if(H5P_get(plist, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, &file_type)<0) + if(H5P_get(plist, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, &file_type) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") /* * Set the file view when we are using MPI derived types */ - if (MPI_SUCCESS != (mpi_code=MPI_File_set_view(file->f, mpi_off, MPI_BYTE, file_type, H5FD_mpi_native_g, file->info))) + if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, mpi_off, MPI_BYTE, file_type, H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) /* When using types, use the address as the displacement for * MPI_File_set_view and reset the address for the read to zero */ - mpi_off=0; + mpi_off = 0; } /* end if */ } /* end if */ @@ -1553,7 +1490,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t dxpl_id, had HDassert(plist); /* get the transfer mode from the dxpl */ - if(H5P_get(plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, &coll_opt_mode)<0) + if(H5P_get(plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, &coll_opt_mode) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O collective_op property") if(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { @@ -2117,7 +2054,7 @@ H5FD_mpio_communicator(const H5FD_t *_file) HDassert(H5FD_MPIO==file->pub.driver_id); FUNC_LEAVE_NOAPI(file->comm) -} +} /* end H5FD_mpio_communicator() */ #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5FDpkg.h b/src/H5FDpkg.h index 7c0988e..ef33cf1 100644 --- a/src/H5FDpkg.h +++ b/src/H5FDpkg.h @@ -21,7 +21,7 @@ * the H5FD package. Source files outside the H5FD package should * include H5FDprivate.h instead. */ -#ifndef H5FD_PACKAGE +#if !(defined H5FD_FRIEND || defined H5FD_MODULE) #error "Do not include this file outside the H5FD package!" #endif @@ -52,7 +52,6 @@ /******************************/ /* Package Private Prototypes */ /******************************/ -H5_DLL herr_t H5FD_init(void); H5_DLL haddr_t H5FD_alloc_real(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, hsize_t size, haddr_t *align_addr, hsize_t *align_size); H5_DLL herr_t H5FD_free_real(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 0a7fe6c..412bbef 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -90,6 +90,12 @@ typedef struct { } \ } +/* Define structure to hold driver ID & info for FAPLs */ +typedef struct { + hid_t driver_id; /* Driver's ID */ + const void *driver_info; /* Driver info, for open callbacks */ +} H5FD_driver_prop_t; + /*****************************/ /* Library Private Variables */ @@ -111,8 +117,7 @@ H5_DLL hsize_t H5FD_sb_size(H5FD_t *file); H5_DLL herr_t H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf); H5_DLL herr_t H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf); H5_DLL void *H5FD_fapl_get(H5FD_t *file); -H5_DLL herr_t H5FD_fapl_open(struct H5P_genplist_t *plist, hid_t driver_id, const void *driver_info); -H5_DLL herr_t H5FD_fapl_close(hid_t driver_id, void *fapl); +H5_DLL herr_t H5FD_fapl_close(hid_t driver_id, const void *fapl); H5_DLL hid_t H5FD_register(const void *cls, size_t size, hbool_t app_ref); H5_DLL H5FD_t *H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 10e2a66..34527df 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -25,8 +25,7 @@ * application to the same file). */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_sec2_init_interface +#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */ #include "H5private.h" /* Generic Functions */ @@ -179,7 +178,7 @@ H5FL_DEFINE_STATIC(H5FD_sec2_t); /*------------------------------------------------------------------------- - * Function: H5FD_sec2_init_interface + * Function: H5FD__init_package * * Purpose: Initializes any interface-specific data or routines. * @@ -188,18 +187,18 @@ H5FL_DEFINE_STATIC(H5FD_sec2_t); *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_init_interface(void) +H5FD__init_package(void) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5FD_sec2_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize sec2 VFD") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_sec2_init_interface() */ +} /* H5FD__init_package() */ /*------------------------------------------------------------------------- @@ -219,7 +218,7 @@ done: hid_t H5FD_sec2_init(void) { - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -316,7 +315,7 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif h5_stat_t sb; - H5FD_t *ret_value; /* Return value */ + H5FD_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5FDspace.c b/src/H5FDspace.c index deb2153..edc83e6 100644 --- a/src/H5FDspace.c +++ b/src/H5FDspace.c @@ -28,10 +28,7 @@ /* Module Setup */ /****************/ -#define H5FD_PACKAGE /*suppress error about including H5FDpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_space_init_interface +#include "H5FDmodule.h" /* This source code file is part of the H5FD module */ /***********/ @@ -86,28 +83,6 @@ H5FL_DEFINE(H5FD_free_t); -/*-------------------------------------------------------------------------- -NAME - H5FD_space_init_interface -- Initialize interface-specific information -USAGE - herr_t H5FD_space_init_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5FD_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5FD_space_init_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5FD_init()) -} /* H5FD_space_init_interface() */ - - /*------------------------------------------------------------------------- * Function: H5FD_extend * @@ -129,7 +104,7 @@ H5FD_extend(H5FD_t *file, H5FD_mem_t type, hbool_t new_block, hsize_t size, hadd hsize_t orig_size = size; /* Original allocation size */ haddr_t eoa; /* Address of end-of-allocated space */ hsize_t extra; /* Extra space to allocate, to align request */ - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -197,7 +172,7 @@ done: haddr_t H5FD_alloc_real(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size) { - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) #ifdef H5FD_ALLOC_DEBUG @@ -253,7 +228,7 @@ haddr_t H5FD_alloc(H5FD_t *file, hid_t dxpl_id, H5FD_mem_t type, H5F_t *f, hsize_t size, haddr_t *frag_addr, hsize_t *frag_size) { - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 65b75a3..686e1fc 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -43,17 +43,7 @@ #include <windows.h> #include <io.h> -/* This is not defined in the Windows header files */ -#ifndef F_OK -#define F_OK 00 -#endif - -#endif - -#ifdef MAX -#undef MAX -#endif /* MAX */ -#define MAX(X,Y) ((X)>(Y)?(X):(Y)) +#endif /* H5_HAVE_WIN32_API */ /* The driver identification number, initialized at runtime */ static hid_t H5FD_STDIO_g = 0; @@ -331,7 +321,7 @@ H5Pset_fapl_stdio(hid_t fapl_id) *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id, +H5FD_stdio_open( const char *name, unsigned flags, hid_t /*UNUSED*/ fapl_id, haddr_t maxaddr) { FILE *f = NULL; @@ -556,7 +546,7 @@ H5FD_stdio_cmp(const H5FD_t *_f1, const H5FD_t *_f2) *------------------------------------------------------------------------- */ static herr_t -H5FD_stdio_query(const H5FD_t *_f, unsigned long *flags /* out */) +H5FD_stdio_query(const H5FD_t *_f, unsigned long /*OUT*/ *flags) { /* Quiet the compiler */ _f=_f; @@ -593,7 +583,7 @@ H5FD_stdio_query(const H5FD_t *_f, unsigned long *flags /* out */) *------------------------------------------------------------------------- */ static haddr_t -H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type, hid_t /*H5_ATTR_UNUSED*/ dxpl_id, hsize_t size) +H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxpl_id, hsize_t size) { H5FD_stdio_t *file = (H5FD_stdio_t*)_file; haddr_t addr; @@ -638,7 +628,7 @@ H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type, hid_t /*H5_A *------------------------------------------------------------------------- */ static haddr_t -H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type) +H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type) { const H5FD_stdio_t *file = (const H5FD_stdio_t *)_file; @@ -669,7 +659,7 @@ H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type) *------------------------------------------------------------------------- */ static herr_t -H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type, haddr_t addr) +H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, haddr_t addr) { H5FD_stdio_t *file = (H5FD_stdio_t*)_file; @@ -704,10 +694,13 @@ H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type, haddr_t ad *------------------------------------------------------------------------- */ static haddr_t -H5FD_stdio_get_eof(const H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type) +H5FD_stdio_get_eof(const H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type) { const H5FD_stdio_t *file = (const H5FD_stdio_t *)_file; + /* Quiet the compiler */ + type = type; + /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -728,7 +721,7 @@ H5FD_stdio_get_eof(const H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type) *------------------------------------------------------------------------- */ static herr_t -H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) +H5FD_stdio_get_handle(H5FD_t *_file, hid_t /*UNUSED*/ fapl, void **file_handle) { H5FD_stdio_t *file = (H5FD_stdio_t *)_file; static const char *func = "H5FD_stdio_get_handle"; /* Function Name for error reporting */ @@ -766,8 +759,8 @@ H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) *------------------------------------------------------------------------- */ static herr_t -H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, - void *buf/*out*/) +H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxpl_id, + haddr_t addr, size_t size, void /*OUT*/ *buf) { H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func = "H5FD_stdio_read"; /* Function Name for error reporting */ @@ -871,8 +864,8 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz *------------------------------------------------------------------------- */ static herr_t -H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, - size_t size, const void *buf) +H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxpl_id, + haddr_t addr, size_t size, const void *buf) { H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func = "H5FD_stdio_write"; /* Function Name for error reporting */ @@ -961,7 +954,7 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, *------------------------------------------------------------------------- */ static herr_t -H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) +H5FD_stdio_flush(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, unsigned closing) { H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func = "H5FD_stdio_flush"; /* Function Name for error reporting */ @@ -1006,7 +999,8 @@ H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) *------------------------------------------------------------------------- */ static herr_t -H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) +H5FD_stdio_truncate(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, + hbool_t /*UNUSED*/ closing) { H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func = "H5FD_stdio_truncate"; /* Function Name for error reporting */ @@ -27,8 +27,7 @@ * move frequently accessed free lists to the head of the queue. */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FL_init_interface +#include "H5FLmodule.h" /* This source code file is part of the H5FL module */ /* #define H5FL_DEBUG */ @@ -117,6 +116,9 @@ struct H5FL_fac_node_t { struct H5FL_fac_node_t *next; /* Pointer to next block in free list */ }; +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* The head of the list of factory things to garbage collect */ static H5FL_fac_gc_list_t H5FL_fac_gc_head={0,NULL}; @@ -130,14 +132,18 @@ static H5FL_track_t *H5FL_out_head_g = NULL; #endif /* H5FL_TRACK */ /* Forward declarations of local static functions */ -static herr_t H5FL_reg_gc(void); -static herr_t H5FL_reg_gc_list(H5FL_reg_head_t *head); -static herr_t H5FL_arr_gc(void); -static herr_t H5FL_arr_gc_list(H5FL_arr_head_t *head); -static herr_t H5FL_blk_gc(void); -static herr_t H5FL_blk_gc_list(H5FL_blk_head_t *head); -static herr_t H5FL_fac_gc(void); -static herr_t H5FL_fac_gc_list(H5FL_fac_head_t *head); +static herr_t H5FL__reg_gc(void); +static herr_t H5FL__reg_gc_list(H5FL_reg_head_t *head); +static int H5FL__reg_term(void); +static herr_t H5FL__arr_gc(void); +static herr_t H5FL__arr_gc_list(H5FL_arr_head_t *head); +static int H5FL__arr_term(void); +static herr_t H5FL__blk_gc(void); +static herr_t H5FL__blk_gc_list(H5FL_blk_head_t *head); +static int H5FL__blk_term(void); +static herr_t H5FL__fac_gc(void); +static herr_t H5FL__fac_gc_list(H5FL_fac_head_t *head); +static int H5FL__fac_term_all(void); /* Declare a free list to manage the H5FL_blk_node_t struct */ H5FL_DEFINE(H5FL_blk_node_t); @@ -150,26 +156,66 @@ H5FL_DEFINE(H5FL_fac_head_t); /*-------------------------------------------------------------------------- -NAME - H5FL_init_interface -- Initialize interface-specific information -USAGE - herr_t H5FL_init_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. - + NAME + H5FL_term_package + PURPOSE + Terminate various H5FL objects + USAGE + void H5FL_term_package() + RETURNS + Success: Positive if any action might have caused a change in some + other interface; zero otherwise. + Failure: Negative + DESCRIPTION + Release any resources allocated. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Can't report errors... + EXAMPLES + REVISION LOG --------------------------------------------------------------------------*/ -static herr_t -H5FL_init_interface(void) +int +H5FL_term_package(void) { + int n = 0; + FUNC_ENTER_NOAPI_NOINIT_NOERR - /* Nothing currently... */ + if(H5_PKG_INIT_VAR) { + /* Garbage collect any nodes on the free lists */ + (void)H5FL_garbage_coll(); - FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FL_init_interface() */ + /* Shut down the various kinds of free lists */ + n += H5FL__reg_term(); + n += H5FL__fac_term_all(); + n += H5FL__arr_term(); + n += H5FL__blk_term(); + + /* Mark interface closed */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; + } /* end if */ + +#ifdef H5FL_TRACK + /* If we haven't freed all the allocated memory, dump out the list now */ + if(n > 0 && H5FL_out_head_g) { + H5FL_track_t *trk = H5FL_out_head_g; + + /* Dump information about all the outstanding allocations */ + while(trk != NULL) { + /* Print information about the outstanding block */ + HDfprintf(stderr,"%s: Outstanding allocation:\n", FUNC); + HDfprintf(stderr,"\tPtr: %p, File: %s, Function: %s, Line: %d\n", (((unsigned char *)trk) + sizeof(H5FL_track_t)), trk->file, trk->func, trk->line); + H5CS_print_stack(trk->stack, stderr); + + /* Advance to next node */ + trk = trk->next; + } /* end while */ + } /* end if */ +#endif /* H5FL_TRACK */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5FL_term_package() */ /*------------------------------------------------------------------------- @@ -191,7 +237,7 @@ H5FL_init_interface(void) static void * H5FL_malloc(size_t mem_size) { - void *ret_value; /* return value*/ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -297,7 +343,6 @@ H5FL_reg_free(H5FL_reg_head_t *head, void *obj) /* Free tracking information about the allocation location */ H5CS_close_stack(trk->stack); - trk->stack = H5MM_xfree(trk->stack); trk->file = H5MM_xfree(trk->file); trk->func = H5MM_xfree(trk->func); @@ -337,12 +382,12 @@ H5FL_reg_free(H5FL_reg_head_t *head, void *obj) /* Check for exceeding free list memory use limits */ /* First check this particular list */ if(head->onlist * head->size > H5FL_reg_lst_mem_lim) - if(H5FL_reg_gc_list(head)<0) + if(H5FL__reg_gc_list(head) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") /* Then check the global amount memory on regular free lists */ if(H5FL_reg_gc_head.mem_freed>H5FL_reg_glb_mem_lim) - if(H5FL_reg_gc()<0) + if(H5FL__reg_gc() < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") done: @@ -368,7 +413,7 @@ done: void * H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) { - void *ret_value; /* Pointer to object to return */ + void *ret_value = NULL; /* Pointer to object to return */ FUNC_ENTER_NOAPI(NULL) @@ -405,8 +450,8 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) #ifdef H5FL_TRACK /* Copy allocation location information */ - ((H5FL_track_t *)ret_value)->stack = H5MM_calloc(sizeof(H5CS_t)); - H5CS_copy_stack(((H5FL_track_t *)ret_value)->stack); + ((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack(); + HDassert(((H5FL_track_t *)ret_value)->stack); ((H5FL_track_t *)ret_value)->file = H5MM_strdup(call_file); ((H5FL_track_t *)ret_value)->func = H5MM_strdup(call_func); ((H5FL_track_t *)ret_value)->line = call_line; @@ -445,7 +490,7 @@ done: void * H5FL_reg_calloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) { - void *ret_value; /* Pointer to object to return */ + void *ret_value = NULL; /* Pointer to object to return */ FUNC_ENTER_NOAPI(NULL) @@ -466,7 +511,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FL_reg_gc_list + * Function: H5FL__reg_gc_list * * Purpose: Garbage collect on a particular object free list * @@ -476,26 +521,25 @@ done: * Programmer: Quincey Koziol * Tuesday, July 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_reg_gc_list(H5FL_reg_head_t *head) +H5FL__reg_gc_list(H5FL_reg_head_t *head) { H5FL_reg_node_t *free_list; /* Pointer to nodes in free list being garbage collected */ - void *tmp; /* Temporary node pointer */ size_t total_mem; /* Total memory used on list */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Calculate the total memory used on this list */ - total_mem=head->onlist*head->size; + total_mem = head->onlist * head->size; /* For each free list being garbage collected, walk through the nodes and free them */ - free_list=head->list; - while(free_list!=NULL) { - tmp=free_list->next; + free_list = head->list; + while(free_list != NULL) { + void *tmp; /* Temporary node pointer */ + + tmp = free_list->next; /* Decrement the count of nodes allocated and free the node */ head->allocated--; @@ -506,18 +550,18 @@ H5FL_reg_gc_list(H5FL_reg_head_t *head) } /* end while */ /* Indicate no free nodes on the free list */ - head->list=NULL; - head->onlist=0; + head->list = NULL; + head->onlist = 0; /* Decrement global count of free memory on "regular" lists */ - H5FL_reg_gc_head.mem_freed-=total_mem; + H5FL_reg_gc_head.mem_freed -= total_mem; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FL_reg_gc_list() */ +} /* end H5FL__reg_gc_list() */ /*------------------------------------------------------------------------- - * Function: H5FL_reg_gc + * Function: H5FL__reg_gc * * Purpose: Garbage collect on all the object free lists * @@ -534,30 +578,30 @@ H5FL_reg_gc_list(H5FL_reg_head_t *head) *------------------------------------------------------------------------- */ static herr_t -H5FL_reg_gc(void) +H5FL__reg_gc(void) { H5FL_reg_gc_node_t *gc_node; /* Pointer into the list of things to garbage collect */ - herr_t ret_value=SUCCEED; /* return value*/ + herr_t ret_value = SUCCEED; /* return value*/ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Walk through all the free lists, free()'ing the nodes */ - gc_node=H5FL_reg_gc_head.first; - while(gc_node!=NULL) { + gc_node = H5FL_reg_gc_head.first; + while(gc_node != NULL) { /* Release the free nodes on the list */ - if(H5FL_reg_gc_list(gc_node->list)<0) + if(H5FL__reg_gc_list(gc_node->list) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed") /* Go on to the next free list to garbage collect */ - gc_node=gc_node->next; + gc_node = gc_node->next; } /* end while */ /* Double check that all the memory on the free lists is recycled */ - HDassert(H5FL_reg_gc_head.mem_freed==0); + HDassert(H5FL_reg_gc_head.mem_freed == 0); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FL_reg_gc() */ +} /* end H5FL__reg_gc() */ /*-------------------------------------------------------------------------- @@ -566,7 +610,7 @@ done: PURPOSE Terminate various H5FL object free lists USAGE - int H5FL_term() + int H5FL_reg_term() RETURNS Success: Positive if any action might have caused a change in some other interface; zero otherwise. @@ -586,50 +630,46 @@ done: again to reclaim this layer's memory. --------------------------------------------------------------------------*/ static int -H5FL_reg_term(void) +H5FL__reg_term(void) { H5FL_reg_gc_node_t *left; /* pointer to garbage collection lists with work left */ - H5FL_reg_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR + + /* Free the nodes on the garbage collection list, keeping nodes with allocations outstanding */ + left = NULL; + while(H5FL_reg_gc_head.first != NULL) { + H5FL_reg_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ - if (H5_interface_initialize_g) { - /* Free the nodes on the garbage collection list, keeping nodes with allocations outstanding */ - left=NULL; - while(H5FL_reg_gc_head.first!=NULL) { - tmp=H5FL_reg_gc_head.first->next; + /* Get a copy of the next node */ + tmp = H5FL_reg_gc_head.first->next; #ifdef H5FL_DEBUG - printf("H5FL_reg_term: head->name=%s, head->allocated=%d\n", H5FL_reg_gc_head.first->list->name,(int)H5FL_reg_gc_head.first->list->allocated); +printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.first->list->name, (int)H5FL_reg_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ - /* Check if the list has allocations outstanding */ - if(H5FL_reg_gc_head.first->list->allocated>0) { - /* Add free list to the list of nodes with allocations open still */ - H5FL_reg_gc_head.first->next=left; - left=H5FL_reg_gc_head.first; - } /* end if */ - /* No allocations left open for list, get rid of it */ - else { - /* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */ - H5FL_reg_gc_head.first->list->init=0; + /* Check if the list has allocations outstanding */ + if(H5FL_reg_gc_head.first->list->allocated > 0) { + /* Add free list to the list of nodes with allocations open still */ + H5FL_reg_gc_head.first->next = left; + left = H5FL_reg_gc_head.first; + } /* end if */ + /* No allocations left open for list, get rid of it */ + else { + /* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */ + H5FL_reg_gc_head.first->list->init = 0; - /* Free the node from the garbage collection list */ - H5MM_xfree(H5FL_reg_gc_head.first); - } /* end else */ + /* Free the node from the garbage collection list */ + H5MM_xfree(H5FL_reg_gc_head.first); + } /* end else */ - H5FL_reg_gc_head.first=tmp; - } /* end while */ + H5FL_reg_gc_head.first = tmp; + } /* end while */ - /* Point to the list of nodes left with allocations open, if any */ - H5FL_reg_gc_head.first=left; - if (!left) - H5_interface_initialize_g = 0; /*this layer has reached its initial state*/ - } + /* Point to the list of nodes left with allocations open, if any */ + H5FL_reg_gc_head.first = left; - /* Terminating this layer never affects other layers; rather, other layers affect - * the termination of this layer. */ - FUNC_LEAVE_NOAPI(0) -} /* end H5FL_reg_term() */ + FUNC_LEAVE_NOAPI(H5FL_reg_gc_head.first != NULL ? 1 : 0) +} /* end H5FL__reg_term() */ /*------------------------------------------------------------------------- @@ -654,7 +694,7 @@ H5FL_reg_term(void) static H5FL_blk_node_t * H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size) { - H5FL_blk_node_t *temp; /* Temp. pointer to node in the native list */ + H5FL_blk_node_t *temp = NULL; /* Temp. pointer to node in the native list */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -716,7 +756,7 @@ static H5FL_blk_node_t * H5FL_blk_create_list(H5FL_blk_node_t **head, size_t size) { H5FL_blk_node_t *temp; /* Temp. pointer to node in the list */ - H5FL_blk_node_t *ret_value; + H5FL_blk_node_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -809,21 +849,20 @@ done: htri_t H5FL_blk_free_block_avail(H5FL_blk_head_t *head, size_t size) { - H5FL_blk_node_t *free_list; /* The free list of nodes of correct size */ - htri_t ret_value; /* Return value */ + H5FL_blk_node_t *free_list; /* The free list of nodes of correct size */ + htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI_NOERR /* Double check parameters */ HDassert(head); /* check if there is a free list for blocks of this size */ /* and if there are any blocks available on the list */ - if((free_list=H5FL_blk_find_list(&(head->head),size))!=NULL && free_list->list!=NULL) - ret_value=TRUE; + if((free_list = H5FL_blk_find_list(&(head->head), size)) != NULL && free_list->list != NULL) + ret_value = TRUE; else - ret_value=FALSE; -done: + ret_value = FALSE; FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_blk_free_block_avail() */ @@ -849,9 +888,9 @@ done: void * H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) { - H5FL_blk_node_t *free_list; /* The free list of nodes of correct size */ - H5FL_blk_list_t *temp; /* Temp. ptr to the new native list allocated */ - void *ret_value; /* Pointer to the block to return to the user */ + H5FL_blk_node_t *free_list; /* The free list of nodes of correct size */ + H5FL_blk_list_t *temp; /* Temp. ptr to the new native list allocated */ + void *ret_value = NULL; /* Pointer to the block to return to the user */ FUNC_ENTER_NOAPI(NULL) @@ -897,8 +936,8 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) #ifdef H5FL_TRACK /* Copy allocation location information */ - ((H5FL_track_t *)ret_value)->stack = H5MM_calloc(sizeof(H5CS_t)); - H5CS_copy_stack(((H5FL_track_t *)ret_value)->stack); + ((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack(); + HDassert(((H5FL_track_t *)ret_value)->stack); ((H5FL_track_t *)ret_value)->file = H5MM_strdup(call_file); ((H5FL_track_t *)ret_value)->func = H5MM_strdup(call_func); ((H5FL_track_t *)ret_value)->line = call_line; @@ -941,7 +980,7 @@ done: void * H5FL_blk_calloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) { - void *ret_value; /* Pointer to the block to return to the user */ + void *ret_value = NULL; /* Pointer to the block to return to the user */ FUNC_ENTER_NOAPI(NULL) @@ -1001,7 +1040,6 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) /* Free tracking information about the allocation location */ H5CS_close_stack(trk->stack); - trk->stack = H5MM_xfree(trk->stack); trk->file = H5MM_xfree(trk->file); trk->func = H5MM_xfree(trk->func); @@ -1044,20 +1082,20 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) /* Increment the number of blocks on free list */ head->onlist++; - head->list_mem+=free_size; + head->list_mem += free_size; /* Increment the amount of "block" freed memory globally */ - H5FL_blk_gc_head.mem_freed+=free_size; + H5FL_blk_gc_head.mem_freed += free_size; /* Check for exceeding free list memory use limits */ /* First check this particular list */ - if(head->list_mem>H5FL_blk_lst_mem_lim) - if(H5FL_blk_gc_list(head)<0) + if(head->list_mem > H5FL_blk_lst_mem_lim) + if(H5FL__blk_gc_list(head) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") /* Then check the global amount memory on block free lists */ - if(H5FL_blk_gc_head.mem_freed>H5FL_blk_glb_mem_lim) - if(H5FL_blk_gc()<0) + if(H5FL_blk_gc_head.mem_freed > H5FL_blk_glb_mem_lim) + if(H5FL__blk_gc() < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") done: @@ -1121,7 +1159,8 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_ trk->func = H5MM_xfree(trk->func); /* Store new tracking information */ - H5CS_copy_stack(trk->stack); + trk->stack = H5CS_copy_stack(); + HDassert(trk->stack); trk->file = H5MM_strdup(call_file); trk->func = H5MM_strdup(call_func); trk->line = call_line; @@ -1140,7 +1179,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FL_blk_gc_list + * Function: H5FL__blk_gc_list * * Purpose: Garbage collect a priority queue * @@ -1150,34 +1189,33 @@ done: * Programmer: Quincey Koziol * Thursday, March 23, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_blk_gc_list(H5FL_blk_head_t *head) +H5FL__blk_gc_list(H5FL_blk_head_t *head) { - H5FL_blk_list_t *list; /* The free list of native nodes of a particular size */ - void *next; /* Temp. ptr to the free list list node */ - void *temp; /* Temp. ptr to the free list page node */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Loop through all the nodes in the block free list queue */ - while(head->head!=NULL) { - temp=head->head->next; + while(head->head != NULL) { + H5FL_blk_list_t *list; /* The free list of native nodes of a particular size */ + void *temp; /* Temp. ptr to the free list page node */ + + temp = head->head->next; /* Loop through all the blocks in the free list, freeing them */ - list=head->head->list; - while(list!=NULL) { - next=list->next; + list = head->head->list; + while(list != NULL) { + void *next; /* Temp. ptr to the free list list node */ + + next = list->next; /* Decrement the number of blocks & memory allocated from this PQ */ head->allocated--; - head->list_mem-=head->head->size; + head->list_mem -= head->head->size; /* Decrement global count of free memory on "block" lists */ - H5FL_blk_gc_head.mem_freed-=head->head->size; + H5FL_blk_gc_head.mem_freed -= head->head->size; /* Free the block */ H5MM_free(list); @@ -1200,11 +1238,11 @@ H5FL_blk_gc_list(H5FL_blk_head_t *head) HDassert(0 == head->list_mem); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FL_blk_gc_list() */ +} /* end H5FL__blk_gc_list() */ /*------------------------------------------------------------------------- - * Function: H5FL_blk_gc + * Function: H5FL__blk_gc * * Purpose: Garbage collect on all the priority queues * @@ -1214,44 +1252,42 @@ H5FL_blk_gc_list(H5FL_blk_head_t *head) * Programmer: Quincey Koziol * Saturday, March 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_blk_gc(void) +H5FL__blk_gc(void) { H5FL_blk_gc_node_t *gc_node; /* Pointer into the list of things to garbage collect */ - herr_t ret_value=SUCCEED; /* return value*/ + herr_t ret_value = SUCCEED; /* return value*/ FUNC_ENTER_NOAPI_NOINIT /* Walk through all the free lists, free()'ing the nodes */ - gc_node=H5FL_blk_gc_head.first; - while(gc_node!=NULL) { + gc_node = H5FL_blk_gc_head.first; + while(gc_node != NULL) { /* For each free list being garbage collected, walk through the nodes and free them */ - if(H5FL_blk_gc_list(gc_node->pq)<0) + if(H5FL__blk_gc_list(gc_node->pq) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed") /* Go on to the next free list to garbage collect */ - gc_node=gc_node->next; + gc_node = gc_node->next; } /* end while */ /* Double check that all the memory on the free lists are recycled */ - HDassert(H5FL_blk_gc_head.mem_freed==0); + HDassert(H5FL_blk_gc_head.mem_freed == 0); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FL_blk_gc() */ +} /* end H5FL__blk_gc() */ /*-------------------------------------------------------------------------- NAME - H5FL_blk_term + H5FL__blk_term PURPOSE Terminate various H5FL_blk objects USAGE - void H5FL_blk_term() + void H5FL__blk_term() RETURNS Success: Positive if any action might have caused a change in some other interface; zero otherwise. @@ -1265,45 +1301,46 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static int -H5FL_blk_term(void) +H5FL__blk_term(void) { H5FL_blk_gc_node_t *left; /* pointer to garbage collection lists with work left */ - H5FL_blk_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Free the nodes on the garbage collection list, keeping nodes with allocations outstanding */ - left=NULL; - while(H5FL_blk_gc_head.first!=NULL) { - tmp=H5FL_blk_gc_head.first->next; + left = NULL; + while(H5FL_blk_gc_head.first != NULL) { + H5FL_blk_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ + + tmp = H5FL_blk_gc_head.first->next; #ifdef H5FL_DEBUG -printf("H5FL_blk_term: head->name=%s, head->allocated=%d\n", H5FL_blk_gc_head.first->pq->name,(int)H5FL_blk_gc_head.first->pq->allocated); +printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.first->pq->name, (int)H5FL_blk_gc_head.first->pq->allocated); #endif /* H5FL_DEBUG */ /* Check if the list has allocations outstanding */ - if(H5FL_blk_gc_head.first->pq->allocated>0) { + if(H5FL_blk_gc_head.first->pq->allocated > 0) { /* Add free list to the list of nodes with allocations open still */ - H5FL_blk_gc_head.first->next=left; - left=H5FL_blk_gc_head.first; + H5FL_blk_gc_head.first->next = left; + left = H5FL_blk_gc_head.first; } /* end if */ /* No allocations left open for list, get rid of it */ else { /* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */ - H5FL_blk_gc_head.first->pq->init=0; + H5FL_blk_gc_head.first->pq->init = 0; /* Free the node from the garbage collection list */ H5MM_free(H5FL_blk_gc_head.first); } /* end else */ - H5FL_blk_gc_head.first=tmp; + H5FL_blk_gc_head.first = tmp; } /* end while */ /* Point to the list of nodes left with allocations open, if any */ - H5FL_blk_gc_head.first=left; + H5FL_blk_gc_head.first = left; - FUNC_LEAVE_NOAPI(H5FL_blk_gc_head.first!=NULL ? 1 : 0) -} /* end H5FL_blk_term() */ + FUNC_LEAVE_NOAPI(H5FL_blk_gc_head.first != NULL ? 1 : 0) +} /* end H5FL__blk_term() */ /*------------------------------------------------------------------------- @@ -1422,13 +1459,13 @@ H5FL_arr_free(H5FL_arr_head_t *head, void *obj) /* Check for exceeding free list memory use limits */ /* First check this particular list */ - if(head->list_mem>H5FL_arr_lst_mem_lim) - if(H5FL_arr_gc_list(head)<0) + if(head->list_mem > H5FL_arr_lst_mem_lim) + if(H5FL__arr_gc_list(head) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") /* Then check the global amount memory on array free lists */ - if(H5FL_arr_gc_head.mem_freed>H5FL_arr_glb_mem_lim) - if(H5FL_arr_gc()<0) + if(H5FL_arr_gc_head.mem_freed > H5FL_arr_glb_mem_lim) + if(H5FL__arr_gc() < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") done: @@ -1455,8 +1492,8 @@ void * H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem) { H5FL_arr_list_t *new_obj; /* Pointer to the new free list node allocated */ - void *ret_value; /* Pointer to object to return */ - size_t mem_size; /* Size of memory block being recycled */ + size_t mem_size; /* Size of memory block being recycled */ + void *ret_value = NULL; /* Pointer to the block to return */ FUNC_ENTER_NOAPI(NULL) @@ -1529,7 +1566,7 @@ done: void * H5FL_arr_calloc(H5FL_arr_head_t *head, size_t elem) { - void *ret_value; /* Pointer to object to return */ + void *ret_value = NULL; /* Pointer to the block to return */ FUNC_ENTER_NOAPI(NULL) @@ -1567,51 +1604,50 @@ done: void * H5FL_arr_realloc(H5FL_arr_head_t *head, void * obj, size_t new_elem) { - void *ret_value; /* Pointer to object to return */ + void *ret_value = NULL; /* Pointer to the block to return */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_NOAPI_NOERR /* Double check parameters */ HDassert(head); HDassert(new_elem); /* Check if we are really allocating the object */ - if(obj==NULL) - ret_value=H5FL_arr_malloc(head,new_elem); + if(obj == NULL) + ret_value = H5FL_arr_malloc(head, new_elem); else { H5FL_arr_list_t *temp; /* Temp. ptr to the new free list node allocated */ /* Sanity check that the number of elements is supported */ - HDassert((int)new_elem<=head->maxelem); + HDassert((int)new_elem <= head->maxelem); /* Get the pointer to the info header in front of the block to free */ - temp=(H5FL_arr_list_t *)((unsigned char *)obj-sizeof(H5FL_arr_list_t)); /*lint !e826 Pointer-to-pointer cast is appropriate here */ + temp = (H5FL_arr_list_t *)((unsigned char *)obj - sizeof(H5FL_arr_list_t)); /*lint !e826 Pointer-to-pointer cast is appropriate here */ /* Check if the size is really changing */ - if(temp->nelem!=new_elem) { + if(temp->nelem != new_elem) { size_t blk_size; /* Size of block */ /* Get the new array of objects */ - ret_value=H5FL_arr_malloc(head,new_elem); + ret_value = H5FL_arr_malloc(head, new_elem); /* Copy the appropriate amount of elements */ - blk_size = head->list_arr[ MIN(temp->nelem, new_elem) ].size; - HDmemcpy(ret_value,obj,blk_size); + blk_size = head->list_arr[MIN(temp->nelem, new_elem)].size; + HDmemcpy(ret_value, obj, blk_size); /* Free the old block */ - H5FL_arr_free(head,obj); + H5FL_arr_free(head, obj); } /* end if */ else - ret_value=obj; + ret_value = obj; } /* end else */ -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_arr_realloc() */ /*------------------------------------------------------------------------- - * Function: H5FL_arr_gc_list + * Function: H5FL__arr_gc_list * * Purpose: Garbage collect on an array object free list * @@ -1621,29 +1657,29 @@ done: * Programmer: Quincey Koziol * Tuesday, July 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_arr_gc_list(H5FL_arr_head_t *head) +H5FL__arr_gc_list(H5FL_arr_head_t *head) { - H5FL_arr_list_t *arr_free_list; /* Pointer to nodes in free list being garbage collected */ - void *tmp; /* Temporary node pointer */ unsigned u; /* Counter for array of free lists */ - size_t total_mem; /* Total memory used on list */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Walk through the array of free lists */ - for(u=0; u<(unsigned)head->maxelem; u++) { - if(head->list_arr[u].onlist>0) { + for(u = 0; u < (unsigned)head->maxelem; u++) { + if(head->list_arr[u].onlist > 0) { + H5FL_arr_list_t *arr_free_list; /* Pointer to nodes in free list being garbage collected */ + size_t total_mem; /* Total memory used on list */ + /* Calculate the total memory used on this list */ - total_mem=head->list_arr[u].onlist*head->list_arr[u].size; + total_mem = head->list_arr[u].onlist * head->list_arr[u].size; /* For each free list being garbage collected, walk through the nodes and free them */ - arr_free_list=head->list_arr[u].list; - while(arr_free_list!=NULL) { + arr_free_list = head->list_arr[u].list; + while(arr_free_list != NULL) { + void *tmp; /* Temporary node pointer */ + tmp = arr_free_list->next; /* Decrement the count of nodes allocated and free the node */ @@ -1658,22 +1694,22 @@ H5FL_arr_gc_list(H5FL_arr_head_t *head) head->list_arr[u].onlist = 0; /* Decrement count of free memory on this "array" list */ - head->list_mem-=total_mem; + head->list_mem -= total_mem; /* Decrement global count of free memory on "array" lists */ - H5FL_arr_gc_head.mem_freed-=total_mem; + H5FL_arr_gc_head.mem_freed -= total_mem; } /* end if */ } /* end for */ /* Double check that all the memory on this list is recycled */ - HDassert(head->list_mem==0); + HDassert(head->list_mem == 0); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FL_arr_gc_list() */ +} /* end H5FL__arr_gc_list() */ /*------------------------------------------------------------------------- - * Function: H5FL_arr_gc + * Function: H5FL__arr_gc * * Purpose: Garbage collect on all the array object free lists * @@ -1683,44 +1719,42 @@ H5FL_arr_gc_list(H5FL_arr_head_t *head) * Programmer: Quincey Koziol * Saturday, March 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_arr_gc(void) +H5FL__arr_gc(void) { H5FL_gc_arr_node_t *gc_arr_node; /* Pointer into the list of things to garbage collect */ - herr_t ret_value=SUCCEED; /* return value*/ + herr_t ret_value = SUCCEED; /* return value*/ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Walk through all the free lists, free()'ing the nodes */ - gc_arr_node=H5FL_arr_gc_head.first; - while(gc_arr_node!=NULL) { + gc_arr_node = H5FL_arr_gc_head.first; + while(gc_arr_node != NULL) { /* Release the free nodes on the list */ - if(H5FL_arr_gc_list(gc_arr_node->list)<0) + if(H5FL__arr_gc_list(gc_arr_node->list) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed") /* Go on to the next free list to garbage collect */ - gc_arr_node=gc_arr_node->next; + gc_arr_node = gc_arr_node->next; } /* end while */ /* Double check that all the memory on the free lists are recycled */ - HDassert(H5FL_arr_gc_head.mem_freed==0); + HDassert(H5FL_arr_gc_head.mem_freed == 0); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FL_arr_gc() */ +} /* end H5FL__arr_gc() */ /*-------------------------------------------------------------------------- NAME - H5FL_arr_term + H5FL__arr_term PURPOSE Terminate various H5FL array object free lists USAGE - int H5FL_arr_term() + int H5FL__arr_term() RETURNS Success: Positive if any action might have caused a change in some other interface; zero otherwise. @@ -1734,26 +1768,27 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static int -H5FL_arr_term(void) +H5FL__arr_term(void) { H5FL_gc_arr_node_t *left; /* pointer to garbage collection lists with work left */ - H5FL_gc_arr_node_t *tmp; /* Temporary pointer to a garbage collection node */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Free the nodes on the garbage collection list, keeping nodes with allocations outstanding */ - left=NULL; - while(H5FL_arr_gc_head.first!=NULL) { - tmp=H5FL_arr_gc_head.first->next; + left = NULL; + while(H5FL_arr_gc_head.first != NULL) { + H5FL_gc_arr_node_t *tmp; /* Temporary pointer to a garbage collection node */ + + tmp = H5FL_arr_gc_head.first->next; /* Check if the list has allocations outstanding */ #ifdef H5FL_DEBUG -printf("H5FL_arr_term: head->name=%s, head->allocated=%d\n", H5FL_arr_gc_head.first->list->name,(int)H5FL_arr_gc_head.first->list->allocated); +printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_arr_gc_head.first->list->name, (int)H5FL_arr_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ - if(H5FL_arr_gc_head.first->list->allocated>0) { + if(H5FL_arr_gc_head.first->list->allocated > 0) { /* Add free list to the list of nodes with allocations open still */ - H5FL_arr_gc_head.first->next=left; - left=H5FL_arr_gc_head.first; + H5FL_arr_gc_head.first->next = left; + left = H5FL_arr_gc_head.first; } /* end if */ /* No allocations left open for list, get rid of it */ else { @@ -1761,20 +1796,20 @@ printf("H5FL_arr_term: head->name=%s, head->allocated=%d\n", H5FL_arr_gc_head.fi H5MM_xfree(H5FL_arr_gc_head.first->list->list_arr); /* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */ - H5FL_arr_gc_head.first->list->init=0; + H5FL_arr_gc_head.first->list->init = 0; /* Free the node from the garbage collection list */ H5MM_free(H5FL_arr_gc_head.first); } /* end else */ - H5FL_arr_gc_head.first=tmp; + H5FL_arr_gc_head.first = tmp; } /* end while */ /* Point to the list of nodes left with allocations open, if any */ - H5FL_arr_gc_head.first=left; + H5FL_arr_gc_head.first = left; - FUNC_LEAVE_NOAPI(H5FL_arr_gc_head.first!=NULL ? 1 : 0) -} /* end H5FL_arr_term() */ + FUNC_LEAVE_NOAPI(H5FL_arr_gc_head.first != NULL ? 1 : 0) +} /* end H5FL__arr_term() */ /*------------------------------------------------------------------------- @@ -1831,18 +1866,17 @@ H5FL_seq_free(H5FL_seq_head_t *head, void *obj) void * H5FL_seq_malloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) { - void *ret_value; /* Pointer to object to return */ + void *ret_value = NULL; /* Pointer to the block to return */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_NOAPI_NOERR /* Double check parameters */ HDassert(head); HDassert(elem); /* Use block routine */ - ret_value=H5FL_blk_malloc(&(head->queue),head->size*elem H5FL_TRACK_INFO_INT); + ret_value = H5FL_blk_malloc(&(head->queue), head->size * elem H5FL_TRACK_INFO_INT); -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_seq_malloc() */ @@ -1865,18 +1899,17 @@ done: void * H5FL_seq_calloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) { - void *ret_value; /* Pointer to object to return */ + void *ret_value = NULL; /* Pointer to the block to return */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_NOAPI_NOERR /* Double check parameters */ HDassert(head); HDassert(elem); /* Use block routine */ - ret_value=H5FL_blk_calloc(&(head->queue),head->size*elem H5FL_TRACK_INFO_INT); + ret_value = H5FL_blk_calloc(&(head->queue), head->size * elem H5FL_TRACK_INFO_INT); -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_seq_calloc() */ @@ -1899,18 +1932,17 @@ done: void * H5FL_seq_realloc(H5FL_seq_head_t *head, void * obj, size_t new_elem H5FL_TRACK_PARAMS) { - void *ret_value; /* Pointer to object to return */ + void *ret_value = NULL; /* Pointer to the block to return */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_NOAPI_NOERR /* Double check parameters */ HDassert(head); HDassert(new_elem); /* Use block routine */ - ret_value=H5FL_blk_realloc(&(head->queue),obj,head->size*new_elem H5FL_TRACK_INFO_INT); + ret_value = H5FL_blk_realloc(&(head->queue), obj, head->size * new_elem H5FL_TRACK_INFO_INT); -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_seq_realloc() */ @@ -1936,9 +1968,9 @@ done: H5FL_fac_head_t * H5FL_fac_init(size_t size) { - H5FL_fac_gc_node_t *new_node = NULL; /* Pointer to the node for the new list to garbage collect */ - H5FL_fac_head_t *factory = NULL; /* Pointer to new block factory */ - H5FL_fac_head_t *ret_value; /* Return value */ + H5FL_fac_gc_node_t *new_node = NULL; /* Pointer to the node for the new list to garbage collect */ + H5FL_fac_head_t *factory = NULL; /* Pointer to new block factory */ + H5FL_fac_head_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -2013,7 +2045,7 @@ done: void * H5FL_fac_free(H5FL_fac_head_t *head, void *obj) { - void *ret_value=NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ /* NOINIT OK here because this must be called after H5FL_fac_init -NAF */ FUNC_ENTER_NOAPI_NOINIT @@ -2028,7 +2060,6 @@ H5FL_fac_free(H5FL_fac_head_t *head, void *obj) /* Free tracking information about the allocation location */ H5CS_close_stack(trk->stack); - trk->stack = H5MM_xfree(trk->stack); trk->file = H5MM_xfree(trk->file); trk->func = H5MM_xfree(trk->func); @@ -2054,26 +2085,26 @@ H5FL_fac_free(H5FL_fac_head_t *head, void *obj) HDassert(head->init); /* Link into the free list */ - ((H5FL_fac_node_t *)obj)->next=head->list; + ((H5FL_fac_node_t *)obj)->next = head->list; /* Point free list at the node freed */ - head->list=(H5FL_fac_node_t *)obj; + head->list = (H5FL_fac_node_t *)obj; /* Increment the number of blocks on free list */ head->onlist++; /* Increment the amount of "factory" freed memory globally */ - H5FL_fac_gc_head.mem_freed+=head->size; + H5FL_fac_gc_head.mem_freed += head->size; /* Check for exceeding free list memory use limits */ /* First check this particular list */ if(head->onlist * head->size > H5FL_fac_lst_mem_lim) - if(H5FL_fac_gc_list(head)<0) + if(H5FL__fac_gc_list(head) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") /* Then check the global amount memory on factory free lists */ if(H5FL_fac_gc_head.mem_freed > H5FL_fac_glb_mem_lim) - if(H5FL_fac_gc()<0) + if(H5FL__fac_gc() < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") done: @@ -2102,7 +2133,7 @@ done: void * H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) { - void *ret_value; /* Pointer to object to return */ + void *ret_value = NULL; /* Pointer to the block to return */ /* NOINIT OK here because this must be called after H5FL_fac_init -NAF */ FUNC_ENTER_NOAPI_NOINIT @@ -2136,8 +2167,8 @@ H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) #ifdef H5FL_TRACK /* Copy allocation location information */ - ((H5FL_track_t *)ret_value)->stack = H5MM_calloc(sizeof(H5CS_t)); - H5CS_copy_stack(((H5FL_track_t *)ret_value)->stack); + ((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack(); + HDassert(((H5FL_track_t *)ret_value)->stack); ((H5FL_track_t *)ret_value)->file = H5MM_strdup(call_file); ((H5FL_track_t *)ret_value)->func = H5MM_strdup(call_func); ((H5FL_track_t *)ret_value)->line = call_line; @@ -2179,7 +2210,7 @@ done: void * H5FL_fac_calloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) { - void *ret_value; /* Pointer to object to return */ + void *ret_value = NULL; /* Pointer to the block to return */ /* NOINIT OK here because this must be called after H5FL_fac_init -NAF */ FUNC_ENTER_NOAPI_NOINIT @@ -2198,9 +2229,10 @@ H5FL_fac_calloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_fac_calloc() */ + /*------------------------------------------------------------------------- - * Function: H5FL_fac_gc_list + * Function: H5FL__fac_gc_list * * Purpose: Garbage collect on a particular factory free list * @@ -2210,26 +2242,25 @@ done: * Programmer: Neil Fortner * Friday, December 19, 2008 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_fac_gc_list(H5FL_fac_head_t *head) +H5FL__fac_gc_list(H5FL_fac_head_t *head) { H5FL_fac_node_t *free_list; /* Pointer to nodes in free list being garbage collected */ - void *tmp; /* Temporary node pointer */ size_t total_mem; /* Total memory used on list */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Calculate the total memory used on this list */ - total_mem=head->onlist*head->size; + total_mem = head->onlist * head->size; /* For each free list being garbage collected, walk through the nodes and free them */ - free_list=head->list; - while(free_list!=NULL) { - tmp=free_list->next; + free_list = head->list; + while(free_list != NULL) { + void *tmp; /* Temporary node pointer */ + + tmp = free_list->next; /* Decrement the count of nodes allocated and free the node */ head->allocated--; @@ -2240,18 +2271,18 @@ H5FL_fac_gc_list(H5FL_fac_head_t *head) } /* end while */ /* Indicate no free nodes on the free list */ - head->list=NULL; - head->onlist=0; + head->list = NULL; + head->onlist = 0; /* Decrement global count of free memory on "factory" lists */ - H5FL_fac_gc_head.mem_freed-=total_mem; + H5FL_fac_gc_head.mem_freed -= total_mem; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FL_fac_gc_list() */ +} /* end H5FL__fac_gc_list() */ /*------------------------------------------------------------------------- - * Function: H5FL_fac_gc + * Function: H5FL__fac_gc * * Purpose: Garbage collect on all the factory free lists * @@ -2261,35 +2292,33 @@ H5FL_fac_gc_list(H5FL_fac_head_t *head) * Programmer: Neil Fortner * Friday, December 19, 2008 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_fac_gc(void) +H5FL__fac_gc(void) { H5FL_fac_gc_node_t *gc_node; /* Pointer into the list of things to garbage collect */ - herr_t ret_value=SUCCEED; /* return value*/ + herr_t ret_value = SUCCEED; /* return value*/ FUNC_ENTER_NOAPI_NOINIT /* Walk through all the free lists, free()'ing the nodes */ - gc_node=H5FL_fac_gc_head.first; - while(gc_node!=NULL) { + gc_node = H5FL_fac_gc_head.first; + while(gc_node != NULL) { /* Release the free nodes on the list */ - if(H5FL_fac_gc_list(gc_node->list)<0) + if(H5FL__fac_gc_list(gc_node->list) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed") /* Go on to the next free list to garbage collect */ - gc_node=gc_node->next; + gc_node = gc_node->next; } /* end while */ /* Double check that all the memory on the free lists is recycled */ - HDassert(H5FL_fac_gc_head.mem_freed==0); + HDassert(H5FL_fac_gc_head.mem_freed == 0); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FL_fac_gc() */ +} /* end H5FL__fac_gc() */ /*------------------------------------------------------------------------- @@ -2323,11 +2352,11 @@ H5FL_fac_term(H5FL_fac_head_t *factory) HDassert(factory); /* Garbage collect all the blocks in the factory's free list */ - if(H5FL_fac_gc_list(factory)<0) + if(H5FL__fac_gc_list(factory) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of factory failed") /* Verify that all the blocks have been freed */ - if(factory->allocated>0) + if(factory->allocated > 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "factory still has objects allocated") /* Unlink block free list for factory from global free list */ @@ -2358,7 +2387,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5FL_fac_term_all + * Function: H5FL__fac_term_all * * Purpose: Terminate all block factories * @@ -2368,23 +2397,21 @@ done: * Programmer: Neil Fortner * Friday, December 19, 2008 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -H5FL_fac_term_all(void) +H5FL__fac_term_all(void) { - H5FL_fac_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Free the nodes on the garbage collection list */ while(H5FL_fac_gc_head.first != NULL) { - tmp=H5FL_fac_gc_head.first->next; + H5FL_fac_gc_node_t *tmp; /* Temporary pointer to a garbage collection node */ + + tmp = H5FL_fac_gc_head.first->next; #ifdef H5FL_DEBUG -printf("H5FL_fac_term: head->size=%d, head->allocated=%d\n", (int)H5FL_fac_gc_head.first->list->size,(int)H5FL_fac_gc_head.first->list->allocated); +printf("%s: head->size = %d, head->allocated = %d\n", FUNC, (int)H5FL_fac_gc_head.first->list->size, (int)H5FL_fac_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ /* The list cannot have any allocations outstanding */ @@ -2400,7 +2427,7 @@ printf("H5FL_fac_term: head->size=%d, head->allocated=%d\n", (int)H5FL_fac_gc_he } /* end while */ FUNC_LEAVE_NOAPI(0) -} /* end H5FL_fac_term_all() */ +} /* end H5FL__fac_term_all() */ /*------------------------------------------------------------------------- @@ -2426,20 +2453,20 @@ H5FL_garbage_coll(void) FUNC_ENTER_NOAPI(FAIL) /* Garbage collect the free lists for array objects */ - if(H5FL_arr_gc()<0) + if(H5FL__arr_gc() < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect array objects") /* Garbage collect free lists for blocks */ - if(H5FL_blk_gc()<0) + if(H5FL__blk_gc() < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect block objects") /* Garbage collect the free lists for regular objects */ - if(H5FL_reg_gc()<0) + if(H5FL__reg_gc() < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect regular objects") /* Garbage collect the free lists for factory objects */ - if(H5FL_fac_gc()<0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect regular objects") + if(H5FL__fac_gc() < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect factory objects") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2482,82 +2509,28 @@ H5FL_set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_l int arr_list_lim, int blk_global_lim, int blk_list_lim, int fac_global_lim, int fac_list_lim) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI_NOERR /* Set the limit variables */ /* limit on all regular free lists */ - H5FL_reg_glb_mem_lim=(reg_global_lim==-1 ? UINT_MAX : (size_t)reg_global_lim); + H5FL_reg_glb_mem_lim = (reg_global_lim == -1 ? UINT_MAX : (size_t)reg_global_lim); /* limit on each regular free list */ - H5FL_reg_lst_mem_lim=(reg_list_lim==-1 ? UINT_MAX : (size_t)reg_list_lim); + H5FL_reg_lst_mem_lim = (reg_list_lim == -1 ? UINT_MAX : (size_t)reg_list_lim); /* limit on all array free lists */ - H5FL_arr_glb_mem_lim=(arr_global_lim==-1 ? UINT_MAX : (size_t)arr_global_lim); + H5FL_arr_glb_mem_lim = (arr_global_lim == -1 ? UINT_MAX : (size_t)arr_global_lim); /* limit on each array free list */ - H5FL_arr_lst_mem_lim=(arr_list_lim==-1 ? UINT_MAX : (size_t)arr_list_lim); + H5FL_arr_lst_mem_lim = (arr_list_lim == -1 ? UINT_MAX : (size_t)arr_list_lim); /* limit on all block free lists */ - H5FL_blk_glb_mem_lim=(blk_global_lim==-1 ? UINT_MAX : (size_t)blk_global_lim); + H5FL_blk_glb_mem_lim = (blk_global_lim == -1 ? UINT_MAX : (size_t)blk_global_lim); /* limit on each block free list */ - H5FL_blk_lst_mem_lim=(blk_list_lim==-1 ? UINT_MAX : (size_t)blk_list_lim); + H5FL_blk_lst_mem_lim = (blk_list_lim == -1 ? UINT_MAX : (size_t)blk_list_lim); /* limit on all factory free lists */ - H5FL_fac_glb_mem_lim=(fac_global_lim==-1 ? UINT_MAX : (size_t)fac_global_lim); + H5FL_fac_glb_mem_lim = (fac_global_lim == -1 ? UINT_MAX : (size_t)fac_global_lim); /* limit on each factory free list */ - H5FL_fac_lst_mem_lim=(fac_list_lim==-1 ? UINT_MAX : (size_t)fac_list_lim); + H5FL_fac_lst_mem_lim = (fac_list_lim == -1 ? UINT_MAX : (size_t)fac_list_lim); -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_set_free_list_limits() */ - -/*-------------------------------------------------------------------------- - NAME - H5FL_term_interface - PURPOSE - Terminate various H5FL objects - USAGE - void H5FL_term_interface() - RETURNS - Success: Positive if any action might have caused a change in some - other interface; zero otherwise. - Failure: Negative - DESCRIPTION - Release any resources allocated. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - Can't report errors... - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -int -H5FL_term_interface(void) -{ - int ret_value=0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Garbage collect any nodes on the free lists */ - (void)H5FL_garbage_coll(); - - ret_value=H5FL_reg_term()+H5FL_fac_term_all()+H5FL_arr_term()+H5FL_blk_term(); - -#ifdef H5FL_TRACK - /* If we haven't freed all the allocated memory, dump out the list now */ - if(ret_value > 0 && H5FL_out_head_g) { - H5FL_track_t *trk = H5FL_out_head_g; - - /* Dump information about all the outstanding allocations */ - while(trk != NULL) { - /* Print information about the outstanding block */ - HDfprintf(stderr,"%s: Outstanding allocation:\n", "H5FL_term_interface"); - HDfprintf(stderr,"\tFile: %s, Function: %s, Line: %d\n", trk->file, trk->func, trk->line); - H5CS_print_stack(trk->stack, stderr); - - /* Advance to next node */ - trk = trk->next; - } /* end while */ - } /* end if */ -#endif /* H5FL_TRACK */ - - FUNC_LEAVE_NOAPI(ret_value) -} - diff --git a/src/H5FLmodule.h b/src/H5FLmodule.h new file mode 100644 index 0000000..cfa585c --- /dev/null +++ b/src/H5FLmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5FL package. Including this header means that the source file + * is part of the H5FL package. + */ +#ifndef _H5FLmodule_H +#define _H5FLmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5FL_MODULE +#define H5_MY_PKG H5FL +#define H5_MY_PKG_ERR H5E_RESOURCE +#define H5_MY_PKG_INIT NO + +#endif /* _H5FLmodule_H */ + @@ -21,7 +21,7 @@ * */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #include "H5Eprivate.h" /* Error handling */ @@ -27,7 +27,8 @@ /* Module Setup */ /****************/ -#define H5FS_PACKAGE /*suppress error about including H5FSpkg */ +#include "H5FSmodule.h" /* This source code file is part of the H5FS module */ + /***********/ /* Headers */ @@ -38,6 +39,7 @@ #include "H5FSpkg.h" /* File free space */ #include "H5MFprivate.h" /* File memory management */ + /****************/ /* Local Macros */ /****************/ @@ -66,6 +68,9 @@ static herr_t H5FS_sinfo_free_node_cb(void *item, void *key, void *op_data); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Declare a free list to manage the H5FS_section_class_t sequence information */ H5FL_SEQ_DEFINE(H5FS_section_class_t); @@ -107,7 +112,7 @@ H5FS_create(H5F_t *f, hid_t dxpl_id, haddr_t *fs_addr, const H5FS_create_t *fs_c uint16_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata, hsize_t alignment, hsize_t threshold) { H5FS_t *fspace = NULL; /* New free space structure */ - H5FS_t *ret_value; /* Return value */ + H5FS_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, NULL) #ifdef H5FS_DEBUG @@ -196,7 +201,7 @@ H5FS_open(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr, uint16_t nclasses, { H5FS_t *fspace = NULL; /* New free space structure */ H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ - H5FS_t *ret_value; /* Return value */ + H5FS_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__FREESPACE_TAG, NULL) #ifdef H5FS_DEBUG @@ -602,7 +607,7 @@ H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes { H5FS_t *fspace = NULL; /* Free space manager */ size_t u; /* Local index variable */ - H5FS_t *ret_value; /* Return value */ + H5FS_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5FScache.c b/src/H5FScache.c index 25a9c5e..25a16e0 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5FS_PACKAGE /*suppress error about including H5FSpkg */ +#include "H5FSmodule.h" /* This source code file is part of the H5FS module */ + /***********/ /* Headers */ @@ -41,6 +42,7 @@ #include "H5VMprivate.h" /* Vectors and arrays */ #include "H5WBprivate.h" /* Wrapped Buffers */ + /****************/ /* Local Macros */ /****************/ @@ -210,7 +212,7 @@ H5FS__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ unsigned nclasses; /* Number of section classes */ - H5FS_t *ret_value; /* Return value */ + H5FS_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -343,7 +345,7 @@ H5FS__cache_hdr_image_len(const void *_thing, size_t *image_len, /*------------------------------------------------------------------------- - * Function: H5FS__cache_hdf_pre_serialize + * Function: H5FS__cache_hdr_pre_serialize * * Purpose: The free space manager header contains the address, size, and * allocation size of the free space manager section info. However, @@ -376,6 +378,8 @@ H5FS__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, unsigned *flags) { H5FS_t *fspace = (H5FS_t *)_thing; /* Pointer to the object */ + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC_TAG(dxpl_id, H5AC__FREESPACE_TAG, FAIL) @@ -391,6 +395,16 @@ H5FS__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, HDassert(flags); if(fspace->sinfo) { + H5AC_ring_t ring; + + /* Retrieve the ring type for the header */ + if(H5AC_get_entry_ring(f, addr, &ring) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "unable to get property value"); + + /* Set the ring type for the section info in the DXPL */ + if(H5AC_set_ring(dxpl_id, ring, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTSET, FAIL, "unable to set ring value") + /* This implies that the header "owns" the section info. * * Unfortunately, the comments in the code are not clear as to @@ -596,6 +610,10 @@ H5FS__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, *flags = 0; done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_FSPACE, H5E_CANTSET, FAIL, "unable to set property value") + FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5FS__cache_hdr_pre_serialize() */ @@ -824,8 +842,8 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t len, void *_udata, size_t old_sect_size; /* Old section size */ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum */ - uint32_t computed_chksum; /* Computed metadata checksum */ - void * ret_value; /* Return value */ + uint32_t computed_chksum; /* Computed metadata checksum */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c index de66ebd..7303b73 100644 --- a/src/H5FSdbg.c +++ b/src/H5FSdbg.c @@ -28,10 +28,11 @@ /* Module Setup */ /****************/ -#define H5FS_PACKAGE /*suppress error about including H5FSpkg */ +#include "H5FSmodule.h" /* This source code file is part of the H5FS module */ #define H5HF_DEBUGGING /* Need access to fractal heap debugging routines */ #define H5MF_DEBUGGING /* Need access to file space debugging routines */ + /***********/ /* Headers */ /***********/ @@ -41,6 +42,7 @@ #include "H5HFprivate.h" /* Fractal heaps */ #include "H5MFprivate.h" /* File memory management */ + /****************/ /* Local Macros */ /****************/ diff --git a/src/H5FSmodule.h b/src/H5FSmodule.h new file mode 100644 index 0000000..b435b79 --- /dev/null +++ b/src/H5FSmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5FS package. Including this header means that the source file + * is part of the H5FS package. + */ +#ifndef _H5FSmodule_H +#define _H5FSmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5FS_MODULE +#define H5_MY_PKG H5FS +#define H5_MY_PKG_ERR H5E_FSPACE +#define H5_MY_PKG_INIT NO + +#endif /* _H5FSmodule_H */ + diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index 2c1eba7..b0df9e6 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -21,7 +21,7 @@ * the H5FS package. Source files outside the H5FS package should * include H5FSprivate.h instead. */ -#ifndef H5FS_PACKAGE +#if !(defined H5FS_FRIEND || defined H5FS_MODULE) #error "Do not include this file outside the H5FS package!" #endif diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 0b47f51..d447160 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -25,7 +25,7 @@ /* Module Setup */ /****************/ -#define H5FS_PACKAGE /*suppress error about including H5FSpkg */ +#include "H5FSmodule.h" /* This source code file is part of the H5FS module */ /***********/ @@ -126,8 +126,8 @@ H5FL_DEFINE(H5FS_sinfo_t); H5FS_sinfo_t * H5FS_sinfo_new(H5F_t *f, H5FS_t *fspace) { - H5FS_sinfo_t *sinfo = NULL; /* Section information struct created */ - H5FS_sinfo_t *ret_value; /* Return value */ + H5FS_sinfo_t *sinfo = NULL; /* Section information struct created */ + H5FS_sinfo_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5FSstat.c b/src/H5FSstat.c index 66c5495..390eb9f 100644 --- a/src/H5FSstat.c +++ b/src/H5FSstat.c @@ -22,7 +22,8 @@ /* Module Setup */ /****************/ -#define H5FS_PACKAGE /*suppress error about including H5FSpkg */ +#include "H5FSmodule.h" /* This source code file is part of the H5FS module */ + /***********/ /* Headers */ @@ -31,6 +32,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FSpkg.h" /* Free-space manager */ + /****************/ /* Local Macros */ /****************/ diff --git a/src/H5FStest.c b/src/H5FStest.c index 63ba94c..f96ee75 100644 --- a/src/H5FStest.c +++ b/src/H5FStest.c @@ -22,9 +22,10 @@ /* Module Setup */ /****************/ -#define H5FS_PACKAGE /*suppress error about including H5FSpkg */ +#include "H5FSmodule.h" /* This source code file is part of the H5FS module */ #define H5FS_TESTING /*suppress warning about H5FS testing funcs */ + /***********/ /* Headers */ /***********/ @@ -32,6 +33,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5FSpkg.h" /* Free-space manager */ + /****************/ /* Local Macros */ /****************/ diff --git a/src/H5Faccum.c b/src/H5Faccum.c index 99f83bd..53f51ad 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -30,7 +30,7 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ diff --git a/src/H5Fcwfs.c b/src/H5Fcwfs.c index 36f0a93..32c73b0 100644 --- a/src/H5Fcwfs.c +++ b/src/H5Fcwfs.c @@ -35,7 +35,7 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ @@ -260,8 +260,9 @@ herr_t H5F_cwfs_advance_heap(H5F_t *f, H5HG_heap_t *heap, hbool_t add_heap) { unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(FAIL) /* Check args */ HDassert(f); @@ -281,7 +282,8 @@ H5F_cwfs_advance_heap(H5F_t *f, H5HG_heap_t *heap, hbool_t add_heap) f->shared->cwfs[f->shared->ncwfs - 1] = heap; } /* end if */ - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5F_cwfs_advance_heap() */ @@ -302,8 +304,9 @@ herr_t H5F_cwfs_remove_heap(H5F_file_t *shared, H5HG_heap_t *heap) { unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(FAIL) /* Check args */ HDassert(shared); @@ -318,6 +321,7 @@ H5F_cwfs_remove_heap(H5F_file_t *shared, H5HG_heap_t *heap) } /* end if */ } /* end for */ - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5F_cwfs_remove_heap() */ diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c index 93da900..11accc6 100644 --- a/src/H5Fdbg.c +++ b/src/H5Fdbg.c @@ -19,8 +19,8 @@ * Purpose: File object debugging functions. */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #include "H5private.h" /* Generic Functions */ diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index 7e2ea17..d16e2d4 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -31,10 +31,7 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5F__init_deprec_interface +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ @@ -82,51 +79,6 @@ /*******************/ - -/*-------------------------------------------------------------------------- -NAME - H5F__init_deprec_interface -- Initialize interface-specific information -USAGE - herr_t H5F__init_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5F_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5F__init_deprec_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5F_init()) -} /* H5F__init_deprec_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5F__term_deprec_interface -- Terminate interface -USAGE - herr_t H5F__term_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5F__term_deprec_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5F__term_deprec_interface() */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- diff --git a/src/H5Fefc.c b/src/H5Fefc.c index 9916002..5e3deb1 100644 --- a/src/H5Fefc.c +++ b/src/H5Fefc.c @@ -26,7 +26,7 @@ *------------------------------------------------------------------------- */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /* Packages needed by this file... */ @@ -92,7 +92,7 @@ H5F_efc_t * H5F_efc_create(unsigned max_nfiles) { H5F_efc_t *efc = NULL; /* EFC object */ - H5F_efc_t *ret_value; /* Return value */ + H5F_efc_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -162,8 +162,7 @@ H5F_efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, * support this so clients do not have to make 2 different calls depending * on the state of the efc. */ if(!efc) { - if(NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id, - dxpl_id))) + if(NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file") /* Increment the number of open objects to prevent the file from being @@ -235,8 +234,7 @@ H5F_efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, } /* end if */ else { /* Cannot cache file, just open file and return */ - if(NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id, - dxpl_id))) + if(NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file") /* Increment the number of open objects to prevent the file from @@ -257,8 +255,7 @@ H5F_efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Open the file */ - if(NULL == (ent->file = H5F_open(name, flags, fcpl_id, fapl_id, - dxpl_id))) + if(NULL == (ent->file = H5F_open(name, flags, fcpl_id, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file") open_file = TRUE; diff --git a/src/H5Ffake.c b/src/H5Ffake.c index af048bc..e191003 100644 --- a/src/H5Ffake.c +++ b/src/H5Ffake.c @@ -13,10 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5F_init_fake_interface +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /* Packages needed by this file... */ @@ -27,28 +24,6 @@ /* PRIVATE PROTOTYPES */ -/*-------------------------------------------------------------------------- -NAME - H5F_init_fake_interface -- Initialize interface-specific information -USAGE - herr_t H5F_init_fake_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5F_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5F_init_fake_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5F_init()) -} /* H5F_init_fake_interface() */ - - /*------------------------------------------------------------------------- * Function: H5F_fake_alloc * @@ -70,7 +45,7 @@ H5F_t * H5F_fake_alloc(uint8_t sizeof_size) { H5F_t *f = NULL; /* Pointer to fake file struct */ - H5F_t *ret_value; /* Return value */ + H5F_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) diff --git a/src/H5Fint.c b/src/H5Fint.c index 0cf60b3..f15b60b 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -17,10 +17,7 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5F_init_interface +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ @@ -103,30 +100,6 @@ H5FL_DEFINE(H5F_file_t); /*------------------------------------------------------------------------- - * Function: H5F_init_interface - * - * Purpose: Initialize interface-specific information. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Robb Matzke - * Friday, November 20, 1998 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5F_init_interface(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F_init_interface() */ - - -/*------------------------------------------------------------------------- * Function: H5F_get_access_plist * * Purpose: Returns a copy of the file access property list of the @@ -154,9 +127,10 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) { H5P_genplist_t *new_plist; /* New property list */ H5P_genplist_t *old_plist; /* Old property list */ - void *driver_info=NULL; - unsigned efc_size = 0; - hid_t ret_value = SUCCEED; + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ + hbool_t driver_prop_copied = FALSE; /* Whether the driver property has been set up */ + unsigned efc_size = 0; + hid_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) @@ -203,32 +177,26 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag") #endif /* H5_HAVE_PARALLEL */ - /* - * Since we're resetting the driver ID and info, close them if they - * exist in this new property list. - */ - if(H5P_facc_close(ret_value, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't free the old driver information") - - /* Increment the reference count on the driver ID and insert it into the property list */ - if(H5I_inc_ref(f->shared->lf->driver_id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver") - if(H5P_set(new_plist, H5F_ACS_FILE_DRV_ID_NAME, &(f->shared->lf->driver_id)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver ID") + /* Prepare the driver property */ + driver_prop.driver_id = f->shared->lf->driver_id; + driver_prop.driver_info = H5FD_fapl_get(f->shared->lf); + driver_prop_copied = TRUE; - /* Set the driver "info" in the property list */ - driver_info = H5FD_fapl_get(f->shared->lf); - if(driver_info != NULL && H5P_set(new_plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver info") + /* Set the driver property */ + if(H5P_set(new_plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver ID & info") /* Set the file close degree appropriately */ - if(f->shared->fc_degree == H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->lf->cls->fc_degree)) < 0) { + if(f->shared->fc_degree == H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->lf->cls->fc_degree)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") - } else if(f->shared->fc_degree != H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->fc_degree)) < 0) { + else if(f->shared->fc_degree != H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->fc_degree)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") - } done: + /* Release the copy of the driver info, if it was set up */ + if(driver_prop_copied && H5FD_fapl_close(driver_prop.driver_id, driver_prop.driver_info) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close copy of driver info") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_access_plist() */ @@ -537,7 +505,7 @@ H5F_is_hdf5(const char *name) { H5FD_t *file = NULL; /* Low-level file struct */ haddr_t sig_addr; /* Addess of hdf5 file signature */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -585,7 +553,7 @@ done: H5F_t * H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) { - H5F_t *f = NULL, *ret_value; + H5F_t *f = NULL, *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT @@ -963,7 +931,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_class_t *drvr; /*file driver class info */ H5P_genplist_t *a_plist; /*file access property list */ H5F_close_degree_t fc_degree; /*file close degree */ - H5F_t *ret_value; /*actual return value */ + H5F_t *ret_value = NULL; /*actual return value */ FUNC_ENTER_NOAPI(NULL) @@ -1462,7 +1430,7 @@ done: hid_t H5F_get_id(H5F_t *file, hbool_t app_ref) { - hid_t ret_value; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1986,7 +1954,7 @@ H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) { H5FD_t *fd_ptr; /* file driver */ haddr_t eoa; /* End of file address */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Fio.c b/src/H5Fio.c index 763bd69..04c4055 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ diff --git a/src/H5Fmodule.h b/src/H5Fmodule.h new file mode 100644 index 0000000..4bb2506 --- /dev/null +++ b/src/H5Fmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5F package. Including this header means that the source file + * is part of the H5F package. + */ +#ifndef _H5Fmodule_H +#define _H5Fmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5F_MODULE +#define H5_MY_PKG H5F +#define H5_MY_PKG_ERR H5E_FILE +#define H5_MY_PKG_INIT YES + +#endif /* _H5Fmodule_H */ + diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 643eba5..99fa4f2 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -13,10 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5F_init_mount_interface +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /* Packages needed by this file... */ @@ -36,28 +33,6 @@ static herr_t H5F_unmount(H5G_loc_t *loc, const char *name, hid_t dxpl_id); static void H5F_mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs); -/*-------------------------------------------------------------------------- -NAME - H5F_init_mount_interface -- Initialize interface-specific information -USAGE - herr_t H5F_init_mount_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5F_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5F_init_mount_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5F_init()) -} /* H5F_init_mount_interface() */ - - /*------------------------------------------------------------------------- * Function: H5F_close_mounts * @@ -439,7 +414,7 @@ done: hbool_t H5F_is_mount(const H5F_t *file) { - hbool_t ret_value; /* Return value */ + hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 9f7d316..ae15142 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 63708b8..4fda863 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -21,7 +21,7 @@ * the H5F package. Source files outside the H5F package should * include H5Fprivate.h instead. */ -#ifndef H5F_PACKAGE +#if !(defined H5F_FRIEND || defined H5F_MODULE) #error "Do not include this file outside the H5F package!" #endif @@ -336,8 +336,6 @@ H5_DLLVAR const H5AC_class_t H5AC_DRVRINFO[1]; /******************************/ /* General routines */ -H5_DLL herr_t H5F_init(void); -H5_DLL herr_t H5F__term_deprec_interface(void); H5F_t *H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); herr_t H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 160740a..8c0e608 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -270,7 +270,7 @@ ((O1) >= (O2) && (O1) < ((O2) + (L2)))) /* If the module using this macro is allowed access to the private variables, access them directly */ -#ifdef H5F_PACKAGE +#ifdef H5F_MODULE #define H5F_INTENT(F) ((F)->shared->flags) #define H5F_OPEN_NAME(F) ((F)->open_name) #define H5F_ACTUAL_NAME(F) ((F)->actual_name) @@ -312,7 +312,7 @@ #define H5F_SET_GRP_BTREE_SHARED(F, RC) (((F)->shared->grp_btree_shared = (RC)) ? SUCCEED : FAIL) #define H5F_USE_TMP_SPACE(F) ((F)->shared->use_tmp_space) #define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->tmp_addr, (ADDR))) -#else /* H5F_PACKAGE */ +#else /* H5F_MODULE */ #define H5F_INTENT(F) (H5F_get_intent(F)) #define H5F_OPEN_NAME(F) (H5F_get_open_name(F)) #define H5F_ACTUAL_NAME(F) (H5F_get_actual_name(F)) @@ -354,7 +354,7 @@ #define H5F_SET_GRP_BTREE_SHARED(F, RC) (H5F_set_grp_btree_shared((F), (RC))) #define H5F_USE_TMP_SPACE(F) (H5F_use_tmp_space(F)) #define H5F_IS_TMP_ADDR(F, ADDR) (H5F_is_tmp_addr((F), (ADDR))) -#endif /* H5F_PACKAGE */ +#endif /* H5F_MODULE */ /* Macros to encode/decode offset/length's for storing in the file */ @@ -442,8 +442,7 @@ #define H5F_ACS_SIEVE_BUF_SIZE_NAME "sieve_buf_size" /* Maximum sieve buffer size (when data sieving is allowed by file driver) */ #define H5F_ACS_SDATA_BLOCK_SIZE_NAME "sdata_block_size" /* Minimum "small data" allocation block size (when aggregating "small" raw data allocations) */ #define H5F_ACS_GARBG_COLCT_REF_NAME "gc_ref" /* Garbage-collect references */ -#define H5F_ACS_FILE_DRV_ID_NAME "driver_id" /* File driver ID */ -#define H5F_ACS_FILE_DRV_INFO_NAME "driver_info" /* File driver info */ +#define H5F_ACS_FILE_DRV_NAME "driver-id/info" /* File driver ID & info */ #define H5F_ACS_CLOSE_DEGREE_NAME "close_degree" /* File close degree */ #define H5F_ACS_FAMILY_OFFSET_NAME "family_offset" /* Offset position in file for family file driver */ #define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" /* New member size of family driver. (private property only used by h5repart) */ @@ -667,9 +666,6 @@ H5_DLL void H5F_addr_encode_len(size_t addr_len, uint8_t **pp, haddr_t addr); H5_DLL void H5F_addr_decode(const H5F_t *f, const uint8_t **pp, haddr_t *addr_p); H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t **pp, haddr_t *addr_p); -/* File access property list callbacks */ -H5_DLL herr_t H5P_facc_close(hid_t dxpl_id, void *close_data); - /* Shared file list related routines */ H5_DLL void H5F_sfile_assert_num(unsigned n); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 6290614..05667ac 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ @@ -968,7 +968,7 @@ done: haddr_t H5F_get_eoa(const H5F_t *f, H5FD_mem_t type) { - haddr_t ret_value; + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c index a1c6976..4fb9cd9 100644 --- a/src/H5Fsfile.c +++ b/src/H5Fsfile.c @@ -13,7 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /* Packages needed by this file... */ #include "H5private.h" /* Generic Functions */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index e83330d..50f6b06 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -17,10 +17,7 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5F_init_super_interface +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ /***********/ @@ -77,28 +74,6 @@ H5FL_DEFINE(H5F_super_t); -/*-------------------------------------------------------------------------- -NAME - H5F_init_super_interface -- Initialize interface-specific information -USAGE - herr_t H5F_init_super_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5F_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5F_init_super_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5F_init()) -} /* H5F_init_super_interface() */ - - /*------------------------------------------------------------------------- * Function: H5F_super_ext_create * @@ -206,6 +181,8 @@ herr_t H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hid_t dxpl_id, hbool_t was_created) { + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -216,13 +193,17 @@ H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hid_t dxpl_id, /* Check if extension was created */ if(was_created) { + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_SBE, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Increment link count on superblock extension's object header */ if(H5O_link(ext_ptr, 1, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_LINKCOUNT, FAIL, "unable to increment hard link count") /* Decrement refcount on superblock extension's object header in memory */ if(H5O_dec_rc_by_loc(ext_ptr, dxpl_id) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to decrement refcount on superblock extension") + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to decrement refcount on superblock extension"); } /* end if */ /* Twiddle the number of open objects to avoid closing the file. */ @@ -232,6 +213,10 @@ H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hid_t dxpl_id, f->nopen_objs--; done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value") + FUNC_LEAVE_NOAPI(ret_value) } /* H5F_super_ext_close() */ @@ -256,7 +241,8 @@ done: herr_t H5F__super_read(H5F_t *f, hid_t dxpl_id) { - H5P_genplist_t *dxpl; /* DXPL object */ + H5P_genplist_t *dxpl = NULL; /* DXPL object */ + H5AC_ring_t ring, orig_ring = H5AC_RING_INV; H5F_super_t * sblock = NULL; /* Superblock structure */ H5F_superblock_cache_ud_t udata; /* User data for cache callbacks */ H5P_genplist_t *c_plist; /* File creation property list */ @@ -276,6 +262,8 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id) /* Get the DXPL plist object for DXPL ID */ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") + if((H5P_get(dxpl, H5AC_RING_NAME, &orig_ring)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get property value"); /* Find the superblock */ if(H5FD_locate_signature(f->shared->lf, dxpl, &super_addr) < 0) @@ -320,6 +308,11 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id) udata.stored_eof = HADDR_UNDEF; udata.drvrinfo_removed = FALSE; + /* Set the ring type in the DXPL */ + ring = H5AC_RING_SB; + if((H5P_set(dxpl, H5AC_RING_NAME, &ring)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set property value"); + /* Look up the superblock */ if(NULL == (sblock = (H5F_super_t *)H5AC_protect(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, &udata, rw_flags))) HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "unable to load superblock") @@ -419,6 +412,11 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id) * allocated so that it knows how to allocate additional memory. */ + /* Set the ring type in the DXPL */ + ring = H5AC_RING_SBE; + if((H5P_set(dxpl, H5AC_RING_NAME, &ring)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set property value"); + /* Decode the optional driver information block */ if(H5F_addr_defined(sblock->driver_addr)) { H5O_drvinfo_t *drvinfo; /* Driver info */ @@ -647,6 +645,10 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id) f->shared->sblock = sblock; done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value") + /* Release the superblock */ if(sblock && H5AC_unprotect(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, sblock, sblock_flags) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTUNPROTECT, FAIL, "unable to close superblock") @@ -705,6 +707,8 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) H5O_drvinfo_t *drvinfo = NULL; /* Driver info */ hbool_t drvinfo_in_cache = FALSE; /* Whether the driver info block has been inserted into the metadata cache */ H5P_genplist_t *plist; /* File creation property list */ + H5P_genplist_t *dxpl = NULL; + H5AC_ring_t ring, orig_ring = H5AC_RING_INV; hsize_t userblock_size; /* Size of userblock, in bytes */ hsize_t superblock_size; /* Size of superblock, in bytes */ size_t driver_size; /* Size of driver info block (bytes) */ @@ -830,6 +834,10 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) if(H5F__set_eoa(f, H5FD_MEM_SUPER, superblock_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set EOA value for superblock") + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_SB, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Insert superblock into cache, pinned */ if(H5AC_insert_entry(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, sblock, H5AC__PIN_ENTRY_FLAG | H5AC__FLUSH_LAST_FLAG | H5AC__FLUSH_COLLECTIVELY_FLAG) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "can't add superblock to cache") @@ -875,6 +883,11 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) else need_ext = FALSE; + /* Set the ring type in the DXPL */ + ring = H5AC_RING_SBE; + if((H5P_set(dxpl, H5AC_RING_NAME, &ring)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set property value") + /* Create the superblock extension for "extra" superblock data, if necessary. */ if(need_ext) { /* The superblock extension isn't actually a group, but the @@ -914,20 +927,20 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) /* Check for driver info to store */ if(driver_size > 0) { - H5O_drvinfo_t drvinfo; /* Driver info */ + H5O_drvinfo_t info; /* Driver info */ uint8_t dbuf[H5F_MAX_DRVINFOBLOCK_SIZE]; /* Driver info block encoding buffer */ /* Sanity check */ HDassert(driver_size <= H5F_MAX_DRVINFOBLOCK_SIZE); /* Encode driver-specific data */ - if(H5FD_sb_encode(f->shared->lf, drvinfo.name, dbuf) < 0) + if(H5FD_sb_encode(f->shared->lf, info.name, dbuf) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information") /* Write driver info information to the superblock extension */ - drvinfo.len = driver_size; - drvinfo.buf = dbuf; - if(H5O_msg_create(&ext_loc, H5O_DRVINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &drvinfo, dxpl_id) < 0) + info.len = driver_size; + info.buf = dbuf; + if(H5O_msg_create(&ext_loc, H5O_DRVINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &info, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update driver info header message") } /* end if */ @@ -976,6 +989,10 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) } /* end if */ done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value") + /* Close superblock extension, if it was created */ if(ext_created && H5F_super_ext_close(f, &ext_loc, dxpl_id, ext_created) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension") @@ -1114,6 +1131,8 @@ H5F__super_free(H5F_super_t *sblock) herr_t H5F__super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_size) { + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -1138,6 +1157,10 @@ H5F__super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext ext_loc.file = f; ext_loc.addr = f->shared->sblock->ext_addr; + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_SBE, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Get object header info for superblock extension */ if(H5O_get_hdr_info(&ext_loc, dxpl_id, &hdr_info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info") @@ -1151,6 +1174,10 @@ H5F__super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext } /* end if */ done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value") + FUNC_LEAVE_NOAPI(ret_value) } /* H5F__super_size() */ @@ -1169,6 +1196,8 @@ done: herr_t H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_t may_create) { + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ hbool_t ext_created = FALSE; /* Whether superblock extension was created */ hbool_t ext_opened = FALSE; /* Whether superblock extension was opened */ H5O_loc_t ext_loc; /* "Object location" for superblock extension */ @@ -1182,6 +1211,10 @@ H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_ HDassert(f->shared); HDassert(f->shared->sblock); + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_SBE, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Open/create the superblock extension object header */ if(H5F_addr_defined(f->shared->sblock->ext_addr)) { if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0) @@ -1219,6 +1252,10 @@ H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_ } /* end else */ done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value") + /* Close the superblock extension, if it was opened */ if(ext_opened && H5F_super_ext_close(f, &ext_loc, dxpl_id, ext_created) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension") @@ -1245,6 +1282,8 @@ done: herr_t H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id) { + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ H5O_loc_t ext_loc; /* "Object location" for superblock extension */ hbool_t ext_opened = FALSE; /* Whether the superblock extension was opened */ int null_count = 0; /* # of null messages */ @@ -1256,6 +1295,10 @@ H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id) /* Make sure that the superblock extension object header exists */ HDassert(H5F_addr_defined(f->shared->sblock->ext_addr)); + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_SBE, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Open superblock extension object header */ if(H5F_super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension") @@ -1289,6 +1332,10 @@ H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id) } /* end if */ done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value") + /* Close superblock extension object header, if opened */ if(ext_opened && H5F_super_ext_close(f, &ext_loc, dxpl_id, FALSE) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension") diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index ac1f840..c2c7bc9 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -28,8 +28,8 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ /***********/ @@ -199,7 +199,7 @@ H5F__cache_superblock_deserialize(const void *_image, size_t len, void *_udata, unsigned super_vers; /* Superblock version */ uint8_t sizeof_addr; /* Size of offsets in the file (in bytes) */ uint8_t sizeof_size; /* Size of lengths in the file (in bytes) */ - H5F_super_t *ret_value; /* Return value */ + H5F_super_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -515,6 +515,8 @@ H5F__cache_superblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, size_t H5_ATTR_UNUSED *new_len, size_t H5_ATTR_UNUSED *new_compressed_len, unsigned H5_ATTR_UNUSED *flags) { + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ H5F_super_t *sblock = (H5F_super_t *)_thing; /* Pointer to the super block */ herr_t ret_value = SUCCEED; /* Return value */ @@ -562,6 +564,10 @@ H5F__cache_superblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, if(H5FD_sb_encode(f->shared->lf, drvinfo.name, dbuf) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information") + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_SBE, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Write driver info information to the superblock extension */ drvinfo.len = driver_size; drvinfo.buf = dbuf; @@ -577,6 +583,10 @@ H5F__cache_superblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, } /* end if */ done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set property value") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FS_cache_superblock_pre_serialize() */ @@ -814,7 +824,7 @@ H5F__cache_drvrinfo_deserialize(const void *_image, size_t len, void *_udata, const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ char drv_name[9]; /* Name of driver */ unsigned drv_vers; /* Version of driver info block */ - H5O_drvinfo_t *ret_value; /* Return value */ + H5O_drvinfo_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Ftest.c b/src/H5Ftest.c index 73b00a6..b741e0d 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -28,12 +28,12 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#include "H5Fmodule.h" /* This source code file is part of the H5F module */ #define H5F_TESTING /*suppress warning about H5F testing funcs*/ -#define H5SM_PACKAGE /*suppress error about including H5SMpkg */ -#define H5SM_TESTING /*suppress warning about H5SM testing funcs*/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5G_TESTING /*suppress warning about H5G testing funcs*/ +#define H5SM_FRIEND /*suppress error about including H5SMpkg */ +#define H5SM_TESTING /*suppress warning about H5SM testing funcs*/ /***********/ @@ -79,10 +79,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5G_init_interface +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -120,6 +117,9 @@ /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -138,36 +138,13 @@ static const H5I_class_t H5I_GROUP_CLS[1] = {{ (H5I_free_t)H5G_close /* Callback routine for closing objects of this class */ }}; +/* Flag indicating "top" of interface has been initialized */ +static hbool_t H5G_top_package_initialize_s = FALSE; - -/*------------------------------------------------------------------------- - * Function: H5G__init - * - * Purpose: Initialize the interface from some other package. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Quincey Koziol - * Saturday, November 11, 2006 - * - *------------------------------------------------------------------------- - */ -herr_t -H5G__init(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - /* FUNC_ENTER() does all the work */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G__init() */ /*------------------------------------------------------------------------- - * Function: H5G_init_interface + * Function: H5G__init_package * * Purpose: Initializes the H5G interface. * @@ -177,7 +154,7 @@ done: * Monday, January 5, 1998 * * Notes: The group creation properties are registered in the property - * list interface initialization routine (H5P_init_interface) + * list interface initialization routine (H5P_init_package) * so that the file creation property class can inherit from it * correctly. (Which allows the file creation property list to * control the group creation properties of the root group of @@ -185,64 +162,100 @@ done: * *------------------------------------------------------------------------- */ -static herr_t -H5G_init_interface(void) +herr_t +H5G__init_package(void) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Initialize the atom group for the group IDs */ if(H5I_register_type(H5I_GROUP_CLS) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to initialize interface") + /* Mark "top" of interface as initialized, too */ + H5G_top_package_initialize_s = TRUE; + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_init_interface() */ +} /* end H5G__init_package() */ /*------------------------------------------------------------------------- - * Function: H5G_term_interface + * Function: H5G_top_term_package * - * Purpose: Terminates the H5G interface + * Purpose: Close the "top" of the interface, releasing IDs, etc. * * Return: Success: Positive if anything is done that might * affect other interfaces; zero otherwise. - * * Failure: Negative. * - * Programmer: Robb Matzke - * Monday, January 5, 1998 + * Programmer: Quincey Koziol + * Sunday, September 13, 2015 * *------------------------------------------------------------------------- */ int -H5G_term_interface(void) +H5G_top_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5G_top_package_initialize_s) { if(H5I_nmembers(H5I_GROUP) > 0) { (void)H5I_clear_type(H5I_GROUP, FALSE, FALSE); n++; /*H5I*/ } /* end if */ - else { - /* Close deprecated interface */ - n += H5G__term_deprec_interface(); - /* Destroy the group object id group */ - (void)H5I_dec_type_ref(H5I_GROUP); - n++; /*H5I*/ + /* Mark closed */ + if(0 == n) + H5G_top_package_initialize_s = FALSE; + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5G_top_term_package() */ + + +/*------------------------------------------------------------------------- + * Function: H5G_term_package + * + * Purpose: Terminates the H5G interface + * + * Note: Finishes shutting down the interface, after + * H5G_top_term_package() is called + * + * Return: Success: Positive if anything is done that might + * affect other interfaces; zero otherwise. + * Failure: Negative. + * + * Programmer: Robb Matzke + * Monday, January 5, 1998 + * + *------------------------------------------------------------------------- + */ +int +H5G_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + /* Sanity checks */ + HDassert(0 == H5I_nmembers(H5I_GROUP)); + HDassert(FALSE == H5G_top_package_initialize_s); + + /* Destroy the group object id group */ + n += (H5I_dec_type_ref(H5I_GROUP) > 0); - /* Mark closed */ - H5_interface_initialize_g = 0; - } /* end else */ + /* Mark closed */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5G_term_interface() */ +} /* end H5G_term_package() */ /*------------------------------------------------------------------------- diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c index 31db886..104e6b3 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -232,7 +232,7 @@ H5G_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec) { const H5G_bt2_ud_common_t *bt2_udata = (const H5G_bt2_ud_common_t *)_bt2_udata; const H5G_dense_bt2_name_rec_t *bt2_rec = (const H5G_dense_bt2_name_rec_t *)_bt2_rec; - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -420,7 +420,7 @@ H5G_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec) { const H5G_bt2_ud_common_t *bt2_udata = (const H5G_bt2_ud_common_t *)_bt2_udata; const H5G_dense_bt2_corder_rec_t *bt2_rec = (const H5G_dense_bt2_corder_rec_t *)_bt2_rec; - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Gcache.c b/src/H5Gcache.c index f765b41..e7d44b5 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -178,7 +178,7 @@ H5G__cache_node_deserialize(const void *_image, size_t len, void *_udata, H5F_t *f = (H5F_t *)_udata; /* User data for callback */ H5G_node_t *sym = NULL; /* Symbol table node created */ const uint8_t *image = (const uint8_t *)_image; /* Pointer to image to deserialize */ - void * ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c index 89e79cc..41ca4f5 100644 --- a/src/H5Gcompact.c +++ b/src/H5Gcompact.c @@ -23,7 +23,7 @@ * *------------------------------------------------------------------------- */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /* Packages needed by this file... */ @@ -224,8 +224,8 @@ H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx, char* name, size_t size) { - H5G_link_table_t ltable = {0, NULL}; /* Link table */ - ssize_t ret_value; /* Return value */ + H5G_link_table_t ltable = {0, NULL}; /* Link table */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_PACKAGE @@ -411,7 +411,7 @@ H5G__compact_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *li H5G_lib_iterate_t op, void *op_data) { H5G_link_table_t ltable = {0, NULL}; /* Link table */ - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -503,7 +503,7 @@ H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, H5O_link_t *lnk, { H5G_iter_lkp_t udata; /* User data for iteration callback */ H5O_mesg_operator_t op; /* Message operator */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -598,7 +598,7 @@ H5G__compact_get_type_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t * hsize_t idx) { H5G_link_table_t ltable = {0, NULL}; /* Link table */ - H5G_obj_t ret_value; /* Return value */ + H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5Gdense.c b/src/H5Gdense.c index 285355f..ab0547b 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -29,7 +29,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ /* Headers */ @@ -540,7 +540,7 @@ H5G__dense_lookup(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, H5G_bt2_ud_common_t udata; /* User data for v2 B-tree link lookup */ H5HF_t *fheap = NULL; /* Fractal heap handle */ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -991,7 +991,7 @@ H5G__dense_iterate(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo, H5G_link_table_t ltable = {0, NULL}; /* Table of links */ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */ haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */ - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -1197,7 +1197,7 @@ H5G__dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, H5G_link_table_t ltable = {0, NULL}; /* Table of links */ H5B2_t *bt2 = NULL; /* v2 B-tree handle for index */ haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_PACKAGE @@ -1836,8 +1836,8 @@ H5G_obj_t H5G__dense_get_type_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo, hsize_t idx) { - H5G_link_table_t ltable = {0, NULL}; /* Table of links */ - H5G_obj_t ret_value; /* Return value */ + H5G_link_table_t ltable = {0, NULL}; /* Table of links */ + H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 4e3572e..e0bc78e 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -31,10 +31,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5G__init_deprec_interface +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -106,51 +103,6 @@ static H5G_obj_t H5G_obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, /*******************/ - -/*-------------------------------------------------------------------------- -NAME - H5G__init_deprec_interface -- Initialize interface-specific information -USAGE - herr_t H5G__init_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5G__init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5G__init_deprec_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5G__init()) -} /* H5G__init_deprec_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5G__term_deprec_interface -- Terminate interface -USAGE - herr_t H5G__term_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5G__term_deprec_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5G__term_deprec_interface() */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- @@ -168,7 +120,7 @@ H5G__term_deprec_interface(void) H5G_obj_t H5G_map_obj_type(H5O_type_t obj_type) { - H5G_obj_t ret_value; /* Return value */ + H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1164,7 +1116,7 @@ H5G_obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id) { H5O_linfo_t linfo; /* Link info message */ htri_t linfo_exists; /* Whether the link info message exists */ - H5G_obj_t ret_value; /* Return value */ + H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, oloc->addr, H5G_UNKNOWN) diff --git a/src/H5Gent.c b/src/H5Gent.c index 3809933..8df8414 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -22,7 +22,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ diff --git a/src/H5Gint.c b/src/H5Gint.c index 04b21a5..ea8288c 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -28,10 +28,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5G_init_int_interface +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -119,34 +116,6 @@ H5FL_DEFINE(H5_obj_t); -/*-------------------------------------------------------------------------- -NAME - H5G_init_int_interface -- Initialize interface-specific information -USAGE - herr_t H5G_init_int_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5G__init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5G_init_int_interface(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Funnel all work to H5G__init() */ - if(H5G__init() < 0) - HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "interface initialization failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5G_init_int_interface() */ - - /*------------------------------------------------------------------------- * Function: H5G__create_named * @@ -167,7 +136,7 @@ H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, { H5O_obj_create_t ocrt_info; /* Information for object creation */ H5G_obj_create_t gcrt_info; /* Information for group creation */ - H5G_t *ret_value; /* Return value */ + H5G_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -225,7 +194,7 @@ H5G__create(H5F_t *file, H5G_obj_create_t *gcrt_info, hid_t dxpl_id) { H5G_t *grp = NULL; /*new group */ unsigned oloc_init = 0; /* Flag to indicate that the group object location was created successfully */ - H5G_t *ret_value; /* Return value */ + H5G_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -302,7 +271,7 @@ H5G__open_name(const H5G_loc_t *loc, const char *name, hid_t gapl_id, H5O_loc_t grp_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Location at 'name' found */ H5O_type_t obj_type; /* Type of object at location */ - H5G_t *ret_value; /* Return value */ + H5G_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -363,7 +332,7 @@ H5G_open(const H5G_loc_t *loc, hid_t dxpl_id) { H5G_t *grp = NULL; /* Group opened */ H5G_shared_t *shared_fo; /* Shared group object */ - H5G_t *ret_value; /* Return value */ + H5G_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -814,7 +783,7 @@ H5G_iterate(hid_t loc_id, const char *group_name, hid_t gid = -1; /* ID of group to iterate over */ H5G_t *grp = NULL; /* Pointer to group data structure to iterate over */ H5G_iter_appcall_ud_t udata; /* User data for callback */ - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1084,7 +1053,7 @@ H5G_visit(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_t loc; /* Location of group passed in */ H5G_loc_t start_loc; /* Location of starting group */ unsigned rc; /* Reference count of object */ - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ /* Portably clear udata struct (before FUNC_ENTER) */ HDmemset(&udata, 0, sizeof(udata)); diff --git a/src/H5Glink.c b/src/H5Glink.c index 8b258b5..5a195c8 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -159,7 +159,7 @@ H5G_link_cmp_name_dec(const void *lnk1, const void *lnk2) static int H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2) { - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -194,7 +194,7 @@ H5G_link_cmp_corder_inc(const void *lnk1, const void *lnk2) static int H5G_link_cmp_corder_dec(const void *lnk1, const void *lnk2) { - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 677cc25..eb8cd78 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -649,7 +649,7 @@ htri_t H5G_loc_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id) { H5G_loc_exists_t udata; /* User data for traversal callback */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -913,7 +913,7 @@ H5G_loc_get_comment(H5G_loc_t *loc, const char *name, char *comment/*out*/, size_t bufsize, hid_t lapl_id, hid_t dxpl_id) { H5G_loc_gc_t udata; /* User data for traversal callback */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Gmodule.h b/src/H5Gmodule.h new file mode 100644 index 0000000..52ac067 --- /dev/null +++ b/src/H5Gmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5G package. Including this header means that the source file + * is part of the H5G package. + */ +#ifndef _H5Gmodule_H +#define _H5Gmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5G_MODULE +#define H5_MY_PKG H5G +#define H5_MY_PKG_ERR H5E_SYM +#define H5_MY_PKG_INIT YES + +#endif /* _H5Gmodule_H */ + diff --git a/src/H5Gname.c b/src/H5Gname.c index bbeddb6..aff9d31 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -166,7 +166,7 @@ H5G_normalize(const char *name) char *norm; /* Pointer to the normalized string */ size_t s,d; /* Positions within the strings */ unsigned last_slash; /* Flag to indicate last character was a slash */ - char *ret_value; /* Return value */ + char *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -297,7 +297,7 @@ H5G_build_fullpath(const char *prefix, const char *name) size_t path_len; /* Length of the path */ size_t name_len; /* Length of the name */ unsigned need_sep; /* Flag to indicate if separator is needed */ - H5RS_str_t *ret_value; /* Return value */ + H5RS_str_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -354,7 +354,7 @@ H5RS_str_t * H5G_build_fullpath_refstr_str(H5RS_str_t *prefix_r, const char *name) { const char *prefix; /* Pointer to raw string for path */ - H5RS_str_t *ret_value; + H5RS_str_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -565,7 +565,7 @@ H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size, hbool_t *cached, hid_t lapl_id, hid_t dxpl_id) { ssize_t len = 0; /* Length of object's name */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1292,7 +1292,7 @@ H5G_get_name_by_addr(hid_t file, hid_t lapl_id, hid_t dxpl_id, const H5O_loc_t * H5G_loc_t root_loc; /* Root group's location */ hbool_t found_obj = FALSE; /* If we found the object */ herr_t status; /* Status from iteration */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ /* Portably clear udata struct (before FUNC_ENTER) */ HDmemset(&udata, 0, sizeof(udata)); diff --git a/src/H5Gnode.c b/src/H5Gnode.c index cbb9a8e..e25a17e 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -31,7 +31,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -404,7 +404,7 @@ H5G_node_cmp2(void *_lt_key, void *_udata, void *_rt_key) H5G_node_key_t *rt_key = (H5G_node_key_t *) _rt_key; const char *s1, *s2; const char *base; /* Base of heap */ - int ret_value; + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Gobj.c b/src/H5Gobj.c index c1f05b7..f7782a6 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -156,7 +156,7 @@ H5G__obj_create(H5F_t *f, hid_t dxpl_id, H5G_obj_create_t *gcrt_info, HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info") /* Get the pipeline property */ - if(H5P_get(gc_plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(gc_plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info") /* Call the "real" group creation routine now */ @@ -320,8 +320,8 @@ done: htri_t H5G__obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo, hid_t dxpl_id) { - H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ - htri_t ret_value; /* Return value */ + H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, grp_oloc->addr, FAIL) @@ -666,7 +666,7 @@ H5G__obj_iterate(const H5O_loc_t *grp_oloc, { H5O_linfo_t linfo; /* Link info message */ htri_t linfo_exists; /* Whether the link info message exists */ - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, grp_oloc->addr, FAIL) @@ -813,7 +813,7 @@ H5G_obj_get_name_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, { H5O_linfo_t linfo; /* Link info message */ htri_t linfo_exists; /* Whether the link info message exists */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, oloc->addr, FAIL) diff --git a/src/H5Goh.c b/src/H5Goh.c index 1a0f112..c516713 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -17,8 +17,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ /***********/ @@ -107,7 +107,7 @@ H5FL_DEFINE(H5G_copy_file_ud_t); static void * H5O_group_get_copy_file_udata(void) { - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -177,7 +177,7 @@ H5O_group_isa(struct H5O_t *oh) { htri_t stab_exists; /* Whether the 'stab' message is in the object header */ htri_t linfo_exists; /* Whether the 'linfo' message is in the object header */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -213,7 +213,7 @@ static hid_t H5O_group_open(const H5G_loc_t *obj_loc, hid_t H5_ATTR_UNUSED lapl_id, hid_t dxpl_id, hbool_t app_ref) { H5G_t *grp = NULL; /* Group opened */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -254,7 +254,7 @@ H5O_group_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc, hid_t dxpl_id) { H5G_obj_create_t *crt_info = (H5G_obj_create_t *)_crt_info; /* Group creation parameters */ H5G_t *grp = NULL; /* New group created */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -302,7 +302,7 @@ static H5O_loc_t * H5O_group_get_oloc(hid_t obj_id) { H5G_t *grp; /* Group opened */ - H5O_loc_t *ret_value; /* Return value */ + H5O_loc_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 7346b41..1457e62 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -21,7 +21,7 @@ * only within the H5G package. Source files outside the * H5G package should include H5Gprivate.h instead. */ -#ifndef H5G_PACKAGE +#if !(defined H5G_FRIEND || defined H5G_MODULE) #error "Do not include this file outside the H5G package!" #endif @@ -351,8 +351,6 @@ H5_DLL herr_t H5G__traverse_special(const H5G_loc_t *grp_loc, /* * Utility functions */ -H5_DLL herr_t H5G__init(void); -H5_DLL herr_t H5G__term_deprec_interface(void); H5_DLL const char *H5G__component(const char *name, size_t *size_p); /* diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 130c742..baf4209 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -101,11 +101,11 @@ } /* If the module using this macro is allowed access to the private variables, access them directly */ -#ifdef H5G_PACKAGE +#ifdef H5G_MODULE #define H5G_MOUNTED(G) ((G)->shared->mounted) -#else /* H5G_PACKAGE */ +#else /* H5G_MODULE */ #define H5G_MOUNTED(G) (H5G_mounted(G)) -#endif /* H5G_PACKAGE */ +#endif /* H5G_MODULE */ /* * During name lookups (see H5G_traverse()) we sometimes want information about diff --git a/src/H5Groot.c b/src/H5Groot.c index 5ec9d3a..ba25f31 100644 --- a/src/H5Groot.c +++ b/src/H5Groot.c @@ -28,8 +28,8 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 08188ae..7f4b8df 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -22,7 +22,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -533,7 +533,7 @@ H5G__stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, H5HL_t *heap = NULL; /* Local heap for group */ H5O_stab_t stab; /* Info about symbol table */ H5G_link_table_t ltable = {0, NULL}; /* Link table */ - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, oloc->addr, FAIL) @@ -751,7 +751,7 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t H5O_stab_t stab; /* Info about local heap & B-tree */ H5G_bt_it_gnbi_t udata; /* Iteration information */ hbool_t udata_valid = FALSE; /* Whether iteration information is valid */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ /* Portably clear udata struct (before FUNC_ENTER) */ HDmemset(&udata, 0, sizeof(udata)); @@ -874,7 +874,7 @@ H5G__stab_lookup(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, H5G_bt_lkp_t bt_udata; /* Data to pass through B-tree */ H5G_stab_fnd_ud_t udata; /* 'User data' to give to callback */ H5O_stab_t stab; /* Symbol table message */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -1191,7 +1191,7 @@ H5G__stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id) { H5O_stab_t stab; /* Info about local heap & B-tree */ H5G_bt_it_gtbi_t udata; /* User data for B-tree callback */ - H5G_obj_t ret_value; /* Return value */ + H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, oloc->addr, H5G_UNKNOWN) diff --git a/src/H5Gtest.c b/src/H5Gtest.c index 1c0adea..a8796fb 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -23,7 +23,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ #define H5G_TESTING /*suppress warning about H5G testing funcs*/ diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 1c654bb..5121f45 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#include "H5Gmodule.h" /* This source code file is part of the H5G module */ /***********/ @@ -33,7 +33,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ @@ -68,6 +69,9 @@ /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -153,7 +157,7 @@ H5HF_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam) H5HF_t *fh = NULL; /* Pointer to new fractal heap */ H5HF_hdr_t *hdr = NULL; /* The fractal heap header information */ haddr_t fh_addr; /* Heap header address */ - H5HF_t *ret_value; /* Return value */ + H5HF_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -220,7 +224,7 @@ H5HF_open(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr) { H5HF_t *fh = NULL; /* Pointer to new fractal heap */ H5HF_hdr_t *hdr = NULL; /* The fractal heap header information */ - H5HF_t *ret_value; /* Return value */ + H5HF_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c index cb1ec77..2f3d0e4 100644 --- a/src/H5HFbtree2.c +++ b/src/H5HFbtree2.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ /***********/ @@ -196,7 +196,7 @@ H5HF_huge_bt2_crt_context(void *_f) { H5F_t *f = (H5F_t *)_f; /* User data for building callback context */ H5HF_huge_bt2_ctx_t *ctx; /* Callback context structure */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -762,7 +762,7 @@ H5HF_huge_bt2_dir_compare(const void *_rec1, const void *_rec2) { const H5HF_huge_bt2_dir_rec_t *rec1 = (const H5HF_huge_bt2_dir_rec_t *)_rec1; const H5HF_huge_bt2_dir_rec_t *rec2 = (const H5HF_huge_bt2_dir_rec_t *)_rec2; - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -985,7 +985,7 @@ H5HF_huge_bt2_filt_dir_compare(const void *_rec1, const void *_rec2) { const H5HF_huge_bt2_filt_dir_rec_t *rec1 = (const H5HF_huge_bt2_filt_dir_rec_t *)_rec1; const H5HF_huge_bt2_filt_dir_rec_t *rec2 = (const H5HF_huge_bt2_filt_dir_rec_t *)_rec2; - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5HFcache.c b/src/H5HFcache.c index ec8d9a6..4f3dfc3 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ /***********/ @@ -401,7 +401,7 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ uint8_t heap_flags; /* Status flags for heap */ - void * ret_value; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -905,7 +905,7 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t len, void *_udata, uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ unsigned u; /* Local index variable */ - void * ret_value; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -1590,7 +1590,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, H5HF_direct_t *dblock = NULL; /* Direct block info */ const uint8_t *image; /* Pointer into raw data buffer */ haddr_t heap_addr; /* Address of heap header in the file */ - void * ret_value; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -1924,7 +1924,7 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, H5HF_hdr_t *hdr; /* Shared fractal heap information */ H5HF_direct_t *dblock = (H5HF_direct_t *)_thing; /* Direct block info */ H5HF_indirect_t *par_iblock; /* Parent indirect block */ - unsigned par_entry; /* Entry in parent indirect block */ + unsigned par_entry = 0; /* Entry in parent indirect block */ void *write_buf; /* Pointer to buffer to write out */ size_t write_size; /* Size of buffer to write out */ uint8_t *image; /* Pointer into raw data buffer */ @@ -2224,6 +2224,7 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, else { /* the direct block's parent is an indirect block */ /* Sanity check */ HDassert(par_iblock); + HDassert(par_iblock->ents); HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, addr)); /* Allocate 'normal' space for the direct block */ diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 736b98d..40191e5 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ #define H5HF_DEBUGGING /* Need access to fractal heap debugging routines */ /***********/ diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 5dd5b0c..9461fc0 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ @@ -447,7 +448,7 @@ H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr, { H5HF_direct_t *dblock; /* Direct block from cache */ H5HF_dblock_cache_ud_t udata; /* parent and other infor for deserializing direct block */ - H5HF_direct_t *ret_value; /* Return value */ + H5HF_direct_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5HFdtable.c b/src/H5HFdtable.c index c523396..3ceb6f5 100644 --- a/src/H5HFdtable.c +++ b/src/H5HFdtable.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ @@ -240,7 +241,7 @@ H5HF_dtable_dest(H5HF_dtable_t *dtable) unsigned H5HF_dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size) { - unsigned row; /* Row where block will fit */ + unsigned row = 0; /* Row where block will fit */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -274,7 +275,7 @@ H5HF_dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size) unsigned H5HF_dtable_size_to_rows(const H5HF_dtable_t *dtable, hsize_t size) { - unsigned rows; /* # of rows required for indirect block */ + unsigned rows = 0; /* # of rows required for indirect block */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -310,7 +311,7 @@ H5HF_dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, unsigned end_row; /* Row for last block covered */ unsigned end_col; /* Column for last block covered */ unsigned end_entry; /* Entry for last block covered */ - hsize_t acc_span_size; /* Accumulated span size */ + hsize_t acc_span_size = 0; /* Accumulated span size */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 340940f..6560756 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ @@ -110,7 +111,7 @@ H5HF_hdr_t * H5HF_hdr_alloc(H5F_t *f) { H5HF_hdr_t *hdr = NULL; /* Shared fractal heap header */ - H5HF_hdr_t *ret_value; /* Return value */ + H5HF_hdr_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -342,7 +343,7 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam) { H5HF_hdr_t *hdr = NULL; /* The new fractal heap header information */ size_t dblock_overhead; /* Direct block's overhead */ - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -533,7 +534,7 @@ H5HF_hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, unsigned flags) { H5HF_hdr_cache_ud_t cache_udata; /* User-data for callback */ H5HF_hdr_t *hdr; /* Fractal heap header */ - H5HF_hdr_t *ret_value; /* Return value */ + H5HF_hdr_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c index 04cd425..888af48 100644 --- a/src/H5HFhuge.c +++ b/src/H5HFhuge.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ /***********/ @@ -261,7 +261,7 @@ static hsize_t H5HF_huge_new_id(H5HF_hdr_t *hdr) { hsize_t new_id; /* New object's ID */ - hsize_t ret_value; /* Return value */ + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 547aaf0..29f4662 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ @@ -1171,7 +1172,7 @@ H5HF_man_iblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t iblock_addr, H5HF_parent_t par_info; /* Parent info for loading block */ H5HF_indirect_t *iblock = NULL; /* Indirect block from cache */ hbool_t should_protect = FALSE; /* Whether we should protect the indirect block or not */ - H5HF_indirect_t *ret_value; /* Return value */ + H5HF_indirect_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5HFiter.c b/src/H5HFiter.c index 262a9ee..55a8532 100644 --- a/src/H5HFiter.c +++ b/src/H5HFiter.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ diff --git a/src/H5HFman.c b/src/H5HFman.c index cfbcd87..cff4395 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ diff --git a/src/H5HFmodule.h b/src/H5HFmodule.h new file mode 100644 index 0000000..e3274ce --- /dev/null +++ b/src/H5HFmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5HF package. Including this header means that the source file + * is part of the H5HF package. + */ +#ifndef _H5HFmodule_H +#define _H5HFmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5HF_MODULE +#define H5_MY_PKG H5HF +#define H5_MY_PKG_ERR H5E_HEAP +#define H5_MY_PKG_INIT NO + +#endif /* _H5HFmodule_H */ + diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index 685c83a..7a6794e 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -21,7 +21,7 @@ * the H5HF package. Source files outside the H5HF package should * include H5HFprivate.h instead. */ -#ifndef H5HF_PACKAGE +#if !(defined H5HF_FRIEND || defined H5HF_MODULE) #error "Do not include this file outside the H5HF package!" #endif diff --git a/src/H5HFsection.c b/src/H5HFsection.c index c997119..070bc3e 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -25,7 +25,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ @@ -407,8 +408,8 @@ static H5HF_free_section_t * H5HF_sect_node_new(unsigned sect_type, haddr_t sect_addr, hsize_t sect_size, H5FS_section_state_t sect_state) { - H5HF_free_section_t *new_sect; /* New section */ - H5HF_free_section_t *ret_value; /* Return value */ + H5HF_free_section_t *new_sect; /* New section */ + H5HF_free_section_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -489,7 +490,7 @@ H5HF_sect_single_new(hsize_t sect_off, size_t sect_size, H5HF_indirect_t *parent, unsigned par_entry) { H5HF_free_section_t *sect = NULL; /* 'Single' free space section to add */ - H5HF_free_section_t *ret_value; /* Return value */ + H5HF_free_section_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -866,7 +867,7 @@ H5HF_sect_single_deserialize(const H5FS_section_class_t H5_ATTR_UNUSED *cls, hsize_t sect_size, unsigned H5_ATTR_UNUSED *des_flags) { H5HF_free_section_t *new_sect; /* New section */ - H5FS_section_info_t *ret_value; /* Return value */ + H5FS_section_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1261,7 +1262,7 @@ H5HF_sect_row_create(haddr_t sect_off, hsize_t sect_size, hbool_t is_first, unsigned row, unsigned col, unsigned nentries, H5HF_free_section_t *under_sect) { H5HF_free_section_t *sect = NULL; /* 'Row' section created */ - H5HF_free_section_t *ret_value; /* Return value */ + H5HF_free_section_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1513,7 +1514,7 @@ done: H5HF_indirect_t * H5HF_sect_row_get_iblock(H5HF_free_section_t *sect) { - H5HF_indirect_t *ret_value; /* Return value */ + H5HF_indirect_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1675,7 +1676,7 @@ H5HF_sect_row_deserialize(const H5FS_section_class_t *cls, hid_t dxpl_id, unsigned *des_flags) { H5HF_hdr_t *hdr; /* Fractal heap header */ - H5FS_section_info_t *ret_value; /* Return value */ + H5FS_section_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2102,7 +2103,7 @@ H5HF_sect_row_debug(const H5FS_section_info_t *_sect, static hsize_t H5HF_sect_indirect_iblock_off(const H5HF_free_section_t *sect) { - hsize_t ret_value; /* Return value */ + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -2133,7 +2134,7 @@ H5HF_sect_indirect_iblock_off(const H5HF_free_section_t *sect) static H5HF_free_section_t * H5HF_sect_indirect_top(H5HF_free_section_t *sect) { - H5HF_free_section_t *ret_value; /* Return value */ + H5HF_free_section_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -2242,7 +2243,7 @@ H5HF_sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, unsigned nentries) { H5HF_free_section_t *sect = NULL; /* 'Indirect' free space section to add */ - H5HF_free_section_t *ret_value; /* Return value */ + H5HF_free_section_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2313,7 +2314,7 @@ H5HF_sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, H5HF_free_section_t *row_sect) { H5HF_free_section_t *sect = NULL; /* 'Indirect' free space section to add */ - H5HF_free_section_t *ret_value; /* Return value */ + H5HF_free_section_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -3945,7 +3946,7 @@ H5HF_sect_indirect_deserialize(H5HF_hdr_t *hdr, hid_t dxpl_id, unsigned end_entry; /* End entry in indirect block */ unsigned end_row; /* End row in indirect block */ unsigned end_col; /* End column in indirect block */ - H5FS_section_info_t *ret_value; /* Return value */ + H5FS_section_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5HFspace.c b/src/H5HFspace.c index 7fb0dd4..20057e4 100644 --- a/src/H5HFspace.c +++ b/src/H5HFspace.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ @@ -216,7 +217,7 @@ htri_t H5HF_space_find(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t request, H5HF_free_section_t **node) { htri_t node_found = FALSE; /* Whether an existing free list node was found */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5HFstat.c b/src/H5HFstat.c index b0e1987..303b1f4 100644 --- a/src/H5HFstat.c +++ b/src/H5HFstat.c @@ -24,7 +24,8 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ + /***********/ /* Headers */ diff --git a/src/H5HFtest.c b/src/H5HFtest.c index c2e9cb0..4ec7149 100644 --- a/src/H5HFtest.c +++ b/src/H5HFtest.c @@ -24,9 +24,10 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /*suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ #define H5HF_TESTING /*suppress warning about H5HF testing funcs*/ + /***********/ /* Headers */ /***********/ @@ -244,7 +245,7 @@ done: unsigned H5HF_get_max_root_rows(const H5HF_t *fh) { - unsigned ret_value; /* Return value */ + unsigned ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -275,7 +276,7 @@ H5HF_get_max_root_rows(const H5HF_t *fh) unsigned H5HF_get_dtable_width_test(const H5HF_t *fh) { - unsigned ret_value; /* Return value */ + unsigned ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -306,7 +307,7 @@ H5HF_get_dtable_width_test(const H5HF_t *fh) unsigned H5HF_get_dtable_max_drows_test(const H5HF_t *fh) { - unsigned ret_value; /* Return value */ + unsigned ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -341,7 +342,7 @@ H5HF_get_dtable_max_drows_test(const H5HF_t *fh) unsigned H5HF_get_iblock_max_drows_test(const H5HF_t *fh, unsigned pos) { - unsigned ret_value; /* Return value */ + unsigned ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -374,7 +375,7 @@ H5HF_get_iblock_max_drows_test(const H5HF_t *fh, unsigned pos) hsize_t H5HF_get_dblock_size_test(const H5HF_t *fh, unsigned row) { - hsize_t ret_value; /* Return value */ + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -406,7 +407,7 @@ H5HF_get_dblock_size_test(const H5HF_t *fh, unsigned row) hsize_t H5HF_get_dblock_free_test(const H5HF_t *fh, unsigned row) { - hsize_t ret_value; /* Return value */ + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c index 27ab443..8c321bc 100644 --- a/src/H5HFtiny.c +++ b/src/H5HFtiny.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5HF_PACKAGE /* suppress error about including H5HFpkg */ +#include "H5HFmodule.h" /* This source code file is part of the H5HF module */ /***********/ @@ -41,7 +41,7 @@ /* Module Setup */ /****************/ -#define H5HG_PACKAGE /*suppress error about including H5HGpkg */ +#include "H5HGmodule.h" /* This source code file is part of the H5HG module */ /***********/ @@ -91,6 +91,9 @@ static haddr_t H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Declare a free list to manage the H5HG_heap_t struct */ H5FL_DEFINE(H5HG_heap_t); @@ -249,7 +252,7 @@ H5HG_heap_t * H5HG_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, unsigned flags) { H5HG_heap_t *heap; /* Global heap */ - H5HG_heap_t *ret_value; /* Return value */ + H5HG_heap_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -299,7 +302,7 @@ H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) size_t idx; uint8_t *p; size_t need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -612,7 +615,7 @@ H5HG_read(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/, size_t size; /* Size of the heap object */ uint8_t *p; /* Pointer to object in heap buffer */ void *orig_object = object; /* Keep a copy of the original object pointer */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__GLOBALHEAP_TAG, NULL) @@ -684,7 +687,7 @@ H5HG_link(H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust) { H5HG_heap_t *heap = NULL; unsigned heap_flags = H5AC__NO_FLAGS_SET; - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__GLOBALHEAP_TAG, FAIL) diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 5c6bee1..c1eb8d9 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5HG_PACKAGE /*suppress error about including H5HGpkg */ +#include "H5HGmodule.h" /* This source code file is part of the H5HG module */ /***********/ @@ -161,7 +161,7 @@ H5HG__cache_heap_deserialize(const void *_image, size_t len, void *_udata, H5F_t *f = (H5F_t *)_udata; /* File pointer -- obtained from user data */ H5HG_heap_t *heap = NULL; /* New global heap */ uint8_t *image; /* Pointer to image to decode */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5HGdbg.c b/src/H5HGdbg.c index c79aac8..6013de5 100644 --- a/src/H5HGdbg.c +++ b/src/H5HGdbg.c @@ -23,7 +23,7 @@ /* Module Setup */ /****************/ -#define H5HG_PACKAGE /*suppress error about including H5HGpkg */ +#include "H5HGmodule.h" /* This source code file is part of the H5HG module */ /***********/ diff --git a/src/H5HGmodule.h b/src/H5HGmodule.h new file mode 100644 index 0000000..aa34f29 --- /dev/null +++ b/src/H5HGmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5HG package. Including this header means that the source file + * is part of the H5HG package. + */ +#ifndef _H5HGmodule_H +#define _H5HGmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5HG_MODULE +#define H5_MY_PKG H5HG +#define H5_MY_PKG_ERR H5E_HEAP +#define H5_MY_PKG_INIT NO + +#endif /* _H5HGmodule_H */ + diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h index 9137e7b..ffbf7c6 100644 --- a/src/H5HGpkg.h +++ b/src/H5HGpkg.h @@ -21,7 +21,7 @@ * only within the H5HG package. Source files outside the * H5HG package should include H5HGprivate.h instead. */ -#ifndef H5HG_PACKAGE +#if !(defined H5HG_FRIEND || defined H5HG_MODULE) #error "Do not include this file outside the H5HG package!" #endif diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h index 3765c47..b090d4c 100644 --- a/src/H5HGprivate.h +++ b/src/H5HGprivate.h @@ -44,15 +44,15 @@ typedef struct H5HG_heap_t H5HG_heap_t; #define H5HG_MAXSIZE 65536 /* If the module using this macro is allowed access to the private variables, access them directly */ -#ifdef H5HG_PACKAGE +#ifdef H5HG_MODULE #define H5HG_ADDR(H) ((H)->addr) #define H5HG_SIZE(H) ((H)->size) #define H5HG_FREE_SIZE(H) ((H)->obj[0].size) -#else /* H5HG_PACKAGE */ +#else /* H5HG_MODULE */ #define H5HG_ADDR(H) (H5HG_get_addr(H)) #define H5HG_SIZE(H) (H5HG_get_size(H)) #define H5HG_FREE_SIZE(H) (H5HG_get_free_size(H)) -#endif /* H5HG_PACKAGE */ +#endif /* H5HG_MODULE */ /* Main global heap routines */ diff --git a/src/H5HGquery.c b/src/H5HGquery.c index a1b3777..d07edcc 100644 --- a/src/H5HGquery.c +++ b/src/H5HGquery.c @@ -25,7 +25,7 @@ /* Module Setup */ /****************/ -#define H5HG_PACKAGE /*suppress error about including H5HGpkg */ +#include "H5HGmodule.h" /* This source code file is part of the H5HG module */ /***********/ @@ -29,7 +29,7 @@ /* Module Setup */ /****************/ -#define H5HL_PACKAGE /* Suppress error about including H5HLpkg */ +#include "H5HLmodule.h" /* This source code file is part of the H5HL module */ /***********/ @@ -71,6 +71,9 @@ static herr_t H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Declare a free list to manage the H5HL_free_t struct */ H5FL_DEFINE(H5HL_free_t); @@ -115,7 +118,7 @@ H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/) { H5HL_t *heap = NULL; /* Heap created */ H5HL_prfx_t *prfx = NULL; /* Heap prefix */ - hsize_t total_size; /* Total heap size on disk */ + hsize_t total_size = 0; /* Total heap size on disk */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -446,10 +449,10 @@ H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, unsigned flags) H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ H5HL_prfx_t *prfx = NULL; /* Local heap prefix */ H5HL_dblk_t *dblk = NULL; /* Local heap data block */ - H5HL_t *heap; /* Heap data structure */ + H5HL_t *heap = NULL; /* Heap data structure */ unsigned prfx_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting prefix entry */ unsigned dblk_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting data block entry */ - H5HL_t *ret_value; /* Return value */ + H5HL_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -511,11 +514,11 @@ H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, unsigned flags) done: /* Release the prefix from the cache, now pinned */ - if(prfx && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, prfx_cache_flags) < 0) + if(prfx && heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, prfx_cache_flags) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release local heap prefix") /* Release the data block from the cache, now pinned */ - if(dblk && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, dblk_cache_flags) < 0) + if(dblk && heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, dblk_cache_flags) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release local heap data block") FUNC_LEAVE_NOAPI(ret_value) @@ -700,7 +703,7 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * size_t offset = 0; size_t need_size; hbool_t found; - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(UFAIL) @@ -1062,7 +1065,7 @@ done: herr_t H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) { - H5HL_t *heap; /* Local heap to delete */ + H5HL_t *heap = NULL; /* Local heap to delete */ H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ H5HL_prfx_t *prfx = NULL; /* Local heap prefix */ H5HL_dblk_t *dblk = NULL; /* Local heap data block */ @@ -1114,11 +1117,11 @@ H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) done: /* Release the data block from the cache, now deleted */ - if(dblk && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, cache_flags) < 0) + if(dblk && heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, cache_flags) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap data block") /* Release the prefix from the cache, now deleted */ - if(prfx && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, cache_flags) < 0) + if(prfx && heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, cache_flags) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap prefix") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 2054e34..42fe1c7 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5HL_PACKAGE /* Suppress error about including H5HLpkg */ +#include "H5HLmodule.h" /* This source code file is part of the H5HL module */ /***********/ @@ -311,7 +311,7 @@ H5HL__cache_prefix_deserialize(const void *_image, size_t len, void *_udata, H5HL_prfx_t *prfx = NULL; /* Heap prefix deserialized */ const uint8_t *image = (const uint8_t *)_image; /* Pointer into decoding buffer */ H5HL_cache_prfx_ud_t *udata = (H5HL_cache_prfx_ud_t *)_udata; /* User data for callback */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -682,7 +682,7 @@ H5HL__cache_datablock_deserialize(const void *image, size_t len, void *_udata, { H5HL_dblk_t *dblk = NULL; /* Local heap data block deserialized */ H5HL_cache_dblk_ud_t *udata = (H5HL_cache_dblk_ud_t *)_udata; /* User data for callback */ - void * ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index edddd65..3620511 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -18,7 +18,8 @@ * * Purpose: Local Heap object debugging functions. */ -#define H5HL_PACKAGE /* Suppress error about including H5HLpkg */ + +#include "H5HLmodule.h" /* This source code file is part of the H5HL module */ #include "H5private.h" /* Generic Functions */ diff --git a/src/H5HLint.c b/src/H5HLint.c index d5238eb..bbf579d 100644 --- a/src/H5HLint.c +++ b/src/H5HLint.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5HL_PACKAGE /* Suppress error about including H5HLpkg */ +#include "H5HLmodule.h" /* This source code file is part of the H5HL module */ /***********/ @@ -102,7 +102,7 @@ H5HL_t * H5HL_new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size) { H5HL_t *heap = NULL; /* New local heap */ - H5HL_t *ret_value; /* Return value */ + H5HL_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -129,7 +129,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5HL_inc_rc + * Function: H5HL__inc_rc * * Purpose: Increment ref. count on heap * @@ -143,9 +143,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HL_inc_rc(H5HL_t *heap) +H5HL__inc_rc(H5HL_t *heap) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check arguments */ HDassert(heap); @@ -154,11 +154,11 @@ H5HL_inc_rc(H5HL_t *heap) heap->rc++; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HL_inc_rc() */ +} /* end H5HL__inc_rc() */ /*------------------------------------------------------------------------- - * Function: H5HL_dec_rc + * Function: H5HL__dec_rc * * Purpose: Decrement ref. count on heap * @@ -172,9 +172,9 @@ H5HL_inc_rc(H5HL_t *heap) *------------------------------------------------------------------------- */ static herr_t -H5HL_dec_rc(H5HL_t *heap) +H5HL__dec_rc(H5HL_t *heap) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check arguments */ HDassert(heap); @@ -187,7 +187,7 @@ H5HL_dec_rc(H5HL_t *heap) H5HL_dest(heap); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5HL_dec_rc() */ +} /* end H5HL__dec_rc() */ /*------------------------------------------------------------------------- @@ -250,7 +250,7 @@ H5HL_prfx_t * H5HL_prfx_new(H5HL_t *heap) { H5HL_prfx_t *prfx = NULL; /* New local heap prefix */ - H5HL_prfx_t *ret_value; /* Return value */ + H5HL_prfx_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -262,7 +262,7 @@ H5HL_prfx_new(H5HL_t *heap) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") /* Increment ref. count on heap data structure */ - if(H5HL_inc_rc(heap) < 0) + if(H5HL__inc_rc(heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count") /* Link the heap & the prefix */ @@ -307,7 +307,7 @@ H5HL_prfx_dest(H5HL_prfx_t *prfx) prfx->heap->prfx = NULL; /* Decrement ref. count on heap data structure */ - if(H5HL_dec_rc(prfx->heap) < 0) + if(H5HL__dec_rc(prfx->heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count") /* Unlink heap from prefix */ @@ -340,7 +340,7 @@ H5HL_dblk_t * H5HL_dblk_new(H5HL_t *heap) { H5HL_dblk_t *dblk = NULL; /* New local heap data block */ - H5HL_dblk_t *ret_value; /* Return value */ + H5HL_dblk_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -352,7 +352,7 @@ H5HL_dblk_new(H5HL_t *heap) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") /* Increment ref. count on heap data structure */ - if(H5HL_inc_rc(heap) < 0) + if(H5HL__inc_rc(heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count") /* Link the heap & the data block */ @@ -401,7 +401,7 @@ H5HL_dblk_dest(H5HL_dblk_t *dblk) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "can't unpin local heap prefix") /* Decrement ref. count on heap data structure */ - if(H5HL_dec_rc(dblk->heap) < 0) + if(H5HL__dec_rc(dblk->heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count") /* Unlink heap from data block */ diff --git a/src/H5HLmodule.h b/src/H5HLmodule.h new file mode 100644 index 0000000..b38c077 --- /dev/null +++ b/src/H5HLmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5HL package. Including this header means that the source file + * is part of the H5HL package. + */ +#ifndef _H5HLmodule_H +#define _H5HLmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5HL_MODULE +#define H5_MY_PKG H5HL +#define H5_MY_PKG_ERR H5E_HEAP +#define H5_MY_PKG_INIT NO + +#endif /* _H5HLmodule_H */ + diff --git a/src/H5HLpkg.h b/src/H5HLpkg.h index 75c9959..6e35add 100644 --- a/src/H5HLpkg.h +++ b/src/H5HLpkg.h @@ -21,7 +21,7 @@ * only within the H5HL package. Source files outside the * H5HL package should include H5HLprivate.h instead. */ -#ifndef H5HL_PACKAGE +#if !(defined H5HL_FRIEND || defined H5HL_MODULE) #error "Do not include this file outside the H5HL package!" #endif @@ -35,10 +35,7 @@ * 5/18/04 - Expanded to allow registration of new types at run-time */ -#define H5I_PACKAGE /*suppress error about including H5Ipkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5I_init_interface +#include "H5Imodule.h" /* This source code file is part of the H5I module */ #include "H5private.h" /* Generic Functions */ @@ -55,7 +52,7 @@ #ifndef H5I_DEBUG_OUTPUT #include "H5Gprivate.h" /* Groups */ #else /* H5I_DEBUG_OUTPUT */ -#define H5G_PACKAGE /*suppress error message about including H5Gpkg.h */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #include "H5Gpkg.h" /* Groups */ #include "H5Dprivate.h" /* Datasets */ #include "H5Tprivate.h" /* Datatypes */ @@ -106,6 +103,9 @@ typedef struct { hbool_t app_ref; /* Whether this is an appl. ref. call */ } H5I_clear_type_ud_t; +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*-------------------- Locally scoped variables -----------------------------*/ /* Array of pointers to atomic types */ @@ -141,29 +141,8 @@ static herr_t H5I__debug(H5I_type_t type); #endif /* H5I_DEBUG_OUTPUT */ -/*-------------------------------------------------------------------------- -NAME - H5I_init_interface -- Initialize interface-specific information -USAGE - herr_t H5I_init_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. - ---------------------------------------------------------------------------*/ -static herr_t -H5I_init_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5I_init_interface() */ - - /*------------------------------------------------------------------------- - * Function: H5I_term_interface + * Function: H5I_term_package * * Purpose: Terminate the H5I interface: release all memory, reset all * global variables to initial values. This only happens if all @@ -179,20 +158,20 @@ H5I_init_interface(void) *------------------------------------------------------------------------- */ int -H5I_term_interface(void) +H5I_term_package(void) { - H5I_id_type_t *type_ptr; - H5I_type_t type; - int n = 0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5_PKG_INIT_VAR) { + H5I_id_type_t *type_ptr; /* Pointer to ID type */ + H5I_type_t type; /* Type of ID */ + /* How many types are still being used? */ - for(type = (H5I_type_t)0; type < H5I_next_type; H5_INC_ENUM(H5I_type_t, type)) { + for(type = (H5I_type_t)0; type < H5I_next_type; H5_INC_ENUM(H5I_type_t, type)) if((type_ptr = H5I_id_type_list_g[type]) && type_ptr->ids) n++; - } /* end for */ /* If no types are used then clean up */ if(0 == n) { @@ -202,16 +181,18 @@ H5I_term_interface(void) HDassert(NULL == type_ptr->ids); type_ptr = H5FL_FREE(H5I_id_type_t, type_ptr); H5I_id_type_list_g[type] = NULL; + n++; } /* end if */ } /* end for */ - } /* end if */ - /* Mark interface closed */ - H5_interface_initialize_g = 0; + /* Mark interface closed */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; + } /* end if */ } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5I_term_interface() */ +} /* end H5I_term_package() */ /*------------------------------------------------------------------------- @@ -238,9 +219,9 @@ H5I_term_interface(void) H5I_type_t H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func) { - H5I_class_t *cls = NULL; /* New ID class */ - H5I_type_t new_type; /* New ID type value */ - H5I_type_t ret_value; /* Return value */ + H5I_class_t *cls = NULL; /* New ID class */ + H5I_type_t new_type; /* New ID type value */ + H5I_type_t ret_value = H5I_BADID; /* Return value */ FUNC_ENTER_API(H5I_BADID) H5TRACE3("It", "zIux", hash_size, reserved, free_func); @@ -290,10 +271,9 @@ H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func) done: /* Clean up on error */ - if(ret_value < 0) { + if(ret_value < 0) if(cls) cls = H5FL_FREE(H5I_class_t, cls); - } /* end if */ FUNC_LEAVE_API(ret_value) } /* end H5Iregister_type() */ @@ -467,8 +447,8 @@ done: int64_t H5I_nmembers(H5I_type_t type) { - H5I_id_type_t *type_ptr = NULL; - int64_t ret_value; + H5I_id_type_t *type_ptr; /* Pointer to the ID type */ + int64_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -504,7 +484,7 @@ done: herr_t H5Iclear_type(H5I_type_t type, hbool_t force) { - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "Itb", type, force); @@ -625,7 +605,6 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) } /* end if */ } /* end if */ - FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__clear_type_cb() */ @@ -649,7 +628,7 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) herr_t H5Idestroy_type(H5I_type_t type) { - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "It", type); @@ -731,7 +710,7 @@ done: hid_t H5Iregister(H5I_type_t type, const void *object) { - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "It*x", type, object); @@ -826,8 +805,8 @@ done: void * H5I_subst(hid_t id, const void *new_object) { - H5I_id_info_t *id_ptr; /* Ptr to the atom */ - void *ret_value; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the atom */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -866,7 +845,7 @@ H5I_object(hid_t id) H5I_id_info_t *id_ptr; /*ptr to the new atom */ void *ret_value = NULL; /*return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_NOAPI_NOERR /* General lookup of the ID */ if(NULL != (id_ptr = H5I__find_id(id))) { @@ -875,7 +854,6 @@ H5I_object(hid_t id) ret_value = (void *)id_ptr->obj_ptr; } /* end if */ -done: FUNC_LEAVE_NOAPI(ret_value) } /* end if */ @@ -900,7 +878,7 @@ done: void * H5Iobject_verify(hid_t id, H5I_type_t id_type) { - void * ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) H5TRACE2("*x", "iIt", id, id_type); @@ -939,7 +917,7 @@ H5I_object_verify(hid_t id, H5I_type_t id_type) H5I_id_info_t *id_ptr = NULL; /*ptr to the new atom */ void *ret_value = NULL; /*return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_NOAPI_NOERR HDassert(id_type >= 1 && id_type < H5I_next_type); @@ -950,7 +928,6 @@ H5I_object_verify(hid_t id, H5I_type_t id_type) ret_value = (void *)id_ptr->obj_ptr; } /* end if */ -done: FUNC_LEAVE_NOAPI(ret_value) } /* H5I_object_verify() */ @@ -974,16 +951,15 @@ done: H5I_type_t H5I_get_type(hid_t id) { - H5I_type_t ret_value = H5I_BADID; + H5I_type_t ret_value = H5I_BADID; /* Return value */ - FUNC_ENTER_NOAPI(H5I_BADID) + FUNC_ENTER_NOAPI_NOERR if(id > 0) ret_value = H5I_TYPE(id); HDassert(ret_value >= H5I_BADID && ret_value < H5I_next_type); -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_get_type() */ @@ -1006,7 +982,7 @@ done: H5I_type_t H5Iget_type(hid_t id) { - H5I_type_t ret_value = H5I_BADID; /* Return value */ + H5I_type_t ret_value = H5I_BADID; /* Return value */ FUNC_ENTER_API(H5I_BADID) H5TRACE1("It", "i", id); @@ -1041,7 +1017,7 @@ done: void * H5Iremove_verify(hid_t id, H5I_type_t id_type) { - void * ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) H5TRACE2("*x", "iIt", id, id_type); @@ -1108,8 +1084,8 @@ H5I__remove_verify(hid_t id, H5I_type_t id_type) static void * H5I__remove_common(H5I_id_type_t *type_ptr, hid_t id) { - H5I_id_info_t *curr_id; /*ptr to the current atom */ - void * ret_value; /*return value */ + H5I_id_info_t *curr_id; /* Pointer to the current atom */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -1149,9 +1125,9 @@ done: void * H5I_remove(hid_t id) { - H5I_id_type_t *type_ptr; /*ptr to the atomic type */ - H5I_type_t type; /*atom's atomic type */ - void * ret_value; /*return value */ + H5I_id_type_t *type_ptr; /* Pointer to the atomic type */ + H5I_type_t type; /* Atom's atomic type */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1190,7 +1166,7 @@ done: int H5Idec_ref(hid_t id) { - int ret_value; /* Return value */ + int ret_value = 0; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("Is", "i", id); @@ -1228,8 +1204,8 @@ done: int H5I_dec_ref(hid_t id) { - H5I_id_info_t *id_ptr; /*ptr to the new ID */ - int ret_value; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the new ID */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1298,8 +1274,8 @@ done: int H5I_dec_app_ref(hid_t id) { - H5I_id_info_t *id_ptr; /*ptr to the new ID */ - int ret_value; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the new ID */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1346,7 +1322,7 @@ done: int H5I_dec_app_ref_always_close(hid_t id) { - int ret_value; /* Return value */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1424,8 +1400,8 @@ done: int H5I_inc_ref(hid_t id, hbool_t app_ref) { - H5I_id_info_t *id_ptr; /*ptr to the ID */ - int ret_value; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the ID */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1499,8 +1475,8 @@ done: int H5I_get_ref(hid_t id, hbool_t app_ref) { - H5I_id_info_t *id_ptr; /*ptr to the ID */ - int ret_value; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the ID */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1574,8 +1550,8 @@ done: static int H5I__inc_type_ref(H5I_type_t type) { - H5I_id_type_t *type_ptr; /* ptr to the type */ - int ret_value; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the type */ + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -1658,8 +1634,8 @@ done: herr_t H5I_dec_type_ref(H5I_type_t type) { - H5I_id_type_t *type_ptr; /* Pointer to the ID type */ - herr_t ret_value; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the ID type */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1747,7 +1723,7 @@ static int H5I__get_type_ref(H5I_type_t type) { H5I_id_type_t *type_ptr; /*ptr to the type */ - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -1825,7 +1801,7 @@ static int H5I__search_cb(void *obj, hid_t id, void *_udata) { H5I_search_ud_t *udata = (H5I_search_ud_t *)_udata; /* User data for callback */ - int ret_value; /* Callback return value */ + int ret_value = -1; /* Callback return value */ FUNC_ENTER_STATIC_NOERR @@ -2013,7 +1989,7 @@ H5I__find_id(hid_t id) { H5I_type_t type; /*ID's type */ H5I_id_type_t *type_ptr; /*ptr to the type */ - H5I_id_info_t *ret_value; /*return value */ + H5I_id_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -2130,7 +2106,7 @@ hid_t H5I_get_file_id(hid_t obj_id, hbool_t app_ref) { H5I_type_t type; /* ID type */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Imodule.h b/src/H5Imodule.h new file mode 100644 index 0000000..19cc9a4 --- /dev/null +++ b/src/H5Imodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5I package. Including this header means that the source file + * is part of the H5I package. + */ +#ifndef _H5Imodule_H +#define _H5Imodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5I_MODULE +#define H5_MY_PKG H5I +#define H5_MY_PKG_ERR H5E_ATOM +#define H5_MY_PKG_INIT NO + +#endif /* _H5Imodule_H */ + diff --git a/src/H5Ipkg.h b/src/H5Ipkg.h index 1666b76..0a6ae8c 100644 --- a/src/H5Ipkg.h +++ b/src/H5Ipkg.h @@ -21,7 +21,7 @@ * the H5I package. Source files outside the H5I package should * include H5Iprivate.h instead. */ -#ifndef H5I_PACKAGE +#if !(defined H5I_FRIEND || defined H5I_MODULE) #error "Do not include this file outside the H5I package!" #endif diff --git a/src/H5Itest.c b/src/H5Itest.c index 5236e8d..9d451c6 100644 --- a/src/H5Itest.c +++ b/src/H5Itest.c @@ -23,7 +23,7 @@ /* Module Setup */ /****************/ -#define H5I_PACKAGE /*suppress error about including H5Ipkg */ +#include "H5Imodule.h" /* This source code file is part of the H5I module */ #define H5I_TESTING /*suppress warning about H5I testing funcs*/ @@ -80,7 +80,7 @@ ssize_t H5I_get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached) { H5G_loc_t loc; /* Object location */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -17,10 +17,8 @@ /* Module Setup */ /****************/ -#define H5L_PACKAGE /*suppress error about including H5Lpkg */ +#include "H5Lmodule.h" /* This source code file is part of the H5L module */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5L_init_interface /***********/ /* Headers */ @@ -191,6 +189,9 @@ static herr_t H5L_get_name_by_idx_cb(H5G_loc_t *grp_loc/*in*/, /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -235,7 +236,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_init_interface + * Function: H5L__init_package * * Purpose: Initialize information specific to H5L interface. * @@ -246,12 +247,12 @@ done: * *------------------------------------------------------------------------- */ -static herr_t -H5L_init_interface(void) +herr_t +H5L__init_package(void) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Initialize user-defined link classes */ if(H5L_register_external() < 0) @@ -259,13 +260,13 @@ H5L_init_interface(void) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_init_interface() */ +} /* end H5L_init_package() */ /*------------------------------------------------------------------------- - * Function: H5L_term_interface + * Function: H5L_term_package * - * Purpose: Terminate any resources allocated in H5L_init_interface. + * Purpose: Terminate any resources allocated in H5L__init_package. * * Return: Non-negative on success/Negative on failure * @@ -275,21 +276,27 @@ done: *------------------------------------------------------------------------- */ int -H5L_term_interface(void) +H5L_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - /* Free the table of link types */ - H5L_table_g = (H5L_class_t *)H5MM_xfree(H5L_table_g); - H5L_table_used_g = H5L_table_alloc_g = 0; + if(H5_PKG_INIT_VAR) { + /* Free the table of link types */ + if(H5L_table_g) { + H5L_table_g = (H5L_class_t *)H5MM_xfree(H5L_table_g); + H5L_table_used_g = H5L_table_alloc_g = 0; + n++; + } /* end if */ - /* Mark the interface as uninitialized */ - H5_interface_initialize_g = 0; + /* Mark the interface as uninitialized */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; + } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* H5L_term_interface() */ +} /* H5L_term_package() */ /*------------------------------------------------------------------------- @@ -2792,7 +2799,7 @@ static htri_t H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id) { hbool_t exists = FALSE; /* Whether the link exists in the group */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2949,7 +2956,7 @@ done: hid_t H5L_get_default_lcpl(void) { - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index fcd3395..f029ebc 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -13,12 +13,17 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ -#define H5L_PACKAGE /*suppress error about including H5Lpkg */ +/****************/ +/* Module Setup */ +/****************/ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5L_init_extern_interface +#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#include "H5Lmodule.h" /* This source code file is part of the H5L module */ + +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ #include "H5Eprivate.h" /* Error handling */ @@ -29,13 +34,52 @@ #include "H5Opublic.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ + +/****************/ +/* Local Macros */ +/****************/ + +/* Version of external link format */ +#define H5L_EXT_VERSION 0 + +/* Valid flags for external links */ +#define H5L_EXT_FLAGS_ALL 0 + +/* Size of local link name buffer for traversing external links */ +#define H5L_EXT_TRAVERSE_BUF_SIZE 256 + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + static hid_t H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const void *udata, size_t H5_ATTR_UNUSED udata_size, hid_t lapl_id); static ssize_t H5L_extern_query(const char H5_ATTR_UNUSED * link_name, const void *udata, size_t udata_size, void * buf /*out*/, size_t buf_size); + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + /* Default External Link link class */ -const H5L_class_t H5L_EXTERN_LINK_CLASS[1] = {{ +static const H5L_class_t H5L_EXTERN_LINK_CLASS[1] = {{ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */ H5L_TYPE_EXTERNAL, /* Link type id number */ "external", /* Link name for debugging */ @@ -47,41 +91,9 @@ const H5L_class_t H5L_EXTERN_LINK_CLASS[1] = {{ H5L_extern_query /* Query callback */ }}; -/* Version of external link format */ -#define H5L_EXT_VERSION 0 - -/* Valid flags for external links */ -#define H5L_EXT_FLAGS_ALL 0 - -/* Size of local link name buffer for traversing external links */ -#define H5L_EXT_TRAVERSE_BUF_SIZE 256 /*-------------------------------------------------------------------------- -NAME - H5L_init_extern_interface -- Initialize interface-specific information -USAGE - herr_t H5L_init_extern_interface() - -RETURNS - Non-negative on success/Negative on failure - -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5L_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5L_init_extern_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5L_init()) -} /* H5L_init_extern_interface() */ - - - -/*-------------------------------------------------------------------------- * Function: H5L_getenv_prefix_name -- * * Purpose: Get the first pathname in the list of pathnames stored in ENV_PREFIX, @@ -210,7 +222,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, char *actual_file_name = NULL; /* Parent file's actual name */ H5P_genplist_t *fa_plist; /* File access property list pointer */ H5F_close_degree_t fc_degree = H5F_CLOSE_WEAK; /* File close degree for target file */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -254,7 +266,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get parent's file access property list") /* Get callback_info */ - if(H5P_get(plist, H5L_ACS_ELINK_CB_NAME, &cb_info)<0) + if(H5P_get(plist, H5L_ACS_ELINK_CB_NAME, &cb_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get elink callback info") /* Get file access property list */ @@ -279,7 +291,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* Check if we need to allocate larger buffer */ if((size_t)group_name_len > sizeof(local_group_name)) { if(NULL == (parent_group_name = (char *)H5MM_malloc((size_t)group_name_len))) - HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, FAIL, "can't allocate buffer to hold group name, group_name_len = %Zu", group_name_len) + HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, FAIL, "can't allocate buffer to hold group name, group_name_len = %zd", group_name_len) } /* end if */ else parent_group_name = local_group_name; @@ -378,7 +390,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* try searching from property list */ if(ext_file == NULL) { - if(H5P_get(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0) + if(H5P_peek(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix") if(my_prefix) { if(H5L_build_name(my_prefix, temp_file_name, &full_name/*out*/) < 0) diff --git a/src/H5Lmodule.h b/src/H5Lmodule.h new file mode 100644 index 0000000..e665c81 --- /dev/null +++ b/src/H5Lmodule.h @@ -0,0 +1,36 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5L package. Including this header means that the source file + * is part of the H5L package. + */ +#ifndef _H5Lmodule_H +#define _H5Lmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5L_MODULE +#define H5_MY_PKG H5L +#define H5_MY_PKG_ERR H5E_LINK +#define H5_MY_PKG_INIT YES + +#endif /* _H5Lmodule_H */ + + diff --git a/src/H5Lpkg.h b/src/H5Lpkg.h index 2e931f5..bb8534b 100644 --- a/src/H5Lpkg.h +++ b/src/H5Lpkg.h @@ -21,7 +21,7 @@ * only within the H5L package. Source files outside the * H5L package should include H5Lprivate.h instead. */ -#ifndef H5L_PACKAGE +#if !(defined H5L_FRIEND || defined H5L_MODULE) #error "Do not include this file outside the H5L package!" #endif @@ -28,8 +28,8 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5MF_PACKAGE /*suppress error about including H5MFpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#include "H5MFmodule.h" /* This source code file is part of the H5MF module */ /***********/ @@ -92,6 +92,9 @@ static herr_t H5MF_alloc_close(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -237,6 +240,8 @@ H5MF_alloc_open(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type) { const H5FS_section_class_t *classes[] = { /* Free space section classes implemented for file */ H5MF_FSPACE_SECT_CLS_SIMPLE}; + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -250,6 +255,10 @@ H5MF_alloc_open(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type) HDassert(H5F_addr_defined(f->shared->fs_addr[type])); HDassert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED); + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Open an existing free space structure for the file */ if(NULL == (f->shared->fs_man[type] = H5FS_open(f, dxpl_id, f->shared->fs_addr[type], NELMTS(classes), classes, f, f->shared->alignment, f->shared->threshold))) @@ -260,6 +269,10 @@ H5MF_alloc_open(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type) f->shared->fs_state[type] = H5F_FS_STATE_OPEN; done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF_alloc_open() */ @@ -423,8 +436,10 @@ done: haddr_t H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, hsize_t size) { + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ H5FD_mem_t fs_type; /* Free space type (mapped from allocation type) */ - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) #ifdef H5MF_ALLOC_DEBUG @@ -440,6 +455,10 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ /* Get free space type from allocation type */ fs_type = H5MF_ALLOC_TO_FS_TYPE(f, alloc_type); + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, HADDR_UNDEF, "unable to set ring value") + /* Check if we are using the free space manager for this file */ if(H5F_HAVE_FREE_SPACE_MANAGER(f)) { /* Check if the free space manager for the file has been initialized */ @@ -512,6 +531,10 @@ HDfprintf(stderr, "%s: Check 2.0\n", FUNC); HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed from aggr/vfd") done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, HADDR_UNDEF, "unable to set property value") + #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size); #endif /* H5MF_ALLOC_DEBUG */ @@ -551,7 +574,7 @@ haddr_t H5MF_alloc_tmp(H5F_t *f, hsize_t size) { haddr_t eoa; /* End of allocated space in the file */ - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) #ifdef H5MF_ALLOC_DEBUG @@ -604,6 +627,8 @@ H5MF_xfree(const H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, haddr_t addr, H5F_io_info_t fio_info; /* I/O info for operation */ H5MF_free_section_t *node = NULL; /* Free space section pointer */ H5MF_sect_ud_t udata; /* User data for callback */ + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ H5FD_mem_t fs_type; /* Free space type (mapped from allocation type) */ herr_t ret_value = SUCCEED; /* Return value */ @@ -622,6 +647,10 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN if(H5F_addr_le(f->shared->tmp_addr, addr)) HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, FAIL, "attempting to free temporary file space") + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Set up I/O info for operation */ fio_info.f = f; if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) @@ -729,6 +758,10 @@ HDfprintf(stderr, "%s: After H5FS_sect_add()\n", FUNC); } /* end else */ done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value") + /* Release section node, if allocated and not added to section list or merged */ if(node) if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0) @@ -762,9 +795,11 @@ htri_t H5MF_try_extend(H5F_t *f, hid_t dxpl_id, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsize_t extra_requested) { + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ haddr_t end; /* End of block to extend */ H5FD_mem_t map_type; /* Mapped type */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) #ifdef H5MF_ALLOC_DEBUG @@ -781,6 +816,10 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r /* Compute end of block to extend */ end = addr + size; + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Check if the block is exactly at the end of the file */ if((ret_value = H5FD_try_extend(f->shared->lf, map_type, f, end, extra_requested)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file") @@ -810,6 +849,10 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r } /* end if */ done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value") + #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value); #endif /* H5MF_ALLOC_DEBUG */ @@ -842,6 +885,8 @@ H5MF_sects_dump(f, dxpl_id, stderr); herr_t H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_size) { + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ haddr_t eoa; /* End of allocated space in the file */ haddr_t ma_addr = HADDR_UNDEF; /* Base "metadata aggregator" address */ hsize_t ma_size = 0; /* Size of "metadata aggregator" */ @@ -865,6 +910,10 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_si if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Retrieve metadata aggregator info, if available */ if(H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats") @@ -953,6 +1002,10 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_si *meta_size = tot_meta_size; done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF_get_freespace() */ @@ -977,7 +1030,9 @@ H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, haddr_t addr, { H5MF_free_section_t *node = NULL; /* Free space section pointer */ H5MF_sect_ud_t udata; /* User data for callback */ - htri_t ret_value; /* Return value */ + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) #ifdef H5MF_ALLOC_DEBUG @@ -991,6 +1046,10 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN HDassert(H5F_addr_defined(addr)); HDassert(size > 0); + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Create free space section for block */ if(NULL == (node = H5MF_sect_simple_new(addr, size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space section") @@ -1012,6 +1071,10 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN } /* end if */ done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value") + /* Free section node allocated */ if(node && H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0) HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") @@ -1104,6 +1167,8 @@ done: herr_t H5MF_close(H5F_t *f, hid_t dxpl_id) { + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ H5FD_mem_t type; /* Memory type for iteration */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1118,6 +1183,10 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); HDassert(f->shared->lf); HDassert(f->shared->sblock); + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Free the space in aggregators */ /* (for space not at EOF, it may be put into free space managers) */ if(H5MF_free_aggrs(f, dxpl_id) < 0) @@ -1280,6 +1349,10 @@ HDfprintf(stderr, "%s: Before deleting free space manager\n", FUNC); HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa") done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value") + #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Leaving\n", FUNC); #endif /* H5MF_ALLOC_DEBUG */ @@ -1337,9 +1410,11 @@ H5MF_get_free_sections(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, size_t nsects, { size_t total_sects = 0; /* total number of sections */ H5MF_sect_iter_ud_t sect_udata; /* User data for callback */ + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ H5FD_mem_t start_type, end_type; /* Memory types to iterate over */ H5FD_mem_t ty; /* Memory type for iteration */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1363,6 +1438,10 @@ H5MF_get_free_sections(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, size_t nsects, sect_udata.sect_count = nsects; sect_udata.sect_idx = 0; + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_FSM, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set ring value") + /* Iterate over memory types, retrieving the number of sections of each type */ for(ty = start_type; ty < end_type; H5_INC_ENUM(H5FD_mem_t, ty)) { hbool_t fs_started = FALSE; @@ -1406,6 +1485,10 @@ H5MF_get_free_sections(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, size_t nsects, ret_value = (ssize_t)total_sects; done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "unable to set property value") + FUNC_LEAVE_NOAPI(ret_value) } /* H5MF_get_free_sections() */ diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index c5a7b49..40f3ac0 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -25,8 +25,8 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5MF_PACKAGE /*suppress error about including H5MFpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#include "H5MFmodule.h" /* This source code file is part of the H5MF module */ /***********/ @@ -97,7 +97,7 @@ static herr_t H5MF_aggr_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, hsize_t size) { - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) #ifdef H5MF_ALLOC_DEBUG @@ -158,7 +158,7 @@ H5MF_aggr_alloc(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr, haddr_t eoa_frag_addr = HADDR_UNDEF; /* Address of fragment at EOA */ hsize_t eoa_frag_size = 0; /* Size of fragment at EOA */ haddr_t eoa = HADDR_UNDEF; /* Initial EOA for the file */ - haddr_t ret_value; /* Return value */ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI(HADDR_UNDEF) #ifdef H5MF_AGGR_DEBUG @@ -871,7 +871,7 @@ H5MF_aggrs_try_shrink_eoa(H5F_t *f, hid_t dxpl_id) { htri_t ma_status; /* Whether the metadata aggregator can shrink the EOA */ htri_t sda_status; /* Whether the small data aggregator can shrink the EOA */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index 3a664ef..59da9e8 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -28,8 +28,8 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5MF_PACKAGE /*suppress error about including H5MFpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#include "H5MFmodule.h" /* This source code file is part of the H5MF module */ #define H5MF_DEBUGGING /* Need access to file space debugging routines */ diff --git a/src/H5MFmodule.h b/src/H5MFmodule.h new file mode 100644 index 0000000..6e5f8ad --- /dev/null +++ b/src/H5MFmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5MF package. Including this header means that the source file + * is part of the H5MF package. + */ +#ifndef _H5MFmodule_H +#define _H5MFmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5MF_MODULE +#define H5_MY_PKG H5MF +#define H5_MY_PKG_ERR H5E_RESOURCE +#define H5_MY_PKG_INIT NO + +#endif /* _H5MFmodule_H */ + diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h index 2071a0a..1a62710 100644 --- a/src/H5MFpkg.h +++ b/src/H5MFpkg.h @@ -21,7 +21,7 @@ * the H5MF package. Source files outside the H5MF package should * include H5MFprivate.h instead. */ -#ifndef H5MF_PACKAGE +#if !(defined H5MF_FRIEND || defined H5MF_MODULE) #error "Do not include this file outside the H5MF package!" #endif diff --git a/src/H5MFsection.c b/src/H5MFsection.c index 20b9984..f333356 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -25,8 +25,8 @@ /* Module Setup */ /****************/ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#define H5MF_PACKAGE /*suppress error about including H5MFpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#include "H5MFmodule.h" /* This source code file is part of the H5MF module */ /***********/ @@ -132,7 +132,7 @@ H5MF_free_section_t * H5MF_sect_simple_new(haddr_t sect_off, hsize_t sect_size) { H5MF_free_section_t *sect = NULL; /* 'Simple' free space section to add */ - H5MF_free_section_t *ret_value; /* Return value */ + H5MF_free_section_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -178,7 +178,7 @@ H5MF_sect_simple_deserialize(const H5FS_section_class_t H5_ATTR_UNUSED *cls, hsize_t sect_size, unsigned H5_ATTR_UNUSED *des_flags) { H5MF_free_section_t *sect; /* New section */ - H5FS_section_info_t *ret_value; /* Return value */ + H5FS_section_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -219,7 +219,7 @@ H5MF_sect_simple_can_merge(const H5FS_section_info_t *_sect1, { const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */ const H5MF_free_section_t *sect2 = (const H5MF_free_section_t *)_sect2; /* File free section */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -300,7 +300,7 @@ H5MF_sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata) H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */ haddr_t eoa; /* End of address space in the file */ haddr_t end; /* End of section to extend */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -519,7 +519,7 @@ H5MF_sect_simple_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, static H5FS_section_info_t * H5MF_sect_simple_split(H5FS_section_info_t *sect, hsize_t frag_size) { - H5MF_free_section_t *ret_value; /* Return value */ + H5MF_free_section_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -29,7 +29,7 @@ *------------------------------------------------------------------------- */ -#define H5MP_PACKAGE /*suppress error about including H5MPpkg */ +#include "H5MPmodule.h" /* This source code file is part of the H5MP module */ /* Private headers */ #include "H5private.h" /* Generic Functions */ @@ -63,6 +63,9 @@ /* Package Variable Definitions */ /********************************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /********************/ /* Static Variables */ @@ -90,7 +93,7 @@ H5MP_pool_t * H5MP_create(size_t page_size, unsigned flags) { H5MP_pool_t *mp = NULL; /* New memory pool header */ - H5MP_pool_t *ret_value; /* Return value */ + H5MP_pool_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -141,7 +144,7 @@ H5MP_new_page(H5MP_pool_t *mp, size_t page_size) { H5MP_page_t *new_page; /* New page created */ H5MP_page_blk_t *first_blk; /* Pointer to first block in page */ - H5MP_page_t *ret_value; /* Return value */ + H5MP_page_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -212,7 +215,7 @@ H5MP_malloc (H5MP_pool_t *mp, size_t request) H5MP_page_t *alloc_page = NULL; /* Page to allocate space from */ H5MP_page_blk_t *alloc_free; /* Pointer to free space in page */ size_t needed; /* Size requested, plus block header and alignment */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) diff --git a/src/H5MPmodule.h b/src/H5MPmodule.h new file mode 100644 index 0000000..ca6c405 --- /dev/null +++ b/src/H5MPmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5MP package. Including this header means that the source file + * is part of the H5MP package. + */ +#ifndef _H5MPmodule_H +#define _H5MPmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5MP_MODULE +#define H5_MY_PKG H5MP +#define H5_MY_PKG_ERR H5E_RESOURCE +#define H5_MY_PKG_INIT NO + +#endif /* _H5MPmodule_H */ + diff --git a/src/H5MPpkg.h b/src/H5MPpkg.h index 5a0b1f8..e724146 100644 --- a/src/H5MPpkg.h +++ b/src/H5MPpkg.h @@ -21,7 +21,7 @@ * the H5MP package. Source files outside the H5MP package should * include H5MPprivate.h instead. */ -#ifndef H5MP_PACKAGE +#if !(defined H5MP_FRIEND || defined H5MP_MODULE) #error "Do not include this file outside the H5MP package!" #endif diff --git a/src/H5MPtest.c b/src/H5MPtest.c index ccbd140..3f218db 100644 --- a/src/H5MPtest.c +++ b/src/H5MPtest.c @@ -19,7 +19,7 @@ * Purpose: Memory pool testing functions. */ -#define H5MP_PACKAGE /*suppress error about including H5MPpkg */ +#include "H5MPmodule.h" /* This source code file is part of the H5MP module */ #define H5MP_TESTING /*include H5MP testing funcs*/ /* Private headers */ @@ -28,10 +28,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5O_init_interface /***********/ /* Headers */ @@ -94,6 +92,9 @@ static const H5O_obj_class_t *H5O_obj_class_real(H5O_t *oh); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Header message ID to class mapping */ /* Remember to increment H5O_MSG_TYPES in H5Opkg.h when adding a new @@ -178,7 +179,7 @@ static const H5O_obj_class_t *const H5O_obj_class_g[] = { /*------------------------------------------------------------------------- - * Function: H5O_init_interface + * Function: H5O__init_package * * Purpose: Initialize information specific to H5O interface. * @@ -187,16 +188,12 @@ static const H5O_obj_class_t *const H5O_obj_class_g[] = { * Programmer: Quincey Koziol * Thursday, January 18, 2007 * - * Changes: JRM -- 12/12/07 - * Added santity check verifying that H5O_msg_class_g - * is big enough. - * *------------------------------------------------------------------------- */ -static herr_t -H5O_init_interface(void) +herr_t +H5O__init_package(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* H5O interface sanity checks */ HDcompile_assert(H5O_MSG_TYPES == NELMTS(H5O_msg_class_g)); @@ -205,7 +202,7 @@ H5O_init_interface(void) HDcompile_assert(H5O_UNKNOWN_ID < H5O_MSG_TYPES); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_init_interface() */ +} /* end H5O__init_package() */ /*------------------------------------------------------------------------- @@ -247,7 +244,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) /* Open the object */ if((ret_value = H5O_open_name(&loc, name, lapl_id, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: FUNC_LEAVE_API(ret_value) @@ -313,18 +310,18 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, /* Find the object's location, according to the order in the index */ if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; /* Open the object */ if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, dxpl_id, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: /* Release the object location if we failed after copying it */ if(ret_value < 0 && loc_found) if(H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") FUNC_LEAVE_API(ret_value) } /* end H5Oopen_by_idx() */ @@ -394,7 +391,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) /* Open the object */ if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_ind_dxpl_id, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: @@ -458,7 +455,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, /* Link to the object */ if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link") done: FUNC_LEAVE_API(ret_value) @@ -619,7 +616,7 @@ H5Oget_info(hid_t loc_id, H5O_info_t *oinfo) /* Retrieve the object's information */ if(H5G_loc_info(&loc, ".", TRUE, oinfo/*out*/, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: FUNC_LEAVE_API(ret_value) @@ -663,7 +660,7 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap /* Retrieve the object's information */ if(H5G_loc_info(&loc, name, TRUE, oinfo/*out*/, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: FUNC_LEAVE_API(ret_value) @@ -723,17 +720,17 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, /* Find the object's location, according to the order in the index */ if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; /* Retrieve the object's information */ if(H5O_get_info(obj_loc.oloc, H5AC_ind_dxpl_id, TRUE, oinfo) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve object info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") done: /* Release the object location */ if(loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") FUNC_LEAVE_API(ret_value) } /* end H5Oget_info_by_idx() */ @@ -771,7 +768,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) /* (Re)set the object's comment */ if(H5G_loc_set_comment(&loc, ".", comment, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: FUNC_LEAVE_API(ret_value) @@ -818,7 +815,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, /* (Re)set the object's comment */ if(H5G_loc_set_comment(&loc, name, comment, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: FUNC_LEAVE_API(ret_value) @@ -856,7 +853,7 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) /* Retrieve the object's comment */ if((ret_value = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: FUNC_LEAVE_API(ret_value) @@ -902,7 +899,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf /* Retrieve the object's comment */ if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize, lapl_id, dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: FUNC_LEAVE_API(ret_value) @@ -960,7 +957,7 @@ H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, /* Call internal object visitation routine */ if((ret_value = H5O_visit(obj_id, ".", idx_type, order, op, op_data, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "object visitation failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: FUNC_LEAVE_API(ret_value) @@ -1026,7 +1023,7 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Call internal object visitation routine */ if((ret_value = H5O_visit(loc_id, obj_name, idx_type, order, op, op_data, lapl_id, dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "object visitation failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: FUNC_LEAVE_API(ret_value) @@ -1370,17 +1367,17 @@ H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hbool_t app_ref) /* Find the object's location */ if(H5G_loc_find(loc, name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; /* Open the object */ if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, dxpl_id, app_ref)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: if(ret_value < 0 && loc_found) if(H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_open_name() */ @@ -1403,7 +1400,7 @@ hid_t H5O_open_by_loc(const H5G_loc_t *obj_loc, hid_t lapl_id, hid_t dxpl_id, hbool_t app_ref) { const H5O_obj_class_t *obj_class; /* Class of object for location */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1499,7 +1496,7 @@ int H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, hbool_t *deleted) { haddr_t addr = H5O_OH_GET_ADDR(oh); /* Object header address */ - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1615,7 +1612,7 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) { H5O_t *oh = NULL; hbool_t deleted = FALSE; /* Whether the object was deleted */ - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, loc->addr, FAIL) @@ -1666,7 +1663,7 @@ H5O_protect(const H5O_loc_t *loc, hid_t dxpl_id, unsigned prot_flags) H5O_cache_ud_t udata; /* User data for protecting object header */ H5O_cont_msgs_t cont_msg_info; /* Continuation message info */ unsigned file_intent; /* R/W intent on file */ - H5O_t *ret_value; /* Return value */ + H5O_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, loc->addr, NULL) @@ -1885,8 +1882,8 @@ done: H5O_t * H5O_pin(const H5O_loc_t *loc, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Object header */ - H5O_t *ret_value; /* Return value */ + H5O_t *oh = NULL; /* Object header */ + H5O_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -2380,7 +2377,7 @@ const H5O_obj_class_t * H5O_obj_class(const H5O_loc_t *loc, hid_t dxpl_id) { H5O_t *oh = NULL; /* Object header for location */ - const H5O_obj_class_t *ret_value; /* Return value */ + const H5O_obj_class_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->addr, NULL) @@ -2417,7 +2414,7 @@ static const H5O_obj_class_t * H5O_obj_class_real(H5O_t *oh) { size_t i; /* Local index variable */ - const H5O_obj_class_t *ret_value; /* Return value */ + const H5O_obj_class_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -2459,7 +2456,7 @@ done: H5O_loc_t * H5O_get_loc(hid_t object_id) { - H5O_loc_t *ret_value; /* Return value */ + H5O_loc_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -3279,7 +3276,7 @@ H5O_visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type, hbool_t loc_found = FALSE; /* Entry at 'name' found */ H5O_info_t oinfo; /* Object info struct */ hid_t obj_id = (-1); /* ID of object */ - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 4949b23..c5f692d 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -24,8 +24,9 @@ *------------------------------------------------------------------------- */ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5A_FRIEND /*suppress error about including H5Apkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Apkg.h" /* Attributes */ @@ -110,7 +111,7 @@ H5O_ainfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *o { H5O_ainfo_t *ainfo = NULL; /* Attribute info */ unsigned char flags; /* Flags for encoding attribute info */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -239,7 +240,7 @@ H5O_ainfo_copy(const void *_mesg, void *_dest) { const H5O_ainfo_t *ainfo = (const H5O_ainfo_t *)_mesg; H5O_ainfo_t *dest = (H5O_ainfo_t *) _dest; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -279,7 +280,7 @@ static size_t H5O_ainfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_ainfo_t *ainfo = (const H5O_ainfo_t *)_mesg; - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -408,7 +409,7 @@ H5O_ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, { H5O_ainfo_t *ainfo_src = (H5O_ainfo_t *)mesg_src; H5O_ainfo_t *ainfo_dst = NULL; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index e9d4f85..3d930f0 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + /***********/ /* Headers */ @@ -515,7 +516,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno, uint8_t *old_image; /* Old address of chunk's image in memory */ size_t old_size; /* Old size of chunk */ htri_t was_extended; /* If chunk can be extended */ - size_t extend_msg; /* Index of null message to extend */ + size_t extend_msg = 0; /* Index of null message to extend */ hbool_t extended_msg = FALSE; /* Whether an existing message was extended */ uint8_t new_size_flags = 0; /* New chunk #0 size flags */ hbool_t adjust_size_flags = FALSE; /* Whether to adjust the chunk #0 size flags */ @@ -1458,7 +1459,7 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh) hbool_t curr_chk_dirtied = FALSE; /* Flags for unprotecting curr chunk */ hbool_t packed_msg; /* Flag to indicate that messages were packed */ hbool_t did_packing = FALSE; /* Whether any messages were packed */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1742,7 +1743,7 @@ H5O_merge_null(H5F_t *f, hid_t dxpl_id, H5O_t *oh) { hbool_t merged_msg; /* Flag to indicate that messages were merged */ hbool_t did_merging = FALSE; /* Whether any messages were merged */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1877,7 +1878,7 @@ H5O_remove_empty_chunks(H5F_t *f, hid_t dxpl_id, H5O_t *oh) { hbool_t deleted_chunk; /* Whether to a chunk was deleted */ hbool_t did_deleting = FALSE; /* Whether any chunks were deleted */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Oattr.c b/src/H5Oattr.c index fd7fcda..9cbcdc4 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -13,9 +13,9 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5A_PACKAGE /*prevent warning from including H5Apkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#define H5A_FRIEND /*suppress error about including H5Apkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ +#define H5S_FRIEND /*suppress error about including H5Spkg */ #include "H5private.h" /* Generic Functions */ @@ -129,7 +129,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED H5S_extent_t *extent; /*extent dimensionality information */ size_t name_len; /*attribute name length */ unsigned flags = 0; /* Attribute flags */ - H5A_t *ret_value; /* Return value */ + H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -380,7 +380,7 @@ done: static void * H5O_attr_copy(const void *_src, void *_dst) { - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -496,10 +496,6 @@ H5O_attr_reset(void H5_ATTR_UNUSED *_mesg) * Programmer: Quincey Koziol * Thursday, November 18, 2004 * - * Modification:Raymond Lu - * 4 June 2008 - * Let this function call H5A_close in turn. - * *------------------------------------------------------------------------- */ static herr_t @@ -652,7 +648,7 @@ H5O_attr_copy_file(H5F_t *file_src, const H5O_msg_class_t H5_ATTR_UNUSED *mesg_t void *native_src, H5F_t *file_dst, hbool_t *recompute_size, H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata, hid_t dxpl_id) { - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 52f414b..9b494a1 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -28,8 +28,9 @@ /* Module Setup */ /****************/ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5A_FRIEND /*suppress error about including H5Apkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + /***********/ /* Headers */ @@ -474,7 +475,7 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) H5A_t *exist_attr = NULL; /* Existing opened attribute object */ H5A_t *opened_attr = NULL; /* Newly opened attribute object */ htri_t found_open_attr = FALSE; /* Whether opened object is found */ - H5A_t *ret_value; /* Return value */ + H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->addr, NULL) @@ -616,7 +617,7 @@ H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, H5A_t *exist_attr = NULL; /* Existing opened attribute object */ H5A_t *opened_attr = NULL; /* Newly opened attribute object */ htri_t found_open_attr = FALSE; /* Whether opened object is found */ - H5A_t *ret_value; /* Return value */ + H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1272,7 +1273,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh = NULL; /* Pointer to actual object header */ H5O_ainfo_t ainfo; /* Attribute information for object */ H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->addr, FAIL) @@ -1357,7 +1358,7 @@ H5O_attr_iterate(hid_t loc_id, hid_t dxpl_id, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data) { H5G_loc_t loc; /* Object location */ - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1837,7 +1838,7 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) { H5O_t *oh = NULL; /* Pointer to actual object header */ H5O_ainfo_t ainfo; /* Attribute information for object */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, loc->addr, FAIL) @@ -1992,7 +1993,7 @@ H5O_attr_count(const H5O_loc_t *loc, hid_t dxpl_id) { H5O_t *oh = NULL; /* Pointer to actual object header */ hsize_t nattrs; /* Number of attributes */ - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Obogus.c b/src/H5Obogus.c index b368ab6..de205f6 100644 --- a/src/H5Obogus.c +++ b/src/H5Obogus.c @@ -28,7 +28,8 @@ *------------------------------------------------------------------------- */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ diff --git a/src/H5Obtreek.c b/src/H5Obtreek.c index 802f23a..ac6fe37 100644 --- a/src/H5Obtreek.c +++ b/src/H5Obtreek.c @@ -21,7 +21,8 @@ * information in the superblock extension. */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -83,7 +84,7 @@ H5O_btreek_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p) { H5O_btreek_t *mesg; /* Native message */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -165,7 +166,7 @@ H5O_btreek_copy(const void *_mesg, void *_dest) { const H5O_btreek_t *mesg = (const H5O_btreek_t *)_mesg; H5O_btreek_t *dest = (H5O_btreek_t *)_dest; - void *ret_value; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 203d0fc..945d12e 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ /***********/ @@ -636,13 +636,21 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O__cache_clear(const H5F_t *f, void *_thing, hbool_t about_to_destroy) +#ifdef H5_HAVE_PARALLEL +H5O__cache_clear(const H5F_t *f, void *_thing, hbool_t H5_ATTR_UNUSED about_to_destroy) +#else +H5O__cache_clear(const H5F_t H5_ATTR_UNUSED *f, void *_thing, hbool_t H5_ATTR_UNUSED about_to_destroy) +#endif /* H5_HAVE_PARALLEL */ { H5O_t *oh = (H5O_t *)_thing; /* Object header to reset */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ +#ifdef H5_HAVE_PARALLEL FUNC_ENTER_STATIC +#else + FUNC_ENTER_STATIC_NOERR +#endif /* H5_HAVE_PARALLEL */ /* Check arguments */ HDassert(oh); @@ -673,7 +681,9 @@ H5O__cache_clear(const H5F_t *f, void *_thing, hbool_t about_to_destroy) oh->ndecode_dirtied = 0; #endif /* NDEBUG */ +#ifdef H5_HAVE_PARALLEL done: +#endif /* H5_HAVE_PARALLEL */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__cache_clear() */ @@ -731,9 +741,9 @@ static void * H5O__cache_chk_deserialize(const void *image, size_t len, void *_udata, hbool_t *dirty) { - H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk proxy object */ + H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk proxy object */ H5O_chk_cache_ud_t *udata = (H5O_chk_cache_ud_t *)_udata; /* User data for callback */ - void * ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -942,14 +952,22 @@ done: *------------------------------------------------------------------------- */ static herr_t +#ifdef H5_HAVE_PARALLEL H5O__cache_chk_clear(const H5F_t *f, void *_thing, hbool_t about_to_destroy) +#else +H5O__cache_chk_clear(const H5F_t H5_ATTR_UNUSED *f, void *_thing, hbool_t H5_ATTR_UNUSED about_to_destroy) +#endif /* H5_HAVE_PARALLEL */ { H5O_chunk_proxy_t *chk_proxy = (H5O_chunk_proxy_t *)_thing; /* Object header chunk to reset */ H5O_t *oh; /* Object header for chunk */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ +#ifdef H5_HAVE_PARALLEL FUNC_ENTER_STATIC +#else + FUNC_ENTER_STATIC_NOERR +#endif /* H5_HAVE_PARALLEL */ /* Check arguments */ HDassert(chk_proxy); @@ -971,7 +989,9 @@ H5O__cache_chk_clear(const H5F_t *f, void *_thing, hbool_t about_to_destroy) if(chk_proxy->oh->mesg[u].chunkno == chk_proxy->chunkno) chk_proxy->oh->mesg[u].dirty = FALSE; +#ifdef H5_HAVE_PARALLEL done: +#endif /* H5_HAVE_PARALLEL */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__cache_chk_clear() */ diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c index bb82ad1..8abe660 100644 --- a/src/H5Ochunk.c +++ b/src/H5Ochunk.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + /***********/ /* Headers */ @@ -149,7 +150,7 @@ H5O_chunk_proxy_t * H5O_chunk_protect(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx) { H5O_chunk_proxy_t *chk_proxy = NULL; /* Proxy for protected chunk */ - H5O_chunk_proxy_t *ret_value; /* Return value */ + H5O_chunk_proxy_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, oh->cache_info.addr, NULL) diff --git a/src/H5Ocont.c b/src/H5Ocont.c index a139654..63002c5 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -27,7 +27,8 @@ *------------------------------------------------------------------------- */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -94,7 +95,7 @@ H5O_cont_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *op unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p) { H5O_cont_t *cont = NULL; - void *ret_value; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -174,7 +175,7 @@ H5O_cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con static size_t H5O_cont_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 66322da..e641d70 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + /***********/ /* Headers */ @@ -1084,7 +1085,7 @@ H5O_copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object copy flag") /* Retrieve the marge committed datatype list */ - if(H5P_get(ocpy_plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) + if(H5P_peek(ocpy_plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge committed datatype list") /* Get callback info */ diff --git a/src/H5Odbg.c b/src/H5Odbg.c index bd789c5..d9d4b8b 100644 --- a/src/H5Odbg.c +++ b/src/H5Odbg.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + /***********/ /* Headers */ @@ -247,8 +248,8 @@ H5O_assert(const H5O_t *oh) herr_t H5O_debug_id(unsigned type_id, H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, int indent, int fwidth) { - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c index 73cb7cc..2fdf494 100644 --- a/src/H5Odrvinfo.c +++ b/src/H5Odrvinfo.c @@ -21,7 +21,8 @@ * in the superblock extension. */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -84,7 +85,7 @@ H5O_drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p) { H5O_drvinfo_t *mesg; /* Native message */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -181,7 +182,7 @@ H5O_drvinfo_copy(const void *_mesg, void *_dest) { const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; H5O_drvinfo_t *dest = (H5O_drvinfo_t *)_dest; - void *ret_value; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -228,7 +229,7 @@ static size_t H5O_drvinfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; - size_t ret_value; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 622a18e..cee6e1e 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -13,8 +13,9 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5T_PACKAGE /*prevent warning from including H5Tpkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ +#define H5T_FRIEND /*prevent warning from including H5Tpkg */ + #include "H5private.h" /* Generic Functions */ #include "H5Dprivate.h" /* Datasets */ @@ -35,7 +36,7 @@ static void *H5O_dtype_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, static void *H5O_dtype_copy(const void *_mesg, void *_dest); static size_t H5O_dtype_size(const H5F_t *f, const void *_mesg); static herr_t H5O_dtype_reset(void *_mesg); -static herr_t H5O_dtype_free(void *_mesg); +static herr_t H5O__dtype_free(void *_mesg); static herr_t H5O_dtype_set_share(void *_mesg, const H5O_shared_t *sh); static htri_t H5O_dtype_can_share(const void *_mesg); static herr_t H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src, @@ -101,7 +102,7 @@ const H5O_msg_class_t H5O_MSG_DTYPE[1] = {{ H5O_dtype_copy, /* copy the native value */ H5O_dtype_shared_size, /* size of raw message */ H5O_dtype_reset, /* reset method */ - H5O_dtype_free, /* free method */ + H5O__dtype_free, /* free method */ H5O_dtype_shared_delete, /* file delete method */ H5O_dtype_shared_link, /* link method */ H5O_dtype_set_share, /* set share method */ @@ -1093,7 +1094,7 @@ H5O_dtype_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *o unsigned *ioflags/*in,out*/, const uint8_t *p) { H5T_t *dt = NULL; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1175,9 +1176,9 @@ done: static void * H5O_dtype_copy(const void *_src, void *_dst) { - const H5T_t *src = (const H5T_t *) _src; - H5T_t *dst; - void *ret_value; /* Return value */ + const H5T_t *src = (const H5T_t *) _src; + H5T_t *dst; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1224,7 +1225,7 @@ H5O_dtype_size(const H5F_t *f, const void *_mesg) { const H5T_t *dt = (const H5T_t *)_mesg; unsigned u; /* Local index variable */ - size_t ret_value; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1369,31 +1370,34 @@ H5O_dtype_reset(void *_mesg) /*------------------------------------------------------------------------- - * Function: H5O_dtype_free + * Function: H5O__dtype_free * - * Purpose: Free's the message + * Purpose: Frees the message * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Thursday, March 30, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5O_dtype_free(void *mesg) +H5O__dtype_free(void *mesg) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_STATIC + + /* Sanity check */ HDassert(mesg); - ((H5T_t *) mesg)->shared = H5FL_FREE(H5T_shared_t, ((H5T_t *) mesg)->shared); - mesg = H5FL_FREE(H5T_t, mesg); + /* Release the datatype */ + if(H5T_close((H5T_t *)mesg) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free datatype") - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_dtype_free() */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O__dtype_free() */ /*------------------------------------------------------------------------- @@ -1562,7 +1566,7 @@ H5O_dtype_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const H5O_msg_class_t *mesg_ H5O_copy_t H5_ATTR_UNUSED *cpy_info, void H5_ATTR_UNUSED *udata, hid_t H5_ATTR_UNUSED dxpl_id) { H5T_t *dst_mesg; /* Destination datatype */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Oefl.c b/src/H5Oefl.c index a7ce31a..25ab753 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -18,7 +18,7 @@ * Tuesday, November 25, 1997 */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ #include "H5private.h" /* Generic Functions */ @@ -96,8 +96,8 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh, int version; const char *s = NULL; H5HL_t *heap; - size_t u; /* Local index variable */ - void *ret_value; /* Return value */ + size_t u; /* Local index variable */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -258,64 +258,47 @@ H5O_efl_copy(const void *_mesg, void *_dest) { const H5O_efl_t *mesg = (const H5O_efl_t *) _mesg; H5O_efl_t *dest = (H5O_efl_t *) _dest; - size_t u; /* Local index variable */ - void *ret_value; /* Return value */ + size_t u; /* Local index variable */ + hbool_t slot_allocated = FALSE; /* Flag to indicate that dynamic allocation has begun */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* check args */ HDassert(mesg); - if(!dest) { - if(NULL == (dest = (H5O_efl_t *)H5MM_calloc(sizeof(H5O_efl_t)))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message") - if(NULL == (dest->slot = (H5O_efl_entry_t *)H5MM_calloc(mesg->nalloc * sizeof(H5O_efl_entry_t)))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message slots") - } /* end if */ - else if(dest->nalloc < mesg->nalloc) { - H5O_efl_entry_t *temp_slot; /* Temporary pointer to new slot information */ - /* Allocate new 'slot' information */ - if(NULL == (temp_slot = (H5O_efl_entry_t *)H5MM_calloc(mesg->nalloc * sizeof(H5O_efl_entry_t)))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message slots") + /* Allocate destination message, if necessary */ + if(!dest && NULL == (dest = (H5O_efl_t *)H5MM_calloc(sizeof(H5O_efl_t)))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message") - /* Release old 'slot' information */ - for(u = 0; u < dest->nused; u++) - dest->slot[u].name = (char *)H5MM_xfree(dest->slot[u].name); - dest->slot = (H5O_efl_entry_t *)H5MM_xfree(dest->slot); + /* copy */ + *dest = *mesg; - /* Point to new 'slot' information */ - dest->slot = temp_slot; + /* Deep copy allocated information */ + if(dest->nalloc > 0) { + if(NULL == (dest->slot = (H5O_efl_entry_t *)H5MM_calloc(dest->nalloc * sizeof(H5O_efl_entry_t)))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message slots") + slot_allocated = TRUE; + for(u = 0; u < mesg->nused; u++) { + dest->slot[u] = mesg->slot[u]; + if(NULL == (dest->slot[u].name = H5MM_xstrdup(mesg->slot[u].name))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message slot name") + } /* end for */ } /* end if */ - else { - /* Release old 'slot' information */ - for(u = 0; u < dest->nused; u++) - dest->slot[u].name = (char *)H5MM_xfree(dest->slot[u].name); - } /* end else */ - dest->heap_addr = mesg->heap_addr; - dest->nalloc = mesg->nalloc; - dest->nused = mesg->nused; - - for(u = 0; u < mesg->nused; u++) { - dest->slot[u] = mesg->slot[u]; - if(NULL == (dest->slot[u].name = H5MM_xstrdup(mesg->slot[u].name))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message slot name") - } /* end for */ /* Set return value */ ret_value = dest; done: if(NULL == ret_value) { - if(dest && NULL == _dest) { - if(dest->slot) { - for(u = 0; u < mesg->nused; u++) { - if(dest->slot[u].name != NULL && dest->slot[u].name != mesg->slot[u].name) - dest->slot[u].name = (char *)H5MM_xfree(dest->slot[u].name); - } /* end for */ - dest->slot = (H5O_efl_entry_t *)H5MM_xfree(dest->slot); - } /* end if */ - dest = (H5O_efl_t *)H5MM_xfree(dest); + if(slot_allocated) { + for(u = 0; u < dest->nused; u++) + if(dest->slot[u].name != NULL && dest->slot[u].name != mesg->slot[u].name) + dest->slot[u].name = (char *)H5MM_xfree(dest->slot[u].name); + dest->slot = (H5O_efl_entry_t *)H5MM_xfree(dest->slot); } /* end if */ + if(NULL == _dest) + dest = (H5O_efl_t *)H5MM_xfree(dest); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -389,8 +372,10 @@ H5O_efl_reset(void *_mesg) /* reset */ if(mesg->slot) { - for(u = 0; u < mesg->nused; u++) + for(u = 0; u < mesg->nused; u++) { mesg->slot[u].name = (char *)H5MM_xfree(mesg->slot[u].name); + mesg->slot[u].name_offset = 0; + } /* end for */ mesg->slot = (H5O_efl_entry_t *)H5MM_xfree(mesg->slot); } /* end if */ mesg->heap_addr = HADDR_UNDEF; @@ -460,9 +445,9 @@ H5O_efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_ds { H5O_efl_t *efl_src = (H5O_efl_t *) mesg_src; H5O_efl_t *efl_dst = NULL; - H5HL_t *heap = NULL; /* Pointer to local heap for EFL file names */ + H5HL_t *heap = NULL; /* Pointer to local heap for EFL file names */ size_t idx, size, name_offset, heap_size; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, H5AC__COPIED_TAG, NULL) diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 3bd1e84..ebcb5d3 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -20,7 +20,8 @@ * uninitialized data points of a dataset. */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Dprivate.h" /* Datasets */ @@ -188,7 +189,7 @@ H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p) { H5O_fill_t *fill = NULL; - void *ret_value; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -301,8 +302,8 @@ static void * H5O_fill_old_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p) { - H5O_fill_t *fill = NULL; /* Decoded fill value message */ - void *ret_value; /* Return value */ + H5O_fill_t *fill = NULL; /* Decoded fill value message */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -494,7 +495,7 @@ H5O_fill_copy(const void *_src, void *_dst) { const H5O_fill_t *src = (const H5O_fill_t *)_src; H5O_fill_t *dst = (H5O_fill_t *)_dst; - void *ret_value; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -611,7 +612,7 @@ static size_t H5O_fill_new_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) { const H5O_fill_t *fill = (const H5O_fill_t *)_fill; - size_t ret_value; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index 180ebe8..1712857 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -24,7 +24,8 @@ *------------------------------------------------------------------------- */ -#define H5O_PACKAGE /* suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -89,7 +90,7 @@ H5O_fsinfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED * { H5O_fsinfo_t *fsinfo = NULL; /* free-space manager info */ H5FD_mem_t type; /* Memory type for iteration */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -183,9 +184,9 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c static void * H5O_fsinfo_copy(const void *_mesg, void *_dest) { - const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg; - H5O_fsinfo_t *dest = (H5O_fsinfo_t *) _dest; - void *ret_value; /* Return value */ + const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg; + H5O_fsinfo_t *dest = (H5O_fsinfo_t *) _dest; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -224,7 +225,7 @@ H5O_fsinfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const voi { const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg; size_t fs_addr_size = 0; - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index 5519021..9cd0dc1 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -24,7 +24,8 @@ *------------------------------------------------------------------------- */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -100,7 +101,7 @@ H5O_ginfo_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5 { H5O_ginfo_t *ginfo = NULL; /* Pointer to group information message */ unsigned char flags; /* Flags for encoding group info */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -224,7 +225,7 @@ H5O_ginfo_copy(const void *_mesg, void *_dest) { const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)_mesg; H5O_ginfo_t *dest = (H5O_ginfo_t *)_dest; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -265,7 +266,7 @@ static size_t H5O_ginfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)_mesg; - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 8821694..6f4274f 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -19,8 +19,9 @@ * Purpose: Messages related to data layout. */ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5D_FRIEND /*suppress error about including H5Dpkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Dpkg.h" /* Dataset functions */ @@ -101,7 +102,7 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED * { H5O_layout_t *mesg = NULL; unsigned u; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -190,7 +191,7 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED * } /* end if */ else { /* Layout class */ - mesg->type = (H5D_layout_t)*p++; + mesg->type = mesg->storage.type = (H5D_layout_t)*p++; /* Interpret the rest of the message according to the layout class */ switch(mesg->type) { @@ -375,7 +376,7 @@ H5O_layout_copy(const void *_mesg, void *_dest) { const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; H5O_layout_t *dest = (H5O_layout_t *) _dest; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -389,19 +390,38 @@ H5O_layout_copy(const void *_mesg, void *_dest) /* copy */ *dest = *mesg; - /* Deep copy the buffer for compact datasets also */ - if(mesg->type == H5D_COMPACT && mesg->storage.u.compact.size > 0) { - /* Allocate memory for the raw data */ - if(NULL == (dest->storage.u.compact.buf = H5MM_malloc(dest->storage.u.compact.size))) - HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset") + /* Special actions for each type of layout */ + switch(mesg->type) { + case H5D_COMPACT: + /* Deep copy the buffer for compact datasets also */ + if(mesg->storage.u.compact.size > 0) { + /* Sanity check */ + HDassert(mesg->storage.u.compact.buf); - /* Copy over the raw data */ - HDmemcpy(dest->storage.u.compact.buf, mesg->storage.u.compact.buf, dest->storage.u.compact.size); - } /* end if */ + /* Allocate memory for the raw data */ + if(NULL == (dest->storage.u.compact.buf = H5MM_malloc(dest->storage.u.compact.size))) + HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset") - /* Reset the pointer of the chunked storage index but not the address */ - if(dest->type == H5D_CHUNKED && dest->storage.u.chunk.ops) - H5D_chunk_idx_reset(&dest->storage.u.chunk, FALSE); + /* Copy over the raw data */ + HDmemcpy(dest->storage.u.compact.buf, mesg->storage.u.compact.buf, dest->storage.u.compact.size); + } /* end if */ + break; + + case H5D_CONTIGUOUS: + /* Nothing required */ + break; + + case H5D_CHUNKED: + /* Reset the pointer of the chunked storage index but not the address */ + if(dest->storage.u.chunk.ops) + H5D_chunk_idx_reset(&dest->storage.u.chunk, FALSE); + break; + + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: + default: + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, NULL, "Invalid layout class") + } /* end switch */ /* Set return value */ ret_value = dest; @@ -435,7 +455,7 @@ static size_t H5O_layout_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; - size_t ret_value; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -593,8 +613,8 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */ H5O_layout_t *layout_src = (H5O_layout_t *) mesg_src; H5O_layout_t *layout_dst = NULL; - hbool_t copied = FALSE; /* Whether the data was copied */ - void *ret_value; /* Return value */ + hbool_t copied = FALSE; /* Whether the data was copied */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -686,7 +706,7 @@ H5O_layout_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const vo FILE * stream, int indent, int fwidth) { const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; - unsigned u; + size_t u; FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -709,7 +729,7 @@ H5O_layout_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const vo "Number of dimensions:", (unsigned long)(mesg->u.chunk.ndims)); HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Size:"); - for(u = 0; u < mesg->u.chunk.ndims; u++) + for(u = 0; u < (size_t)mesg->u.chunk.ndims; u++) HDfprintf(stream, "%s%lu", u ? ", " : "", (unsigned long)(mesg->u.chunk.dim[u])); HDfprintf(stream, "}\n"); diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index a0b6e4a..62e63d4 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -24,9 +24,10 @@ *------------------------------------------------------------------------- */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ -#define H5L_PACKAGE /*suppress error about including H5Lpkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5L_FRIEND /*suppress error about including H5Lpkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -119,7 +120,7 @@ H5O_linfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *o { H5O_linfo_t *linfo = NULL; /* Link info */ unsigned char index_flags; /* Flags for encoding link index info */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -249,7 +250,7 @@ H5O_linfo_copy(const void *_mesg, void *_dest) { const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg; H5O_linfo_t *dest = (H5O_linfo_t *) _dest; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -289,7 +290,7 @@ static size_t H5O_linfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg; - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -383,10 +384,10 @@ H5O_linfo_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *native_src, H5F_t *fil hbool_t H5_ATTR_UNUSED *recompute_size, unsigned H5_ATTR_UNUSED *mesg_flags, H5O_copy_t *cpy_info, void *_udata, hid_t dxpl_id) { - H5O_linfo_t *linfo_src = (H5O_linfo_t *) native_src; - H5O_linfo_t *linfo_dst = NULL; + H5O_linfo_t *linfo_src = (H5O_linfo_t *) native_src; + H5O_linfo_t *linfo_dst = NULL; H5G_copy_file_ud_t *udata = (H5G_copy_file_ud_t *) _udata; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, H5AC__COPIED_TAG, NULL) diff --git a/src/H5Olink.c b/src/H5Olink.c index 7e70196..fd4ee88 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -24,9 +24,10 @@ *------------------------------------------------------------------------- */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ -#define H5L_PACKAGE /*suppress error about including H5Lpkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5L_FRIEND /*suppress error about including H5Lpkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -124,7 +125,7 @@ H5O_link_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *op H5O_link_t *lnk = NULL; /* Pointer to link message */ size_t len = 0; /* Length of a string in the message */ unsigned char link_flags; /* Flags for encoding link info */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -411,7 +412,7 @@ H5O_link_copy(const void *_mesg, void *_dest) { const H5O_link_t *lnk = (const H5O_link_t *) _mesg; H5O_link_t *dest = (H5O_link_t *) _dest; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -478,9 +479,9 @@ static size_t H5O_link_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_link_t *lnk = (const H5O_link_t *)_mesg; - uint64_t name_len; /* Length of name */ - size_t name_size; /* Size of encoded name length */ - size_t ret_value; /* Return value */ + uint64_t name_len; /* Length of name */ + size_t name_size; /* Size of encoded name length */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -727,7 +728,7 @@ H5O_link_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *native_src, H5F_t H5_AT H5O_copy_t H5_ATTR_UNUSED *cpy_info, void H5_ATTR_UNUSED *udata, hid_t H5_ATTR_UNUSED dxpl_id) { H5O_link_t *link_src = (H5O_link_t *)native_src; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Omessage.c b/src/H5Omessage.c index c2756ea..d42896c 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -28,7 +28,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + /***********/ /* Headers */ @@ -465,7 +466,7 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg, hid_t dxpl_id) { H5O_t *oh = NULL; /* Object header to use */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, loc->addr, NULL) @@ -652,7 +653,7 @@ void * H5O_msg_free(unsigned type_id, void *mesg) { const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - void * ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -749,7 +750,7 @@ void * H5O_msg_copy(unsigned type_id, const void *mesg, void *dst) { const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -789,7 +790,7 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) H5O_t *oh = NULL; /* Object header to operate on */ const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ unsigned msg_count; /* Message count */ - int ret_value; /* Return value */ + int ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -836,7 +837,7 @@ unsigned H5O_msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type) { unsigned u; /* Local index variable */ - unsigned ret_value; /* Return value */ + unsigned ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -875,7 +876,7 @@ htri_t H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) { H5O_t *oh = NULL; /* Object header for location */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, loc->addr, FAIL) @@ -966,8 +967,8 @@ H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj hid_t dxpl_id) { H5O_t *oh = NULL; /* Pointer to actual object header */ - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1018,8 +1019,8 @@ H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence, H5O_operator_t op, void *op_data, hbool_t adj_link, hid_t dxpl_id) { H5O_t *oh = NULL; /* Pointer to actual object header */ - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value; /* Return value */ + const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1210,7 +1211,7 @@ H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id, { H5O_t *oh = NULL; /* Pointer to actual object header */ const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1359,7 +1360,7 @@ H5O_msg_raw_size(const H5F_t *f, unsigned type_id, hbool_t disable_shared, const void *mesg) { const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) @@ -1404,7 +1405,7 @@ H5O_msg_size_f(const H5F_t *f, hid_t ocpl_id, unsigned type_id, const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ H5P_genplist_t *ocpl; /* Object Creation Property list */ uint8_t oh_flags; /* Object header status flags */ - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) @@ -1466,7 +1467,7 @@ H5O_msg_size_oh(const H5F_t *f, const H5O_t *oh, unsigned type_id, const void *mesg, size_t extra_raw) { const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) @@ -1517,7 +1518,7 @@ htri_t H5O_msg_can_share(unsigned type_id, const void *mesg) { const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - htri_t ret_value; + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1564,7 +1565,7 @@ htri_t H5O_msg_can_share_in_ohdr(unsigned type_id) { const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - htri_t ret_value; + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1602,7 +1603,7 @@ htri_t H5O_msg_is_shared(unsigned type_id, const void *mesg) { const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - htri_t ret_value; + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1816,8 +1817,8 @@ H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id, const unsigned char *buf) { const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - void *ret_value; /* Return value */ unsigned ioflags = 0; /* Flags for decode routine */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1859,7 +1860,7 @@ H5O_msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, void *native_src, H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id) { - void *ret_value; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2047,7 +2048,7 @@ H5O_msg_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id, const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_NOAPI(FAIL) /* check args */ HDassert(f); @@ -2276,7 +2277,7 @@ H5O_msg_get_chunkno(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ H5O_mesg_t *idx_msg; /* Pointer to message to modify */ unsigned idx; /* Index of message to modify */ - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Omodule.h b/src/H5Omodule.h new file mode 100644 index 0000000..a8f1301 --- /dev/null +++ b/src/H5Omodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5O package. Including this header means that the source file + * is part of the H5O package. + */ +#ifndef _H5Omodule_H +#define _H5Omodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5O_MODULE +#define H5_MY_PKG H5O +#define H5_MY_PKG_ERR H5E_OHDR +#define H5_MY_PKG_INIT YES + +#endif /* _H5Omodule_H */ + diff --git a/src/H5Omtime.c b/src/H5Omtime.c index 63ba152..622d57d 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -19,7 +19,8 @@ * Purpose: The object modification time message. */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -126,8 +127,8 @@ H5O_mtime_new_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p) { time_t *mesg; - uint32_t tmp_time; /* Temporary copy of the time */ - void *ret_value; /* Return value */ + uint32_t tmp_time; /* Temporary copy of the time */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -184,7 +185,7 @@ H5O_mtime_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5 time_t *mesg, the_time; int i; struct tm tm; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -352,7 +353,7 @@ H5O_mtime_copy(const void *_mesg, void *_dest) { const time_t *mesg = (const time_t *) _mesg; time_t *dest = (time_t *) _dest; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Oname.c b/src/H5Oname.c index 2cd9e72..6c4f76f 100644 --- a/src/H5Oname.c +++ b/src/H5Oname.c @@ -24,7 +24,8 @@ *------------------------------------------------------------------------- */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -88,7 +89,7 @@ H5O_name_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p) { H5O_name_t *mesg; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -170,9 +171,9 @@ H5O_name_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, static void * H5O_name_copy(const void *_mesg, void *_dest) { - const H5O_name_t *mesg = (const H5O_name_t *) _mesg; - H5O_name_t *dest = (H5O_name_t *) _dest; - void *ret_value; /* Return value */ + const H5O_name_t *mesg = (const H5O_name_t *) _mesg; + H5O_name_t *dest = (H5O_name_t *) _dest; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -223,7 +224,7 @@ static size_t H5O_name_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_name_t *mesg = (const H5O_name_t *) _mesg; - size_t ret_value; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Onull.c b/src/H5Onull.c index a6c6524..258f695 100644 --- a/src/H5Onull.c +++ b/src/H5Onull.c @@ -24,7 +24,8 @@ *------------------------------------------------------------------------- */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Opkg.h" /* Object headers */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 1f8a1cd..ddcdb10 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -13,7 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5O_PACKAGE +#if !(defined H5O_FRIEND || defined H5O_MODULE) #error "Do not include this file outside the H5O package!" #endif diff --git a/src/H5Opline.c b/src/H5Opline.c index b79a73c..95a82b5 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -20,8 +20,9 @@ * Purpose: Data filter pipeline message. */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ +#define H5Z_FRIEND /*suppress error about including H5Zpkg */ + #include "H5private.h" /* Generic Functions */ #include "H5Dprivate.h" /* Datasets */ @@ -116,7 +117,7 @@ H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5 H5Z_filter_info_t *filter; /* Filter to decode */ size_t name_length; /* Length of filter name */ size_t i; /* Local index variable */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -344,7 +345,7 @@ H5O_pline_copy(const void *_src, void *_dst/*out*/) const H5O_pline_t *src = (const H5O_pline_t *)_src; /* Source pipeline message */ H5O_pline_t *dst = (H5O_pline_t *)_dst; /* Destination pipeline message */ size_t i; /* Local index variable */ - H5O_pline_t *ret_value; /* Return value */ + H5O_pline_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -434,7 +435,7 @@ H5O_pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) { const H5O_pline_t *pline = (const H5O_pline_t*)mesg; /* Pipeline message */ size_t i; /* Local index variable */ - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index dbe74f7..b6667e9 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -109,11 +109,11 @@ typedef struct H5O_t H5O_t; #define H5O_CPY_MCDT_SEARCH_CB_NAME "committed dtype list search" /* Callback function when the search for a matching committed datatype is complete */ /* If the module using this macro is allowed access to the private variables, access them directly */ -#ifdef H5O_PACKAGE +#ifdef H5O_MODULE #define H5O_OH_GET_ADDR(O) ((O)->chunk[0].addr) -#else /* H5O_PACKAGE */ +#else /* H5O_MODULE */ #define H5O_OH_GET_ADDR(O) (H5O_get_oh_addr(O)) -#endif /* H5O_PACKAGE */ +#endif /* H5O_MODULE */ /* Set the fields in a shared message structure */ #define H5O_UPDATE_SHARED(SH_MESG, SH_TYPE, F, MSG_TYPE, CRT_IDX, OH_ADDR) \ diff --git a/src/H5Orefcount.c b/src/H5Orefcount.c index f5c7e25..ff7dfee 100644 --- a/src/H5Orefcount.c +++ b/src/H5Orefcount.c @@ -24,7 +24,8 @@ *------------------------------------------------------------------------- */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -93,8 +94,8 @@ static void * H5O_refcount_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p) { - H5O_refcount_t *refcount = NULL; /* Reference count */ - void *ret_value; /* Return value */ + H5O_refcount_t *refcount = NULL; /* Reference count */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -177,9 +178,9 @@ H5O_refcount_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shar static void * H5O_refcount_copy(const void *_mesg, void *_dest) { - const H5O_refcount_t *refcount = (const H5O_refcount_t *)_mesg; - H5O_refcount_t *dest = (H5O_refcount_t *) _dest; - void *ret_value; /* Return value */ + const H5O_refcount_t *refcount = (const H5O_refcount_t *)_mesg; + H5O_refcount_t *dest = (H5O_refcount_t *) _dest; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 8d357c2..28021de 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -13,8 +13,8 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5S_PACKAGE /*prevent warning from including H5Spkg.h */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ +#define H5S_FRIEND /*prevent warning from including H5Spkg.h */ #include "H5private.h" /* Generic Functions */ #include "H5Dprivate.h" /* Datasets */ @@ -115,9 +115,9 @@ H5O_sdspace_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p) { H5S_extent_t *sdim = NULL;/* New extent dimensionality structure */ - void *ret_value; - unsigned i; /* local counting variable */ unsigned flags, version; + unsigned i; /* Local counting variable */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -302,7 +302,7 @@ H5O_sdspace_copy(const void *_mesg, void *_dest) { const H5S_extent_t *mesg = (const H5S_extent_t *)_mesg; H5S_extent_t *dest = (H5S_extent_t *)_dest; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -312,7 +312,7 @@ H5O_sdspace_copy(const void *_mesg, void *_dest) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy extent information */ - if(H5S_extent_copy(dest, mesg, TRUE) < 0) + if(H5S_extent_copy_real(dest, mesg, TRUE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent") /* Set return value */ @@ -352,7 +352,7 @@ static size_t H5O_sdspace_size(const H5F_t *f, const void *_mesg) { const H5S_extent_t *space = (const H5S_extent_t *)_mesg; - size_t ret_value; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -467,7 +467,7 @@ H5O_sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "dataspace extent allocation failed") /* Create a copy of the dataspace extent */ - if(H5S_extent_copy(udata->src_space_extent, src_space_extent, TRUE) < 0) + if(H5S_extent_copy_real(udata->src_space_extent, src_space_extent, TRUE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent") } /* end if */ diff --git a/src/H5Oshared.c b/src/H5Oshared.c index c5c088a..25baa88 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -30,7 +30,7 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ /***********/ @@ -313,7 +313,7 @@ H5O_shared_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned *ioflags, { H5O_shared_t sh_mesg; /* Shared message info */ unsigned version; /* Shared message version */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -477,7 +477,7 @@ H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src) size_t H5O_shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg) { - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Oshared.h b/src/H5Oshared.h index 2ac2a98..e8d620a 100644 --- a/src/H5Oshared.h +++ b/src/H5Oshared.h @@ -51,7 +51,7 @@ static H5_INLINE void * H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, const uint8_t *p) { - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -166,7 +166,7 @@ static H5_INLINE size_t H5O_SHARED_SIZE(const H5F_t *f, hbool_t disable_shared, const void *_mesg) { const H5O_shared_t *sh_mesg = (const H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */ - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -324,7 +324,7 @@ H5O_SHARED_COPY_FILE(H5F_t *file_src, void *_native_src, H5F_t *file_dst, void *udata, hid_t dxpl_id) { void *dst_mesg = NULL; /* Destination message */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Oshmesg.c b/src/H5Oshmesg.c index deb10ab..a506ce2 100644 --- a/src/H5Oshmesg.c +++ b/src/H5Oshmesg.c @@ -21,7 +21,8 @@ * information in the superblock extension. */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -79,8 +80,8 @@ static void * H5O_shmesg_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p) { - H5O_shmesg_table_t *mesg; /* Native message */ - void *ret_value; /* Return value */ + H5O_shmesg_table_t *mesg; /* Native message */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -156,7 +157,7 @@ H5O_shmesg_copy(const void *_mesg, void *_dest) { const H5O_shmesg_table_t *mesg = (const H5O_shmesg_table_t *)_mesg; H5O_shmesg_table_t *dest = (H5O_shmesg_table_t *)_dest; - void *ret_value; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -194,7 +195,7 @@ done: static size_t H5O_shmesg_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { - size_t ret_value; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 133a3e2..bb39e58 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -24,8 +24,9 @@ *------------------------------------------------------------------------- */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -101,7 +102,7 @@ H5O_stab_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *op unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p) { H5O_stab_t *stab = NULL; - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -180,9 +181,9 @@ H5O_stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con static void * H5O_stab_copy(const void *_mesg, void *_dest) { - const H5O_stab_t *stab = (const H5O_stab_t *) _mesg; - H5O_stab_t *dest = (H5O_stab_t *) _dest; - void *ret_value; /* Return value */ + const H5O_stab_t *stab = (const H5O_stab_t *) _mesg; + H5O_stab_t *dest = (H5O_stab_t *) _dest; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -222,7 +223,7 @@ done: static size_t H5O_stab_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -314,8 +315,8 @@ H5O_stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst, H5O_stab_t *stab_src = (H5O_stab_t *) native_src; H5O_stab_t *stab_dst = NULL; H5G_copy_file_ud_t *udata = (H5G_copy_file_ud_t *)_udata; - size_t size_hint; /* Local heap initial size */ - void *ret_value; /* Return value */ + size_t size_hint; /* Local heap initial size */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Otest.c b/src/H5Otest.c index e7312ee..b5f728a 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -23,8 +23,8 @@ /* Module Setup */ /****************/ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5A_FRIEND /*suppress error about including H5Apkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ #define H5O_TESTING /*suppress warning about H5O testing funcs*/ @@ -99,7 +99,7 @@ H5O_is_attr_dense_test(hid_t oid) H5O_t *oh = NULL; /* Object header */ H5O_ainfo_t ainfo; /* Attribute information for object */ H5O_loc_t *loc; /* Pointer to object's location */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -159,12 +159,12 @@ htri_t H5O_is_attr_empty_test(hid_t oid) { H5O_t *oh = NULL; /* Object header */ - H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ + H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ H5O_ainfo_t ainfo; /* Attribute information for object */ htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ - H5O_loc_t *loc; /* Pointer to object's location */ + H5O_loc_t *loc; /* Pointer to object's location */ hsize_t nattrs; /* Number of attributes */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Ounknown.c b/src/H5Ounknown.c index 548f74d..546e839 100644 --- a/src/H5Ounknown.c +++ b/src/H5Ounknown.c @@ -24,7 +24,8 @@ *------------------------------------------------------------------------- */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -22,10 +22,7 @@ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5P__init_pub_interface +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -62,6 +59,9 @@ typedef struct { /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -74,51 +74,6 @@ typedef struct { /*-------------------------------------------------------------------------- -NAME - H5P__init_pub_interface -- Initialize interface-specific information -USAGE - herr_t H5P__init_pub_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5P_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5P__init_pub_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5P_init()) -} /* H5P__init_pub_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5P__term_pub_interface -- Terminate interface -USAGE - herr_t H5P__term_pub_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5P__term_pub_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5P__term_pub_interface() */ - - -/*-------------------------------------------------------------------------- NAME H5Pcopy PURPOSE @@ -1395,7 +1350,7 @@ H5Premove(hid_t plist_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name"); /* Create the new property list class */ - if((ret_value = H5P_remove(plist_id,plist,name)) < 0) + if((ret_value = H5P_remove(plist, name)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property"); done: @@ -16,8 +16,7 @@ /* Module Setup */ /****************/ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5PL__init_interface +#include "H5PLmodule.h" /* This source code file is part of the H5PL module */ /***********/ @@ -52,7 +51,6 @@ * If you do not do this, people will be unable to incorporate our * source code into their own CMake builds if they define UNICODE. */ - #ifdef H5_HAVE_WIN32_API #define H5PL_PATH_SEPARATOR ";" @@ -103,6 +101,7 @@ typedef const void *(*H5PL_get_plugin_info_t)(void); /* Special symbol to indicate no plugin loading */ #define H5PL_NO_PLUGIN "::" + /******************/ /* Local Typedefs */ /******************/ @@ -130,6 +129,9 @@ static herr_t H5PL__close(H5PL_HANDLE handle); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -153,36 +155,94 @@ static hbool_t H5PL_path_found_g = FALSE; /* Enable all plugin libraries */ static unsigned int H5PL_plugin_g = H5PL_ALL_PLUGIN; + /*-------------------------------------------------------------------------- NAME - H5PL__init_interface -- Initialize interface-specific information + H5PL__init_package -- Initialize interface-specific information USAGE - herr_t H5PL__init_interface() + herr_t H5PL__init_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION Initializes any interface-specific data or routines. --------------------------------------------------------------------------*/ -static herr_t -H5PL__init_interface(void) +herr_t +H5PL__init_package(void) { char *preload_path; - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Retrieve pathnames from HDF5_PLUGIN_PRELOAD if the user sets it * to tell the library to load plugin libraries without search. */ - if(NULL != (preload_path = HDgetenv("HDF5_PLUGIN_PRELOAD"))) { + if(NULL != (preload_path = HDgetenv("HDF5_PLUGIN_PRELOAD"))) /* Special symbal "::" means no plugin during data reading. */ if(!HDstrcmp(preload_path, H5PL_NO_PLUGIN)) H5PL_plugin_g = 0; - } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5PL__init_interface() */ +} /* end H5PL__init_package() */ + + +/*------------------------------------------------------------------------- + * Function: H5PL_term_package + * + * Purpose: Terminate the H5PL interface: release all memory, reset all + * global variables to initial values. This only happens if all + * types have been destroyed from other interfaces. + * + * Return: Success: Positive if any action was taken that might + * affect some other interface; zero otherwise. + * Failure: Negative. + * + * Programmer: Raymond Lu + * 20 February 2013 + * + *------------------------------------------------------------------------- + */ +int +H5PL_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + size_t u; /* Local index variable */ + + /* Close opened dynamic libraries */ + if(H5PL_table_g) { + for(u = 0; u < H5PL_table_used_g; u++) + H5PL__close((H5PL_table_g[u]).handle); + + /* Free the table of dynamic libraries */ + H5PL_table_g = (H5PL_table_t *)H5MM_xfree(H5PL_table_g); + H5PL_table_used_g = H5PL_table_alloc_g = 0; + + n++; + } /* end if */ + + /* Free the table of search paths */ + if(H5PL_num_paths_g > 0) { + for(u = 0; u < H5PL_num_paths_g; u++) + if(H5PL_path_table_g[u]) + H5PL_path_table_g[u] = (char *)H5MM_xfree(H5PL_path_table_g[u]); + H5PL_num_paths_g = 0; + H5PL_path_found_g = FALSE; + + n++; + } /* end if */ + + /* Mark the interface as uninitialized */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5PL_term_package() */ /*------------------------------------------------------------------------- @@ -209,21 +269,24 @@ H5PLset_loading_state(unsigned int plugin_type) { char *preload_path; herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API(FAIL) H5TRACE1("e", "Iu", plugin_type); + /* change the bit value of the requested plugin type(s) */ H5PL_plugin_g = plugin_type; + /* check if special ENV variable is set and disable all plugin types */ - if(NULL != (preload_path = HDgetenv("HDF5_PLUGIN_PRELOAD"))) { + if(NULL != (preload_path = HDgetenv("HDF5_PLUGIN_PRELOAD"))) /* Special symbol "::" means no plugin during data reading. */ if(!HDstrcmp(preload_path, H5PL_NO_PLUGIN)) H5PL_plugin_g = 0; - } + done: FUNC_LEAVE_API(ret_value) } /* end H5PLset_loading_state() */ - + /*------------------------------------------------------------------------- * Function: H5PLget_loading_state * @@ -240,66 +303,17 @@ herr_t H5PLget_loading_state(unsigned int *plugin_type) { herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API(FAIL) H5TRACE1("e", "*Iu", plugin_type); if(plugin_type) *plugin_type = H5PL_plugin_g; - done: + +done: FUNC_LEAVE_API(ret_value) } /* end H5PLget_loading_state() */ - - -/*------------------------------------------------------------------------- - * Function: H5PL_term_interface - * - * Purpose: Terminate the H5PL interface: release all memory, reset all - * global variables to initial values. This only happens if all - * types have been destroyed from other interfaces. - * - * Return: Success: Positive if any action was taken that might - * affect some other interface; zero otherwise. - * - * Failure: Negative. - * - * Programmer: Raymond Lu - * 20 February 2013 - * - *------------------------------------------------------------------------- - */ -int -H5PL_term_interface(void) -{ - int i = 0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if(H5_interface_initialize_g) { - size_t u; /* Local index variable */ - - /* Close opened dynamic libraries */ - for(u = 0; u < H5PL_table_used_g; u++) - H5PL__close((H5PL_table_g[u]).handle); - - /* Free the table of dynamic libraries */ - H5PL_table_g = (H5PL_table_t *)H5MM_xfree(H5PL_table_g); - H5PL_table_used_g = H5PL_table_alloc_g = 0; - - /* Free the table of search paths */ - for(u = 0; u < H5PL_num_paths_g; u++) - if(H5PL_path_table_g[u]) - H5PL_path_table_g[u] = (char *)H5MM_xfree(H5PL_path_table_g[u]); - H5PL_num_paths_g = 0; - H5PL_path_found_g = FALSE; - - H5_interface_initialize_g = 0; - i = 1; - } /* end if */ - - FUNC_LEAVE_NOAPI(i) -} /* end H5PL_term_interface() */ - /*------------------------------------------------------------------------- * Function: H5PL_load @@ -324,14 +338,17 @@ H5PL_load(H5PL_type_t type, int id) FUNC_ENTER_NOAPI(NULL) - switch (type) { - case H5PL_TYPE_FILTER: - if((H5PL_plugin_g & H5PL_FILTER_PLUGIN) == 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin filter '%d' is not available", id) - break; - default: - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin '%d' is not valid", id) - } + switch(type) { + case H5PL_TYPE_FILTER: + if((H5PL_plugin_g & H5PL_FILTER_PLUGIN) == 0) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin filter '%d' is not available", id) + break; + + case H5PL_TYPE_ERROR: + case H5PL_TYPE_NONE: + default: + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin '%d' is not valid", id) + } /* end switch */ /* Initialize the location paths for dynamic libraries, if they aren't * already set up. @@ -724,3 +741,4 @@ H5PL__close(H5PL_HANDLE handle) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5PL__close() */ + diff --git a/src/H5PLmodule.h b/src/H5PLmodule.h new file mode 100644 index 0000000..0339737 --- /dev/null +++ b/src/H5PLmodule.h @@ -0,0 +1,36 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5PL package. Including this header means that the source file + * is part of the H5PL package. + */ +#ifndef _H5PLmodule_H +#define _H5PLmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5PL_MODULE +#define H5_MY_PKG H5PL +#define H5_MY_PKG_ERR H5E_PLUGIN +#define H5_MY_PKG_INIT YES + +#endif /* _H5PLmodule_H */ + + diff --git a/src/H5Pacpl.c b/src/H5Pacpl.c index 0a0641c..bfed332 100644 --- a/src/H5Pacpl.c +++ b/src/H5Pacpl.c @@ -27,7 +27,9 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ + /***********/ /* Headers */ diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index 93d16bb..dd9c24d 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -27,7 +27,8 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -49,13 +50,13 @@ /* Definitions for size of raw data chunk cache(slots) */ #define H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE sizeof(size_t) #define H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF H5D_CHUNK_CACHE_NSLOTS_DEFAULT -#define H5D_ACS_DATA_CACHE_NUM_SLOTS_ENC H5P__encode_size_t -#define H5D_ACS_DATA_CACHE_NUM_SLOTS_DEC H5P__decode_size_t +#define H5D_ACS_DATA_CACHE_NUM_SLOTS_ENC H5P__encode_chunk_cache_nslots +#define H5D_ACS_DATA_CACHE_NUM_SLOTS_DEC H5P__decode_chunk_cache_nslots /* Definition for size of raw data chunk cache(bytes) */ #define H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE sizeof(size_t) #define H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF H5D_CHUNK_CACHE_NBYTES_DEFAULT -#define H5D_ACS_DATA_CACHE_BYTE_SIZE_ENC H5P__encode_size_t -#define H5D_ACS_DATA_CACHE_BYTE_SIZE_DEC H5P__decode_size_t +#define H5D_ACS_DATA_CACHE_BYTE_SIZE_ENC H5P__encode_chunk_cache_nbytes +#define H5D_ACS_DATA_CACHE_BYTE_SIZE_DEC H5P__decode_chunk_cache_nbytes /* Definition for preemption read chunks first */ #define H5D_ACS_PREEMPT_READ_CHUNKS_SIZE sizeof(double) #define H5D_ACS_PREEMPT_READ_CHUNKS_DEF H5D_CHUNK_CACHE_W0_DEFAULT @@ -78,6 +79,12 @@ /* Property class callbacks */ static herr_t H5P__dacc_reg_prop(H5P_genclass_t *pclass); +static herr_t H5P__encode_chunk_cache_nslots(const void *value, void **_pp, + size_t *size); +static herr_t H5P__decode_chunk_cache_nslots(const void **_pp, void *_value); +static herr_t H5P__encode_chunk_cache_nbytes(const void *value, void **_pp, + size_t *size); +static herr_t H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value); /*********************/ @@ -282,5 +289,225 @@ H5Pget_chunk_cache(hid_t dapl_id, size_t *rdcc_nslots, size_t *rdcc_nbytes, doub done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_chunk_cache() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__encode_chunk_cache_nslots + * + * Purpose: Encode the rdcc_nslots parameter to a serialized + * property list. Similar to H5P__encode_size_t except + * the value of 255 for the enc_size field is reserved to + * indicate H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF, in which + * nothing further is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Wednesday, January 23, 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__encode_chunk_cache_nslots(const void *value, void **_pp, size_t *size) +{ + uint64_t enc_value; /* Property value to encode */ + uint8_t **pp = (uint8_t **)_pp; + unsigned enc_size; /* Size of encoded property */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + HDassert(size); + + /* Determine if this is the default value, in which case only encode + * enc_size (as 255). Also set size needed for encoding. */ + if(*(const size_t *)value == H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF) { + enc_size = 0; + *size += 1; + } /* end if */ + else { + enc_value = (uint64_t)*(const size_t *)value; + enc_size = H5VM_limit_enc_size(enc_value); + HDassert(enc_size > 0); + *size += (1 + enc_size); + } /* end else */ + + HDassert(enc_size < 256); + + if(NULL != *pp) { + /* Encode the size */ + *(*pp)++ = (uint8_t)enc_size; + + /* Encode the value if necessary */ + if(enc_size != 0) { + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + } /* end if */ + } /* end if */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__encode_chunk_cache_nslots() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__decode_chunk_cache_nslots + * + * Purpose: Decode the rdcc_nslots parameter from a serialized + * property list. Similar to H5P__decode_size_t except + * the value of 255 for the enc_size field is reserved to + * indicate H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF, in which + * nothing further needs to be decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Wednesday, January 23, 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__decode_chunk_cache_nslots(const void **_pp, void *_value) +{ + size_t *value = (size_t *)_value; /* Property value to return */ + const uint8_t **pp = (const uint8_t **)_pp; + uint64_t enc_value; /* Decoded property value */ + unsigned enc_size; /* Size of encoded property */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity check */ + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + HDassert(pp); + HDassert(*pp); + HDassert(value); + + /* Decode the size */ + enc_size = *(*pp)++; + HDassert(enc_size < 256); + + /* Determine if enc_size indicates that this is the default value, in which + * case set value to H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF and return */ + if(enc_size == 0) + *value = H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF; + else { + /* Decode the value */ + UINT64DECODE_VAR(*pp, enc_value, enc_size); + H5_CHECKED_ASSIGN(*value, uint64_t, enc_value, size_t); + } /* end else */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__decode_chunk_cache_nslots() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__encode_chunk_cache_nbytes + * + * Purpose: Encode the rdcc_nbytes parameter to a serialized + * property list. Similar to H5P__encode_size_t except + * the value of 255 for the enc_size field is reserved to + * indicate H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF, in which + * nothing further is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Wednesday, January 23, 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__encode_chunk_cache_nbytes(const void *value, void **_pp, size_t *size) +{ + uint64_t enc_value; /* Property value to encode */ + uint8_t **pp = (uint8_t **)_pp; + unsigned enc_size; /* Size of encoded property */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + HDassert(size); + + /* Determine if this is the default value, in which case only encode + * enc_size (as 255). Also set size needed for encoding. */ + if(*(const size_t *)value == H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF) { + enc_size = 0; + *size += 1; + } /* end if */ + else { + enc_value = (uint64_t)*(const size_t *)value; + enc_size = H5VM_limit_enc_size(enc_value); + HDassert(enc_size > 0); + *size += (1 + enc_size); + } /* end else */ + + HDassert(enc_size < 256); + + if(NULL != *pp) { + /* Encode the size */ + *(*pp)++ = (uint8_t)enc_size; + + /* Encode the value if necessary */ + if(enc_size != 0) { + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + } /* end if */ + } /* end if */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__encode_chunk_cache_nbytes() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__decode_chunk_cache_nbytes + * + * Purpose: Decode the rdcc_nbytes parameter from a serialized + * property list. Similar to H5P__decode_size_t except + * the value of 255 for the enc_size field is reserved to + * indicate H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF, in which + * nothing further needs to be decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Wednesday, January 23, 2013 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value) +{ + size_t *value = (size_t *)_value; /* Property value to return */ + const uint8_t **pp = (const uint8_t **)_pp; + uint64_t enc_value; /* Decoded property value */ + unsigned enc_size; /* Size of encoded property */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity check */ + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + HDassert(pp); + HDassert(*pp); + HDassert(value); + + /* Decode the size */ + enc_size = *(*pp)++; + HDassert(enc_size < 256); + + /* Determine if enc_size indicates that this is the default value, in which + * case set value to H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF and return */ + if(enc_size == 0) + *value = H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF; + else { + /* Decode the value */ + UINT64DECODE_VAR(*pp, enc_value, enc_size); + H5_CHECKED_ASSIGN(*value, uint64_t, enc_value, size_t); + } /* end else */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__decode_chunk_cache_nbytes() */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 9bf58e4..5c64ccb 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -27,8 +27,8 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -43,7 +43,7 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Ppkg.h" /* Property lists */ #include "H5Tprivate.h" /* Datatypes */ -#include "H5Zpkg.h" /* Data filters */ +#include "H5Zprivate.h" /* Data filters */ /****************/ @@ -77,16 +77,26 @@ /* Definitions for storage layout property */ #define H5D_CRT_LAYOUT_SIZE sizeof(H5O_layout_t) #define H5D_CRT_LAYOUT_DEF H5D_DEF_LAYOUT_CONTIG +#define H5D_CRT_LAYOUT_SET H5P__dcrt_layout_set +#define H5D_CRT_LAYOUT_GET H5P__dcrt_layout_get #define H5D_CRT_LAYOUT_ENC H5P__dcrt_layout_enc #define H5D_CRT_LAYOUT_DEC H5P__dcrt_layout_dec +#define H5D_CRT_LAYOUT_DEL H5P__dcrt_layout_del +#define H5D_CRT_LAYOUT_COPY H5P__dcrt_layout_copy #define H5D_CRT_LAYOUT_CMP H5P__dcrt_layout_cmp +#define H5D_CRT_LAYOUT_CLOSE H5P__dcrt_layout_close /* Definitions for fill value. size=0 means fill value will be 0 as * library default; size=-1 means fill value is undefined. */ #define H5D_CRT_FILL_VALUE_SIZE sizeof(H5O_fill_t) #define H5D_CRT_FILL_VALUE_DEF {{0, NULL, H5O_NULL_ID, {{0, HADDR_UNDEF}}}, H5O_FILL_VERSION_2, NULL, 0, NULL, H5D_ALLOC_TIME_LATE, H5D_FILL_TIME_IFSET, FALSE} -#define H5D_CRT_FILL_VALUE_ENC H5P__fill_value_enc -#define H5D_CRT_FILL_VALUE_DEC H5P__fill_value_dec +#define H5D_CRT_FILL_VALUE_SET H5P__dcrt_fill_value_set +#define H5D_CRT_FILL_VALUE_GET H5P__dcrt_fill_value_get +#define H5D_CRT_FILL_VALUE_ENC H5P__dcrt_fill_value_enc +#define H5D_CRT_FILL_VALUE_DEC H5P__dcrt_fill_value_dec +#define H5D_CRT_FILL_VALUE_DEL H5P__dcrt_fill_value_del +#define H5D_CRT_FILL_VALUE_COPY H5P__dcrt_fill_value_copy #define H5D_CRT_FILL_VALUE_CMP H5P_fill_value_cmp +#define H5D_CRT_FILL_VALUE_CLOSE H5P__dcrt_fill_value_close /* Definitions for space allocation time state */ #define H5D_CRT_ALLOC_TIME_STATE_SIZE sizeof(unsigned) #define H5D_CRT_ALLOC_TIME_STATE_DEF 1 @@ -95,9 +105,14 @@ /* Definitions for external file list */ #define H5D_CRT_EXT_FILE_LIST_SIZE sizeof(H5O_efl_t) #define H5D_CRT_EXT_FILE_LIST_DEF {HADDR_UNDEF, 0, 0, NULL} +#define H5D_CRT_EXT_FILE_LIST_SET H5P__dcrt_ext_file_list_set +#define H5D_CRT_EXT_FILE_LIST_GET H5P__dcrt_ext_file_list_get #define H5D_CRT_EXT_FILE_LIST_ENC H5P__dcrt_ext_file_list_enc #define H5D_CRT_EXT_FILE_LIST_DEC H5P__dcrt_ext_file_list_dec +#define H5D_CRT_EXT_FILE_LIST_DEL H5P__dcrt_ext_file_list_del +#define H5D_CRT_EXT_FILE_LIST_COPY H5P__dcrt_ext_file_list_copy #define H5D_CRT_EXT_FILE_LIST_CMP H5P__dcrt_ext_file_list_cmp +#define H5D_CRT_EXT_FILE_LIST_CLOSE H5P__dcrt_ext_file_list_close /******************/ @@ -122,18 +137,31 @@ static herr_t H5P__init_def_layout(void); /* Property class callbacks */ static herr_t H5P__dcrt_reg_prop(H5P_genclass_t *pclass); -static herr_t H5P__dcrt_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_data); -static herr_t H5P__dcrt_close(hid_t dxpl_id, void *close_data); /* Property callbacks */ +static herr_t H5P__dcrt_layout_set(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__dcrt_layout_get(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_layout_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dcrt_layout_dec(const void **pp, void *value); +static herr_t H5P__dcrt_layout_del(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__dcrt_layout_copy(const char *name, size_t size, void *value); static int H5P__dcrt_layout_cmp(const void *value1, const void *value2, size_t size); -static herr_t H5P__fill_value_enc(const void *value, void **pp, size_t *size); -static herr_t H5P__fill_value_dec(const void **pp, void *value); +static herr_t H5P__dcrt_layout_close(const char *name, size_t size, void *value); +static herr_t H5P__dcrt_fill_value_set(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__dcrt_fill_value_get(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__dcrt_fill_value_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dcrt_fill_value_dec(const void **pp, void *value); +static herr_t H5P__dcrt_fill_value_del(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__dcrt_fill_value_copy(const char *name, size_t size, void *value); +static herr_t H5P__dcrt_fill_value_close(const char *name, size_t size, void *value); +static herr_t H5P__dcrt_ext_file_list_set(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__dcrt_ext_file_list_get(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__dcrt_ext_file_list_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dcrt_ext_file_list_dec(const void **pp, void *value); +static herr_t H5P__dcrt_ext_file_list_del(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__dcrt_ext_file_list_copy(const char *name, size_t size, void *value); static int H5P__dcrt_ext_file_list_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__dcrt_ext_file_list_close(const char *name, size_t size, void *value); /*********************/ @@ -153,9 +181,9 @@ const H5P_libclass_t H5P_CLS_DCRT[1] = {{ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ - H5P__dcrt_copy, /* Class copy callback */ + NULL, /* Class copy callback */ NULL, /* Class copy callback info */ - H5P__dcrt_close, /* Class close callback */ + NULL, /* Class close callback */ NULL /* Class close callback info */ }}; @@ -212,14 +240,14 @@ H5P__dcrt_reg_prop(H5P_genclass_t *pclass) /* Register the storage layout property */ if(H5P_register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &H5D_def_layout_g, - NULL, NULL, NULL, H5D_CRT_LAYOUT_ENC, H5D_CRT_LAYOUT_DEC, - NULL, NULL, H5D_CRT_LAYOUT_CMP, NULL) < 0) + NULL, H5D_CRT_LAYOUT_SET, H5D_CRT_LAYOUT_GET, H5D_CRT_LAYOUT_ENC, H5D_CRT_LAYOUT_DEC, + H5D_CRT_LAYOUT_DEL, H5D_CRT_LAYOUT_COPY, H5D_CRT_LAYOUT_CMP, H5D_CRT_LAYOUT_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the fill value property */ if(H5P_register_real(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &H5D_def_fill_g, - NULL, NULL, NULL, H5D_CRT_FILL_VALUE_ENC, H5D_CRT_FILL_VALUE_DEC, - NULL, NULL, H5D_CRT_FILL_VALUE_CMP, NULL) < 0) + NULL, H5D_CRT_FILL_VALUE_SET, H5D_CRT_FILL_VALUE_GET, H5D_CRT_FILL_VALUE_ENC, H5D_CRT_FILL_VALUE_DEC, + H5D_CRT_FILL_VALUE_DEL, H5D_CRT_FILL_VALUE_COPY, H5D_CRT_FILL_VALUE_CMP, H5D_CRT_FILL_VALUE_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the space allocation time state property */ @@ -230,8 +258,8 @@ H5P__dcrt_reg_prop(H5P_genclass_t *pclass) /* Register the external file list property */ if(H5P_register_real(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &H5D_def_efl_g, - NULL, NULL, NULL, H5D_CRT_EXT_FILE_LIST_ENC, H5D_CRT_EXT_FILE_LIST_DEC, - NULL, NULL, H5D_CRT_EXT_FILE_LIST_CMP, NULL) < 0) + NULL, H5D_CRT_EXT_FILE_LIST_SET, H5D_CRT_EXT_FILE_LIST_GET, H5D_CRT_EXT_FILE_LIST_ENC, H5D_CRT_EXT_FILE_LIST_DEC, + H5D_CRT_EXT_FILE_LIST_DEL, H5D_CRT_EXT_FILE_LIST_COPY, H5D_CRT_EXT_FILE_LIST_CMP, H5D_CRT_EXT_FILE_LIST_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: @@ -240,165 +268,80 @@ done: /*------------------------------------------------------------------------- - * Function: H5P__dcrt_copy + * Function: H5P__dcrt_layout_set * - * Purpose: Callback routine which is called whenever any dataset - * creation property list is copied. This routine copies - * the properties from the old list to the new list. + * Purpose: Copies a layout property when it's set for a property list * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Raymond Lu - * Tuesday, October 2, 2001 + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 * *------------------------------------------------------------------------- */ /* ARGSUSED */ static herr_t -H5P__dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void H5_ATTR_UNUSED *copy_data) +H5P__dcrt_layout_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) { - H5O_fill_t src_fill, dst_fill; /* Source & destination fill values */ - H5O_efl_t src_efl, dst_efl; /* Source & destination external file lists */ - H5O_layout_t src_layout, dst_layout; /* Source & destination layout */ - H5P_genplist_t *src_plist; /* Pointer to source property list */ - H5P_genplist_t *dst_plist; /* Pointer to destination property list */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_layout_t *layout = (H5O_layout_t *)value; /* Create local aliases for values */ + H5O_layout_t new_layout; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC - /* Verify property list IDs */ - if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_plist_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") - if(NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_plist_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") - - /* Get the layout, fill value, external file list, and data pipeline - * properties from the old property list - */ - if(H5P_get(src_plist, H5D_CRT_LAYOUT_NAME, &src_layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get layout") - if(H5P_get(src_plist, H5D_CRT_FILL_VALUE_NAME, &src_fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") - if(H5P_get(src_plist, H5D_CRT_EXT_FILE_LIST_NAME, &src_efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") + /* Sanity check */ + HDassert(value); /* Make copy of layout */ - if(NULL == H5O_msg_copy(H5O_LAYOUT_ID, &src_layout, &dst_layout)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy layout") + if(NULL == H5O_msg_copy(H5O_LAYOUT_ID, layout, &new_layout)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy layout") - /* Reset layout values set when dataset is created */ - dst_layout.ops = NULL; - switch(dst_layout.type) { - case H5D_COMPACT: - dst_layout.storage.u.compact.buf = H5MM_xfree(dst_layout.storage.u.compact.buf); - HDmemset(&dst_layout.storage.u.compact, 0, sizeof(dst_layout.storage.u.compact)); - break; - - case H5D_CONTIGUOUS: - dst_layout.storage.u.contig.addr = HADDR_UNDEF; - dst_layout.storage.u.contig.size = 0; - break; - - case H5D_CHUNKED: - /* Reset chunk size */ - dst_layout.u.chunk.size = 0; - - /* Reset index info, if the chunk ops are set */ - if(dst_layout.storage.u.chunk.ops) - /* Reset address and pointer of the array struct for the chunked storage index */ - if(H5D_chunk_idx_reset(&dst_layout.storage.u.chunk, TRUE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to reset chunked storage index in dest") - - /* Reset chunk index ops */ - dst_layout.storage.u.chunk.ops = NULL; - break; - - case H5D_LAYOUT_ERROR: - case H5D_NLAYOUTS: - default: - HDassert(0 && "Unknown layout type!"); - } /* end switch */ - - /* Make copy of fill value */ - if(NULL == H5O_msg_copy(H5O_FILL_ID, &src_fill, &dst_fill)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy fill value") - - /* Make copy of external file list */ - HDmemset(&dst_efl, 0, sizeof(H5O_efl_t)); - if(NULL == H5O_msg_copy(H5O_EFL_ID, &src_efl, &dst_efl)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy external file list") - - /* Reset efl name_offset and heap_addr, these are the values when the dataset is created */ - if(dst_efl.slot) { - unsigned int i; - - dst_efl.heap_addr = HADDR_UNDEF; - for(i = 0; i < dst_efl.nused; i++) - dst_efl.slot[i].name_offset = 0; - } /* end if */ - - /* Set the layout, fill value, external file list, and data pipeline - * properties for the destination property list - */ - if(H5P_set(dst_plist, H5D_CRT_LAYOUT_NAME, &dst_layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set layout") - if(H5P_set(dst_plist, H5D_CRT_FILL_VALUE_NAME, &dst_fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value") - if(H5P_set(dst_plist, H5D_CRT_EXT_FILE_LIST_NAME, &dst_efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file list") + /* Copy new layout message over old one */ + *layout = new_layout; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__dcrt_copy() */ +} /* end H5P__dcrt_layout_set() */ /*------------------------------------------------------------------------- - * Function: H5P__dcrt_close + * Function: H5P__dcrt_layout_get * - * Purpose: Callback routine which is called whenever any dataset create - * property list is closed. This routine performs any generic - * cleanup needed on the properties the library put into the list. + * Purpose: Copies a layout property when it's retrieved from a property list * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, July 11, 2001 + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static herr_t -H5P__dcrt_close(hid_t dcpl_id, void H5_ATTR_UNUSED *close_data) +H5P__dcrt_layout_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) { - H5O_fill_t fill; /* Fill value */ - H5O_efl_t efl; /* External file list */ - H5P_genplist_t *plist; /* Property list */ + H5O_layout_t *layout = (H5O_layout_t *)value; /* Create local aliases for values */ + H5O_layout_t new_layout; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC - /* Check arguments */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") + /* Sanity check */ + HDassert(value); - /* Get the fill value, external file list, and data pipeline properties - * from the old property list */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") - if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") + /* Make copy of layout */ + if(NULL == H5O_msg_copy(H5O_LAYOUT_ID, layout, &new_layout)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy layout") - /* Clean up any values set for the fill-value and external file-list */ - if(H5O_msg_reset(H5O_FILL_ID, &fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release fill info") - if(H5O_msg_reset(H5O_EFL_ID, &efl) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release external file list info") + /* Copy new layout message over old one */ + *layout = new_layout; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__dcrt_close() */ +} /* end H5P__dcrt_layout_get() */ /*------------------------------------------------------------------------- @@ -478,7 +421,7 @@ static herr_t H5P__dcrt_layout_dec(const void **_pp, void *value) { const H5O_layout_t *layout; /* Storage layout */ - H5O_layout_t chunk_layout; /* Layout structure for chunk info */ + H5O_layout_t tmp_layout; /* Temporary local layout structure */ H5D_layout_t type; /* Layout type */ const uint8_t **pp = (const uint8_t **)_pp; herr_t ret_value = SUCCEED; /* Return value */ @@ -518,15 +461,15 @@ H5P__dcrt_layout_dec(const void **_pp, void *value) unsigned u; /* Local index variable */ /* Initialize to default values */ - chunk_layout = H5D_def_layout_chunk_g; + tmp_layout = H5D_def_layout_chunk_g; /* Set rank & dimensions */ - chunk_layout.u.chunk.ndims = (unsigned)ndims; + tmp_layout.u.chunk.ndims = (unsigned)ndims; for(u = 0; u < ndims; u++) - UINT32DECODE(*pp, chunk_layout.u.chunk.dim[u]) + UINT32DECODE(*pp, tmp_layout.u.chunk.dim[u]) /* Point at the newly set up struct */ - layout = &chunk_layout; + layout = &tmp_layout; } /* end else */ } break; @@ -546,6 +489,76 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__dcrt_layout_del + * + * Purpose: Frees memory used to store the layout property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Tuesday, Feb 10, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_layout_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Reset the old layout */ + if(H5O_msg_reset(H5O_LAYOUT_ID, value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release layout message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_layout_del() */ + + +/*-------------------------------------------------------------------------- + * Function: H5P__dcrt_layout_copy + * + * Purpose: Copy the layout property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Monday, Feb 9, 2015 + * + *-------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_layout_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, + void *value) +{ + H5O_layout_t *layout = (H5O_layout_t *)value; /* Create local aliases for values */ + H5O_layout_t new_layout; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + HDassert(layout); + + /* Make copy of layout */ + if(NULL == H5O_msg_copy(H5O_LAYOUT_ID, layout, &new_layout)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy layout") + + /* Set new layout message directly into property list */ + *layout = new_layout; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_layout_copy() */ + + +/*------------------------------------------------------------------------- * Function: H5P__dcrt_layout_cmp * * Purpose: Callback routine which is called whenever the layout @@ -562,7 +575,8 @@ done: *------------------------------------------------------------------------- */ static int -H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, size_t H5_ATTR_UNUSED size) +H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, + size_t H5_ATTR_UNUSED size) { const H5O_layout_t *layout1 = (const H5O_layout_t *)_layout1, /* Create local aliases for values */ *layout2 = (const H5O_layout_t *)_layout2; @@ -617,7 +631,116 @@ done: /*------------------------------------------------------------------------- - * Function: H5P__fill_value_enc + * Function: H5P__dcrt_layout_close + * + * Purpose: Frees memory used to store the layout property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Tuesday, Feb 10, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_layout_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, + void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Reset the old layout */ + if(H5O_msg_reset(H5O_LAYOUT_ID, value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release layout message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_layout_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dcrt_fill_value_set + * + * Purpose: Copies a fill value property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_fill_value_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + H5O_fill_t *fill = (H5O_fill_t *)value; /* Create local aliases for values */ + H5O_fill_t new_fill; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of fill value */ + if(NULL == H5O_msg_copy(H5O_FILL_ID, fill, &new_fill)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy fill value") + + /* Copy new fill value message over old one */ + *fill = new_fill; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_fill_value_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dcrt_fill_value_get + * + * Purpose: Copies a fill value property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_fill_value_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + H5O_fill_t *fill = (H5O_fill_t *)value; /* Create local aliases for values */ + H5O_fill_t new_fill; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of fill value */ + if(NULL == H5O_msg_copy(H5O_FILL_ID, fill, &new_fill)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy fill value") + + /* Copy new fill value message over old one */ + *fill = new_fill; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_fill_value_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dcrt_fill_value_enc * * Purpose: Callback routine which is called whenever the fill value * property in the dataset creation property list is @@ -632,14 +755,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__fill_value_enc(const void *value, void **_pp, size_t *size) +H5P__dcrt_fill_value_enc(const void *value, void **_pp, size_t *size) { const H5O_fill_t *fill = (const H5O_fill_t *)value; /* Create local aliases for values */ size_t dt_size = 0; /* Size of encoded datatype */ herr_t ret_value = SUCCEED; /* Return value */ uint8_t **pp = (uint8_t **)_pp; uint64_t enc_value; - unsigned enc_size; + unsigned enc_size = 0; FUNC_ENTER_STATIC @@ -708,11 +831,11 @@ H5P__fill_value_enc(const void *value, void **_pp, size_t *size) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__fill_value_enc() */ +} /* end H5P__dcrt_fill_value_enc() */ /*------------------------------------------------------------------------- - * Function: H5P__fill_value_dec + * Function: H5P__dcrt_fill_value_dec * * Purpose: Callback routine which is called whenever the fill value * property in the dataset creation property list is @@ -727,7 +850,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__fill_value_dec(const void **_pp, void *_value) +H5P__dcrt_fill_value_dec(const void **_pp, void *_value) { H5O_fill_t *fill = (H5O_fill_t *)_value; /* Fill value */ const uint8_t **pp = (const uint8_t **)_pp; @@ -775,7 +898,77 @@ H5P__fill_value_dec(const void **_pp, void *_value) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__fill_value_dec() */ +} /* end H5P__dcrt_fill_value_dec() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dcrt_fill_value_del + * + * Purpose: Frees memory used to store the fill value property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Thursday, Feb 26, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_fill_value_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Reset the old fill value message */ + if(H5O_msg_reset(H5O_FILL_ID, value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release fill value message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_fill_value_del() */ + + +/*-------------------------------------------------------------------------- + * Function: H5P__dcrt_fill_value_copy + * + * Purpose: Copy the fill value property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Thursday, Feb 26, 2015 + * + *-------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_fill_value_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, + void *value) +{ + H5O_fill_t *fill = (H5O_fill_t *)value; /* Create local aliases for values */ + H5O_fill_t new_fill; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + HDassert(fill); + + /* Make copy of fill value message */ + if(NULL == H5O_msg_copy(H5O_FILL_ID, fill, &new_fill)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy fill value") + + /* Set new fill value message directly into property list */ + *fill = new_fill; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_fill_value_copy() */ /*------------------------------------------------------------------------- @@ -794,7 +987,8 @@ done: *------------------------------------------------------------------------- */ int -H5P_fill_value_cmp(const void *_fill1, const void *_fill2, size_t H5_ATTR_UNUSED size) +H5P_fill_value_cmp(const void *_fill1, const void *_fill2, + size_t H5_ATTR_UNUSED size) { const H5O_fill_t *fill1 = (const H5O_fill_t *)_fill1, /* Create local aliases for values */ *fill2 = (const H5O_fill_t *)_fill2; @@ -840,6 +1034,115 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__dcrt_fill_value_close + * + * Purpose: Frees memory used to store the fill value property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Thursday, Feb 26, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_fill_value_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, + void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Reset the old fill value message */ + if(H5O_msg_reset(H5O_FILL_ID, value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release fill value message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_fill_value_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dcrt_ext_file_list_set + * + * Purpose: Copies an external file list property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_ext_file_list_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + H5O_efl_t *efl = (H5O_efl_t *)value; /* Create local aliases for values */ + H5O_efl_t new_efl; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of external file list */ + if(NULL == H5O_msg_copy(H5O_EFL_ID, efl, &new_efl)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy external file list") + + /* Copy new external file list message over old one */ + *efl = new_efl; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_ext_file_list_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dcrt_ext_file_list_get + * + * Purpose: Copies an external file lsit property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_ext_file_list_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + H5O_efl_t *efl = (H5O_efl_t *)value; /* Create local aliases for values */ + H5O_efl_t new_efl; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of external file list */ + if(NULL == H5O_msg_copy(H5O_EFL_ID, efl, &new_efl)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy external file list") + + /* Copy new external file list message over old one */ + *efl = new_efl; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_ext_file_list_get() */ + + +/*------------------------------------------------------------------------- * Function: H5P__dcrt_ext_file_list_enc * * Purpose: Callback routine which is called whenever the efl @@ -1015,6 +1318,76 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__dcrt_ext_file_list_del + * + * Purpose: Frees memory used to store the efl property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Thursday, Feb 26, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_ext_file_list_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Reset the old efl message */ + if(H5O_msg_reset(H5O_EFL_ID, value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release external file list message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_ext_file_list_del() */ + + +/*-------------------------------------------------------------------------- + * Function: H5P__dcrt_ext_file_list_copy + * + * Purpose: Copy the efl property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Thurday, Feb 26, 2015 + * + *-------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_ext_file_list_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, + void *value) +{ + H5O_efl_t *efl = (H5O_efl_t *)value; /* Create local aliases for values */ + H5O_efl_t new_efl; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + HDassert(efl); + + /* Make copy of efl message */ + if(NULL == H5O_msg_copy(H5O_EFL_ID, efl, &new_efl)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy external file list") + + /* Set new efl message directly into property list */ + *efl = new_efl; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_ext_file_list_copy() */ + + +/*------------------------------------------------------------------------- * Function: H5P__dcrt_ext_file_list_cmp * * Purpose: Callback routine which is called whenever the external file @@ -1031,7 +1404,8 @@ done: *------------------------------------------------------------------------- */ static int -H5P__dcrt_ext_file_list_cmp(const void *_efl1, const void *_efl2, size_t H5_ATTR_UNUSED size) +H5P__dcrt_ext_file_list_cmp(const void *_efl1, const void *_efl2, + size_t H5_ATTR_UNUSED size) { const H5O_efl_t *efl1 = (const H5O_efl_t *)_efl1, /* Create local aliases for values */ *efl2 = (const H5O_efl_t *)_efl2; @@ -1096,6 +1470,39 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__dcrt_ext_file_list_close + * + * Purpose: Frees memory used to store the efl property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Neil Fortner + * Thursday, Feb 26, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dcrt_ext_file_list_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, + void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Reset the old efl message */ + if(H5O_msg_reset(H5O_EFL_ID, value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release external file list message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dcrt_ext_file_list_close() */ + + +/*------------------------------------------------------------------------- * Function: H5P__set_layout * * Purpose: Sets the layout of raw data in the file. @@ -1121,10 +1528,10 @@ H5P__set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout) /* If we still have the "default" allocation time, change it according to the new layout */ if(alloc_time_state) { - H5O_fill_t fill; /* Fill value */ + H5O_fill_t fill; /* Fill value */ /* Get current fill value info */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") /* Set the default based on layout */ @@ -1148,7 +1555,7 @@ H5P__set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout) } /* end switch */ /* Set updated fill value info */ - if(H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_poke(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time") } /* end if */ @@ -1185,8 +1592,10 @@ H5P__init_def_layout(void) FUNC_ENTER_STATIC_NOERR /* Initialize the default layout info for non-contigous layouts */ + H5D_def_layout_compact_g.storage.type = H5D_COMPACT; H5D_def_layout_compact_g.storage.u.compact = def_store_compact; H5D_def_layout_chunk_g.u.chunk = def_layout_chunk; + H5D_def_layout_chunk_g.storage.type = H5D_CHUNKED; H5D_def_layout_chunk_g.storage.u.chunk = def_store_chunk; /* Note that we've initialized the default values */ @@ -1307,8 +1716,8 @@ H5Pget_layout(hid_t plist_id) if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5D_LAYOUT_ERROR, "can't find object for ID") - /* Get layout property */ - if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) + /* Peek at layout property */ + if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5D_LAYOUT_ERROR, "can't get layout") /* Set return value */ @@ -1439,8 +1848,8 @@ H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[]/*out*/) if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - /* Retrieve the layout property */ - if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) + /* Peek at the layout property */ + if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout") if(H5D_CHUNKED != layout.type) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout") @@ -1506,7 +1915,7 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) + if(H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") if(efl.nused > 0 && H5O_EFL_UNLIMITED == efl.slot[efl.nused - 1].size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "previous file size is unlimited") @@ -1519,7 +1928,6 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) } /* end for */ } /* end if */ - /* Add to the list */ if(efl.nused >= efl.nalloc) { size_t na = efl.nalloc + H5O_EFL_ALLOC; @@ -1537,7 +1945,7 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) efl.slot[idx].size = size; efl.nused++; - if(H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) + if(H5P_poke(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file list") done: @@ -1581,7 +1989,7 @@ H5Pget_external_count(hid_t plist_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get value */ - if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) + if(H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") /* Set return value */ @@ -1639,7 +2047,7 @@ H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name/*out* HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get value */ - if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) + if(H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") if(idx >= efl.nused) @@ -1718,11 +2126,11 @@ H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block) cd_values[1]=pixels_per_block; /* Add the filter */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") if(H5Z_append(&pline, H5Z_FILTER_SZIP, H5Z_FLAG_OPTIONAL, (size_t)2, cd_values) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add szip filter to pipeline") - if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline") done: @@ -1765,11 +2173,11 @@ H5Pset_shuffle(hid_t plist_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Add the filter */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") if(H5Z_append(&pline, H5Z_FILTER_SHUFFLE, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to shuffle the data") - if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline") done: @@ -1811,11 +2219,11 @@ H5Pset_nbit(hid_t plist_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Add the nbit filter */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") if(H5Z_append(&pline, H5Z_FILTER_NBIT, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add nbit filter to pipeline") - if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline") done: @@ -1890,11 +2298,11 @@ H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, int scale_fac cd_values[1] = (unsigned)scale_factor; /* Add the scaleoffset filter */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") if(H5Z_append(&pline, H5Z_FILTER_SCALEOFFSET, H5Z_FLAG_OPTIONAL, (size_t)2, cd_values) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add scaleoffset filter to pipeline") - if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline") done: @@ -1934,7 +2342,7 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the current fill value */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") /* Release the dynamic fill value components */ @@ -1984,7 +2392,7 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) fill.size = (-1); /* Update fill value in property list */ - if(H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_poke(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set fill value") done: @@ -2028,7 +2436,7 @@ H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value/*out*/, * datatype conversion might not have resulted in zero. If fill value * is undefined, also return error. */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") if(fill.size == -1) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "fill value is undefined") @@ -2040,8 +2448,8 @@ H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value/*out*/, } /* end if */ /* - * Can we convert between the source and destination datatypes? - */ + * Can we convert between the source and destination datatypes? + */ if(NULL == (tpath = H5T_path_find(fill.type, type, NULL, NULL, dxpl_id, FALSE))) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes") if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(fill.type, H5T_COPY_TRANSIENT), FALSE)) < 0) @@ -2196,7 +2604,7 @@ H5P_fill_value_defined(H5P_genplist_t *plist, H5D_fill_value_t *status) HDassert(status); /* Get the fill value struct */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") /* Get the fill-value status */ @@ -2284,8 +2692,8 @@ H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time) if(alloc_time == H5D_ALLOC_TIME_DEFAULT) { H5O_layout_t layout; /* Type of storage layout */ - /* Retrieve the storage layout */ - if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) + /* Peek at the storage layout */ + if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get layout") /* Set the default based on layout */ @@ -2316,14 +2724,14 @@ H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time) alloc_time_state = 0; /* Retrieve previous fill value settings */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") /* Update property value */ fill.alloc_time = alloc_time; /* Set values */ - if(H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_poke(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value") if(H5P_set(plist, H5D_CRT_ALLOC_TIME_STATE_NAME, &alloc_time_state) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time") @@ -2365,7 +2773,7 @@ H5Pget_alloc_time(hid_t plist_id, H5D_alloc_time_t *alloc_time/*out*/) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Retrieve fill value settings */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") /* Set user's value */ @@ -2409,14 +2817,14 @@ H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Retrieve previous fill value settings */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") /* Update property value */ fill.fill_time = fill_time; /* Set values */ - if(H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_poke(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value") done: @@ -2458,7 +2866,7 @@ H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t *fill_time/*out*/) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Retrieve fill value settings */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + if(H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") /* Set user's value */ diff --git a/src/H5Pdeprec.c b/src/H5Pdeprec.c index e4e91ac..ecf2bea 100644 --- a/src/H5Pdeprec.c +++ b/src/H5Pdeprec.c @@ -31,10 +31,7 @@ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5P__init_deprec_interface +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -82,51 +79,6 @@ /*******************/ - -/*-------------------------------------------------------------------------- -NAME - H5P__init_deprec_interface -- Initialize interface-specific information -USAGE - herr_t H5P__init_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5P_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5P__init_deprec_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5P_init()) -} /* H5P__init_deprec_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5P__term_deprec_interface -- Terminate interface -USAGE - herr_t H5P__term_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5P__term_deprec_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5P__term_deprec_interface() */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /*-------------------------------------------------------------------------- diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index acd30c8..59b3188 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -27,14 +27,15 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Cache */ +#include "H5ACprivate.h" /* Cache */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ @@ -152,6 +153,8 @@ /* Definitions for data transform property */ #define H5D_XFER_XFORM_SIZE sizeof(void *) #define H5D_XFER_XFORM_DEF NULL +#define H5D_XFER_XFORM_SET H5P__dxfr_xform_set +#define H5D_XFER_XFORM_GET H5P__dxfr_xform_get #define H5D_XFER_XFORM_ENC H5P__dxfr_xform_enc #define H5D_XFER_XFORM_DEC H5P__dxfr_xform_dec #define H5D_XFER_XFORM_DEL H5P__dxfr_xform_del @@ -167,6 +170,11 @@ #define H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_DEF NULL #define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_SIZE sizeof(uint32_t) #define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF 0 +/* Ring type - private property */ +#define H5AC_XFER_RING_SIZE sizeof(unsigned) +#define H5AC_XFER_RING_DEF H5AC_RING_US +#define H5AC_XFER_RING_ENC H5P__encode_unsigned +#define H5AC_XFER_RING_DEC H5P__decode_unsigned /* Definition for reading metadata collectively */ #define H5D_XFER_COLL_MD_READ_SIZE sizeof(H5P_coll_md_read_flag_t) @@ -204,6 +212,8 @@ static herr_t H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **pp, si static herr_t H5P__dxfr_mpio_chunk_opt_hard_dec(const void **pp, void *value); static herr_t H5P__dxfr_edc_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dxfr_edc_dec(const void **pp, void *value); +static herr_t H5P__dxfr_xform_set(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__dxfr_xform_get(hid_t prop_id, const char* name, size_t size, void* value); static herr_t H5P__dxfr_xform_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dxfr_xform_dec(const void **pp, void *value); static herr_t H5P__dxfr_xform_del(hid_t prop_id, const char* name, size_t size, void* value); @@ -278,6 +288,7 @@ static const uint32_t H5D_def_direct_chunk_filters_g = H5D_XFER_DIRECT_CHUNK_WRI static const hsize_t *H5D_def_direct_chunk_offset_g = H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_DEF; /* Default value for the offset of direct chunk write */ static const uint32_t H5D_def_direct_chunk_datasize_g = H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF; /* Default value for the datasize of direct chunk write */ static const H5P_coll_md_read_flag_t H5D_def_coll_md_read_g = H5D_XFER_COLL_MD_READ_DEF; /* Default setting for the collective metedata read flag */ +static const H5AC_ring_t H5D_ring_g = H5AC_XFER_RING_DEF; /* Default value for the cache entry ring type */ /*------------------------------------------------------------------------- @@ -444,7 +455,7 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) /* Register the data transform property */ if(H5P_register_real(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &H5D_def_xfer_xform_g, - NULL, NULL, NULL, H5D_XFER_XFORM_ENC, H5D_XFER_XFORM_DEC, + NULL, H5D_XFER_XFORM_SET, H5D_XFER_XFORM_GET, H5D_XFER_XFORM_ENC, H5D_XFER_XFORM_DEC, H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, H5D_XFER_XFORM_CMP, H5D_XFER_XFORM_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -479,6 +490,12 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the ring property (private) */ + if(H5P_register_real(pclass, H5AC_RING_NAME, H5AC_XFER_RING_SIZE, &H5D_ring_g, + NULL, NULL, NULL, H5AC_XFER_RING_ENC, H5AC_XFER_RING_DEC, + NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dxfr_reg_prop() */ @@ -653,6 +670,72 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__dxfr_xform_set + * + * Purpose: Copies a data transform property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_xform_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of data transform */ + if(H5Z_xform_copy((H5Z_data_xform_t **)value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "error copying the data transform info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dxfr_xform_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_xform_get + * + * Purpose: Copies a data transform property when it's retrieved for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_xform_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of data transform */ + if(H5Z_xform_copy((H5Z_data_xform_t **)value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "error copying the data transform info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dxfr_xform_get() */ + + +/*------------------------------------------------------------------------- * Function: H5P__dxfr_xform_enc * * Purpose: Callback routine which is called whenever the data transform @@ -829,10 +912,12 @@ H5P__dxfr_xform_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size FUNC_ENTER_STATIC + /* Sanity check */ HDassert(value); + /* Make copy of data transform */ if(H5Z_xform_copy((H5Z_data_xform_t **)value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error copying the data transform info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "error copying the data transform info") done: FUNC_LEAVE_NOAPI(ret_value) @@ -955,7 +1040,7 @@ H5Pset_data_transform(hid_t plist_id, const char *expression) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* See if a data transform is already set, and free it if it is */ - if(H5P_get(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) + if(H5P_peek(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting data transform expression") /* Destroy previous data transform property */ @@ -966,15 +1051,14 @@ H5Pset_data_transform(hid_t plist_id, const char *expression) if(NULL == (data_xform_prop = H5Z_xform_create(expression))) HGOTO_ERROR(H5E_PLINE, H5E_NOSPACE, FAIL, "unable to create data transform info") - /* Update property list */ - if(H5P_set(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) + /* Update property list (takes ownership of transform) */ + if(H5P_poke(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Error setting data transform expression") done: - if(ret_value < 0) { + if(ret_value < 0) if(data_xform_prop && H5Z_xform_destroy(data_xform_prop) < 0) HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "unable to release data transform expression") - } /* end if */ FUNC_LEAVE_API(ret_value) } /* end H5Pset_data_transform() */ @@ -1018,7 +1102,7 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size) if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - if(H5P_get(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) + if(H5P_peek(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting data transform expression") if(NULL == data_xform_prop) @@ -1028,6 +1112,7 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size) if(NULL == (pexp = H5Z_xform_extract_xform_str(data_xform_prop))) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "failed to retrieve transform expression") + /* Copy into application buffer */ len = HDstrlen(pexp); if(expression) { HDstrncpy(expression, pexp, MIN(len + 1, size)); @@ -1038,11 +1123,6 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size) ret_value = (ssize_t)len; done: - if(ret_value < 0) { - if(data_xform_prop && H5Z_xform_destroy(data_xform_prop) < 0) - HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "unable to release data transform expression") - } /* end if */ - FUNC_LEAVE_API(ret_value) } /* end H5Pget_data_transform() */ diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c index bb9f3be..1bcd19c 100644 --- a/src/H5Pencdec.c +++ b/src/H5Pencdec.c @@ -22,12 +22,7 @@ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ - -#ifdef NOT_YET -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5P_init_encdec_interface -#endif /* NOT_YET */ +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -82,29 +77,6 @@ typedef struct { /*******************/ -#ifdef NOT_YET - -/*-------------------------------------------------------------------------- -NAME - H5P_init_encdec_interface -- Initialize interface-specific information -USAGE - herr_t H5P_init_encdec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5P_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5P_init_encdec_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5P_init()) -} /* H5P_init_encdec_interface() */ -#endif /* NOT_YET */ - /*------------------------------------------------------------------------- * Function: H5P__encode_size_t @@ -737,7 +709,7 @@ H5P__decode(const void *buf) hid_t plist_id = -1; /* ID of new property list */ size_t value_buf_size = 0; /* Size of current value buffer */ uint8_t vers; /* Version of encoded property list */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_PACKAGE @@ -796,7 +768,7 @@ H5P__decode(const void *buf) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "no decode callback for property: '%s'", name) /* Set the value for the property */ - if(H5P_set(plist, name, value_buf) < 0) + if(H5P_poke(plist, name, value_buf) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value for property: '%s'", name) } /* end while */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index de5f8bf..21bf4c8 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -27,7 +27,8 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -110,12 +111,16 @@ #define H5F_ACS_GARBG_COLCT_REF_DEF 0 #define H5F_ACS_GARBG_COLCT_REF_ENC H5P__encode_unsigned #define H5F_ACS_GARBG_COLCT_REF_DEC H5P__decode_unsigned -/* Definition for file driver ID */ -#define H5F_ACS_FILE_DRV_ID_SIZE sizeof(hid_t) -#define H5F_ACS_FILE_DRV_ID_DEF H5_DEFAULT_VFD -/* Definition for file driver info */ -#define H5F_ACS_FILE_DRV_INFO_SIZE sizeof(void*) -#define H5F_ACS_FILE_DRV_INFO_DEF NULL +/* Definition for file driver ID & info*/ +#define H5F_ACS_FILE_DRV_SIZE sizeof(H5FD_driver_prop_t) +#define H5F_ACS_FILE_DRV_DEF {H5_DEFAULT_VFD, NULL} +#define H5F_ACS_FILE_DRV_CRT H5P__facc_file_driver_create +#define H5F_ACS_FILE_DRV_SET H5P__facc_file_driver_set +#define H5F_ACS_FILE_DRV_GET H5P__facc_file_driver_get +#define H5F_ACS_FILE_DRV_DEL H5P__facc_file_driver_del +#define H5F_ACS_FILE_DRV_COPY H5P__facc_file_driver_copy +#define H5F_ACS_FILE_DRV_CMP H5P__facc_file_driver_cmp +#define H5F_ACS_FILE_DRV_CLOSE H5P__facc_file_driver_close /* Definition for file close degree */ #define H5F_CLOSE_DEGREE_SIZE sizeof(H5F_close_degree_t) #define H5F_CLOSE_DEGREE_DEF H5F_CLOSE_DEFAULT @@ -157,9 +162,12 @@ /* Definition of pointer to initial file image info */ #define H5F_ACS_FILE_IMAGE_INFO_SIZE sizeof(H5FD_file_image_info_t) #define H5F_ACS_FILE_IMAGE_INFO_DEF H5FD_DEFAULT_FILE_IMAGE_INFO -#define H5F_ACS_FILE_IMAGE_INFO_DEL H5P_file_image_info_del -#define H5F_ACS_FILE_IMAGE_INFO_COPY H5P_file_image_info_copy -#define H5F_ACS_FILE_IMAGE_INFO_CLOSE H5P_file_image_info_close +#define H5F_ACS_FILE_IMAGE_INFO_SET H5P__facc_file_image_info_set +#define H5F_ACS_FILE_IMAGE_INFO_GET H5P__facc_file_image_info_get +#define H5F_ACS_FILE_IMAGE_INFO_DEL H5P__facc_file_image_info_del +#define H5F_ACS_FILE_IMAGE_INFO_COPY H5P__facc_file_image_info_copy +#define H5F_ACS_FILE_IMAGE_INFO_CMP H5P__facc_file_image_info_cmp +#define H5F_ACS_FILE_IMAGE_INFO_CLOSE H5P__facc_file_image_info_close /* Definition of core VFD write tracking flag */ #define H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE sizeof(hbool_t) #define H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF FALSE @@ -192,14 +200,26 @@ /********************/ /* Property class callbacks */ -static herr_t H5P_facc_reg_prop(H5P_genclass_t *pclass); -static herr_t H5P_facc_create(hid_t fapl_id, void *copy_data); -static herr_t H5P_facc_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_data); +static herr_t H5P__facc_reg_prop(H5P_genclass_t *pclass); + +/* File driver ID & info property callbacks */ +static herr_t H5P__facc_file_driver_create(const char *name, size_t size, void *value); +static herr_t H5P__facc_file_driver_set(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_file_driver_get(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_file_driver_del(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_file_driver_copy(const char *name, size_t size, void *value); +static int H5P__facc_file_driver_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__facc_file_driver_close(const char *name, size_t size, void *value); /* File image info property callbacks */ -static herr_t H5P_file_image_info_del(hid_t prop_id, const char *name, size_t size, void *value); -static herr_t H5P_file_image_info_copy(const char *name, size_t size, void *value); -static herr_t H5P_file_image_info_close(const char *name, size_t size, void *value); +static herr_t H5P__file_image_info_copy(void *value); +static herr_t H5P__file_image_info_free(void *value); +static herr_t H5P__facc_file_image_info_set(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_file_image_info_get(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_file_image_info_del(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_file_image_info_copy(const char *name, size_t size, void *value); +static int H5P__facc_file_image_info_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__facc_file_image_info_close(const char *name, size_t size, void *value); /* encode & decode callbacks */ static herr_t H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size); @@ -224,13 +244,13 @@ const H5P_libclass_t H5P_CLS_FACC[1] = {{ &H5P_CLS_FILE_ACCESS_g, /* Pointer to class */ &H5P_CLS_FILE_ACCESS_ID_g, /* Pointer to class ID */ &H5P_LST_FILE_ACCESS_ID_g, /* Pointer to default property list ID */ - H5P_facc_reg_prop, /* Default property registration routine */ + H5P__facc_reg_prop, /* Default property registration routine */ - H5P_facc_create, /* Class creation callback */ + NULL, /* Class creation callback */ NULL, /* Class creation callback info */ - H5P_facc_copy, /* Class copy callback */ + NULL, /* Class copy callback */ NULL, /* Class copy callback info */ - H5P_facc_close, /* Class close callback */ + NULL, /* Class close callback */ NULL /* Class close callback info */ }}; @@ -255,7 +275,6 @@ static const hsize_t H5F_def_meta_block_size_g = H5F_ACS_META_BLOCK_SIZE_DEF; static const size_t H5F_def_sieve_buf_size_g = H5F_ACS_SIEVE_BUF_SIZE_DEF; /* Default raw data I/O sieve buffer size */ static const hsize_t H5F_def_sdata_block_size_g = H5F_ACS_SDATA_BLOCK_SIZE_DEF; /* Default small data allocation block size */ static const unsigned H5F_def_gc_ref_g = H5F_ACS_GARBG_COLCT_REF_DEF; /* Default garbage collection for references setting */ -static const void *H5F_def_driver_info_g = H5F_ACS_FILE_DRV_INFO_DEF; /* Default VFL driver info */ static const H5F_close_degree_t H5F_def_close_degree_g = H5F_CLOSE_DEGREE_DEF; /* Default file close degree */ static const hsize_t H5F_def_family_offset_g = H5F_ACS_FAMILY_OFFSET_DEF; /* Default offset for family VFD */ static const hsize_t H5F_def_family_newsize_g = H5F_ACS_FAMILY_NEWSIZE_DEF; /* Default size of new files for family VFD */ @@ -269,9 +288,10 @@ static const hbool_t H5F_def_core_write_tracking_flag_g = H5F_ACS_CORE_WRITE_TRA static const size_t H5F_def_core_write_tracking_page_size_g = H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF; /* Default core VFD write tracking page size */ static const H5P_coll_md_read_flag_t H5F_def_coll_md_read_flag_g = H5F_ACS_COLL_MD_READ_FLAG_DEF; /* Default setting for the collective metedata read flag */ + /*------------------------------------------------------------------------- - * Function: H5P_facc_reg_prop + * Function: H5P__facc_reg_prop * * Purpose: Register the file access property list class's properties * @@ -282,12 +302,12 @@ static const H5P_coll_md_read_flag_t H5F_def_coll_md_read_flag_g = H5F_ACS_COLL_ *------------------------------------------------------------------------- */ static herr_t -H5P_facc_reg_prop(H5P_genclass_t *pclass) +H5P__facc_reg_prop(H5P_genclass_t *pclass) { - const hid_t def_driver_id = H5F_ACS_FILE_DRV_ID_DEF; /* Default VFL driver ID (initialized from a variable) */ + const H5FD_driver_prop_t def_driver_prop = H5F_ACS_FILE_DRV_DEF; /* Default VFL driver ID & info (initialized from a variable) */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Register the initial metadata cache resize configuration */ if(H5P_register_real(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &H5F_def_mdc_initCacheCfg_g, @@ -349,16 +369,11 @@ H5P_facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register the file driver ID */ + /* Register the file driver ID & info */ /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_ID_NAME, H5F_ACS_FILE_DRV_ID_SIZE, &def_driver_id, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the file driver info */ - /* (Note: this property should not have an encode/decode callback -QAK) */ - if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_INFO_NAME, H5F_ACS_FILE_DRV_INFO_SIZE, &H5F_def_driver_info_g, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + if(H5P_register_real(pclass, H5F_ACS_FILE_DRV_NAME, H5F_ACS_FILE_DRV_SIZE, &def_driver_prop, + H5F_ACS_FILE_DRV_CRT, H5F_ACS_FILE_DRV_SET, H5F_ACS_FILE_DRV_GET, NULL, NULL, + H5F_ACS_FILE_DRV_DEL, H5F_ACS_FILE_DRV_COPY, H5F_ACS_FILE_DRV_CMP, H5F_ACS_FILE_DRV_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the file close degree */ @@ -413,8 +428,8 @@ H5P_facc_reg_prop(H5P_genclass_t *pclass) /* Register the initial file image info */ /* (Note: this property should not have an encode/decode callback -QAK) */ if(H5P_register_real(pclass, H5F_ACS_FILE_IMAGE_INFO_NAME, H5F_ACS_FILE_IMAGE_INFO_SIZE, &H5F_def_file_image_info_g, - NULL, NULL, NULL, NULL, NULL, - H5F_ACS_FILE_IMAGE_INFO_DEL, H5F_ACS_FILE_IMAGE_INFO_COPY, NULL, H5F_ACS_FILE_IMAGE_INFO_CLOSE) < 0) + NULL, H5F_ACS_FILE_IMAGE_INFO_SET, H5F_ACS_FILE_IMAGE_INFO_GET, NULL, NULL, + H5F_ACS_FILE_IMAGE_INFO_DEL, H5F_ACS_FILE_IMAGE_INFO_COPY, H5F_ACS_FILE_IMAGE_INFO_CMP, H5F_ACS_FILE_IMAGE_INFO_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the core VFD backing store write tracking flag */ @@ -438,159 +453,7 @@ H5P_facc_reg_prop(H5P_genclass_t *pclass) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_facc_reg_prop() */ - - -/*---------------------------------------------------------------------------- - * Function: H5P_facc_create - * - * Purpose: Callback routine which is called whenever a file access - * property list is closed. This routine performs any generic - * initialization needed on the properties the library put into - * the list. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Raymond Lu - * Tuesday, Oct 23, 2001 - * - *---------------------------------------------------------------------------- - */ -/* ARGSUSED */ -static herr_t -H5P_facc_create(hid_t fapl_id, void H5_ATTR_UNUSED *copy_data) -{ - hid_t driver_id; - H5P_genplist_t *plist; /* Property list */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - /* Check argument */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - - /* Retrieve driver ID property */ - if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID") - - if(driver_id > 0) { - void *driver_info; - - /* Retrieve driver info property */ - if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver info") - - /* Set the driver for the property list */ - if(H5FD_fapl_open(plist, driver_id, driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_facc_create() */ - - -/*-------------------------------------------------------------------------- - * Function: H5P_facc_copy - * - * Purpose: Callback routine which is called whenever a file access - * property list is copied. This routine performs any generic - * copy needed on the properties. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Raymond Lu - * Tuesday, Oct 23, 2001 - * - *-------------------------------------------------------------------------- - */ -/* ARGSUSED */ -static herr_t -H5P_facc_copy(hid_t dst_fapl_id, hid_t src_fapl_id, void H5_ATTR_UNUSED *copy_data) -{ - hid_t driver_id; - H5P_genplist_t *src_plist; /* Source property list */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - /* Get driver ID from source property list */ - if(NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") - if(H5P_get(src_plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID") - - if(driver_id > 0) { - H5P_genplist_t *dst_plist; /* Destination property list */ - void *driver_info; - - /* Get driver info from source property list */ - if(H5P_get(src_plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver info") - - /* Set the driver for the destination property list */ - if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") - if(H5FD_fapl_open(dst_plist, driver_id, driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_facc_copy() */ - - -/*-------------------------------------------------------------------------- - * Function: H5P_facc_close - * - * Purpose: Callback routine which is called whenever a file access - * property list is closed. This routine performs any generic - * cleanup needed on the properties. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Raymond Lu - * Tuesday, Oct 23, 2001 - * - *--------------------------------------------------------------------------- - */ -/* ARGSUSED */ -herr_t -H5P_facc_close(hid_t fapl_id, void H5_ATTR_UNUSED *close_data) -{ - hid_t driver_id; - H5P_genplist_t *plist; /* Property list */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Check argument */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - - /* Get driver ID property */ - if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_DONE(FAIL) /* Can't return errors when library is shutting down */ - - if(driver_id > 0) { - void *driver_info; - - /* Get driver info property */ - if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0) - HGOTO_DONE(FAIL) /* Can't return errors when library is shutting down */ - - /* Close the driver for the property list */ - if(H5FD_fapl_close(driver_id, driver_info) < 0) - HGOTO_DONE(FAIL) /* Can't return errors when library is shutting down */ - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_facc_close() */ +} /* end H5P__facc_reg_prop() */ /*------------------------------------------------------------------------- @@ -714,9 +577,7 @@ done: herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info) { - hid_t driver_id; /* VFL driver ID */ - void *driver_info; /* VFL driver info */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -724,19 +585,15 @@ H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_drive HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID") if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - /* Get the current driver information */ - if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID") - if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL,"can't get driver info") + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ - /* Close the driver for the property list */ - if(H5FD_fapl_close(driver_id, driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset driver") + /* Prepare the driver property */ + driver_prop.driver_id = new_driver_id; + driver_prop.driver_info = new_driver_info; - /* Set the driver for the property list */ - if(H5FD_fapl_open(plist, new_driver_id, new_driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") + /* Set the driver ID & info property */ + if(H5P_set(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver ID & info") } /* end if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") @@ -790,7 +647,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_get_driver + * Function: H5P_peek_driver * * Purpose: Return the ID of the low-level file driver. PLIST_ID should * be a file access property list. @@ -808,7 +665,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5P_get_driver(H5P_genplist_t *plist) +H5P_peek_driver(H5P_genplist_t *plist) { hid_t ret_value = FAIL; /* Return value */ @@ -816,18 +673,21 @@ H5P_get_driver(H5P_genplist_t *plist) /* Get the current driver ID */ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &ret_value) < 0) + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ + + if(H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID") + ret_value = driver_prop.driver_id; } /* end if */ else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access property list") if(H5FD_VFD_DEFAULT == ret_value) ret_value = H5_DEFAULT_VFD; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_get_driver() */ +} /* end H5P_peek_driver() */ /*------------------------------------------------------------------------- @@ -836,6 +696,8 @@ done: * Purpose: Return the ID of the low-level file driver. PLIST_ID should * be a file access property list. * + * Note: The ID returned should not be closed. + * * Return: Success: A low-level driver ID which is the same ID * used when the driver was set for the property * list. The driver ID is only valid as long as @@ -861,7 +723,7 @@ H5Pget_driver(hid_t plist_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") /* Get the driver */ - if((ret_value = H5P_get_driver(plist)) < 0) + if((ret_value = H5P_peek_driver(plist)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver") done: @@ -870,7 +732,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_get_driver_info + * Function: H5P_peek_driver_info * * Purpose: Returns a pointer directly to the file driver-specific * information of a file access. @@ -888,8 +750,8 @@ done: * *------------------------------------------------------------------------- */ -void * -H5P_get_driver_info(H5P_genplist_t *plist) +const void * +H5P_peek_driver_info(H5P_genplist_t *plist) { void *ret_value = NULL; /* Return value */ @@ -897,15 +759,18 @@ H5P_get_driver_info(H5P_genplist_t *plist) /* Get the current driver info */ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &ret_value) < 0) + H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ + + if(H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver info") + ret_value = (void *)driver_prop.driver_info; } /* end if */ else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a file access property list") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_get_driver_info() */ +} /* end H5P_peek_driver_info() */ /*------------------------------------------------------------------------- @@ -940,7 +805,7 @@ H5Pget_driver_info(hid_t plist_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list") /* Get the driver info */ - if(NULL == (ret_value = H5P_get_driver_info(plist))) + if(NULL == (ret_value = (void *)H5P_peek_driver_info(plist))) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver info") done: @@ -949,6 +814,365 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__file_driver_copy + * + * Purpose: Copy file driver ID & info. + * + * Note: This is an "in-place" copy, since this routine gets called + * after the top-level copy has been performed and this routine + * finishes the "deep" part of the copy. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, Sept 8, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__file_driver_copy(void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + if(value) { + H5FD_driver_prop_t *info = (H5FD_driver_prop_t *)value; /* Driver ID & info struct */ + + /* Copy the driver & info, if there is one */ + if(info->driver_id > 0) { + /* Increment the reference count on driver and copy driver info */ + if(H5I_inc_ref(info->driver_id, FALSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver") + + /* Copy driver info, if it exists */ + if(info->driver_info) { + H5FD_class_t *driver; /* Pointer to driver */ + void *new_pl; /* Copy of driver info */ + + /* Retrieve the driver for the ID */ + if(NULL == (driver = (H5FD_class_t *)H5I_object(info->driver_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a driver ID") + + /* Allow the driver to copy or do it ourselves */ + if(driver->fapl_copy) { + if(NULL == (new_pl = (driver->fapl_copy)(info->driver_info))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "driver info copy failed") + } /* end if */ + else if(driver->fapl_size > 0) { + if(NULL == (new_pl = H5MM_malloc(driver->fapl_size))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "driver info allocation failed") + HDmemcpy(new_pl, info->driver_info, driver->fapl_size); + } /* end else-if */ + else + HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "no way to copy driver info") + + /* Set the driver info for the copy */ + info->driver_info = new_pl; + } /* end if */ + } /* end if */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__file_driver_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__file_driver_free + * + * Purpose: Free file driver ID & info. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, Sept 8, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__file_driver_free(void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + if(value) { + H5FD_driver_prop_t *info = (H5FD_driver_prop_t *)value; /* Driver ID & info struct */ + + /* Copy the driver & info, if there is one */ + if(info->driver_id > 0) { + if(info->driver_info) { + H5FD_class_t *driver; /* Pointer to driver */ + + /* Retrieve the driver for the ID */ + if(NULL == (driver = (H5FD_class_t *)H5I_object(info->driver_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a driver ID") + + /* Allow driver to free info or do it ourselves */ + if(driver->fapl_free) { + if((driver->fapl_free)((void *)info->driver_info) < 0) /* Casting away const OK -QAK */ + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed") + } /* end if */ + else + H5MM_xfree((void *)info->driver_info); /* Casting away const OK -QAK */ + } /* end if */ + + /* Decrement reference count for driver */ + if(H5I_dec_ref(info->driver_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for driver ID") + } /* end if */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__file_driver_free() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_driver_create + * + * Purpose: Create callback for the file driver ID & info property. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, September 8, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_driver_create(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Make copy of file driver */ + if(H5P__file_driver_copy(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_driver_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_driver_set + * + * Purpose: Copies a file driver property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, Sept 7, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_driver_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of file driver ID & info */ + if(H5P__file_driver_copy(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_driver_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_driver_get + * + * Purpose: Copies a file driver property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, Sept 7, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_driver_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of file driver */ + if(H5P__file_driver_copy(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_driver_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_driver_del + * + * Purpose: Frees memory used to store the driver ID & info property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, September 8, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_driver_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Free the file driver ID & info */ + if(H5P__file_driver_free(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release file driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_driver_del() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_driver_copy + * + * Purpose: Copy callback for the file driver ID & info property. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, September 8, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_driver_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Make copy of file driver */ + if(H5P__file_driver_copy(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_driver_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_driver_cmp + * + * Purpose: Callback routine which is called whenever the file driver ID & info + * property in the file access property list is compared. + * + * Return: positive if VALUE1 is greater than VALUE2, negative if + * VALUE2 is greater than VALUE1 and zero if VALUE1 and + * VALUE2 are equal. + * + * Programmer: Quincey Koziol + * Monday, September 8, 2015 + * + *------------------------------------------------------------------------- + */ +static int +H5P__facc_file_driver_cmp(const void *_info1, const void *_info2, + size_t H5_ATTR_UNUSED size) +{ + const H5FD_driver_prop_t *info1 = (const H5FD_driver_prop_t *)_info1, /* Create local aliases for values */ + *info2 = (const H5FD_driver_prop_t *)_info2; + H5FD_class_t *cls1, *cls2; /* Driver class for each property */ + int cmp_value; /* Value from comparison */ + herr_t ret_value = 0; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(info1); + HDassert(info2); + HDassert(size == sizeof(H5FD_driver_prop_t)); + + /* Compare drivers */ + if(NULL == (cls1 = H5FD_get_class(info1->driver_id))) + HGOTO_DONE(-1) + if(NULL == (cls2 = H5FD_get_class(info2->driver_id))) + HGOTO_DONE(1) + if(cls1->name == NULL && cls2->name != NULL) HGOTO_DONE(-1); + if(cls1->name != NULL && cls2->name == NULL) HGOTO_DONE(1); + if(0 != (cmp_value = HDstrcmp(cls1->name, cls2->name))) + HGOTO_DONE(cmp_value); + + /* Compare driver infos */ + if(cls1->fapl_size < cls2->fapl_size) HGOTO_DONE(-1) + if(cls1->fapl_size > cls2->fapl_size) HGOTO_DONE(1) + HDassert(cls1->fapl_size == cls2->fapl_size); + if(info1->driver_info == NULL && info2->driver_info != NULL) HGOTO_DONE(-1); + if(info1->driver_info != NULL && info2->driver_info == NULL) HGOTO_DONE(1); + if(info1->driver_info) { + HDassert(cls1->fapl_size > 0); + if(0 != (cmp_value = HDmemcmp(info1->driver_info, info2->driver_info, cls1->fapl_size))) + HGOTO_DONE(cmp_value); + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_driver_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_driver_close + * + * Purpose: Close callback for the file driver ID & info property. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Monday, September 8, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_driver_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Free the file driver */ + if(H5P__file_driver_free(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release file driver") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_driver_close() */ + + +/*------------------------------------------------------------------------- * Function: H5Pset_family_offset * * Purpose: Set offset for family driver. This file access property @@ -2021,7 +2245,7 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get old image info */ - if(H5P_get(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) + if(H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get old file image pointer") /* Release previous buffer, if it exists */ @@ -2062,7 +2286,7 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) image_info.size = buf_len; /* Set values */ - if(H5P_set(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) + if(H5P_poke(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file image info") done: @@ -2114,7 +2338,7 @@ H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get values */ - if(H5P_get(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) + if(H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info") /* verify file image field consistancy */ @@ -2190,7 +2414,7 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get old info */ - if(H5P_get(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) + if(H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get old file image info") /* verify file image field consistancy */ @@ -2228,7 +2452,7 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback } /* end if */ /* Set values */ - if(H5P_set(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) + if(H5P_poke(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file image info") done: @@ -2266,7 +2490,7 @@ H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get old info */ - if(H5P_get(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) + if(H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info") /* verify file image field consistancy */ @@ -2293,80 +2517,30 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_file_image_info_del - * - * Purpose: Delete callback for the file image info property, called - * when the property is deleted from the plist. The buffer - * and udata may need to be freed, possibly using their - * respective callbacks so the default free won't work. + * Function: H5P__file_image_info_copy * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Jacob Gruber - * Thurday, August 11, 2011 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P_file_image_info_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) -{ - H5FD_file_image_info_t info; /* Image info struct */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - if(value) { - info = *(H5FD_file_image_info_t *)value; - - /* verify file image field consistancy */ - HDassert(((info.buffer != NULL) && (info.size > 0)) || - ((info.buffer == NULL) && (info.size == 0))); - - if(info.buffer && info.size > 0) { - /* Free buffer */ - if(info.callbacks.image_free) { - if(info.callbacks.image_free(info.buffer, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE, info.callbacks.udata) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "image_free callback failed") - } /* end if */ - else - HDfree(info.buffer); - } /* end if */ - - /* Free udata if it exists */ - if(info.callbacks.udata) { - if(NULL == info.callbacks.udata_free) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata_free not defined") - - if(info.callbacks.udata_free(info.callbacks.udata) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed") - } /* end if */ - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_file_image_info_del() */ - - -/*------------------------------------------------------------------------- - * Function: H5P_file_image_info_copy - * - * Purpose: Copy callback for the file image info property. The buffer + * Purpose: Copy file image info. The buffer * and udata may need to be copied, possibly using their * respective callbacks so the default copy won't work. * - * Return: Non-negative on success/Negative on failure + * Note: This is an "in-place" copy, since this routine gets called + * after the top-level copy has been performed and this routine + * finishes the "deep" part of the copy. * - * Programmer: Jacob Gruber - * Thurday, August 11, 2011 + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 * *------------------------------------------------------------------------- */ static herr_t -H5P_file_image_info_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__file_image_info_copy(void *value) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(value) { H5FD_file_image_info_t *info; /* Image info struct */ @@ -2387,19 +2561,18 @@ H5P_file_image_info_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED if(info->callbacks.image_malloc) { if(NULL == (info->buffer = info->callbacks.image_malloc(info->size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, info->callbacks.udata))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "image malloc callback failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "image malloc callback failed") } /* end if */ else { if(NULL == (info->buffer = H5MM_malloc(info->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory block") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate memory block") } /* end else */ /* Copy data to new buffer */ if(info->callbacks.image_memcpy) { if(info->buffer != info->callbacks.image_memcpy(info->buffer, old_buffer, - info->size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, - info->callbacks.udata)) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") + info->size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, info->callbacks.udata)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") } /* end if */ else HDmemcpy(info->buffer, old_buffer, info->size); @@ -2410,50 +2583,53 @@ H5P_file_image_info_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED void *old_udata = info->callbacks.udata; if(NULL == info->callbacks.udata_copy) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata_copy not defined") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "udata_copy not defined") info->callbacks.udata = info->callbacks.udata_copy(old_udata); } /* end if */ - } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_file_image_info_copy() */ +} /* end H5P__file_image_info_copy() */ /*------------------------------------------------------------------------- - * Function: H5P_file_image_info_close + * Function: H5P__file_image_info_free * - * Purpose: Close callback for the file image info property. The buffer - * and udata may need to be freed, possibly using their - * respective callbacks so the standard free won't work. + * Purpose: Free file image info. The buffer and udata may need to be + * freed, possibly using their respective callbacks, so the + * default free won't work. * - * Return: Non-negative on success/Negative on failure + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Jacob Gruber - * Thurday, August 11, 2011 + * Programmer: Quincey Koziol + * Wednesday, Sept 2, 2015 * *------------------------------------------------------------------------- */ static herr_t -H5P_file_image_info_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__file_image_info_free(void *value) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(value) { H5FD_file_image_info_t *info; /* Image info struct */ info = (H5FD_file_image_info_t *)value; + /* Verify file image field consistancy */ + HDassert(((info->buffer != NULL) && (info->size > 0)) || + ((info->buffer == NULL) && (info->size == 0))); + + /* Free buffer */ if(info->buffer != NULL && info->size > 0) { - /* Free buffer */ if(info->callbacks.image_free) { - if(info->callbacks.image_free(info->buffer, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE, - info->callbacks.udata) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "image_free callback failed") + if((*info->callbacks.image_free)(info->buffer, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE, info->callbacks.udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "image_free callback failed") } /* end if */ else H5MM_xfree(info->buffer); @@ -2462,15 +2638,231 @@ H5P_file_image_info_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED /* Free udata if it exists */ if(info->callbacks.udata) { if(NULL == info->callbacks.udata_free) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata_free not defined") - if(info->callbacks.udata_free(info->callbacks.udata) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "udata_free not defined") + if((*info->callbacks.udata_free)(info->callbacks.udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "udata_free callback failed") } /* end if */ } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_file_image_info_close() */ +} /* end H5P__file_image_info_free() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_image_info_set + * + * Purpose: Copies a file image property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_image_info_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of file image info */ + if(H5P__file_image_info_copy(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file image info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_image_info_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_image_info_get + * + * Purpose: Copies a file image property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_image_info_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of file image info */ + if(H5P__file_image_info_copy(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file image info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_image_info_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_image_info_del + * + * Purpose: Delete callback for the file image info property, called + * when the property is deleted from the plist. The buffer + * and udata may need to be freed, possibly using their + * respective callbacks so the default free won't work. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Jacob Gruber + * Thurday, August 11, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_image_info_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Free the file image info */ + if(H5P__file_image_info_free(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release file image info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_image_info_del() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_image_info_copy + * + * Purpose: Copy callback for the file image info property. The buffer + * and udata may need to be copied, possibly using their + * respective callbacks so the default copy won't work. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Jacob Gruber + * Thurday, August 11, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_image_info_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Make copy of file image info */ + if(H5P__file_image_info_copy(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file image info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_image_info_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_image_info_cmp + * + * Purpose: Callback routine which is called whenever the file image info + * property in the file access property list is compared. + * + * Return: positive if VALUE1 is greater than VALUE2, negative if + * VALUE2 is greater than VALUE1 and zero if VALUE1 and + * VALUE2 are equal. + * + * Programmer: Quincey Koziol + * Thursday, September 3, 2015 + * + *------------------------------------------------------------------------- + */ +static int +H5P__facc_file_image_info_cmp(const void *_info1, const void *_info2, + size_t H5_ATTR_UNUSED size) +{ + const H5FD_file_image_info_t *info1 = (const H5FD_file_image_info_t *)_info1, /* Create local aliases for values */ + *info2 = (const H5FD_file_image_info_t *)_info2; + herr_t ret_value = 0; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(info1); + HDassert(info2); + HDassert(size == sizeof(H5FD_file_image_info_t)); + + /* Check for different buffer sizes */ + if(info1->size < info2->size) HGOTO_DONE(-1) + if(info1->size > info2->size) HGOTO_DONE(1) + + /* Check for different callbacks */ + /* (Order in memory is fairly meaningless, so just check for equality) */ + if(info1->callbacks.image_malloc != info2->callbacks.image_malloc) HGOTO_DONE(1) + if(info1->callbacks.image_memcpy != info2->callbacks.image_memcpy) HGOTO_DONE(-1) + if(info1->callbacks.image_realloc != info2->callbacks.image_realloc) HGOTO_DONE(1) + if(info1->callbacks.image_free != info2->callbacks.image_free) HGOTO_DONE(-1) + if(info1->callbacks.udata_copy != info2->callbacks.udata_copy) HGOTO_DONE(1) + if(info1->callbacks.udata_free != info2->callbacks.udata_free) HGOTO_DONE(-1) + + /* Check for different udata */ + /* (Don't know how big it is, so can't check contents) */ + if(info1->callbacks.udata < info2->callbacks.udata) HGOTO_DONE(-1) + if(info1->callbacks.udata > info2->callbacks.udata) HGOTO_DONE(1) + + /* Check buffer contents (instead of buffer pointers) */ + if(info1->buffer != NULL && info2->buffer == NULL) HGOTO_DONE(-1) + if(info1->buffer == NULL && info2->buffer != NULL) HGOTO_DONE(1) + if(info1->buffer != NULL && info2->buffer != NULL) + ret_value = HDmemcmp(info1->buffer, info2->buffer, size); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_image_info_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_file_image_info_close + * + * Purpose: Close callback for the file image info property. The buffer + * and udata may need to be freed, possibly using their + * respective callbacks so the standard free won't work. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Jacob Gruber + * Thurday, August 11, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_file_image_info_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Free the file image info */ + if(H5P__file_image_info_free(value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release file image info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_file_image_info_close() */ /*------------------------------------------------------------------------- diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index 5fc93fd..d451982 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -27,7 +27,8 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ diff --git a/src/H5Pfmpl.c b/src/H5Pfmpl.c index 875f101..de9fa3b 100644 --- a/src/H5Pfmpl.c +++ b/src/H5Pfmpl.c @@ -27,7 +27,8 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index 1e3a278..f84fa7b 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -27,7 +27,9 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ + /***********/ /* Headers */ diff --git a/src/H5Pint.c b/src/H5Pint.c index 50a9b2e..539fe68 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -22,10 +22,7 @@ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5P_init_interface +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -80,6 +77,22 @@ typedef struct { int cmp_value; /* Value from property comparison */ } H5P_plist_cmp_ud_t; +/* Typedef for property list set/poke callbacks */ +typedef struct { + const void *value; /* Pointer to value to set */ +} H5P_prop_set_ud_t; + +/* Typedef for property list get/peek callbacks */ +typedef struct { + void *value; /* Pointer for retrieved value */ +} H5P_prop_get_ud_t; + +/* Typedef for H5P__do_prop() callbacks */ +typedef herr_t (*H5P_do_plist_op_t)(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void *udata); +typedef herr_t (*H5P_do_pclass_op_t)(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void *udata); + /********************/ /* Local Prototypes */ @@ -89,6 +102,8 @@ typedef struct { static H5P_genprop_t *H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type); static herr_t H5P_free_prop(H5P_genprop_t *prop); static int H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2); +static herr_t H5P__do_prop(H5P_genplist_t *plist, const char *name, H5P_do_plist_op_t plist_op, + H5P_do_pclass_op_t pclass_op, void *udata); /*********************/ @@ -97,7 +112,7 @@ static int H5P_cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2); /* * Predefined property list classes. These are initialized at runtime by - * H5P_init_interface() in this source file. + * H5P__init_package() in this source file. */ hid_t H5P_CLS_ROOT_ID_g = FAIL; H5P_genclass_t *H5P_CLS_ROOT_g = NULL; @@ -138,7 +153,7 @@ H5P_genclass_t *H5P_CLS_STRING_CREATE_g = NULL; /* * Predefined property lists for each predefined class. These are initialized - * at runtime by H5P_init_interface() in this source file. + * at runtime by H5P__init_package() in this source file. */ hid_t H5P_LST_FILE_CREATE_ID_g = FAIL; hid_t H5P_LST_FILE_ACCESS_ID_g = FAIL; @@ -337,89 +352,17 @@ static const H5I_class_t H5I_GENPROPLST_CLS[1] = {{ -/*-------------------------------------------------------------------------- - NAME - H5P_do_prop_cb1 - PURPOSE - Internal routine to call a property list callback routine and update - the property list accordingly. - USAGE - herr_t H5P_do_prop_cb1(slist,prop,cb) - H5SL_t *slist; IN/OUT: Skip list to hold changed properties - H5P_genprop_t *prop; IN: Property to call callback for - H5P_prp_cb1_t *cb; IN: Callback routine to call - RETURNS - Returns non-negative on success, negative on failure. - DESCRIPTION - Calls the callback routine passed in. If the callback routine changes - the property value, then the property is duplicated and added to skip list. - - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static herr_t -H5P_do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb) -{ - void *tmp_value=NULL; /* Temporary value buffer */ - H5P_genprop_t *pcopy=NULL; /* Copy of property to insert into skip list */ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Allocate space for a temporary copy of the property value */ - if(NULL == (tmp_value = H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for temporary property value") - HDmemcpy(tmp_value,prop->value,prop->size); - - /* Call "type 1" callback ('create', 'copy' or 'close') */ - if(cb(prop->name,prop->size,tmp_value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Property callback failed") - - /* Check if the property value changed */ - if((prop->cmp)(tmp_value,prop->value,prop->size)) { - /* Make a copy of the class's property */ - if((pcopy=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property") - - /* Copy the changed value into the new property */ - HDmemcpy(pcopy->value,tmp_value,prop->size); - - /* Insert the changed property into the property list */ - if(H5P_add_prop(slist,pcopy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert property into skip list") - } /* end if */ - -done: - /* Release the temporary value buffer */ - if(tmp_value!=NULL) - H5MM_xfree(tmp_value); - - /* Cleanup on failure */ - if(ret_value<0) { - if(pcopy!=NULL) - H5P_free_prop(pcopy); - } /* end if */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_do_prop_cb1() */ - - /*------------------------------------------------------------------------- * Function: H5P_init * * Purpose: Initialize the interface from some other layer. * * Return: Success: non-negative - * * Failure: negative * * Programmer: Quincey Koziol * Saturday, March 4, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -437,22 +380,22 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_init_interface -- Initialize interface-specific information + H5P__init_package -- Initialize interface-specific information USAGE - herr_t H5P_init_interface() + herr_t H5P__init_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION Initializes any interface-specific data or routines. --------------------------------------------------------------------------*/ -static herr_t -H5P_init_interface(void) +herr_t +H5P__init_package(void) { size_t tot_init; /* Total # of classes initialized */ size_t pass_init; /* # of classes initialized in each pass */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* * Initialize the Generic Property class & object groups. @@ -515,16 +458,16 @@ H5P_init_interface(void) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_init_interface() */ +} /* end H5P__init_package() */ /*-------------------------------------------------------------------------- NAME - H5P_term_interface + H5P_term_package PURPOSE Terminate various H5P objects USAGE - void H5P_term_interface() + void H5P_term_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -536,13 +479,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ int -H5P_term_interface(void) +H5P_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5_PKG_INIT_VAR) { int64_t nlist, nclass; /* Destroy HDF5 library property classes & lists */ @@ -625,25 +568,89 @@ H5P_term_interface(void) n++; /*H5I*/ } else { - /* Close public interface */ - n += H5P__term_pub_interface(); - - /* Close deprecated interface */ - n += H5P__term_deprec_interface(); - /* Destroy the property list and class id groups */ - (void)H5I_dec_type_ref(H5I_GENPROP_LST); - n++; /*H5I*/ - (void)H5I_dec_type_ref(H5I_GENPROP_CLS); - n++; /*H5I*/ + n += (H5I_dec_type_ref(H5I_GENPROP_LST) > 0); + n += (H5I_dec_type_ref(H5I_GENPROP_CLS) > 0); /* Mark closed */ - H5_interface_initialize_g = 0; + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end else */ } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5P_term_interface() */ +} /* end H5P_term_package() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P_do_prop_cb1 + PURPOSE + Internal routine to call a property list callback routine and update + the property list accordingly. + USAGE + herr_t H5P_do_prop_cb1(slist,prop,cb) + H5SL_t *slist; IN/OUT: Skip list to hold changed properties + H5P_genprop_t *prop; IN: Property to call callback for + H5P_prp_cb1_t *cb; IN: Callback routine to call + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Calls the callback routine passed in. If the callback routine changes + the property value, then the property is duplicated and added to skip list. + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5P_do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb) +{ + void *tmp_value = NULL; /* Temporary value buffer */ + H5P_genprop_t *pcopy = NULL; /* Copy of property to insert into skip list */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Sanity check */ + HDassert(slist); + HDassert(prop); + HDassert(prop->cmp); + HDassert(cb); + + /* Allocate space for a temporary copy of the property value */ + if(NULL == (tmp_value = H5MM_malloc(prop->size))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary property value") + HDmemcpy(tmp_value, prop->value, prop->size); + + /* Call "type 1" callback ('create', 'copy' or 'close') */ + if(cb(prop->name, prop->size, tmp_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL,"Property callback failed") + + /* Make a copy of the class's property */ + if(NULL == (pcopy = H5P_dup_prop(prop, H5P_PROP_WITHIN_LIST))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") + + /* Copy the changed value into the new property */ + HDmemcpy(pcopy->value, tmp_value, prop->size); + + /* Insert the changed property into the property list */ + if(H5P_add_prop(slist, pcopy) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into skip list") + +done: + /* Release the temporary value buffer */ + if(tmp_value) + H5MM_xfree(tmp_value); + + /* Cleanup on failure */ + if(ret_value < 0) + if(pcopy) + H5P_free_prop(pcopy); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_do_prop_cb1() */ /*-------------------------------------------------------------------------- @@ -866,7 +873,7 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) /* Only "copy" properties we haven't seen before */ if(nseen==0 || H5SL_search(seen,tmp->name) == NULL) { - /* Call property creation callback, if it exists */ + /* Call property copy callback, if it exists */ if(tmp->copy) { /* Call the callback & insert changed value into skip list (if necessary) */ if(H5P_do_prop_cb1(new_plist->props,tmp,tmp->copy) < 0) @@ -962,7 +969,7 @@ static H5P_genprop_t * H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type) { H5P_genprop_t *prop = NULL; /* Pointer to new property copied */ - H5P_genprop_t *ret_value; /* Return value */ + H5P_genprop_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1078,8 +1085,8 @@ H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close) { - H5P_genprop_t *prop = NULL; /* Pointer to new property copied */ - H5P_genprop_t *ret_value; /* Return value */ + H5P_genprop_t *prop = NULL; /* Pointer to new property copied */ + H5P_genprop_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1199,7 +1206,7 @@ done: H5P_genprop_t * H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name) { - H5P_genprop_t *ret_value; /* Property pointer return value */ + H5P_genprop_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -1259,7 +1266,7 @@ done: static H5P_genprop_t * H5P_find_prop_pclass(H5P_genclass_t *pclass, const char *name) { - H5P_genprop_t *ret_value; /* Property pointer return value */ + H5P_genprop_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1569,8 +1576,8 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t t H5P_cls_copy_func_t cls_copy, void *copy_data, H5P_cls_close_func_t cls_close, void *close_data) { - H5P_genclass_t *pclass=NULL; /* Property list class created */ - H5P_genclass_t *ret_value; /* return value */ + H5P_genclass_t *pclass = NULL; /* Property list class created */ + H5P_genclass_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1664,10 +1671,10 @@ static H5P_genplist_t * H5P_create(H5P_genclass_t *pclass) { H5P_genclass_t *tclass; /* Temporary class pointer */ - H5P_genplist_t *plist=NULL; /* New property list created */ + H5P_genplist_t *plist = NULL; /* New property list created */ H5P_genprop_t *tmp; /* Temporary pointer to parent class properties */ - H5SL_t *seen=NULL; /* Skip list to hold names of properties already seen */ - H5P_genplist_t *ret_value; /* Return value */ + H5SL_t *seen = NULL; /* Skip list to hold names of properties already seen */ + H5P_genplist_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1803,10 +1810,10 @@ done: hid_t H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref) { - H5P_genclass_t *tclass; /* Temporary class pointer */ - H5P_genplist_t *plist = NULL; /* Property list created */ - hid_t plist_id = FAIL; /* Property list ID */ - hid_t ret_value; /* return value */ + H5P_genclass_t *tclass; /* Temporary class pointer */ + H5P_genplist_t *plist = NULL; /* Property list created */ + hid_t plist_id = FAIL; /* Property list ID */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2589,162 +2596,449 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_set + H5P__do_prop PURPOSE - Internal routine to set a property's value in a property list. + Internal routine to perform an operation on a property in a property list USAGE - herr_t H5P_set(plist, name, value) + herr_t H5P__do_prop(plist, name, cb, udata) H5P_genplist_t *plist; IN: Property list to find property in const char *name; IN: Name of property to set - void *value; IN: Pointer to the value for the property + H5P_do_plist_op_t plist_op; IN: Pointer to the callback to invoke when the + property is found in the property list + H5P_do_pclass_op_t pclass_op; IN: Pointer to the callback to invoke when the + property is found in the property class + void *udata; IN: Pointer to the user data for the callback RETURNS Returns non-negative on success, negative on failure. DESCRIPTION - Sets a new value for a property in a property list. The property name - must exist or this routine will fail. If there is a 'set' callback routine - registered for this property, the 'value' will be passed to that routine and - any changes to the 'value' will be used when setting the property value. - The information pointed at by the 'value' pointer (possibly modified by the - 'set' callback) is copied into the property list value and may be changed - by the application making the H5Pset call without affecting the property - value. - - If the 'set' callback routine returns an error, the property value will - not be modified. This routine may not be called for zero-sized properties - and will return an error in that case. - + Finds a property in a property list and calls the callback with it. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t -H5P_set(H5P_genplist_t *plist, const char *name, const void *value) +static herr_t +H5P__do_prop(H5P_genplist_t *plist, const char *name, H5P_do_plist_op_t plist_op, + H5P_do_pclass_op_t pclass_op, void *udata) { H5P_genclass_t *tclass; /* Temporary class pointer */ H5P_genprop_t *prop; /* Temporary property pointer */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC + /* Sanity check */ HDassert(plist); HDassert(name); - HDassert(value); + HDassert(plist_op); + HDassert(pclass_op); /* Check if the property has been deleted */ - if(H5SL_search(plist->del,name)!=NULL) + if(NULL != H5SL_search(plist->del, name)) HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist") /* Find property in changed list */ if(NULL != (prop = (H5P_genprop_t *)H5SL_search(plist->props, name))) { - /* Check for property size >0 */ - if(prop->size==0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") - - /* Make a copy of the value and pass to 'set' callback */ - if(prop->set!=NULL) { - void *tmp_value; /* Temporary value for property */ - - /* Make a copy of the current value, in case the callback fails */ - if(NULL==(tmp_value=H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed temporary property value") - HDmemcpy(tmp_value,value,prop->size); - - /* Call user's callback */ - if((*(prop->set))(plist->plist_id,name,prop->size,tmp_value) < 0) { - H5MM_xfree(tmp_value); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") - } /* end if */ - - /* Copy new [possibly unchanged] value into property value */ - HDmemcpy(prop->value,tmp_value,prop->size); - - /* Free the temporary value buffer */ - H5MM_xfree(tmp_value); - } /* end if */ - /* No 'set' callback, just copy value */ - else - HDmemcpy(prop->value,value,prop->size); + /* Call the 'found in propery list' callback */ + if((*plist_op)(plist, name, prop, udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on property") } /* end if */ else { /* * Check if we should set class properties (up through list of parent classes also), * & make property 'set' callback. */ - tclass=plist->pclass; - while(tclass!=NULL) { - if(tclass->nprops>0) { + tclass = plist->pclass; + while(NULL != tclass) { + if(tclass->nprops > 0) { /* Find the property in the class */ - if((prop = (H5P_genprop_t *)H5SL_search(tclass->props,name))!=NULL) { - H5P_genprop_t *pcopy; /* Copy of property to insert into skip list */ - - /* Check for property size >0 */ - if(prop->size==0) - HGOTO_ERROR(H5E_PLIST,H5E_BADVALUE,FAIL,"property has zero size") - - /* Make a copy of the value and pass to 'set' callback */ - if(prop->set!=NULL) { - void *tmp_value; /* Temporary value for property */ - - /* Make a copy of the current value, in case the callback fails */ - if(NULL==(tmp_value=H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed temporary property value") - HDmemcpy(tmp_value,value,prop->size); - - /* Call user's callback */ - if((*(prop->set))(plist->plist_id,name,prop->size,tmp_value) < 0) { - H5MM_xfree(tmp_value); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") - } /* end if */ - - if((prop->cmp)(tmp_value,prop->value,prop->size)) { - /* Make a copy of the class's property */ - if((pcopy=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCOPY,FAIL,"Can't copy property") - - /* Copy new value into property value */ - HDmemcpy(pcopy->value,tmp_value,pcopy->size); - - /* Insert the changed property into the property list */ - if(H5P_add_prop(plist->props,pcopy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") - } /* end if */ - - /* Free the temporary value buffer */ - H5MM_xfree(tmp_value); - } /* end if */ - /* No 'set' callback, just copy value */ - else { - if((prop->cmp)(value,prop->value,prop->size)) { - /* Make a copy of the class's property */ - if((pcopy=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCOPY,FAIL,"Can't copy property") - - HDmemcpy(pcopy->value,value,pcopy->size); - - /* Insert the changed property into the property list */ - if(H5P_add_prop(plist->props,pcopy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") - } /* end if */ - } /* end else */ + if(NULL != (prop = (H5P_genprop_t *)H5SL_search(tclass->props, name))) { + /* Call the 'found in class' callback */ + if((*pclass_op)(plist, name, prop, udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on property") /* Leave */ - HGOTO_DONE(SUCCEED); - } /* end while */ + break; + } /* end if */ } /* end if */ /* Go up to parent class */ - tclass=tclass->parent; + tclass = tclass->parent; } /* end while */ /* If we get this far, then it wasn't in the list of changed properties, * nor in the properties in the class hierarchy, indicate an error */ - HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list") + if(NULL == tclass) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "can't find property in skip list") } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) +} /* H5P__do_prop() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P__poke_plist_cb + PURPOSE + Internal callback for H5P__do_prop, to overwrite a property's value in a property list. + USAGE + herr_t H5P__poke_plist_cb(plist, name, value) + H5P_genplist_t *plist; IN: Property list to overwrite property in + const char *name; IN: Name of property to overwrite + H5P_genprop_t *prop; IN: Property to overwrite + void *udata; IN: User data for operation + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Overwrite a value for a property in a property list. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Called when the property is found in the property list. + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5P__poke_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void *_udata) +{ + H5P_prop_set_ud_t *udata = (H5P_prop_set_ud_t *)_udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(plist); + HDassert(name); + HDassert(prop); + + /* Check for property size >0 */ + if(0 == prop->size) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + + /* Overwrite value in property */ + HDmemcpy(prop->value, udata->value, prop->size); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5P__poke_plist_cb() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P__poke_pclass_cb + PURPOSE + Internal callback for H5P__do_prop, to overwrite a property's value in a property list. + USAGE + herr_t H5P__poke_pclass_cb(plist, name, value) + H5P_genplist_t *plist; IN: Property list to overwrite property in + const char *name; IN: Name of property to overwrite + H5P_genprop_t *prop; IN: Property to overwrite + void *udata; IN: User data for operation + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Overwrite a value for a property in a property list. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Called when the property is found in the property class. + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5P__poke_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void *_udata) +{ + H5P_prop_set_ud_t *udata = (H5P_prop_set_ud_t *)_udata; /* User data for callback */ + H5P_genprop_t *pcopy = NULL; /* Copy of property to insert into skip list */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(plist); + HDassert(name); + HDassert(prop); + HDassert(prop->cmp); + + /* Check for property size >0 */ + if(0 == prop->size) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + + /* Make a copy of the class's property */ + if(NULL == (pcopy = H5P_dup_prop(prop, H5P_PROP_WITHIN_LIST))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") + + HDmemcpy(pcopy->value, udata->value, pcopy->size); + + /* Insert the changed property into the property list */ + if(H5P_add_prop(plist->props, pcopy) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") + +done: + /* Cleanup on failure */ + if(ret_value < 0) + if(pcopy) + H5P_free_prop(pcopy); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5P__poke_pclass_cb() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P_poke + PURPOSE + Internal routine to overwrite a property's value in a property list. + USAGE + herr_t H5P_poke(plist, name, value) + H5P_genplist_t *plist; IN: Property list to find property in + const char *name; IN: Name of property to overwrite + void *value; IN: Pointer to the value for the property + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Overwrites a property in a property list (i.e. a "shallow" copy over + the property value). The property name must exist or this routine will + fail. If there is a setget' callback routine registered for this property, + it is _NOT_ called. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + This routine may not be called for zero-sized properties and will + return an error in that case. + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5P_poke(H5P_genplist_t *plist, const char *name, const void *value) +{ + H5P_prop_set_ud_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(plist); + HDassert(name); + HDassert(value); + + /* Find the property and set the value */ + udata.value = value; + if(H5P__do_prop(plist, name, H5P__poke_plist_cb, H5P__poke_pclass_cb, &udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to overwrite value") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5P_poke() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P__set_plist_cb + PURPOSE + Internal callback for H5P__do_prop, to set a property's value in a property list. + USAGE + herr_t H5P__set_plist_cb(plist, name, value) + H5P_genplist_t *plist; IN: Property list to set property in + const char *name; IN: Name of property to set + H5P_genprop_t *prop; IN: Property to set + void *udata; IN: User data for operation + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Sets a new value for a property in a property list. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Called when the property is found in the property list. + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5P__set_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void *_udata) +{ + H5P_prop_set_ud_t *udata = (H5P_prop_set_ud_t *)_udata; /* User data for callback */ + void *tmp_value = NULL; /* Temporary value for property */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(plist); + HDassert(name); + HDassert(prop); + + /* Check for property size >0 */ + if(0 == prop->size) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + + /* Make a copy of the value and pass to 'set' callback */ + if(NULL != prop->set) { + /* Make a copy of the current value, in case the callback fails */ + if(NULL == (tmp_value = H5MM_malloc(prop->size))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value") + HDmemcpy(tmp_value, udata->value, prop->size); + + /* Call user's callback */ + if((*(prop->set))(plist->plist_id, name, prop->size, tmp_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") + } /* end if */ + /* No 'set' callback, just copy value */ + else + tmp_value = (void *)udata->value; /* Casting away const OK -QAK */ + + /* Free any previous value for the property */ + if(NULL != prop->del) { + /* Call user's 'delete' callback */ + if((*(prop->del))(plist->plist_id, name, prop->size, prop->value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't release property value") + } /* end if */ + + /* Copy new [possibly unchanged] value into property value */ + HDmemcpy(prop->value, tmp_value, prop->size); + +done: + /* Free the temporary value buffer */ + if(tmp_value != NULL && tmp_value != udata->value) + H5MM_xfree(tmp_value); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5P__set_plist_cb() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P__set_pclass_cb + PURPOSE + Internal callback for H5P__do_prop, to set a property's value in a property list. + USAGE + herr_t H5P__set_pclass_cb(plist, name, value) + H5P_genplist_t *plist; IN: Property list to set property in + const char *name; IN: Name of property to set + H5P_genprop_t *prop; IN: Property to set + void *udata; IN: User data for operation + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Sets a new value for a property in a property list. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Called when the property is found in the property class. + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5P__set_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void *_udata) +{ + H5P_prop_set_ud_t *udata = (H5P_prop_set_ud_t *)_udata; /* User data for callback */ + H5P_genprop_t *pcopy = NULL; /* Copy of property to insert into skip list */ + void *tmp_value = NULL; /* Temporary value for property */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(plist); + HDassert(name); + HDassert(prop); + HDassert(prop->cmp); + + /* Check for property size >0 */ + if(0 == prop->size) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + + /* Make a copy of the value and pass to 'set' callback */ + if(NULL != prop->set) { + /* Make a copy of the current value, in case the callback fails */ + if(NULL == (tmp_value = H5MM_malloc(prop->size))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value") + HDmemcpy(tmp_value, udata->value, prop->size); + + /* Call user's callback */ + if((*(prop->set))(plist->plist_id, name, prop->size, tmp_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") + } /* end if */ + /* No 'set' callback, just copy value */ + else + tmp_value = (void *)udata->value; /* Casting away const OK -QAK */ + + /* Make a copy of the class's property */ + if(NULL == (pcopy = H5P_dup_prop(prop, H5P_PROP_WITHIN_LIST))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") + + HDmemcpy(pcopy->value, tmp_value, pcopy->size); + + /* Insert the changed property into the property list */ + if(H5P_add_prop(plist->props, pcopy) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") + +done: + /* Free the temporary value buffer */ + if(tmp_value != NULL && tmp_value != udata->value) + H5MM_xfree(tmp_value); + + /* Cleanup on failure */ + if(ret_value < 0) + if(pcopy) + H5P_free_prop(pcopy); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5P__set_pclass_cb() */ + + +/*-------------------------------------------------------------------------- + NAME + H5P_set + PURPOSE + Internal routine to set a property's value in a property list. + USAGE + herr_t H5P_set(plist, name, value) + H5P_genplist_t *plist; IN: Property list to find property in + const char *name; IN: Name of property to set + void *value; IN: Pointer to the value for the property + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Sets a new value for a property in a property list. The property name + must exist or this routine will fail. If there is a 'set' callback routine + registered for this property, the 'value' will be passed to that routine and + any changes to the 'value' will be used when setting the property value. + The information pointed at by the 'value' pointer (possibly modified by the + 'set' callback) is copied into the property list value and may be changed + by the application making the H5Pset call without affecting the property + value. + + If the 'set' callback routine returns an error, the property value will + not be modified. This routine may not be called for zero-sized properties + and will return an error in that case. + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5P_set(H5P_genplist_t *plist, const char *name, const void *value) +{ + H5P_prop_set_ud_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(plist); + HDassert(name); + HDassert(value); + + /* Find the property and set the value */ + udata.value = value; + if(H5P__do_prop(plist, name, H5P__set_plist_cb, H5P__set_pclass_cb, &udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to set value") + +done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_set() */ @@ -3411,7 +3705,7 @@ done: htri_t H5P_class_isa(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) { - htri_t ret_value; + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3464,7 +3758,7 @@ H5P_isa_class(hid_t plist_id, hid_t pclass_id) { H5P_genplist_t *plist; /* Property list to query */ H5P_genclass_t *pclass; /* Property list class */ - htri_t ret_value; /* return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -3514,7 +3808,7 @@ done: H5P_genplist_t * H5P_object_verify(hid_t plist_id, hid_t pclass_id) { - H5P_genplist_t *ret_value; /* return value */ + H5P_genplist_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -3884,330 +4178,359 @@ done: /*-------------------------------------------------------------------------- NAME - H5P_peek_unsigned + H5P__peek_cb PURPOSE - Internal routine to quickly retrieve the value of a property in a property list. + Internal callback for H5P__do_prop, to peek at a property's value in a property list. USAGE - int H5P_peek_unsigned(plist, name) - H5P_genplist_t *plist; IN: Property list to check - const char *name; IN: Name of property to query + herr_t H5P__peek_plist_cb(plist, name, value) + H5P_genplist_t *plist; IN: Property list to peek property in + const char *name; IN: Name of property to peek + H5P_genprop_t *prop; IN: Property to peek + void *udata; IN: User data for operation RETURNS - Directly returns the value of the property in the list + Returns non-negative on success, negative on failure. DESCRIPTION - This function directly returns the value of a property in a property - list. Because this function is only able to just copy a particular property - value to the return value, there is no way to check for errors. We attempt - to make certain that bad things don't happen by validating that the size of - the property is the same as the size of the return type, but that can't - catch all errors. - This function does call the user's 'get' callback routine still. - + Peeks at a new value for a property in a property list. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS - No error checking! - Use with caution! + Called when the property is found in the property list and when it's found + for the property class. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -unsigned -H5P_peek_unsigned(H5P_genplist_t *plist, const char *name) +static herr_t +H5P__peek_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void *_udata) { - unsigned ret_value; /* return value */ + H5P_prop_get_ud_t *udata = (H5P_prop_get_ud_t *)_udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(UFAIL) + FUNC_ENTER_STATIC + /* Sanity check */ HDassert(plist); HDassert(name); + HDassert(prop); - /* Get the value to return, don't worry about the return value, we can't return it */ - H5P_get(plist,name,&ret_value); + /* Check for property size >0 */ + if(0 == prop->size) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + + /* Make a (shallow) copy of the value */ + HDmemcpy(udata->value, prop->value, prop->size); done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_peek_unsigned() */ +} /* H5P__peek_cb() */ /*-------------------------------------------------------------------------- NAME - H5P_peek_hid_t + H5P_peek PURPOSE - Internal routine to quickly retrieve the value of a property in a property list. + Internal routine to look at the value of a property in a property list. USAGE - hid_t H5P_peek_hid_t(plist, name) + herr_t H5P_peek(plist, name, value) H5P_genplist_t *plist; IN: Property list to check const char *name; IN: Name of property to query + void *value; OUT: Pointer to the buffer for the property value RETURNS - Directly returns the value of the property in the list + Returns non-negative on success, negative on failure. DESCRIPTION - This function directly returns the value of a property in a property - list. Because this function is only able to just copy a particular property - value to the return value, there is no way to check for errors. We attempt - to make certain that bad things don't happen by validating that the size of - the property is the same as the size of the return type, but that can't - catch all errors. - This function does call the user's 'get' callback routine still. - + Retrieves a "shallow" copy of the value for a property in a property + list. The property name must exist or this routine will fail. If there + is a 'get' callback routine registered for this property, it is _NOT_ + called. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS - No error checking! - Use with caution! + This routine may not be called for zero-sized properties and will + return an error in that case. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -hid_t -H5P_peek_hid_t(H5P_genplist_t *plist, const char *name) +herr_t +H5P_peek(H5P_genplist_t *plist, const char *name, void *value) { - hid_t ret_value; /* return value */ + H5P_prop_get_ud_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* Sanity check */ HDassert(plist); HDassert(name); + HDassert(value); - /* Get the value to return, don't worry about the return value, we can't return it */ - H5P_get(plist,name,&ret_value); + /* Find the property and peek at the value */ + udata.value = value; + if(H5P__do_prop(plist, name, H5P__peek_cb, H5P__peek_cb, &udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to peek at value") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_peek_hid_t() */ +} /* H5P_peek() */ /*-------------------------------------------------------------------------- NAME - H5P_peek_voidp + H5P__get_cb PURPOSE - Internal routine to quickly retrieve the value of a property in a property list. + Internal callback for H5P__do_prop, to get a property's value in a property list. USAGE - void *H5P_peek_voidp(plist, name) - H5P_genplist_t *plist; IN: Property list to check - const char *name; IN: Name of property to query + herr_t H5P__get_plist_cb(plist, name, value) + H5P_genplist_t *plist; IN: Property list to get property in + const char *name; IN: Name of property to get + H5P_genprop_t *prop; IN: Property to get + void *udata; IN: User data for operation RETURNS - Directly returns the value of the property in the list + Returns non-negative on success, negative on failure. DESCRIPTION - This function directly returns the value of a property in a property - list. Because this function is only able to just copy a particular property - value to the return value, there is no way to check for errors. We attempt - to make certain that bad things don't happen by validating that the size of - the property is the same as the size of the return type, but that can't - catch all errors. - This function does call the user's 'get' callback routine still. - + Gets a new value for a property in a property list. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS - No error checking! - Use with caution! + Called when the property is found in the property list and when it's found + for the property class. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -void * -H5P_peek_voidp(H5P_genplist_t *plist, const char *name) +static herr_t +H5P__get_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void *_udata) { - void * ret_value; /* return value */ + H5P_prop_get_ud_t *udata = (H5P_prop_get_ud_t *)_udata; /* User data for callback */ + void *tmp_value = NULL; /* Temporary value for property */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC + /* Sanity check */ HDassert(plist); HDassert(name); + HDassert(prop); - /* Get the value to return, don't worry about the return value, we can't return it */ - H5P_get(plist,name,&ret_value); + /* Check for property size >0 */ + if(0 == prop->size) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + + /* Call the 'get' callback, if there is one */ + if(NULL != prop->get) { + /* Make a copy of the current value, in case the callback fails */ + if(NULL == (tmp_value = H5MM_malloc(prop->size))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value") + HDmemcpy(tmp_value, prop->value, prop->size); + + /* Call user's callback */ + if((*(prop->get))(plist->plist_id, name, prop->size, tmp_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") + + /* Copy new [possibly unchanged] value into return value */ + HDmemcpy(udata->value, tmp_value, prop->size); + } /* end if */ + /* No 'get' callback, just copy value */ + else + HDmemcpy(udata->value, prop->value, prop->size); done: + /* Free the temporary value buffer */ + if(tmp_value) + H5MM_xfree(tmp_value); + FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_peek_voidp() */ +} /* H5P__get_cb() */ /*-------------------------------------------------------------------------- NAME - H5P_peek_size_t + H5P_get PURPOSE - Internal routine to quickly retrieve the value of a property in a property list. + Internal routine to query the value of a property in a property list. USAGE - hsize_t H5P_peek_size_t(plist, name) + herr_t H5P_get(plist, name, value) H5P_genplist_t *plist; IN: Property list to check const char *name; IN: Name of property to query + void *value; OUT: Pointer to the buffer for the property value RETURNS - Directly returns the value of the property in the list + Returns non-negative on success, negative on failure. DESCRIPTION - This function directly returns the value of a property in a property - list. Because this function is only able to just copy a particular property - value to the return value, there is no way to check for errors. We attempt - to make certain that bad things don't happen by validating that the size of - the property is the same as the size of the return type, but that can't - catch all errors. - This function does call the user's 'get' callback routine still. + Retrieves a copy of the value for a property in a property list. The + property name must exist or this routine will fail. If there is a + 'get' callback routine registered for this property, the copy of the + value of the property will first be passed to that routine and any changes + to the copy of the value will be used when returning the property value + from this routine. + If the 'get' callback routine returns an error, 'value' will not be + modified and this routine will return an error. This routine may not be + called for zero-sized properties. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS - No error checking! - Use with caution! EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -size_t -H5P_peek_size_t(H5P_genplist_t *plist, const char *name) +herr_t +H5P_get(H5P_genplist_t *plist, const char *name, void *value) { - size_t ret_value; /* return value */ + H5P_prop_get_ud_t udata; /* User data for callback */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(UFAIL) + FUNC_ENTER_NOAPI(FAIL) + /* Sanity check */ HDassert(plist); HDassert(name); + HDassert(value); - /* Get the value to return, don't worry about the return value, we can't return it */ - H5P_get(plist,name,&ret_value); + /* Find the property and get the value */ + udata.value = value; + if(H5P__do_prop(plist, name, H5P__get_cb, H5P__get_cb, &udata) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to get value") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_peek_size_t() */ +} /* H5P_get() */ /*-------------------------------------------------------------------------- NAME - H5P_get + H5P__del_plist_cb PURPOSE - Internal routine to query the value of a property in a property list. + Internal callback for H5P__do_prop, to remove a property's value in a property list. USAGE - herr_t H5P_get(plist, name, value) - H5P_genplist_t *plist; IN: Property list to check - const char *name; IN: Name of property to query - void *value; OUT: Pointer to the buffer for the property value + herr_t H5P__del_plist_cb(plist, name, value) + H5P_genplist_t *plist; IN: Property list to remove property from + const char *name; IN: Name of property to remove + H5P_genprop_t *prop; IN: Property to remove + void *udata; IN: User data for operation RETURNS Returns non-negative on success, negative on failure. DESCRIPTION - Retrieves a copy of the value for a property in a property list. The - property name must exist or this routine will fail. If there is a - 'get' callback routine registered for this property, the copy of the - value of the property will first be passed to that routine and any changes - to the copy of the value will be used when returning the property value - from this routine. - If the 'get' callback routine returns an error, 'value' will not be - modified and this routine will return an error. This routine may not be - called for zero-sized properties. - + Remove a property in a property list. Called when the + property is found in the property list. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t -H5P_get(const H5P_genplist_t *plist, const char *name, void *value) +static herr_t +H5P__del_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void H5_ATTR_UNUSED *_udata) { - H5P_genclass_t *tclass; /* Temporary class pointer */ - H5P_genprop_t *prop; /* Temporary property pointer */ - herr_t ret_value=SUCCEED; /* Return value */ + char *del_name = NULL; /* Pointer to deleted name */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC + /* Sanity check */ HDassert(plist); HDassert(name); - HDassert(value); + HDassert(prop); - /* Check if the property has been deleted */ - if(H5SL_search(plist->del,name)!=NULL) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist") + /* Pass value to 'close' callback, if it exists */ + if(NULL != prop->del) { + /* Call user's callback */ + if((*(prop->del))(plist->plist_id, name, prop->size, prop->value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't release property value") + } /* end if */ - /* Find property */ - if((prop = (H5P_genprop_t *)H5SL_search(plist->props,name))!=NULL) { - /* Check for property size >0 */ - if(prop->size==0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + /* Duplicate string for insertion into new deleted property skip list */ + if(NULL == (del_name = H5MM_xstrdup(name))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed") - /* Make a copy of the value and pass to 'get' callback */ - if(prop->get!=NULL) { - void *tmp_value; /* Temporary value for property */ + /* Insert property name into deleted list */ + if(H5SL_insert(plist->del, del_name, del_name) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into deleted skip list") - /* Make a copy of the current value, in case the callback fails */ - if(NULL==(tmp_value=H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed temporary property value") - HDmemcpy(tmp_value,prop->value,prop->size); + /* Remove the property from the skip list */ + if(NULL == H5SL_remove(plist->props, prop->name)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove property from skip list") - /* Call user's callback */ - if((*(prop->get))(plist->plist_id,name,prop->size,tmp_value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't get property value") + /* Free the property, ignoring return value, nothing we can do */ + H5P_free_prop(prop); - /* Copy new [possibly unchanged] value into return value */ - HDmemcpy(value,tmp_value,prop->size); + /* Decrement the number of properties in list */ + plist->nprops--; - /* Free the temporary value buffer */ - H5MM_xfree(tmp_value); - } /* end if */ - /* No 'get' callback, just copy value */ - else - HDmemcpy(value,prop->value,prop->size); - } /* end if */ - else { - /* - * Check if we should get class properties (up through list of parent classes also), - * & make property 'get' callback. - */ - tclass=plist->pclass; - while(tclass!=NULL) { - if(tclass->nprops>0) { - /* Find the property in the class */ - if((prop = (H5P_genprop_t *)H5SL_search(tclass->props,name))!=NULL) { - /* Check for property size >0 */ - if(prop->size==0) - HGOTO_ERROR(H5E_PLIST,H5E_BADVALUE,FAIL,"property has zero size") - - /* Call the 'get' callback, if there is one */ - if(prop->get!=NULL) { - void *tmp_value; /* Temporary value for property */ +done: + /* Error cleanup */ + if(ret_value < 0) + if(del_name) + H5MM_xfree(del_name); - /* Make a copy of the current value, in case the callback fails */ - if(NULL==(tmp_value=H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed temporary property value") - HDmemcpy(tmp_value,prop->value,prop->size); + FUNC_LEAVE_NOAPI(ret_value) +} /* H5P__del_plist_cb() */ - /* Call user's callback */ - if((*(prop->get))(plist->plist_id,name,prop->size,tmp_value) < 0) { - H5MM_xfree(tmp_value); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") - } /* end if */ + +/*-------------------------------------------------------------------------- + NAME + H5P__del_pclass_cb + PURPOSE + Internal callback for H5P__do_prop, to remove a property's value in a property list. + USAGE + herr_t H5P__del_pclass_cb(plist, name, value) + H5P_genplist_t *plist; IN: Property list to remove property from + const char *name; IN: Name of property to remove + H5P_genprop_t *prop; IN: Property to remove + void *udata; IN: User data for operation + RETURNS + Returns non-negative on success, negative on failure. + DESCRIPTION + Remove a property in a property list. Called when the + property is found in the property class. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5P__del_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, + void H5_ATTR_UNUSED *_udata) +{ + char *del_name = NULL; /* Pointer to deleted name */ + void *tmp_value = NULL; /* Temporary value for property */ + herr_t ret_value = SUCCEED; /* Return value */ - if((prop->cmp)(tmp_value,prop->value,prop->size)) { - H5P_genprop_t *pcopy; /* Copy of property to insert into skip list */ + FUNC_ENTER_STATIC - /* Make a copy of the class's property */ - if((pcopy=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTCOPY,FAIL,"Can't copy property") + /* Sanity check */ + HDassert(plist); + HDassert(name); + HDassert(prop); - /* Copy new value into property value */ - HDmemcpy(pcopy->value,tmp_value,prop->size); + /* Pass value to 'del' callback, if it exists */ + if(NULL != prop->del) { + /* Allocate space for a temporary copy of the property value */ + if(NULL == (tmp_value = H5MM_malloc(prop->size))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary property value") + HDmemcpy(tmp_value, prop->value, prop->size); - /* Insert the changed property into the property list */ - if(H5P_add_prop(plist->props,pcopy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,"Can't insert changed property into skip list") - } /* end if */ + /* Call user's callback */ + if((*(prop->del))(plist->plist_id, name, prop->size, tmp_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't close property value") + } /* end if */ - /* Copy new [possibly unchanged] value into return value */ - HDmemcpy(value,tmp_value,prop->size); + /* Duplicate string for insertion into new deleted property skip list */ + if(NULL == (del_name = H5MM_xstrdup(name))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed") - /* Free the temporary value buffer */ - H5MM_xfree(tmp_value); - } /* end if */ - /* No 'get' callback, just copy value */ - else - HDmemcpy(value,prop->value,prop->size); + /* Insert property name into deleted list */ + if(H5SL_insert(plist->del, del_name, del_name) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into deleted skip list") - /* Leave */ - HGOTO_DONE(SUCCEED); - } /* end while */ - } /* end if */ + /* Decrement the number of properties in list */ + plist->nprops--; - /* Go up to parent class */ - tclass=tclass->parent; - } /* end while */ +done: + /* Free the temporary value buffer */ + if(tmp_value) + H5MM_xfree(tmp_value); - /* If we get this far, then it wasn't in the list of changed properties, - * nor in the properties in the class hierarchy, indicate an error - */ - HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list") - } /* end else */ + /* Error cleanup */ + if(ret_value < 0) + if(del_name) + H5MM_xfree(del_name); -done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_get() */ +} /* H5P__del_pclass_cb() */ /*-------------------------------------------------------------------------- @@ -4237,104 +4560,19 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name) +H5P_remove(H5P_genplist_t *plist, const char *name) { - H5P_genclass_t *tclass; /* Temporary class pointer */ - H5P_genprop_t *prop; /* Temporary property pointer */ - char *del_name; /* Pointer to deleted name */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + /* Sanity check */ HDassert(plist); HDassert(name); - /* Indicate that the property isn't in the list if it has been deleted already */ - if(H5SL_search(plist->del,name)!=NULL) - HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list") - - /* Get the property node from the changed property skip list */ - if((prop = (H5P_genprop_t *)H5SL_search(plist->props,name))!=NULL) { - /* Pass value to 'close' callback, if it exists */ - if(prop->del!=NULL) { - /* Call user's callback */ - if((*(prop->del))(plist_id,name,prop->size,prop->value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't close property value") - } /* end if */ - - /* Duplicate string for insertion into new deleted property skip list */ - if((del_name=H5MM_xstrdup(name)) == NULL) - HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,FAIL,"memory allocation failed") - - /* Insert property name into deleted list */ - if(H5SL_insert(plist->del,del_name,del_name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into deleted skip list") - - /* Remove the property from the skip list */ - if(H5SL_remove(plist->props,prop->name) == NULL) - HGOTO_ERROR(H5E_PLIST,H5E_CANTDELETE,FAIL,"can't remove property from skip list") - - /* Free the property, ignoring return value, nothing we can do */ - H5P_free_prop(prop); - - /* Decrement the number of properties in list */ - plist->nprops--; - } /* end if */ - /* Walk through all the properties in the class hierarchy, looking for the property */ - else { - /* - * Check if we should delete class properties (up through list of parent classes also), - * & make property 'delete' callback. - */ - tclass=plist->pclass; - while(tclass!=NULL) { - if(tclass->nprops>0) { - /* Find the property in the class */ - if((prop=H5P_find_prop_pclass(tclass,name))!=NULL) { - /* Pass value to 'del' callback, if it exists */ - if(prop->del!=NULL) { - void *tmp_value; /* Temporary value buffer */ - - /* Allocate space for a temporary copy of the property value */ - if(NULL==(tmp_value=H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for temporary property value") - HDmemcpy(tmp_value,prop->value,prop->size); - - /* Call user's callback */ - if((*(prop->del))(plist_id,name,prop->size,tmp_value) < 0) { - H5MM_xfree(tmp_value); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't close property value") - } /* end if */ - - /* Release the temporary value buffer */ - H5MM_xfree(tmp_value); - } /* end if */ - - /* Duplicate string for insertion into new deleted property skip list */ - if((del_name=H5MM_xstrdup(name)) == NULL) - HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,FAIL,"memory allocation failed") - - /* Insert property name into deleted list */ - if(H5SL_insert(plist->del,del_name,del_name) < 0) - HGOTO_ERROR(H5E_PLIST,H5E_CANTINSERT,FAIL,"can't insert property into deleted skip list") - - /* Decrement the number of properties in list */ - plist->nprops--; - - /* Leave */ - HGOTO_DONE(SUCCEED); - } /* end while */ - } /* end if */ - - /* Go up to parent class */ - tclass=tclass->parent; - } /* end while */ - - /* If we get this far, then it wasn't in the list of changed properties, - * nor in the properties in the class hierarchy, indicate an error - */ - HGOTO_ERROR(H5E_PLIST,H5E_NOTFOUND,FAIL,"can't find property in skip list") - } /* end else */ + /* Find the property and get the value */ + if(H5P__do_prop(plist, name, H5P__del_plist_cb, H5P__del_pclass_cb, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to remove value") done: FUNC_LEAVE_NOAPI(ret_value) @@ -4392,7 +4630,7 @@ H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) /* If the property exists in the destination alread */ if(NULL != H5P__find_prop_plist(dst_plist, name)) { /* Delete the property from the destination list, calling the 'close' callback if necessary */ - if(H5P_remove(dst_id,dst_plist,name) < 0) + if(H5P_remove(dst_plist, name) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property") /* Get the pointer to the source property */ @@ -4787,7 +5025,7 @@ done: char * H5P_get_class_name(H5P_genclass_t *pclass) { - char *ret_value; /* return value */ + char *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -4825,7 +5063,7 @@ done: char * H5P_get_class_path(H5P_genclass_t *pclass) { - char *ret_value; /* return value */ + char *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -4891,7 +5129,7 @@ H5P_open_class_path(const char *path) char *delimit; /* Pointer to path delimiter during traversal */ H5P_genclass_t *curr_class; /* Pointer to class during path traversal */ H5P_check_class_t check_info; /* Structure to hold the information for checking duplicate names */ - H5P_genclass_t *ret_value; /* Return value */ + H5P_genclass_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -4971,7 +5209,7 @@ done: H5P_genclass_t * H5P_get_class_parent(const H5P_genclass_t *pclass) { - H5P_genclass_t *ret_value; /* return value */ + H5P_genclass_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -5038,7 +5276,7 @@ H5P__new_plist_of_type(H5P_plist_type_t type) { H5P_genclass_t *pclass; /* Class of property list to create */ hid_t class_id; /* ID of class to create */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5Plapl.c b/src/H5Plapl.c index ed81acb..b311238 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -27,7 +27,9 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ + /***********/ /* Headers */ @@ -55,22 +57,26 @@ /* Definitions for external link prefix */ #define H5L_ACS_ELINK_PREFIX_SIZE sizeof(char *) #define H5L_ACS_ELINK_PREFIX_DEF NULL /*default is no prefix */ -#define H5L_ACS_ELINK_PREFIX_ENC H5P_lacc_elink_pref_enc -#define H5L_ACS_ELINK_PREFIX_DEC H5P_lacc_elink_pref_dec -#define H5L_ACS_ELINK_PREFIX_DEL H5P_lacc_elink_pref_del -#define H5L_ACS_ELINK_PREFIX_COPY H5P_lacc_elink_pref_copy -#define H5L_ACS_ELINK_PREFIX_CMP H5P_lacc_elink_pref_cmp -#define H5L_ACS_ELINK_PREFIX_CLOSE H5P_lacc_elink_pref_close +#define H5L_ACS_ELINK_PREFIX_SET H5P__lacc_elink_pref_set +#define H5L_ACS_ELINK_PREFIX_GET H5P__lacc_elink_pref_get +#define H5L_ACS_ELINK_PREFIX_ENC H5P__lacc_elink_pref_enc +#define H5L_ACS_ELINK_PREFIX_DEC H5P__lacc_elink_pref_dec +#define H5L_ACS_ELINK_PREFIX_DEL H5P__lacc_elink_pref_del +#define H5L_ACS_ELINK_PREFIX_COPY H5P__lacc_elink_pref_copy +#define H5L_ACS_ELINK_PREFIX_CMP H5P__lacc_elink_pref_cmp +#define H5L_ACS_ELINK_PREFIX_CLOSE H5P__lacc_elink_pref_close /* Definitions for setting fapl of external link access */ #define H5L_ACS_ELINK_FAPL_SIZE sizeof(hid_t) #define H5L_ACS_ELINK_FAPL_DEF H5P_DEFAULT -#define H5L_ACS_ELINK_FAPL_ENC H5P_lacc_elink_fapl_enc -#define H5L_ACS_ELINK_FAPL_DEC H5P_lacc_elink_fapl_dec -#define H5L_ACS_ELINK_FAPL_DEL H5P_lacc_elink_fapl_del -#define H5L_ACS_ELINK_FAPL_COPY H5P_lacc_elink_fapl_copy -#define H5L_ACS_ELINK_FAPL_CMP H5P_lacc_elink_fapl_cmp -#define H5L_ACS_ELINK_FAPL_CLOSE H5P_lacc_elink_fapl_close +#define H5L_ACS_ELINK_FAPL_SET H5P__lacc_elink_fapl_set +#define H5L_ACS_ELINK_FAPL_GET H5P__lacc_elink_fapl_get +#define H5L_ACS_ELINK_FAPL_ENC H5P__lacc_elink_fapl_enc +#define H5L_ACS_ELINK_FAPL_DEC H5P__lacc_elink_fapl_dec +#define H5L_ACS_ELINK_FAPL_DEL H5P__lacc_elink_fapl_del +#define H5L_ACS_ELINK_FAPL_COPY H5P__lacc_elink_fapl_copy +#define H5L_ACS_ELINK_FAPL_CMP H5P__lacc_elink_fapl_cmp +#define H5L_ACS_ELINK_FAPL_CLOSE H5P__lacc_elink_fapl_close /* Definitions for file access flags for external link traversal */ #define H5L_ACS_ELINK_FLAGS_SIZE sizeof(unsigned) @@ -103,21 +109,25 @@ /********************/ /* Property class callbacks */ -static herr_t H5P_lacc_reg_prop(H5P_genclass_t *pclass); +static herr_t H5P__lacc_reg_prop(H5P_genclass_t *pclass); /* Property list callbacks */ -static herr_t H5P_lacc_elink_pref_enc(const void *value, void **_pp, size_t *size); -static herr_t H5P_lacc_elink_pref_dec(const void **_pp, void *value); -static herr_t H5P_lacc_elink_pref_del(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P_lacc_elink_pref_copy(const char* name, size_t size, void* value); -static int H5P_lacc_elink_pref_cmp(const void *value1, const void *value2, size_t size); -static herr_t H5P_lacc_elink_pref_close(const char* name, size_t size, void* value); -static herr_t H5P_lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size); -static herr_t H5P_lacc_elink_fapl_dec(const void **_pp, void *value); -static herr_t H5P_lacc_elink_fapl_del(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P_lacc_elink_fapl_copy(const char* name, size_t size, void* value); -static int H5P_lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t size); -static herr_t H5P_lacc_elink_fapl_close(const char* name, size_t size, void* value); +static herr_t H5P__lacc_elink_pref_set(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__lacc_elink_pref_get(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__lacc_elink_pref_dec(const void **_pp, void *value); +static herr_t H5P__lacc_elink_pref_del(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__lacc_elink_pref_copy(const char* name, size_t size, void* value); +static int H5P__lacc_elink_pref_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__lacc_elink_pref_close(const char* name, size_t size, void* value); +static herr_t H5P__lacc_elink_fapl_set(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__lacc_elink_fapl_get(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__lacc_elink_fapl_dec(const void **_pp, void *value); +static herr_t H5P__lacc_elink_fapl_del(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__lacc_elink_fapl_copy(const char* name, size_t size, void* value); +static int H5P__lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__lacc_elink_fapl_close(const char* name, size_t size, void* value); /*********************/ @@ -133,7 +143,7 @@ const H5P_libclass_t H5P_CLS_LACC[1] = {{ &H5P_CLS_LINK_ACCESS_g, /* Pointer to class */ &H5P_CLS_LINK_ACCESS_ID_g, /* Pointer to class ID */ &H5P_LST_LINK_ACCESS_ID_g, /* Pointer to default property list ID */ - H5P_lacc_reg_prop, /* Default property registration routine */ + H5P__lacc_reg_prop, /* Default property registration routine */ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ @@ -163,7 +173,7 @@ static const H5P_coll_md_read_flag_t H5L_def_coll_md_read_g = H5L_ACS_COLL_MD_RE /*------------------------------------------------------------------------- - * Function: H5P_lacc_reg_prop + * Function: H5P__lacc_reg_prop * * Purpose: Register the dataset creation property list class's properties * @@ -172,18 +182,14 @@ static const H5P_coll_md_read_flag_t H5L_def_coll_md_read_g = H5L_ACS_COLL_MD_RE * Programmer: Quincey Koziol * October 31, 2006 * - * Modifications: - * Vailin Choi, Sept. 12th 2008 - * Register the setting of file access property list for link access - * *------------------------------------------------------------------------- */ static herr_t -H5P_lacc_reg_prop(H5P_genclass_t *pclass) +H5P__lacc_reg_prop(H5P_genclass_t *pclass) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Register property for number of links traversed */ if(H5P_register_real(pclass, H5L_ACS_NLINKS_NAME, H5L_ACS_NLINKS_SIZE, &H5L_def_nlinks_g, @@ -193,13 +199,13 @@ H5P_lacc_reg_prop(H5P_genclass_t *pclass) /* Register property for external link prefix */ if(H5P_register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, &H5L_def_elink_prefix_g, - NULL, NULL, NULL, H5L_ACS_ELINK_PREFIX_ENC, H5L_ACS_ELINK_PREFIX_DEC, + NULL, H5L_ACS_ELINK_PREFIX_SET, H5L_ACS_ELINK_PREFIX_GET, H5L_ACS_ELINK_PREFIX_ENC, H5L_ACS_ELINK_PREFIX_DEC, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, H5L_ACS_ELINK_PREFIX_CMP, H5L_ACS_ELINK_PREFIX_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register fapl for link access */ if(H5P_register_real(pclass, H5L_ACS_ELINK_FAPL_NAME, H5L_ACS_ELINK_FAPL_SIZE, &H5L_def_fapl_id_g, - NULL, NULL, NULL, H5L_ACS_ELINK_FAPL_ENC, H5L_ACS_ELINK_FAPL_DEC, + NULL, H5L_ACS_ELINK_FAPL_SET, H5L_ACS_ELINK_FAPL_GET, H5L_ACS_ELINK_FAPL_ENC, H5L_ACS_ELINK_FAPL_DEC, H5L_ACS_ELINK_FAPL_DEL, H5L_ACS_ELINK_FAPL_COPY, H5L_ACS_ELINK_FAPL_CMP, H5L_ACS_ELINK_FAPL_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -224,11 +230,97 @@ H5P_lacc_reg_prop(H5P_genclass_t *pclass) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lacc_reg_prop() */ +} /* end H5P__lacc_reg_prop() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__lacc_elink_fapl_set + * + * Purpose: Copies an external link FAPL property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, Sept 2, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__lacc_elink_fapl_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + hid_t l_fapl_id; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Get the FAPL ID */ + l_fapl_id = *(const hid_t *)value; + + /* Duplicate the FAPL, if it's non-default */ + if(l_fapl_id != H5P_DEFAULT) { + H5P_genplist_t *l_fapl_plist; + + if(NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") + if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__lacc_elink_fapl_set() */ /*------------------------------------------------------------------------- - * Function: H5P_lacc_elink_fapl_enc + * Function: H5P__lacc_elink_fapl_get + * + * Purpose: Copies an external link FAPL property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, Sept 2, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__lacc_elink_fapl_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + hid_t l_fapl_id; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Get the FAPL ID */ + l_fapl_id = *(const hid_t *)value; + + /* Duplicate the FAPL, if it's non-default */ + if(l_fapl_id != H5P_DEFAULT) { + H5P_genplist_t *l_fapl_plist; + + if(NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") + if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__lacc_elink_fapl_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__lacc_elink_fapl_enc * * Purpose: Callback routine which is called whenever the elink FAPL * property in the dataset access property list is @@ -243,7 +335,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P_lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) +H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) { const hid_t *elink_fapl = (const hid_t *)value; /* Property to encode */ uint8_t **pp = (uint8_t **)_pp; @@ -252,7 +344,7 @@ H5P_lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) size_t fapl_size = 0; /* FAPL's encoded size */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check for non-default FAPL */ if(*elink_fapl != H5P_DEFAULT) { @@ -296,11 +388,11 @@ H5P_lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lacc_elink_fapl_enc() */ +} /* end H5P__lacc_elink_fapl_enc() */ /*------------------------------------------------------------------------- - * Function: H5P_lacc_elink_fapl_dec + * Function: H5P__lacc_elink_fapl_dec * * Purpose: Callback routine which is called whenever the elink FAPL * property in the dataset access property list is @@ -315,15 +407,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P_lacc_elink_fapl_dec(const void **_pp, void *_value) +H5P__lacc_elink_fapl_dec(const void **_pp, void *_value) { hid_t *elink_fapl = (hid_t *)_value; /* The elink FAPL value */ const uint8_t **pp = (const uint8_t **)_pp; hbool_t non_default_fapl; /* Whether the FAPL is non-default */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC + /* Sanity check */ HDassert(pp); HDassert(*pp); HDassert(elink_fapl); @@ -354,11 +447,11 @@ H5P_lacc_elink_fapl_dec(const void **_pp, void *_value) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lacc_elink_fapl_dec() */ +} /* end H5P__lacc_elink_fapl_dec() */ /*-------------------------------------------------------------------------- - * Function: H5P_lacc_elink_fapl_del + * Function: H5P__lacc_elink_fapl_del * * Purpose: Close the FAPL for link access * @@ -372,27 +465,30 @@ done: */ /* ARGSUSED */ static herr_t -H5P_lacc_elink_fapl_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__lacc_elink_fapl_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { hid_t l_fapl_id; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC + /* Sanity check */ HDassert(value); + /* Get the FAPL ID */ l_fapl_id = (*(const hid_t *)value); - if((l_fapl_id > H5P_DEFAULT) && (H5I_dec_ref(l_fapl_id) < 0)) + /* Close the FAPL */ + if(l_fapl_id != H5P_DEFAULT && H5I_dec_ref(l_fapl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lacc_elink_fapl_del() */ +} /* end H5P__lacc_elink_fapl_del() */ /*-------------------------------------------------------------------------- - * Function: H5P_lacc_elink_fapl_copy + * Function: H5P__lacc_elink_fapl_copy * * Purpose: Copy the FAPL for link access * @@ -406,34 +502,36 @@ done: */ /* ARGSUSED */ static herr_t -H5P_lacc_elink_fapl_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__lacc_elink_fapl_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { hid_t l_fapl_id; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC + /* Sanity check */ HDassert(value); + /* Get the FAPL ID */ l_fapl_id = (*(const hid_t *)value); - if(l_fapl_id > H5P_DEFAULT) { + /* Duplicate the FAPL, if it's non-default */ + if(l_fapl_id != H5P_DEFAULT) { H5P_genplist_t *l_fapl_plist; if(NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") - + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") if(((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to copy file access properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lacc_elink_fapl_copy() */ +} /* end H5P__lacc_elink_fapl_copy() */ /*------------------------------------------------------------------------- - * Function: H5P_lacc_elink_fapl_cmp + * Function: H5P__lacc_elink_fapl_cmp * * Purpose: Callback routine which is called whenever the elink FAPL * property in the link access property list is @@ -447,14 +545,14 @@ done: *------------------------------------------------------------------------- */ static int -H5P_lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size) +H5P__lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size) { const hid_t *fapl1 = (const hid_t *)value1; const hid_t *fapl2 = (const hid_t *)value2; H5P_genplist_t *obj1, *obj2; /* Property lists to compare */ int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check for comparison with default value */ if(*fapl1 == 0 && *fapl2 > 0) HGOTO_DONE(1); @@ -476,11 +574,11 @@ H5P_lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t H5_ATTR_U done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lacc_elink_fapl_cmp() */ +} /* end H5P__lacc_elink_fapl_cmp() */ /*-------------------------------------------------------------------------- - * Function: H5P_lacc_elink_fapl_close + * Function: H5P__lacc_elink_fapl_close * * Purpose: Close the FAPL for link access * @@ -494,26 +592,88 @@ done: */ /* ARGSUSED */ static herr_t -H5P_lacc_elink_fapl_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__lacc_elink_fapl_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { hid_t l_fapl_id; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC + /* Sanity check */ HDassert(value); + /* Get the FAPL ID */ l_fapl_id = (*(const hid_t *)value); + + /* Close the FAPL */ if((l_fapl_id > H5P_DEFAULT) && (H5I_dec_ref(l_fapl_id) < 0)) HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lacc_elink_fapl_close() */ +} /* end H5P__lacc_elink_fapl_close() */ /*------------------------------------------------------------------------- - * Function: H5P_lacc_elink_pref_enc + * Function: H5P__lacc_elink_pref_set + * + * Purpose: Copies an external link prefix property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, Sept 2, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__lacc_elink_pref_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(value); + + /* Copy the prefix */ + *(char **)value = H5MM_xstrdup(*(const char **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__lacc_elink_pref_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__lacc_elink_pref_get + * + * Purpose: Copies an external link prefix property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, Sept 2, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__lacc_elink_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(value); + + /* Copy the prefix */ + *(char **)value = H5MM_xstrdup(*(const char **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__lacc_elink_pref_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__lacc_elink_pref_enc * * Purpose: Callback routine which is called whenever the elink flags * property in the dataset access property list is @@ -528,7 +688,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P_lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) +H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) { const char *elink_pref = *(const char * const *)value; uint8_t **pp = (uint8_t **)_pp; @@ -536,7 +696,7 @@ H5P_lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) uint64_t enc_value; unsigned enc_size; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); @@ -565,11 +725,11 @@ H5P_lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) *size += len; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_lacc_elink_pref_enc() */ +} /* end H5P__lacc_elink_pref_enc() */ /*------------------------------------------------------------------------- - * Function: H5P_lacc_elink_pref_dec + * Function: H5P__lacc_elink_pref_dec * * Purpose: Callback routine which is called whenever the elink prefix * property in the dataset access property list is @@ -584,7 +744,7 @@ H5P_lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) *------------------------------------------------------------------------- */ static herr_t -H5P_lacc_elink_pref_dec(const void **_pp, void *_value) +H5P__lacc_elink_pref_dec(const void **_pp, void *_value) { char **elink_pref = (char **)_value; const uint8_t **pp = (const uint8_t **)_pp; @@ -593,7 +753,7 @@ H5P_lacc_elink_pref_dec(const void **_pp, void *_value) unsigned enc_size; /* Size of encoded property */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(pp); HDassert(*pp); @@ -622,11 +782,11 @@ H5P_lacc_elink_pref_dec(const void **_pp, void *_value) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lacc_elink_pref_dec() */ +} /* end H5P__lacc_elink_pref_dec() */ /*------------------------------------------------------------------------- - * Function: H5P_lacc_elink_pref_del + * Function: H5P__lacc_elink_pref_del * * Purpose: Frees memory used to store the external link prefix string * @@ -639,20 +799,20 @@ done: */ /* ARGSUSED */ static herr_t -H5P_lacc_elink_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__lacc_elink_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); H5MM_xfree(*(void **)value); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_lacc_elink_pref_del() */ +} /* end H5P__lacc_elink_pref_del() */ /*------------------------------------------------------------------------- - * Function: H5P_lacc_elink_pref_copy + * Function: H5P__lacc_elink_pref_copy * * Purpose: Creates a copy of the external link prefix string * @@ -665,20 +825,20 @@ H5P_lacc_elink_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED */ /* ARGSUSED */ static herr_t -H5P_lacc_elink_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__lacc_elink_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); *(char **)value = H5MM_xstrdup(*(const char **)value); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_lacc_elink_pref_copy() */ +} /* end H5P__lacc_elink_pref_copy() */ /*------------------------------------------------------------------------- - * Function: H5P_lacc_elink_pref_cmp + * Function: H5P__lacc_elink_pref_cmp * * Purpose: Callback routine which is called whenever the elink prefix * property in the dataset creation property list is @@ -692,13 +852,13 @@ H5P_lacc_elink_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED *------------------------------------------------------------------------- */ static int -H5P_lacc_elink_pref_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size) +H5P__lacc_elink_pref_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size) { const char *pref1 = *(const char * const *)value1; const char *pref2 = *(const char * const *)value2; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(NULL == pref1 && NULL != pref2) HGOTO_DONE(1); @@ -709,11 +869,11 @@ H5P_lacc_elink_pref_cmp(const void *value1, const void *value2, size_t H5_ATTR_U done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_lacc_elink_pref_cmp() */ +} /* end H5P__lacc_elink_pref_cmp() */ /*------------------------------------------------------------------------- - * Function: H5P_lacc_elink_pref_close + * Function: H5P__lacc_elink_pref_close * * Purpose: Frees memory used to store the external link prefix string * @@ -726,16 +886,16 @@ done: */ /* ARGSUSED */ static herr_t -H5P_lacc_elink_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__lacc_elink_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(value); H5MM_xfree(*(void **)value); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P_lacc_elink_pref_close() */ +} /* end H5P__lacc_elink_pref_close() */ /*------------------------------------------------------------------------- @@ -843,7 +1003,6 @@ herr_t H5Pset_elink_prefix(hid_t plist_id, const char *prefix) { H5P_genplist_t *plist; /* Property list pointer */ - char *my_prefix; /* Copy of prefix string */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -853,19 +1012,8 @@ H5Pset_elink_prefix(hid_t plist_id, const char *prefix) if(NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - /* Get current prefix value */ - if(H5P_get(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get prefix info") - - /* Free existing prefix, if there is one */ - H5MM_xfree(my_prefix); - - /* Make a copy of the user's prefix string */ - if(NULL == (my_prefix = H5MM_xstrdup(prefix))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy prefix") - /* Set prefix */ - if(H5P_set(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0) + if(H5P_set(plist, H5L_ACS_ELINK_PREFIX_NAME, &prefix) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info") done: @@ -905,7 +1053,7 @@ H5Pget_elink_prefix(hid_t plist_id, char *prefix, size_t size) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the current prefix */ - if(H5P_get(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0) + if(H5P_peek(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix") /* Check for prefix being set */ @@ -943,9 +1091,8 @@ done: herr_t H5Pset_elink_fapl(hid_t lapl_id, hid_t fapl_id) { - H5P_genplist_t *plist, *fapl_plist; /* Property list pointer */ - hid_t l_fapl_id, new_fapl_id; - herr_t ret_value = SUCCEED; /* Return value */ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "ii", lapl_id, fapl_id); @@ -954,23 +1101,8 @@ H5Pset_elink_fapl(hid_t lapl_id, hid_t fapl_id) if(NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link access property list"); - /* Get the current file access property list for the link access */ - if(H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &l_fapl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl") - - /* Close the current file access property list if set */ - if((l_fapl_id > H5P_DEFAULT) && (H5I_dec_ref(l_fapl_id) < 0)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for file access property list") - - if(NULL == (fapl_plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access property list"); - - /* Make a copy of the property list for FAPL_ID */ - if((new_fapl_id = H5P_copy_plist(fapl_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy file access properties") - /* Set the file access property list for the link access */ - if(H5P_set(plist, H5L_ACS_ELINK_FAPL_NAME, &new_fapl_id) < 0) + if(H5P_set(plist, H5L_ACS_ELINK_FAPL_NAME, &fapl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fapl for link") done: @@ -994,9 +1126,8 @@ done: hid_t H5Pget_elink_fapl(hid_t lapl_id) { - H5P_genplist_t *plist, *fapl_plist; /* Property list pointer */ - hid_t l_fapl_id; - hid_t ret_value=FAIL; /* Return value */ + H5P_genplist_t *plist; /* Property list pointer */ + hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", lapl_id); @@ -1005,18 +1136,9 @@ H5Pget_elink_fapl(hid_t lapl_id) if(NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - if(H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &l_fapl_id) < 0) + if(H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &ret_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl for links") - if(l_fapl_id > H5P_DEFAULT) { - if(NULL==(fapl_plist = H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); - - if((ret_value = H5P_copy_plist(fapl_plist, TRUE)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to copy file access properties") - } else - ret_value = l_fapl_id; - done: FUNC_LEAVE_API(ret_value); } /* end H5Pget_elink_fapl() */ @@ -1029,7 +1151,7 @@ done: * external link. This should be either H5F_ACC_RDONLY or * H5F_ACC_RDWR, or H5F_ACC_DEFAULT to unset the value. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner * Tuesday, December 9, 2008 @@ -1068,7 +1190,7 @@ done: * Purpose: Gets the file access flags to be used when traversing an * external link. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner * Tuesday, December 9, 2008 @@ -1089,8 +1211,8 @@ H5Pget_elink_acc_flags(hid_t lapl_id, unsigned *flags) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get flags */ - if (flags) - if(H5P_get(plist, H5L_ACS_ELINK_FLAGS_NAME, flags)<0) + if(flags) + if(H5P_get(plist, H5L_ACS_ELINK_FLAGS_NAME, flags) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "can't get access flags") done: @@ -1105,7 +1227,7 @@ done: * external link. This should be either H5F_ACC_RDONLY or * H5F_ACC_RDWR. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner * Tuesday, December 15, 2008 @@ -1150,7 +1272,7 @@ done: * Purpose: Gets the file access flags to be used when traversing an * external link. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner * Tuesday, December 15, 2008 @@ -1172,15 +1294,15 @@ H5Pget_elink_cb(hid_t lapl_id, H5L_elink_traverse_t *func, void **op_data) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get callback_info */ - if(H5P_get(plist, H5L_ACS_ELINK_CB_NAME, &cb_info)<0) + if(H5P_get(plist, H5L_ACS_ELINK_CB_NAME, &cb_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get callback info") if(func) *func = cb_info.func; - if(op_data) *op_data = cb_info.user_data; done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_elink_cb() */ + diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c index cde2035..f6e7793 100644 --- a/src/H5Plcpl.c +++ b/src/H5Plcpl.c @@ -27,7 +27,8 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ diff --git a/src/H5Pmodule.h b/src/H5Pmodule.h new file mode 100644 index 0000000..ddf7c0f --- /dev/null +++ b/src/H5Pmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5P package. Including this header means that the source file + * is part of the H5P package. + */ +#ifndef _H5Pmodule_H +#define _H5Pmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5P_MODULE +#define H5_MY_PKG H5P +#define H5_MY_PKG_ERR H5E_PLIST +#define H5_MY_PKG_INIT YES + +#endif /* _H5Pmodule_H */ + diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index 2740aad..7ae5a6e 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -27,8 +27,9 @@ /****************/ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#define H5O_FRIEND /*suppress error about including H5Opkg */ +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -63,9 +64,14 @@ #define H5O_CRT_OHDR_FLAGS_DEC H5P__decode_uint8_t /* Definitions for filter pipeline */ #define H5O_CRT_PIPELINE_SIZE sizeof(H5O_pline_t) +#define H5O_CRT_PIPELINE_SET H5P__ocrt_pipeline_set +#define H5O_CRT_PIPELINE_GET H5P__ocrt_pipeline_get #define H5O_CRT_PIPELINE_ENC H5P__ocrt_pipeline_enc #define H5O_CRT_PIPELINE_DEC H5P__ocrt_pipeline_dec +#define H5O_CRT_PIPELINE_DEL H5P__ocrt_pipeline_del +#define H5O_CRT_PIPELINE_COPY H5P__ocrt_pipeline_copy #define H5O_CRT_PIPELINE_CMP H5P__ocrt_pipeline_cmp +#define H5O_CRT_PIPELINE_CLOSE H5P__ocrt_pipeline_close /******************/ @@ -84,13 +90,16 @@ /* Property class callbacks */ static herr_t H5P__ocrt_reg_prop(H5P_genclass_t *pclass); -static herr_t H5P__ocrt_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_data); -static herr_t H5P__ocrt_close(hid_t dxpl_id, void *close_data); /* Property callbacks */ static herr_t H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__ocrt_pipeline_dec(const void **_pp, void *value); +static herr_t H5P__ocrt_pipeline_set(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__ocrt_pipeline_get(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__ocrt_pipeline_del(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__ocrt_pipeline_copy(const char *name, size_t size, void *value); static int H5P__ocrt_pipeline_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__ocrt_pipeline_close(const char *name, size_t size, void *value); /* Local routines */ static herr_t H5P__set_filter(H5P_genplist_t *plist, H5Z_filter_t filter, @@ -113,9 +122,9 @@ const H5P_libclass_t H5P_CLS_OCRT[1] = {{ NULL, /* Class creation callback */ NULL, /* Class creation callback info */ - H5P__ocrt_copy, /* Class copy callback */ + NULL, /* Class copy callback */ NULL, /* Class copy callback info */ - H5P__ocrt_close, /* Class close callback */ + NULL, /* Class close callback */ NULL /* Class close callback info */ }}; @@ -177,8 +186,8 @@ H5P__ocrt_reg_prop(H5P_genclass_t *pclass) /* Register the pipeline property */ if(H5P_register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &H5O_def_pline_g, - NULL, NULL, NULL, H5O_CRT_PIPELINE_ENC, H5O_CRT_PIPELINE_DEC, - NULL, NULL, H5O_CRT_PIPELINE_CMP, NULL) < 0) + NULL, H5O_CRT_PIPELINE_SET, H5O_CRT_PIPELINE_GET, H5O_CRT_PIPELINE_ENC, H5O_CRT_PIPELINE_DEC, + H5O_CRT_PIPELINE_DEL, H5O_CRT_PIPELINE_COPY, H5O_CRT_PIPELINE_CMP, H5O_CRT_PIPELINE_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") done: @@ -187,97 +196,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5P__ocrt_copy - * - * Purpose: Callback routine which is called whenever any object - * creation property list is copied. This routine copies - * the properties from the old list to the new list. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Neil Fortner - * Monday, September 21, 2009 - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -static herr_t -H5P__ocrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void H5_ATTR_UNUSED *copy_data) -{ - H5O_pline_t src_pline, dst_pline; /* Source & destination pipelines */ - H5P_genplist_t *src_plist; /* Pointer to source property list */ - H5P_genplist_t *dst_plist; /* Pointer to destination property list */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Verify property list IDs */ - if(NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_plist_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object creation property list") - if(NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_plist_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object creation property list") - - /* Get the link pipeline property from the old property list */ - if(H5P_get(src_plist, H5O_CRT_PIPELINE_NAME, &src_pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") - - /* Make copy of link pipeline */ - if(NULL == H5O_msg_copy(H5O_PLINE_ID, &src_pline, &dst_pline)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy link pipeline") - - /* Set the link pipeline property for the destination property list */ - if(H5P_set(dst_plist, H5O_CRT_PIPELINE_NAME, &dst_pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__ocrt_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5P__ocrt_close - * - * Purpose: Callback routine which is called whenever any object create - * property list is closed. This routine performs any generic - * cleanup needed on the properties the library put into the list. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Neil Fortner - * Monday, September 21, 2009 - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -static herr_t -H5P__ocrt_close(hid_t dcpl_id, void H5_ATTR_UNUSED *close_data) -{ - H5O_pline_t pline; /* I/O pipeline */ - H5P_genplist_t *plist; /* Property list */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check arguments */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object creation property list") - - /* Get the link pipeline property from the old property list */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") - - /* Clean up any values set for the link pipeline */ - if(H5O_msg_reset(H5O_PLINE_ID, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't release pipeline info") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__ocrt_close() */ - - -/*------------------------------------------------------------------------- * Function: H5Pset_attr_phase_change * * Purpose: Sets the cutoff values for indexes storing attributes @@ -615,7 +533,7 @@ H5P_modify_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned flags, FUNC_ENTER_NOAPI(FAIL) /* Get the pipeline property to modify */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Modify the filter parameters of the I/O pipeline */ @@ -623,7 +541,7 @@ H5P_modify_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned flags, HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline") /* Put the I/O pipeline information back into the property list */ - if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") done: @@ -841,7 +759,7 @@ H5P__set_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned int flags, } /* end if */ /* Get the pipeline property to append to */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Add the filter to the I/O pipeline */ @@ -849,7 +767,7 @@ H5P__set_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned int flags, HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline") /* Put the I/O pipeline information back into the property list */ - if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") done: @@ -899,7 +817,7 @@ H5Pget_nfilters(hid_t plist_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the pipeline property to query */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Set return value */ @@ -982,7 +900,7 @@ H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_FILTER_ERROR, "can't find object for ID") /* Get the pipeline property to query */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline") /* Check index */ @@ -1038,7 +956,7 @@ H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags FUNC_ENTER_NOAPI(FAIL) /* Get pipeline info */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Get pointer to filter in pipeline */ @@ -1167,7 +1085,7 @@ H5Pall_filters_avail(hid_t plist_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the pipeline property to query */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Check if all filters are available */ @@ -1203,7 +1121,7 @@ H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id) FUNC_ENTER_NOAPI(FAIL) /* Get pipeline info */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Check if the file is in the pipeline */ @@ -1250,7 +1168,7 @@ H5Premove_filter(hid_t plist_id, H5Z_filter_t filter) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the pipeline property to modify */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Check if there are any filters */ @@ -1260,7 +1178,7 @@ H5Premove_filter(hid_t plist_id, H5Z_filter_t filter) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't delete filter") /* Put the I/O pipeline information back into the property list */ - if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") } /* end if */ @@ -1318,7 +1236,7 @@ H5Pset_deflate(hid_t plist_id, unsigned level) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the pipeline property to append to */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Add the filter */ @@ -1326,7 +1244,7 @@ H5Pset_deflate(hid_t plist_id, unsigned level) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add deflate filter to pipeline") /* Put the I/O pipeline information back into the property list */ - if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") done: @@ -1369,7 +1287,7 @@ H5Pset_fletcher32(hid_t plist_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the pipeline property to append to */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") /* Add the Fletcher32 checksum as a filter */ @@ -1377,7 +1295,7 @@ H5Pset_fletcher32(hid_t plist_id) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add fletcher32 filter to pipeline") /* Put the I/O pipeline information back into the property list */ - if(H5P_set(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") done: @@ -1462,6 +1380,82 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/, /*------------------------------------------------------------------------- + * Function: H5P__ocrt_pipeline_set + * + * Purpose: Copies an I/O pipeline property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, Sept 3, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__ocrt_pipeline_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + H5O_pline_t *pline = (H5O_pline_t *)value; /* Create local aliases for values */ + H5O_pline_t new_pline; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of I/O pipeline */ + if(NULL == H5O_msg_copy(H5O_PLINE_ID, pline, &new_pline)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy I/O pipeline") + + /* Copy new I/O pipeline message over old one */ + *pline = new_pline; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__ocrt_pipeline_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__ocrt_pipeline_get + * + * Purpose: Copies a layout property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Tuesday, Sept 1, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__ocrt_pipeline_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + H5O_pline_t *pline = (H5O_pline_t *)value; /* Create local aliases for values */ + H5O_pline_t new_pline; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of I/O pipeline */ + if(NULL == H5O_msg_copy(H5O_PLINE_ID, pline, &new_pline)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy I/O pipeline") + + /* Copy new I/O pipeline message over old one */ + *pline = new_pline; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__ocrt_pipeline_get() */ + + +/*------------------------------------------------------------------------- * Function: H5P__ocrt_pipeline_enc * * Purpose: Callback routine which is called whenever the pipeline @@ -1639,6 +1633,9 @@ H5P__ocrt_pipeline_dec(const void **_pp, void *_value) /* Add the filter to the I/O pipeline */ if(H5Z_append(pline, filter.id, filter.flags, filter.cd_nelmts, filter.cd_values) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline") + + /* Free cd_values, if it was allocated */ + filter.cd_values = (unsigned *)H5MM_xfree(filter.cd_values); } /* end for */ done: @@ -1647,6 +1644,77 @@ done: /*------------------------------------------------------------------------- + * Function: H5P__ocrt_pipeline_del + * + * Purpose: Frees memory used to store the I/O pipeline property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, Sept 3, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__ocrt_pipeline_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Reset the old I/O pipeline */ + if(H5O_msg_reset(H5O_PLINE_ID, value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release I/O pipeline message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__ocrt_pipeline_del() */ + + +/*-------------------------------------------------------------------------- + * Function: H5P__ocrt_pipeline_copy + * + * Purpose: Copy the I/O pipeline property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, Sept 3, 2015 + * + *-------------------------------------------------------------------------- + */ +static herr_t +H5P__ocrt_pipeline_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, + void *value) +{ + H5O_pline_t *pline = (H5O_pline_t *)value; /* Create local aliases for values */ + H5O_pline_t new_pline; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(pline); + + /* Make copy of I/O pipeline */ + if(NULL == H5O_msg_copy(H5O_PLINE_ID, pline, &new_pline)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy I/O pipeline") + + /* Copy new I/O pipeline message over old one */ + *pline = new_pline; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__ocrt_pipeline_copy() */ + + +/*------------------------------------------------------------------------- * Function: H5P__ocrt_pipeline_cmp * * Purpose: Callback routine which is called whenever a filter pipeline @@ -1727,6 +1795,39 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__ocrt_pipeline_cmp() */ + +/*------------------------------------------------------------------------- + * Function: H5P__ocrt_pipeline_close + * + * Purpose: Frees memory used to store the I/O pipeline property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, Sept 3, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__ocrt_pipeline_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, + void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Reset the old I/O pipeline */ + if(H5O_msg_reset(H5O_PLINE_ID, value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release I/O pipeline message") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__ocrt_pipeline_close() */ + #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- @@ -1792,7 +1893,7 @@ H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_FILTER_ERROR, "can't find object for ID") /* Get pipeline info */ - if(H5P_get(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) + if(H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline") /* Check more args */ diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c index 45ba778..7657d52 100644 --- a/src/H5Pocpypl.c +++ b/src/H5Pocpypl.c @@ -27,7 +27,8 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ /***********/ @@ -53,10 +54,13 @@ #define H5O_CPY_OPTION_ENC H5P__encode_unsigned #define H5O_CPY_OPTION_DEC H5P__decode_unsigned /* Definitions for merge committed dtype list */ -#define H5O_CPY_MERGE_COMM_DT_LIST_SIZE sizeof(char *) +#define H5O_CPY_MERGE_COMM_DT_LIST_SIZE sizeof(H5O_copy_dtype_merge_list_t *) #define H5O_CPY_MERGE_COMM_DT_LIST_DEF NULL +#define H5O_CPY_MERGE_COMM_DT_LIST_SET H5P__ocpy_merge_comm_dt_list_set +#define H5O_CPY_MERGE_COMM_DT_LIST_GET H5P__ocpy_merge_comm_dt_list_get #define H5O_CPY_MERGE_COMM_DT_LIST_ENC H5P__ocpy_merge_comm_dt_list_enc #define H5O_CPY_MERGE_COMM_DT_LIST_DEC H5P__ocpy_merge_comm_dt_list_dec +#define H5O_CPY_MERGE_COMM_DT_LIST_DEL H5P__ocpy_merge_comm_dt_list_del #define H5O_CPY_MERGE_COMM_DT_LIST_COPY H5P__ocpy_merge_comm_dt_list_copy #define H5O_CPY_MERGE_COMM_DT_LIST_CMP H5P__ocpy_merge_comm_dt_list_cmp #define H5O_CPY_MERGE_COMM_DT_LIST_CLOSE H5P__ocpy_merge_comm_dt_list_close @@ -81,13 +85,17 @@ /* General routines */ static H5O_copy_dtype_merge_list_t *H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list); +static herr_t H5P__copy_merge_comm_dt_list(H5O_copy_dtype_merge_list_t **value); /* Property class callbacks */ static herr_t H5P__ocpy_reg_prop(H5P_genclass_t *pclass); /* Property callbacks */ +static herr_t H5P__ocpy_merge_comm_dt_list_set(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__ocpy_merge_comm_dt_list_get(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__ocpy_merge_comm_dt_list_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__ocpy_merge_comm_dt_list_dec(const void **_pp, void *value); +static herr_t H5P__ocpy_merge_comm_dt_list_del(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__ocpy_merge_comm_dt_list_copy(const char* name, size_t size, void* value); static int H5P__ocpy_merge_comm_dt_list_cmp(const void *value1, const void *value2, size_t size); static herr_t H5P__ocpy_merge_comm_dt_list_close(const char* name, size_t size, void* value); @@ -162,8 +170,8 @@ H5P__ocpy_reg_prop(H5P_genclass_t *pclass) /* Register merge named dtype list property */ if(H5P_register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, &H5O_def_merge_comm_dtype_list_g, - NULL, NULL, NULL, H5O_CPY_MERGE_COMM_DT_LIST_ENC, H5O_CPY_MERGE_COMM_DT_LIST_DEC, - NULL, H5O_CPY_MERGE_COMM_DT_LIST_COPY, H5O_CPY_MERGE_COMM_DT_LIST_CMP, H5O_CPY_MERGE_COMM_DT_LIST_CLOSE) < 0) + NULL, H5O_CPY_MERGE_COMM_DT_LIST_SET, H5O_CPY_MERGE_COMM_DT_LIST_GET, H5O_CPY_MERGE_COMM_DT_LIST_ENC, H5O_CPY_MERGE_COMM_DT_LIST_DEC, + H5O_CPY_MERGE_COMM_DT_LIST_DEL, H5O_CPY_MERGE_COMM_DT_LIST_COPY, H5O_CPY_MERGE_COMM_DT_LIST_CMP, H5O_CPY_MERGE_COMM_DT_LIST_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register property for callback when completing the search for a matching named datatype from the named dtype list */ @@ -186,20 +194,23 @@ done: * * Programmer: Neil Fortner * October 27, 2011 + * *------------------------------------------------------------------------- */ static H5O_copy_dtype_merge_list_t * H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list) { - H5O_copy_dtype_merge_list_t *tmp_node; - FUNC_ENTER_STATIC_NOERR /* Free the list */ while(dt_list) { + H5O_copy_dtype_merge_list_t *tmp_node; + tmp_node = dt_list->next; + (void)H5MM_xfree(dt_list->path); (void)H5FL_FREE(H5O_copy_dtype_merge_list_t, dt_list); + dt_list = tmp_node; } /* end while */ @@ -207,6 +218,138 @@ H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list) } /* H5P__free_merge_comm_dtype_list */ +/*-------------------------------------------------------------------------- + * Function: H5P__copy_merge_comm_dt_list + * + * Purpose: Copy a merge committed datatype list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, September 2, 2015 + * + *-------------------------------------------------------------------------- + */ +static herr_t +H5P__copy_merge_comm_dt_list(H5O_copy_dtype_merge_list_t **value) +{ + const H5O_copy_dtype_merge_list_t *src_dt_list; /* Source merge named datatype lists */ + H5O_copy_dtype_merge_list_t *dst_dt_list = NULL; /* Destination merge named datatype lists */ + H5O_copy_dtype_merge_list_t *dst_dt_list_tail = NULL, *tmp_dt_list = NULL; /* temporary merge named datatype lists */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of merge committed dtype list */ + src_dt_list = *value; + while(src_dt_list) { + /* Copy src_dt_list */ + if(NULL == (tmp_dt_list = H5FL_CALLOC(H5O_copy_dtype_merge_list_t))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed") + if(NULL == (tmp_dt_list->path = H5MM_strdup(src_dt_list->path))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed") + + /* Add copied node to dest dtype list */ + if(dst_dt_list_tail) { + dst_dt_list_tail->next = tmp_dt_list; + dst_dt_list_tail = tmp_dt_list; + } /* end if */ + else { + dst_dt_list = tmp_dt_list; + dst_dt_list_tail = tmp_dt_list; + } /* end else */ + tmp_dt_list = NULL; + + /* Advance src_dt_list pointer */ + src_dt_list = src_dt_list->next; + } /* end while */ + + /* Set the merge named dtype list property for the destination property list */ + *value = dst_dt_list; + +done: + if(ret_value < 0) { + dst_dt_list = H5P__free_merge_comm_dtype_list(dst_dt_list); + if(tmp_dt_list) { + tmp_dt_list->path = (char *)H5MM_xfree(tmp_dt_list->path); + tmp_dt_list = H5FL_FREE(H5O_copy_dtype_merge_list_t, tmp_dt_list); + } /* end if */ + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__copy_merge_comm_dt_list() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__ocpy_merge_comm_dt_list_set + * + * Purpose: Copies a merge committed datatype list property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, Sept 2, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__ocpy_merge_comm_dt_list_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of merge committed dtype list */ + if(H5P__copy_merge_comm_dt_list((H5O_copy_dtype_merge_list_t **)value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy merge committed dtype list") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__ocpy_merge_comm_dt_list_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__ocpy_merge_comm_dt_list_get + * + * Purpose: Copies a merge committed datatype list property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, Sept 2, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__ocpy_merge_comm_dt_list_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(value); + + /* Make copy of merge committed dtype list */ + if(H5P__copy_merge_comm_dt_list((H5O_copy_dtype_merge_list_t **)value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy merge committed dtype list") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__ocpy_merge_comm_dt_list_get() */ + + /*------------------------------------------------------------------------- * Function: H5P__ocpy_merge_comm_dt_list_enc * @@ -295,6 +438,9 @@ H5P__ocpy_merge_comm_dt_list_dec(const void **_pp, void *_value) HDassert(pp); HDassert(*pp); HDassert(dt_list); + + /* Start off with NULL (default value) */ + *dt_list = NULL; /* Decode the string sequence */ len = HDstrlen(*(const char **)pp); @@ -339,6 +485,36 @@ done: /*-------------------------------------------------------------------------- + * Function: H5P__ocpy_merge_comm_dt_list_del + * + * Purpose: Frees memory used to store the merge committed datatype list property + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, September 2, 2015 + * + *-------------------------------------------------------------------------- + */ +/* ARGSUSED */ +static herr_t +H5P__ocpy_merge_comm_dt_list_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(value); + + /* Free the merge named dtype list */ + H5P__free_merge_comm_dtype_list(*(H5O_copy_dtype_merge_list_t **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__ocpy_merge_comm_dt_list_del() */ + + +/*-------------------------------------------------------------------------- * Function: H5P__ocpy_merge_comm_dt_list_copy * * Purpose: Copy the merge committed datatype list @@ -356,51 +532,18 @@ static herr_t H5P__ocpy_merge_comm_dt_list_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { - const H5O_copy_dtype_merge_list_t *src_dt_list; /* Source merge named datatype lists */ - H5O_copy_dtype_merge_list_t *dst_dt_list = NULL; /* Destination merge named datatype lists */ - H5O_copy_dtype_merge_list_t *dst_dt_list_tail = NULL, *tmp_dt_list = NULL; /* temporary merge named datatype lists */ herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + /* Sanity check */ HDassert(value); /* Make copy of merge committed dtype list */ - src_dt_list = *(const H5O_copy_dtype_merge_list_t **)value; - while(src_dt_list) { - /* Copy src_dt_list */ - if(NULL == (tmp_dt_list = H5FL_CALLOC(H5O_copy_dtype_merge_list_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - if(NULL == (tmp_dt_list->path = H5MM_strdup(src_dt_list->path))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - - /* Add copied node to dest dtype list */ - if(dst_dt_list_tail) { - dst_dt_list_tail->next = tmp_dt_list; - dst_dt_list_tail = tmp_dt_list; - } /* end if */ - else { - dst_dt_list = tmp_dt_list; - dst_dt_list_tail = tmp_dt_list; - } /* end else */ - tmp_dt_list = NULL; - - /* Advance src_dt_list pointer */ - src_dt_list = src_dt_list->next; - } /* end while */ - - /* Set the merge named dtype list property for the destination property list */ - *(H5O_copy_dtype_merge_list_t **)value = dst_dt_list; + if(H5P__copy_merge_comm_dt_list((H5O_copy_dtype_merge_list_t **)value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy merge committed dtype list") done: - if(ret_value < 0) { - dst_dt_list = H5P__free_merge_comm_dtype_list(dst_dt_list); - if(tmp_dt_list) { - tmp_dt_list->path = (char *)H5MM_xfree(tmp_dt_list->path); - tmp_dt_list = H5FL_FREE(H5O_copy_dtype_merge_list_t, tmp_dt_list); - } /* end if */ - } /* end if */ - FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__ocpy_merge_comm_dt_list_copy() */ @@ -439,6 +582,9 @@ H5P__ocpy_merge_comm_dt_list_cmp(const void *_dt_list1, const void *_dt_list2, /* Walk through the lists, comparing each path. For the lists to be the * same, the paths must be in the same order. */ while(dt_list1 && dt_list2) { + HDassert(dt_list1->path); + HDassert(dt_list2->path); + /* Compare paths */ ret_value = HDstrcmp(dt_list1->path, dt_list2->path); if(ret_value != 0) HGOTO_DONE(ret_value) @@ -601,13 +747,15 @@ H5Padd_merge_committed_dtype_path(hid_t plist_id, const char *path) /* Check parameters */ if(!path) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no path specified") + if(path[0] == '\0') + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "path is empty string") /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get dtype list */ - if(H5P_get(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &old_list) < 0) + if(H5P_peek(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &old_list) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge named dtype list") /* Add the new path to the list */ @@ -618,7 +766,7 @@ H5Padd_merge_committed_dtype_path(hid_t plist_id, const char *path) new_obj->next = old_list; /* Update the list stored in the property list */ - if(H5P_set(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &new_obj) < 0) + if(H5P_poke(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &new_obj) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set merge named dtype list") done: @@ -663,14 +811,14 @@ H5Pfree_merge_committed_dtype_paths(hid_t plist_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get dtype list */ - if(H5P_get(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) + if(H5P_peek(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge committed dtype list") /* Free dtype list */ dt_list = H5P__free_merge_comm_dtype_list(dt_list); /* Update the list stored in the property list (to NULL) */ - if(H5P_set(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) + if(H5P_poke(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set merge committed dtype list") done: diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 1bf4465..d10d578 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -21,7 +21,7 @@ * the H5P package. Source files outside the H5P package should * include H5Pprivate.h instead. */ -#ifndef H5P_PACKAGE +#if !(defined H5P_FRIEND || defined H5P_MODULE) #error "Do not include this file outside the H5P package!" #endif @@ -158,8 +158,6 @@ struct H5Z_filter_info_t; /******************************/ /* Private functions, not part of the publicly documented API */ -H5_DLL herr_t H5P__term_pub_interface(void); -H5_DLL herr_t H5P__term_deprec_interface(void); H5_DLL H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t type, H5P_cls_create_func_t cls_create, void *create_data, diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 81e1f40..cff79a6 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -33,13 +33,13 @@ #define H5P_STRCRT_CHAR_ENCODING_NAME "character_encoding" /* Character set encoding for string */ /* If the module using this macro is allowed access to the private variables, access them directly */ -#ifdef H5P_PACKAGE +#ifdef H5P_MODULE #define H5P_PLIST_ID(P) ((P)->plist_id) #define H5P_CLASS(P) ((P)->pclass) -#else /* H5F_PACKAGE */ +#else /* H5P_MODULE */ #define H5P_PLIST_ID(P) (H5P_get_plist_id(P)) #define H5P_CLASS(P) (H5P_get_class(P)) -#endif /* H5P_PACKAGE */ +#endif /* H5P_MODULE */ /****************************/ @@ -121,21 +121,23 @@ H5_DLL herr_t H5P_init(void); H5_DLL herr_t H5P_close(void *_plist); H5_DLL hid_t H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref); H5_DLL hid_t H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref); -H5_DLL herr_t H5P_get(const H5P_genplist_t *plist, const char *name, void *value); +H5_DLL herr_t H5P_get(H5P_genplist_t *plist, const char *name, void *value); H5_DLL herr_t H5P_set(H5P_genplist_t *plist, const char *name, const void *value); +H5_DLL herr_t H5P_peek(H5P_genplist_t *plist, const char *name, void *value); +H5_DLL herr_t H5P_poke(H5P_genplist_t *plist, const char *name, const void *value); H5_DLL herr_t H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get, H5P_prp_encode_func_t prp_encode, H5P_prp_decode_func_t prp_decode, H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, H5P_prp_close_func_t prp_close); -H5_DLL herr_t H5P_remove(hid_t plist_id, H5P_genplist_t *plist, const char *name); +H5_DLL herr_t H5P_remove(H5P_genplist_t *plist, const char *name); H5_DLL htri_t H5P_exist_plist(const H5P_genplist_t *plist, const char *name); H5_DLL htri_t H5P_class_isa(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2); H5_DLL char *H5P_get_class_name(H5P_genclass_t *pclass); H5_DLL herr_t H5P_get_nprops_pclass(const H5P_genclass_t *pclass, size_t *nprops, hbool_t recurse); -H5_DLL hid_t H5P_get_driver(H5P_genplist_t *plist); -H5_DLL void * H5P_get_driver_info(H5P_genplist_t *plist); +H5_DLL hid_t H5P_peek_driver(H5P_genplist_t *plist); +H5_DLL const void *H5P_peek_driver_info(H5P_genplist_t *plist); H5_DLL herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info); H5_DLL herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist, diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c index 3ba625e..5a09cd7 100644 --- a/src/H5Pstrcpl.c +++ b/src/H5Pstrcpl.c @@ -27,7 +27,9 @@ /****************/ /* Module Setup */ /****************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ + /***********/ /* Headers */ diff --git a/src/H5Ptest.c b/src/H5Ptest.c index b36da6a..30a98a4 100644 --- a/src/H5Ptest.c +++ b/src/H5Ptest.c @@ -19,7 +19,7 @@ * Purpose: Generic Property Testing Functions */ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ #define H5P_TESTING /*suppress warning about H5P testing funcs*/ @@ -60,8 +60,8 @@ char * H5P_get_class_path_test(hid_t pclass_id) { - H5P_genclass_t *pclass; /* Property class to query */ - char *ret_value; /* return value */ + H5P_genclass_t *pclass; /* Property class to query */ + char *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -101,8 +101,8 @@ done: hid_t H5P_open_class_path_test(const char *path) { - H5P_genclass_t *pclass=NULL;/* Property class to query */ - hid_t ret_value; /* Return value */ + H5P_genclass_t *pclass = NULL; /* Property class to query */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -156,7 +156,7 @@ H5P_reset_external_file_test(hid_t dcpl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") /* get external file list */ - if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) + if(H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") /* Clean up any values set for the external file-list */ @@ -164,7 +164,7 @@ H5P_reset_external_file_test(hid_t dcpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release external file list info") /* set external file list */ - if(H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) + if(H5P_poke(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") done: @@ -17,10 +17,7 @@ /* Module Setup */ /****************/ -#define H5R_PACKAGE /*suppress error about including H5Rpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5R_init_interface +#include "H5Rmodule.h" /* This source code file is part of the H5R module */ /***********/ @@ -63,6 +60,9 @@ static ssize_t H5R_get_name(H5F_t *file, hid_t lapl_id, hid_t dxpl_id, hid_t id, /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -81,39 +81,16 @@ static const H5I_class_t H5I_REFERENCE_CLS[1] = {{ NULL /* Callback routine for closing objects of this class */ }}; +/* Flag indicating "top" of interface has been initialized */ +static hbool_t H5R_top_package_initialize_s = FALSE; - -/*------------------------------------------------------------------------- - * Function: H5R_init - * - * Purpose: Initialize the interface from some other package. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Quincey Koziol - * Thursday, September 13, 2007 - * - *------------------------------------------------------------------------- - */ -herr_t -H5R_init(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - /* FUNC_ENTER() does all the work */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5R_init() */ /*-------------------------------------------------------------------------- NAME - H5R_init_interface -- Initialize interface-specific information + H5R__init_package -- Initialize interface-specific information USAGE - herr_t H5R_init_interface() + herr_t H5R__init_package() RETURNS Non-negative on success/Negative on failure @@ -121,33 +98,37 @@ DESCRIPTION Initializes any interface-specific data or routines. --------------------------------------------------------------------------*/ -static herr_t -H5R_init_interface(void) +herr_t +H5R__init_package(void) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Initialize the atom group for the file IDs */ if(H5I_register_type(H5I_REFERENCE_CLS) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to initialize interface"); + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to initialize interface") + + /* Mark "top" of interface as initialized, too */ + H5R_top_package_initialize_s = TRUE; done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5R__init_package() */ /*-------------------------------------------------------------------------- NAME - H5R_term_interface + H5R_top_term_package PURPOSE Terminate various H5R objects USAGE - void H5R_term_interface() + void H5R_top_term_package() RETURNS void DESCRIPTION - Release the atom group and any other resources allocated. + Release IDs for the atom group, deferring full interface shutdown + until later (in H5R_term_package). GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS Can't report errors... @@ -155,32 +136,69 @@ done: REVISION LOG --------------------------------------------------------------------------*/ int -H5R_term_interface(void) +H5R_top_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if (H5_interface_initialize_g) { + if(H5R_top_package_initialize_s) { if(H5I_nmembers(H5I_REFERENCE) > 0) { (void)H5I_clear_type(H5I_REFERENCE, FALSE, FALSE); n++; /*H5I*/ } /* end if */ - else { - /* Close deprecated interface */ - n += H5R__term_deprec_interface(); - /* Destroy the reference id group */ - (void)H5I_dec_type_ref(H5I_REFERENCE); - n++; /*H5I*/ + /* Mark closed */ + if(0 == n) + H5R_top_package_initialize_s = FALSE; + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5R_top_term_package() */ + + +/*-------------------------------------------------------------------------- + NAME + H5R_term_package + PURPOSE + Terminate various H5R objects + USAGE + void H5R_term_package() + RETURNS + void + DESCRIPTION + Release the atom group and any other resources allocated. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Can't report errors... + + Finishes shutting down the interface, after H5R_top_term_package() + is called + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +int +H5R_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + /* Sanity checks */ + HDassert(0 == H5I_nmembers(H5I_REFERENCE)); + HDassert(FALSE == H5R_top_package_initialize_s); + + /* Destroy the reference id group */ + n += (H5I_dec_type_ref(H5I_REFERENCE) > 0); - /* Mark closed */ - H5_interface_initialize_g = 0; - } /* end else */ + /* Mark closed */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5R_term_interface() */ +} /* end H5R_term_package() */ /*-------------------------------------------------------------------------- @@ -424,7 +442,7 @@ H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type, H5G_loc_t loc; /* Group location */ unsigned rc; /* Reference count of object */ H5O_type_t obj_type; /* Type of object */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -902,9 +920,9 @@ static ssize_t H5R_get_name(H5F_t *f, hid_t lapl_id, hid_t dxpl_id, hid_t id, H5R_type_t ref_type, const void *_ref, char *name, size_t size) { - hid_t file_id = (-1); /* ID for file that the reference is in */ + hid_t file_id = H5I_INVALID_HID; /* ID for file that the reference is in */ H5O_loc_t oloc; /* Object location describing object for reference */ - ssize_t ret_value; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 9877f42..b8133b2 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -31,10 +31,7 @@ /* Module Setup */ /****************/ -#define H5R_PACKAGE /*suppress error about including H5Rpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5R__init_deprec_interface +#include "H5Rmodule.h" /* This source code file is part of the H5R module */ /***********/ @@ -84,51 +81,6 @@ /*******************/ - -/*-------------------------------------------------------------------------- -NAME - H5R__init_deprec_interface -- Initialize interface-specific information -USAGE - herr_t H5R__init_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5R_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5R__init_deprec_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5R_init()) -} /* H5R__init_deprec_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5R__term_deprec_interface -- Terminate interface -USAGE - herr_t H5R__term_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5R__term_deprec_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5R__term_deprec_interface() */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /*-------------------------------------------------------------------------- diff --git a/src/H5Rmodule.h b/src/H5Rmodule.h new file mode 100644 index 0000000..6799483 --- /dev/null +++ b/src/H5Rmodule.h @@ -0,0 +1,36 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5R package. Including this header means that the source file + * is part of the H5R package. + */ +#ifndef _H5Rmodule_H +#define _H5Rmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5R_MODULE +#define H5_MY_PKG H5R +#define H5_MY_PKG_ERR H5E_REFERENCE +#define H5_MY_PKG_INIT YES + +#endif /* _H5Rmodule_H */ + + diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index fd16754..8ed8d65 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -21,7 +21,7 @@ * only within the H5R package. Source files outside the * H5R package should include H5Rprivate.h instead. */ -#ifndef H5R_PACKAGE +#if !(defined H5R_FRIEND || defined H5R_MODULE) #error "Do not include this file outside the H5R package!" #endif @@ -54,8 +54,6 @@ /******************************/ /* General functions */ -H5_DLL herr_t H5R_init(void); -H5_DLL herr_t H5R__term_deprec_interface(void); H5_DLL herr_t H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref, H5O_type_t *obj_type); H5_DLL hid_t H5R_dereference(H5F_t *file, hid_t dapl_id, hid_t dxpl_id, H5R_type_t ref_type, @@ -17,10 +17,7 @@ /* Module Setup */ /****************/ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5S_init_interface +#include "H5Smodule.h" /* This source code file is part of the H5S module */ /***********/ @@ -52,17 +49,18 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5S_set_extent_simple (H5S_t *space, unsigned rank, - const hsize_t *dims, const hsize_t *max); static htri_t H5S_is_simple(const H5S_t *sdim); -static herr_t H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc); -static H5S_t *H5S_decode(const unsigned char *buf); +static herr_t H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc); +static H5S_t *H5S_decode(const unsigned char **p); /*********************/ /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ @@ -80,7 +78,7 @@ H5FL_DEFINE(H5S_extent_t); H5FL_DEFINE(H5S_t); /* Declare a free list to manage the array's of hsize_t's */ -H5FL_ARR_DEFINE(hsize_t,H5S_MAX_RANK); +H5FL_ARR_DEFINE(hsize_t, H5S_MAX_RANK); /* Dataspace ID class */ static const H5I_class_t H5I_DATASPACE_CLS[1] = {{ @@ -90,47 +88,52 @@ static const H5I_class_t H5I_DATASPACE_CLS[1] = {{ (H5I_free_t)H5S_close /* Callback routine for closing objects of this class */ }}; +/* Flag indicating "top" of interface has been initialized */ +static hbool_t H5S_top_package_initialize_s = FALSE; + /*-------------------------------------------------------------------------- NAME - H5S_init_interface -- Initialize interface-specific information + H5S__init_package -- Initialize interface-specific information USAGE - herr_t H5S_init_interface() - + herr_t H5S__init_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION Initializes any interface-specific data or routines. - --------------------------------------------------------------------------*/ -static herr_t -H5S_init_interface(void) +herr_t +H5S__init_package(void) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Initialize the atom group for the file IDs */ if(H5I_register_type(H5I_DATASPACE_CLS) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize interface") + /* Mark "top" of interface as initialized, too */ + H5S_top_package_initialize_s = TRUE; + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_init_interface() */ +} /* end H5S__init_package() */ /*-------------------------------------------------------------------------- NAME - H5S_term_interface + H5S_top_term_package PURPOSE Terminate various H5S objects USAGE - void H5S_term_interface() + void H5S_top_term_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION - Release the atom group and any other resources allocated. + Release IDs for the atom group, deferring full interface shutdown + until later (in H5S_term_package). GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS Can't report errors... @@ -138,29 +141,69 @@ done: REVISION LOG --------------------------------------------------------------------------*/ int -H5S_term_interface(void) +H5S_top_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5S_top_package_initialize_s) { if(H5I_nmembers(H5I_DATASPACE) > 0) { (void)H5I_clear_type(H5I_DATASPACE, FALSE, FALSE); n++; /*H5I*/ } /* end if */ - else { - /* Destroy the dataspace object id group */ - (void)H5I_dec_type_ref(H5I_DATASPACE); - n++; /*H5I*/ - /* Shut down interface */ - H5_interface_initialize_g = 0; - } /* end else */ + /* Mark "top" of interface as closed */ + if(0 == n) + H5S_top_package_initialize_s = FALSE; + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5S_top_term_package() */ + + +/*-------------------------------------------------------------------------- + NAME + H5S_term_package + PURPOSE + Terminate various H5S objects + USAGE + void H5S_term_package() + RETURNS + Non-negative on success/Negative on failure + DESCRIPTION + Release the atom group and any other resources allocated. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Can't report errors... + + Finishes shutting down the interface, after H5S_top_term_package() + is called + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +int +H5S_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + /* Sanity checks */ + HDassert(0 == H5I_nmembers(H5I_DATASPACE)); + HDassert(FALSE == H5S_top_package_initialize_s); + + /* Destroy the dataspace object id group */ + n += (H5I_dec_type_ref(H5I_DATASPACE) > 0); + + /* Mark interface as closed */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5S_term_interface() */ +} /* end H5S_term_package() */ /*-------------------------------------------------------------------------- @@ -185,7 +228,7 @@ H5S_t * H5S_create(H5S_class_t type) { H5S_t *new_ds = NULL; /* New dataspace created */ - H5S_t *ret_value; /* Return value */ + H5S_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -479,7 +522,40 @@ H5Sextent_copy(hid_t dst_id,hid_t src_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Copy */ - if(H5S_extent_copy(&(dst->extent), &(src->extent), TRUE) < 0) + if(H5S_extent_copy(dst, src) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Sextent_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5S_extent_copy + * + * Purpose: Copies a dataspace extent + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * Monday, February 23, 2015 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5S_extent_copy(H5S_t *dst, const H5S_t *src) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(dst); + HDassert(src); + + /* Copy extent */ + if(H5S_extent_copy_real(&(dst->extent), &(src->extent), TRUE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent") /* If the selection is 'all', update the number of elements selected in the @@ -489,12 +565,12 @@ H5Sextent_copy(hid_t dst_id,hid_t src_id) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") done: - FUNC_LEAVE_API(ret_value) -} /* end H5Sextent_copy() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5S_extent_copy() */ /*------------------------------------------------------------------------- - * Function: H5S_extent_copy + * Function: H5S_extent_copy_real * * Purpose: Copies a dataspace extent * @@ -508,7 +584,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max) +H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max) { unsigned u; herr_t ret_value = SUCCEED; /* Return value */ @@ -561,7 +637,7 @@ H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_extent_copy() */ +} /* end H5S_extent_copy_real() */ /*------------------------------------------------------------------------- @@ -588,8 +664,8 @@ done: H5S_t * H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max) { - H5S_t *dst = NULL; - H5S_t *ret_value; /* Return value */ + H5S_t *dst = NULL; + H5S_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -597,7 +673,7 @@ H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy the source dataspace's extent */ - if(H5S_extent_copy(&(dst->extent), &(src->extent), copy_max) < 0) + if(H5S_extent_copy_real(&(dst->extent), &(src->extent), copy_max) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent") /* Copy the source dataspace's selection */ @@ -640,7 +716,7 @@ done: hssize_t H5S_get_simple_extent_npoints(const H5S_t *ds) { - hssize_t ret_value; + hssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(-1) @@ -716,8 +792,8 @@ done: hsize_t H5S_get_npoints_max(const H5S_t *ds) { - hsize_t ret_value; unsigned u; + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) @@ -821,7 +897,7 @@ done: int H5S_get_simple_extent_ndims(const H5S_t *ds) { - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -906,8 +982,8 @@ done: int H5S_extent_get_dims(const H5S_extent_t *ext, hsize_t dims[], hsize_t max_dims[]) { - int i; /* Local index variable */ - int ret_value; /* Return value */ + int i; /* Local index variable */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -965,7 +1041,7 @@ done: int H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[], hsize_t max_dims[]) { - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1073,8 +1149,8 @@ done: H5S_t * H5S_read(const H5O_loc_t *loc, hid_t dxpl_id) { - H5S_t *ds = NULL; /* Dataspace to return */ - H5S_t *ret_value; /* Return value */ + H5S_t *ds = NULL; /* Dataspace to return */ + H5S_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1121,7 +1197,7 @@ done: static htri_t H5S_is_simple(const H5S_t *sdim) { - htri_t ret_value; + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1262,14 +1338,14 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, const hsize_t *max) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI(FAIL) /* Check args */ HDassert(rank <= H5S_MAX_RANK); @@ -1426,7 +1502,7 @@ H5S_t * H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/*rank*/]) { - H5S_t *ret_value; /* Return value */ + H5S_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1475,7 +1551,7 @@ H5Sencode(hid_t obj_id, void *buf, size_t *nalloc) if (NULL==(dspace=(H5S_t *)H5I_object_verify(obj_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") - if(H5S_encode(dspace, (unsigned char *)buf, nalloc)<0) + if(H5S_encode(dspace, (unsigned char **)&buf, nalloc)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") done: @@ -1500,13 +1576,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc) +H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc) { + H5F_t *f = NULL; /* Fake file structure*/ + unsigned char *pp = (*p); /* Local pointer for decoding */ size_t extent_size; /* Size of serialized dataspace extent */ hssize_t sselect_size; /* Signed size of serialized dataspace selection */ size_t select_size; /* Size of serialized dataspace selection */ - H5F_t *f = NULL; /* Fake file structure*/ - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1525,28 +1602,29 @@ H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc) /* Verify the size of buffer. If it's not big enough, simply return the * right size without filling the buffer. */ - if(!buf || *nalloc < (extent_size + select_size + 1 + 1 + 1 + 4)) + if(!pp || *nalloc < (extent_size + select_size + 1 + 1 + 1 + 4)) *nalloc = extent_size + select_size + 1 + 1 + 1 + 4; else { /* Encode the type of the information */ - *buf++ = H5O_SDSPACE_ID; + *pp++ = H5O_SDSPACE_ID; /* Encode the version of the dataspace information */ - *buf++ = H5S_ENCODE_VERSION; + *pp++ = H5S_ENCODE_VERSION; /* Encode the "size of size" information */ - *buf++ = (unsigned char)H5F_SIZEOF_SIZE(f); + *pp++ = (unsigned char)H5F_SIZEOF_SIZE(f); /* Encode size of extent information. Pointer is actually moved in this macro. */ - UINT32ENCODE(buf, extent_size); + UINT32ENCODE(pp, extent_size); /* Encode the extent part of dataspace */ - if(H5O_msg_encode(f, H5O_SDSPACE_ID, TRUE, buf, obj) < 0) + if(H5O_msg_encode(f, H5O_SDSPACE_ID, TRUE, pp, obj) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode extent space") - buf += extent_size; + pp += extent_size; /* Encode the selection part of dataspace. */ - if(H5S_SELECT_SERIALIZE(obj, &buf) < 0) + *p = pp; + if(H5S_SELECT_SERIALIZE(obj, p) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode select space") } /* end else */ @@ -1587,7 +1665,7 @@ H5Sdecode(const void *buf) if(buf == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer") - if((ds = H5S_decode((const unsigned char *)buf)) == NULL) + if((ds = H5S_decode((const unsigned char **)&buf)) == NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, FAIL, "can't decode object") /* Register the type and return the ID */ @@ -1616,40 +1694,41 @@ done: *------------------------------------------------------------------------- */ static H5S_t* -H5S_decode(const unsigned char *buf) +H5S_decode(const unsigned char **p) { - H5S_t *ds; - H5S_extent_t *extent; - size_t extent_size; /* size of the extent message*/ H5F_t *f = NULL; /* Fake file structure*/ + H5S_t *ds; /* Decoded dataspace */ + H5S_extent_t *extent; /* Entent of decoded dataspace */ + const unsigned char *pp = (*p); /* Local pointer for decoding */ + size_t extent_size; /* size of the extent message*/ uint8_t sizeof_size; /* 'Size of sizes' for file */ - H5S_t *ret_value; + H5S_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Decode the type of the information */ - if(*buf++ != H5O_SDSPACE_ID) + if(*pp++ != H5O_SDSPACE_ID) HGOTO_ERROR(H5E_DATASPACE, H5E_BADMESG, NULL, "not an encoded dataspace") /* Decode the version of the dataspace information */ - if(*buf++ != H5S_ENCODE_VERSION) + if(*pp++ != H5S_ENCODE_VERSION) HGOTO_ERROR(H5E_DATASPACE, H5E_VERSION, NULL, "unknown version of encoded dataspace") /* Decode the "size of size" information */ - sizeof_size = *buf++; + sizeof_size = *pp++; /* Allocate "fake" file structure */ if(NULL == (f = H5F_fake_alloc(sizeof_size))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate fake file struct") /* Decode size of extent information */ - UINT32DECODE(buf, extent_size); + UINT32DECODE(pp, extent_size); /* Decode the extent part of dataspace */ /* (pass mostly bogus file pointer and bogus DXPL) */ - if((extent = (H5S_extent_t *)H5O_msg_decode(f, H5P_DEFAULT, NULL, H5O_SDSPACE_ID, buf))==NULL) + if((extent = (H5S_extent_t *)H5O_msg_decode(f, H5P_DEFAULT, NULL, H5O_SDSPACE_ID, pp))==NULL) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object") - buf += extent_size; + pp += extent_size; /* Copy the extent into dataspace structure */ if((ds = H5FL_CALLOC(H5S_t))==NULL) @@ -1665,7 +1744,8 @@ H5S_decode(const unsigned char *buf) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection") /* Decode the select part of dataspace. I believe this part always exists. */ - if(H5S_SELECT_DESERIALIZE(&ds, &buf) < 0) + *p = pp; + if(H5S_SELECT_DESERIALIZE(&ds, p) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode space selection") /* Set return value */ @@ -1705,7 +1785,7 @@ done: H5S_class_t H5S_get_simple_extent_type(const H5S_t *space) { - H5S_class_t ret_value; + H5S_class_t ret_value = H5S_NO_CLASS; /* Return value */ FUNC_ENTER_NOAPI(H5S_NO_CLASS) @@ -1903,7 +1983,7 @@ done: hbool_t H5S_has_extent(const H5S_t *ds) { - hbool_t ret_value; + hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -59,16 +59,15 @@ * */ -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5SL_init_interface +#include "H5SLmodule.h" /* This source code file is part of the H5SL module */ /* Private headers needed */ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ +#include "H5MMprivate.h" /* Memory management */ #include "H5SLprivate.h" /* Skip list routines */ -#include "H5MMprivate.h" /* Memory management */ /* Local Macros */ @@ -576,6 +575,9 @@ static H5SL_node_t *H5SL_insert_common(H5SL_t *slist, void *item, const void *ke static herr_t H5SL_release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data); static herr_t H5SL_close_common(H5SL_t *slist, H5SL_operator_t op, void *op_data); +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Declare a free list to manage the H5SL_t struct */ H5FL_DEFINE_STATIC(H5SL_t); @@ -590,12 +592,11 @@ static size_t H5SL_fac_nalloc_g; /*-------------------------------------------------------------------------- NAME - H5SL_init_interface + H5SL__init_package PURPOSE Initialize interface-specific information USAGE - herr_t H5SL_init_interface() - + herr_t H5SL__init_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -605,10 +606,10 @@ static size_t H5SL_fac_nalloc_g; EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static herr_t -H5SL_init_interface(void) +herr_t +H5SL__init_package(void) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Allocate space for array of factories */ H5SL_fac_g = (H5FL_fac_head_t **)H5MM_malloc(sizeof(H5FL_fac_head_t *)); @@ -621,7 +622,64 @@ H5SL_init_interface(void) H5SL_fac_nused_g = 1; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5SL_init_interface() */ +} /* end H5SL__init_package() */ + + +/*-------------------------------------------------------------------------- + NAME + H5SL_term_package + PURPOSE + Terminate all the H5FL factories used in this package, and clear memory + USAGE + int H5SL_term_package() + RETURNS + Success: Positive if any action might have caused a change in some + other interface; zero otherwise. + Failure: Negative + DESCRIPTION + Release any resources allocated. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Can't report errors... + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +int H5SL_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + /* Terminate all the factories */ + if(H5SL_fac_nused_g > 0) { + size_t i; + herr_t ret; + + for(i = 0; i < H5SL_fac_nused_g; i++) { + ret = H5FL_fac_term(H5SL_fac_g[i]); + HDassert(ret >= 0); + } /* end if */ + H5SL_fac_nused_g = 0; + + n++; + } /* end if */ + + /* Free the list of factories */ + if(H5SL_fac_g) { + H5SL_fac_g = (H5FL_fac_head_t **)H5MM_xfree((void *)H5SL_fac_g); + H5SL_fac_nalloc_g = 0; + + n++; + } /* end if */ + + /* Mark the interface as uninitialized */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* H5SL_term_package() */ /*-------------------------------------------------------------------------- @@ -649,7 +707,7 @@ H5SL_init_interface(void) static H5SL_node_t * H5SL_new_node(void *item, const void *key, uint32_t hashval) { - H5SL_node_t *ret_value; /* New skip list node */ + H5SL_node_t *ret_value = NULL; /* New skip list node */ FUNC_ENTER_NOAPI_NOINIT @@ -938,7 +996,7 @@ H5SL_create(H5SL_type_t type, H5SL_cmp_t cmp) { H5SL_t *new_slist = NULL; /* Pointer to new skip list object created */ H5SL_node_t *header; /* Pointer to skip list header node */ - H5SL_t *ret_value; /* Return value */ + H5SL_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1097,7 +1155,7 @@ done: H5SL_node_t * H5SL_add(H5SL_t *slist, void *item, const void *key) { - H5SL_node_t *ret_value; /* Return value */ + H5SL_node_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1425,9 +1483,9 @@ done: void * H5SL_less(H5SL_t *slist, const void *key) { - H5SL_node_t *x; /* Current node to examine */ - uint32_t hashval = 0; /* Hash value for key */ - void *ret_value; /* Return value */ + H5SL_node_t *x; /* Current node to examine */ + uint32_t hashval = 0; /* Hash value for key */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1534,9 +1592,9 @@ done: void * H5SL_greater(H5SL_t *slist, const void *key) { - H5SL_node_t *x; /* Current node to examine */ - uint32_t hashval = 0; /* Hash value for key */ - void *ret_value; /* Return value */ + H5SL_node_t *x; /* Current node to examine */ + uint32_t hashval = 0; /* Hash value for key */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1726,9 +1784,9 @@ done: H5SL_node_t * H5SL_below(H5SL_t *slist, const void *key) { - H5SL_node_t *x; /* Current node to examine */ - uint32_t hashval = 0; /* Hash value for key */ - H5SL_node_t *ret_value; /* Return value */ + H5SL_node_t *x; /* Current node to examine */ + uint32_t hashval = 0; /* Hash value for key */ + H5SL_node_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1832,9 +1890,9 @@ done: H5SL_node_t * H5SL_above(H5SL_t *slist, const void *key) { - H5SL_node_t *x; /* Current node to examine */ - uint32_t hashval = 0; /* Hash value for key */ - H5SL_node_t *ret_value; /* Return value */ + H5SL_node_t *x; /* Current node to examine */ + uint32_t hashval = 0; /* Hash value for key */ + H5SL_node_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -2509,50 +2567,3 @@ H5SL_close(H5SL_t *slist) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SL_close() */ - -/*-------------------------------------------------------------------------- - NAME - H5SL_term_interface - PURPOSE - Terminate all the H5FL factories used in this package, and clear memory - USAGE - int H5SL_term_interface() - RETURNS - Success: Positive if any action might have caused a change in some - other interface; zero otherwise. - Failure: Negative - DESCRIPTION - Release any resources allocated. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - Can't report errors... - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -int H5SL_term_interface(void) -{ - size_t i; - herr_t ret; - int n = H5_interface_initialize_g ? 1 : 0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if(n) { - /* Terminate all the factories */ - for(i=0; i<H5SL_fac_nused_g; i++) { - ret = H5FL_fac_term(H5SL_fac_g[i]); - HDassert(ret >= 0); - } - H5SL_fac_nused_g = 0; - - /* Free the list of factories */ - H5SL_fac_g = (H5FL_fac_head_t **)H5MM_xfree((void *)H5SL_fac_g); - H5SL_fac_nalloc_g = 0; - - /* Mark the interface as uninitialized */ - H5_interface_initialize_g = 0; - } /* end if */ - - FUNC_LEAVE_NOAPI(n) -} /* H5SL_term_interface() */ - diff --git a/src/H5SLmodule.h b/src/H5SLmodule.h new file mode 100644 index 0000000..d5bfbc2 --- /dev/null +++ b/src/H5SLmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5SL package. Including this header means that the source file + * is part of the H5SL package. + */ +#ifndef _H5SLmodule_H +#define _H5SLmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5SL_MODULE +#define H5_MY_PKG H5SL +#define H5_MY_PKG_ERR H5E_SLIST +#define H5_MY_PKG_INIT YES + +#endif /* _H5SLmodule_H */ + @@ -17,8 +17,9 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5SM_PACKAGE /*suppress error about including H5SMpkg */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ +#include "H5SMmodule.h" /* This source code file is part of the H5SM module */ + /***********/ /* Headers */ @@ -84,6 +85,9 @@ static herr_t H5SM_read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + H5FL_DEFINE(H5SM_master_table_t); H5FL_ARR_DEFINE(H5SM_index_header_t, H5O_SHMESG_MAX_NINDEXES); H5FL_DEFINE(H5SM_list_t); @@ -122,6 +126,8 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d { H5O_shmesg_table_t sohm_table; /* SOHM message for superblock extension */ H5SM_master_table_t *table = NULL; /* SOHM master table for file */ + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t ring, orig_ring = H5AC_RING_INV; /* Original ring value */ haddr_t table_addr = HADDR_UNDEF; /* Address of SOHM master table in file */ unsigned list_max, btree_min; /* Phase change limits for SOHM indices */ unsigned index_type_flags[H5O_SHMESG_MAX_NINDEXES]; /* Messages types stored in each index */ @@ -136,6 +142,10 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d /* File should not already have a SOHM table */ HDassert(!H5F_addr_defined(H5F_SOHM_ADDR(f))); + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_US, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "unable to set ring value") + /* Initialize master table */ if(NULL == (table = H5FL_MALLOC(H5SM_master_table_t))) HGOTO_ERROR(H5E_SOHM, H5E_CANTALLOC, FAIL, "memory allocation failed for SOHM table") @@ -220,6 +230,11 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d if(type_flags_used & H5O_SHMESG_ATTR_FLAG) H5F_SET_STORE_MSG_CRT_IDX(f, TRUE); + /* Set the ring type to superblock extension */ + ring = H5AC_RING_SBE; + if((H5P_set(dxpl, H5AC_RING_NAME, &ring)) < 0) + HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "unable to set property value") + /* Write shared message information to the superblock extension */ sohm_table.addr = H5F_SOHM_ADDR(f); sohm_table.version = H5F_SOHM_VERS(f); @@ -228,6 +243,10 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, const H5O_loc_t *ext_loc, hid_t d HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "unable to update SOHM header message") done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "unable to set property value") + if(ret_value < 0) { if(table_addr != HADDR_UNDEF) H5MF_xfree(f, H5FD_MEM_SOHM_TABLE, dxpl_id, table_addr, (hsize_t)table->table_size); @@ -627,7 +646,7 @@ H5SM_create_list(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id) hsize_t x; /* Counter variable */ size_t num_entries; /* Number of messages to create in list */ haddr_t addr = HADDR_UNDEF; /* Address of the list on disk */ - haddr_t ret_value; + haddr_t ret_value = HADDR_UNDEF; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, H5AC__SOHM_TAG, HADDR_UNDEF) @@ -870,7 +889,7 @@ done: static htri_t H5SM_can_share_common(const H5F_t *f, unsigned type_id, const void *mesg) { - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1602,8 +1621,8 @@ done: static size_t H5SM_find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *empty_pos) { - size_t x; - size_t ret_value; + size_t x; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1929,6 +1948,8 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id) H5F_t *f = ext_loc->file; /* File pointer (convenience variable) */ H5O_shmesg_table_t sohm_table; /* SOHM message from superblock extension */ H5SM_master_table_t *table = NULL; /* SOHM master table */ + H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ unsigned tmp_sohm_nindexes; /* Number of shared messages indexes in the table */ htri_t status; /* Status for message existing */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1969,6 +1990,10 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id) /* Set up user data for callback */ cache_udata.f = f; + /* Set the ring type in the DXPL */ + if(H5AC_set_ring(dxpl_id, H5AC_RING_US, &dxpl, &orig_ring) < 0) + HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "unable to set ring value") + /* Read the rest of the SOHM table information from the cache */ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") @@ -2020,6 +2045,10 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id) } /* end else */ done: + /* Reset the ring in the DXPL */ + if(H5AC_reset_ring(dxpl, orig_ring) < 0) + HDONE_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "unable to set property value") + /* Release the master SOHM table if we took it out of the cache */ if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c index 7706cbd..e24dbb7 100644 --- a/src/H5SMbtree2.c +++ b/src/H5SMbtree2.c @@ -17,8 +17,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5SM_PACKAGE /*suppress error about including H5SMpkg */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ +#include "H5SMmodule.h" /* This source code file is part of the H5SM module */ /***********/ @@ -97,7 +97,7 @@ H5SM_bt2_crt_context(void *_f) { H5F_t *f = (H5F_t *)_f; /* User data for building callback context */ H5SM_bt2_ctx_t *ctx; /* Callback context structure */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 293088c..1bdd95a 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5SM_PACKAGE /*suppress error about including H5SMpkg */ +#include "H5SMmodule.h" /* This source code file is part of the H5SM module */ /***********/ @@ -186,7 +186,7 @@ H5SM__cache_table_deserialize(const void *_image, size_t len, void *_udata, uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ size_t u; /* Counter variable for index headers */ - void * ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -510,7 +510,7 @@ H5SM__cache_list_deserialize(const void *_image, size_t len, void *_udata, uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ size_t u; /* Counter variable for messages in list */ - void * ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c index d2dff47..5dbe5cf 100644 --- a/src/H5SMmessage.c +++ b/src/H5SMmessage.c @@ -17,8 +17,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5SM_PACKAGE /*suppress error about including H5SMpkg */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ +#include "H5SMmodule.h" /* This source code file is part of the H5SM module */ /***********/ diff --git a/src/H5SMmodule.h b/src/H5SMmodule.h new file mode 100644 index 0000000..b6991b6 --- /dev/null +++ b/src/H5SMmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5SM package. Including this header means that the source file + * is part of the H5SM package. + */ +#ifndef _H5SMmodule_H +#define _H5SMmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5SM_MODULE +#define H5_MY_PKG H5SM +#define H5_MY_PKG_ERR H5E_SOHM +#define H5_MY_PKG_INIT NO + +#endif /* _H5SMmodule_H */ + diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h index 68dc484..ac2ba1b 100644 --- a/src/H5SMpkg.h +++ b/src/H5SMpkg.h @@ -21,7 +21,7 @@ * the H5SM shared object header messages package. Source files * outside the H5SM package should include H5SMprivate.h instead. */ -#ifndef H5SM_PACKAGE +#if !(defined H5SM_FRIEND || defined H5SM_MODULE) #error "Do not include this file outside the H5SM package!" #endif diff --git a/src/H5SMtest.c b/src/H5SMtest.c index c4e02bc..798203d 100644 --- a/src/H5SMtest.c +++ b/src/H5SMtest.c @@ -17,7 +17,7 @@ /* Module Setup */ /****************/ -#define H5SM_PACKAGE /*suppress error about including H5SMpkg */ +#include "H5SMmodule.h" /* This source code file is part of the H5SM module */ #define H5SM_TESTING /*suppress warning about H5SM testing funcs*/ diff --git a/src/H5Sall.c b/src/H5Sall.c index 7eab8b3..b8a39cc 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -20,7 +20,7 @@ * Purpose: "All" selection data space I/O functions. */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#include "H5Smodule.h" /* This source code file is part of the H5S module */ #include "H5private.h" /* Generic Functions */ @@ -512,19 +512,25 @@ H5S_all_serial_size (const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_all_serialize (const H5S_t *space, uint8_t **p) +H5S_all_serialize(const H5S_t *space, uint8_t **p) { + uint8_t *pp = (*p); /* Local pointer for decoding */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Check args */ HDassert(space); HDassert(p); - HDassert(*p); + HDassert(pp); /* Store the preamble information */ - UINT32ENCODE(*p, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ - UINT32ENCODE(*p, (uint32_t)1); /* Store the version number */ - UINT32ENCODE(*p, (uint32_t)0); /* Store the un-used padding */ - UINT32ENCODE(*p, (uint32_t)0); /* Store the additional information length */ + UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ + UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */ + UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ + UINT32ENCODE(pp, (uint32_t)0); /* Store the additional information length */ + + /* Update encoding pointer */ + *p = pp; FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_all_serialize() */ diff --git a/src/H5Sdbg.c b/src/H5Sdbg.c index 0cbe4f2..b69604c 100644 --- a/src/H5Sdbg.c +++ b/src/H5Sdbg.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#include "H5Smodule.h" /* This source code file is part of the H5S module */ /***********/ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 51b5ab6..10bcdd6 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -20,7 +20,7 @@ * Purpose: Hyperslab selection data space I/O functions. */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#include "H5Smodule.h" /* This source code file is part of the H5S module */ #include "H5private.h" /* Generic Functions */ @@ -1093,7 +1093,7 @@ H5S_hyper_iter_release (H5S_sel_iter_t *iter) static H5S_hyper_span_t * H5S_hyper_new_span(hsize_t low, hsize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next) { - H5S_hyper_span_t *ret_value; + H5S_hyper_span_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1288,7 +1288,7 @@ H5S_hyper_copy_span_helper (H5S_hyper_span_info_t *spans) H5S_hyper_span_t *new_span; /* Temporary hyperslab span */ H5S_hyper_span_t *prev_span; /* Previous hyperslab span */ H5S_hyper_span_info_t *new_down; /* New down span tree */ - H5S_hyper_span_info_t *ret_value; + H5S_hyper_span_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1374,7 +1374,7 @@ done: static H5S_hyper_span_info_t * H5S_hyper_copy_span(H5S_hyper_span_info_t *spans) { - H5S_hyper_span_info_t *ret_value; + H5S_hyper_span_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1753,9 +1753,9 @@ static htri_t H5S_hyper_is_valid (const H5S_t *space) { unsigned u; /* Counter */ - htri_t ret_value=TRUE; /* return value */ + htri_t ret_value = TRUE; /* return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(FAIL) HDassert(space); @@ -1858,7 +1858,7 @@ H5S_hyper_span_nblocks(H5S_hyper_span_info_t *spans) static hsize_t H5S_get_select_hyper_nblocks(H5S_t *space) { - hsize_t ret_value; /* return value */ + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1940,9 +1940,9 @@ done: static hssize_t H5S_hyper_serial_size(const H5S_t *space) { - unsigned u; /* Counter */ hsize_t block_count; /* block counter for regular hyperslabs */ - hssize_t ret_value; /* return value */ + unsigned u; /* Counter */ + hssize_t ret_value = -1; /* return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1977,14 +1977,14 @@ H5S_hyper_serial_size(const H5S_t *space) PURPOSE Serialize the current selection into a user-provided buffer. USAGE - herr_t H5S_hyper_serialize_helper(spans, start, end, rank, buf) + void H5S_hyper_serialize_helper(spans, start, end, rank, buf) H5S_hyper_span_info_t *spans; IN: Hyperslab span tree to serialize hssize_t start[]; IN/OUT: Accumulated start points hssize_t end[]; IN/OUT: Accumulated end points hsize_t rank; IN: Current rank looking at uint8 *buf; OUT: Buffer to put serialized selection into RETURNS - Non-negative on success/Negative on failure + <none> DESCRIPTION Serializes the current element selection into a buffer. (Primarily for storing on disk). @@ -1993,12 +1993,13 @@ H5S_hyper_serial_size(const H5S_t *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static herr_t -H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hsize_t *start, hsize_t *end, hsize_t rank, uint8_t **p) +static void +H5S_hyper_serialize_helper(const H5S_hyper_span_info_t *spans, + hsize_t *start, hsize_t *end, hsize_t rank, uint8_t **p) { H5S_hyper_span_t *curr; /* Pointer to current hyperslab span */ + uint8_t *pp = (*p); /* Local pointer for decoding */ hsize_t u; /* Index variable */ - herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2007,7 +2008,7 @@ H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hsize_t *start, HDassert(start); HDassert(end); HDassert(rank < H5O_LAYOUT_NDIMS); - HDassert(p && *p); + HDassert(p && pp); /* Walk through the list of spans, recursing or outputing them */ curr=spans->head; @@ -2019,33 +2020,35 @@ H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hsize_t *start, end[rank]=curr->high; /* Recurse down to the next dimension */ - if(H5S_hyper_serialize_helper(curr->down,start,end,rank+1,p)<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans") + *p = pp; + H5S_hyper_serialize_helper(curr->down, start, end, rank + 1, p); } /* end if */ else { /* Encode all the previous dimensions starting & ending points */ /* Encode previous starting points */ for(u=0; u<rank; u++) - UINT32ENCODE(*p, (uint32_t)start[u]); + UINT32ENCODE(pp, (uint32_t)start[u]); /* Encode starting point for this span */ - UINT32ENCODE(*p, (uint32_t)curr->low); + UINT32ENCODE(pp, (uint32_t)curr->low); /* Encode previous ending points */ for(u=0; u<rank; u++) - UINT32ENCODE(*p, (uint32_t)end[u]); + UINT32ENCODE(pp, (uint32_t)end[u]); /* Encode starting point for this span */ - UINT32ENCODE(*p, (uint32_t)curr->high); + UINT32ENCODE(pp, (uint32_t)curr->high); } /* end else */ /* Advance to next node */ curr=curr->next; } /* end while */ -done: - FUNC_LEAVE_NOAPI(ret_value) + /* Update encoding pointer */ + *p = pp; + + FUNC_LEAVE_NOAPI_VOID } /* H5S_hyper_serialize_helper() */ @@ -2071,14 +2074,15 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_hyper_serialize (const H5S_t *space, uint8_t **p) +H5S_hyper_serialize(const H5S_t *space, uint8_t **p) { const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */ + uint8_t *pp = (*p); /* Local pointer for decoding */ hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */ - hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */ + hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */ hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */ hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */ - hsize_t temp_off; /* Offset in a given dimension */ + hsize_t temp_off; /* Offset in a given dimension */ uint8_t *lenp; /* pointer to length location for later storage */ uint32_t len = 0; /* number of bytes used */ hsize_t block_count; /* block counter for regular hyperslabs */ @@ -2088,17 +2092,20 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t **p) FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Check args */ HDassert(space); + HDassert(p); + HDassert(pp); /* Store the preamble information */ - UINT32ENCODE(*p, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ - UINT32ENCODE(*p, (uint32_t)1); /* Store the version number */ - UINT32ENCODE(*p, (uint32_t)0); /* Store the un-used padding */ - lenp = *p; /* keep the pointer to the length location for later */ - *p += 4; /* skip over space for length */ + UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ + UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */ + UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ + lenp = pp; /* keep the pointer to the length location for later */ + pp += 4; /* skip over space for length */ /* Encode number of dimensions */ - UINT32ENCODE(*p, (uint32_t)space->extent.rank); + UINT32ENCODE(pp, (uint32_t)space->extent.rank); len += 4; /* Check for a "regular" hyperslab selection */ @@ -2116,7 +2123,7 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t **p) /* Encode number of hyperslabs */ H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t); - UINT32ENCODE(*p, (uint32_t)block_count); + UINT32ENCODE(pp, (uint32_t)block_count); len+=4; /* Now serialize the information for the regular hyperslab */ @@ -2139,11 +2146,11 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t **p) /* Encode hyperslab starting location */ for(u = 0; u < ndims; u++) - UINT32ENCODE(*p, (uint32_t)offset[u]); + UINT32ENCODE(pp, (uint32_t)offset[u]); /* Encode hyperslab ending location */ for(u = 0; u < ndims; u++) - UINT32ENCODE(*p, (uint32_t)(offset[u] + (diminfo[u].block - 1))); + UINT32ENCODE(pp, (uint32_t)(offset[u] + (diminfo[u].block - 1))); /* Move the offset to the next sequence to start */ offset[fast_dim]+=diminfo[fast_dim].stride; @@ -2194,7 +2201,7 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t **p) /* Encode number of hyperslabs */ block_count = H5S_hyper_span_nblocks(space->select.sel_info.hslab->span_lst); H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t); - UINT32ENCODE(*p, (uint32_t)block_count); + UINT32ENCODE(pp, (uint32_t)block_count); len+=4; /* Add 8 bytes times the rank for each hyperslab selected */ @@ -2202,12 +2209,16 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t **p) len += (uint32_t)(8 * space->extent.rank * block_count); /* Encode each hyperslab in selection */ + *p = pp; H5S_hyper_serialize_helper(space->select.sel_info.hslab->span_lst, start, end, (hsize_t)0, p); } /* end else */ /* Encode length */ UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */ + /* Update encoding pointer */ + *p = pp; + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_hyper_serialize() */ @@ -2235,8 +2246,9 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t **p) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_hyper_deserialize (H5S_t *space, const uint8_t **p) +H5S_hyper_deserialize(H5S_t *space, const uint8_t **p) { + const uint8_t *pp = (*p); /* Local pointer for decoding */ unsigned rank; /* rank of points */ size_t num_elem=0; /* number of elements in selection */ hsize_t start[H5O_LAYOUT_NDIMS]; /* hyperslab start information */ @@ -2257,12 +2269,12 @@ H5S_hyper_deserialize (H5S_t *space, const uint8_t **p) /* Check args */ HDassert(space); HDassert(p); - HDassert(*p); + HDassert(pp); /* Deserialize slabs to select */ /* (The header and rank have already beed decoded) */ rank = space->extent.rank; /* Retrieve rank from space */ - UINT32DECODE(*p,num_elem); /* decode the number of points */ + UINT32DECODE(pp,num_elem); /* decode the number of points */ /* Set the count & stride for all blocks */ for(tcount=count,tstride=stride,j=0; j<rank; j++,tstride++,tcount++) { @@ -2274,11 +2286,11 @@ H5S_hyper_deserialize (H5S_t *space, const uint8_t **p) for(i=0; i<num_elem; i++) { /* Decode the starting points */ for(tstart=start,j=0; j<rank; j++,tstart++) - UINT32DECODE(*p, *tstart); + UINT32DECODE(pp, *tstart); /* Decode the ending points */ for(tend=end,j=0; j<rank; j++,tend++) - UINT32DECODE(*p, *tend); + UINT32DECODE(pp, *tend); /* Change the ending points into blocks */ for(tblock=block,tstart=start,tend=end,j=0; j<rank; j++,tstart++,tend++,tblock++) @@ -2289,6 +2301,9 @@ H5S_hyper_deserialize (H5S_t *space, const uint8_t **p) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") } /* end for */ + /* Update decoding pointer */ + *p = pp; + done: FUNC_LEAVE_NOAPI(ret_value) } /* H5S_hyper_deserialize() */ @@ -2890,7 +2905,7 @@ H5S_hyper_is_contiguous(const H5S_t *space) unsigned u; /* index variable */ htri_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(FAIL) HDassert(space); @@ -3045,6 +3060,7 @@ H5S_hyper_is_contiguous(const H5S_t *space) ret_value=TRUE; } /* end else */ +done: FUNC_LEAVE_NOAPI(ret_value) } /* H5S_hyper_is_contiguous() */ @@ -3075,7 +3091,7 @@ H5S_hyper_is_single(const H5S_t *space) unsigned u; /* index variable */ htri_t ret_value=TRUE; /* return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(FAIL) HDassert(space); @@ -3140,7 +3156,7 @@ done: static htri_t H5S_hyper_is_regular(const H5S_t *space) { - htri_t ret_value; /* return value */ + htri_t ret_value = FAIL; /* return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -3193,13 +3209,15 @@ H5S_hyper_release(H5S_t *space) space->select.num_elem = 0; /* Release irregular hyperslab information */ - if(space->select.sel_info.hslab->span_lst != NULL) { - if(H5S_hyper_free_span_info(space->select.sel_info.hslab->span_lst) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans") - } /* end if */ + if(space->select.sel_info.hslab) { + if(space->select.sel_info.hslab->span_lst != NULL) { + if(H5S_hyper_free_span_info(space->select.sel_info.hslab->span_lst) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans") + } /* end if */ - /* Release space for the hyperslab selection information */ - space->select.sel_info.hslab = H5FL_FREE(H5S_hyper_sel_t, space->select.sel_info.hslab); + /* Release space for the hyperslab selection information */ + space->select.sel_info.hslab = H5FL_FREE(H5S_hyper_sel_t, space->select.sel_info.hslab); + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -4833,7 +4851,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* Merge/add span 'a' with/to a_not_b list */ if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_a->high,span_a->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") /* Advance span 'a', leave span 'b' */ H5S_hyper_recover_span(&recover_a,&span_a,span_a->next); @@ -4848,7 +4866,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* Merge/add lower part of span 'a' with/to a_not_b list */ if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_b->low-1,span_a->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") /* Check for overlaps between upper part of span 'a' and lower part of span 'b' */ @@ -4859,7 +4877,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if(span_a->down==NULL) { /* Merge/add overlapped part with/to a_and_b list */ if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_b->low,span_a->high,NULL,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") } /* end if */ /* If there are down spans, check for the overlap in them and add to each appropriate list */ else { @@ -4876,7 +4894,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if(down_a_not_b!=NULL) { /* Merge/add overlapped part with/to a_not_b list */ if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_b->low,span_a->high,down_a_not_b,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") /* Release the down span tree generated */ H5S_hyper_free_span_info(down_a_not_b); @@ -4886,7 +4904,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if(down_a_and_b!=NULL) { /* Merge/add overlapped part with/to a_and_b list */ if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_b->low,span_a->high,down_a_and_b,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") /* Release the down span tree generated */ H5S_hyper_free_span_info(down_a_and_b); @@ -4896,7 +4914,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if(down_b_not_a!=NULL) { /* Merge/add overlapped part with/to b_not_a list */ if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_a->high,down_b_not_a,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") /* Release the down span tree generated */ H5S_hyper_free_span_info(down_b_not_a); @@ -4935,7 +4953,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* Merge/add lower part of span 'a' with/to a_not_b list */ if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_b->low-1,span_a->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") /* Check for overlaps between middle part of span 'a' and span 'b' */ @@ -4946,7 +4964,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if(span_a->down==NULL) { /* Merge/add overlapped part with/to a_and_b list */ if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_b->low,span_b->high,NULL,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") } /* end if */ /* If there are down spans, check for the overlap in them and add to each appropriate list */ else { @@ -4963,7 +4981,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if(down_a_not_b!=NULL) { /* Merge/add overlapped part with/to a_not_b list */ if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_b->low,span_b->high,down_a_not_b,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") /* Release the down span tree generated */ H5S_hyper_free_span_info(down_a_not_b); @@ -4973,7 +4991,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if(down_a_and_b!=NULL) { /* Merge/add overlapped part with/to a_and_b list */ if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_b->low,span_b->high,down_a_and_b,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") /* Release the down span tree generated */ H5S_hyper_free_span_info(down_a_and_b); @@ -4983,7 +5001,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if(down_b_not_a!=NULL) { /* Merge/add overlapped part with/to b_not_a list */ if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_b->high,down_b_not_a,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") /* Release the down span tree generated */ H5S_hyper_free_span_info(down_b_not_a); @@ -5014,7 +5032,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if(span_a->low>span_b->low) { /* Merge/add lower part of span 'b' with/to b_not_a list */ if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_a->low-1,span_b->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") } /* end if */ else { /* Keep going, nothing to split off */ @@ -5029,7 +5047,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if(span_a->down==NULL) { /* Merge/add overlapped part with/to a_and_b list */ if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_a->low,span_a->high,NULL,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") } /* end if */ /* If there are down spans, check for the overlap in them and add to each appropriate list */ else { @@ -5046,7 +5064,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if(down_a_not_b!=NULL) { /* Merge/add overlapped part with/to a_not_b list */ if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_a->high,down_a_not_b,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") /* Release the down span tree generated */ H5S_hyper_free_span_info(down_a_not_b); @@ -5056,7 +5074,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if(down_a_and_b!=NULL) { /* Merge/add overlapped part with/to a_and_b list */ if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_a->low,span_a->high,down_a_and_b,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") /* Release the down span tree generated */ H5S_hyper_free_span_info(down_a_and_b); @@ -5066,7 +5084,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if(down_b_not_a!=NULL) { /* Merge/add overlapped part with/to b_not_a list */ if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_a->low,span_a->high,down_b_not_a,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") /* Release the down span tree generated */ H5S_hyper_free_span_info(down_b_not_a); @@ -5106,7 +5124,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* Merge/add lower part of span 'b' with/to b_not_a list */ if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_a->low-1,span_b->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") } /* end if */ else { /* Keep going, nothing to split off */ @@ -5121,7 +5139,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if(span_a->down==NULL) { /* Merge/add overlapped part with/to a_and_b list */ if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_a->low,span_b->high,NULL,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") } /* end if */ /* If there are down spans, check for the overlap in them and add to each appropriate list */ else { @@ -5138,7 +5156,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if(down_a_not_b!=NULL) { /* Merge/add overlapped part with/to a_not_b list */ if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_b->high,down_a_not_b,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") /* Release the down span tree generated */ H5S_hyper_free_span_info(down_a_not_b); @@ -5148,7 +5166,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if(down_a_and_b!=NULL) { /* Merge/add overlapped part with/to a_and_b list */ if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_a->low,span_b->high,down_a_and_b,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") /* Release the down span tree generated */ H5S_hyper_free_span_info(down_a_and_b); @@ -5158,7 +5176,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if(down_b_not_a!=NULL) { /* Merge/add overlapped part with/to b_not_a list */ if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_a->low,span_b->high,down_b_not_a,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") /* Release the down span tree generated */ H5S_hyper_free_span_info(down_b_not_a); @@ -5187,7 +5205,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* Merge/add span 'b' with/to b_not_a list */ if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_b->high,span_b->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") /* Advance span 'b', leave span 'a' */ H5S_hyper_recover_span(&recover_b,&span_b,span_b->next); @@ -5201,7 +5219,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* Merge/add span 'a' with/to a_not_b list */ if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_a->high,span_a->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") /* Advance to the next 'a' span */ H5S_hyper_recover_span(&recover_a,&span_a,span_a->next); @@ -5214,7 +5232,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* Merge/add span 'b' with/to b_not_a list */ if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_b->high,span_b->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") /* Advance to the next 'b' span */ H5S_hyper_recover_span(&recover_b,&span_b,span_b->next); @@ -5259,7 +5277,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf H5S_hyper_span_t *span_b; /* Pointer to current span 'b' working on */ H5S_hyper_span_t *prev_span_merge; /* Pointer to previous merged span */ unsigned recover_a, recover_b; /* Flags to indicate when to recover temporary spans */ - H5S_hyper_span_info_t *ret_value; + H5S_hyper_span_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -5296,7 +5314,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf if(span_a->high<span_b->low) { /* Merge/add span 'a' with/to the merged spans */ if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_a->high,span_a->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") /* Advance span 'a' */ H5S_hyper_recover_span(&recover_a,&span_a,span_a->next); @@ -5311,19 +5329,19 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf if(H5S_hyper_cmp_spans(span_a->down,span_b->down)==TRUE) { /* Merge/add copy of span 'a' with/to merged spans */ if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_a->high,span_a->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") } /* end if */ else { /* Merge/add lower part of span 'a' with/to merged spans */ if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_b->low-1,span_a->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") /* Get merged span tree for overlapped section */ tmp_spans=H5S_hyper_merge_spans_helper(span_a->down,span_b->down); /* Merge/add overlapped section to merged spans */ if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_a->high,tmp_spans,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") /* Release merged span tree for overlapped section */ H5S_hyper_free_span_info(tmp_spans); @@ -5360,19 +5378,19 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf if(H5S_hyper_cmp_spans(span_a->down,span_b->down)==TRUE) { /* Merge/add copy of lower & middle parts of span 'a' to merged spans */ if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_b->high,span_a->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") } /* end if */ else { /* Merge/add lower part of span 'a' to merged spans */ if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_b->low-1,span_a->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") /* Get merged span tree for overlapped section */ tmp_spans=H5S_hyper_merge_spans_helper(span_a->down,span_b->down); /* Merge/add overlapped section to merged spans */ if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_b->high,tmp_spans,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") /* Release merged span tree for overlapped section */ H5S_hyper_free_span_info(tmp_spans); @@ -5400,14 +5418,14 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf if(H5S_hyper_cmp_spans(span_a->down,span_b->down)==TRUE) { /* Merge/add copy of lower & middle parts of span 'b' to merged spans */ if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_a->high,span_a->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") } /* end if */ else { /* Check if there is a lower part of span 'b' */ if(span_a->low>span_b->low) { /* Merge/add lower part of span 'b' to merged spans */ if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_a->low-1,span_b->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") } /* end if */ else { /* No lower part of span 'b' , keep going... */ @@ -5418,7 +5436,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf /* Merge/add overlapped section to merged spans */ if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_a->high,tmp_spans,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") /* Release merged span tree for overlapped section */ H5S_hyper_free_span_info(tmp_spans); @@ -5455,14 +5473,14 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf if(H5S_hyper_cmp_spans(span_a->down,span_b->down)==TRUE) { /* Merge/add copy of span 'b' to merged spans if so */ if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_b->high,span_b->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") } /* end if */ else { /* Check if there is a lower part of span 'b' */ if(span_a->low>span_b->low) { /* Merge/add lower part of span 'b' to merged spans */ if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_a->low-1,span_b->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") } /* end if */ else { /* No lower part of span 'b' , keep going... */ @@ -5473,7 +5491,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf /* Merge/add overlapped section to merged spans */ if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_b->high,tmp_spans,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") /* Release merged span tree for overlapped section */ H5S_hyper_free_span_info(tmp_spans); @@ -5499,7 +5517,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf else { /* Merge/add span 'b' with the merged spans */ if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_b->high,span_b->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") /* Advance span 'b' */ H5S_hyper_recover_span(&recover_b,&span_b,span_b->next); @@ -5511,7 +5529,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf while(span_a!=NULL) { /* Merge/add all 'a' spans into the merged spans */ if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_a->high,span_a->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") /* Advance to next 'a' span, until all processed */ H5S_hyper_recover_span(&recover_a,&span_a,span_a->next); @@ -5523,7 +5541,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf while(span_b!=NULL) { /* Merge/add all 'b' spans into the merged spans */ if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_b->high,span_b->down,NULL)==FAIL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") /* Advance to next 'b' span, until all processed */ H5S_hyper_recover_span(&recover_b,&span_b,span_b->next); @@ -5627,7 +5645,7 @@ static hsize_t H5S_hyper_spans_nelem (H5S_hyper_span_info_t *spans) { H5S_hyper_span_t *span; /* Hyperslab span */ - hsize_t ret_value; + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -5689,7 +5707,7 @@ H5S_hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride, hsize_t stride_iter; /* Iterator over the stride values */ int i; /* Counters */ unsigned u; /* Counters */ - H5S_hyper_span_info_t *ret_value; /* Return value */ + H5S_hyper_span_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -7099,8 +7117,8 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release hyperslab") /* Allocate space for the hyperslab selection information */ - if((space->select.sel_info.hslab=H5FL_MALLOC(H5S_hyper_sel_t))==NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab info") + if(NULL == (space->select.sel_info.hslab = H5FL_MALLOC(H5S_hyper_sel_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info") /* Save the diminfo */ space->select.num_elem=1; @@ -7119,32 +7137,32 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, } /* end for */ /* Indicate that the dimension information is valid */ - space->select.sel_info.hslab->diminfo_valid=TRUE; + space->select.sel_info.hslab->diminfo_valid = TRUE; /* Indicate that there's no slab information */ - space->select.sel_info.hslab->span_lst=NULL; + space->select.sel_info.hslab->span_lst = NULL; } /* end if */ else if(op>=H5S_SELECT_OR && op<=H5S_SELECT_NOTA) { /* Sanity check */ HDassert(H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS); /* Check if there's no hyperslab span information currently */ - if(space->select.sel_info.hslab->span_lst==NULL) - if(H5S_hyper_generate_spans(space)<0) + if(NULL == space->select.sel_info.hslab->span_lst) + if(H5S_hyper_generate_spans(space) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree") + /* Indicate that the regular dimensions are no longer valid */ + space->select.sel_info.hslab->diminfo_valid = FALSE; + /* Add in the new hyperslab information */ if(H5S_generate_hyperslab (space, op, start, opt_stride, opt_count, opt_block)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs") - - /* Indicate that the regular dimensions are no longer valid */ - space->select.sel_info.hslab->diminfo_valid=FALSE; } /* end if */ else HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation") /* Set selection type */ - space->select.type=H5S_sel_hyper; + space->select.type = H5S_sel_hyper; done: FUNC_LEAVE_NOAPI(ret_value) @@ -8720,7 +8738,7 @@ H5S_hyper_get_seq_list(const H5S_t *space, unsigned H5_ATTR_UNUSED flags, H5S_se size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem, hsize_t *off, size_t *len) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -8794,7 +8812,7 @@ H5S_hyper_get_seq_list(const H5S_t *space, unsigned H5_ATTR_UNUSED flags, H5S_se /* Make certain that we don't write too many */ actual_elem = MIN3(leftover, (size_t)iter->elmt_left, maxelem); - /* initialize row sizes for each dimension */ + /* Initialize row sizes for each dimension */ elem_size = iter->elmt_size; for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) { slab[i] = acc; diff --git a/src/H5Smodule.h b/src/H5Smodule.h new file mode 100644 index 0000000..d4d94f2 --- /dev/null +++ b/src/H5Smodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5S package. Including this header means that the source file + * is part of the H5S package. + */ +#ifndef _H5Smodule_H +#define _H5Smodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5S_MODULE +#define H5_MY_PKG H5S +#define H5_MY_PKG_ERR H5E_DATASPACE +#define H5_MY_PKG_INIT YES + +#endif /* _H5Smodule_H */ + diff --git a/src/H5Smpio.c b/src/H5Smpio.c index c2190b4..1f97bc8 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -22,7 +22,7 @@ * I didn't make them portable. */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#include "H5Smodule.h" /* This source code file is part of the H5S module */ #include "H5private.h" /* Generic Functions */ diff --git a/src/H5Snone.c b/src/H5Snone.c index a67880e..19d5eed 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -20,7 +20,7 @@ * Purpose: "None" selection data space I/O functions. */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#include "H5Smodule.h" /* This source code file is part of the H5S module */ #include "H5private.h" @@ -482,15 +482,23 @@ H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space) static herr_t H5S_none_serialize(const H5S_t *space, uint8_t **p) { + uint8_t *pp = (*p); /* Local pointer for decoding */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Check args */ HDassert(space); + HDassert(p); + HDassert(pp); /* Store the preamble information */ - UINT32ENCODE(*p, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ - UINT32ENCODE(*p, (uint32_t)1); /* Store the version number */ - UINT32ENCODE(*p, (uint32_t)0); /* Store the un-used padding */ - UINT32ENCODE(*p, (uint32_t)0); /* Store the additional information length */ + UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ + UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */ + UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ + UINT32ENCODE(pp, (uint32_t)0); /* Store the additional information length */ + + /* Update encoding pointer */ + *p = pp; FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_none_serialize() */ diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 5f84717..933de64 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -21,7 +21,7 @@ * the H5S package. Source files outside the H5S package should * include H5Sprivate.h instead. */ -#ifndef H5S_PACKAGE +#if !(defined H5S_FRIEND || defined H5S_MODULE) #error "Do not include this file outside the H5S package!" #endif @@ -131,7 +131,7 @@ typedef htri_t (*H5S_sel_is_valid_func_t)(const H5S_t *space); typedef hssize_t (*H5S_sel_serial_size_func_t)(const H5S_t *space); /* Method to store current selection in "serialized" form (a byte sequence suitable for storing on disk) */ typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t **p); -/* Method to store create selection from "serialized" form (a byte sequence suitable for storing on disk) */ +/* Method to create selection from "serialized" form (a byte sequence suitable for storing on disk) */ typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t *space, const uint8_t **p); /* Method to determine smallest n-D bounding box containing the current selection */ typedef herr_t (*H5S_sel_bounds_func_t)(const H5S_t *space, hsize_t *start, hsize_t *end); @@ -245,7 +245,7 @@ H5_DLLVAR const H5S_select_class_t H5S_sel_point[1]; /* Extent functions */ H5_DLL herr_t H5S_extent_release(H5S_extent_t *extent); -H5_DLL herr_t H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src, +H5_DLL herr_t H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_max); /* Operations on selections */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 20a60bb..daee160 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -20,7 +20,7 @@ * Purpose: Point selection data space I/O functions. */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#include "H5Smodule.h" /* This source code file is part of the H5S module */ #include "H5private.h" /* Generic Functions */ @@ -774,7 +774,7 @@ static hssize_t H5S_point_serial_size (const H5S_t *space) { H5S_pnt_node_t *curr; /* Point information nodes */ - hssize_t ret_value; /* return value */ + hssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -822,28 +822,32 @@ H5S_point_serial_size (const H5S_t *space) static herr_t H5S_point_serialize (const H5S_t *space, uint8_t **p) { - H5S_pnt_node_t *curr; /* Point information nodes */ - uint8_t *lenp; /* pointer to length location for later storage */ - uint32_t len=0; /* number of bytes used */ - unsigned u; /* local counting variable */ + H5S_pnt_node_t *curr; /* Point information nodes */ + uint8_t *pp = (*p); /* Local pointer for decoding */ + uint8_t *lenp; /* pointer to length location for later storage */ + uint32_t len=0; /* number of bytes used */ + unsigned u; /* local counting variable */ FUNC_ENTER_NOAPI_NOINIT_NOERR + /* Check args */ HDassert(space); + HDassert(p); + HDassert(pp); /* Store the preamble information */ - UINT32ENCODE(*p, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ - UINT32ENCODE(*p, (uint32_t)1); /* Store the version number */ - UINT32ENCODE(*p, (uint32_t)0); /* Store the un-used padding */ - lenp=*p; /* keep the pointer to the length location for later */ - *p+=4; /* skip over space for length */ + UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ + UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */ + UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ + lenp = pp; /* Keep the pointer to the length location for later */ + pp += 4; /* Skip over space for length */ /* Encode number of dimensions */ - UINT32ENCODE(*p, (uint32_t)space->extent.rank); + UINT32ENCODE(pp, (uint32_t)space->extent.rank); len+=4; /* Encode number of elements */ - UINT32ENCODE(*p, (uint32_t)space->select.num_elem); + UINT32ENCODE(pp, (uint32_t)space->select.num_elem); len+=4; /* Encode each point in selection */ @@ -854,7 +858,7 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p) /* Encode each point */ for(u=0; u<space->extent.rank; u++) - UINT32ENCODE(*p, (uint32_t)curr->pnt[u]); + UINT32ENCODE(pp, (uint32_t)curr->pnt[u]); curr=curr->next; } /* end while */ @@ -862,6 +866,9 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p) /* Encode length */ UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */ + /* Update encoding pointer */ + *p = pp; + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_serialize() */ @@ -891,24 +898,25 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p) static herr_t H5S_point_deserialize (H5S_t *space, const uint8_t **p) { - H5S_seloper_t op=H5S_SELECT_SET; /* Selection operation */ - unsigned rank; /* Rank of points */ - size_t num_elem=0; /* Number of elements in selection */ - hsize_t *coord=NULL, *tcoord; /* Pointer to array of elements */ + H5S_seloper_t op = H5S_SELECT_SET; /* Selection operation */ + hsize_t *coord = NULL, *tcoord; /* Pointer to array of elements */ + const uint8_t *pp = (*p); /* Local pointer for decoding */ + size_t num_elem = 0; /* Number of elements in selection */ + unsigned rank; /* Rank of points */ unsigned i, j; /* local counting variables */ - herr_t ret_value = SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Check args */ HDassert(space); HDassert(p); - HDassert(*p); + HDassert(pp); /* Deserialize points to select */ /* (The header and rank have already beed decoded) */ rank = space->extent.rank; /* Retrieve rank from space */ - UINT32DECODE(*p, num_elem); /* decode the number of points */ + UINT32DECODE(pp, num_elem); /* decode the number of points */ /* Allocate space for the coordinates */ if(NULL == (coord = (hsize_t *)H5MM_malloc(num_elem * rank * sizeof(hsize_t)))) @@ -917,12 +925,15 @@ H5S_point_deserialize (H5S_t *space, const uint8_t **p) /* Retrieve the coordinates from the buffer */ for(tcoord = coord, i = 0; i < num_elem; i++) for(j = 0; j < (unsigned)rank; j++, tcoord++) - UINT32DECODE(*p, *tcoord); + UINT32DECODE(pp, *tcoord); /* Select points */ if(H5S_select_elements(space, op, num_elem, (const hsize_t *)coord) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + /* Update decoding pointer */ + *p = pp; + done: /* Free the coordinate array if necessary */ if(coord != NULL) @@ -1208,7 +1219,7 @@ done: static htri_t H5S_point_is_contiguous(const H5S_t *space) { - htri_t ret_value; /* return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1245,7 +1256,7 @@ H5S_point_is_contiguous(const H5S_t *space) static htri_t H5S_point_is_single(const H5S_t *space) { - htri_t ret_value; /* return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1285,7 +1296,7 @@ H5S_point_is_single(const H5S_t *space) static htri_t H5S_point_is_regular(const H5S_t *space) { - htri_t ret_value; /* return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 7b7b8c6..b6b974d 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -116,7 +116,7 @@ typedef struct H5S_sel_iter_t { } H5S_sel_iter_t; /* If the module using this macro is allowed access to the private variables, access them directly */ -#ifdef H5S_PACKAGE +#ifdef H5S_MODULE #define H5S_GET_EXTENT_TYPE(S) ((S)->extent.type) #define H5S_GET_EXTENT_NDIMS(S) ((S)->extent.rank) #define H5S_GET_EXTENT_NPOINTS(S) ((S)->extent.nelem) @@ -142,7 +142,7 @@ typedef struct H5S_sel_iter_t { #define H5S_SELECT_ITER_NEXT(ITER,NELEM)((*(ITER)->type->iter_next)(ITER,NELEM)) #define H5S_SELECT_ITER_NEXT_BLOCK(ITER) ((*(ITER)->type->iter_next_block)(ITER)) #define H5S_SELECT_ITER_RELEASE(ITER) ((*(ITER)->type->iter_release)(ITER)) -#else /* H5S_PACKAGE */ +#else /* H5S_MODULE */ #define H5S_GET_EXTENT_TYPE(S) (H5S_get_simple_extent_type(S)) #define H5S_GET_EXTENT_NDIMS(S) (H5S_get_simple_extent_ndims(S)) #define H5S_GET_EXTENT_NPOINTS(S) (H5S_get_simple_extent_npoints(S)) @@ -168,7 +168,7 @@ typedef struct H5S_sel_iter_t { #define H5S_SELECT_ITER_NEXT(ITER,NELEM)(H5S_select_iter_next(ITER,NELEM)) #define H5S_SELECT_ITER_NEXT_BLOCK(ITER) (H5S_select_iter_next_block(ITER)) #define H5S_SELECT_ITER_RELEASE(ITER) (H5S_select_iter_release(ITER)) -#endif /* H5S_PACKAGE */ +#endif /* H5S_MODULE */ /* Handle these two callbacks in a special way, since they have prologs that need to be executed */ #define H5S_SELECT_COPY(DST,SRC,SHARE) (H5S_select_copy(DST,SRC,SHARE)) #define H5S_SELECT_DESERIALIZE(S,BUF) (H5S_select_deserialize(S,BUF)) @@ -190,6 +190,8 @@ H5_DLL herr_t H5S_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, H5S_t *ds); H5_DLL H5S_t *H5S_read(const struct H5O_loc_t *loc, hid_t dxpl_id); H5_DLL htri_t H5S_set_extent(H5S_t *space, const hsize_t *size); H5_DLL herr_t H5S_set_extent_real(H5S_t *space, const hsize_t *size); +H5_DLL herr_t H5S_set_extent_simple(H5S_t *space, unsigned rank, + const hsize_t *dims, const hsize_t *max); H5_DLL H5S_t *H5S_create(H5S_class_t type); H5_DLL H5S_t *H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/*rank*/]); @@ -204,6 +206,7 @@ H5_DLL int H5S_extend(H5S_t *space, const hsize_t *size); H5_DLL hsize_t H5S_extent_nelem(const H5S_extent_t *ext); H5_DLL int H5S_extent_get_dims(const H5S_extent_t *ext, hsize_t dims[], hsize_t max_dims[]); H5_DLL htri_t H5S_extent_equal(const H5S_t *ds1, const H5S_t *ds2); +H5_DLL herr_t H5S_extent_copy(H5S_t *dst, const H5S_t *src); /* Operations on selections */ H5_DLL herr_t H5S_select_deserialize(H5S_t **space, const uint8_t **p); diff --git a/src/H5Spublic.h b/src/H5Spublic.h index 37d3866..721c4bf 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -25,7 +25,7 @@ /* Define atomic datatypes */ #define H5S_ALL (hid_t)0 -#define H5S_UNLIMITED ((hsize_t)(hssize_t)(-1)) +#define H5S_UNLIMITED HSIZE_UNDEF /* Define user-level maximum number of dimensions */ #define H5S_MAX_RANK 32 diff --git a/src/H5Sselect.c b/src/H5Sselect.c index e04ae16..153c691 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -19,7 +19,7 @@ * Purpose: Dataspace selection functions. */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#include "H5Smodule.h" /* This source code file is part of the H5S module */ #include "H5private.h" /* Generic Functions */ @@ -107,7 +107,7 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset) herr_t H5S_select_copy (H5S_t *dst, const H5S_t *src, hbool_t share_selection) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -148,7 +148,7 @@ done: herr_t H5S_select_release(H5S_t *ds) { - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -185,7 +185,7 @@ H5S_select_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len) { - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -220,7 +220,7 @@ H5S_select_get_seq_list(const H5S_t *space, unsigned flags, hssize_t H5S_select_serial_size(const H5S_t *space) { - hssize_t ret_value; /* Return value */ + hssize_t ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -411,7 +411,7 @@ done: htri_t H5S_select_valid(const H5S_t *space) { - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -450,12 +450,12 @@ H5S_select_valid(const H5S_t *space) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_select_deserialize (H5S_t **space, const uint8_t **p) +H5S_select_deserialize(H5S_t **space, const uint8_t **p) { - H5S_t *tmp_space; /* Pointer to actual dataspace to use, either - *space or a newly allocated one */ - uint32_t sel_type; /* Pointer to the selection type */ - herr_t ret_value=FAIL; /* return value */ + H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, either + *space or a newly allocated one */ + uint32_t sel_type; /* Pointer to the selection type */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -482,9 +482,14 @@ H5S_select_deserialize (H5S_t **space, const uint8_t **p) /* Decode the rank of the point selection */ UINT32DECODE(*p,rank); - if(!*space) + if(!*space) { + hsize_t dims[H5S_MAX_RANK]; + /* Patch the rank of the allocated dataspace */ - tmp_space->extent.rank = rank; + (void)HDmemset(dims, 0, (size_t)rank * sizeof(dims[0])); + if(H5S_set_extent_simple(tmp_space, rank, dims, NULL) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions") + } /* end if */ else /* Verify the rank of the provided dataspace */ if(rank != tmp_space->extent.rank) @@ -611,7 +616,7 @@ done: herr_t H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -652,7 +657,7 @@ H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) herr_t H5S_get_select_offset(const H5S_t *space, hsize_t *offset) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -690,7 +695,7 @@ H5S_get_select_offset(const H5S_t *space, hsize_t *offset) htri_t H5S_select_is_contiguous(const H5S_t *space) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -727,7 +732,7 @@ H5S_select_is_contiguous(const H5S_t *space) htri_t H5S_select_is_single(const H5S_t *space) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -764,7 +769,7 @@ H5S_select_is_single(const H5S_t *space) htri_t H5S_select_is_regular(const H5S_t *space) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -801,7 +806,7 @@ H5S_select_is_regular(const H5S_t *space) herr_t H5S_select_adjust_u(H5S_t *space, const hsize_t *offset) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -839,7 +844,7 @@ H5S_select_adjust_u(H5S_t *space, const hsize_t *offset) herr_t H5S_select_project_scalar(const H5S_t *space, hsize_t *offset) { - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -879,7 +884,7 @@ H5S_select_project_scalar(const H5S_t *space, hsize_t *offset) herr_t H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset) { - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -914,7 +919,7 @@ H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset) herr_t H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_size) { - herr_t ret_value; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -969,7 +974,7 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s herr_t H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1051,7 +1056,7 @@ H5S_select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) hsize_t H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter) { - hsize_t ret_value; /* return value */ + hsize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1130,7 +1135,7 @@ H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter) herr_t H5S_select_iter_next(H5S_sel_iter_t *iter, size_t nelem) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1213,7 +1218,7 @@ H5S_select_iter_next_block(H5S_sel_iter_t *iter) herr_t H5S_select_iter_release(H5S_sel_iter_t *sel_iter) { - herr_t ret_value; /* return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1430,7 +1435,7 @@ done: H5S_sel_type H5S_get_select_type(const H5S_t *space) { - H5S_sel_type ret_value; /* Return value */ + H5S_sel_type ret_value = H5S_SEL_ERROR; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Stest.c b/src/H5Stest.c index 62a4179..e1f4b61 100644 --- a/src/H5Stest.c +++ b/src/H5Stest.c @@ -19,7 +19,7 @@ * Purpose: Dataspace selection testing functions. */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#include "H5Smodule.h" /* This source code file is part of the H5S module */ #define H5S_TESTING /*suppress warning about H5S testing funcs*/ @@ -54,7 +54,7 @@ H5S_select_shape_same_test(hid_t sid1, hid_t sid2) { H5S_t *space1; /* Pointer to 1st dataspace */ H5S_t *space2; /* Pointer to 2nd dataspace */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -95,7 +95,7 @@ htri_t H5S_get_rebuild_status_test(hid_t space_id) { H5S_t *space; /* Pointer to 1st dataspace */ - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1,4 +1,3 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * @@ -25,10 +24,7 @@ /* Module Setup */ /****************/ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ /***********/ @@ -304,12 +300,15 @@ H5T_order_t H5T_native_order_g = H5T_ORDER_ERROR; /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* * Predefined data types. These are initialized at runtime in H5Tinit.c and - * by H5T_init_interface() in this source file. + * by H5T__init_package() in this source file. * * If more of these are added, the new ones must be added to the list of - * types to reset in H5T_term_interface(). + * types to reset in H5T_term_package(). */ hid_t H5T_IEEE_F32BE_g = FAIL; hid_t H5T_IEEE_F32LE_g = FAIL; @@ -529,6 +528,9 @@ static const H5I_class_t H5I_DATATYPE_CLS[1] = {{ (H5I_free_t)H5T_close /* Callback routine for closing objects of this class */ }}; +/* Flag indicating "top" of interface has been initialized */ +static hbool_t H5T_top_package_initialize_s = FALSE; + /*------------------------------------------------------------------------- @@ -537,48 +539,42 @@ static const H5I_class_t H5I_DATATYPE_CLS[1] = {{ * Purpose: Initialize the interface from some other package. * * Return: Success: non-negative - * * Failure: negative * * Programmer: Robb Matzke * Wednesday, December 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5T_init(void) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* FUNC_ENTER() does all the work */ done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5T_init() */ /*------------------------------------------------------------------------- - * Function: H5T_init_inf + * Function: H5T__init_inf * * Purpose: Initialize the +/- Infinity floating-poing values for type * conversion. * * Return: Success: non-negative - * * Failure: negative * * Programmer: Quincey Koziol * Saturday, November 22, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5T_init_inf(void) +H5T__init_inf(void) { H5T_t *dst_p; /* Datatype type operate on */ H5T_atomic_t *dst; /* Datatype's atomic info */ @@ -587,7 +583,7 @@ H5T_init_inf(void) size_t u; /* Local index value */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get the float datatype */ if(NULL == (dst_p = (H5T_t *)H5I_object(H5T_NATIVE_FLOAT_g))) @@ -673,63 +669,22 @@ H5T_init_inf(void) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T_init_inf() */ - - -/*------------------------------------------------------------------------- - * Function: H5T_init_hw - * - * Purpose: Perform hardware specific [floating-point] initialization - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Quincey Koziol - * Monday, November 24, 2003 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5T_init_hw(void) -{ -#ifdef H5_HAVE_GET_FPC_CSR - union fpc_csr csr; /* Union to hold results of floating-point status register query */ -#endif /* H5_HAVE_GET_FPC_CSR */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT_NOERR - -#ifdef H5_HAVE_GET_FPC_CSR - /* [This code is specific to SGI machines] */ - - /* Get the floating-point status register */ - csr.fc_word = get_fpc_csr(); - - /* If the "flush denormalized values to zero" flag is set, unset it */ - if(csr.fc_struct.flush) { - csr.fc_struct.flush = 0; - set_fpc_csr(csr.fc_word); - } /* end if */ -#endif /* H5_HAVE_GET_FPC_CSR */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T_init_hw() */ +} /* end H5T__init_inf() */ /*-------------------------------------------------------------------------- NAME - H5T_init_interface -- Initialize interface-specific information + H5T__init_package -- Initialize interface-specific information USAGE - herr_t H5T_init_interface() - + herr__t H5T_init_package() RETURNS Non-negative on success/Negative on failure DESCRIPTION Initializes any interface-specific data or routines. --------------------------------------------------------------------------*/ -static herr_t -H5T_init_interface(void) +herr_t +H5T__init_package(void) { H5T_t *native_schar=NULL; /* Datatype structure for native signed char */ H5T_t *native_uchar=NULL; /* Datatype structure for native unsigned char */ @@ -777,17 +732,13 @@ H5T_init_interface(void) /* Make certain there aren't too many classes of datatypes defined */ /* Only 16 (numbered 0-15) are supported in the current file format */ - HDassert(H5T_NCLASSES < 16); - - /* Perform any necessary hardware initializations */ - if(H5T_init_hw() < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface") + HDcompile_assert(H5T_NCLASSES < 16); /* * Initialize pre-defined native datatypes from code generated during * the library configuration by H5detect. */ - if(H5TN_init_interface() < 0) + if(H5T__init_native() < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface") /* Get the atomic datatype structures needed by the initialization code below */ @@ -1004,7 +955,7 @@ H5T_init_interface(void) /* One-byte character string */ H5T_INIT_TYPE(CSTRING, H5T_C_S1_g, ALLOC, -, SET, 1) - string=dt; /* Keep type for later */ + string = dt; /* Keep type for later */ /*------------------------------------------------------------ * The `Fortran' architecture @@ -1021,7 +972,7 @@ H5T_init_interface(void) /* Object reference (i.e. object header address in file) */ H5T_INIT_TYPE(OBJREF, H5T_STD_REF_OBJ_g, ALLOC, -, SET, H5R_OBJ_REF_BUF_SIZE) - objref=dt; /* Keep type for later */ + objref = dt; /* Keep type for later */ /* Dataset Region reference (i.e. selection inside a dataset) */ H5T_INIT_TYPE(REGREF, H5T_STD_REF_DSETREG_g, ALLOC, -, SET, H5R_DSET_REG_REF_BUF_SIZE) @@ -1263,6 +1214,7 @@ H5T_init_interface(void) status |= H5T_register(H5T_PERS_HARD, "dbl_uint", native_double, native_uint, H5T__conv_double_uint, H5AC_ind_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_HARD, "ldbl_uint", native_ldouble, native_uint, H5T__conv_ldouble_uint, H5AC_ind_dxpl_id, FALSE); + /* From floats to long */ status |= H5T_register(H5T_PERS_HARD, "flt_long", native_float, native_long, H5T__conv_float_long, H5AC_ind_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_HARD, "dbl_long", native_double, native_long, H5T__conv_double_long, H5AC_ind_dxpl_id, FALSE); status |= H5T_register(H5T_PERS_HARD, "ldbl_long", native_ldouble, native_long, H5T__conv_ldouble_long, H5AC_ind_dxpl_id, FALSE); @@ -1294,13 +1246,13 @@ H5T_init_interface(void) status |= H5T_register(H5T_PERS_HARD, "no-op", native_int, native_int, H5T__conv_noop, H5AC_ind_dxpl_id, FALSE); /* Initialize the +/- Infinity values for floating-point types */ - status |= H5T_init_inf(); + status |= H5T__init_inf(); - if (status<0) + if(status < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to register conversion function(s)") /* Register datatype creation property class properties here. See similar - * code in H5D_init_interface(), etc. for example. + * code in H5D__init_package(), etc. for example. */ /* Only register the default property list if it hasn't been created yet */ @@ -1313,6 +1265,9 @@ H5T_init_interface(void) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class") } /* end if */ + /* Mark "top" of interface as initialized, too */ + H5T_top_package_initialize_s = TRUE; + done: /* General cleanup */ if(compound != NULL) @@ -1338,11 +1293,11 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5T_init_interface() */ +} /* end H5T__init_package() */ /*------------------------------------------------------------------------- - * Function: H5T_unlock_cb + * Function: H5T__unlock_cb * * Purpose: Clear the immutable flag for a datatype. This function is * called when the library is closing in order to unlock all @@ -1356,198 +1311,252 @@ done: *------------------------------------------------------------------------- */ static int -H5T_unlock_cb(void *_dt, hid_t H5_ATTR_UNUSED id, void H5_ATTR_UNUSED *key) +H5T__unlock_cb(void *_dt, hid_t H5_ATTR_UNUSED id, void *_udata) { H5T_t *dt = (H5T_t *)_dt; + int *n = (int *)_udata; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR + + HDassert(dt && dt->shared); - HDassert (dt && dt->shared); - if (H5T_STATE_IMMUTABLE==dt->shared->state) + if(H5T_STATE_IMMUTABLE==dt->shared->state) { dt->shared->state = H5T_STATE_RDONLY; + (*n)++; + } /* end if */ + FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5T_unlock_cb() */ +} /* end H5T__unlock_cb() */ /*------------------------------------------------------------------------- - * Function: H5T_term_interface + * Function: H5T_top_term_package * - * Purpose: Close this interface. + * Purpose: Close the "top" of the interface, releasing IDs, etc. * * Return: Success: Positive if any action might have caused a - * change in some other interface; zero - * otherwise. - * + * change in some other interface; zero otherwise. * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 20, 1998 + * Programmer: Quincey Koziol + * Thursday, September 10, 2015 * *------------------------------------------------------------------------- */ int -H5T_term_interface(void) +H5T_top_term_package(void) { int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { - int i, nprint = 0; - + if(H5T_top_package_initialize_s) { /* Unregister all conversion functions */ - for(i = 0; i < H5T_g.npaths; i++) { - H5T_path_t *path; - - path = H5T_g.path[i]; - HDassert(path); - if(path->func) { - H5T__print_stats(path, &nprint/*in,out*/); - path->cdata.command = H5T_CONV_FREE; - if((path->func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, - (size_t)0, (size_t)0, NULL, NULL,H5AC_ind_dxpl_id) < 0) { + if(H5T_g.path) { + int i, nprint = 0; + + for(i = 0; i < H5T_g.npaths; i++) { + H5T_path_t *path; + + path = H5T_g.path[i]; + HDassert(path); + if(path->func) { + H5T__print_stats(path, &nprint/*in,out*/); + path->cdata.command = H5T_CONV_FREE; + if((path->func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, + (size_t)0, (size_t)0, NULL, NULL,H5AC_ind_dxpl_id) < 0) { #ifdef H5T_DEBUG - if (H5DEBUG(T)) { - fprintf(H5DEBUG(T), "H5T: conversion function " - "0x%08lx failed to free private data for " - "%s (ignored)\n", - (unsigned long)(path->func), path->name); - } /* end if */ + if (H5DEBUG(T)) { + fprintf(H5DEBUG(T), "H5T: conversion function " + "0x%08lx failed to free private data for " + "%s (ignored)\n", + (unsigned long)(path->func), path->name); + } /* end if */ #endif - H5E_clear_stack(NULL); /*ignore the error*/ - } /* end if */ - } /* end if */ + H5E_clear_stack(NULL); /*ignore the error*/ + } /* end if */ + } /* end if */ - if(path->src) - H5T_close(path->src); - if(path->dst) - H5T_close(path->dst); - path = H5FL_FREE(H5T_path_t, path); - H5T_g.path[i] = NULL; - } /* end for */ + if(path->src) + H5T_close(path->src); + if(path->dst) + H5T_close(path->dst); + path = H5FL_FREE(H5T_path_t, path); + H5T_g.path[i] = NULL; + } /* end for */ + + /* Clear conversion tables */ + H5T_g.path = (H5T_path_t **)H5MM_xfree(H5T_g.path); + H5T_g.npaths = 0; + H5T_g.apaths = 0; + H5T_g.soft = (H5T_soft_t *)H5MM_xfree(H5T_g.soft); + H5T_g.nsoft = 0; + H5T_g.asoft = 0; - /* Clear conversion tables */ - H5T_g.path = (H5T_path_t **)H5MM_xfree(H5T_g.path); - H5T_g.npaths = 0; - H5T_g.apaths = 0; - H5T_g.soft = (H5T_soft_t *)H5MM_xfree(H5T_g.soft); - H5T_g.nsoft = 0; - H5T_g.asoft = 0; + n++; + } /* end if */ /* Unlock all datatypes, then free them */ /* note that we are ignoring the return value from H5I_iterate() */ - H5I_iterate(H5I_DATATYPE, H5T_unlock_cb, NULL, FALSE); + /* Also note that we are incrementing 'n' in the callback */ + H5I_iterate(H5I_DATATYPE, H5T__unlock_cb, &n, FALSE); - /* Close deprecated interface */ - n += H5T__term_deprec_interface(); - - /* Destroy the datatype object id group */ - (void)H5I_dec_type_ref(H5I_DATATYPE); - n++; /*H5I*/ + /* Release all datatype IDs */ + if(H5I_nmembers(H5I_DATATYPE) > 0) { + (void)H5I_clear_type(H5I_DATATYPE, FALSE, FALSE); + n++; /*H5I*/ + } /* end if */ /* Reset all the datatype IDs */ - H5T_IEEE_F32BE_g = FAIL; - H5T_IEEE_F32LE_g = FAIL; - H5T_IEEE_F64BE_g = FAIL; - H5T_IEEE_F64LE_g = FAIL; - - H5T_STD_I8BE_g = FAIL; - H5T_STD_I8LE_g = FAIL; - H5T_STD_I16BE_g = FAIL; - H5T_STD_I16LE_g = FAIL; - H5T_STD_I32BE_g = FAIL; - H5T_STD_I32LE_g = FAIL; - H5T_STD_I64BE_g = FAIL; - H5T_STD_I64LE_g = FAIL; - H5T_STD_U8BE_g = FAIL; - H5T_STD_U8LE_g = FAIL; - H5T_STD_U16BE_g = FAIL; - H5T_STD_U16LE_g = FAIL; - H5T_STD_U32BE_g = FAIL; - H5T_STD_U32LE_g = FAIL; - H5T_STD_U64BE_g = FAIL; - H5T_STD_U64LE_g = FAIL; - H5T_STD_B8BE_g = FAIL; - H5T_STD_B8LE_g = FAIL; - H5T_STD_B16BE_g = FAIL; - H5T_STD_B16LE_g = FAIL; - H5T_STD_B32BE_g = FAIL; - H5T_STD_B32LE_g = FAIL; - H5T_STD_B64BE_g = FAIL; - H5T_STD_B64LE_g = FAIL; - H5T_STD_REF_OBJ_g = FAIL; - H5T_STD_REF_DSETREG_g = FAIL; - - H5T_UNIX_D32BE_g = FAIL; - H5T_UNIX_D32LE_g = FAIL; - H5T_UNIX_D64BE_g = FAIL; - H5T_UNIX_D64LE_g = FAIL; - - H5T_C_S1_g = FAIL; - - H5T_FORTRAN_S1_g = FAIL; - - H5T_NATIVE_SCHAR_g = FAIL; - H5T_NATIVE_UCHAR_g = FAIL; - H5T_NATIVE_SHORT_g = FAIL; - H5T_NATIVE_USHORT_g = FAIL; - H5T_NATIVE_INT_g = FAIL; - H5T_NATIVE_UINT_g = FAIL; - H5T_NATIVE_LONG_g = FAIL; - H5T_NATIVE_ULONG_g = FAIL; - H5T_NATIVE_LLONG_g = FAIL; - H5T_NATIVE_ULLONG_g = FAIL; - H5T_NATIVE_FLOAT_g = FAIL; - H5T_NATIVE_DOUBLE_g = FAIL; + if(H5T_IEEE_F32BE_g > 0) { + H5T_IEEE_F32BE_g = FAIL; + H5T_IEEE_F32LE_g = FAIL; + H5T_IEEE_F64BE_g = FAIL; + H5T_IEEE_F64LE_g = FAIL; + + H5T_STD_I8BE_g = FAIL; + H5T_STD_I8LE_g = FAIL; + H5T_STD_I16BE_g = FAIL; + H5T_STD_I16LE_g = FAIL; + H5T_STD_I32BE_g = FAIL; + H5T_STD_I32LE_g = FAIL; + H5T_STD_I64BE_g = FAIL; + H5T_STD_I64LE_g = FAIL; + H5T_STD_U8BE_g = FAIL; + H5T_STD_U8LE_g = FAIL; + H5T_STD_U16BE_g = FAIL; + H5T_STD_U16LE_g = FAIL; + H5T_STD_U32BE_g = FAIL; + H5T_STD_U32LE_g = FAIL; + H5T_STD_U64BE_g = FAIL; + H5T_STD_U64LE_g = FAIL; + H5T_STD_B8BE_g = FAIL; + H5T_STD_B8LE_g = FAIL; + H5T_STD_B16BE_g = FAIL; + H5T_STD_B16LE_g = FAIL; + H5T_STD_B32BE_g = FAIL; + H5T_STD_B32LE_g = FAIL; + H5T_STD_B64BE_g = FAIL; + H5T_STD_B64LE_g = FAIL; + H5T_STD_REF_OBJ_g = FAIL; + H5T_STD_REF_DSETREG_g = FAIL; + + H5T_UNIX_D32BE_g = FAIL; + H5T_UNIX_D32LE_g = FAIL; + H5T_UNIX_D64BE_g = FAIL; + H5T_UNIX_D64LE_g = FAIL; + + H5T_C_S1_g = FAIL; + + H5T_FORTRAN_S1_g = FAIL; + + H5T_NATIVE_SCHAR_g = FAIL; + H5T_NATIVE_UCHAR_g = FAIL; + H5T_NATIVE_SHORT_g = FAIL; + H5T_NATIVE_USHORT_g = FAIL; + H5T_NATIVE_INT_g = FAIL; + H5T_NATIVE_UINT_g = FAIL; + H5T_NATIVE_LONG_g = FAIL; + H5T_NATIVE_ULONG_g = FAIL; + H5T_NATIVE_LLONG_g = FAIL; + H5T_NATIVE_ULLONG_g = FAIL; + H5T_NATIVE_FLOAT_g = FAIL; + H5T_NATIVE_DOUBLE_g = FAIL; #if H5_SIZEOF_LONG_DOUBLE !=0 - H5T_NATIVE_LDOUBLE_g = FAIL; + H5T_NATIVE_LDOUBLE_g = FAIL; #endif - H5T_NATIVE_B8_g = FAIL; - H5T_NATIVE_B16_g = FAIL; - H5T_NATIVE_B32_g = FAIL; - H5T_NATIVE_B64_g = FAIL; - H5T_NATIVE_OPAQUE_g = FAIL; - H5T_NATIVE_HADDR_g = FAIL; - H5T_NATIVE_HSIZE_g = FAIL; - H5T_NATIVE_HSSIZE_g = FAIL; - H5T_NATIVE_HERR_g = FAIL; - H5T_NATIVE_HBOOL_g = FAIL; - - H5T_NATIVE_INT8_g = FAIL; - H5T_NATIVE_UINT8_g = FAIL; - H5T_NATIVE_INT_LEAST8_g = FAIL; - H5T_NATIVE_UINT_LEAST8_g = FAIL; - H5T_NATIVE_INT_FAST8_g = FAIL; - H5T_NATIVE_UINT_FAST8_g = FAIL; - - H5T_NATIVE_INT16_g = FAIL; - H5T_NATIVE_UINT16_g = FAIL; - H5T_NATIVE_INT_LEAST16_g = FAIL; - H5T_NATIVE_UINT_LEAST16_g = FAIL; - H5T_NATIVE_INT_FAST16_g = FAIL; - H5T_NATIVE_UINT_FAST16_g = FAIL; - - H5T_NATIVE_INT32_g = FAIL; - H5T_NATIVE_UINT32_g = FAIL; - H5T_NATIVE_INT_LEAST32_g = FAIL; - H5T_NATIVE_UINT_LEAST32_g = FAIL; - H5T_NATIVE_INT_FAST32_g = FAIL; - H5T_NATIVE_UINT_FAST32_g = FAIL; - - H5T_NATIVE_INT64_g = FAIL; - H5T_NATIVE_UINT64_g = FAIL; - H5T_NATIVE_INT_LEAST64_g = FAIL; - H5T_NATIVE_UINT_LEAST64_g = FAIL; - H5T_NATIVE_INT_FAST64_g = FAIL; - H5T_NATIVE_UINT_FAST64_g = FAIL; + H5T_NATIVE_B8_g = FAIL; + H5T_NATIVE_B16_g = FAIL; + H5T_NATIVE_B32_g = FAIL; + H5T_NATIVE_B64_g = FAIL; + H5T_NATIVE_OPAQUE_g = FAIL; + H5T_NATIVE_HADDR_g = FAIL; + H5T_NATIVE_HSIZE_g = FAIL; + H5T_NATIVE_HSSIZE_g = FAIL; + H5T_NATIVE_HERR_g = FAIL; + H5T_NATIVE_HBOOL_g = FAIL; + + H5T_NATIVE_INT8_g = FAIL; + H5T_NATIVE_UINT8_g = FAIL; + H5T_NATIVE_INT_LEAST8_g = FAIL; + H5T_NATIVE_UINT_LEAST8_g = FAIL; + H5T_NATIVE_INT_FAST8_g = FAIL; + H5T_NATIVE_UINT_FAST8_g = FAIL; + + H5T_NATIVE_INT16_g = FAIL; + H5T_NATIVE_UINT16_g = FAIL; + H5T_NATIVE_INT_LEAST16_g = FAIL; + H5T_NATIVE_UINT_LEAST16_g = FAIL; + H5T_NATIVE_INT_FAST16_g = FAIL; + H5T_NATIVE_UINT_FAST16_g = FAIL; + + H5T_NATIVE_INT32_g = FAIL; + H5T_NATIVE_UINT32_g = FAIL; + H5T_NATIVE_INT_LEAST32_g = FAIL; + H5T_NATIVE_UINT_LEAST32_g = FAIL; + H5T_NATIVE_INT_FAST32_g = FAIL; + H5T_NATIVE_UINT_FAST32_g = FAIL; + + H5T_NATIVE_INT64_g = FAIL; + H5T_NATIVE_UINT64_g = FAIL; + H5T_NATIVE_INT_LEAST64_g = FAIL; + H5T_NATIVE_UINT_LEAST64_g = FAIL; + H5T_NATIVE_INT_FAST64_g = FAIL; + H5T_NATIVE_UINT_FAST64_g = FAIL; + + n++; + } /* end if */ + + /* Mark "top" of interface as closed */ + if(0 == n) + H5T_top_package_initialize_s = FALSE; + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5T_top_term_package() */ + + +/*------------------------------------------------------------------------- + * Function: H5T_term_package + * + * Purpose: Close this interface. + * + * Note: Finishes shutting down the interface, after + * H5T_top_term_package() is called + * + * Return: Success: Positive if any action might have caused a + * change in some other interface; zero + * otherwise. + * Failure: Negative + * + * Programmer: Robb Matzke + * Friday, November 20, 1998 + * + *------------------------------------------------------------------------- + */ +int +H5T_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + /* Sanity check */ + HDassert(0 == H5I_nmembers(H5I_DATATYPE)); + HDassert(FALSE == H5T_top_package_initialize_s); + + /* Destroy the datatype object id group */ + n += (H5I_dec_type_ref(H5I_DATATYPE) > 0); /* Mark interface as closed */ - H5_interface_initialize_g = 0; + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end if */ FUNC_LEAVE_NOAPI(n) -} /* end H5T_term_interface() */ +} /* end H5T_term_package() */ /*------------------------------------------------------------------------- @@ -1865,7 +1874,7 @@ done: H5T_class_t H5T_get_class(const H5T_t *dt, htri_t internal) { - H5T_class_t ret_value; + H5T_class_t ret_value = H5T_NO_CLASS; /* Return value */ FUNC_ENTER_NOAPI(H5T_NO_CLASS) @@ -2912,8 +2921,8 @@ done: H5T_t * H5T_decode(const unsigned char *buf) { - H5F_t *f = NULL; /* Fake file structure*/ - H5T_t *ret_value; /* Return value */ + H5F_t *f = NULL; /* Fake file structure*/ + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -3116,7 +3125,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) H5T_shared_t *reopened_fo = NULL; unsigned i; char *s; - H5T_t *ret_value; + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -3445,7 +3454,7 @@ H5T_t * H5T__alloc(void) { H5T_t *dt = NULL; /* Pointer to datatype allocated */ - H5T_t *ret_value; /* Return value */ + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -3532,21 +3541,23 @@ H5T__free(H5T_t *dt) switch(dt->shared->type) { case H5T_COMPOUND: for(i = 0; i < dt->shared->u.compnd.nmembs; i++) { - H5MM_xfree(dt->shared->u.compnd.memb[i].name); + dt->shared->u.compnd.memb[i].name = (char *)H5MM_xfree(dt->shared->u.compnd.memb[i].name); H5T_close(dt->shared->u.compnd.memb[i].type); } /* end for */ - H5MM_xfree(dt->shared->u.compnd.memb); + dt->shared->u.compnd.memb = (H5T_cmemb_t *)H5MM_xfree(dt->shared->u.compnd.memb); + dt->shared->u.compnd.nmembs = 0; break; case H5T_ENUM: for(i = 0; i < dt->shared->u.enumer.nmembs; i++) - H5MM_xfree(dt->shared->u.enumer.name[i]); - H5MM_xfree(dt->shared->u.enumer.name); - H5MM_xfree(dt->shared->u.enumer.value); + dt->shared->u.enumer.name[i] = (char *)H5MM_xfree(dt->shared->u.enumer.name[i]); + dt->shared->u.enumer.name = (char **)H5MM_xfree(dt->shared->u.enumer.name); + dt->shared->u.enumer.value = (uint8_t *)H5MM_xfree(dt->shared->u.enumer.value); + dt->shared->u.enumer.nmembs = 0; break; case H5T_OPAQUE: - H5MM_xfree(dt->shared->u.opaque.tag); + dt->shared->u.opaque.tag = (char *)H5MM_xfree(dt->shared->u.opaque.tag); break; case H5T_NO_CLASS: @@ -3562,11 +3573,13 @@ H5T__free(H5T_t *dt) default: break; } /* end switch */ + dt->shared->type = H5T_NO_CLASS; /* Close the parent */ HDassert(dt->shared->parent != dt); if(dt->shared->parent && H5T_close(dt->shared->parent) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close parent data type") + dt->shared->parent = NULL; done: FUNC_LEAVE_NOAPI(ret_value) @@ -3641,7 +3654,7 @@ H5T_close(H5T_t *dt) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "problem attempting to free location") } /* end if */ - /* Free the group hier. path since we're not calling H5T__free*/ + /* Free the group hier. path since we're not calling H5T__free() */ H5G_name_free(&(dt->path)); } /* end else */ @@ -4375,7 +4388,7 @@ done: * function like H5Tregister() is calling this function to * register a new hard conversion function, IS_API is TRUE * and the old path is replaced. If a private function like - * H5T_init_interface() is trying to register hard conversions, + * H5T__init_package() is trying to register hard conversions, * IS_API is FALSE and the old hard path is not replaced. * Tuesday, Sept 13, 2005 * @@ -4394,13 +4407,15 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, hid_t src_id = -1, dst_id = -1; /*src and dst type identifiers */ int i; /*counter */ int nprint = 0; /*lines of output printed */ - H5T_path_t *ret_value; /*return value */ + H5T_path_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) /* Sanity check */ HDassert(src); + HDassert(src->shared); HDassert(dst); + HDassert(dst->shared); /* * Make sure the first entry in the table is the no-op conversion path. @@ -4753,7 +4768,7 @@ static htri_t H5T_compiler_conv(H5T_t *src, H5T_t *dst) { H5T_path_t *path; - htri_t ret_value; + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -5045,7 +5060,7 @@ done: htri_t H5T_is_sensible(const H5T_t *dt) { - htri_t ret_value; + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -62,7 +62,7 @@ static void H5TS_key_destructor(void *key_val) { /* Use HDfree here instead of H5MM_xfree(), to avoid calling the H5CS routines */ - if(key_val!=NULL) + if(key_val != NULL) HDfree(key_val); } @@ -91,7 +91,8 @@ H5TS_key_destructor(void *key_val) void H5TS_pthread_first_thread_init(void) { - H5_g.H5_libinit_g = FALSE; + H5_g.H5_libinit_g = FALSE; /* Library hasn't been initialized */ + H5_g.H5_libterm_g = FALSE; /* Library isn't being shutdown */ #ifdef H5_HAVE_WIN32_API # ifdef PTW32_STATIC_LIB diff --git a/src/H5Tarray.c b/src/H5Tarray.c index 752f2aa..4b2c7cf 100644 --- a/src/H5Tarray.c +++ b/src/H5Tarray.c @@ -22,10 +22,7 @@ /* Module Setup */ /****************/ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_array_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ /***********/ @@ -78,28 +75,6 @@ -/*-------------------------------------------------------------------------- -NAME - H5T_init_array_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_array_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_array_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_array_interface() */ - - /*------------------------------------------------------------------------- * Function: H5Tarray_create2 * @@ -179,8 +154,8 @@ done: H5T_t * H5T__array_create(H5T_t *base, unsigned ndims, const hsize_t dim[/* ndims */]) { - H5T_t *ret_value; /* new array data type */ - unsigned u; /* local index variable */ + unsigned u; /* Local index variable */ + H5T_t *ret_value = NULL; /* New array data type */ FUNC_ENTER_PACKAGE diff --git a/src/H5Tbit.c b/src/H5Tbit.c index 5322959..8c53066 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -19,7 +19,7 @@ * the bytes are in little-endian order. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /*generic functions */ @@ -261,7 +261,7 @@ H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size) { uint64_t val = 0; size_t i, hs; - uint64_t ret_value; /* Return value */ + uint64_t ret_value = 0; /* Return value */ FUNC_ENTER_PACKAGE_NOERR diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 7508dbb..c2833e1 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -22,10 +22,7 @@ /* Module Setup */ /****************/ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_commit_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ /***********/ @@ -83,28 +80,6 @@ static H5T_t *H5T_open_oid(const H5G_loc_t *loc, hid_t dxpl_id); -/*-------------------------------------------------------------------------- -NAME - H5T_init_commit_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_commit_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_commit_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_commit_interface() */ - - /*------------------------------------------------------------------------- * Function: H5Tcommit2 * @@ -182,10 +157,10 @@ herr_t H5T__commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id) { - H5O_obj_create_t ocrt_info; /* Information for object creation */ - H5T_obj_create_t tcrt_info; /* Information for named datatype creation */ - H5T_state_t old_state = H5T_STATE_TRANSIENT; /* The state of the datatype before H5T__commit. */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_obj_create_t ocrt_info; /* Information for object creation */ + H5T_obj_create_t tcrt_info; /* Information for named datatype creation */ + H5T_state_t old_state; /* The state of the datatype before H5T__commit. */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -514,7 +489,7 @@ H5T_committed(const H5T_t *type) int H5T_link(const H5T_t *type, int adjust, hid_t dxpl_id) { - int ret_value; /* Return value */ + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -698,7 +673,7 @@ H5T_open(const H5G_loc_t *loc, hid_t dxpl_id) { H5T_shared_t *shared_fo = NULL; H5T_t *dt = NULL; - H5T_t *ret_value; + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -814,7 +789,7 @@ static H5T_t * H5T_open_oid(const H5G_loc_t *loc, hid_t dxpl_id) { H5T_t *dt = NULL; /* Datatype from the file */ - H5T_t *ret_value; /* Return value */ + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c index b377b29..1342770 100644 --- a/src/H5Tcompound.c +++ b/src/H5Tcompound.c @@ -22,10 +22,7 @@ /* Module Setup */ /****************/ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_compound_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ /***********/ @@ -80,26 +77,6 @@ static htri_t H5T_is_packed(const H5T_t *dt); -/*-------------------------------------------------------------------------- -NAME - H5T_init_compound_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_compound_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init() currently). ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_compound_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_compound_interface() */ - - /*------------------------------------------------------------------------- * Function: H5Tget_member_offset * @@ -282,7 +259,7 @@ done: H5T_t * H5T_get_member_type(const H5T_t *dt, unsigned membno, H5T_copy_t method) { - H5T_t *ret_value; /* Return value */ + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 6847e68..8b96d22 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -21,7 +21,8 @@ /* Module Setup */ /****************/ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ + /***********/ /* Headers */ @@ -2111,7 +2112,7 @@ done: H5T_subset_info_t * H5T__conv_struct_subset(const H5T_cdata_t *cdata) { - H5T_conv_struct_t *priv; + H5T_conv_struct_t *priv = NULL; FUNC_ENTER_PACKAGE_NOERR @@ -2925,7 +2926,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, /* Use O(log N) lookup */ unsigned lt = 0; unsigned rt = src->shared->u.enumer.nmembs; - unsigned md; + unsigned md = 0; int cmp; while(lt < rt) { diff --git a/src/H5Tcset.c b/src/H5Tcset.c index 33fb32a..95658ed 100644 --- a/src/H5Tcset.c +++ b/src/H5Tcset.c @@ -18,10 +18,7 @@ * the character set (cset) for the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_cset_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /*generic functions */ @@ -30,28 +27,6 @@ #include "H5Tpkg.h" /*data-type functions */ -/*-------------------------------------------------------------------------- -NAME - H5T_init_cset_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_cset_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_cset_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_cset_interface() */ - - /*------------------------------------------------------------------------- * Function: H5Tget_cset * diff --git a/src/H5Tdbg.c b/src/H5Tdbg.c index 717fc17..8a10cc6 100644 --- a/src/H5Tdbg.c +++ b/src/H5Tdbg.c @@ -28,7 +28,7 @@ /* Module Setup */ /****************/ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ /***********/ diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index f1586bd..cd4de1d 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -31,10 +31,7 @@ /* Module Setup */ /****************/ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T__init_deprec_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ /***********/ @@ -84,51 +81,6 @@ /*******************/ - -/*-------------------------------------------------------------------------- -NAME - H5T__init_deprec_interface -- Initialize interface-specific information -USAGE - herr_t H5T__init_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init() currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T__init_deprec_interface(void) -{ - FUNC_ENTER_STATIC_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T__init_deprec_interface() */ - - -/*-------------------------------------------------------------------------- -NAME - H5T__term_deprec_interface -- Terminate interface -USAGE - herr_t H5T__term_deprec_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Terminates interface. (Just resets H5_interface_initialize_g - currently). - ---------------------------------------------------------------------------*/ -herr_t -H5T__term_deprec_interface(void) -{ - FUNC_ENTER_PACKAGE_NOERR - - /* Mark closed */ - H5_interface_initialize_g = 0; - - FUNC_LEAVE_NOAPI(0) -} /* H5T__term_deprec_interface() */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- diff --git a/src/H5Tenum.c b/src/H5Tenum.c index 2b7563b..e80d748 100644 --- a/src/H5Tenum.c +++ b/src/H5Tenum.c @@ -18,10 +18,7 @@ * in the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_enum_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /*generic functions */ @@ -36,27 +33,6 @@ static char *H5T_enum_nameof(const H5T_t *dt, const void *value, char *name/*out static herr_t H5T_enum_valueof(const H5T_t *dt, const char *name, void *value/*out*/); - -/*-------------------------------------------------------------------------- -NAME - H5T_init_enum_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_enum_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_enum_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_enum_interface() */ /*------------------------------------------------------------------------- @@ -123,7 +99,7 @@ done: H5T_t * H5T__enum_create(const H5T_t *parent) { - H5T_t *ret_value; /*new enumeration data type */ + H5T_t *ret_value = NULL; /* New enumeration data type */ FUNC_ENTER_PACKAGE @@ -416,7 +392,7 @@ H5T_enum_nameof(const H5T_t *dt, const void *value, char *name/*out*/, size_t si unsigned lt, md = 0, rt; /* Indices for binary search */ int cmp = (-1); /* Comparison result */ hbool_t alloc_name = FALSE; /* Whether name has been allocated */ - char *ret_value; /* Return value */ + char *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Tfields.c b/src/H5Tfields.c index fb186fb..8818a73 100644 --- a/src/H5Tfields.c +++ b/src/H5Tfields.c @@ -18,10 +18,7 @@ * enumerated & compound datatypes in the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_fields_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /*generic functions */ @@ -31,28 +28,6 @@ #include "H5Tpkg.h" /*data-type functions */ -/*-------------------------------------------------------------------------- -NAME - H5T_init_fields_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_fields_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_fields_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_fields_interface() */ - - /*------------------------------------------------------------------------- * Function: H5Tget_nmembers * @@ -117,7 +92,7 @@ done: int H5T_get_nmembers(const H5T_t *dt) { - int ret_value; + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -199,7 +174,7 @@ done: char * H5T__get_member_name(H5T_t const *dt, unsigned membno) { - char *ret_value; + char *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5Tfixed.c b/src/H5Tfixed.c index b2401d4..62b8e79 100644 --- a/src/H5Tfixed.c +++ b/src/H5Tfixed.c @@ -18,10 +18,7 @@ * integer) datatypes in the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_fixed_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /*generic functions */ @@ -30,28 +27,6 @@ #include "H5Tpkg.h" /*data-type functions */ -/*-------------------------------------------------------------------------- -NAME - H5T_init_fixed_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_fixed_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_fixed_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_fixed_interface() */ - - /*------------------------------------------------------------------------- * Function: H5Tget_sign * @@ -79,8 +54,8 @@ H5Tget_sign(hid_t type_id) H5TRACE1("Ts", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_SGN_ERROR, "not an integer datatype") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_SGN_ERROR, "not an integer datatype") ret_value = H5T_get_sign(dt); @@ -109,7 +84,7 @@ done: H5T_sign_t H5T_get_sign(H5T_t const *dt) { - H5T_sign_t ret_value; + H5T_sign_t ret_value = H5T_SGN_ERROR; /* Return value */ FUNC_ENTER_NOAPI(H5T_SGN_ERROR) @@ -158,18 +133,18 @@ H5Tset_sign(hid_t type_id, H5T_sign_t sign) H5TRACE2("e", "iTs", type_id, sign); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an integer datatype") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an integer datatype") if (H5T_STATE_TRANSIENT!=dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") if (sign < H5T_SGN_NONE || sign >= H5T_NSGN) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal sign type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal sign type") if (H5T_ENUM==dt->shared->type && dt->shared->u.enumer.nmembs>0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (H5T_INTEGER!=dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for datatype class") /* Commit */ dt->shared->u.atomic.u.i.sign = sign; diff --git a/src/H5Tfloat.c b/src/H5Tfloat.c index fff413d..b8b1c07 100644 --- a/src/H5Tfloat.c +++ b/src/H5Tfloat.c @@ -18,10 +18,7 @@ * datatypes in the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_float_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /*generic functions */ @@ -29,27 +26,6 @@ #include "H5Iprivate.h" /*ID functions */ #include "H5Tpkg.h" /*data-type functions */ - -/*-------------------------------------------------------------------------- -NAME - H5T_init_float_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_float_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_float_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_float_interface() */ /*------------------------------------------------------------------------- diff --git a/src/H5Tmodule.h b/src/H5Tmodule.h new file mode 100644 index 0000000..bfaab5e6 --- /dev/null +++ b/src/H5Tmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5T package. Including this header means that the source file + * is part of the H5T package. + */ +#ifndef _H5Tmodule_H +#define _H5Tmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5T_MODULE +#define H5_MY_PKG H5T +#define H5_MY_PKG_ERR H5E_DATATYPE +#define H5_MY_PKG_INIT YES + +#endif /* _H5Tmodule_H */ + diff --git a/src/H5Tnative.c b/src/H5Tnative.c index bf6ba08..229fe94 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -18,10 +18,7 @@ * a "native" datatype for the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_native_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /* Generic Functions */ @@ -43,27 +40,6 @@ static H5T_t* H5T_get_native_bitfield(size_t prec, H5T_direction_t direction, static herr_t H5T_cmp_offset(size_t *comp_size, size_t *offset, size_t elem_size, size_t nelems, size_t align, size_t *struct_align); - -/*-------------------------------------------------------------------------- -NAME - H5T_init_native_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_native_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_native_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_native_interface() */ /*------------------------------------------------------------------------- @@ -168,7 +144,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig int snmemb; /* Number of members in compound & enum types */ unsigned nmemb = 0; /* Number of members in compound & enum types */ unsigned u; /* Local index variable */ - H5T_t *ret_value; /* Return value */ + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -571,7 +547,7 @@ H5T_get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, H5T_NATIVE_INT_MATCH_LLONG, H5T_NATIVE_INT_MATCH_UNKNOWN } match = H5T_NATIVE_INT_MATCH_UNKNOWN; - H5T_t *ret_value; /* Return value */ + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -711,7 +687,7 @@ H5T_get_native_float(size_t size, H5T_direction_t direction, size_t *struct_alig #endif H5T_NATIVE_FLOAT_MATCH_UNKNOWN } match=H5T_NATIVE_FLOAT_MATCH_UNKNOWN; - H5T_t *ret_value; /* Return value */ + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -829,7 +805,7 @@ H5T_get_native_bitfield(size_t prec, H5T_direction_t direction, size_t *struct_a hid_t tid=(-1); /* Datatype ID of appropriate native datatype */ size_t align=0; /* Alignment necessary for native datatype */ size_t native_size=0; /* Datatype size of the native type */ - H5T_t *ret_value; /* Return value */ + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) diff --git a/src/H5Toffset.c b/src/H5Toffset.c index ea4b3b5..cc45d8e 100644 --- a/src/H5Toffset.c +++ b/src/H5Toffset.c @@ -18,10 +18,7 @@ * the datatype offset for the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_offset_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /* Generic Functions */ @@ -32,27 +29,6 @@ /* Static local functions */ static herr_t H5T_set_offset(const H5T_t *dt, size_t offset); - -/*-------------------------------------------------------------------------- -NAME - H5T_init_offset_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_offset_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_offset_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_offset_interface() */ /*------------------------------------------------------------------------- @@ -138,7 +114,7 @@ done: int H5T_get_offset(const H5T_t *dt) { - int ret_value; + int ret_value = -1; /* Return value */ FUNC_ENTER_NOAPI(-1) diff --git a/src/H5Toh.c b/src/H5Toh.c index abf8a51..9c8ad80 100644 --- a/src/H5Toh.c +++ b/src/H5Toh.c @@ -17,8 +17,8 @@ /* Module Setup */ /****************/ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ /***********/ @@ -102,7 +102,7 @@ const H5O_obj_class_t H5O_OBJ_DATATYPE[1] = {{ static htri_t H5O_dtype_isa(struct H5O_t *oh) { - htri_t ret_value; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -133,7 +133,7 @@ static hid_t H5O_dtype_open(const H5G_loc_t *obj_loc, hid_t H5_ATTR_UNUSED lapl_id, hid_t dxpl_id, hbool_t app_ref) { H5T_t *type = NULL; /* Datatype opened */ - hid_t ret_value; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -173,7 +173,7 @@ static void * H5O_dtype_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc, hid_t dxpl_id) { H5T_obj_create_t *crt_info = (H5T_obj_create_t *)_crt_info; /* Named datatype creation parameters */ - void *ret_value; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -217,7 +217,7 @@ static H5O_loc_t * H5O_dtype_get_oloc(hid_t obj_id) { H5T_t *type; /* Datatype opened */ - H5O_loc_t *ret_value; /* Return value */ + H5O_loc_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT diff --git a/src/H5Topaque.c b/src/H5Topaque.c index e93bf65..9cc22c9 100644 --- a/src/H5Topaque.c +++ b/src/H5Topaque.c @@ -18,10 +18,7 @@ * datatypes in the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_opaque_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /* Generic Functions */ @@ -30,27 +27,6 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Tpkg.h" /* Datatypes */ - -/*-------------------------------------------------------------------------- -NAME - H5T_init_opaque_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_opaque_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_opaque_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_opaque_interface() */ /*------------------------------------------------------------------------- @@ -77,18 +53,18 @@ H5Tset_tag(hid_t type_id, const char *tag) H5TRACE2("e", "i*s", type_id, tag); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") if (H5T_STATE_TRANSIENT!=dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (H5T_OPAQUE!=dt->shared->type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an opaque data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an opaque data type") if (!tag) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no tag") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no tag") if (HDstrlen(tag) >= H5T_OPAQUE_TAG_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "tag too long") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "tag too long") /* Commit */ H5MM_xfree(dt->shared->u.opaque.tag); @@ -124,16 +100,16 @@ H5Tget_tag(hid_t type_id) H5TRACE1("*s", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (H5T_OPAQUE != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "operation not defined for data type class") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "operation not defined for data type class") /* result */ if (NULL==(ret_value=H5MM_strdup(dt->shared->u.opaque.tag))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Torder.c b/src/H5Torder.c index 35be454..6c9c55c 100644 --- a/src/H5Torder.c +++ b/src/H5Torder.c @@ -22,10 +22,7 @@ /* Module Setup */ /****************/ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_order_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ /***********/ @@ -79,27 +76,6 @@ static herr_t H5T_set_order(H5T_t *dtype, H5T_order_t order); -/*-------------------------------------------------------------------------- -NAME - H5T_init_order_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_order_interface() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_order_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_order_interface() */ - - /*------------------------------------------------------------------------- * Function: H5Tget_order * diff --git a/src/H5Tpad.c b/src/H5Tpad.c index 88a5e13..e636a84 100644 --- a/src/H5Tpad.c +++ b/src/H5Tpad.c @@ -18,10 +18,7 @@ * the datatype padding for the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_pad_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /* Generic Functions */ @@ -29,27 +26,6 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Tpkg.h" /* Datatypes */ - -/*-------------------------------------------------------------------------- -NAME - H5T_init_pad_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_pad_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_pad_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_pad_interface() */ /*------------------------------------------------------------------------- @@ -80,12 +56,12 @@ H5Tget_pad(hid_t type_id, H5T_pad_t *lsb/*out*/, H5T_pad_t *msb/*out*/) H5TRACE3("e", "ixx", type_id, lsb, msb); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (!H5T_IS_ATOMIC(dt->shared)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type") /* Get values */ if (lsb) @@ -124,18 +100,18 @@ H5Tset_pad(hid_t type_id, H5T_pad_t lsb, H5T_pad_t msb) H5TRACE3("e", "iTpTp", type_id, lsb, msb); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") if (H5T_STATE_TRANSIENT!=dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") if (lsb < H5T_PAD_ZERO || lsb >= H5T_NPAD || msb < H5T_PAD_ZERO || msb >= H5T_NPAD) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pad type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pad type") if (H5T_ENUM==dt->shared->type && dt->shared->u.enumer.nmembs>0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (!H5T_IS_ATOMIC(dt->shared)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type") /* Commit */ dt->shared->u.atomic.lsb_pad = lsb; diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 0b0cd61..0bd1e06 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -21,7 +21,7 @@ * the H5T package. Source files outside the H5T package should * include H5Tprivate.h instead. */ -#ifndef H5T_PACKAGE +#if !(defined H5T_FRIEND || defined H5T_MODULE) #error "Do not include this file outside the H5T package!" #endif @@ -424,7 +424,7 @@ H5FL_EXTERN(H5T_t); H5FL_EXTERN(H5T_shared_t); /* Common functions */ -H5_DLL herr_t H5T__term_deprec_interface(void); +H5_DLL herr_t H5T__init_native(void); H5_DLL H5T_t *H5T__create(H5T_class_t type, size_t size); H5_DLL herr_t H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id); H5_DLL herr_t H5T__commit_named(const H5G_loc_t *loc, const char *name, diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c index b3975af..be85491 100644 --- a/src/H5Tprecis.c +++ b/src/H5Tprecis.c @@ -18,10 +18,7 @@ * the datatype precision for the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_precis_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /* Generic Functions */ @@ -32,27 +29,6 @@ /* Static local functions */ static herr_t H5T_set_precision(const H5T_t *dt, size_t prec); - -/*-------------------------------------------------------------------------- -NAME - H5T_init_precis_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_precis_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_precis_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_precis_interface() */ /*------------------------------------------------------------------------- @@ -87,12 +63,12 @@ H5Tget_precision(hid_t type_id) H5TRACE1("z", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") /* Get precision */ if((ret_value = H5T_get_precision(dt)) == 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, 0, "cant't get precision for specified datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, 0, "cant't get precision for specified datatype") done: FUNC_LEAVE_API(ret_value) @@ -119,7 +95,7 @@ done: size_t H5T_get_precision(const H5T_t *dt) { - size_t ret_value; + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) @@ -176,22 +152,22 @@ H5Tset_precision(hid_t type_id, size_t prec) H5TRACE2("e", "iz", type_id, prec); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if (H5T_STATE_TRANSIENT!=dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only") if (prec == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "precision must be positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "precision must be positive") if (H5T_ENUM==dt->shared->type && dt->shared->u.enumer.nmembs>0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "operation not allowed after members are defined") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "operation not allowed after members are defined") if (H5T_STRING==dt->shared->type) HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "precision for this type is read-only") if (H5T_COMPOUND==dt->shared->type || H5T_OPAQUE==dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified datatype") /* Do the work */ if (H5T_set_precision(dt, prec)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set precision") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set precision") done: FUNC_LEAVE_API(ret_value) @@ -283,9 +259,19 @@ H5T_set_precision(const H5T_t *dt, size_t prec) dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec+offset) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first") break; + + case H5T_NO_CLASS: + case H5T_STRING: + case H5T_OPAQUE: + case H5T_COMPOUND: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + case H5T_ARRAY: + case H5T_NCLASSES: default: HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class") - } /* end switch */ /*lint !e788 All appropriate cases are covered */ + } /* end switch */ /* Commit */ dt->shared->size = size; diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 558afaf..93fe599 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -34,17 +34,17 @@ #define H5T_ELEM_BUF_SIZE 256 /* If the module using this macro is allowed access to the private variables, access them directly */ -#ifdef H5T_PACKAGE +#ifdef H5T_MODULE #define H5T_GET_SIZE(T) ((T)->shared->size) #define H5T_GET_SHARED(T) ((T)->shared) #define H5T_GET_MEMBER_OFFSET(T, I) ((T)->u.compnd.memb[I].offset) #define H5T_GET_MEMBER_SIZE(T, I) ((T)->u.compnd.memb[I].shared->size) -#else /* H5T_PACKAGE */ +#else /* H5T_MODULE */ #define H5T_GET_SIZE(T) (H5T_get_size(T)) #define H5T_GET_SHARED(T) (H5T_get_shared(T)) #define H5T_GET_MEMBER_OFFSET(T, I) (H5T_get_member_offset((T), (I))) #define H5T_GET_MEMBER_SIZE(T, I) (H5T_get_member_size((T), (I))) -#endif /* H5T_PACKAGE */ +#endif /* H5T_MODULE */ /* Forward references of package typedefs (declared in H5Tpkg.h) */ typedef struct H5T_t H5T_t; @@ -104,7 +104,6 @@ struct H5O_t; H5_DLLVAR H5T_order_t H5T_native_order_g; /* Private functions */ -H5_DLL herr_t H5TN_init_interface(void); H5_DLL herr_t H5T_init(void); H5_DLL H5T_t *H5T_copy(H5T_t *old_dt, H5T_copy_t method); H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable); diff --git a/src/H5Tstrpad.c b/src/H5Tstrpad.c index e8ac4f5..2cd1db4 100644 --- a/src/H5Tstrpad.c +++ b/src/H5Tstrpad.c @@ -18,10 +18,7 @@ * the datatype string padding for the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_strpad_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /* Generic Functions */ @@ -29,27 +26,6 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Tpkg.h" /* Datatypes */ - -/*-------------------------------------------------------------------------- -NAME - H5T_init_strpad_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_strpad_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_strpad_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_strpad_interface() */ /*------------------------------------------------------------------------- @@ -83,12 +59,12 @@ H5Tget_strpad(hid_t type_id) H5TRACE1("Tz", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_STR_ERROR, "not a datatype") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_STR_ERROR, "not a datatype") while (dt->shared->parent && !H5T_IS_STRING(dt->shared)) dt = dt->shared->parent; /*defer to parent*/ if (!H5T_IS_STRING(dt->shared)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_STR_ERROR, "operation not defined for datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_STR_ERROR, "operation not defined for datatype class") /* result */ if(H5T_IS_FIXED_STRING(dt->shared)) @@ -140,16 +116,16 @@ H5Tset_strpad(hid_t type_id, H5T_str_t strpad) H5TRACE2("e", "iTz", type_id, strpad); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if (H5T_STATE_TRANSIENT!=dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") if (strpad < H5T_STR_NULLTERM || strpad >= H5T_NSTR) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal string pad type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal string pad type") while (dt->shared->parent && !H5T_IS_STRING(dt->shared)) dt = dt->shared->parent; /*defer to parent*/ if (!H5T_IS_STRING(dt->shared)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class") /* Commit */ if(H5T_IS_FIXED_STRING(dt->shared)) diff --git a/src/H5Tvisit.c b/src/H5Tvisit.c index 68cabda..d732fb3 100644 --- a/src/H5Tvisit.c +++ b/src/H5Tvisit.c @@ -35,7 +35,7 @@ /* Module Setup */ /****************/ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ /***********/ @@ -136,6 +136,19 @@ H5T__visit(H5T_t *dt, unsigned visit_flags, H5T_operator_t op, void *op_value) HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "can't visit parent datatype") break; + case H5T_NO_CLASS: + case H5T_NCLASSES: + /* Not real values */ + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class") + break; + + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: default: /* Visit "simple" datatypes here */ if(visit_flags & H5T_VISIT_SIMPLE) diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 4ee3d0d..26346d6 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -18,10 +18,7 @@ * datatypes in the H5T interface. */ -#define H5T_PACKAGE /*suppress error about including H5Tpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5T_init_vlen_interface +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ #include "H5private.h" /* Generic Functions */ @@ -64,27 +61,6 @@ static H5T_vlen_alloc_info_t H5T_vlen_def_vl_alloc_info ={ H5D_VLEN_FREE_INFO }; - -/*-------------------------------------------------------------------------- -NAME - H5T_init_vlen_interface -- Initialize interface-specific information -USAGE - herr_t H5T_init_vlen_interface() - -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. (Just calls - H5T_init_iterface currently). - ---------------------------------------------------------------------------*/ -static herr_t -H5T_init_vlen_interface(void) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(H5T_init()) -} /* H5T_init_vlen_interface() */ /*------------------------------------------------------------------------- @@ -113,7 +89,7 @@ H5Tvlen_create(hid_t base_id) H5TRACE1("i", "i", base_id); /* Check args */ - if(NULL == (base = H5I_object_verify(base_id, H5I_DATATYPE))) + if(NULL == (base = (H5T_t *)H5I_object_verify(base_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype") /* Create up VL datatype */ @@ -147,8 +123,8 @@ done: H5T_t * H5T__vlen_create(const H5T_t *base) { - H5T_t *dt = NULL; /*new VL datatype */ - H5T_t *ret_value; /*return value */ + H5T_t *dt = NULL; /* New VL datatype */ + H5T_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -288,6 +264,8 @@ H5T__vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) */ break; + case H5T_LOC_MAXLOC: + /* MAXLOC is invalid */ default: HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid VL datatype location") } /* end switch */ /*lint !e788 All appropriate cases are covered */ @@ -716,11 +694,11 @@ H5T_vlen_str_mem_write(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, co /* Use the user's memory allocation routine if one is defined */ if(vl_alloc_info->alloc_func!=NULL) { - if(NULL==(t=(vl_alloc_info->alloc_func)((seq_len+1)*base_size,vl_alloc_info->alloc_info))) + if(NULL==(t = (char *)(vl_alloc_info->alloc_func)((seq_len+1)*base_size,vl_alloc_info->alloc_info))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data") } /* end if */ else { /* Default to system malloc */ - if(NULL==(t=H5MM_malloc((seq_len+1)*base_size))) + if(NULL==(t = (char *)H5MM_malloc((seq_len+1)*base_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data") } /* end else */ @@ -779,7 +757,7 @@ static ssize_t H5T_vlen_disk_getlen(const void *_vl) { const uint8_t *vl=(const uint8_t *)_vl; /* Pointer to the disk VL information */ - size_t seq_len; /* Sequence length */ + size_t seq_len = 0; /* Sequence length */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1119,8 +1097,24 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi } /* end else */ break; + /* Don't do anything for simple types */ + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_ENUM: + break; + + /* Should never have these values */ + case H5T_NO_CLASS: + case H5T_NCLASSES: default: + HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid VL datatype class") break; + } /* end switch */ /*lint !e788 All appropriate cases are covered */ done: @@ -1167,7 +1161,7 @@ H5T_vlen_reclaim(void *elem, hid_t type_id, unsigned H5_ATTR_UNUSED ndim, const HDassert(H5I_DATATYPE == H5I_get_type(type_id)); /* Check args */ - if(NULL == (dt = H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Pull the free function and free info pointer out of the op_data and call the recurse datatype free function */ @@ -13,10 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ - -/* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5Z_init_interface +#include "H5Zmodule.h" /* This source code file is part of the H5Z module */ #include "H5private.h" /* Generic Functions */ @@ -57,6 +54,9 @@ typedef enum { H5Z_PRELUDE_SET_LOCAL /* Call "set local" callback */ } H5Z_prelude_type_t; +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /* Local variables */ static size_t H5Z_table_alloc_g = 0; static size_t H5Z_table_used_g = 0; @@ -73,7 +73,7 @@ static int H5Z__flush_file_cb(void *obj_ptr, hid_t obj_id, void *key); /*------------------------------------------------------------------------- - * Function: H5Z_init_interface + * Function: H5Z__init_package * * Purpose: Initializes the data filter layer. * @@ -82,45 +82,43 @@ static int H5Z__flush_file_cb(void *obj_ptr, hid_t obj_id, void *key); * Programmer: Robb Matzke * Thursday, April 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ -static herr_t -H5Z_init_interface (void) +herr_t +H5Z__init_package(void) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Internal filters */ - if (H5Z_register (H5Z_SHUFFLE)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register shuffle filter") - if (H5Z_register (H5Z_FLETCHER32)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register fletcher32 filter") - if (H5Z_register (H5Z_NBIT)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register nbit filter") - if (H5Z_register (H5Z_SCALEOFFSET)<0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register scaleoffset filter") + if(H5Z_register(H5Z_SHUFFLE) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register shuffle filter") + if(H5Z_register(H5Z_FLETCHER32) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register fletcher32 filter") + if(H5Z_register(H5Z_NBIT) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register nbit filter") + if(H5Z_register(H5Z_SCALEOFFSET) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register scaleoffset filter") /* External filters */ #ifdef H5_HAVE_FILTER_DEFLATE - if (H5Z_register (H5Z_DEFLATE)<0) + if(H5Z_register(H5Z_DEFLATE) < 0) HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register deflate filter") #endif /* H5_HAVE_FILTER_DEFLATE */ #ifdef H5_HAVE_FILTER_SZIP H5Z_SZIP->encoder_present = SZ_encoder_enabled(); - if (H5Z_register (H5Z_SZIP)<0) + if(H5Z_register(H5Z_SZIP) < 0) HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register szip filter") #endif /* H5_HAVE_FILTER_SZIP */ done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5Z__init_package() */ /*------------------------------------------------------------------------- - * Function: H5Z_term_interface + * Function: H5Z_term_package * * Purpose: Terminate the H5Z layer. * @@ -129,44 +127,44 @@ done: * Programmer: Robb Matzke * Thursday, April 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ int -H5Z_term_interface(void) +H5Z_term_package(void) { -#ifdef H5Z_DEBUG - size_t i; - int dir, nprint=0; - char comment[16], bandwidth[32]; -#endif + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_interface_initialize_g) { + if(H5_PKG_INIT_VAR) { #ifdef H5Z_DEBUG - if (H5DEBUG(Z)) { - for (i=0; i<H5Z_table_used_g; i++) { - for (dir=0; dir<2; dir++) { - if (0==H5Z_stat_table_g[i].stats[dir].total) continue; + char comment[16], bandwidth[32]; + int dir, nprint = 0; + size_t i; - if (0==nprint++) { + if(H5DEBUG(Z)) { + for(i = 0; i < H5Z_table_used_g; i++) { + for(dir = 0; dir<2; dir++) { + if(0 == H5Z_stat_table_g[i].stats[dir].total) + continue; + + if(0 == nprint++) { /* Print column headers */ - HDfprintf (H5DEBUG(Z), "H5Z: filter statistics " + HDfprintf(H5DEBUG(Z), "H5Z: filter statistics " "accumulated over life of library:\n"); - HDfprintf (H5DEBUG(Z), + HDfprintf(H5DEBUG(Z), " %-16s %10s %10s %8s %8s %8s %10s\n", "Filter", "Total", "Errors", "User", "System", "Elapsed", "Bandwidth"); - HDfprintf (H5DEBUG(Z), + HDfprintf(H5DEBUG(Z), " %-16s %10s %10s %8s %8s %8s %10s\n", "------", "-----", "------", "----", "------", "-------", "---------"); - } + } /* end if */ /* Truncate the comment to fit in the field */ - HDstrncpy(comment, H5Z_table_g[i].name, - sizeof comment); - comment[sizeof(comment)-1] = '\0'; + HDstrncpy(comment, H5Z_table_g[i].name, sizeof comment); + comment[sizeof(comment) - 1] = '\0'; /* * Format bandwidth to have four significant digits and @@ -178,7 +176,7 @@ H5Z_term_interface(void) H5Z_stat_table_g[i].stats[dir].timer.etime); /* Print the statistics */ - HDfprintf (H5DEBUG(Z), + HDfprintf(H5DEBUG(Z), " %s%-15s %10Hd %10Hd %8.2f %8.2f %8.2f " "%10s\n", dir?"<":">", comment, H5Z_stat_table_g[i].stats[dir].total, @@ -187,21 +185,28 @@ H5Z_term_interface(void) H5Z_stat_table_g[i].stats[dir].timer.stime, H5Z_stat_table_g[i].stats[dir].timer.etime, bandwidth); - } - } - } + } /* end for */ + } /* end for */ + } /* end if */ #endif /* H5Z_DEBUG */ /* Free the table of filters */ - H5Z_table_g = (H5Z_class2_t *)H5MM_xfree(H5Z_table_g); + if(H5Z_table_g) { + H5Z_table_g = (H5Z_class2_t *)H5MM_xfree(H5Z_table_g); #ifdef H5Z_DEBUG - H5Z_stat_table_g = (H5Z_stats_t *)H5MM_xfree(H5Z_stat_table_g); + H5Z_stat_table_g = (H5Z_stats_t *)H5MM_xfree(H5Z_stat_table_g); #endif /* H5Z_DEBUG */ - H5Z_table_used_g = H5Z_table_alloc_g = 0; - H5_interface_initialize_g = 0; + H5Z_table_used_g = H5Z_table_alloc_g = 0; + + n++; + } /* end if */ + + /* Mark interface as closed */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; } /* end if */ - return(0); -} /* end H5Z_term_interface() */ + FUNC_LEAVE_NOAPI(n) +} /* end H5Z_term_package() */ /*------------------------------------------------------------------------- @@ -825,8 +830,8 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type if(NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") - /* Get layout information */ - if(H5P_get(dc_plist, H5D_CRT_LAYOUT_NAME, &dcpl_layout) < 0) + /* Peek at the layout information */ + if(H5P_peek(dc_plist, H5D_CRT_LAYOUT_NAME, &dcpl_layout) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") /* Check if the dataset is chunked */ @@ -834,7 +839,7 @@ H5Z_prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_type H5O_pline_t dcpl_pline; /* Object's I/O pipeline information */ /* Get I/O pipeline information */ - if(H5P_get(dc_plist, H5O_CRT_PIPELINE_NAME, &dcpl_pline) < 0) + if(H5P_peek(dc_plist, H5O_CRT_PIPELINE_NAME, &dcpl_pline) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") /* Check if the chunks have filters */ @@ -1445,8 +1450,8 @@ done: H5Z_filter_info_t * H5Z_filter_info(const H5O_pline_t *pline, H5Z_filter_t filter) { - size_t idx; /* Index of filter in pipeline */ - H5Z_filter_info_t *ret_value; /* Return value */ + size_t idx; /* Index of filter in pipeline */ + H5Z_filter_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c index 06d9866..15aac27 100644 --- a/src/H5Zdeflate.c +++ b/src/H5Zdeflate.c @@ -18,7 +18,7 @@ * Friday, August 27, 1999 */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ +#include "H5Zmodule.h" /* This source code file is part of the H5Z module */ #include "H5private.h" /* Generic Functions */ @@ -77,7 +77,7 @@ H5Z_filter_deflate (unsigned flags, size_t cd_nelmts, { void *outbuf = NULL; /* Pointer to new buffer */ int status; /* Status from zlib operation */ - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) diff --git a/src/H5Zfletcher32.c b/src/H5Zfletcher32.c index 1877ddd..690d7a2 100644 --- a/src/H5Zfletcher32.c +++ b/src/H5Zfletcher32.c @@ -14,11 +14,11 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu<slu@ncsa.uiuc.edu> + * Programmer: Raymond Lu <slu@ncsa.uiuc.edu> * Jan 3, 2003 */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ +#include "H5Zmodule.h" /* This source code file is part of the H5Z module */ #include "H5private.h" /* Generic Functions */ @@ -81,7 +81,7 @@ H5Z_filter_fletcher32 (unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, const un uint32_t reversed_fletcher; /* Possible wrong checksum value */ uint8_t c[4]; uint8_t tmp; - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) diff --git a/src/H5Zmodule.h b/src/H5Zmodule.h new file mode 100644 index 0000000..fa0ef8f --- /dev/null +++ b/src/H5Zmodule.h @@ -0,0 +1,35 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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 files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Saturday, September 12, 2015 + * + * Purpose: This file contains declarations which define macros for the + * H5Z package. Including this header means that the source file + * is part of the H5Z package. + */ +#ifndef _H5Zmodule_H +#define _H5Zmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5Z_MODULE +#define H5_MY_PKG H5Z +#define H5_MY_PKG_ERR H5E_PLINE +#define H5_MY_PKG_INIT YES + +#endif /* _H5Zmodule_H */ + diff --git a/src/H5Znbit.c b/src/H5Znbit.c index 38610b6..e2fb300 100644 --- a/src/H5Znbit.c +++ b/src/H5Znbit.c @@ -13,7 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ +#include "H5Zmodule.h" /* This source code file is part of the H5Z module */ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ @@ -266,9 +266,23 @@ H5Z_calc_parms_array(const H5T_t *type) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") break; - default: /* Other datatype class: nbit does no compression */ + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + /* Other datatype classes: nbit does no compression */ H5Z_calc_parms_nooptype(); break; + + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + /* Badness */ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype") + break; } /* end switch */ done: @@ -351,9 +365,23 @@ H5Z_calc_parms_compound(const H5T_t *type) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") break; - default: /* Other datatype class: nbit does no compression */ + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + /* Other datatype classes: nbit does no compression */ H5Z_calc_parms_nooptype(); break; + + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + /* Badness */ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype") + break; } /* end switch */ /* Close member datatype */ @@ -444,7 +472,7 @@ H5Z_set_parms_atomic(const H5T_t *type, unsigned cd_values[]) /* Get datatype's size */ if((dtype_size = H5T_get_size(type)) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") /* Set "local" parameter for datatype size */ cd_values[cd_values_index++] = dtype_size; @@ -463,6 +491,10 @@ H5Z_set_parms_atomic(const H5T_t *type, unsigned cd_values[]) cd_values[cd_values_index++] = H5Z_NBIT_ORDER_BE; break; + case H5T_ORDER_VAX: + case H5T_ORDER_MIXED: + case H5T_ORDER_ERROR: + case H5T_ORDER_NONE: default: HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order") } /* end switch */ @@ -561,7 +593,7 @@ H5Z_set_parms_array(const H5T_t *type, unsigned cd_values[]) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; - default: /* other datatype that nbit does no compression */ + case H5T_VLEN: /* Check if base datatype is a variable-length string */ if((is_vlstring = H5T_is_variable_str(dtype_base)) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot determine if datatype is a variable-length string") @@ -573,6 +605,23 @@ H5Z_set_parms_array(const H5T_t *type, unsigned cd_values[]) if(H5Z_set_parms_nooptype(dtype_base, cd_values) == FAIL) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; + + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_ENUM: + if(H5Z_set_parms_nooptype(dtype_base, cd_values) == FAIL) + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") + break; + + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + /* Badness */ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype") + break; } /* end switch */ done: @@ -666,16 +715,16 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned cd_values[]) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; - default: /* other datatype that nbit does no compression */ + case H5T_VLEN: /* Check if datatype is a variable-length string */ if((is_vlstring = H5T_is_variable_str(dtype_member)) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot determine if datatype is a variable-length string") /* Because for some no-op datatype (VL datatype and VL string datatype), its - * size can not be retrieved correctly by using function call H5T_get_size, - * special handling is needed for getting the size. Here the difference between + * size can not be retrieved correctly by using function call H5T_get_size, + * special handling is needed for getting the size. Here the difference between * adjacent member offset is used (if alignment is present, the result can be - * larger, but it does not affect the nbit filter's correctness). + * larger, but it does not affect the nbit filter's correctness). */ if(dtype_member_class == H5T_VLEN || is_vlstring) { /* Set datatype class code */ @@ -688,9 +737,25 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned cd_values[]) /* Set "local" parameter for datatype size */ cd_values[cd_values_index++] = dtype_next_member_offset - dtype_member_offset; - } else - if(H5Z_set_parms_nooptype(dtype_member, cd_values)==FAIL) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") + } + break; + + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_ENUM: + /* other datatype that nbit does no compression */ + if(H5Z_set_parms_nooptype(dtype_member, cd_values) == FAIL) + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") + break; + + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + /* Badness */ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit was passed bad datatype") break; } /* end switch */ @@ -770,8 +835,22 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") break; - default: /* no need to calculate other datatypes at top level */ - break; + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + /* No need to calculate other datatypes at top level */ + break; + + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + /* Badness */ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype") + break; } /* end switch */ /* Check if the number of parameters exceed what cd_values[] can store */ @@ -826,8 +905,22 @@ H5Z_set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") break; - default: /* no need to set parameters for other datatypes at top level */ - break; + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + /* No need to set parameters for other datatypes at top level */ + break; + + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + /* Badness */ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype") + break; } /* end switch */ /* Check if calculation of parameters matches with setting of parameters */ diff --git a/src/H5Zpkg.h b/src/H5Zpkg.h index e2cec89..aa2ffe2 100644 --- a/src/H5Zpkg.h +++ b/src/H5Zpkg.h @@ -13,7 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H5Z_PACKAGE +#if !(defined H5Z_FRIEND || defined H5Z_MODULE) #error "Do not include this file outside the H5Z package!" #endif diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 673b9e0..7de0060 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -13,7 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ +#include "H5Zmodule.h" /* This source code file is part of the H5Z module */ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ @@ -746,7 +746,7 @@ static enum H5Z_scaleoffset_t H5Z_scaleoffset_get_type(unsigned dtype_class, unsigned dtype_size, unsigned dtype_sign) { enum H5Z_scaleoffset_t type = t_bad; /* integer type */ - enum H5Z_scaleoffset_t ret_value; /* return value */ + enum H5Z_scaleoffset_t ret_value = t_bad; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -977,6 +977,7 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) case H5T_ORDER_ERROR: case H5T_ORDER_VAX: + case H5T_ORDER_MIXED: case H5T_ORDER_NONE: default: HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order") @@ -1075,6 +1076,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value case H5T_ORDER_ERROR: case H5T_ORDER_VAX: + case H5T_ORDER_MIXED: case H5T_ORDER_NONE: default: HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "bad H5T_NATIVE_INT endianness order") diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c index 654a7d5..3fa6c8d 100644 --- a/src/H5Zshuffle.c +++ b/src/H5Zshuffle.c @@ -13,7 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ +#include "H5Zmodule.h" /* This source code file is part of the H5Z module */ #include "H5private.h" /* Generic Functions */ @@ -135,7 +135,7 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], size_t j; /* Local index variable */ #endif /* NO_DUFFS_DEVICE */ size_t leftover; /* Extra bytes at end of buffer */ - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(0) diff --git a/src/H5Zszip.c b/src/H5Zszip.c index f0d08d8..2c2ed07 100644 --- a/src/H5Zszip.c +++ b/src/H5Zszip.c @@ -13,7 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ +#include "H5Zmodule.h" /* This source code file is part of the H5Z module */ #include "H5private.h" /* Generic Functions */ diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 7a94487..42d6ceb 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -13,7 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define H5Z_PACKAGE /*suppress error about including H5Zpkg */ +#include "H5Zmodule.h" /* This source code file is part of the H5Z module */ #include "H5private.h" /* Generic Functions */ @@ -255,8 +255,14 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); else \ { \ ret_value->type = (TYPE); \ - ret_value->lchild = (H5Z_node*) H5Z_xform_copy_tree(tree->lchild, dat_val_pointers, new_dat_val_pointers); \ - ret_value->rchild = (H5Z_node*) H5Z_xform_copy_tree(tree->rchild, dat_val_pointers, new_dat_val_pointers); \ + if(tree->lchild) \ + ret_value->lchild = (H5Z_node*) H5Z_xform_copy_tree(tree->lchild, dat_val_pointers, new_dat_val_pointers); \ + else \ + ret_value->lchild = NULL; \ + if(tree->rchild) \ + ret_value->rchild = (H5Z_node*) H5Z_xform_copy_tree(tree->rchild, dat_val_pointers, new_dat_val_pointers); \ + else \ + ret_value->rchild = NULL; \ } \ } @@ -542,7 +548,7 @@ static void * H5Z_xform_parse(const char *expression, H5Z_datval_ptrs* dat_val_pointers) { H5Z_token tok; - void* ret_value; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -581,7 +587,7 @@ static H5Z_node * H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) { H5Z_node *expr; - H5Z_node *ret_value; /* Return value */ + H5Z_node *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -675,7 +681,7 @@ static H5Z_node * H5Z_parse_term(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) { H5Z_node *term = NULL; - H5Z_node *ret_value; + H5Z_node *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -731,11 +737,20 @@ H5Z_parse_term(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) case H5Z_XFORM_END: HGOTO_DONE(term) - default: + case H5Z_XFORM_INTEGER: + case H5Z_XFORM_FLOAT: + case H5Z_XFORM_SYMBOL: + case H5Z_XFORM_PLUS: + case H5Z_XFORM_MINUS: + case H5Z_XFORM_LPAREN: H5Z_unget_token(current); HGOTO_DONE(term) - } - } + + case H5Z_XFORM_ERROR: + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "bad transform type passed to data transform expression") + } /* end switch */ + } /* end for */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -766,119 +781,122 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) { H5Z_node *factor=NULL; H5Z_node *new_node; - H5Z_node *ret_value; + H5Z_node *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT current = H5Z_get_token(current); switch (current->tok_type) { - case H5Z_XFORM_INTEGER: - factor = H5Z_new_node(H5Z_XFORM_INTEGER); + case H5Z_XFORM_INTEGER: + factor = H5Z_new_node(H5Z_XFORM_INTEGER); - if (!factor) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") + if (!factor) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") sscanf(current->tok_begin, "%ld", &factor->value.int_val); - break; + break; - case H5Z_XFORM_FLOAT: - factor = H5Z_new_node(H5Z_XFORM_FLOAT); + case H5Z_XFORM_FLOAT: + factor = H5Z_new_node(H5Z_XFORM_FLOAT); - if (!factor) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") + if (!factor) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") sscanf(current->tok_begin, "%lf", &factor->value.float_val); - break; + break; - case H5Z_XFORM_SYMBOL: - factor = H5Z_new_node(H5Z_XFORM_SYMBOL); + case H5Z_XFORM_SYMBOL: + factor = H5Z_new_node(H5Z_XFORM_SYMBOL); - if (!factor) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") + if (!factor) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") factor->value.dat_val = &(dat_val_pointers->ptr_dat_val[dat_val_pointers->num_ptrs]); - dat_val_pointers->num_ptrs++; - break; + dat_val_pointers->num_ptrs++; + break; - case H5Z_XFORM_LPAREN: - factor = H5Z_parse_expression(current, dat_val_pointers); + case H5Z_XFORM_LPAREN: + factor = H5Z_parse_expression(current, dat_val_pointers); - if (!factor) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") + if (!factor) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") current = H5Z_get_token(current); - if (current->tok_type != H5Z_XFORM_RPAREN) { - H5Z_xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error in data transform expression") - } - break; - - case H5Z_XFORM_RPAREN: - /* We shouldn't see a ) right now */ - H5Z_xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error: unexpected ')' ") + if (current->tok_type != H5Z_XFORM_RPAREN) { + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error in data transform expression") + } + break; - case H5Z_XFORM_PLUS: - /* unary + */ - new_node = H5Z_parse_factor(current, dat_val_pointers); + case H5Z_XFORM_RPAREN: + /* We shouldn't see a ) right now */ + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error: unexpected ')' ") + + case H5Z_XFORM_PLUS: + /* unary + */ + new_node = H5Z_parse_factor(current, dat_val_pointers); + + if (new_node) { + if (new_node->type != H5Z_XFORM_INTEGER && new_node->type != H5Z_XFORM_FLOAT && + new_node->type != H5Z_XFORM_SYMBOL) { + H5Z_xform_destroy_parse_tree(new_node); + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + } - if (new_node) { - if (new_node->type != H5Z_XFORM_INTEGER && new_node->type != H5Z_XFORM_FLOAT && - new_node->type != H5Z_XFORM_SYMBOL) { - H5Z_xform_destroy_parse_tree(new_node); - H5Z_xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") - } + factor = new_node; + new_node = H5Z_new_node(H5Z_XFORM_PLUS); - factor = new_node; - new_node = H5Z_new_node(H5Z_XFORM_PLUS); + if (!new_node) { + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + } - if (!new_node) { + new_node->rchild = factor; + factor = new_node; + } else { H5Z_xform_destroy_parse_tree(factor); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") } + break; - new_node->rchild = factor; - factor = new_node; - } else { - H5Z_xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") - } - break; + case H5Z_XFORM_MINUS: + /* unary - */ + new_node = H5Z_parse_factor(current, dat_val_pointers); - case H5Z_XFORM_MINUS: - /* unary - */ - new_node = H5Z_parse_factor(current, dat_val_pointers); + if (new_node) { + if (new_node->type != H5Z_XFORM_INTEGER && new_node->type != H5Z_XFORM_FLOAT && + new_node->type != H5Z_XFORM_SYMBOL) { + H5Z_xform_destroy_parse_tree(new_node); + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + } - if (new_node) { - if (new_node->type != H5Z_XFORM_INTEGER && new_node->type != H5Z_XFORM_FLOAT && - new_node->type != H5Z_XFORM_SYMBOL) { - H5Z_xform_destroy_parse_tree(new_node); - H5Z_xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") - } + factor = new_node; + new_node = H5Z_new_node(H5Z_XFORM_MINUS); - factor = new_node; - new_node = H5Z_new_node(H5Z_XFORM_MINUS); + if (!new_node) { + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + } - if (!new_node) { + new_node->rchild = factor; + factor = new_node; + } else { H5Z_xform_destroy_parse_tree(factor); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") } + break; - new_node->rchild = factor; - factor = new_node; - } else { - H5Z_xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") - } - break; - - case H5Z_XFORM_END: - break; + case H5Z_XFORM_END: + break; - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Invalid token while parsing data transform expression") + case H5Z_XFORM_MULT: + case H5Z_XFORM_DIVIDE: + case H5Z_XFORM_ERROR: + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Invalid token while parsing data transform expression") } @@ -905,7 +923,7 @@ done: static H5Z_node * H5Z_new_node(H5Z_token_type type) { - H5Z_node *ret_value; + H5Z_node *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1091,23 +1109,30 @@ H5Z_xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_ switch (tree->type) { case H5Z_XFORM_PLUS: - H5Z_XFORM_TYPE_OP(resl, resr, array_type, +, array_size) - break; + H5Z_XFORM_TYPE_OP(resl, resr, array_type, +, array_size) + break; case H5Z_XFORM_MINUS: - H5Z_XFORM_TYPE_OP(resl, resr, array_type, -, array_size) - break; + H5Z_XFORM_TYPE_OP(resl, resr, array_type, -, array_size) + break; case H5Z_XFORM_MULT: - H5Z_XFORM_TYPE_OP(resl, resr, array_type, *, array_size) - break; + H5Z_XFORM_TYPE_OP(resl, resr, array_type, *, array_size) + break; case H5Z_XFORM_DIVIDE: - H5Z_XFORM_TYPE_OP(resl, resr, array_type, /, array_size) - break; + H5Z_XFORM_TYPE_OP(resl, resr, array_type, /, array_size) + break; + case H5Z_XFORM_ERROR: + case H5Z_XFORM_INTEGER: + case H5Z_XFORM_FLOAT: + case H5Z_XFORM_SYMBOL: + case H5Z_XFORM_LPAREN: + case H5Z_XFORM_RPAREN: + case H5Z_XFORM_END: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid expression tree") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid expression tree") } /* end switch */ /* The result stores a pointer to the new data */ @@ -1277,14 +1302,11 @@ H5Z_xform_copy_tree(H5Z_node* tree, H5Z_datval_ptrs* dat_val_pointers, H5Z_datva H5Z_XFORM_DO_OP4(H5Z_XFORM_MINUS) else if(tree->type == H5Z_XFORM_DIVIDE) H5Z_XFORM_DO_OP4(H5Z_XFORM_DIVIDE) - else HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error in parse tree while trying to copy") - - - done: - FUNC_LEAVE_NOAPI(ret_value) +done: + FUNC_LEAVE_NOAPI(ret_value) } @@ -1458,10 +1480,10 @@ H5Z_do_op(H5Z_node* tree) H5Z_data_xform_t * H5Z_xform_create(const char *expr) { - H5Z_data_xform_t *data_xform_prop=NULL; - H5Z_data_xform_t *ret_value; + H5Z_data_xform_t *data_xform_prop = NULL; unsigned int i; unsigned int count = 0; + H5Z_data_xform_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1494,7 +1516,7 @@ H5Z_xform_create(const char *expr) * of the data we have for polynomial transforms */ data_xform_prop->dat_val_pointers->num_ptrs = 0; - /* we generate the parse tree right here and store a poitner to its root in the property. */ + /* we generate the parse tree right here and store a pointer to its root in the property. */ if((data_xform_prop->parse_root = (H5Z_node *)H5Z_xform_parse(expr, data_xform_prop->dat_val_pointers))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to generate parse tree from expression") @@ -1590,8 +1612,6 @@ H5Z_xform_destroy(H5Z_data_xform_t *data_xform_prop) * after the top-level copy has been performed and this routine finishes * the "deep" part of the copy. * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1677,7 +1697,7 @@ done: hbool_t H5Z_xform_noop(const H5Z_data_xform_t *data_xform_prop) { - hbool_t ret_value; + hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5api_adpt.h b/src/H5api_adpt.h index ab7287c..910bef9 100644 --- a/src/H5api_adpt.h +++ b/src/H5api_adpt.h @@ -21,28 +21,6 @@ #ifndef H5API_ADPT_H #define H5API_ADPT_H -/* - * Does the compiler support the __attribute__(()) syntax? It's no - * big deal if we don't. - * - * Note that Solaris Studio supports attribute, but does not support the - * attributes we use. - */ -#ifdef __cplusplus -# define H5_ATTR_FORMAT(X,Y,Z) /*void*/ -# define H5_ATTR_UNUSED /*void*/ -# define H5_ATTR_NORETURN /*void*/ -#else /* __cplusplus */ -#if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C) -# define H5_ATTR_FORMAT(X,Y,Z) __attribute__((format(X, Y, Z))) -# define H5_ATTR_UNUSED __attribute__((unused)) -# define H5_ATTR_NORETURN __attribute__((noreturn)) -#else -# define H5_ATTR_FORMAT(X,Y,Z) /*void*/ -# define H5_ATTR_UNUSED /*void*/ -# define H5_ATTR_NORETURN /*void*/ -#endif -#endif /* __cplusplus */ /* This will only be defined if HDF5 was built with CMake */ #ifdef H5_BUILT_AS_DYNAMIC_LIB diff --git a/src/H5config.h.in b/src/H5config.h.in deleted file mode 100644 index ad8dcf9..0000000 --- a/src/H5config.h.in +++ /dev/null @@ -1,656 +0,0 @@ -/* src/H5config.h.in. Generated from configure.ac by autoheader. */ - -/* Define if building universal (internal helper macro) */ -#undef AC_APPLE_UNIVERSAL_BUILD - -/* Define if the memory buffers being written to disk should be cleared before - writing. */ -#undef CLEAR_MEMORY - -/* Define if C++ compiler recognizes offsetof */ -#undef CXX_HAVE_OFFSETOF - -/* Define the default plugins path to compile */ -#undef DEFAULT_PLUGINDIR - -/* Define if `dev_t' is a scalar */ -#undef DEV_T_IS_SCALAR - -/* Define to dummy `main' function (if any) required to link to the Fortran - libraries. */ -#undef FC_DUMMY_MAIN - -/* Define if F77 and FC dummy `main' functions are identical. */ -#undef FC_DUMMY_MAIN_EQ_F77 - -/* Define to a macro mangling the given C identifier (in lower and upper - case), which must not contain underscores, for linking with Fortran. */ -#undef FC_FUNC - -/* As FC_FUNC, but for C identifiers containing underscores. */ -#undef FC_FUNC_ - -/* Define if Fortran C_LONG_DOUBLE is different from C_DOUBLE */ -#undef FORTRAN_C_LONG_DOUBLE_IS_UNIQUE - -/* Define if we have Fortran C_LONG_DOUBLE */ -#undef FORTRAN_HAVE_C_LONG_DOUBLE - -/* Define if we have Fortran intrinsic C_SIZEOF */ -#undef FORTRAN_HAVE_C_SIZEOF - -/* Define if we have Fortran intrinsic SIZEOF */ -#undef FORTRAN_HAVE_SIZEOF - -/* Define if we have Fortran intrinsic STORAGE_SIZE */ -#undef FORTRAN_HAVE_STORAGE_SIZE - -/* Determine the size of C long double */ -#undef FORTRAN_SIZEOF_LONG_DOUBLE - -/* Define valid Fortran INTEGER KINDs */ -#undef H5CONFIG_F_IKIND - -/* Define number of valid Fortran INTEGER KINDs */ -#undef H5CONFIG_F_NUM_IKIND - -/* Define number of valid Fortran REAL KINDs */ -#undef H5CONFIG_F_NUM_RKIND - -/* Define valid Fortran REAL KINDs */ -#undef H5CONFIG_F_RKIND - -/* Define valid Fortran REAL KINDs Sizeof */ -#undef H5CONFIG_F_RKIND_SIZEOF - -/* Define to 1 if you have the `alarm' function. */ -#undef HAVE_ALARM - -/* Define to 1 if you have the `asprintf' function. */ -#undef HAVE_ASPRINTF - -/* Define if the __attribute__(()) extension is present */ -#undef HAVE_ATTRIBUTE - -/* Define if the compiler understands C99 designated initialization of structs - and unions */ -#undef HAVE_C99_DESIGNATED_INITIALIZER - -/* Define if the compiler understands the __func__ keyword */ -#undef HAVE_C99_FUNC - -/* Define to 1 if you have the `clock_gettime' function. */ -#undef HAVE_CLOCK_GETTIME - -/* Define if the function stack tracing code is to be compiled in */ -#undef HAVE_CODESTACK - -/* Define if Darwin or Mac OS X */ -#undef HAVE_DARWIN - -/* Define to 1 if you have the `difftime' function. */ -#undef HAVE_DIFFTIME - -/* Define if the direct I/O virtual file driver (VFD) should be compiled */ -#undef HAVE_DIRECT - -/* Define to 1 if you have the <dirent.h> header file. */ -#undef HAVE_DIRENT_H - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the <dmalloc.h> header file. */ -#undef HAVE_DMALLOC_H - -/* Define if library information should be embedded in the executables */ -#undef HAVE_EMBEDDED_LIBINFO - -/* Define to 1 if you have the <features.h> header file. */ -#undef HAVE_FEATURES_H - -/* Define if support for deflate (zlib) filter is enabled */ -#undef HAVE_FILTER_DEFLATE - -/* Define if support for szip filter is enabled */ -#undef HAVE_FILTER_SZIP - -/* Determine if __float128 is available */ -#undef HAVE_FLOAT128 - -/* Define to 1 if you have the `fork' function. */ -#undef HAVE_FORK - -/* Define to 1 if you have the `frexpf' function. */ -#undef HAVE_FREXPF - -/* Define to 1 if you have the `frexpl' function. */ -#undef HAVE_FREXPL - -/* Define to 1 if you have the `fseeko' function. */ -#undef HAVE_FSEEKO - -/* Define to 1 if you have the `fseeko64' function. */ -#undef HAVE_FSEEKO64 - -/* Define to 1 if you have the `fstat64' function. */ -#undef HAVE_FSTAT64 - -/* Define to 1 if you have the `ftello' function. */ -#undef HAVE_FTELLO - -/* Define to 1 if you have the `ftello64' function. */ -#undef HAVE_FTELLO64 - -/* Define to 1 if you have the `ftruncate64' function. */ -#undef HAVE_FTRUNCATE64 - -/* Define if the compiler understands the __FUNCTION__ keyword */ -#undef HAVE_FUNCTION - -/* Determine if INTEGER*16 is available */ -#undef HAVE_Fortran_INTEGER_SIZEOF_16 - -/* Define to 1 if you have the `GetConsoleScreenBufferInfo' function. */ -#undef HAVE_GETCONSOLESCREENBUFFERINFO - -/* Define to 1 if you have the `gethostname' function. */ -#undef HAVE_GETHOSTNAME - -/* Define to 1 if you have the `getpwuid' function. */ -#undef HAVE_GETPWUID - -/* Define to 1 if you have the `getrusage' function. */ -#undef HAVE_GETRUSAGE - -/* Define to 1 if you have the `gettextinfo' function. */ -#undef HAVE_GETTEXTINFO - -/* Define to 1 if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define to 1 if you have the `get_fpc_csr' function. */ -#undef HAVE_GET_FPC_CSR - -/* Define if the compiler understands inline */ -#undef HAVE_INLINE - -/* Define if library will contain instrumentation to detect correct - optimization operation */ -#undef HAVE_INSTRUMENTED_LIBRARY - -/* Define to 1 if you have the <inttypes.h> header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `ioctl' function. */ -#undef HAVE_IOCTL - -/* Define to 1 if you have the <io.h> header file. */ -#undef HAVE_IO_H - -/* Define to 1 if you have the `dl' library (-ldl). */ -#undef HAVE_LIBDL - -/* Define to 1 if you have the `dmalloc' library (-ldmalloc). */ -#undef HAVE_LIBDMALLOC - -/* Define to 1 if you have the `m' library (-lm). */ -#undef HAVE_LIBM - -/* Define to 1 if you have the `mpe' library (-lmpe). */ -#undef HAVE_LIBMPE - -/* Define to 1 if you have the `nsl' library (-lnsl). */ -#undef HAVE_LIBNSL - -/* Define to 1 if you have the `pthread' library (-lpthread). */ -#undef HAVE_LIBPTHREAD - -/* Define to 1 if you have the `socket' library (-lsocket). */ -#undef HAVE_LIBSOCKET - -/* Define to 1 if you have the `sz' library (-lsz). */ -#undef HAVE_LIBSZ - -/* Define to 1 if you have the `ws2_32' library (-lws2_32). */ -#undef HAVE_LIBWS2_32 - -/* Define to 1 if you have the `z' library (-lz). */ -#undef HAVE_LIBZ - -/* Define to 1 if you have the `longjmp' function. */ -#undef HAVE_LONGJMP - -/* Define to 1 if you have the `lseek64' function. */ -#undef HAVE_LSEEK64 - -/* Define to 1 if you have the `lstat' function. */ -#undef HAVE_LSTAT - -/* Define to 1 if you have the <mach/mach_time.h> header file. */ -#undef HAVE_MACH_MACH_TIME_H - -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* Define if we have MPE support */ -#undef HAVE_MPE - -/* Define to 1 if you have the <mpe.h> header file. */ -#undef HAVE_MPE_H - -/* Define if `MPI_Comm_c2f' and `MPI_Comm_f2c' exists */ -#undef HAVE_MPI_MULTI_LANG_Comm - -/* Define if `MPI_Info_c2f' and `MPI_Info_f2c' exists */ -#undef HAVE_MPI_MULTI_LANG_Info - -/* Define if we have parallel support */ -#undef HAVE_PARALLEL - -/* Define to 1 if you have the <pthread.h> header file. */ -#undef HAVE_PTHREAD_H - -/* Define to 1 if you have the <quadmath.h> header file. */ -#undef HAVE_QUADMATH_H - -/* Define to 1 if you have the `random' function. */ -#undef HAVE_RANDOM - -/* Define to 1 if you have the `rand_r' function. */ -#undef HAVE_RAND_R - -/* Define to 1 if you have the `setjmp' function. */ -#undef HAVE_SETJMP - -/* Define to 1 if you have the <setjmp.h> header file. */ -#undef HAVE_SETJMP_H - -/* Define to 1 if you have the `setsysinfo' function. */ -#undef HAVE_SETSYSINFO - -/* Define to 1 if you have the `siglongjmp' function. */ -#undef HAVE_SIGLONGJMP - -/* Define to 1 if you have the `signal' function. */ -#undef HAVE_SIGNAL - -/* Define to 1 if you have the `sigprocmask' function. */ -#undef HAVE_SIGPROCMASK - -/* Define to 1 if you have the `sigsetjmp' function. */ -#undef HAVE_SIGSETJMP - -/* Define to 1 if you have the `snprintf' function. */ -#undef HAVE_SNPRINTF - -/* Define to 1 if you have the `srandom' function. */ -#undef HAVE_SRANDOM - -/* Define to 1 if you have the `stat64' function. */ -#undef HAVE_STAT64 - -/* Define if `struct stat' has the `st_blocks' field */ -#undef HAVE_STAT_ST_BLOCKS - -/* Define to 1 if you have the <stddef.h> header file. */ -#undef HAVE_STDDEF_H - -/* Define to 1 if you have the <stdint.h> header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strdup' function. */ -#undef HAVE_STRDUP - -/* Define to 1 if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the <string.h> header file. */ -#undef HAVE_STRING_H - -/* Define if `struct text_info' is defined */ -#undef HAVE_STRUCT_TEXT_INFO - -/* Define if `struct videoconfig' is defined */ -#undef HAVE_STRUCT_VIDEOCONFIG - -/* Define to 1 if you have the `symlink' function. */ -#undef HAVE_SYMLINK - -/* Define to 1 if you have the `system' function. */ -#undef HAVE_SYSTEM - -/* Define to 1 if you have the <sys/fpu.h> header file. */ -#undef HAVE_SYS_FPU_H - -/* Define to 1 if you have the <sys/ioctl.h> header file. */ -#undef HAVE_SYS_IOCTL_H - -/* Define to 1 if you have the <sys/proc.h> header file. */ -#undef HAVE_SYS_PROC_H - -/* Define to 1 if you have the <sys/resource.h> header file. */ -#undef HAVE_SYS_RESOURCE_H - -/* Define to 1 if you have the <sys/socket.h> header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the <sys/sysinfo.h> header file. */ -#undef HAVE_SYS_SYSINFO_H - -/* Define to 1 if you have the <sys/timeb.h> header file. */ -#undef HAVE_SYS_TIMEB_H - -/* Define to 1 if you have the <sys/time.h> header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the <sys/types.h> header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the <szlib.h> header file. */ -#undef HAVE_SZLIB_H - -/* Define if we have thread safe support */ -#undef HAVE_THREADSAFE - -/* Define if `timezone' is a global variable */ -#undef HAVE_TIMEZONE - -/* Define if the ioctl TIOCGETD is defined */ -#undef HAVE_TIOCGETD - -/* Define if the ioctl TIOGWINSZ is defined */ -#undef HAVE_TIOCGWINSZ - -/* Define to 1 if you have the `tmpfile' function. */ -#undef HAVE_TMPFILE - -/* Define if `tm_gmtoff' is a member of `struct tm' */ -#undef HAVE_TM_GMTOFF - -/* Define to 1 if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `vasprintf' function. */ -#undef HAVE_VASPRINTF - -/* Define to 1 if you have the `vsnprintf' function. */ -#undef HAVE_VSNPRINTF - -/* Define to 1 if you have the `waitpid' function. */ -#undef HAVE_WAITPID - -/* Define if your system has window style path name. */ -#undef HAVE_WINDOW_PATH - -/* Define to 1 if you have the <winsock2.h> header file. */ -#undef HAVE_WINSOCK2_H - -/* Define to 1 if you have the <zlib.h> header file. */ -#undef HAVE_ZLIB_H - -/* Define to 1 if you have the `_getvideoconfig' function. */ -#undef HAVE__GETVIDEOCONFIG - -/* Define to 1 if you have the `_scrsize' function. */ -#undef HAVE__SCRSIZE - -/* Define if the compiler understands __inline */ -#undef HAVE___INLINE - -/* Define if the compiler understands __inline__ */ -#undef HAVE___INLINE__ - -/* Define if HDF5's high-level library headers should be included in hdf5.h */ -#undef INCLUDE_HL - -/* Define if your system can convert long double to (unsigned) long long - values correctly. */ -#undef LDOUBLE_TO_LLONG_ACCURATE - -/* Define if your system converts long double to (unsigned) long values with - special algorithm. */ -#undef LDOUBLE_TO_LONG_SPECIAL - -/* Define if your system can convert (unsigned) long long to long double - values correctly. */ -#undef LLONG_TO_LDOUBLE_CORRECT - -/* Define if your system can convert (unsigned) long to long double values - with special algorithm. */ -#undef LONG_TO_LDOUBLE_SPECIAL - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Define if the metadata trace file code is to be compiled in */ -#undef METADATA_TRACE_FILE - -/* Define if we can violate pointer alignment restrictions */ -#undef NO_ALIGNMENT_RESTRICTIONS - -/* Define if deprecated public API symbols are disabled */ -#undef NO_DEPRECATED_SYMBOLS - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Determine the maximum decimal precision in C */ -#undef PAC_C_MAX_REAL_PRECISION - -/* Define Fortran Maximum Real Decimal Precision */ -#undef PAC_FC_MAX_REAL_PRECISION - -/* Width for printf() for type `long long' or `__int64', use `ll' */ -#undef PRINTF_LL_WIDTH - -/* The size of `char', as computed by sizeof. */ -#undef SIZEOF_CHAR - -/* The size of `double', as computed by sizeof. */ -#undef SIZEOF_DOUBLE - -/* The size of `float', as computed by sizeof. */ -#undef SIZEOF_FLOAT - -/* The size of `int', as computed by sizeof. */ -#undef SIZEOF_INT - -/* The size of `int16_t', as computed by sizeof. */ -#undef SIZEOF_INT16_T - -/* The size of `int32_t', as computed by sizeof. */ -#undef SIZEOF_INT32_T - -/* The size of `int64_t', as computed by sizeof. */ -#undef SIZEOF_INT64_T - -/* The size of `int8_t', as computed by sizeof. */ -#undef SIZEOF_INT8_T - -/* The size of `int_fast16_t', as computed by sizeof. */ -#undef SIZEOF_INT_FAST16_T - -/* The size of `int_fast32_t', as computed by sizeof. */ -#undef SIZEOF_INT_FAST32_T - -/* The size of `int_fast64_t', as computed by sizeof. */ -#undef SIZEOF_INT_FAST64_T - -/* The size of `int_fast8_t', as computed by sizeof. */ -#undef SIZEOF_INT_FAST8_T - -/* The size of `int_least16_t', as computed by sizeof. */ -#undef SIZEOF_INT_LEAST16_T - -/* The size of `int_least32_t', as computed by sizeof. */ -#undef SIZEOF_INT_LEAST32_T - -/* The size of `int_least64_t', as computed by sizeof. */ -#undef SIZEOF_INT_LEAST64_T - -/* The size of `int_least8_t', as computed by sizeof. */ -#undef SIZEOF_INT_LEAST8_T - -/* The size of `long', as computed by sizeof. */ -#undef SIZEOF_LONG - -/* The size of `long double', as computed by sizeof. */ -#undef SIZEOF_LONG_DOUBLE - -/* The size of `long long', as computed by sizeof. */ -#undef SIZEOF_LONG_LONG - -/* The size of `off64_t', as computed by sizeof. */ -#undef SIZEOF_OFF64_T - -/* The size of `off_t', as computed by sizeof. */ -#undef SIZEOF_OFF_T - -/* The size of `ptrdiff_t', as computed by sizeof. */ -#undef SIZEOF_PTRDIFF_T - -/* The size of `short', as computed by sizeof. */ -#undef SIZEOF_SHORT - -/* The size of `size_t', as computed by sizeof. */ -#undef SIZEOF_SIZE_T - -/* The size of `ssize_t', as computed by sizeof. */ -#undef SIZEOF_SSIZE_T - -/* The size of `uint16_t', as computed by sizeof. */ -#undef SIZEOF_UINT16_T - -/* The size of `uint32_t', as computed by sizeof. */ -#undef SIZEOF_UINT32_T - -/* The size of `uint64_t', as computed by sizeof. */ -#undef SIZEOF_UINT64_T - -/* The size of `uint8_t', as computed by sizeof. */ -#undef SIZEOF_UINT8_T - -/* The size of `uint_fast16_t', as computed by sizeof. */ -#undef SIZEOF_UINT_FAST16_T - -/* The size of `uint_fast32_t', as computed by sizeof. */ -#undef SIZEOF_UINT_FAST32_T - -/* The size of `uint_fast64_t', as computed by sizeof. */ -#undef SIZEOF_UINT_FAST64_T - -/* The size of `uint_fast8_t', as computed by sizeof. */ -#undef SIZEOF_UINT_FAST8_T - -/* The size of `uint_least16_t', as computed by sizeof. */ -#undef SIZEOF_UINT_LEAST16_T - -/* The size of `uint_least32_t', as computed by sizeof. */ -#undef SIZEOF_UINT_LEAST32_T - -/* The size of `uint_least64_t', as computed by sizeof. */ -#undef SIZEOF_UINT_LEAST64_T - -/* The size of `uint_least8_t', as computed by sizeof. */ -#undef SIZEOF_UINT_LEAST8_T - -/* The size of `unsigned', as computed by sizeof. */ -#undef SIZEOF_UNSIGNED - -/* The size of `_Quad', as computed by sizeof. */ -#undef SIZEOF__QUAD - -/* The size of `__float128', as computed by sizeof. */ -#undef SIZEOF___FLOAT128 - -/* The size of `__int64', as computed by sizeof. */ -#undef SIZEOF___INT64 - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define if strict file format checks are enabled */ -#undef STRICT_FORMAT_CHECKS - -/* Define if your system supports pthread_attr_setscope(&attribute, - PTHREAD_SCOPE_SYSTEM) call. */ -#undef SYSTEM_SCOPE_THREADS - -/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ -#undef TIME_WITH_SYS_TIME - -/* Define using v1.6 public API symbols by default */ -#undef USE_16_API_DEFAULT - -/* Define if a memory checking tool will be used on the library, to cause - library to be very picky about memory operations and also disable the - internal free list manager code. */ -#undef USING_MEMCHECKER - -/* Version number of package */ -#undef VERSION - -/* Data accuracy is prefered to speed during data conversions */ -#undef WANT_DATA_ACCURACY - -/* Check exception handling functions during data conversions */ -#undef WANT_DCONV_EXCEPTION - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif - -/* Number of bits in a file offset, on hosts where this is settable. */ -#undef _FILE_OFFSET_BITS - -/* Define for large files, on AIX-style hosts. */ -#undef _LARGE_FILES - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `long int' if <sys/types.h> does not define. */ -#undef off_t - -/* Define to `long' if <sys/types.h> does not define. */ -#undef ptrdiff_t - -/* Define to `unsigned long' if <sys/types.h> does not define. */ -#undef size_t - -/* Define to `long' if <sys/types.h> does not define. */ -#undef ssize_t diff --git a/src/H5detect.c b/src/H5detect.c index 5daf883..ee02c52 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -608,7 +608,7 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) /* Module Setup */\n\ /****************/\n\ \n\ -#define H5T_PACKAGE /*suppress error about including H5Tpkg.h*/\n\ +#include \"H5Tmodule.h\" /* This source code file is part of the H5T module */\n\ \n\ \n\ /***********/\n\ @@ -667,7 +667,7 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) printf("\n\ \n\ /*-------------------------------------------------------------------------\n\ - * Function: H5TN_init_interface\n\ + * Function: H5T__init_native\n\ *\n\ * Purpose: Initialize pre-defined native datatypes from code generated\n\ * during the library configuration by H5detect.\n\ @@ -681,12 +681,12 @@ print_results(int nd, detected_t *d, int na, malign_t *misc_align) *-------------------------------------------------------------------------\n\ */\n\ herr_t\n\ -H5TN_init_interface(void)\n\ +H5T__init_native(void)\n\ {\n\ H5T_t *dt = NULL;\n\ herr_t ret_value = SUCCEED;\n\ \n\ - FUNC_ENTER_NOAPI(FAIL)\n"); + FUNC_ENTER_PACKAGE\n"); for(i = 0; i < nd; i++) { /* The native endianess of this machine */ @@ -809,7 +809,7 @@ done:\n\ } /* end if */\n\ } /* end if */\n\ \n\ - FUNC_LEAVE_NOAPI(ret_value);\n} /* end H5TN_init_interface() */\n"); + FUNC_LEAVE_NOAPI(ret_value);\n} /* end H5T__init_native() */\n"); /* Print the ALIGNMENT and signal-handling status as comments */ printf("\n" diff --git a/src/H5err.txt b/src/H5err.txt index 5a38cdf..e0ebf5e 100644 --- a/src/H5err.txt +++ b/src/H5err.txt @@ -217,6 +217,7 @@ MINOR, DSPACE, H5E_CANTSELECT, Can't select hyperslab MINOR, DSPACE, H5E_CANTNEXT, Can't move to next iterator location MINOR, DSPACE, H5E_BADSELECT, Invalid selection MINOR, DSPACE, H5E_CANTCOMPARE, Can't compare objects +MINOR, DSPACE, H5E_CANTAPPEND, Can't append object # Property list errors MINOR, PLIST, H5E_CANTGET, Can't get value diff --git a/src/H5overflow.h b/src/H5overflow.h deleted file mode 100644 index dc4ed2d..0000000 --- a/src/H5overflow.h +++ /dev/null @@ -1,2254 +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 files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* Generated automatically by bin/make_overflow -- do not edit */ -/* Add new types to H5overflow.txt file */ - - -#ifndef _H5overflow_H -#define _H5overflow_H - - -/* Each type in this file is tested for assignment to the other types, - * and range checks are defined for bad assignments at run-time. - */ - -/* Assignment checks for unsigned */ - -/* src: unsigned, dst: int */ -#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_INT - #define ASSIGN_unsigned_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_INT - #define ASSIGN_unsigned_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_INT */ - #define ASSIGN_unsigned_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: unsigned dst: int */ - -/* src: unsigned, dst: int64_t */ -#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_INT64_T - #define ASSIGN_unsigned_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_INT64_T - #define ASSIGN_unsigned_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_INT64_T */ - #define ASSIGN_unsigned_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: unsigned dst: int64_t */ - -/* src: unsigned, dst: uint8_t */ -#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_UINT8_T - #define ASSIGN_unsigned_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_UINT8_T - #define ASSIGN_unsigned_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_UINT8_T */ - #define ASSIGN_unsigned_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: unsigned dst: uint8_t */ - -/* src: unsigned, dst: uint16_t */ -#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_UINT16_T - #define ASSIGN_unsigned_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_UINT16_T - #define ASSIGN_unsigned_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_UINT16_T */ - #define ASSIGN_unsigned_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: unsigned dst: uint16_t */ - -/* src: unsigned, dst: uint32_t */ -#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_UINT32_T - #define ASSIGN_unsigned_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_UINT32_T - #define ASSIGN_unsigned_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_UINT32_T */ - #define ASSIGN_unsigned_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: unsigned dst: uint32_t */ - -/* src: unsigned, dst: uint64_t */ -#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_UINT64_T - #define ASSIGN_unsigned_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_UINT64_T - #define ASSIGN_unsigned_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_UINT64_T */ - #define ASSIGN_unsigned_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: unsigned dst: uint64_t */ - -/* src: unsigned, dst: ptrdiff_t */ -#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_PTRDIFF_T - #define ASSIGN_unsigned_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_PTRDIFF_T - #define ASSIGN_unsigned_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_PTRDIFF_T */ - #define ASSIGN_unsigned_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: unsigned dst: ptrdiff_t */ - -/* src: unsigned, dst: size_t */ -#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_SIZE_T - #define ASSIGN_unsigned_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_SIZE_T - #define ASSIGN_unsigned_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_SIZE_T */ - #define ASSIGN_unsigned_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: unsigned dst: size_t */ - -/* src: unsigned, dst: ssize_t */ -#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_SSIZE_T - #define ASSIGN_unsigned_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_SSIZE_T - #define ASSIGN_unsigned_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_SSIZE_T */ - #define ASSIGN_unsigned_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: unsigned dst: ssize_t */ - -/* src: unsigned, dst: haddr_t */ -#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_HADDR_T - #define ASSIGN_unsigned_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_HADDR_T - #define ASSIGN_unsigned_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_HADDR_T */ - #define ASSIGN_unsigned_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: unsigned dst: haddr_t */ - -/* src: unsigned, dst: hsize_t */ -#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_HSIZE_T - #define ASSIGN_unsigned_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_HSIZE_T - #define ASSIGN_unsigned_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_HSIZE_T */ - #define ASSIGN_unsigned_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: unsigned dst: hsize_t */ - -/* src: unsigned, dst: hssize_t */ -#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_HSSIZE_T - #define ASSIGN_unsigned_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_HSSIZE_T - #define ASSIGN_unsigned_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_HSSIZE_T */ - #define ASSIGN_unsigned_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: unsigned dst: hssize_t */ - -/* src: unsigned, dst: h5_stat_size_t */ -#if H5_SIZEOF_UNSIGNED < H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_unsigned_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UNSIGNED > H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_unsigned_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UNSIGNED == H5_SIZEOF_H5_STAT_SIZE_T */ - #define ASSIGN_unsigned_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: unsigned dst: h5_stat_size_t */ - - -/* Assignment checks for int */ - -/* src: int, dst: unsigned */ -#if H5_SIZEOF_INT < H5_SIZEOF_UNSIGNED - #define ASSIGN_int_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT > H5_SIZEOF_UNSIGNED - #define ASSIGN_int_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT == H5_SIZEOF_UNSIGNED */ - #define ASSIGN_int_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int dst: unsigned */ - -/* src: int, dst: int64_t */ -#if H5_SIZEOF_INT < H5_SIZEOF_INT64_T - #define ASSIGN_int_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT > H5_SIZEOF_INT64_T - #define ASSIGN_int_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT == H5_SIZEOF_INT64_T */ - #define ASSIGN_int_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: int dst: int64_t */ - -/* src: int, dst: uint8_t */ -#if H5_SIZEOF_INT < H5_SIZEOF_UINT8_T - #define ASSIGN_int_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT > H5_SIZEOF_UINT8_T - #define ASSIGN_int_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT == H5_SIZEOF_UINT8_T */ - #define ASSIGN_int_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int dst: uint8_t */ - -/* src: int, dst: uint16_t */ -#if H5_SIZEOF_INT < H5_SIZEOF_UINT16_T - #define ASSIGN_int_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT > H5_SIZEOF_UINT16_T - #define ASSIGN_int_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT == H5_SIZEOF_UINT16_T */ - #define ASSIGN_int_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int dst: uint16_t */ - -/* src: int, dst: uint32_t */ -#if H5_SIZEOF_INT < H5_SIZEOF_UINT32_T - #define ASSIGN_int_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT > H5_SIZEOF_UINT32_T - #define ASSIGN_int_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT == H5_SIZEOF_UINT32_T */ - #define ASSIGN_int_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int dst: uint32_t */ - -/* src: int, dst: uint64_t */ -#if H5_SIZEOF_INT < H5_SIZEOF_UINT64_T - #define ASSIGN_int_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT > H5_SIZEOF_UINT64_T - #define ASSIGN_int_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT == H5_SIZEOF_UINT64_T */ - #define ASSIGN_int_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int dst: uint64_t */ - -/* src: int, dst: ptrdiff_t */ -#if H5_SIZEOF_INT < H5_SIZEOF_PTRDIFF_T - #define ASSIGN_int_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT > H5_SIZEOF_PTRDIFF_T - #define ASSIGN_int_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT == H5_SIZEOF_PTRDIFF_T */ - #define ASSIGN_int_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: int dst: ptrdiff_t */ - -/* src: int, dst: size_t */ -#if H5_SIZEOF_INT < H5_SIZEOF_SIZE_T - #define ASSIGN_int_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT > H5_SIZEOF_SIZE_T - #define ASSIGN_int_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT == H5_SIZEOF_SIZE_T */ - #define ASSIGN_int_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int dst: size_t */ - -/* src: int, dst: ssize_t */ -#if H5_SIZEOF_INT < H5_SIZEOF_SSIZE_T - #define ASSIGN_int_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT > H5_SIZEOF_SSIZE_T - #define ASSIGN_int_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT == H5_SIZEOF_SSIZE_T */ - #define ASSIGN_int_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: int dst: ssize_t */ - -/* src: int, dst: haddr_t */ -#if H5_SIZEOF_INT < H5_SIZEOF_HADDR_T - #define ASSIGN_int_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT > H5_SIZEOF_HADDR_T - #define ASSIGN_int_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT == H5_SIZEOF_HADDR_T */ - #define ASSIGN_int_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int dst: haddr_t */ - -/* src: int, dst: hsize_t */ -#if H5_SIZEOF_INT < H5_SIZEOF_HSIZE_T - #define ASSIGN_int_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT > H5_SIZEOF_HSIZE_T - #define ASSIGN_int_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT == H5_SIZEOF_HSIZE_T */ - #define ASSIGN_int_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int dst: hsize_t */ - -/* src: int, dst: hssize_t */ -#if H5_SIZEOF_INT < H5_SIZEOF_HSSIZE_T - #define ASSIGN_int_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT > H5_SIZEOF_HSSIZE_T - #define ASSIGN_int_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT == H5_SIZEOF_HSSIZE_T */ - #define ASSIGN_int_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: int dst: hssize_t */ - -/* src: int, dst: h5_stat_size_t */ -#if H5_SIZEOF_INT < H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_int_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT > H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_int_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT == H5_SIZEOF_H5_STAT_SIZE_T */ - #define ASSIGN_int_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int dst: h5_stat_size_t */ - - -/* Assignment checks for int64_t */ - -/* src: int64_t, dst: unsigned */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_UNSIGNED - #define ASSIGN_int64_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_UNSIGNED - #define ASSIGN_int64_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_UNSIGNED */ - #define ASSIGN_int64_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: unsigned */ - -/* src: int64_t, dst: int */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_INT - #define ASSIGN_int64_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_INT - #define ASSIGN_int64_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_INT */ - #define ASSIGN_int64_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: int */ - -/* src: int64_t, dst: uint8_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_UINT8_T - #define ASSIGN_int64_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_UINT8_T - #define ASSIGN_int64_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_UINT8_T */ - #define ASSIGN_int64_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: uint8_t */ - -/* src: int64_t, dst: uint16_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_UINT16_T - #define ASSIGN_int64_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_UINT16_T - #define ASSIGN_int64_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_UINT16_T */ - #define ASSIGN_int64_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: uint16_t */ - -/* src: int64_t, dst: uint32_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_UINT32_T - #define ASSIGN_int64_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_UINT32_T - #define ASSIGN_int64_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_UINT32_T */ - #define ASSIGN_int64_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: uint32_t */ - -/* src: int64_t, dst: uint64_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_UINT64_T - #define ASSIGN_int64_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_UINT64_T - #define ASSIGN_int64_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_UINT64_T */ - #define ASSIGN_int64_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: uint64_t */ - -/* src: int64_t, dst: ptrdiff_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_PTRDIFF_T - #define ASSIGN_int64_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_PTRDIFF_T - #define ASSIGN_int64_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_PTRDIFF_T */ - #define ASSIGN_int64_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: ptrdiff_t */ - -/* src: int64_t, dst: size_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_SIZE_T - #define ASSIGN_int64_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_SIZE_T - #define ASSIGN_int64_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_SIZE_T */ - #define ASSIGN_int64_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: size_t */ - -/* src: int64_t, dst: ssize_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_SSIZE_T - #define ASSIGN_int64_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_SSIZE_T - #define ASSIGN_int64_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_SSIZE_T */ - #define ASSIGN_int64_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: ssize_t */ - -/* src: int64_t, dst: haddr_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_HADDR_T - #define ASSIGN_int64_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_HADDR_T - #define ASSIGN_int64_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_HADDR_T */ - #define ASSIGN_int64_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: haddr_t */ - -/* src: int64_t, dst: hsize_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_HSIZE_T - #define ASSIGN_int64_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_HSIZE_T - #define ASSIGN_int64_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_HSIZE_T */ - #define ASSIGN_int64_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: hsize_t */ - -/* src: int64_t, dst: hssize_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_HSSIZE_T - #define ASSIGN_int64_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_HSSIZE_T - #define ASSIGN_int64_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_HSSIZE_T */ - #define ASSIGN_int64_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: hssize_t */ - -/* src: int64_t, dst: h5_stat_size_t */ -#if H5_SIZEOF_INT64_T < H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_int64_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_INT64_T > H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_int64_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_INT64_T == H5_SIZEOF_H5_STAT_SIZE_T */ - #define ASSIGN_int64_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: int64_t dst: h5_stat_size_t */ - - -/* Assignment checks for uint8_t */ - -/* src: uint8_t, dst: unsigned */ -#if H5_SIZEOF_UINT8_T < H5_SIZEOF_UNSIGNED - #define ASSIGN_uint8_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_UNSIGNED - #define ASSIGN_uint8_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_UNSIGNED */ - #define ASSIGN_uint8_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint8_t dst: unsigned */ - -/* src: uint8_t, dst: int */ -#if H5_SIZEOF_UINT8_T < H5_SIZEOF_INT - #define ASSIGN_uint8_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_INT - #define ASSIGN_uint8_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_INT */ - #define ASSIGN_uint8_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint8_t dst: int */ - -/* src: uint8_t, dst: int64_t */ -#if H5_SIZEOF_UINT8_T < H5_SIZEOF_INT64_T - #define ASSIGN_uint8_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_INT64_T - #define ASSIGN_uint8_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_uint8_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint8_t dst: int64_t */ - -/* src: uint8_t, dst: uint16_t */ -#if H5_SIZEOF_UINT8_T < H5_SIZEOF_UINT16_T - #define ASSIGN_uint8_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_UINT16_T - #define ASSIGN_uint8_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_UINT16_T */ - #define ASSIGN_uint8_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint8_t dst: uint16_t */ - -/* src: uint8_t, dst: uint32_t */ -#if H5_SIZEOF_UINT8_T < H5_SIZEOF_UINT32_T - #define ASSIGN_uint8_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_UINT32_T - #define ASSIGN_uint8_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_UINT32_T */ - #define ASSIGN_uint8_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint8_t dst: uint32_t */ - -/* src: uint8_t, dst: uint64_t */ -#if H5_SIZEOF_UINT8_T < H5_SIZEOF_UINT64_T - #define ASSIGN_uint8_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_UINT64_T - #define ASSIGN_uint8_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_UINT64_T */ - #define ASSIGN_uint8_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint8_t dst: uint64_t */ - -/* src: uint8_t, dst: ptrdiff_t */ -#if H5_SIZEOF_UINT8_T < H5_SIZEOF_PTRDIFF_T - #define ASSIGN_uint8_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_PTRDIFF_T - #define ASSIGN_uint8_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_PTRDIFF_T */ - #define ASSIGN_uint8_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint8_t dst: ptrdiff_t */ - -/* src: uint8_t, dst: size_t */ -#if H5_SIZEOF_UINT8_T < H5_SIZEOF_SIZE_T - #define ASSIGN_uint8_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_SIZE_T - #define ASSIGN_uint8_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_SIZE_T */ - #define ASSIGN_uint8_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint8_t dst: size_t */ - -/* src: uint8_t, dst: ssize_t */ -#if H5_SIZEOF_UINT8_T < H5_SIZEOF_SSIZE_T - #define ASSIGN_uint8_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_SSIZE_T - #define ASSIGN_uint8_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_SSIZE_T */ - #define ASSIGN_uint8_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint8_t dst: ssize_t */ - -/* src: uint8_t, dst: haddr_t */ -#if H5_SIZEOF_UINT8_T < H5_SIZEOF_HADDR_T - #define ASSIGN_uint8_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_HADDR_T - #define ASSIGN_uint8_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_HADDR_T */ - #define ASSIGN_uint8_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint8_t dst: haddr_t */ - -/* src: uint8_t, dst: hsize_t */ -#if H5_SIZEOF_UINT8_T < H5_SIZEOF_HSIZE_T - #define ASSIGN_uint8_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_HSIZE_T - #define ASSIGN_uint8_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_HSIZE_T */ - #define ASSIGN_uint8_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint8_t dst: hsize_t */ - -/* src: uint8_t, dst: hssize_t */ -#if H5_SIZEOF_UINT8_T < H5_SIZEOF_HSSIZE_T - #define ASSIGN_uint8_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_HSSIZE_T - #define ASSIGN_uint8_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_HSSIZE_T */ - #define ASSIGN_uint8_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint8_t dst: hssize_t */ - -/* src: uint8_t, dst: h5_stat_size_t */ -#if H5_SIZEOF_UINT8_T < H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_uint8_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT8_T > H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_uint8_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT8_T == H5_SIZEOF_H5_STAT_SIZE_T */ - #define ASSIGN_uint8_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint8_t dst: h5_stat_size_t */ - - -/* Assignment checks for uint16_t */ - -/* src: uint16_t, dst: unsigned */ -#if H5_SIZEOF_UINT16_T < H5_SIZEOF_UNSIGNED - #define ASSIGN_uint16_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT16_T > H5_SIZEOF_UNSIGNED - #define ASSIGN_uint16_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_UNSIGNED */ - #define ASSIGN_uint16_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint16_t dst: unsigned */ - -/* src: uint16_t, dst: int */ -#if H5_SIZEOF_UINT16_T < H5_SIZEOF_INT - #define ASSIGN_uint16_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT16_T > H5_SIZEOF_INT - #define ASSIGN_uint16_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_INT */ - #define ASSIGN_uint16_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint16_t dst: int */ - -/* src: uint16_t, dst: int64_t */ -#if H5_SIZEOF_UINT16_T < H5_SIZEOF_INT64_T - #define ASSIGN_uint16_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT16_T > H5_SIZEOF_INT64_T - #define ASSIGN_uint16_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_uint16_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint16_t dst: int64_t */ - -/* src: uint16_t, dst: uint8_t */ -#if H5_SIZEOF_UINT16_T < H5_SIZEOF_UINT8_T - #define ASSIGN_uint16_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT16_T > H5_SIZEOF_UINT8_T - #define ASSIGN_uint16_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_UINT8_T */ - #define ASSIGN_uint16_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint16_t dst: uint8_t */ - -/* src: uint16_t, dst: uint32_t */ -#if H5_SIZEOF_UINT16_T < H5_SIZEOF_UINT32_T - #define ASSIGN_uint16_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT16_T > H5_SIZEOF_UINT32_T - #define ASSIGN_uint16_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_UINT32_T */ - #define ASSIGN_uint16_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint16_t dst: uint32_t */ - -/* src: uint16_t, dst: uint64_t */ -#if H5_SIZEOF_UINT16_T < H5_SIZEOF_UINT64_T - #define ASSIGN_uint16_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT16_T > H5_SIZEOF_UINT64_T - #define ASSIGN_uint16_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_UINT64_T */ - #define ASSIGN_uint16_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint16_t dst: uint64_t */ - -/* src: uint16_t, dst: ptrdiff_t */ -#if H5_SIZEOF_UINT16_T < H5_SIZEOF_PTRDIFF_T - #define ASSIGN_uint16_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT16_T > H5_SIZEOF_PTRDIFF_T - #define ASSIGN_uint16_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_PTRDIFF_T */ - #define ASSIGN_uint16_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint16_t dst: ptrdiff_t */ - -/* src: uint16_t, dst: size_t */ -#if H5_SIZEOF_UINT16_T < H5_SIZEOF_SIZE_T - #define ASSIGN_uint16_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT16_T > H5_SIZEOF_SIZE_T - #define ASSIGN_uint16_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_SIZE_T */ - #define ASSIGN_uint16_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint16_t dst: size_t */ - -/* src: uint16_t, dst: ssize_t */ -#if H5_SIZEOF_UINT16_T < H5_SIZEOF_SSIZE_T - #define ASSIGN_uint16_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT16_T > H5_SIZEOF_SSIZE_T - #define ASSIGN_uint16_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_SSIZE_T */ - #define ASSIGN_uint16_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint16_t dst: ssize_t */ - -/* src: uint16_t, dst: haddr_t */ -#if H5_SIZEOF_UINT16_T < H5_SIZEOF_HADDR_T - #define ASSIGN_uint16_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT16_T > H5_SIZEOF_HADDR_T - #define ASSIGN_uint16_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_HADDR_T */ - #define ASSIGN_uint16_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint16_t dst: haddr_t */ - -/* src: uint16_t, dst: hsize_t */ -#if H5_SIZEOF_UINT16_T < H5_SIZEOF_HSIZE_T - #define ASSIGN_uint16_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT16_T > H5_SIZEOF_HSIZE_T - #define ASSIGN_uint16_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_HSIZE_T */ - #define ASSIGN_uint16_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint16_t dst: hsize_t */ - -/* src: uint16_t, dst: hssize_t */ -#if H5_SIZEOF_UINT16_T < H5_SIZEOF_HSSIZE_T - #define ASSIGN_uint16_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT16_T > H5_SIZEOF_HSSIZE_T - #define ASSIGN_uint16_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_HSSIZE_T */ - #define ASSIGN_uint16_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint16_t dst: hssize_t */ - -/* src: uint16_t, dst: h5_stat_size_t */ -#if H5_SIZEOF_UINT16_T < H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_uint16_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT16_T > H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_uint16_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT16_T == H5_SIZEOF_H5_STAT_SIZE_T */ - #define ASSIGN_uint16_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint16_t dst: h5_stat_size_t */ - - -/* Assignment checks for uint32_t */ - -/* src: uint32_t, dst: unsigned */ -#if H5_SIZEOF_UINT32_T < H5_SIZEOF_UNSIGNED - #define ASSIGN_uint32_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_UNSIGNED - #define ASSIGN_uint32_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_UNSIGNED */ - #define ASSIGN_uint32_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint32_t dst: unsigned */ - -/* src: uint32_t, dst: int */ -#if H5_SIZEOF_UINT32_T < H5_SIZEOF_INT - #define ASSIGN_uint32_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_INT - #define ASSIGN_uint32_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_INT */ - #define ASSIGN_uint32_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint32_t dst: int */ - -/* src: uint32_t, dst: int64_t */ -#if H5_SIZEOF_UINT32_T < H5_SIZEOF_INT64_T - #define ASSIGN_uint32_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_INT64_T - #define ASSIGN_uint32_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_uint32_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint32_t dst: int64_t */ - -/* src: uint32_t, dst: uint8_t */ -#if H5_SIZEOF_UINT32_T < H5_SIZEOF_UINT8_T - #define ASSIGN_uint32_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_UINT8_T - #define ASSIGN_uint32_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_UINT8_T */ - #define ASSIGN_uint32_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint32_t dst: uint8_t */ - -/* src: uint32_t, dst: uint16_t */ -#if H5_SIZEOF_UINT32_T < H5_SIZEOF_UINT16_T - #define ASSIGN_uint32_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_UINT16_T - #define ASSIGN_uint32_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_UINT16_T */ - #define ASSIGN_uint32_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint32_t dst: uint16_t */ - -/* src: uint32_t, dst: uint64_t */ -#if H5_SIZEOF_UINT32_T < H5_SIZEOF_UINT64_T - #define ASSIGN_uint32_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_UINT64_T - #define ASSIGN_uint32_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_UINT64_T */ - #define ASSIGN_uint32_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint32_t dst: uint64_t */ - -/* src: uint32_t, dst: ptrdiff_t */ -#if H5_SIZEOF_UINT32_T < H5_SIZEOF_PTRDIFF_T - #define ASSIGN_uint32_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_PTRDIFF_T - #define ASSIGN_uint32_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_PTRDIFF_T */ - #define ASSIGN_uint32_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint32_t dst: ptrdiff_t */ - -/* src: uint32_t, dst: size_t */ -#if H5_SIZEOF_UINT32_T < H5_SIZEOF_SIZE_T - #define ASSIGN_uint32_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_SIZE_T - #define ASSIGN_uint32_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_SIZE_T */ - #define ASSIGN_uint32_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint32_t dst: size_t */ - -/* src: uint32_t, dst: ssize_t */ -#if H5_SIZEOF_UINT32_T < H5_SIZEOF_SSIZE_T - #define ASSIGN_uint32_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_SSIZE_T - #define ASSIGN_uint32_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_SSIZE_T */ - #define ASSIGN_uint32_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint32_t dst: ssize_t */ - -/* src: uint32_t, dst: haddr_t */ -#if H5_SIZEOF_UINT32_T < H5_SIZEOF_HADDR_T - #define ASSIGN_uint32_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_HADDR_T - #define ASSIGN_uint32_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_HADDR_T */ - #define ASSIGN_uint32_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint32_t dst: haddr_t */ - -/* src: uint32_t, dst: hsize_t */ -#if H5_SIZEOF_UINT32_T < H5_SIZEOF_HSIZE_T - #define ASSIGN_uint32_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_HSIZE_T - #define ASSIGN_uint32_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_HSIZE_T */ - #define ASSIGN_uint32_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint32_t dst: hsize_t */ - -/* src: uint32_t, dst: hssize_t */ -#if H5_SIZEOF_UINT32_T < H5_SIZEOF_HSSIZE_T - #define ASSIGN_uint32_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_HSSIZE_T - #define ASSIGN_uint32_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_HSSIZE_T */ - #define ASSIGN_uint32_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint32_t dst: hssize_t */ - -/* src: uint32_t, dst: h5_stat_size_t */ -#if H5_SIZEOF_UINT32_T < H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_uint32_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT32_T > H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_uint32_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT32_T == H5_SIZEOF_H5_STAT_SIZE_T */ - #define ASSIGN_uint32_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint32_t dst: h5_stat_size_t */ - - -/* Assignment checks for uint64_t */ - -/* src: uint64_t, dst: unsigned */ -#if H5_SIZEOF_UINT64_T < H5_SIZEOF_UNSIGNED - #define ASSIGN_uint64_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_UNSIGNED - #define ASSIGN_uint64_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_UNSIGNED */ - #define ASSIGN_uint64_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint64_t dst: unsigned */ - -/* src: uint64_t, dst: int */ -#if H5_SIZEOF_UINT64_T < H5_SIZEOF_INT - #define ASSIGN_uint64_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_INT - #define ASSIGN_uint64_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_INT */ - #define ASSIGN_uint64_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint64_t dst: int */ - -/* src: uint64_t, dst: int64_t */ -#if H5_SIZEOF_UINT64_T < H5_SIZEOF_INT64_T - #define ASSIGN_uint64_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_INT64_T - #define ASSIGN_uint64_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_uint64_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint64_t dst: int64_t */ - -/* src: uint64_t, dst: uint8_t */ -#if H5_SIZEOF_UINT64_T < H5_SIZEOF_UINT8_T - #define ASSIGN_uint64_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_UINT8_T - #define ASSIGN_uint64_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_UINT8_T */ - #define ASSIGN_uint64_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint64_t dst: uint8_t */ - -/* src: uint64_t, dst: uint16_t */ -#if H5_SIZEOF_UINT64_T < H5_SIZEOF_UINT16_T - #define ASSIGN_uint64_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_UINT16_T - #define ASSIGN_uint64_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_UINT16_T */ - #define ASSIGN_uint64_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint64_t dst: uint16_t */ - -/* src: uint64_t, dst: uint32_t */ -#if H5_SIZEOF_UINT64_T < H5_SIZEOF_UINT32_T - #define ASSIGN_uint64_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_UINT32_T - #define ASSIGN_uint64_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_UINT32_T */ - #define ASSIGN_uint64_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint64_t dst: uint32_t */ - -/* src: uint64_t, dst: ptrdiff_t */ -#if H5_SIZEOF_UINT64_T < H5_SIZEOF_PTRDIFF_T - #define ASSIGN_uint64_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_PTRDIFF_T - #define ASSIGN_uint64_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_PTRDIFF_T */ - #define ASSIGN_uint64_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint64_t dst: ptrdiff_t */ - -/* src: uint64_t, dst: size_t */ -#if H5_SIZEOF_UINT64_T < H5_SIZEOF_SIZE_T - #define ASSIGN_uint64_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_SIZE_T - #define ASSIGN_uint64_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_SIZE_T */ - #define ASSIGN_uint64_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint64_t dst: size_t */ - -/* src: uint64_t, dst: ssize_t */ -#if H5_SIZEOF_UINT64_T < H5_SIZEOF_SSIZE_T - #define ASSIGN_uint64_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_SSIZE_T - #define ASSIGN_uint64_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_SSIZE_T */ - #define ASSIGN_uint64_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint64_t dst: ssize_t */ - -/* src: uint64_t, dst: haddr_t */ -#if H5_SIZEOF_UINT64_T < H5_SIZEOF_HADDR_T - #define ASSIGN_uint64_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_HADDR_T - #define ASSIGN_uint64_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_HADDR_T */ - #define ASSIGN_uint64_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint64_t dst: haddr_t */ - -/* src: uint64_t, dst: hsize_t */ -#if H5_SIZEOF_UINT64_T < H5_SIZEOF_HSIZE_T - #define ASSIGN_uint64_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_HSIZE_T - #define ASSIGN_uint64_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_HSIZE_T */ - #define ASSIGN_uint64_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint64_t dst: hsize_t */ - -/* src: uint64_t, dst: hssize_t */ -#if H5_SIZEOF_UINT64_T < H5_SIZEOF_HSSIZE_T - #define ASSIGN_uint64_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_HSSIZE_T - #define ASSIGN_uint64_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_HSSIZE_T */ - #define ASSIGN_uint64_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint64_t dst: hssize_t */ - -/* src: uint64_t, dst: h5_stat_size_t */ -#if H5_SIZEOF_UINT64_T < H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_uint64_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_UINT64_T > H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_uint64_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_UINT64_T == H5_SIZEOF_H5_STAT_SIZE_T */ - #define ASSIGN_uint64_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: uint64_t dst: h5_stat_size_t */ - - -/* Assignment checks for ptrdiff_t */ - -/* src: ptrdiff_t, dst: unsigned */ -#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_UNSIGNED - #define ASSIGN_ptrdiff_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_UNSIGNED - #define ASSIGN_ptrdiff_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_UNSIGNED */ - #define ASSIGN_ptrdiff_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: ptrdiff_t dst: unsigned */ - -/* src: ptrdiff_t, dst: int */ -#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_INT - #define ASSIGN_ptrdiff_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_INT - #define ASSIGN_ptrdiff_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_INT */ - #define ASSIGN_ptrdiff_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: ptrdiff_t dst: int */ - -/* src: ptrdiff_t, dst: int64_t */ -#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_INT64_T - #define ASSIGN_ptrdiff_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_INT64_T - #define ASSIGN_ptrdiff_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_ptrdiff_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: ptrdiff_t dst: int64_t */ - -/* src: ptrdiff_t, dst: uint8_t */ -#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_UINT8_T - #define ASSIGN_ptrdiff_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_UINT8_T - #define ASSIGN_ptrdiff_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_UINT8_T */ - #define ASSIGN_ptrdiff_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: ptrdiff_t dst: uint8_t */ - -/* src: ptrdiff_t, dst: uint16_t */ -#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_UINT16_T - #define ASSIGN_ptrdiff_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_UINT16_T - #define ASSIGN_ptrdiff_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_UINT16_T */ - #define ASSIGN_ptrdiff_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: ptrdiff_t dst: uint16_t */ - -/* src: ptrdiff_t, dst: uint32_t */ -#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_UINT32_T - #define ASSIGN_ptrdiff_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_UINT32_T - #define ASSIGN_ptrdiff_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_UINT32_T */ - #define ASSIGN_ptrdiff_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: ptrdiff_t dst: uint32_t */ - -/* src: ptrdiff_t, dst: uint64_t */ -#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_UINT64_T - #define ASSIGN_ptrdiff_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_UINT64_T - #define ASSIGN_ptrdiff_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_UINT64_T */ - #define ASSIGN_ptrdiff_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: ptrdiff_t dst: uint64_t */ - -/* src: ptrdiff_t, dst: size_t */ -#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_SIZE_T - #define ASSIGN_ptrdiff_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_SIZE_T - #define ASSIGN_ptrdiff_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_SIZE_T */ - #define ASSIGN_ptrdiff_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: ptrdiff_t dst: size_t */ - -/* src: ptrdiff_t, dst: ssize_t */ -#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_SSIZE_T - #define ASSIGN_ptrdiff_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_SSIZE_T - #define ASSIGN_ptrdiff_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_SSIZE_T */ - #define ASSIGN_ptrdiff_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: ptrdiff_t dst: ssize_t */ - -/* src: ptrdiff_t, dst: haddr_t */ -#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_HADDR_T - #define ASSIGN_ptrdiff_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_HADDR_T - #define ASSIGN_ptrdiff_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_HADDR_T */ - #define ASSIGN_ptrdiff_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: ptrdiff_t dst: haddr_t */ - -/* src: ptrdiff_t, dst: hsize_t */ -#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_HSIZE_T - #define ASSIGN_ptrdiff_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_HSIZE_T - #define ASSIGN_ptrdiff_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_HSIZE_T */ - #define ASSIGN_ptrdiff_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: ptrdiff_t dst: hsize_t */ - -/* src: ptrdiff_t, dst: hssize_t */ -#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_HSSIZE_T - #define ASSIGN_ptrdiff_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_HSSIZE_T - #define ASSIGN_ptrdiff_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_HSSIZE_T */ - #define ASSIGN_ptrdiff_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: ptrdiff_t dst: hssize_t */ - -/* src: ptrdiff_t, dst: h5_stat_size_t */ -#if H5_SIZEOF_PTRDIFF_T < H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_ptrdiff_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_PTRDIFF_T > H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_ptrdiff_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_PTRDIFF_T == H5_SIZEOF_H5_STAT_SIZE_T */ - #define ASSIGN_ptrdiff_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: ptrdiff_t dst: h5_stat_size_t */ - - -/* Assignment checks for size_t */ - -/* src: size_t, dst: unsigned */ -#if H5_SIZEOF_SIZE_T < H5_SIZEOF_UNSIGNED - #define ASSIGN_size_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_UNSIGNED - #define ASSIGN_size_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_UNSIGNED */ - #define ASSIGN_size_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: size_t dst: unsigned */ - -/* src: size_t, dst: int */ -#if H5_SIZEOF_SIZE_T < H5_SIZEOF_INT - #define ASSIGN_size_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_INT - #define ASSIGN_size_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_INT */ - #define ASSIGN_size_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: size_t dst: int */ - -/* src: size_t, dst: int64_t */ -#if H5_SIZEOF_SIZE_T < H5_SIZEOF_INT64_T - #define ASSIGN_size_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_INT64_T - #define ASSIGN_size_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_size_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: size_t dst: int64_t */ - -/* src: size_t, dst: uint8_t */ -#if H5_SIZEOF_SIZE_T < H5_SIZEOF_UINT8_T - #define ASSIGN_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_UINT8_T - #define ASSIGN_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_UINT8_T */ - #define ASSIGN_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: size_t dst: uint8_t */ - -/* src: size_t, dst: uint16_t */ -#if H5_SIZEOF_SIZE_T < H5_SIZEOF_UINT16_T - #define ASSIGN_size_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_UINT16_T - #define ASSIGN_size_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_UINT16_T */ - #define ASSIGN_size_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: size_t dst: uint16_t */ - -/* src: size_t, dst: uint32_t */ -#if H5_SIZEOF_SIZE_T < H5_SIZEOF_UINT32_T - #define ASSIGN_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_UINT32_T - #define ASSIGN_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_UINT32_T */ - #define ASSIGN_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: size_t dst: uint32_t */ - -/* src: size_t, dst: uint64_t */ -#if H5_SIZEOF_SIZE_T < H5_SIZEOF_UINT64_T - #define ASSIGN_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_UINT64_T - #define ASSIGN_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_UINT64_T */ - #define ASSIGN_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: size_t dst: uint64_t */ - -/* src: size_t, dst: ptrdiff_t */ -#if H5_SIZEOF_SIZE_T < H5_SIZEOF_PTRDIFF_T - #define ASSIGN_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_PTRDIFF_T - #define ASSIGN_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_PTRDIFF_T */ - #define ASSIGN_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: size_t dst: ptrdiff_t */ - -/* src: size_t, dst: ssize_t */ -#if H5_SIZEOF_SIZE_T < H5_SIZEOF_SSIZE_T - #define ASSIGN_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_SSIZE_T - #define ASSIGN_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_SSIZE_T */ - #define ASSIGN_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: size_t dst: ssize_t */ - -/* src: size_t, dst: haddr_t */ -#if H5_SIZEOF_SIZE_T < H5_SIZEOF_HADDR_T - #define ASSIGN_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_HADDR_T - #define ASSIGN_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_HADDR_T */ - #define ASSIGN_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: size_t dst: haddr_t */ - -/* src: size_t, dst: hsize_t */ -#if H5_SIZEOF_SIZE_T < H5_SIZEOF_HSIZE_T - #define ASSIGN_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_HSIZE_T - #define ASSIGN_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_HSIZE_T */ - #define ASSIGN_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: size_t dst: hsize_t */ - -/* src: size_t, dst: hssize_t */ -#if H5_SIZEOF_SIZE_T < H5_SIZEOF_HSSIZE_T - #define ASSIGN_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_HSSIZE_T - #define ASSIGN_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_HSSIZE_T */ - #define ASSIGN_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: size_t dst: hssize_t */ - -/* src: size_t, dst: h5_stat_size_t */ -#if H5_SIZEOF_SIZE_T < H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_size_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SIZE_T > H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_size_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SIZE_T == H5_SIZEOF_H5_STAT_SIZE_T */ - #define ASSIGN_size_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: size_t dst: h5_stat_size_t */ - - -/* Assignment checks for ssize_t */ - -/* src: ssize_t, dst: unsigned */ -#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_UNSIGNED - #define ASSIGN_ssize_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_UNSIGNED - #define ASSIGN_ssize_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_UNSIGNED */ - #define ASSIGN_ssize_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: ssize_t dst: unsigned */ - -/* src: ssize_t, dst: int */ -#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_INT - #define ASSIGN_ssize_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_INT - #define ASSIGN_ssize_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_INT */ - #define ASSIGN_ssize_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: ssize_t dst: int */ - -/* src: ssize_t, dst: int64_t */ -#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_INT64_T - #define ASSIGN_ssize_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_INT64_T - #define ASSIGN_ssize_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_ssize_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: ssize_t dst: int64_t */ - -/* src: ssize_t, dst: uint8_t */ -#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_UINT8_T - #define ASSIGN_ssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_UINT8_T - #define ASSIGN_ssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_UINT8_T */ - #define ASSIGN_ssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: ssize_t dst: uint8_t */ - -/* src: ssize_t, dst: uint16_t */ -#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_UINT16_T - #define ASSIGN_ssize_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_UINT16_T - #define ASSIGN_ssize_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_UINT16_T */ - #define ASSIGN_ssize_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: ssize_t dst: uint16_t */ - -/* src: ssize_t, dst: uint32_t */ -#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_UINT32_T - #define ASSIGN_ssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_UINT32_T - #define ASSIGN_ssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_UINT32_T */ - #define ASSIGN_ssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: ssize_t dst: uint32_t */ - -/* src: ssize_t, dst: uint64_t */ -#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_UINT64_T - #define ASSIGN_ssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_UINT64_T - #define ASSIGN_ssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_UINT64_T */ - #define ASSIGN_ssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: ssize_t dst: uint64_t */ - -/* src: ssize_t, dst: ptrdiff_t */ -#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_PTRDIFF_T - #define ASSIGN_ssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_PTRDIFF_T - #define ASSIGN_ssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_PTRDIFF_T */ - #define ASSIGN_ssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: ssize_t dst: ptrdiff_t */ - -/* src: ssize_t, dst: size_t */ -#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_SIZE_T - #define ASSIGN_ssize_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_SIZE_T - #define ASSIGN_ssize_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_SIZE_T */ - #define ASSIGN_ssize_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: ssize_t dst: size_t */ - -/* src: ssize_t, dst: haddr_t */ -#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_HADDR_T - #define ASSIGN_ssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_HADDR_T - #define ASSIGN_ssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_HADDR_T */ - #define ASSIGN_ssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: ssize_t dst: haddr_t */ - -/* src: ssize_t, dst: hsize_t */ -#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_HSIZE_T - #define ASSIGN_ssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_HSIZE_T - #define ASSIGN_ssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_HSIZE_T */ - #define ASSIGN_ssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: ssize_t dst: hsize_t */ - -/* src: ssize_t, dst: hssize_t */ -#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_HSSIZE_T - #define ASSIGN_ssize_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_HSSIZE_T - #define ASSIGN_ssize_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_HSSIZE_T */ - #define ASSIGN_ssize_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: ssize_t dst: hssize_t */ - -/* src: ssize_t, dst: h5_stat_size_t */ -#if H5_SIZEOF_SSIZE_T < H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_ssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_SSIZE_T > H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_ssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_SSIZE_T == H5_SIZEOF_H5_STAT_SIZE_T */ - #define ASSIGN_ssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: ssize_t dst: h5_stat_size_t */ - - -/* Assignment checks for haddr_t */ - -/* src: haddr_t, dst: unsigned */ -#if H5_SIZEOF_HADDR_T < H5_SIZEOF_UNSIGNED - #define ASSIGN_haddr_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_UNSIGNED - #define ASSIGN_haddr_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_UNSIGNED */ - #define ASSIGN_haddr_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: haddr_t dst: unsigned */ - -/* src: haddr_t, dst: int */ -#if H5_SIZEOF_HADDR_T < H5_SIZEOF_INT - #define ASSIGN_haddr_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_INT - #define ASSIGN_haddr_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_INT */ - #define ASSIGN_haddr_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: haddr_t dst: int */ - -/* src: haddr_t, dst: int64_t */ -#if H5_SIZEOF_HADDR_T < H5_SIZEOF_INT64_T - #define ASSIGN_haddr_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_INT64_T - #define ASSIGN_haddr_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_haddr_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: haddr_t dst: int64_t */ - -/* src: haddr_t, dst: uint8_t */ -#if H5_SIZEOF_HADDR_T < H5_SIZEOF_UINT8_T - #define ASSIGN_haddr_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_UINT8_T - #define ASSIGN_haddr_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_UINT8_T */ - #define ASSIGN_haddr_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: haddr_t dst: uint8_t */ - -/* src: haddr_t, dst: uint16_t */ -#if H5_SIZEOF_HADDR_T < H5_SIZEOF_UINT16_T - #define ASSIGN_haddr_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_UINT16_T - #define ASSIGN_haddr_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_UINT16_T */ - #define ASSIGN_haddr_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: haddr_t dst: uint16_t */ - -/* src: haddr_t, dst: uint32_t */ -#if H5_SIZEOF_HADDR_T < H5_SIZEOF_UINT32_T - #define ASSIGN_haddr_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_UINT32_T - #define ASSIGN_haddr_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_UINT32_T */ - #define ASSIGN_haddr_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: haddr_t dst: uint32_t */ - -/* src: haddr_t, dst: uint64_t */ -#if H5_SIZEOF_HADDR_T < H5_SIZEOF_UINT64_T - #define ASSIGN_haddr_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_UINT64_T - #define ASSIGN_haddr_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_UINT64_T */ - #define ASSIGN_haddr_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: haddr_t dst: uint64_t */ - -/* src: haddr_t, dst: ptrdiff_t */ -#if H5_SIZEOF_HADDR_T < H5_SIZEOF_PTRDIFF_T - #define ASSIGN_haddr_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_PTRDIFF_T - #define ASSIGN_haddr_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_PTRDIFF_T */ - #define ASSIGN_haddr_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: haddr_t dst: ptrdiff_t */ - -/* src: haddr_t, dst: size_t */ -#if H5_SIZEOF_HADDR_T < H5_SIZEOF_SIZE_T - #define ASSIGN_haddr_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_SIZE_T - #define ASSIGN_haddr_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_SIZE_T */ - #define ASSIGN_haddr_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: haddr_t dst: size_t */ - -/* src: haddr_t, dst: ssize_t */ -#if H5_SIZEOF_HADDR_T < H5_SIZEOF_SSIZE_T - #define ASSIGN_haddr_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_SSIZE_T - #define ASSIGN_haddr_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_SSIZE_T */ - #define ASSIGN_haddr_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: haddr_t dst: ssize_t */ - -/* src: haddr_t, dst: hsize_t */ -#if H5_SIZEOF_HADDR_T < H5_SIZEOF_HSIZE_T - #define ASSIGN_haddr_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_HSIZE_T - #define ASSIGN_haddr_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_HSIZE_T */ - #define ASSIGN_haddr_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: haddr_t dst: hsize_t */ - -/* src: haddr_t, dst: hssize_t */ -#if H5_SIZEOF_HADDR_T < H5_SIZEOF_HSSIZE_T - #define ASSIGN_haddr_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_HSSIZE_T - #define ASSIGN_haddr_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_HSSIZE_T */ - #define ASSIGN_haddr_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: haddr_t dst: hssize_t */ - -/* src: haddr_t, dst: h5_stat_size_t */ -#if H5_SIZEOF_HADDR_T < H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_haddr_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HADDR_T > H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_haddr_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HADDR_T == H5_SIZEOF_H5_STAT_SIZE_T */ - #define ASSIGN_haddr_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: haddr_t dst: h5_stat_size_t */ - - -/* Assignment checks for hsize_t */ - -/* src: hsize_t, dst: unsigned */ -#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_UNSIGNED - #define ASSIGN_hsize_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_UNSIGNED - #define ASSIGN_hsize_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_UNSIGNED */ - #define ASSIGN_hsize_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hsize_t dst: unsigned */ - -/* src: hsize_t, dst: int */ -#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_INT - #define ASSIGN_hsize_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_INT - #define ASSIGN_hsize_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_INT */ - #define ASSIGN_hsize_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hsize_t dst: int */ - -/* src: hsize_t, dst: int64_t */ -#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_INT64_T - #define ASSIGN_hsize_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_INT64_T - #define ASSIGN_hsize_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_hsize_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hsize_t dst: int64_t */ - -/* src: hsize_t, dst: uint8_t */ -#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_UINT8_T - #define ASSIGN_hsize_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_UINT8_T - #define ASSIGN_hsize_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_UINT8_T */ - #define ASSIGN_hsize_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hsize_t dst: uint8_t */ - -/* src: hsize_t, dst: uint16_t */ -#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_UINT16_T - #define ASSIGN_hsize_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_UINT16_T - #define ASSIGN_hsize_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_UINT16_T */ - #define ASSIGN_hsize_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hsize_t dst: uint16_t */ - -/* src: hsize_t, dst: uint32_t */ -#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_UINT32_T - #define ASSIGN_hsize_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_UINT32_T - #define ASSIGN_hsize_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_UINT32_T */ - #define ASSIGN_hsize_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hsize_t dst: uint32_t */ - -/* src: hsize_t, dst: uint64_t */ -#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_UINT64_T - #define ASSIGN_hsize_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_UINT64_T - #define ASSIGN_hsize_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_UINT64_T */ - #define ASSIGN_hsize_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hsize_t dst: uint64_t */ - -/* src: hsize_t, dst: ptrdiff_t */ -#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_PTRDIFF_T - #define ASSIGN_hsize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_PTRDIFF_T - #define ASSIGN_hsize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_PTRDIFF_T */ - #define ASSIGN_hsize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hsize_t dst: ptrdiff_t */ - -/* src: hsize_t, dst: size_t */ -#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_SIZE_T - #define ASSIGN_hsize_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_SIZE_T - #define ASSIGN_hsize_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_SIZE_T */ - #define ASSIGN_hsize_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hsize_t dst: size_t */ - -/* src: hsize_t, dst: ssize_t */ -#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_SSIZE_T - #define ASSIGN_hsize_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_SSIZE_T - #define ASSIGN_hsize_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_SSIZE_T */ - #define ASSIGN_hsize_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hsize_t dst: ssize_t */ - -/* src: hsize_t, dst: haddr_t */ -#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_HADDR_T - #define ASSIGN_hsize_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_HADDR_T - #define ASSIGN_hsize_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_HADDR_T */ - #define ASSIGN_hsize_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hsize_t dst: haddr_t */ - -/* src: hsize_t, dst: hssize_t */ -#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_HSSIZE_T - #define ASSIGN_hsize_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_HSSIZE_T - #define ASSIGN_hsize_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_HSSIZE_T */ - #define ASSIGN_hsize_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hsize_t dst: hssize_t */ - -/* src: hsize_t, dst: h5_stat_size_t */ -#if H5_SIZEOF_HSIZE_T < H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_hsize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSIZE_T > H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_hsize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSIZE_T == H5_SIZEOF_H5_STAT_SIZE_T */ - #define ASSIGN_hsize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hsize_t dst: h5_stat_size_t */ - - -/* Assignment checks for hssize_t */ - -/* src: hssize_t, dst: unsigned */ -#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_UNSIGNED - #define ASSIGN_hssize_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_UNSIGNED - #define ASSIGN_hssize_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_UNSIGNED */ - #define ASSIGN_hssize_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: hssize_t dst: unsigned */ - -/* src: hssize_t, dst: int */ -#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_INT - #define ASSIGN_hssize_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_INT - #define ASSIGN_hssize_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_INT */ - #define ASSIGN_hssize_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hssize_t dst: int */ - -/* src: hssize_t, dst: int64_t */ -#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_INT64_T - #define ASSIGN_hssize_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_INT64_T - #define ASSIGN_hssize_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_hssize_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hssize_t dst: int64_t */ - -/* src: hssize_t, dst: uint8_t */ -#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_UINT8_T - #define ASSIGN_hssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_UINT8_T - #define ASSIGN_hssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_UINT8_T */ - #define ASSIGN_hssize_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: hssize_t dst: uint8_t */ - -/* src: hssize_t, dst: uint16_t */ -#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_UINT16_T - #define ASSIGN_hssize_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_UINT16_T - #define ASSIGN_hssize_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_UINT16_T */ - #define ASSIGN_hssize_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: hssize_t dst: uint16_t */ - -/* src: hssize_t, dst: uint32_t */ -#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_UINT32_T - #define ASSIGN_hssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_UINT32_T - #define ASSIGN_hssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_UINT32_T */ - #define ASSIGN_hssize_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: hssize_t dst: uint32_t */ - -/* src: hssize_t, dst: uint64_t */ -#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_UINT64_T - #define ASSIGN_hssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_UINT64_T - #define ASSIGN_hssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_UINT64_T */ - #define ASSIGN_hssize_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: hssize_t dst: uint64_t */ - -/* src: hssize_t, dst: ptrdiff_t */ -#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_PTRDIFF_T - #define ASSIGN_hssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_PTRDIFF_T - #define ASSIGN_hssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_PTRDIFF_T */ - #define ASSIGN_hssize_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hssize_t dst: ptrdiff_t */ - -/* src: hssize_t, dst: size_t */ -#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_SIZE_T - #define ASSIGN_hssize_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_SIZE_T - #define ASSIGN_hssize_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_SIZE_T */ - #define ASSIGN_hssize_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: hssize_t dst: size_t */ - -/* src: hssize_t, dst: ssize_t */ -#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_SSIZE_T - #define ASSIGN_hssize_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_SSIZE_T - #define ASSIGN_hssize_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_SSIZE_T */ - #define ASSIGN_hssize_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: hssize_t dst: ssize_t */ - -/* src: hssize_t, dst: haddr_t */ -#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_HADDR_T - #define ASSIGN_hssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_HADDR_T - #define ASSIGN_hssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_HADDR_T */ - #define ASSIGN_hssize_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: hssize_t dst: haddr_t */ - -/* src: hssize_t, dst: hsize_t */ -#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_HSIZE_T - #define ASSIGN_hssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_HSIZE_T - #define ASSIGN_hssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_HSIZE_T */ - #define ASSIGN_hssize_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: hssize_t dst: hsize_t */ - -/* src: hssize_t, dst: h5_stat_size_t */ -#if H5_SIZEOF_HSSIZE_T < H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_hssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_HSSIZE_T > H5_SIZEOF_H5_STAT_SIZE_T - #define ASSIGN_hssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_HSSIZE_T == H5_SIZEOF_H5_STAT_SIZE_T */ - #define ASSIGN_hssize_t_TO_h5_stat_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SIGNED_TO_UNSIGNED(dst, dsttype, src, srctype) -#endif /* src: hssize_t dst: h5_stat_size_t */ - - -/* Assignment checks for h5_stat_size_t */ - -/* src: h5_stat_size_t, dst: unsigned */ -#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_UNSIGNED - #define ASSIGN_h5_stat_size_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_UNSIGNED - #define ASSIGN_h5_stat_size_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_UNSIGNED */ - #define ASSIGN_h5_stat_size_t_TO_unsigned(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: h5_stat_size_t dst: unsigned */ - -/* src: h5_stat_size_t, dst: int */ -#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_INT - #define ASSIGN_h5_stat_size_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_INT - #define ASSIGN_h5_stat_size_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_INT */ - #define ASSIGN_h5_stat_size_t_TO_int(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: h5_stat_size_t dst: int */ - -/* src: h5_stat_size_t, dst: int64_t */ -#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_INT64_T - #define ASSIGN_h5_stat_size_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_INT64_T - #define ASSIGN_h5_stat_size_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_INT64_T */ - #define ASSIGN_h5_stat_size_t_TO_int64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: h5_stat_size_t dst: int64_t */ - -/* src: h5_stat_size_t, dst: uint8_t */ -#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_UINT8_T - #define ASSIGN_h5_stat_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_UINT8_T - #define ASSIGN_h5_stat_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_UINT8_T */ - #define ASSIGN_h5_stat_size_t_TO_uint8_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: h5_stat_size_t dst: uint8_t */ - -/* src: h5_stat_size_t, dst: uint16_t */ -#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_UINT16_T - #define ASSIGN_h5_stat_size_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_UINT16_T - #define ASSIGN_h5_stat_size_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_UINT16_T */ - #define ASSIGN_h5_stat_size_t_TO_uint16_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: h5_stat_size_t dst: uint16_t */ - -/* src: h5_stat_size_t, dst: uint32_t */ -#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_UINT32_T - #define ASSIGN_h5_stat_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_UINT32_T - #define ASSIGN_h5_stat_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_UINT32_T */ - #define ASSIGN_h5_stat_size_t_TO_uint32_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: h5_stat_size_t dst: uint32_t */ - -/* src: h5_stat_size_t, dst: uint64_t */ -#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_UINT64_T - #define ASSIGN_h5_stat_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_UINT64_T - #define ASSIGN_h5_stat_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_UINT64_T */ - #define ASSIGN_h5_stat_size_t_TO_uint64_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: h5_stat_size_t dst: uint64_t */ - -/* src: h5_stat_size_t, dst: ptrdiff_t */ -#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_PTRDIFF_T - #define ASSIGN_h5_stat_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_PTRDIFF_T - #define ASSIGN_h5_stat_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_PTRDIFF_T */ - #define ASSIGN_h5_stat_size_t_TO_ptrdiff_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: h5_stat_size_t dst: ptrdiff_t */ - -/* src: h5_stat_size_t, dst: size_t */ -#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_SIZE_T - #define ASSIGN_h5_stat_size_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_SIZE_T - #define ASSIGN_h5_stat_size_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_SIZE_T */ - #define ASSIGN_h5_stat_size_t_TO_size_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: h5_stat_size_t dst: size_t */ - -/* src: h5_stat_size_t, dst: ssize_t */ -#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_SSIZE_T - #define ASSIGN_h5_stat_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_SSIZE_T - #define ASSIGN_h5_stat_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_SSIZE_T */ - #define ASSIGN_h5_stat_size_t_TO_ssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: h5_stat_size_t dst: ssize_t */ - -/* src: h5_stat_size_t, dst: haddr_t */ -#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_HADDR_T - #define ASSIGN_h5_stat_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_HADDR_T - #define ASSIGN_h5_stat_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_HADDR_T */ - #define ASSIGN_h5_stat_size_t_TO_haddr_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: h5_stat_size_t dst: haddr_t */ - -/* src: h5_stat_size_t, dst: hsize_t */ -#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_HSIZE_T - #define ASSIGN_h5_stat_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_HSIZE_T - #define ASSIGN_h5_stat_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_HSIZE_T */ - #define ASSIGN_h5_stat_size_t_TO_hsize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_SAME_SIGNED(dst, dsttype, src, srctype) -#endif /* src: h5_stat_size_t dst: hsize_t */ - -/* src: h5_stat_size_t, dst: hssize_t */ -#if H5_SIZEOF_H5_STAT_SIZE_T < H5_SIZEOF_HSSIZE_T - #define ASSIGN_h5_stat_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_LARGER_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#elif H5_SIZEOF_H5_STAT_SIZE_T > H5_SIZEOF_HSSIZE_T - #define ASSIGN_h5_stat_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SMALLER_SIZE(dst, dsttype, src, srctype) -#else /* H5_SIZEOF_H5_STAT_SIZE_T == H5_SIZEOF_HSSIZE_T */ - #define ASSIGN_h5_stat_size_t_TO_hssize_t(dst, dsttype, src, srctype) \ - ASSIGN_TO_SAME_SIZE_UNSIGNED_TO_SIGNED(dst, dsttype, src, srctype) -#endif /* src: h5_stat_size_t dst: hssize_t */ - -#endif /* H5overflow_H */ - diff --git a/src/H5private.h b/src/H5private.h index 5e968a0..56061bf 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -288,12 +288,23 @@ /* * Does the compiler support the __attribute__(()) syntax? It's no * big deal if we don't. + * + * Note that Solaris Studio supports attribute, but does not support the + * attributes we use. */ #ifdef __cplusplus -# define __attribute__(X) /*void*/ +# define H5_ATTR_FORMAT(X,Y,Z) /*void*/ +# define H5_ATTR_UNUSED /*void*/ +# define H5_ATTR_NORETURN /*void*/ #else /* __cplusplus */ -#ifndef H5_HAVE_ATTRIBUTE -# define __attribute__(X) /*void*/ +#if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C) +# define H5_ATTR_FORMAT(X,Y,Z) __attribute__((format(X, Y, Z))) +# define H5_ATTR_UNUSED __attribute__((unused)) +# define H5_ATTR_NORETURN __attribute__((noreturn)) +#else +# define H5_ATTR_FORMAT(X,Y,Z) /*void*/ +# define H5_ATTR_UNUSED /*void*/ +# define H5_ATTR_NORETURN /*void*/ #endif #endif /* __cplusplus */ @@ -1452,6 +1463,16 @@ extern char *strdup(const char *s); #define HDpthread_self_ulong() ((unsigned long)pthread_self()) #endif /* HDpthread_self_ulong */ +/* Macro for "stringizing" an integer in the C preprocessor (use H5_TOSTRING) */ +/* (use H5_TOSTRING, H5_STRINGIZE is just part of the implementation) */ +#define H5_STRINGIZE(x) #x +#define H5_TOSTRING(x) H5_STRINGIZE(x) + +/* Macro for "glueing" together items, for re-scanning macros */ +#define H5_GLUE(x,y) x##y +#define H5_GLUE3(x,y,z) x##y##z +#define H5_GLUE4(w,x,y,z) w##x##y##z + /* * A macro for detecting over/under-flow when casting between types */ @@ -1771,10 +1792,12 @@ extern char H5_lib_vers_info_g[]; typedef struct H5_api_struct { H5TS_mutex_t init_lock; /* API entrance mutex */ hbool_t H5_libinit_g; /* Has the library been initialized? */ + hbool_t H5_libterm_g; /* Is the library being shutdown? */ } H5_api_t; /* Macros for accessing the global variables */ -#define H5_INIT_GLOBAL H5_g.H5_libinit_g +#define H5_INIT_GLOBAL (H5_g.H5_libinit_g) +#define H5_TERM_GLOBAL (H5_g.H5_libterm_g) /* Macro for first thread initialization */ #ifdef H5_HAVE_WIN_THREADS @@ -1813,9 +1836,11 @@ extern H5_api_t H5_g; /* extern global variables */ extern hbool_t H5_libinit_g; /* Has the library been initialized? */ +extern hbool_t H5_libterm_g; /* Is the library being shutdown? */ /* Macros for accessing the global variables */ -#define H5_INIT_GLOBAL H5_libinit_g +#define H5_INIT_GLOBAL (H5_libinit_g) +#define H5_TERM_GLOBAL (H5_libterm_g) #endif /* H5_HAVE_THREADSAFE */ @@ -1835,101 +1860,110 @@ extern hbool_t H5_libinit_g; /* Has the library been initialized? */ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ #endif -/* Macros for defining interface initialization routines */ -#ifdef H5_INTERFACE_INIT_FUNC -static int H5_interface_initialize_g = 0; -static herr_t H5_INTERFACE_INIT_FUNC(void); -#define H5_INTERFACE_INIT(err) \ - /* Initialize this interface or bust */ \ - if (!H5_interface_initialize_g) { \ - H5_interface_initialize_g = 1; \ - if (H5_INTERFACE_INIT_FUNC()<0) { \ - H5_interface_initialize_g = 0; \ - HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ - "interface initialization failed") \ - } \ - } -#else /* H5_INTERFACE_INIT_FUNC */ -#define H5_INTERFACE_INIT(err) -#endif /* H5_INTERFACE_INIT_FUNC */ +/* Macros for referencing package initialization symbols */ +#define H5_PACKAGE_INIT_VAR(x) H5_GLUE(x, _init_g) +#define H5_PACKAGE_INIT_FUNC(x) H5_GLUE(x, __init_package) + +/* Macros for defining package initialization routines */ +#ifdef H5_MY_PKG +#define H5_PKG_INIT_VAR H5_PACKAGE_INIT_VAR(H5_MY_PKG) +#define H5_PKG_INIT_FUNC H5_PACKAGE_INIT_FUNC(H5_MY_PKG) +#define H5_PACKAGE_YES_INIT(err) \ + /* Initialize this interface or bust */ \ + if(!H5_PKG_INIT_VAR && !H5_TERM_GLOBAL) { \ + H5_PKG_INIT_VAR = TRUE; \ + if(H5_PKG_INIT_FUNC() < 0) { \ + H5_PKG_INIT_VAR = FALSE; \ + HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, "interface initialization failed") \ + } \ + } +#define H5_PACKAGE_NO_INIT(err) \ + /* Initialize this interface or bust */ \ + if(!H5_PKG_INIT_VAR && !H5_TERM_GLOBAL) \ + H5_PKG_INIT_VAR = TRUE; +#define H5_PACKAGE_INIT(pkg_init, err) H5_GLUE3(H5_PACKAGE_, pkg_init, _INIT)(err) +#else /* H5_MY_PKG */ +#define H5_PKG_INIT_VAR (TRUE) +#define H5_PACKAGE_INIT(pkg_init, err) +#endif /* H5_MY_PKG */ #ifndef NDEBUG -#define FUNC_ENTER_CHECK_NAME(asrt) \ - { \ - static hbool_t func_check = FALSE; \ +#define FUNC_ENTER_CHECK_NAME(asrt) \ + { \ + static hbool_t func_check = FALSE; \ \ - if(!func_check) { \ - /* Check function naming status */ \ - HDassert(asrt); \ + if(!func_check) { \ + /* Check function naming status */ \ + HDassert(asrt); \ \ - /* Don't check again */ \ - func_check = TRUE; \ - } /* end if */ \ + /* Don't check again */ \ + func_check = TRUE; \ + } /* end if */ \ } /* end scope */ #else /* NDEBUG */ #define FUNC_ENTER_CHECK_NAME(asrt) #endif /* NDEBUG */ -#define FUNC_ENTER_COMMON(asrt) \ - hbool_t err_occurred = FALSE; \ +#define FUNC_ENTER_COMMON(asrt) \ + hbool_t err_occurred = FALSE; \ + \ FUNC_ENTER_CHECK_NAME(asrt); -#define FUNC_ENTER_COMMON_NOERR(asrt) \ +#define FUNC_ENTER_COMMON_NOERR(asrt) \ FUNC_ENTER_CHECK_NAME(asrt); /* Threadsafety initialization code for API routines */ #define FUNC_ENTER_API_THREADSAFE \ - /* Initialize the thread-safe code */ \ + /* Initialize the thread-safe code */ \ H5_FIRST_THREAD_INIT \ - \ - /* Grab the mutex for the library */ \ + \ + /* Grab the mutex for the library */ \ H5_API_UNSET_CANCEL \ H5_API_LOCK /* Local variables for API routines */ #define FUNC_ENTER_API_VARS \ - MPE_LOG_VARS \ + MPE_LOG_VARS \ H5TRACE_DECL -#define FUNC_ENTER_API_COMMON \ +#define FUNC_ENTER_API_COMMON \ FUNC_ENTER_API_VARS \ - FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \ FUNC_ENTER_API_THREADSAFE; -#define FUNC_ENTER_API_INIT(err) \ - /* Initialize the library */ \ - if(!(H5_INIT_GLOBAL)) { \ - H5_INIT_GLOBAL = TRUE; \ - if(H5_init_library() < 0) \ - HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, \ - "library initialization failed") \ - } \ +#define FUNC_ENTER_API_INIT(err) \ + /* Initialize the library */ \ + if(!H5_INIT_GLOBAL && !H5_TERM_GLOBAL) { \ + H5_INIT_GLOBAL = TRUE; \ + if(H5_init_library() < 0) \ + HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, "library initialization failed") \ + } /* end if */ \ \ - /* Initialize the interface, if appropriate */ \ - H5_INTERFACE_INIT(err) \ + /* Initialize the package, if appropriate */ \ + H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) \ \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC \ \ - BEGIN_MPE_LOG + BEGIN_MPE_LOG /* Use this macro for all "normal" API functions */ -#define FUNC_ENTER_API(err) {{ \ +#define FUNC_ENTER_API(err) {{ \ FUNC_ENTER_API_COMMON \ - FUNC_ENTER_API_INIT(err); \ - /* Clear thread error stack entering public functions */ \ - H5E_clear_stack(NULL); \ + FUNC_ENTER_API_INIT(err); \ + /* Clear thread error stack entering public functions */ \ + H5E_clear_stack(NULL); \ { /* * Use this macro for API functions that shouldn't clear the error stack * like H5Eprint and H5Ewalk. */ -#define FUNC_ENTER_API_NOCLEAR(err) {{ \ +#define FUNC_ENTER_API_NOCLEAR(err) {{ \ FUNC_ENTER_API_COMMON \ - FUNC_ENTER_API_INIT(err); \ + FUNC_ENTER_API_INIT(err); \ { /* @@ -1938,7 +1972,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); * are: H5check_version, etc. * */ -#define FUNC_ENTER_API_NOINIT {{ \ +#define FUNC_ENTER_API_NOINIT {{ \ FUNC_ENTER_API_COMMON \ H5_PUSH_FUNC \ BEGIN_MPE_LOG \ @@ -1951,38 +1985,120 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); * are: H5close, H5check_version, etc. * */ -#define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{ \ +#define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{ \ FUNC_ENTER_API_VARS \ - FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \ - FUNC_ENTER_API_THREADSAFE; \ + FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \ + FUNC_ENTER_API_THREADSAFE; \ BEGIN_MPE_LOG \ { /* Note: this macro only works when there's _no_ interface initialization routine for the module */ -#define FUNC_ENTER_NOAPI_INIT(err) \ - /* Initialize the interface, if appropriate */ \ - H5_INTERFACE_INIT(err) \ +#define FUNC_ENTER_NOAPI_INIT(err) \ + /* Initialize the package, if appropriate */ \ + H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) \ \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC /* Use this macro for all "normal" non-API functions */ -#define FUNC_ENTER_NOAPI(err) { \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ - FUNC_ENTER_NOAPI_INIT(err) \ - { +#define FUNC_ENTER_NOAPI(err) { \ + FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + FUNC_ENTER_NOAPI_INIT(err) \ + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { + +/* Use this macro for all non-API functions, which propagate errors, but don't issue them */ +#define FUNC_ENTER_NOAPI_NOERR { \ + FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ + FUNC_ENTER_NOAPI_INIT(-) \ + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { + +/* + * Use this macro for non-API functions which fall into these categories: + * - static functions, since they must be called from a function in the + * interface, the library and interface must already be + * initialized. + * - functions which are called during library shutdown, since we don't + * want to re-initialize the library. + */ +#define FUNC_ENTER_NOAPI_NOINIT { \ + FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + H5_PUSH_FUNC \ + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { + +/* + * Use this macro for non-API functions which fall into these categories: + * - static functions, since they must be called from a function in the + * interface, the library and interface must already be + * initialized. + * - functions which are called during library shutdown, since we don't + * want to re-initialize the library. + * - functions that propagate, but don't issue errors + */ +#define FUNC_ENTER_NOAPI_NOINIT_NOERR { \ + FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ + H5_PUSH_FUNC \ + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { + +/* + * Use this macro for non-API functions which fall into these categories: + * - functions which shouldn't push their name on the function stack + * (so far, just the H5CS routines themselves) + * + */ +#define FUNC_ENTER_NOAPI_NOFS { \ + FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + \ + /* Initialize the package, if appropriate */ \ + H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) \ + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { + +/* + * Use this macro for non-API functions which fall into these categories: + * - functions which shouldn't push their name on the function stack + * (so far, just the H5CS routines themselves) + * + * This macro is used for functions which fit the above categories _and_ + * also don't use the 'FUNC' variable (i.e. don't push errors on the error stack) + * + */ +#define FUNC_ENTER_NOAPI_NOERR_NOFS { \ + FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { + +/* Use the following two macros as replacements for the FUNC_ENTER_NOAPI + * and FUNC_ENTER_NOAPI_NOINIT macros when the function needs to set + * up a metadata tag. */ +#define FUNC_ENTER_NOAPI_TAG(dxpl_id, tag, err) { \ + haddr_t prev_tag = HADDR_UNDEF; \ + hid_t tag_dxpl_id = dxpl_id; \ + \ + FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + if(H5AC_tag(tag_dxpl_id, tag, &prev_tag)<0) \ + HGOTO_ERROR(H5_MY_PKG_ERR, H5E_CANTTAG, err, "unable to apply metadata tag") \ + FUNC_ENTER_NOAPI_INIT(err) \ + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { + +#define FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, tag, err) { \ + haddr_t prev_tag = HADDR_UNDEF; \ + hid_t tag_dxpl_id = dxpl_id; \ + \ + FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + if(H5AC_tag(tag_dxpl_id, tag, &prev_tag)<0) \ + HGOTO_ERROR(H5_MY_PKG_ERR, H5E_CANTTAG, err, "unable to apply metadata tag") \ + H5_PUSH_FUNC \ + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* Use this macro for all "normal" package-level functions */ #define FUNC_ENTER_PACKAGE { \ 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)); \ 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. */ @@ -1992,21 +2108,27 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); \ FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ if(H5AC_tag(tag_dxpl_id, tag, &prev_tag) < 0) \ - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ + HGOTO_ERROR(H5_MY_PKG_ERR, H5E_CANTTAG, err, "unable to apply metadata 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 staticly-scoped functions which propgate errors, but don't issue them */ #define FUNC_ENTER_STATIC_NOERR { \ FUNC_ENTER_COMMON_NOERR(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 */ +/* And that shouldn't push their name on the function stack */ +#define FUNC_ENTER_STATIC_NOERR_NOFS { \ + FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(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. */ @@ -2016,76 +2138,9 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); \ FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ if(H5AC_tag(tag_dxpl_id, tag, &prev_tag) < 0) \ - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ + HGOTO_ERROR(H5_MY_PKG_ERR, H5E_CANTTAG, err, "unable to apply metadata tag") \ H5_PUSH_FUNC \ - { - -/* Use this macro for all non-API functions, which propagate errors, but don't issue them */ -#define FUNC_ENTER_NOAPI_NOERR { \ - FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ - FUNC_ENTER_NOAPI_INIT(-) \ - { - -/* - * Use this macro for non-API functions which fall into these categories: - * - static functions, since they must be called from a function in the - * interface, the library and interface must already be - * initialized. - * - functions which are called during library shutdown, since we don't - * want to re-initialize the library. - */ -#define FUNC_ENTER_NOAPI_NOINIT { \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ - H5_PUSH_FUNC \ - { - -/* - * Use this macro for non-API functions which fall into these categories: - * - static functions, since they must be called from a function in the - * interface, the library and interface must already be - * initialized. - * - functions which are called during library shutdown, since we don't - * want to re-initialize the library. - * - functions that propagate, but don't issue errors - */ -#define FUNC_ENTER_NOAPI_NOINIT_NOERR { \ - FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ - H5_PUSH_FUNC \ - { - -/* - * Use this macro for non-API functions which fall into these categories: - * - functions which shouldn't push their name on the function stack - * (so far, just the H5CS routines themselves) - * - * This macro is used for functions which fit the above categories _and_ - * also don't use the 'FUNC' variable (i.e. don't push errors on the error stack) - * - */ -#define FUNC_ENTER_NOAPI_NOERR_NOFS { \ - FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ - { - -/* Use the following two macros as replacements for the FUNC_ENTER_NOAPI - * and FUNC_ENTER_NOAPI_NOINIT macros when the function needs to set - * up a metadata tag. */ -#define FUNC_ENTER_NOAPI_TAG(dxpl_id, tag, err) { \ - haddr_t prev_tag = HADDR_UNDEF; \ - hid_t tag_dxpl_id = dxpl_id; \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ - if(H5AC_tag(tag_dxpl_id, tag, &prev_tag)<0) \ - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ - FUNC_ENTER_NOAPI_INIT(err) \ - { - -#define FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, tag, err) { \ - haddr_t prev_tag = HADDR_UNDEF; \ - hid_t tag_dxpl_id = dxpl_id; \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ - if(H5AC_tag(tag_dxpl_id, tag, &prev_tag)<0) \ - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ - H5_PUSH_FUNC \ - { + if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /*------------------------------------------------------------------------- @@ -2102,35 +2157,39 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); H5_API_SET_CANCEL #define FUNC_LEAVE_API(ret_value) \ - FINISH_MPE_LOG \ - H5TRACE_RETURN(ret_value); \ - H5_POP_FUNC \ - if(err_occurred) \ - (void)H5E_dump_api_stack(TRUE); \ - FUNC_LEAVE_API_THREADSAFE \ - return(ret_value); \ + ; \ } /*end scope from end of FUNC_ENTER*/ \ + FINISH_MPE_LOG \ + H5TRACE_RETURN(ret_value); \ + H5_POP_FUNC \ + if(err_occurred) \ + (void)H5E_dump_api_stack(TRUE); \ + FUNC_LEAVE_API_THREADSAFE \ + return(ret_value); \ }} /*end scope from beginning of FUNC_ENTER*/ /* Use this macro to match the FUNC_ENTER_API_NOFS macro */ #define FUNC_LEAVE_API_NOFS(ret_value) \ - FINISH_MPE_LOG \ - H5TRACE_RETURN(ret_value); \ - FUNC_LEAVE_API_THREADSAFE \ - return(ret_value); \ + ; \ } /*end scope from end of FUNC_ENTER*/ \ + FINISH_MPE_LOG \ + H5TRACE_RETURN(ret_value); \ + FUNC_LEAVE_API_THREADSAFE \ + return(ret_value); \ }} /*end scope from beginning of FUNC_ENTER*/ #define FUNC_LEAVE_NOAPI(ret_value) \ - H5_POP_FUNC \ - return(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 \ - H5_POP_FUNC \ - return; \ + ; \ } /*end scope from end of FUNC_ENTER*/ \ + H5_POP_FUNC \ + return; \ } /*end scope from beginning of FUNC_ENTER*/ /* @@ -2139,135 +2198,146 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); * (so far, just the H5CS routines themselves) */ #define FUNC_LEAVE_NOAPI_NOFS(ret_value) \ - return(ret_value); \ + ; \ } /*end scope from end of FUNC_ENTER*/ \ + return(ret_value); \ } /*end scope from beginning of FUNC_ENTER*/ /* Use this macro when exiting a function that set up a metadata tag */ -#define FUNC_LEAVE_NOAPI_TAG(ret_value, err) \ - if(H5AC_tag(tag_dxpl_id, prev_tag, NULL)<0) \ - HDONE_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ - H5_POP_FUNC \ - return(ret_value); \ - } /*end scope from end of FUNC_ENTER*/ \ +#define FUNC_LEAVE_NOAPI_TAG(ret_value, err) \ + ; \ + } /*end scope from end of FUNC_ENTER*/ \ + if(H5AC_tag(tag_dxpl_id, prev_tag, NULL) < 0) \ + HDONE_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ + H5_POP_FUNC \ + return(ret_value); \ } /*end scope from beginning of FUNC_ENTER*/ + /****************************************/ /* Revisions to FUNC_ENTER/LEAVE Macros */ /****************************************/ -/* Macros for referencing package initialization symbols */ -#define H5_PACKAGE_INIT_VAR(x) H5_GLUE3(H5_, x, _init_g) -#define H5_PACKAGE_INIT_FUNC(x) H5_GLUE(x, __pkg_init) - /* Macros to check if a package is initialized */ -#define H5_CHECK_PACKAGE_INIT_REG_YES(asrt) HDassert(H5_PACKAGE_INIT_VAR(pkg)); +#define H5_CHECK_PACKAGE_INIT_REG_YES(asrt) HDassert(H5_PACKAGE_INIT_VAR(pkg)); #define H5_CHECK_PACKAGE_INIT_REG_NO(asrt) #define H5_CHECK_PACKAGE_INIT_INIT_YES(asrt) #define H5_CHECK_PACKAGE_INIT_INIT_NO(asrt) +#define H5_CHECK_PACKAGE_INIT(pkg, pkg_init, init) H5_GLUE4(H5_CHECK_PACKAGE_INIT_, init, _, pkg_init)(pkg) /* Macros to initialize package, if a package initialization routine is defined */ -#define H5_PKG_YES_INIT(pkg) \ - if(!H5_PACKAGE_INIT_VAR(pkg)) { \ - if(H5_GLUE(pkg, _pkg_init)() < 0) { \ - /* (Can't use H5E_THROW here) */ \ +#define H5_PKG_YES_INIT(pkg) \ + if(!H5_PACKAGE_INIT_VAR(pkg) && !H5_TERM_GLOBAL) { \ + H5_PACKAGE_INIT_VAR(pkg) = TRUE; \ + if(H5_PACKAGE_INIT_FUNC(pkg)() < 0) { \ + H5_PACKAGE_INIT_VAR(pkg) = FALSE; \ + /* (Can't use H5E_THROW here) */ \ H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \ - ret_value = fail_value; \ - goto func_init_failed; \ - } /* end if */ \ + ret_value = fail_value; \ + goto func_init_failed; \ + } /* end if */ \ } /* end if */ -#define H5_PKG_NO_INIT(pkg) - -/* Macros to declare package initialization symbols, if a package initialization routine is defined */ -#define H5_PKG_YES_INIT_VAR(pkg) extern hbool_t H5_PACKAGE_INIT_VAR(H5_MY_PKG); -#define H5_PKG_NO_INIT_VAR(pkg) -#define H5_PKG_YES_INIT_FUNC(pkg) extern herr_t H5_PACKAGE_INIT_FUNC(pkg)(void); -#define H5_PKG_NO_INIT_FUNC(pkg) +#define H5_PKG_NO_INIT(pkg) \ + if(!H5_PACKAGE_INIT_VAR(pkg) && !H5_TERM_GLOBAL) \ + H5_PACKAGE_INIT_VAR(pkg) = TRUE; +#define H5_PKG_INIT(pkg_init, pkg) H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg) + +/* Macros to declare package initialization function, if a package initialization routine is defined */ +#ifdef H5_PKG_SINGLE_SOURCE +#define H5_PKG_DECLARE_YES_FUNC(pkg) static herr_t H5_PACKAGE_INIT_FUNC(pkg)(void); +#else /* H5_PKG_SINGLE_SOURCE */ +#define H5_PKG_DECLARE_YES_FUNC(pkg) extern herr_t H5_PACKAGE_INIT_FUNC(pkg)(void); +#endif /* H5_PKG_SINGLE_SOURCE */ +#define H5_PKG_DECLARE_NO_FUNC(pkg) /* Declare package initialization symbols (if in a package) */ -#define H5_DECLARE_PKG_VAR(pkg_init, pkg) H5_GLUE3(H5_PKG_, pkg_init, _INIT_VAR)(pkg) -#define H5_DECLARE_PKG_FUNC(pkg_init, pkg) H5_GLUE3(H5_PKG_, pkg_init, _INIT_FUNC)(pkg) +#ifdef H5_PKG_SINGLE_SOURCE +#define H5_PKG_DECLARE_VAR(pkg) static hbool_t H5_PACKAGE_INIT_VAR(pkg); +#else /* H5_PKG_SINGLE_SOURCE */ +#define H5_PKG_DECLARE_VAR(pkg) extern hbool_t H5_PACKAGE_INIT_VAR(pkg); +#endif /* H5_PKG_SINGLE_SOURCE */ +#define H5_PKG_DECLARE_FUNC(pkg_init, pkg) H5_GLUE3(H5_PKG_DECLARE_, pkg_init, _FUNC)(pkg) #ifdef H5_MY_PKG -H5_DECLARE_PKG_VAR(H5_MY_PKG_INIT, H5_MY_PKG) -H5_DECLARE_PKG_FUNC(H5_MY_PKG_INIT, H5_MY_PKG) +H5_PKG_DECLARE_VAR(H5_MY_PKG) +H5_PKG_DECLARE_FUNC(H5_MY_PKG_INIT, H5_MY_PKG) #endif /* H5_MY_PKG */ /* API re-entrance variable */ extern hbool_t H5_api_entered_g; /* Has library already been entered through API? */ /* Macros for entering different scopes of routines */ -#define H5_PACKAGE_ENTER(pkg, pkg_init, init) \ - FUNC_ENTER_CHECK_NAME(H5_IS_PKG(FUNC)) \ +#define H5_PACKAGE_ENTER(pkg, pkg_init, init) \ + FUNC_ENTER_CHECK_NAME(H5_IS_PKG(FUNC)) \ \ - /* The library should be initialized already */ \ - HDassert(H5_INIT_GLOBAL); \ + /* The library should be initialized already */ \ + HDassert(H5_INIT_GLOBAL); \ \ - /* This interface should be initialized already */ \ - /* (except for package initialization routines :-) */ \ - H5_GLUE4(H5_CHECK_PACKAGE_INIT_, init, _, pkg_init)(pkg) \ + /* This interface should be initialized already */ \ + /* (except for package initialization routines :-) */ \ + H5_CHECK_PACKAGE_INIT(pkg, pkg_init, init) \ \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC \ \ - /* Enter scope for this type of function */ \ + /* Enter scope for this type of function */ \ { -#define H5_PRIVATE_ENTER(pkg, pkg_init) \ - FUNC_ENTER_CHECK_NAME(H5_IS_PRIV(FUNC)) \ +#define H5_PRIVATE_ENTER(pkg, pkg_init) \ + FUNC_ENTER_CHECK_NAME(H5_IS_PRIV(FUNC)) \ \ - /* The library should be initialized already */ \ - HDassert(H5_INIT_GLOBAL); \ + /* The library should be initialized already */ \ + HDassert(H5_INIT_GLOBAL); \ \ - /* Initialize this interface if desired */ \ - H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg) \ + /* Initialize this interface if desired */ \ + H5_PKG_INIT(pkg_init, pkg) \ \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC \ \ - /* Enter scope for this type of function */ \ + /* Enter scope for this type of function */ \ {{ -#define H5_PUBLIC_ENTER(pkg, pkg_init) \ - FUNC_ENTER_API_VARS \ +#define H5_PUBLIC_ENTER(pkg, pkg_init) \ + FUNC_ENTER_API_VARS \ FUNC_ENTER_API_THREADSAFE; \ - FUNC_ENTER_CHECK_NAME(H5_IS_PUB(FUNC)) \ + FUNC_ENTER_CHECK_NAME(H5_IS_PUB(FUNC)) \ \ - /* Clear thread error stack when entering public functions */ \ - H5E_clear_stack(NULL); \ + /* Clear thread error stack when entering public functions */ \ + H5E_clear_stack(NULL); \ \ - /* Initialize the library or bust */ \ - if(!(H5_INIT_GLOBAL)) { \ + /* Initialize the library or bust */ \ + if(!H5_INIT_GLOBAL && !H5_TERM_GLOBAL) { \ H5_INIT_GLOBAL = TRUE; \ - if(H5_init_library() < 0) { \ - /* (Can't use H5E_THROW here) */ \ + if(H5_init_library() < 0) { \ + /* (Can't use H5E_THROW here) */ \ H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \ - ret_value = fail_value; \ - goto func_init_failed; \ - } /* end if */ \ - } /* end if */ \ + ret_value = fail_value; \ + goto func_init_failed; \ + } /* end if */ \ + } /* end if */ \ \ - /* Initialize this interface if desired */ \ - H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg) \ + /* Initialize this interface if desired */ \ + H5_PKG_INIT(pkg_init, pkg) \ \ - /* Check for re-entering API routine */ \ - HDassert(!H5_api_entered_g); \ - H5_api_entered_g = TRUE; \ + /* Check for re-entering API routine */ \ + HDassert(!H5_api_entered_g); \ + H5_api_entered_g = TRUE; \ \ - /* Start logging MPI's MPE information */ \ - BEGIN_MPE_LOG \ + /* Start logging MPI's MPE information */ \ + BEGIN_MPE_LOG \ \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC \ \ - /* Enter scope for this type of function */ \ + /* Enter scope for this type of function */ \ {{{ /* Macros for substituting the package name */ -#define FUNC_ENT_STATIC H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, REG) -#define FUNC_ENT_PKGINIT H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, INIT) -#define FUNC_ENT_PKG H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, REG) -#define FUNC_ENT_PRIV H5_PRIVATE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT) -#define FUNC_ENT_PUB H5_PUBLIC_ENTER(H5_MY_PKG, H5_MY_PKG_INIT) +#define FUNC_ENT_STATIC(pkg, pkg_init) H5_PACKAGE_ENTER(pkg, pkg_init, REG) +#define FUNC_ENT_PKGINIT(pkg, pkg_init) H5_PACKAGE_ENTER(pkg, pkg_init, INIT) +#define FUNC_ENT_PKG(pkg, pkg_init) H5_PACKAGE_ENTER(pkg, pkg_init, REG) +#define FUNC_ENT_PRIV(pkg, pkg_init) H5_PRIVATE_ENTER(pkg, pkg_init) +#define FUNC_ENT_PUB(pkg, pkg_init) H5_PUBLIC_ENTER(pkg, pkg_init) /* Macros for substituting a function prefix */ #define FUNC_PREFIX_STATIC static @@ -2277,23 +2347,23 @@ extern hbool_t H5_api_entered_g; /* Has library already been entered through #define FUNC_PREFIX_PUB /* Macros for declaring error variables */ -#define FUNC_ERR_VAR_ERR(ret_typ, err) \ - hbool_t past_catch = FALSE; \ +#define FUNC_ERR_VAR_ERR(ret_typ, err) \ + hbool_t past_catch = FALSE; \ ret_typ fail_value = err; -#define FUNC_ERR_VAR_ERRCATCH(ret_typ, err) \ +#define FUNC_ERR_VAR_ERRCATCH(ret_typ, err) \ hbool_t past_catch = FALSE; #define FUNC_ERR_VAR_NOERR(ret_typ, err) /* Use this macro when entering all functions */ -#define BEGIN_FUNC(scope, use_err, ret_typ, ret_init, err, func) \ -H5_GLUE(FUNC_PREFIX_, scope) \ -ret_typ \ -func \ -/* Open function */ \ -{ \ - ret_typ ret_value = ret_init; \ - H5_GLUE(FUNC_ERR_VAR_, use_err)(ret_typ, err) \ - H5_GLUE(FUNC_ENT_, scope) +#define BEGIN_FUNC(scope, use_err, ret_typ, ret_init, err, func) \ +H5_GLUE(FUNC_PREFIX_, scope) \ +ret_typ \ +func \ +/* Open function */ \ +{ \ + ret_typ ret_value = ret_init; \ + H5_GLUE(FUNC_ERR_VAR_, use_err)(ret_typ, err) \ + H5_GLUE(FUNC_ENT_, scope)(H5_MY_PKG, H5_MY_PKG_INIT) /* Macros for label when a function initialization can fail */ #define H5_PRIV_YES_FUNC_INIT_FAILED func_init_failed: @@ -2301,73 +2371,73 @@ func \ #define H5_PRIV_FUNC_INIT_FAILED(pkg_init) H5_GLUE3(H5_PRIV_, pkg_init, _FUNC_INIT_FAILED) /* Macros for leaving different scopes of routines */ -#define FUNC_LEAVE_PKGINIT \ - /* Leave scope for this type of function */ \ - } \ +#define FUNC_LEAVE_PKGINIT \ + /* Leave scope for this type of function */ \ + } \ \ - /* Pop the name of this function off the function stack */ \ + /* Pop the name of this function off the function stack */ \ H5_POP_FUNC -#define FUNC_LEAVE_STATIC \ - /* Leave scope for this type of function */ \ - } \ +#define FUNC_LEAVE_STATIC \ + /* Leave scope for this type of function */ \ + } \ \ - /* Pop the name of this function off the function stack */ \ + /* Pop the name of this function off the function stack */ \ H5_POP_FUNC -#define FUNC_LEAVE_PKG \ - /* Leave scope for this type of function */ \ - } \ +#define FUNC_LEAVE_PKG \ + /* Leave scope for this type of function */ \ + } \ \ - /* Pop the name of this function off the function stack */ \ + /* Pop the name of this function off the function stack */ \ H5_POP_FUNC -#define FUNC_LEAVE_PRIV \ - /* Leave scope for this type of function */ \ - }} \ +#define FUNC_LEAVE_PRIV \ + /* Leave scope for this type of function */ \ + }} \ \ - /* Label for errors during FUNC_ENTER */ \ - H5_PRIV_FUNC_INIT_FAILED(H5_MY_PKG_INIT) \ + /* Label for errors during FUNC_ENTER */ \ + H5_PRIV_FUNC_INIT_FAILED(H5_MY_PKG_INIT) \ \ - /* Pop the name of this function off the function stack */ \ + /* Pop the name of this function off the function stack */ \ H5_POP_FUNC -#define FUNC_LEAVE_PUB \ - /* Leave scope for this type of function */ \ - }}} \ +#define FUNC_LEAVE_PUB \ + /* Leave scope for this type of function */ \ + }}} \ \ - /* Label for errors during FUNC_ENTER */ \ -func_init_failed: \ + /* Label for errors during FUNC_ENTER */ \ +func_init_failed: \ \ - /* Dump error stack if an error occurred during API routine */ \ - if(ret_value == fail_value) \ - (void)H5E_dump_api_stack(TRUE); \ + /* Dump error stack if an error occurred during API routine */ \ + if(ret_value == fail_value) \ + (void)H5E_dump_api_stack(TRUE); \ \ - /* Finish the API tracing info */ \ - H5TRACE_RETURN(ret_value); \ + /* Finish the API tracing info */ \ + H5TRACE_RETURN(ret_value); \ \ - /* Pop the name of this function off the function stack */ \ - H5_POP_FUNC \ + /* Pop the name of this function off the function stack */ \ + H5_POP_FUNC \ \ - /* Finish the MPE tracing info */ \ - FINISH_MPE_LOG \ + /* Finish the MPE tracing info */ \ + FINISH_MPE_LOG \ \ - /* Check for leaving API routine */ \ - HDassert(H5_api_entered_g); \ - H5_api_entered_g = FALSE; \ + /* Check for leaving API routine */ \ + HDassert(H5_api_entered_g); \ + H5_api_entered_g = FALSE; \ \ - /* Release thread-safety semaphore */ \ + /* Release thread-safety semaphore */ \ FUNC_LEAVE_API_THREADSAFE /* Use this macro when leaving all functions */ -#define END_FUNC(scope) \ - /* Scope-specific function conclusion */ \ - H5_GLUE(FUNC_LEAVE_, scope) \ +#define END_FUNC(scope) \ + /* Scope-specific function conclusion */ \ + H5_GLUE(FUNC_LEAVE_, scope) \ \ - /* Leave routine */ \ - return(ret_value); \ + /* Leave routine */ \ + return(ret_value); \ \ - /* Close Function */ \ + /* Close Function */ \ } /* Macro to begin/end tagging (when FUNC_ENTER_*TAG macros are insufficient). @@ -2376,23 +2446,13 @@ func_init_failed: \ haddr_t prv_tag = HADDR_UNDEF; \ hid_t my_dxpl_id = dxpl; \ if(H5AC_tag(my_dxpl_id, tag, &prv_tag) < 0) \ - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") + HGOTO_ERROR(H5_MY_PKG_ERR, H5E_CANTTAG, err, "unable to apply metadata tag") #define H5_END_TAG(err) \ if(H5AC_tag(my_dxpl_id, prv_tag, NULL) <0) \ - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ + HGOTO_ERROR(H5_MY_PKG_ERR, H5E_CANTTAG, err, "unable to apply metadata tag") \ } -/* Macro for "stringizing" an integer in the C preprocessor (use H5_TOSTRING) */ -/* (use H5_TOSTRING, H5_STRINGIZE is just part of the implementation) */ -#define H5_STRINGIZE(x) #x -#define H5_TOSTRING(x) H5_STRINGIZE(x) - -/* Macro for "glueing" together items, for re-scanning macros */ -#define H5_GLUE(x,y) x##y -#define H5_GLUE3(x,y,z) x##y##z -#define H5_GLUE4(w,x,y,z) w##x##y##z - /* Compile-time "assert" macro */ #define HDcompile_assert(e) ((void)sizeof(char[ !!(e) ? 1 : -1])) /* Variants that are correct, but generate compile-time warnings in some circumstances: @@ -2405,21 +2465,30 @@ H5_DLL herr_t H5_init_library(void); H5_DLL void H5_term_library(void); /* Functions to terminate interfaces */ -H5_DLL int H5A_term_interface(void); -H5_DLL int H5AC_term_interface(void); -H5_DLL int H5D_term_interface(void); -H5_DLL int H5E_term_interface(void); -H5_DLL int H5F_term_interface(void); -H5_DLL int H5FS_term_interface(void); -H5_DLL int H5G_term_interface(void); -H5_DLL int H5I_term_interface(void); -H5_DLL int H5L_term_interface(void); -H5_DLL int H5P_term_interface(void); -H5_DLL int H5PL_term_interface(void); -H5_DLL int H5R_term_interface(void); -H5_DLL int H5S_term_interface(void); -H5_DLL int H5T_term_interface(void); -H5_DLL int H5Z_term_interface(void); +H5_DLL int H5A_term_package(void); +H5_DLL int H5A_top_term_package(void); +H5_DLL int H5AC_term_package(void); +H5_DLL int H5D_term_package(void); +H5_DLL int H5D_top_term_package(void); +H5_DLL int H5E_term_package(void); +H5_DLL int H5F_term_package(void); +H5_DLL int H5FD_term_package(void); +H5_DLL int H5FL_term_package(void); +H5_DLL int H5FS_term_package(void); +H5_DLL int H5G_term_package(void); +H5_DLL int H5G_top_term_package(void); +H5_DLL int H5I_term_package(void); +H5_DLL int H5L_term_package(void); +H5_DLL int H5P_term_package(void); +H5_DLL int H5PL_term_package(void); +H5_DLL int H5R_term_package(void); +H5_DLL int H5R_top_term_package(void); +H5_DLL int H5S_term_package(void); +H5_DLL int H5S_top_term_package(void); +H5_DLL int H5SL_term_package(void); +H5_DLL int H5T_term_package(void); +H5_DLL int H5T_top_term_package(void); +H5_DLL int H5Z_term_package(void); /* Checksum functions */ H5_DLL uint32_t H5_checksum_fletcher32(const void *data, size_t len); diff --git a/src/H5public.h b/src/H5public.h index 8c7da05..1c617d1 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -94,10 +94,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 229 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 232 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.229" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.232" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) @@ -176,6 +176,7 @@ H5_GCC_DIAG_ON(long-long) #else # error "nothing appropriate for hsize_t" #endif +#define HSIZE_UNDEF ((hsize_t)(hssize_t)(-1)) /* * File addresses have their own types. diff --git a/src/H5trace.c b/src/H5trace.c index e6a091c..41f3418 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -15,11 +15,11 @@ /*------------------------------------------------------------------------- * - * Created: H5trace.c - * Aug 21 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5trace.c + * Aug 21 2006 + * Quincey Koziol <koziol@hdfgroup.org> * - * Purpose: Internal code for tracing API calls + * Purpose: Internal code for tracing API calls * *------------------------------------------------------------------------- */ @@ -27,18 +27,17 @@ /****************/ /* Module Setup */ /****************/ -#define H5I_PACKAGE /*suppress error about including H5Ipkg */ - +#define H5I_FRIEND /*suppress error about including H5Ipkg */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Ipkg.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Ipkg.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #ifdef H5_HAVE_PARALLEL /* datatypes of predefined drivers needed by H5_trace() */ @@ -83,36 +82,36 @@ /*------------------------------------------------------------------------- - * Function: H5_trace + * Function: H5_trace * - * Purpose: This function is called whenever an API function is called - * and tracing is turned on. If RETURNING is non-zero then - * the caller is about to return and RETURNING points to the + * Purpose: This function is called whenever an API function is called + * and tracing is turned on. If RETURNING is non-zero then + * the caller is about to return and RETURNING points to the * time for the corresponding function call event. Otherwise * we print the function name and the arguments. * - * The TYPE argument is a string which gives the type of each of - * the following argument pairs. Each type is zero or more - * asterisks (one for each level of indirection, although some - * types have one level of indirection already implied) followed - * by either one letter (lower case) or two letters (first one - * uppercase). + * The TYPE argument is a string which gives the type of each of + * the following argument pairs. Each type is zero or more + * asterisks (one for each level of indirection, although some + * types have one level of indirection already implied) followed + * by either one letter (lower case) or two letters (first one + * uppercase). * - * The variable argument list consists of pairs of values. Each - * pair is a string which is the formal argument name in the - * calling function, followed by the argument value. The type - * of the argument value is given by the TYPE string. + * The variable argument list consists of pairs of values. Each + * pair is a string which is the formal argument name in the + * calling function, followed by the argument value. The type + * of the argument value is given by the TYPE string. * - * Note: The TYPE string is meant to be terse and is generated by a - * separate perl script. + * Note: The TYPE string is meant to be terse and is generated by a + * separate perl script. * - * WARNING: DO NOT CALL ANY HDF5 FUNCTION THAT CALLS FUNC_ENTER(). DOING - * SO MAY CAUSE H5_trace() TO BE INVOKED RECURSIVELY OR MAY - * CAUSE LIBRARY INITIALIZATIONS THAT ARE NOT DESIRED. + * WARNING: DO NOT CALL ANY HDF5 FUNCTION THAT CALLS FUNC_ENTER(). DOING + * SO MAY CAUSE H5_trace() TO BE INVOKED RECURSIVELY OR MAY + * CAUSE LIBRARY INITIALIZATIONS THAT ARE NOT DESIRED. * - * Return: Execution time for an API call + * Return: Execution time for an API call * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, June 16, 1998 * *------------------------------------------------------------------------- @@ -120,14 +119,14 @@ double H5_trace(const double *returning, const char *func, const char *type, ...) { - va_list ap; - char buf[64], *rest; - const char *argname; - int argno = 0, ptr, asize_idx; - hssize_t asize[16]; - hssize_t i; - void *vp = NULL; - FILE *out = H5_debug_g.trace; + va_list ap; + char buf[64], *rest; + const char *argname; + int argno = 0, ptr, asize_idx; + hssize_t asize[16]; + hssize_t i; + void *vp = NULL; + FILE *out = H5_debug_g.trace; H5_timer_t event_time; static H5_timer_t first_time = {0.0F, 0.0F, 0.0F}; static int current_depth = 0; @@ -206,48 +205,48 @@ H5_trace(const double *returning, const char *func, const char *type, ...) /* Parse the argument types */ for(argno = 0; *type; argno++, type += (HDisupper(*type) ? 2 : 1)) { - /* Count levels of indirection */ - for(ptr = 0; '*' == *type; type++) + /* Count levels of indirection */ + for(ptr = 0; '*' == *type; type++) ptr++; - if('[' == *type) { - if('a' == type[1]) { - asize_idx = (int)HDstrtol(type + 2, &rest, 10); + if('[' == *type) { + if('a' == type[1]) { + asize_idx = (int)HDstrtol(type + 2, &rest, 10); HDassert(0 <= asize_idx && asize_idx < (int) NELMTS(asize)); - HDassert(']'==*rest); - type = rest + 1; - } else { - rest = (char *)HDstrchr(type, ']'); - HDassert(rest); - type = rest + 1; - asize_idx = -1; - } - } /* end if */ + HDassert(']'==*rest); + type = rest + 1; + } else { + rest = (char *)HDstrchr(type, ']'); + HDassert(rest); + type = rest + 1; + asize_idx = -1; + } + } /* end if */ else - asize_idx = -1; - - /* - * The argument name. Leave off the `_id' part. If the argument - * name is the null pointer then don't print the argument or the - * following `='. This is used for return values. - */ - argname = va_arg(ap, char *); /*lint !e64 Type mismatch not really occuring */ - if(argname) { - unsigned n = (unsigned)MAX (0, (int)HDstrlen(argname) - 3); /*lint !e666 Allow expression with side effects */ - - if(!HDstrcmp(argname + n, "_id")) { - HDstrncpy(buf, argname, (size_t)MIN((int)sizeof(buf) - 1, n)); - buf[MIN((int)sizeof(buf) - 1, n)] = '\0'; - argname = buf; - } /* end if */ - fprintf(out, "%s%s=", argno?", ":"", argname); - } /* end if */ + asize_idx = -1; + + /* + * The argument name. Leave off the `_id' part. If the argument + * name is the null pointer then don't print the argument or the + * following `='. This is used for return values. + */ + argname = va_arg(ap, char *); /*lint !e64 Type mismatch not really occuring */ + if(argname) { + unsigned n = (unsigned)MAX (0, (int)HDstrlen(argname) - 3); /*lint !e666 Allow expression with side effects */ + + if(!HDstrcmp(argname + n, "_id")) { + HDstrncpy(buf, argname, (size_t)MIN((int)sizeof(buf) - 1, n)); + buf[MIN((int)sizeof(buf) - 1, n)] = '\0'; + argname = buf; + } /* end if */ + fprintf(out, "%s%s=", argno?", ":"", argname); + } /* end if */ else - argname = ""; + argname = ""; - /* The value */ - if(ptr) + /* The value */ + if(ptr) vp = va_arg(ap, void *); /*lint !e64 Type mismatch not really occuring */ - switch(type[0]) { + switch(type[0]) { case 'a': if(ptr) { if(vp) @@ -268,7 +267,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "0x%lx", (unsigned long)vp); else fprintf(out, "NULL"); - } /* end if */ + } /* end if */ else { hbool_t bool_var = va_arg(ap, hbool_t); /*lint !e732 Loss of sign not really occuring */ @@ -2554,7 +2553,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else fprintf(out, "BADTYPE(%c)", type[0]); goto error; - } /* end switch */ + } /* end switch */ } /* end for */ /* Display event time for return */ @@ -2565,10 +2564,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...) error: va_end(ap); if(returning) - fprintf(out, ";\n"); + fprintf(out, ";\n"); else { - last_call_depth = current_depth++; - fprintf (out, ")"); + last_call_depth = current_depth++; + fprintf (out, ")"); } /* end else */ HDfflush(out); diff --git a/src/H5version.h b/src/H5version.h deleted file mode 100644 index b955a8f..0000000 --- a/src/H5version.h +++ /dev/null @@ -1,564 +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 files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* Generated automatically by bin/make_vers -- do not edit */ -/* Add new versioned symbols to H5vers.txt file */ - - -#ifndef _H5version_H -#define _H5version_H - -/* Issue error if contradicting macros have been defined. */ -#if (defined(H5_USE_16_API) || defined(H5_USE_18_API)) && defined(H5_NO_DEPRECATED_SYMBOLS) - #error "Can't choose old API versions when deprecated APIs are disabled" -#endif /* (defined(H5_USE_16_API) || defined(H5_USE_18_API)) && defined(H5_NO_DEPRECATED_SYMBOLS) */ - - -/* If a particular "global" version of the library's interfaces is chosen, - * set the versions for the API symbols affected. - * - * Note: If an application has already chosen a particular version for an - * API symbol, the individual API version macro takes priority. - */ -#if defined(H5_USE_16_API_DEFAULT) && !defined(H5_USE_16_API) - #define H5_USE_16_API 1 -#endif /* H5_USE_16_API_DEFAULT && !H5_USE_16_API */ - -#if defined(H5_USE_18_API_DEFAULT) && !defined(H5_USE_18_API) - #define H5_USE_18_API 1 -#endif /* H5_USE_18_API_DEFAULT && !H5_USE_18_API */ - - -#ifdef H5_USE_16_API - -/*************/ -/* Functions */ -/*************/ - -#if !defined(H5Acreate_vers) - #define H5Acreate_vers 1 -#endif /* !defined(H5Acreate_vers) */ - -#if !defined(H5Aiterate_vers) - #define H5Aiterate_vers 1 -#endif /* !defined(H5Aiterate_vers) */ - -#if !defined(H5Dcreate_vers) - #define H5Dcreate_vers 1 -#endif /* !defined(H5Dcreate_vers) */ - -#if !defined(H5Dopen_vers) - #define H5Dopen_vers 1 -#endif /* !defined(H5Dopen_vers) */ - -#if !defined(H5Eclear_vers) - #define H5Eclear_vers 1 -#endif /* !defined(H5Eclear_vers) */ - -#if !defined(H5Eget_auto_vers) - #define H5Eget_auto_vers 1 -#endif /* !defined(H5Eget_auto_vers) */ - -#if !defined(H5Eprint_vers) - #define H5Eprint_vers 1 -#endif /* !defined(H5Eprint_vers) */ - -#if !defined(H5Epush_vers) - #define H5Epush_vers 1 -#endif /* !defined(H5Epush_vers) */ - -#if !defined(H5Eset_auto_vers) - #define H5Eset_auto_vers 1 -#endif /* !defined(H5Eset_auto_vers) */ - -#if !defined(H5Ewalk_vers) - #define H5Ewalk_vers 1 -#endif /* !defined(H5Ewalk_vers) */ - -#if !defined(H5Gcreate_vers) - #define H5Gcreate_vers 1 -#endif /* !defined(H5Gcreate_vers) */ - -#if !defined(H5Gopen_vers) - #define H5Gopen_vers 1 -#endif /* !defined(H5Gopen_vers) */ - -#if !defined(H5Pget_filter_vers) - #define H5Pget_filter_vers 1 -#endif /* !defined(H5Pget_filter_vers) */ - -#if !defined(H5Pget_filter_by_id_vers) - #define H5Pget_filter_by_id_vers 1 -#endif /* !defined(H5Pget_filter_by_id_vers) */ - -#if !defined(H5Pinsert_vers) - #define H5Pinsert_vers 1 -#endif /* !defined(H5Pinsert_vers) */ - -#if !defined(H5Pregister_vers) - #define H5Pregister_vers 1 -#endif /* !defined(H5Pregister_vers) */ - -#if !defined(H5Rdereference_vers) - #define H5Rdereference_vers 1 -#endif /* !defined(H5Rdereference_vers) */ - -#if !defined(H5Rget_obj_type_vers) - #define H5Rget_obj_type_vers 1 -#endif /* !defined(H5Rget_obj_type_vers) */ - -#if !defined(H5Tarray_create_vers) - #define H5Tarray_create_vers 1 -#endif /* !defined(H5Tarray_create_vers) */ - -#if !defined(H5Tcommit_vers) - #define H5Tcommit_vers 1 -#endif /* !defined(H5Tcommit_vers) */ - -#if !defined(H5Tget_array_dims_vers) - #define H5Tget_array_dims_vers 1 -#endif /* !defined(H5Tget_array_dims_vers) */ - -#if !defined(H5Topen_vers) - #define H5Topen_vers 1 -#endif /* !defined(H5Topen_vers) */ - -/************/ -/* Typedefs */ -/************/ - -#if !defined(H5E_auto_t_vers) - #define H5E_auto_t_vers 1 -#endif /* !defined(H5E_auto_t_vers) */ - -#if !defined(H5Z_class_t_vers) - #define H5Z_class_t_vers 1 -#endif /* !defined(H5Z_class_t_vers) */ - -#endif /* H5_USE_16_API */ - -#ifdef H5_USE_18_API - -/*************/ -/* Functions */ -/*************/ - -#if !defined(H5Acreate_vers) - #define H5Acreate_vers 2 -#endif /* !defined(H5Acreate_vers) */ - -#if !defined(H5Aiterate_vers) - #define H5Aiterate_vers 2 -#endif /* !defined(H5Aiterate_vers) */ - -#if !defined(H5Dcreate_vers) - #define H5Dcreate_vers 2 -#endif /* !defined(H5Dcreate_vers) */ - -#if !defined(H5Dopen_vers) - #define H5Dopen_vers 2 -#endif /* !defined(H5Dopen_vers) */ - -#if !defined(H5Eclear_vers) - #define H5Eclear_vers 2 -#endif /* !defined(H5Eclear_vers) */ - -#if !defined(H5Eget_auto_vers) - #define H5Eget_auto_vers 2 -#endif /* !defined(H5Eget_auto_vers) */ - -#if !defined(H5Eprint_vers) - #define H5Eprint_vers 2 -#endif /* !defined(H5Eprint_vers) */ - -#if !defined(H5Epush_vers) - #define H5Epush_vers 2 -#endif /* !defined(H5Epush_vers) */ - -#if !defined(H5Eset_auto_vers) - #define H5Eset_auto_vers 2 -#endif /* !defined(H5Eset_auto_vers) */ - -#if !defined(H5Ewalk_vers) - #define H5Ewalk_vers 2 -#endif /* !defined(H5Ewalk_vers) */ - -#if !defined(H5Fget_info_vers) - #define H5Fget_info_vers 1 -#endif /* !defined(H5Fget_info_vers) */ - -#if !defined(H5Gcreate_vers) - #define H5Gcreate_vers 2 -#endif /* !defined(H5Gcreate_vers) */ - -#if !defined(H5Gopen_vers) - #define H5Gopen_vers 2 -#endif /* !defined(H5Gopen_vers) */ - -#if !defined(H5Pget_filter_vers) - #define H5Pget_filter_vers 2 -#endif /* !defined(H5Pget_filter_vers) */ - -#if !defined(H5Pget_filter_by_id_vers) - #define H5Pget_filter_by_id_vers 2 -#endif /* !defined(H5Pget_filter_by_id_vers) */ - -#if !defined(H5Pinsert_vers) - #define H5Pinsert_vers 2 -#endif /* !defined(H5Pinsert_vers) */ - -#if !defined(H5Pregister_vers) - #define H5Pregister_vers 2 -#endif /* !defined(H5Pregister_vers) */ - -#if !defined(H5Rdereference_vers) - #define H5Rdereference_vers 1 -#endif /* !defined(H5Rdereference_vers) */ - -#if !defined(H5Rget_obj_type_vers) - #define H5Rget_obj_type_vers 2 -#endif /* !defined(H5Rget_obj_type_vers) */ - -#if !defined(H5Tarray_create_vers) - #define H5Tarray_create_vers 2 -#endif /* !defined(H5Tarray_create_vers) */ - -#if !defined(H5Tcommit_vers) - #define H5Tcommit_vers 2 -#endif /* !defined(H5Tcommit_vers) */ - -#if !defined(H5Tget_array_dims_vers) - #define H5Tget_array_dims_vers 2 -#endif /* !defined(H5Tget_array_dims_vers) */ - -#if !defined(H5Topen_vers) - #define H5Topen_vers 2 -#endif /* !defined(H5Topen_vers) */ - -/************/ -/* Typedefs */ -/************/ - -#if !defined(H5E_auto_t_vers) - #define H5E_auto_t_vers 2 -#endif /* !defined(H5E_auto_t_vers) */ - -#if !defined(H5Z_class_t_vers) - #define H5Z_class_t_vers 2 -#endif /* !defined(H5Z_class_t_vers) */ - -#endif /* H5_USE_18_API */ - - -/* Choose the correct version of each API symbol, defaulting to the latest - * version of each. The "best" name for API parameters/data structures - * that have changed definitions is also set. An error is issued for - * specifying an invalid API version. - */ - -/*************/ -/* Functions */ -/*************/ - -#if !defined(H5Acreate_vers) || H5Acreate_vers == 2 - #ifndef H5Acreate_vers - #define H5Acreate_vers 2 - #endif /* H5Acreate_vers */ - #define H5Acreate H5Acreate2 -#elif H5Acreate_vers == 1 - #define H5Acreate H5Acreate1 -#else /* H5Acreate_vers */ - #error "H5Acreate_vers set to invalid value" -#endif /* H5Acreate_vers */ - -#if !defined(H5Aiterate_vers) || H5Aiterate_vers == 2 - #ifndef H5Aiterate_vers - #define H5Aiterate_vers 2 - #endif /* H5Aiterate_vers */ - #define H5Aiterate H5Aiterate2 - #define H5A_operator_t H5A_operator2_t -#elif H5Aiterate_vers == 1 - #define H5Aiterate H5Aiterate1 - #define H5A_operator_t H5A_operator1_t -#else /* H5Aiterate_vers */ - #error "H5Aiterate_vers set to invalid value" -#endif /* H5Aiterate_vers */ - -#if !defined(H5Dcreate_vers) || H5Dcreate_vers == 2 - #ifndef H5Dcreate_vers - #define H5Dcreate_vers 2 - #endif /* H5Dcreate_vers */ - #define H5Dcreate H5Dcreate2 -#elif H5Dcreate_vers == 1 - #define H5Dcreate H5Dcreate1 -#else /* H5Dcreate_vers */ - #error "H5Dcreate_vers set to invalid value" -#endif /* H5Dcreate_vers */ - -#if !defined(H5Dopen_vers) || H5Dopen_vers == 2 - #ifndef H5Dopen_vers - #define H5Dopen_vers 2 - #endif /* H5Dopen_vers */ - #define H5Dopen H5Dopen2 -#elif H5Dopen_vers == 1 - #define H5Dopen H5Dopen1 -#else /* H5Dopen_vers */ - #error "H5Dopen_vers set to invalid value" -#endif /* H5Dopen_vers */ - -#if !defined(H5Eclear_vers) || H5Eclear_vers == 2 - #ifndef H5Eclear_vers - #define H5Eclear_vers 2 - #endif /* H5Eclear_vers */ - #define H5Eclear H5Eclear2 -#elif H5Eclear_vers == 1 - #define H5Eclear H5Eclear1 -#else /* H5Eclear_vers */ - #error "H5Eclear_vers set to invalid value" -#endif /* H5Eclear_vers */ - -#if !defined(H5Eget_auto_vers) || H5Eget_auto_vers == 2 - #ifndef H5Eget_auto_vers - #define H5Eget_auto_vers 2 - #endif /* H5Eget_auto_vers */ - #define H5Eget_auto H5Eget_auto2 -#elif H5Eget_auto_vers == 1 - #define H5Eget_auto H5Eget_auto1 -#else /* H5Eget_auto_vers */ - #error "H5Eget_auto_vers set to invalid value" -#endif /* H5Eget_auto_vers */ - -#if !defined(H5Eprint_vers) || H5Eprint_vers == 2 - #ifndef H5Eprint_vers - #define H5Eprint_vers 2 - #endif /* H5Eprint_vers */ - #define H5Eprint H5Eprint2 -#elif H5Eprint_vers == 1 - #define H5Eprint H5Eprint1 -#else /* H5Eprint_vers */ - #error "H5Eprint_vers set to invalid value" -#endif /* H5Eprint_vers */ - -#if !defined(H5Epush_vers) || H5Epush_vers == 2 - #ifndef H5Epush_vers - #define H5Epush_vers 2 - #endif /* H5Epush_vers */ - #define H5Epush H5Epush2 -#elif H5Epush_vers == 1 - #define H5Epush H5Epush1 -#else /* H5Epush_vers */ - #error "H5Epush_vers set to invalid value" -#endif /* H5Epush_vers */ - -#if !defined(H5Eset_auto_vers) || H5Eset_auto_vers == 2 - #ifndef H5Eset_auto_vers - #define H5Eset_auto_vers 2 - #endif /* H5Eset_auto_vers */ - #define H5Eset_auto H5Eset_auto2 -#elif H5Eset_auto_vers == 1 - #define H5Eset_auto H5Eset_auto1 -#else /* H5Eset_auto_vers */ - #error "H5Eset_auto_vers set to invalid value" -#endif /* H5Eset_auto_vers */ - -#if !defined(H5Ewalk_vers) || H5Ewalk_vers == 2 - #ifndef H5Ewalk_vers - #define H5Ewalk_vers 2 - #endif /* H5Ewalk_vers */ - #define H5Ewalk H5Ewalk2 - #define H5E_error_t H5E_error2_t - #define H5E_walk_t H5E_walk2_t -#elif H5Ewalk_vers == 1 - #define H5Ewalk H5Ewalk1 - #define H5E_error_t H5E_error1_t - #define H5E_walk_t H5E_walk1_t -#else /* H5Ewalk_vers */ - #error "H5Ewalk_vers set to invalid value" -#endif /* H5Ewalk_vers */ - -#if !defined(H5Fget_info_vers) || H5Fget_info_vers == 2 - #ifndef H5Fget_info_vers - #define H5Fget_info_vers 2 - #endif /* H5Fget_info_vers */ - #define H5Fget_info H5Fget_info2 - #define H5F_info_t H5F_info2_t -#elif H5Fget_info_vers == 1 - #define H5Fget_info H5Fget_info1 - #define H5F_info_t H5F_info1_t -#else /* H5Fget_info_vers */ - #error "H5Fget_info_vers set to invalid value" -#endif /* H5Fget_info_vers */ - -#if !defined(H5Gcreate_vers) || H5Gcreate_vers == 2 - #ifndef H5Gcreate_vers - #define H5Gcreate_vers 2 - #endif /* H5Gcreate_vers */ - #define H5Gcreate H5Gcreate2 -#elif H5Gcreate_vers == 1 - #define H5Gcreate H5Gcreate1 -#else /* H5Gcreate_vers */ - #error "H5Gcreate_vers set to invalid value" -#endif /* H5Gcreate_vers */ - -#if !defined(H5Gopen_vers) || H5Gopen_vers == 2 - #ifndef H5Gopen_vers - #define H5Gopen_vers 2 - #endif /* H5Gopen_vers */ - #define H5Gopen H5Gopen2 -#elif H5Gopen_vers == 1 - #define H5Gopen H5Gopen1 -#else /* H5Gopen_vers */ - #error "H5Gopen_vers set to invalid value" -#endif /* H5Gopen_vers */ - -#if !defined(H5Pget_filter_vers) || H5Pget_filter_vers == 2 - #ifndef H5Pget_filter_vers - #define H5Pget_filter_vers 2 - #endif /* H5Pget_filter_vers */ - #define H5Pget_filter H5Pget_filter2 -#elif H5Pget_filter_vers == 1 - #define H5Pget_filter H5Pget_filter1 -#else /* H5Pget_filter_vers */ - #error "H5Pget_filter_vers set to invalid value" -#endif /* H5Pget_filter_vers */ - -#if !defined(H5Pget_filter_by_id_vers) || H5Pget_filter_by_id_vers == 2 - #ifndef H5Pget_filter_by_id_vers - #define H5Pget_filter_by_id_vers 2 - #endif /* H5Pget_filter_by_id_vers */ - #define H5Pget_filter_by_id H5Pget_filter_by_id2 -#elif H5Pget_filter_by_id_vers == 1 - #define H5Pget_filter_by_id H5Pget_filter_by_id1 -#else /* H5Pget_filter_by_id_vers */ - #error "H5Pget_filter_by_id_vers set to invalid value" -#endif /* H5Pget_filter_by_id_vers */ - -#if !defined(H5Pinsert_vers) || H5Pinsert_vers == 2 - #ifndef H5Pinsert_vers - #define H5Pinsert_vers 2 - #endif /* H5Pinsert_vers */ - #define H5Pinsert H5Pinsert2 -#elif H5Pinsert_vers == 1 - #define H5Pinsert H5Pinsert1 -#else /* H5Pinsert_vers */ - #error "H5Pinsert_vers set to invalid value" -#endif /* H5Pinsert_vers */ - -#if !defined(H5Pregister_vers) || H5Pregister_vers == 2 - #ifndef H5Pregister_vers - #define H5Pregister_vers 2 - #endif /* H5Pregister_vers */ - #define H5Pregister H5Pregister2 -#elif H5Pregister_vers == 1 - #define H5Pregister H5Pregister1 -#else /* H5Pregister_vers */ - #error "H5Pregister_vers set to invalid value" -#endif /* H5Pregister_vers */ - -#if !defined(H5Rdereference_vers) || H5Rdereference_vers == 2 - #ifndef H5Rdereference_vers - #define H5Rdereference_vers 2 - #endif /* H5Rdereference_vers */ - #define H5Rdereference H5Rdereference2 -#elif H5Rdereference_vers == 1 - #define H5Rdereference H5Rdereference1 -#else /* H5Rdereference_vers */ - #error "H5Rdereference_vers set to invalid value" -#endif /* H5Rdereference_vers */ - -#if !defined(H5Rget_obj_type_vers) || H5Rget_obj_type_vers == 2 - #ifndef H5Rget_obj_type_vers - #define H5Rget_obj_type_vers 2 - #endif /* H5Rget_obj_type_vers */ - #define H5Rget_obj_type H5Rget_obj_type2 -#elif H5Rget_obj_type_vers == 1 - #define H5Rget_obj_type H5Rget_obj_type1 -#else /* H5Rget_obj_type_vers */ - #error "H5Rget_obj_type_vers set to invalid value" -#endif /* H5Rget_obj_type_vers */ - -#if !defined(H5Tarray_create_vers) || H5Tarray_create_vers == 2 - #ifndef H5Tarray_create_vers - #define H5Tarray_create_vers 2 - #endif /* H5Tarray_create_vers */ - #define H5Tarray_create H5Tarray_create2 -#elif H5Tarray_create_vers == 1 - #define H5Tarray_create H5Tarray_create1 -#else /* H5Tarray_create_vers */ - #error "H5Tarray_create_vers set to invalid value" -#endif /* H5Tarray_create_vers */ - -#if !defined(H5Tcommit_vers) || H5Tcommit_vers == 2 - #ifndef H5Tcommit_vers - #define H5Tcommit_vers 2 - #endif /* H5Tcommit_vers */ - #define H5Tcommit H5Tcommit2 -#elif H5Tcommit_vers == 1 - #define H5Tcommit H5Tcommit1 -#else /* H5Tcommit_vers */ - #error "H5Tcommit_vers set to invalid value" -#endif /* H5Tcommit_vers */ - -#if !defined(H5Tget_array_dims_vers) || H5Tget_array_dims_vers == 2 - #ifndef H5Tget_array_dims_vers - #define H5Tget_array_dims_vers 2 - #endif /* H5Tget_array_dims_vers */ - #define H5Tget_array_dims H5Tget_array_dims2 -#elif H5Tget_array_dims_vers == 1 - #define H5Tget_array_dims H5Tget_array_dims1 -#else /* H5Tget_array_dims_vers */ - #error "H5Tget_array_dims_vers set to invalid value" -#endif /* H5Tget_array_dims_vers */ - -#if !defined(H5Topen_vers) || H5Topen_vers == 2 - #ifndef H5Topen_vers - #define H5Topen_vers 2 - #endif /* H5Topen_vers */ - #define H5Topen H5Topen2 -#elif H5Topen_vers == 1 - #define H5Topen H5Topen1 -#else /* H5Topen_vers */ - #error "H5Topen_vers set to invalid value" -#endif /* H5Topen_vers */ - -/************/ -/* Typedefs */ -/************/ - -#if !defined(H5E_auto_t_vers) || H5E_auto_t_vers == 2 - #ifndef H5E_auto_t_vers - #define H5E_auto_t_vers 2 - #endif /* H5E_auto_t_vers */ - #define H5E_auto_t H5E_auto2_t -#elif H5E_auto_t_vers == 1 - #define H5E_auto_t H5E_auto1_t -#else /* H5E_auto_t_vers */ - #error "H5E_auto_t_vers set to invalid value" -#endif /* H5E_auto_t_vers */ - - -#if !defined(H5Z_class_t_vers) || H5Z_class_t_vers == 2 - #ifndef H5Z_class_t_vers - #define H5Z_class_t_vers 2 - #endif /* H5Z_class_t_vers */ - #define H5Z_class_t H5Z_class2_t -#elif H5Z_class_t_vers == 1 - #define H5Z_class_t H5Z_class1_t -#else /* H5Z_class_t_vers */ - #error "H5Z_class_t_vers set to invalid value" -#endif /* H5Z_class_t_vers */ - -#endif /* H5version_H */ - diff --git a/src/Makefile.am b/src/Makefile.am index b6c4dad..f63a88e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -42,26 +42,26 @@ 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 H5ACmpio.c \ + H5AC.c \ H5B.c H5Bcache.c H5Bdbg.c \ H5B2.c H5B2cache.c H5B2dbg.c H5B2hdr.c H5B2int.c H5B2stat.c H5B2test.c \ - H5C.c H5Cmpio.c \ + H5C.c \ H5CS.c \ H5D.c H5Dbtree.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \ H5Ddeprec.c H5Defl.c H5Dfill.c H5Dint.c \ H5Dio.c H5Dlayout.c \ - H5Dmpio.c H5Doh.c H5Dscatgath.c H5Dselect.c H5Dtest.c \ + H5Doh.c H5Dscatgath.c H5Dselect.c H5Dtest.c \ H5E.c H5Edeprec.c H5Eint.c \ H5EA.c H5EAcache.c H5EAdbg.c H5EAdblkpage.c H5EAdblock.c H5EAhdr.c \ H5EAiblock.c H5EAint.c H5EAsblock.c H5EAstat.c H5EAtest.c \ H5F.c H5Fint.c H5Faccum.c H5Fcwfs.c \ H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c H5Fio.c \ - H5Fmount.c H5Fmpi.c H5Fquery.c \ + H5Fmount.c H5Fquery.c \ H5Fsfile.c H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \ H5FA.c H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \ H5FAstat.c H5FAtest.c \ H5FD.c H5FDcore.c \ - H5FDdirect.c H5FDfamily.c H5FDint.c H5FDlog.c H5FDmpi.c H5FDmpio.c \ + H5FDfamily.c H5FDint.c H5FDlog.c \ H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c \ H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSsection.c H5FSstat.c H5FStest.c \ H5G.c H5Gbtree2.c H5Gcache.c \ @@ -95,7 +95,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5R.c H5Rdeprec.c \ H5UC.c \ H5RS.c \ - H5S.c H5Sall.c H5Sdbg.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c \ + H5S.c H5Sall.c H5Sdbg.c H5Shyper.c H5Snone.c H5Spoint.c \ H5Sselect.c H5Stest.c \ H5SL.c \ H5SM.c H5SMbtree2.c H5SMcache.c H5SMmessage.c H5SMtest.c \ @@ -107,9 +107,18 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Topaque.c \ H5Torder.c \ H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c H5VM.c H5WB.c H5Z.c \ - H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c H5Zszip.c \ - H5Zscaleoffset.c H5Ztrans.c - + H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \ + H5Zscaleoffset.c H5Zszip.c H5Ztrans.c + +# Only compile parallel sources if necessary +if BUILD_PARALLEL_CONDITIONAL + libhdf5_la_SOURCES += H5ACmpio.c H5Cmpio.c H5Dmpio.c H5Fmpi.c H5FDmpi.c H5FDmpio.c H5Smpio.c +endif + +# Only compile the direct VFD if necessary +if DIRECT_VFD_CONDITIONAL + libhdf5_la_SOURCES += H5FDdirect.c +endif # Public headers include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5version.h \ diff --git a/src/Makefile.in b/src/Makefile.in deleted file mode 100644 index e5a991f..0000000 --- a/src/Makefile.in +++ /dev/null @@ -1,1962 +0,0 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# -# 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 files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. -# -# HDF5 Library Makefile(.in) -# - - - - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -DIST_COMMON = $(top_srcdir)/config/commence.am \ - $(top_srcdir)/config/lt_vers.am \ - $(top_srcdir)/config/conclude.am $(srcdir)/Makefile.in \ - $(srcdir)/Makefile.am $(srcdir)/H5config.h.in \ - $(top_srcdir)/bin/mkinstalldirs $(srcdir)/libhdf5.settings.in \ - $(top_srcdir)/bin/depcomp $(include_HEADERS) \ - $(top_srcdir)/bin/test-driver COPYING -noinst_PROGRAMS = H5detect$(EXEEXT) H5make_libsettings$(EXEEXT) -TESTS = -subdir = src -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \ - $(top_srcdir)/m4/aclocal_fc.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs -CONFIG_HEADER = H5config.h $(top_builddir)/fortran/src/H5config_f.inc -CONFIG_CLEAN_FILES = libhdf5.settings -CONFIG_CLEAN_VPATH_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(settingsdir)" \ - "$(DESTDIR)$(includedir)" -LTLIBRARIES = $(lib_LTLIBRARIES) -libhdf5_la_LIBADD = -am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \ - H5timer.lo H5trace.lo H5A.lo H5Abtree2.lo H5Adense.lo \ - H5Adeprec.lo H5Aint.lo H5Atest.lo H5AC.lo H5ACmpio.lo H5B.lo \ - H5Bcache.lo H5Bdbg.lo H5B2.lo H5B2cache.lo H5B2dbg.lo \ - H5B2hdr.lo H5B2int.lo H5B2stat.lo H5B2test.lo H5C.lo \ - H5Cmpio.lo H5CS.lo H5D.lo H5Dbtree.lo H5Dchunk.lo \ - H5Dcompact.lo H5Dcontig.lo H5Ddbg.lo H5Ddeprec.lo H5Defl.lo \ - H5Dfill.lo H5Dint.lo H5Dio.lo H5Dlayout.lo H5Dmpio.lo H5Doh.lo \ - H5Dscatgath.lo H5Dselect.lo H5Dtest.lo H5E.lo H5Edeprec.lo \ - H5Eint.lo H5EA.lo H5EAcache.lo H5EAdbg.lo H5EAdblkpage.lo \ - H5EAdblock.lo H5EAhdr.lo H5EAiblock.lo H5EAint.lo \ - H5EAsblock.lo H5EAstat.lo H5EAtest.lo H5F.lo H5Fint.lo \ - H5Faccum.lo H5Fcwfs.lo H5Fdbg.lo H5Fdeprec.lo H5Fefc.lo \ - H5Ffake.lo H5Fio.lo H5Fmount.lo H5Fmpi.lo H5Fquery.lo \ - H5Fsfile.lo H5Fsuper.lo H5Fsuper_cache.lo H5Ftest.lo H5FA.lo \ - H5FAcache.lo H5FAdbg.lo H5FAdblock.lo H5FAdblkpage.lo \ - H5FAhdr.lo H5FAstat.lo H5FAtest.lo H5FD.lo H5FDcore.lo \ - H5FDdirect.lo H5FDfamily.lo H5FDint.lo H5FDlog.lo H5FDmpi.lo \ - H5FDmpio.lo H5FDmulti.lo H5FDsec2.lo H5FDspace.lo H5FDstdio.lo \ - H5FL.lo H5FO.lo H5FS.lo H5FScache.lo H5FSdbg.lo H5FSsection.lo \ - H5FSstat.lo H5FStest.lo H5G.lo H5Gbtree2.lo H5Gcache.lo \ - H5Gcompact.lo H5Gdense.lo H5Gdeprec.lo H5Gent.lo H5Gint.lo \ - H5Glink.lo H5Gloc.lo H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo \ - H5Groot.lo H5Gstab.lo H5Gtest.lo H5Gtraverse.lo H5HF.lo \ - H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo H5HFdblock.lo \ - H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo H5HFiblock.lo H5HFiter.lo \ - H5HFman.lo H5HFsection.lo H5HFspace.lo H5HFstat.lo H5HFtest.lo \ - H5HFtiny.lo H5HG.lo H5HGcache.lo H5HGdbg.lo H5HGquery.lo \ - H5HL.lo H5HLcache.lo H5HLdbg.lo H5HLint.lo H5HP.lo H5I.lo \ - H5Itest.lo H5L.lo H5Lexternal.lo H5lib_settings.lo H5MF.lo \ - H5MFaggr.lo H5MFdbg.lo H5MFsection.lo H5MM.lo H5MP.lo \ - H5MPtest.lo H5O.lo H5Oainfo.lo H5Oalloc.lo H5Oattr.lo \ - H5Oattribute.lo H5Obogus.lo H5Obtreek.lo H5Ocache.lo \ - H5Ochunk.lo H5Ocont.lo H5Ocopy.lo H5Odbg.lo H5Odrvinfo.lo \ - H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Ofsinfo.lo H5Oginfo.lo \ - H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omessage.lo H5Omtime.lo \ - H5Oname.lo H5Onull.lo H5Opline.lo H5Orefcount.lo H5Osdspace.lo \ - H5Oshared.lo H5Ostab.lo H5Oshmesg.lo H5Otest.lo H5Ounknown.lo \ - H5P.lo H5Pacpl.lo H5Pdapl.lo H5Pdcpl.lo H5Pdeprec.lo \ - H5Pdxpl.lo H5Pencdec.lo H5Pfapl.lo H5Pfcpl.lo H5Pfmpl.lo \ - H5Pgcpl.lo H5Pint.lo H5Plapl.lo H5Plcpl.lo H5Pocpl.lo \ - H5Pocpypl.lo H5Pstrcpl.lo H5Ptest.lo H5PL.lo H5R.lo \ - H5Rdeprec.lo H5UC.lo H5RS.lo H5S.lo H5Sall.lo H5Sdbg.lo \ - H5Shyper.lo H5Smpio.lo H5Snone.lo H5Spoint.lo H5Sselect.lo \ - H5Stest.lo H5SL.lo H5SM.lo H5SMbtree2.lo H5SMcache.lo \ - H5SMmessage.lo H5SMtest.lo H5ST.lo H5T.lo H5Tarray.lo \ - H5Tbit.lo H5Tcommit.lo H5Tcompound.lo H5Tconv.lo H5Tcset.lo \ - H5Tdbg.lo H5Tdeprec.lo H5Tenum.lo H5Tfields.lo H5Tfixed.lo \ - H5Tfloat.lo H5Tinit.lo H5Tnative.lo H5Toffset.lo H5Toh.lo \ - H5Topaque.lo H5Torder.lo H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo \ - H5Tvisit.lo H5Tvlen.lo H5TS.lo H5VM.lo H5WB.lo H5Z.lo \ - H5Zdeflate.lo H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo \ - H5Zszip.lo H5Zscaleoffset.lo H5Ztrans.lo -libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -libhdf5_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(libhdf5_la_LDFLAGS) $(LDFLAGS) -o $@ -PROGRAMS = $(noinst_PROGRAMS) -H5detect_SOURCES = H5detect.c -H5detect_OBJECTS = H5detect.$(OBJEXT) -H5detect_LDADD = $(LDADD) -H5make_libsettings_SOURCES = H5make_libsettings.c -H5make_libsettings_OBJECTS = H5make_libsettings.$(OBJEXT) -H5make_libsettings_LDADD = $(LDADD) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/fortran/src -depcomp = $(SHELL) $(top_srcdir)/bin/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(libhdf5_la_SOURCES) H5detect.c H5make_libsettings.c -DIST_SOURCES = $(libhdf5_la_SOURCES) H5detect.c H5make_libsettings.c -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -DATA = $(settings_DATA) -HEADERS = $(include_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ - $(LISP)H5config.h.in -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -am__tty_colors_dummy = \ - mgn= red= grn= lgn= blu= brg= std=; \ - am__color_tests=no -am__tty_colors = { \ - $(am__tty_colors_dummy); \ - if test "X$(AM_COLOR_TESTS)" = Xno; then \ - am__color_tests=no; \ - elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ - am__color_tests=yes; \ - elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ - am__color_tests=yes; \ - fi; \ - if test $$am__color_tests = yes; then \ - red='[0;31m'; \ - grn='[0;32m'; \ - lgn='[1;32m'; \ - blu='[1;34m'; \ - mgn='[0;35m'; \ - brg='[1m'; \ - std='[m'; \ - fi; \ -} -am__recheck_rx = ^[ ]*:recheck:[ ]* -am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* -am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* -# A command that, given a newline-separated list of test names on the -# standard input, print the name of the tests that are to be re-run -# upon "make recheck". -am__list_recheck_tests = $(AWK) '{ \ - recheck = 1; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - { \ - if ((getline line2 < ($$0 ".log")) < 0) \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ - { \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ - { \ - break; \ - } \ - }; \ - if (recheck) \ - print $$0; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# A command that, given a newline-separated list of test names on the -# standard input, create the global log from their .trs and .log files. -am__create_global_log = $(AWK) ' \ -function fatal(msg) \ -{ \ - print "fatal: making $@: " msg | "cat >&2"; \ - exit 1; \ -} \ -function rst_section(header) \ -{ \ - print header; \ - len = length(header); \ - for (i = 1; i <= len; i = i + 1) \ - printf "="; \ - printf "\n\n"; \ -} \ -{ \ - copy_in_global_log = 1; \ - global_test_result = "RUN"; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".trs"); \ - if (line ~ /$(am__global_test_result_rx)/) \ - { \ - sub("$(am__global_test_result_rx)", "", line); \ - sub("[ ]*$$", "", line); \ - global_test_result = line; \ - } \ - else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ - copy_in_global_log = 0; \ - }; \ - if (copy_in_global_log) \ - { \ - rst_section(global_test_result ": " $$0); \ - while ((rc = (getline line < ($$0 ".log"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".log"); \ - print line; \ - }; \ - printf "\n"; \ - }; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# Restructured Text title. -am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } -# Solaris 10 'make', and several other traditional 'make' implementations, -# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it -# by disabling -e (using the XSI extension "set +e") if it's set. -am__sh_e_setup = case $$- in *e*) set +e;; esac -# Default flags passed to test drivers. -am__common_driver_flags = \ - --color-tests "$$am__color_tests" \ - --enable-hard-errors "$$am__enable_hard_errors" \ - --expect-failure "$$am__expect_failure" -# To be inserted before the command running the test. Creates the -# directory for the log if needed. Stores in $dir the directory -# containing $f, in $tst the test, in $log the log. Executes the -# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and -# passes TESTS_ENVIRONMENT. Set up options for the wrapper that -# will run the test scripts (or their associated LOG_COMPILER, if -# thy have one). -am__check_pre = \ -$(am__sh_e_setup); \ -$(am__vpath_adj_setup) $(am__vpath_adj) \ -$(am__tty_colors); \ -srcdir=$(srcdir); export srcdir; \ -case "$@" in \ - */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ - *) am__odir=.;; \ -esac; \ -test "x$$am__odir" = x"." || test -d "$$am__odir" \ - || $(MKDIR_P) "$$am__odir" || exit $$?; \ -if test -f "./$$f"; then dir=./; \ -elif test -f "$$f"; then dir=; \ -else dir="$(srcdir)/"; fi; \ -tst=$$dir$$f; log='$@'; \ -if test -n '$(DISABLE_HARD_ERRORS)'; then \ - am__enable_hard_errors=no; \ -else \ - am__enable_hard_errors=yes; \ -fi; \ -case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ - am__expect_failure=yes;; \ - *) \ - am__expect_failure=no;; \ -esac; \ -$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) -# A shell command to get the names of the tests scripts with any registered -# extension removed (i.e., equivalently, the names of the test logs, with -# the '.log' extension removed). The result is saved in the shell variable -# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, -# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", -# since that might cause problem with VPATH rewrites for suffix-less tests. -# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. -am__set_TESTS_bases = \ - bases='$(TEST_LOGS)'; \ - bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ - bases=`echo $$bases` -RECHECK_LOGS = $(TEST_LOGS) -AM_RECURSIVE_TARGETS = check recheck -TEST_SUITE_LOG = test-suite.log -am__test_logs1 = $(TESTS:=.log) -am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) -TEST_LOGS = $(am__test_logs2:.sh.log=.log) -SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/bin/test-driver -SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS) -am__set_b = \ - case '$@' in \ - */*) \ - case '$*' in \ - */*) b='$*';; \ - *) b=`echo '$@' | sed 's/\.log$$//'`; \ - esac;; \ - *) \ - b='$*';; \ - esac -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@ -AMTAR = @AMTAR@ - -# H5_CFLAGS holds flags that should be used when building hdf5, -# but which should not be exported to h5cc for building other programs. -# AM_CFLAGS is an automake construct which should be used by Makefiles -# instead of CFLAGS, as CFLAGS is reserved solely for the user to define. -# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well. -AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ -AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ -AM_LDFLAGS = @AM_LDFLAGS@ @H5_LDFLAGS@ -AM_MAKEFLAGS = @AM_MAKEFLAGS@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BYTESEX = @BYTESEX@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CC_VERSION = @CC_VERSION@ -CFLAGS = @CFLAGS@ -CLEARFILEBUF = @CLEARFILEBUF@ -CODESTACK = @CODESTACK@ -CONFIG_DATE = @CONFIG_DATE@ -CONFIG_MODE = @CONFIG_MODE@ -CONFIG_USER = @CONFIG_USER@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CXX_VERSION = @CXX_VERSION@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_PKG = @DEBUG_PKG@ -DEFAULT_API_VERSION = @DEFAULT_API_VERSION@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ -DIRECT_VFD = @DIRECT_VFD@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -EXTERNAL_FILTERS = @EXTERNAL_FILTERS@ - -# Make sure that these variables are exported to the Makefiles -F9XMODEXT = @F9XMODEXT@ -F9XMODFLAG = @F9XMODFLAG@ -F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ -FC = @FC@ -FCFLAGS = @FCFLAGS@ -FCFLAGS_f90 = @FCFLAGS_f90@ -FCLIBS = @FCLIBS@ -FC_VERSION = @FC_VERSION@ -FGREP = @FGREP@ -FORTRAN_C_LONG_DOUBLE_IS_UNIQUE = @FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@ -FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ -FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ -FSEARCH_DIRS = @FSEARCH_DIRS@ -GREP = @GREP@ -H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ -H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ -H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ -H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ -H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ -H5_CFLAGS = @H5_CFLAGS@ -H5_CPPFLAGS = @H5_CPPFLAGS@ -H5_CXXFLAGS = @H5_CXXFLAGS@ -H5_FCFLAGS = @H5_FCFLAGS@ -H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@ -H5_LDFLAGS = @H5_LDFLAGS@ -H5_VERSION = @H5_VERSION@ -HADDR_T = @HADDR_T@ -HAVE_DMALLOC = @HAVE_DMALLOC@ -HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@ -HAVE_PTHREAD = @HAVE_PTHREAD@ -HDF5_HL = @HDF5_HL@ -HDF5_INTERFACES = @HDF5_INTERFACES@ -HDF_CXX = @HDF_CXX@ -HDF_FORTRAN = @HDF_FORTRAN@ -HID_T = @HID_T@ -HL = @HL@ -HL_FOR = @HL_FOR@ -HSIZE_T = @HSIZE_T@ -HSSIZE_T = @HSSIZE_T@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTRUMENT = @INSTRUMENT@ -INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LL_PATH = @LL_PATH@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_STATIC_EXEC = @LT_STATIC_EXEC@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -MPE = @MPE@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJECT_NAMELEN_DEFAULT_F = @OBJECT_NAMELEN_DEFAULT_F@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PAC_C_MAX_REAL_PRECISION = @PAC_C_MAX_REAL_PRECISION@ -PAC_FC_ALL_INTEGER_KINDS = @PAC_FC_ALL_INTEGER_KINDS@ -PAC_FC_ALL_INTEGER_KINDS_SIZEOF = @PAC_FC_ALL_INTEGER_KINDS_SIZEOF@ -PAC_FC_ALL_REAL_KINDS = @PAC_FC_ALL_REAL_KINDS@ -PAC_FC_ALL_REAL_KINDS_SIZEOF = @PAC_FC_ALL_REAL_KINDS_SIZEOF@ -PAC_FC_MAX_REAL_PRECISION = @PAC_FC_MAX_REAL_PRECISION@ -PAC_FORTRAN_NATIVE_DOUBLE_KIND = @PAC_FORTRAN_NATIVE_DOUBLE_KIND@ -PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF = @PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF@ -PAC_FORTRAN_NATIVE_INTEGER_KIND = @PAC_FORTRAN_NATIVE_INTEGER_KIND@ -PAC_FORTRAN_NATIVE_INTEGER_SIZEOF = @PAC_FORTRAN_NATIVE_INTEGER_SIZEOF@ -PAC_FORTRAN_NATIVE_REAL_KIND = @PAC_FORTRAN_NATIVE_REAL_KIND@ -PAC_FORTRAN_NATIVE_REAL_SIZEOF = @PAC_FORTRAN_NATIVE_REAL_SIZEOF@ -PARALLEL = @PARALLEL@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -ROOT = @ROOT@ -RUNPARALLEL = @RUNPARALLEL@ -RUNSERIAL = @RUNSERIAL@ -R_INTEGER = @R_INTEGER@ -R_LARGE = @R_LARGE@ -SEARCH = @SEARCH@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SIZE_T = @SIZE_T@ -STATIC_EXEC = @STATIC_EXEC@ -STATIC_SHARED = @STATIC_SHARED@ -STRICT_FORMAT_CHECKS = @STRICT_FORMAT_CHECKS@ -STRIP = @STRIP@ -TESTPARALLEL = @TESTPARALLEL@ -THREADSAFE = @THREADSAFE@ -TIME = @TIME@ -TR = @TR@ -TRACE_API = @TRACE_API@ -UNAME_INFO = @UNAME_INFO@ -USE_FILTER_DEFLATE = @USE_FILTER_DEFLATE@ -USE_FILTER_SZIP = @USE_FILTER_SZIP@ -USINGMEMCHECKER = @USINGMEMCHECKER@ -VERSION = @VERSION@ -WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -ac_ct_FC = @ac_ct_FC@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ - -# Install directories that automake doesn't know about -docdir = $(exec_prefix)/doc -dvidir = @dvidir@ -enable_shared = @enable_shared@ -enable_static = @enable_static@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ - -# Shell commands used in Makefiles -RM = rm -f -CP = cp - -# Some machines need a command to run executables; this is that command -# so that our tests will run. -# We use RUNEXEC instead of RUNSERIAL directly because it may be that -# some tests need to be run with a different command. Older versions -# of the makefiles used the command -# $(LIBTOOL) --mode=execute -# in some directories, for instance. -RUNEXEC = $(RUNSERIAL) - -# Libraries to link to while building -LIBHDF5 = $(top_builddir)/src/libhdf5.la -LIBH5TEST = $(top_builddir)/test/libh5test.la -LIBH5F = $(top_builddir)/fortran/src/libhdf5_fortran.la -LIBH5FTEST = $(top_builddir)/fortran/test/libh5test_fortran.la -LIBH5CPP = $(top_builddir)/c++/src/libhdf5_cpp.la -LIBH5TOOLS = $(top_builddir)/tools/lib/libh5tools.la -LIBH5_HL = $(top_builddir)/hl/src/libhdf5_hl.la -LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la -LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la - -# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below -# has been removed. According to the official description of DESTDIR by Gnu at -# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is -# prepended to the normal and complete install path that it precedes for the -# purpose of installing in a temporary directory which is useful for building -# rpms and other packages. The '/' after ${DESTDIR} will be followed by another -# '/' at the beginning of the normal install path. When DESTDIR is empty the -# path then begins with '//', which is incorrect and causes problems at least for -# Cygwin. - -# Scripts used to build examples -# If only shared libraries have been installed, have h5cc build examples with -# shared libraries instead of static libraries -H5CC = ${DESTDIR}$(bindir)/h5cc -H5CC_PP = ${DESTDIR}$(bindir)/h5pcc -H5FC = ${DESTDIR}$(bindir)/h5fc -H5FC_PP = ${DESTDIR}$(bindir)/h5pfc -H5CPP = ${DESTDIR}$(bindir)/h5c++ -ACLOCAL_AMFLAGS = "-I m4" - -# The trace script; this is used on source files from the C library to -# insert tracing macros. -TRACE = perl $(top_srcdir)/bin/trace - -# .chkexe files are used to mark tests that have run successfully. -# .chklog files are output from those tests. -# *.clog and *.clog2 are from the MPE option. -CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 - -# Add libtool shared library version numbers to the HDF5 library -# See libtool versioning documentation online. -# After making changes, run bin/reconfigure to update other configure related -# files like Makefile.in. -LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 219 -LT_VERS_AGE = 0 - -# Our main target, the HDF5 library -lib_LTLIBRARIES = libhdf5.la - -# Add libtool numbers to the HDF5 library (from config/lt_vers.am) -libhdf5_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS) - -# H5Tinit.c and H5lib_settings.c are generated files and should be cleaned. -MOSTLYCLEANFILES = H5Tinit.c H5lib_settings.c -# H5pubconf.h is generated by configure, and should be cleaned. -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 H5ACmpio.c \ - H5B.c H5Bcache.c H5Bdbg.c \ - H5B2.c H5B2cache.c H5B2dbg.c H5B2hdr.c H5B2int.c H5B2stat.c H5B2test.c \ - H5C.c H5Cmpio.c \ - H5CS.c \ - H5D.c H5Dbtree.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \ - H5Ddeprec.c H5Defl.c H5Dfill.c H5Dint.c \ - H5Dio.c H5Dlayout.c \ - H5Dmpio.c H5Doh.c H5Dscatgath.c H5Dselect.c H5Dtest.c \ - H5E.c H5Edeprec.c H5Eint.c \ - H5EA.c H5EAcache.c H5EAdbg.c H5EAdblkpage.c H5EAdblock.c H5EAhdr.c \ - H5EAiblock.c H5EAint.c H5EAsblock.c H5EAstat.c H5EAtest.c \ - H5F.c H5Fint.c H5Faccum.c H5Fcwfs.c \ - H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c H5Fio.c \ - H5Fmount.c H5Fmpi.c H5Fquery.c \ - H5Fsfile.c H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \ - H5FA.c H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \ - H5FAstat.c H5FAtest.c \ - H5FD.c H5FDcore.c \ - H5FDdirect.c H5FDfamily.c H5FDint.c H5FDlog.c H5FDmpi.c H5FDmpio.c \ - H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c \ - H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSsection.c H5FSstat.c H5FStest.c \ - H5G.c H5Gbtree2.c H5Gcache.c \ - H5Gcompact.c H5Gdense.c H5Gdeprec.c H5Gent.c \ - H5Gint.c H5Glink.c \ - H5Gloc.c H5Gname.c H5Gnode.c H5Gobj.c H5Goh.c H5Groot.c H5Gstab.c H5Gtest.c \ - H5Gtraverse.c \ - H5HF.c H5HFbtree2.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \ - H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c H5HFsection.c \ - H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \ - H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c \ - H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c \ - H5HP.c H5I.c H5Itest.c H5L.c H5Lexternal.c H5lib_settings.c \ - H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \ - H5MM.c H5MP.c H5MPtest.c \ - H5O.c H5Oainfo.c H5Oalloc.c H5Oattr.c \ - H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c H5Ochunk.c \ - H5Ocont.c H5Ocopy.c H5Odbg.c H5Odrvinfo.c H5Odtype.c H5Oefl.c \ - H5Ofill.c H5Ofsinfo.c H5Oginfo.c \ - H5Olayout.c \ - H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c \ - H5Oname.c H5Onull.c H5Opline.c H5Orefcount.c \ - H5Osdspace.c H5Oshared.c H5Ostab.c \ - H5Oshmesg.c H5Otest.c H5Ounknown.c \ - H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c \ - H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \ - H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \ - H5Pgcpl.c H5Pint.c \ - H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \ - H5PL.c \ - H5R.c H5Rdeprec.c \ - H5UC.c \ - H5RS.c \ - H5S.c H5Sall.c H5Sdbg.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c \ - H5Sselect.c H5Stest.c \ - H5SL.c \ - H5SM.c H5SMbtree2.c H5SMcache.c H5SMmessage.c H5SMtest.c \ - H5ST.c \ - H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c H5Tcompound.c H5Tconv.c \ - H5Tcset.c H5Tdbg.c H5Tdeprec.c H5Tenum.c H5Tfields.c \ - H5Tfixed.c \ - H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c \ - H5Topaque.c \ - H5Torder.c \ - H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c H5VM.c H5WB.c H5Z.c \ - H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c H5Zszip.c \ - H5Zscaleoffset.c H5Ztrans.c - - -# Public headers -include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5version.h \ - H5Apublic.h H5ACpublic.h \ - H5Cpublic.h H5Dpublic.h \ - H5Epubgen.h H5Epublic.h H5Fpublic.h \ - H5FDpublic.h H5FDcore.h H5FDdirect.h \ - H5FDfamily.h H5FDlog.h H5FDmpi.h H5FDmpio.h \ - H5FDmulti.h H5FDsec2.h H5FDstdio.h \ - H5Gpublic.h H5Ipublic.h H5Lpublic.h \ - H5MMpublic.h H5Opublic.h H5Ppublic.h \ - H5PLextern.h H5PLpublic.h \ - H5Rpublic.h H5Spublic.h \ - H5Tpublic.h H5Zpublic.h - - -# install libhdf5.settings in lib directory -settingsdir = $(libdir) -settings_DATA = libhdf5.settings - -# Automake needs to be taught how to build lib, progs, and tests targets. -# These will be filled in automatically for the most part (e.g., -# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG, and -# EXTRA_TEST variables are supplied to allow the user to force targets to -# be built at certain times. -LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES) \ - $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB) - -PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS) \ - $(EXTRA_PROG) - -chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST) -TEST_EXTENSIONS = .sh -SH_LOG_COMPILER = $(SHELL) -AM_SH_LOG_FLAGS = -TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_) -TEST_PROG_PARA_CHKEXE = $(TEST_PROG_PARA:=.chkexe_) -TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_) -TEST_SCRIPT_PARA_CHKSH = $(TEST_SCRIPT_PARA:=.chkexe_) -all: H5config.h - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .log .o .obj .sh .sh$(EXEEXT) .trs -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/lt_vers.am $(top_srcdir)/config/conclude.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; -$(top_srcdir)/config/commence.am $(top_srcdir)/config/lt_vers.am $(top_srcdir)/config/conclude.am: - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -H5config.h: stamp-h1 - @test -f $@ || rm -f stamp-h1 - @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 - -stamp-h1: $(srcdir)/H5config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status src/H5config.h -$(srcdir)/H5config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) - rm -f stamp-h1 - touch $@ - -distclean-hdr: - -rm -f H5config.h stamp-h1 -libhdf5.settings: $(top_builddir)/config.status $(srcdir)/libhdf5.settings.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ - -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ - } - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -libhdf5.la: $(libhdf5_la_OBJECTS) $(libhdf5_la_DEPENDENCIES) $(EXTRA_libhdf5_la_DEPENDENCIES) - $(AM_V_CCLD)$(libhdf5_la_LINK) -rpath $(libdir) $(libhdf5_la_OBJECTS) $(libhdf5_la_LIBADD) $(LIBS) - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - -H5detect$(EXEEXT): $(H5detect_OBJECTS) $(H5detect_DEPENDENCIES) $(EXTRA_H5detect_DEPENDENCIES) - @rm -f H5detect$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(H5detect_OBJECTS) $(H5detect_LDADD) $(LIBS) - -H5make_libsettings$(EXEEXT): $(H5make_libsettings_OBJECTS) $(H5make_libsettings_DEPENDENCIES) $(EXTRA_H5make_libsettings_DEPENDENCIES) - @rm -f H5make_libsettings$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(H5make_libsettings_OBJECTS) $(H5make_libsettings_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5A.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5AC.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5ACmpio.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Abtree2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Adense.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Adeprec.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Aint.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Atest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2cache.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2dbg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2hdr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2int.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2stat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2test.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Bcache.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Bdbg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5C.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5CS.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Cmpio.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5D.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dbtree.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dchunk.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dcompact.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dcontig.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ddbg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ddeprec.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Defl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dfill.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dint.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dio.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dlayout.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dmpio.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Doh.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dscatgath.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dselect.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dtest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5E.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5EA.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5EAcache.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5EAdbg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5EAdblkpage.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5EAdblock.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5EAhdr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5EAiblock.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5EAint.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5EAsblock.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5EAstat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5EAtest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Edeprec.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Eint.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5F.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FA.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FAcache.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FAdbg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FAdblkpage.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FAdblock.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FAhdr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FAstat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FAtest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FD.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDcore.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDdirect.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDfamily.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDint.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDlog.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDmpi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDmpio.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDmulti.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDsec2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDspace.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FDstdio.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FL.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FO.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FS.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FScache.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FSdbg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FSsection.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FSstat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5FStest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Faccum.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fcwfs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fdbg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fdeprec.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fefc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ffake.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fint.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fio.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fmount.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fmpi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fquery.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fsfile.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fsuper.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Fsuper_cache.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ftest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5G.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gbtree2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gcache.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gcompact.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gdense.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gdeprec.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gent.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gint.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Glink.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gloc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gname.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gnode.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gobj.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Goh.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Groot.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gstab.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gtest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Gtraverse.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HF.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFbtree2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFcache.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFdbg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFdblock.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFdtable.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFhdr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFhuge.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFiblock.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFiter.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFman.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFsection.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFspace.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFstat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFtest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HFtiny.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HG.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HGcache.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HGdbg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HGquery.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HL.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HLcache.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HLdbg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HLint.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5HP.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5I.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Itest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5L.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Lexternal.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5MF.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5MFaggr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5MFdbg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5MFsection.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5MM.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5MP.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5MPtest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5O.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Oainfo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Oalloc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Oattr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Oattribute.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Obogus.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Obtreek.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ocache.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ochunk.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ocont.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ocopy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Odbg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Odrvinfo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Odtype.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Oefl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ofill.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ofsinfo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Oginfo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Olayout.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Olinfo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Olink.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Omessage.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Omtime.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Oname.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Onull.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Opline.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Orefcount.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Osdspace.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Oshared.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Oshmesg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ostab.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Otest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ounknown.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5P.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5PL.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pacpl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pdapl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pdcpl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pdeprec.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pdxpl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pencdec.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pfapl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pfcpl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pfmpl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pgcpl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pint.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Plapl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Plcpl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pocpl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pocpypl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pstrcpl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ptest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5R.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5RS.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Rdeprec.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5S.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5SL.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5SM.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5SMbtree2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5SMcache.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5SMmessage.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5SMtest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5ST.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Sall.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Sdbg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Shyper.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Smpio.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Snone.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Spoint.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Sselect.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Stest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5T.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5TS.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tarray.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tbit.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tcommit.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tcompound.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tconv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tcset.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tdbg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tdeprec.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tenum.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tfields.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tfixed.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tfloat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tinit.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tnative.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Toffset.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Toh.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Topaque.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Torder.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tpad.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tprecis.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tstrpad.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tvisit.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tvlen.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5UC.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VM.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5WB.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Z.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Zdeflate.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Zfletcher32.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Znbit.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Zscaleoffset.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Zshuffle.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Zszip.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ztrans.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5checksum.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5dbg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5detect.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5lib_settings.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5make_libsettings.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5system.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5timer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5trace.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-settingsDATA: $(settings_DATA) - @$(NORMAL_INSTALL) - @list='$(settings_DATA)'; test -n "$(settingsdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(settingsdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(settingsdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(settingsdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(settingsdir)" || exit $$?; \ - done - -uninstall-settingsDATA: - @$(NORMAL_UNINSTALL) - @list='$(settings_DATA)'; test -n "$(settingsdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(settingsdir)'; $(am__uninstall_files_from_dir) -install-includeHEADERS: $(include_HEADERS) - @$(NORMAL_INSTALL) - @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ - $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ - done - -uninstall-includeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -# Recover from deleted '.trs' file; this should ensure that -# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create -# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells -# to avoid problems with "make -n". -.log.trs: - rm -f $< $@ - $(MAKE) $(AM_MAKEFLAGS) $< - -# Leading 'am--fnord' is there to ensure the list of targets does not -# expand to empty, as could happen e.g. with make check TESTS=''. -am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) -am--force-recheck: - @: - -$(TEST_SUITE_LOG): $(TEST_LOGS) - @$(am__set_TESTS_bases); \ - am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ - redo_bases=`for i in $$bases; do \ - am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ - done`; \ - if test -n "$$redo_bases"; then \ - redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ - redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ - if $(am__make_dryrun); then :; else \ - rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ - fi; \ - fi; \ - if test -n "$$am__remaking_logs"; then \ - echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ - "recursion detected" >&2; \ - else \ - am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ - fi; \ - if $(am__make_dryrun); then :; else \ - st=0; \ - errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ - for i in $$redo_bases; do \ - test -f $$i.trs && test -r $$i.trs \ - || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ - test -f $$i.log && test -r $$i.log \ - || { echo "$$errmsg $$i.log" >&2; st=1; }; \ - done; \ - test $$st -eq 0 || exit 1; \ - fi - @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ - ws='[ ]'; \ - results=`for b in $$bases; do echo $$b.trs; done`; \ - test -n "$$results" || results=/dev/null; \ - all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ - pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ - fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ - skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ - xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ - xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ - error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ - if test `expr $$fail + $$xpass + $$error` -eq 0; then \ - success=true; \ - else \ - success=false; \ - fi; \ - br='==================='; br=$$br$$br$$br$$br; \ - result_count () \ - { \ - if test x"$$1" = x"--maybe-color"; then \ - maybe_colorize=yes; \ - elif test x"$$1" = x"--no-color"; then \ - maybe_colorize=no; \ - else \ - echo "$@: invalid 'result_count' usage" >&2; exit 4; \ - fi; \ - shift; \ - desc=$$1 count=$$2; \ - if test $$maybe_colorize = yes && test $$count -gt 0; then \ - color_start=$$3 color_end=$$std; \ - else \ - color_start= color_end=; \ - fi; \ - echo "$${color_start}# $$desc $$count$${color_end}"; \ - }; \ - create_testsuite_report () \ - { \ - result_count $$1 "TOTAL:" $$all "$$brg"; \ - result_count $$1 "PASS: " $$pass "$$grn"; \ - result_count $$1 "SKIP: " $$skip "$$blu"; \ - result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ - result_count $$1 "FAIL: " $$fail "$$red"; \ - result_count $$1 "XPASS:" $$xpass "$$red"; \ - result_count $$1 "ERROR:" $$error "$$mgn"; \ - }; \ - { \ - echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ - $(am__rst_title); \ - create_testsuite_report --no-color; \ - echo; \ - echo ".. contents:: :depth: 2"; \ - echo; \ - for b in $$bases; do echo $$b; done \ - | $(am__create_global_log); \ - } >$(TEST_SUITE_LOG).tmp || exit 1; \ - mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ - if $$success; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ - fi; \ - echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ - echo "$${col}$$br$${std}"; \ - create_testsuite_report --maybe-color; \ - echo "$$col$$br$$std"; \ - if $$success; then :; else \ - echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ - if test -n "$(PACKAGE_BUGREPORT)"; then \ - echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ - fi; \ - echo "$$col$$br$$std"; \ - fi; \ - $$success || exit 1 -recheck: all - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - bases=`for i in $$bases; do echo $$i; done \ - | $(am__list_recheck_tests)` || exit 1; \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - log_list=`echo $$log_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ - am__force_recheck=am--force-recheck \ - TEST_LOGS="$$log_list"; \ - exit $$? -.sh.log: - @p='$<'; \ - $(am__set_b); \ - $(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -@am__EXEEXT_TRUE@.sh$(EXEEXT).log: -@am__EXEEXT_TRUE@ @p='$<'; \ -@am__EXEEXT_TRUE@ $(am__set_b); \ -@am__EXEEXT_TRUE@ $(am__check_pre) $(SH_LOG_DRIVER) --test-name "$$f" \ -@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ -@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_SH_LOG_DRIVER_FLAGS) $(SH_LOG_DRIVER_FLAGS) -- $(SH_LOG_COMPILE) \ -@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: check-am -all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) $(HEADERS) \ - H5config.h all-local -installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(settingsdir)" "$(DESTDIR)$(includedir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) - -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) - -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) - -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ - clean-noinstPROGRAMS mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-hdr distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-includeHEADERS install-settingsDATA - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: install-libLTLIBRARIES - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool mostlyclean-local - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \ - uninstall-settingsDATA - -.MAKE: all check-am install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am all-local check check-TESTS \ - check-am clean clean-generic clean-libLTLIBRARIES \ - clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-hdr distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-includeHEADERS install-info install-info-am \ - install-libLTLIBRARIES install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-settingsDATA install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \ - pdf-am ps ps-am recheck tags tags-am uninstall uninstall-am \ - uninstall-includeHEADERS uninstall-libLTLIBRARIES \ - uninstall-settingsDATA - - -# List all build rules defined by HDF5 Makefiles as "PHONY" targets here. -# This tells the Makefiles that these targets are not files to be built but -# commands that should be executed even if a file with the same name already -# exists. -.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \ - build-tests check-clean check-install check-p check-s check-vfd \ - install-doc lib progs tests uninstall-doc _exec_check-s _test help - -help: - @$(top_srcdir)/bin/makehelp - -# 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 files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. - -# Number format detection -# The LD_LIBRARY_PATH setting is a kludge. -# Things should have been all set during H5detect making. -# Remove the generated .c file if errors occur unless HDF5_Make_Ignore -# is set to ignore the error. -H5Tinit.c: H5detect$(EXEEXT) - LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) | \ - sed -e 's/-L/:/g' -e 's/ //g'`" \ - $(RUNSERIAL) ./H5detect$(EXEEXT) > $@ || \ - (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ - ($(RM) $@ ; exit 1) - -# Build configuration header file generation -# The LD_LIBRARY_PATH setting is a kludge. -# Things should have been all set during H5make_libsettings making. -# Remove the generated .c file if errors occur unless HDF5_Make_Ignore -# is set to ignore the error. -H5lib_settings.c: H5make_libsettings$(EXEEXT) libhdf5.settings - LD_LIBRARY_PATH="$$LD_LIBRARY_PATH`echo $(LDFLAGS) | \ - sed -e 's/-L/:/g' -e 's/ //g'`" \ - $(RUNSERIAL) ./H5make_libsettings$(EXEEXT) > $@ || \ - (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ - ($(RM) $@ ; exit 1) - -# Error header generation -# -# Actually, H5Einit.h, H5Eterm.h, H5Edefin.h and H5Epubgen.h all -# depend on H5err.txt, but the perl script generates them all, so just -# list one here. -$(top_srcdir)/src/H5Edefin.h: $(top_srcdir)/src/H5err.txt - perl $(top_srcdir)/bin/make_err $? - -# API version macro generation -$(top_srcdir)/src/H5version.h: $(top_srcdir)/src/H5vers.txt - perl $(top_srcdir)/bin/make_vers $? - -# Assignment overflow macro generation -$(top_srcdir)/src/H5overflow.h: $(top_srcdir)/src/H5overflow.txt - perl $(top_srcdir)/bin/make_overflow $? - -# Add TRACE macros to library source files. This is done via the trace script -# in the hdf5/bin directory. If the file contains HDF5 API macros, a "clean" -# version of the source file is saved with a tilde (~) after its name and -# tracing information is inserted. trace should have no effect on files -# without HDF5 macros. -.PHONY: trace - -trace: $(libhdf5_la_SOURCES) - @for dep in $? dummy; do \ - if test $$dep != "dummy" -a -n "$(PERL)"; then \ - case "$$dep" in \ - *.c) \ - $(TRACE) $$dep; \ - ;; \ - esac; \ - fi; \ - done - -# lib/progs/tests targets recurse into subdirectories. build-* targets -# build files in this directory. -build-lib: $(LIB) -build-progs: $(LIB) $(PROGS) -build-tests: $(LIB) $(PROGS) $(chk_TESTS) - -# General rule for recursive building targets. -# BUILT_SOURCES contain targets that need to be built before anything else -# in the directory (e.g., for Fortran type detection) -lib progs tests check-s check-p :: $(BUILT_SOURCES) - @$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1; - @for d in X $(SUBDIRS); do \ - if test $$d != X && test $$d != .; then \ - (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ - fi; \ - done - -# General rule for recursive cleaning targets. Like the rule above, -# but doesn't require building BUILT_SOURCES. -check-clean :: - @$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1; - @for d in X $(SUBDIRS); do \ - if test $$d != X && test $$d != .; then \ - (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ - fi; \ - done - -# Tell Automake to build tests when the user types `make all' (this is -# not its default behavior). Also build EXTRA_LIB and EXTRA_PROG since -# Automake won't build them automatically, either. -all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS) - -# make install-doc doesn't do anything outside of doc directory, but -# Makefiles should recognize it. -# UPDATE: docs no longer reside in this build tree, so this target -# is depreciated. -install-doc uninstall-doc: - @echo "Nothing to be done." - -# clean up files generated by tests so they can be re-run. -build-check-clean: - $(RM) -rf $(CHECK_CLEANFILES) - -# run check-clean whenever mostlyclean is run -mostlyclean-local: build-check-clean - -# check-install is just a synonym for installcheck -check-install: installcheck - -# Run each test in order, passing $(TEST_FLAGS) to the program. -# Since tests are done in a shell loop, "make -i" does apply inside it. -# Set HDF5_Make_Ignore to a non-blank string to ignore errors inside the loop. -# The timestamps give a rough idea how much time the tests use. -# -# Note that targets in chk_TESTS (defined above) will be built when the user -# types 'make tests' or 'make check', but only programs in TEST_PROG, -# TEST_PROG_PARA, or TEST_SCRIPT will actually be executed. -check-TESTS: test - -test _test: - @$(MAKE) build-check-s - @$(MAKE) build-check-p - -# Actual execution of check-s. -build-check-s: $(LIB) $(PROGS) $(chk_TESTS) - @if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then \ - echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \ - fi - @$(MAKE) $(AM_MAKEFLAGS) _exec_check-s - @if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then \ - echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\ - fi - -_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH) - -# The dummy.chkexe here prevents the target from being -# empty if there are no tests in the current directory. -# $${log} is the log file. -# $${tname} is the name of test. -$(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: - @if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \ - tname=$(@:.chkexe_=)$(EXEEXT);\ - log=$(@:.chkexe_=.chklog); \ - echo "============================"; \ - if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \ - echo "No need to test $${tname} again."; \ - else \ - echo "============================" > $${log}; \ - if test "X$(FORTRAN_API)" = "Xyes"; then \ - echo "Fortran API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ - echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ - elif test "X$(CXX_API)" = "Xyes"; then \ - echo "C++ API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ - echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log};\ - else \ - echo "Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \ - echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ - fi; \ - echo "============================" >> $${log}; \ - srcdir="$(srcdir)" \ - $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ - && touch $(@:.chkexe_=.chkexe) || \ - (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ - (cat $${log} && false) || exit 1; \ - echo "" >> $${log}; \ - echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \ - echo "============================" >> $${log}; \ - echo "Finished testing $${tname} $(TEST_FLAGS)"; \ - cat $${log}; \ - fi; \ - fi - -# The dummysh.chkexe here prevents the target from being -# empty if there are no tests in the current directory. -# $${log} is the log file. -# $${tname} is the name of test. -$(TEST_SCRIPT_CHKSH) $(TEST_SCRIPT_PARA_CHKSH) dummysh.chkexe_: - @if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \ - cmd=$(@:.chkexe_=);\ - tname=`basename $$cmd`;\ - chkname=`basename $(@:.chkexe_=.chkexe)`;\ - log=`basename $(@:.chkexe_=.chklog)`; \ - echo "============================"; \ - if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \ - echo "No need to test $${tname} again."; \ - else \ - echo "============================" > $${log}; \ - if test "X$(FORTRAN_API)" = "Xyes"; then \ - echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \ - echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ - elif test "X$(CXX_API)" = "Xyes"; then \ - echo "C++ API: Testing $${tname} $(TEST_FLAGS)"; \ - echo "C++ API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ - else \ - echo "Testing $${tname} $(TEST_FLAGS)"; \ - echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ - fi; \ - echo "============================" >> $${log}; \ - RUNSERIAL="$(RUNSERIAL)" RUNPARALLEL="$(RUNPARALLEL)" \ - srcdir="$(srcdir)" \ - $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \ - && touch $${chkname} || \ - (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ - (cat $${log} && false) || exit 1; \ - echo "" >> $${log}; \ - echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \ - echo "============================" >> $${log}; \ - echo "Finished testing $${tname} $(TEST_FLAGS)"; \ - cat $${log}; \ - fi; \ - echo "============================"; \ - fi - -# Actual execution of check-p. -build-check-p: $(LIB) $(PROGS) $(chk_TESTS) - @if test -n "$(TEST_PROG_PARA)$(TEST_SCRIPT_PARA)"; then \ - echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \ - fi - @if test -n "$(TEST_PROG_PARA)"; then \ - echo "**** Hint ****"; \ - echo "Parallel test files reside in the current directory" \ - "by default."; \ - echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \ - echo " HDF5_PARAPREFIX=/PFS/user/me"; \ - echo " export HDF5_PARAPREFIX"; \ - echo " make check"; \ - echo "**** end of Hint ****"; \ - fi - @for test in $(TEST_PROG_PARA) dummy; do \ - if test $$test != dummy; then \ - $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNEXEC="$(RUNPARALLEL)" || exit 1; \ - fi; \ - done - @for test in $(TEST_SCRIPT_PARA) dummy; do \ - if test $$test != dummy; then \ - $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ || exit 1; \ - fi; \ - done - @if test -n "$(TEST_PROG_PARA)$(TEST_SCRIPT_PARA)"; then \ - echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\ - fi - -# Run test with different Virtual File Driver -check-vfd: $(LIB) $(PROGS) $(chk_TESTS) - @for vfd in $(VFD_LIST) dummy; do \ - if test $$vfd != dummy; then \ - echo "============================"; \ - echo "Testing Virtual File Driver $$vfd"; \ - echo "============================"; \ - $(MAKE) $(AM_MAKEFLAGS) check-clean || exit 1; \ - HDF5_DRIVER=$$vfd $(MAKE) $(AM_MAKEFLAGS) check || exit 1; \ - fi; \ - done - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: |