summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2015-09-14 20:22:39 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2015-09-14 20:22:39 (GMT)
commit81e4ce7805a034e7684f48a208621180cc168921 (patch)
treec6f3187d6a49a314674d642eabda0554386c90b9 /src
parentc3649ea51764b1e7d2b82ca3d5a2ba4053f34a6d (diff)
parentb2f94f9faf805035e4d0e9cb76007204c8250e58 (diff)
downloadhdf5-81e4ce7805a034e7684f48a208621180cc168921.zip
hdf5-81e4ce7805a034e7684f48a208621180cc168921.tar.gz
hdf5-81e4ce7805a034e7684f48a208621180cc168921.tar.bz2
[svn-r27777] merge from trunk.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt10
-rw-r--r--src/H5.c97
-rw-r--r--src/H5A.c120
-rw-r--r--src/H5AC.c165
-rw-r--r--src/H5ACmodule.h35
-rw-r--r--src/H5ACmpio.c33
-rw-r--r--src/H5ACpkg.h2
-rw-r--r--src/H5ACprivate.h18
-rw-r--r--src/H5Abtree2.c26
-rw-r--r--src/H5Adense.c8
-rw-r--r--src/H5Adeprec.c52
-rw-r--r--src/H5Aint.c70
-rw-r--r--src/H5Amodule.h35
-rw-r--r--src/H5Apkg.h4
-rw-r--r--src/H5Atest.c4
-rw-r--r--src/H5B.c13
-rw-r--r--src/H5B2.c10
-rw-r--r--src/H5B2cache.c8
-rw-r--r--src/H5B2dbg.c82
-rw-r--r--src/H5B2hdr.c9
-rw-r--r--src/H5B2int.c7
-rw-r--r--src/H5B2module.h36
-rw-r--r--src/H5B2pkg.h2
-rw-r--r--src/H5B2private.h6
-rw-r--r--src/H5B2stat.c2
-rw-r--r--src/H5B2test.c59
-rw-r--r--src/H5Bcache.c4
-rw-r--r--src/H5Bdbg.c2
-rw-r--r--src/H5Bmodule.h35
-rw-r--r--src/H5Bpkg.h2
-rw-r--r--src/H5C.c1538
-rw-r--r--src/H5CS.c167
-rw-r--r--src/H5CSprivate.h22
-rw-r--r--src/H5Cmodule.h35
-rw-r--r--src/H5Cmpio.c4
-rw-r--r--src/H5Cpkg.h457
-rw-r--r--src/H5Cprivate.h77
-rw-r--r--src/H5D.c53
-rw-r--r--src/H5Dbtree.c12
-rw-r--r--src/H5Dchunk.c20
-rw-r--r--src/H5Dcompact.c6
-rw-r--r--src/H5Dcontig.c85
-rw-r--r--src/H5Ddbg.c25
-rw-r--r--src/H5Ddeprec.c54
-rw-r--r--src/H5Defl.c6
-rw-r--r--src/H5Dfill.c3
-rw-r--r--src/H5Dint.c274
-rw-r--r--src/H5Dio.c2
-rw-r--r--src/H5Dlayout.c69
-rw-r--r--src/H5Dmodule.h35
-rw-r--r--src/H5Dmpio.c2
-rw-r--r--src/H5Doh.c18
-rw-r--r--src/H5Dpkg.h10
-rw-r--r--src/H5Dscatgath.c2
-rw-r--r--src/H5Dselect.c2
-rw-r--r--src/H5Dtest.c2
-rw-r--r--src/H5E.c140
-rw-r--r--src/H5EA.c5
-rw-r--r--src/H5EAcache.c2
-rw-r--r--src/H5EAdbg.c2
-rw-r--r--src/H5EAdblkpage.c2
-rw-r--r--src/H5EAdblock.c2
-rw-r--r--src/H5EAhdr.c2
-rw-r--r--src/H5EAiblock.c2
-rw-r--r--src/H5EAint.c2
-rw-r--r--src/H5EAmodule.h35
-rw-r--r--src/H5EApkg.h12
-rw-r--r--src/H5EAsblock.c2
-rw-r--r--src/H5EAstat.c2
-rw-r--r--src/H5EAtest.c2
-rw-r--r--src/H5Edefin.h1
-rw-r--r--src/H5Edeprec.c50
-rw-r--r--src/H5Einit.h5
-rw-r--r--src/H5Eint.c28
-rw-r--r--src/H5Emodule.h36
-rw-r--r--src/H5Epkg.h2
-rw-r--r--src/H5Epubgen.h2
-rw-r--r--src/H5Eterm.h3
-rw-r--r--src/H5F.c69
-rw-r--r--src/H5FA.c5
-rw-r--r--src/H5FAcache.c2
-rw-r--r--src/H5FAdbg.c2
-rw-r--r--src/H5FAdblkpage.c2
-rw-r--r--src/H5FAdblock.c2
-rw-r--r--src/H5FAhdr.c2
-rw-r--r--src/H5FAmodule.h35
-rw-r--r--src/H5FApkg.h12
-rw-r--r--src/H5FAstat.c2
-rw-r--r--src/H5FAtest.c2
-rw-r--r--src/H5FD.c76
-rw-r--r--src/H5FDcore.c265
-rw-r--r--src/H5FDdirect.c34
-rw-r--r--src/H5FDdrvr_module.h35
-rw-r--r--src/H5FDfamily.c22
-rw-r--r--src/H5FDint.c31
-rw-r--r--src/H5FDlog.c45
-rw-r--r--src/H5FDmodule.h35
-rw-r--r--src/H5FDmpio.c14
-rw-r--r--src/H5FDpkg.h3
-rw-r--r--src/H5FDsec2.c37
-rw-r--r--src/H5FDspace.c33
-rw-r--r--src/H5FDstdio.c57
-rw-r--r--src/H5FL.c687
-rw-r--r--src/H5FLmodule.h35
-rw-r--r--src/H5FO.c2
-rw-r--r--src/H5FS.c13
-rw-r--r--src/H5FScache.c28
-rw-r--r--src/H5FSdbg.c4
-rw-r--r--src/H5FSmodule.h35
-rw-r--r--src/H5FSpkg.h2
-rw-r--r--src/H5FSsection.c6
-rw-r--r--src/H5FSstat.c4
-rw-r--r--src/H5FStest.c4
-rw-r--r--src/H5Faccum.c2
-rw-r--r--src/H5Fcwfs.c14
-rw-r--r--src/H5Fdbg.c6
-rw-r--r--src/H5Fdeprec.c50
-rw-r--r--src/H5Fefc.c4
-rw-r--r--src/H5Ffake.c29
-rw-r--r--src/H5Fint.c39
-rw-r--r--src/H5Fio.c2
-rw-r--r--src/H5Fmodule.h35
-rw-r--r--src/H5Fmount.c29
-rw-r--r--src/H5Fmpi.c2
-rw-r--r--src/H5Fpkg.h4
-rw-r--r--src/H5Fprivate.h6
-rw-r--r--src/H5Fquery.c4
-rw-r--r--src/H5Fsfile.c2
-rw-r--r--src/H5Fsuper.c113
-rw-r--r--src/H5Fsuper_cache.c18
-rw-r--r--src/H5Ftest.c8
-rw-r--r--src/H5G.c117
-rw-r--r--src/H5Gbtree2.c28
-rw-r--r--src/H5Gcache.c4
-rw-r--r--src/H5Gcompact.c12
-rw-r--r--src/H5Gdense.c12
-rw-r--r--src/H5Gdeprec.c54
-rw-r--r--src/H5Gent.c2
-rw-r--r--src/H5Gint.c45
-rw-r--r--src/H5Glink.c6
-rw-r--r--src/H5Gloc.c6
-rw-r--r--src/H5Gmodule.h35
-rw-r--r--src/H5Gname.c12
-rw-r--r--src/H5Gnode.c4
-rw-r--r--src/H5Gobj.c10
-rw-r--r--src/H5Goh.c14
-rw-r--r--src/H5Gpkg.h4
-rw-r--r--src/H5Gprivate.h6
-rw-r--r--src/H5Groot.c4
-rw-r--r--src/H5Gstab.c10
-rw-r--r--src/H5Gtest.c2
-rw-r--r--src/H5Gtraverse.c2
-rw-r--r--src/H5HF.c76
-rw-r--r--src/H5HFbtree2.c92
-rw-r--r--src/H5HFcache.c8
-rw-r--r--src/H5HFdbg.c76
-rw-r--r--src/H5HFdblock.c5
-rw-r--r--src/H5HFdtable.c9
-rw-r--r--src/H5HFhdr.c9
-rw-r--r--src/H5HFhuge.c91
-rw-r--r--src/H5HFiblock.c5
-rw-r--r--src/H5HFiter.c3
-rw-r--r--src/H5HFman.c38
-rw-r--r--src/H5HFmodule.h35
-rw-r--r--src/H5HFpkg.h8
-rw-r--r--src/H5HFprivate.h4
-rw-r--r--src/H5HFsection.c27
-rw-r--r--src/H5HFspace.c5
-rw-r--r--src/H5HFstat.c3
-rw-r--r--src/H5HFtest.c15
-rw-r--r--src/H5HFtiny.c2
-rw-r--r--src/H5HG.c13
-rw-r--r--src/H5HGcache.c4
-rw-r--r--src/H5HGdbg.c2
-rw-r--r--src/H5HGmodule.h35
-rw-r--r--src/H5HGpkg.h2
-rw-r--r--src/H5HGprivate.h6
-rw-r--r--src/H5HGquery.c2
-rw-r--r--src/H5HL.c15
-rw-r--r--src/H5HLcache.c6
-rw-r--r--src/H5HLdbg.c3
-rw-r--r--src/H5HLint.c32
-rw-r--r--src/H5HLmodule.h35
-rw-r--r--src/H5HLpkg.h2
-rw-r--r--src/H5I.c144
-rw-r--r--src/H5Imodule.h35
-rw-r--r--src/H5Ipkg.h2
-rw-r--r--src/H5Itest.c4
-rw-r--r--src/H5L.c45
-rw-r--r--src/H5Lexternal.c92
-rw-r--r--src/H5Lmodule.h36
-rw-r--r--src/H5Lpkg.h2
-rw-r--r--src/H5MF.c97
-rw-r--r--src/H5MFaggr.c10
-rw-r--r--src/H5MFdbg.c4
-rw-r--r--src/H5MFmodule.h35
-rw-r--r--src/H5MFpkg.h2
-rw-r--r--src/H5MFsection.c14
-rw-r--r--src/H5MP.c11
-rw-r--r--src/H5MPmodule.h35
-rw-r--r--src/H5MPpkg.h2
-rw-r--r--src/H5MPtest.c2
-rw-r--r--src/H5O.c61
-rw-r--r--src/H5Oainfo.c13
-rw-r--r--src/H5Oalloc.c11
-rw-r--r--src/H5Oattr.c16
-rw-r--r--src/H5Oattribute.c17
-rw-r--r--src/H5Obogus.c3
-rw-r--r--src/H5Obtreek.c7
-rw-r--r--src/H5Ocache.c28
-rw-r--r--src/H5Ochunk.c5
-rw-r--r--src/H5Ocont.c7
-rw-r--r--src/H5Ocopy.c3
-rw-r--r--src/H5Odbg.c28
-rw-r--r--src/H5Odrvinfo.c9
-rw-r--r--src/H5Odtype.c44
-rw-r--r--src/H5Oefl.c14
-rw-r--r--src/H5Ofill.c13
-rw-r--r--src/H5Ofsinfo.c13
-rw-r--r--src/H5Oginfo.c9
-rw-r--r--src/H5Olayout.c59
-rw-r--r--src/H5Olinfo.c19
-rw-r--r--src/H5Olink.c23
-rw-r--r--src/H5Omessage.c45
-rw-r--r--src/H5Omodule.h35
-rw-r--r--src/H5Omtime.c11
-rw-r--r--src/H5Oname.c13
-rw-r--r--src/H5Onull.c3
-rw-r--r--src/H5Opkg.h2
-rw-r--r--src/H5Opline.c11
-rw-r--r--src/H5Oprivate.h6
-rw-r--r--src/H5Orefcount.c13
-rw-r--r--src/H5Osdspace.c12
-rw-r--r--src/H5Oshared.c6
-rw-r--r--src/H5Oshared.h6
-rw-r--r--src/H5Oshmesg.c11
-rw-r--r--src/H5Ostab.c19
-rw-r--r--src/H5Otest.c12
-rw-r--r--src/H5Ounknown.c3
-rw-r--r--src/H5P.c53
-rw-r--r--src/H5PL.c193
-rw-r--r--src/H5PLmodule.h36
-rw-r--r--src/H5Pacpl.c4
-rw-r--r--src/H5Pdapl.c5
-rw-r--r--src/H5Pdcpl.c18
-rw-r--r--src/H5Pdeprec.c50
-rw-r--r--src/H5Pdxpl.c17
-rw-r--r--src/H5Pencdec.c34
-rw-r--r--src/H5Pfapl.c3
-rw-r--r--src/H5Pfcpl.c3
-rw-r--r--src/H5Pfmpl.c3
-rw-r--r--src/H5Pgcpl.c4
-rw-r--r--src/H5Pint.c231
-rw-r--r--src/H5Plapl.c4
-rw-r--r--src/H5Plcpl.c3
-rw-r--r--src/H5Pmodule.h35
-rw-r--r--src/H5Pocpl.c8
-rw-r--r--src/H5Pocpypl.c11
-rw-r--r--src/H5Ppkg.h4
-rw-r--r--src/H5Pprivate.h6
-rw-r--r--src/H5Pstrcpl.c4
-rw-r--r--src/H5Ptest.c10
-rw-r--r--src/H5R.c127
-rw-r--r--src/H5Rdeprec.c50
-rw-r--r--src/H5Rmodule.h36
-rw-r--r--src/H5Rpkg.h4
-rw-r--r--src/H5S.c131
-rw-r--r--src/H5SL.c155
-rw-r--r--src/H5SLmodule.h35
-rw-r--r--src/H5SM.c103
-rw-r--r--src/H5SMbtree2.c57
-rw-r--r--src/H5SMcache.c6
-rw-r--r--src/H5SMmessage.c4
-rw-r--r--src/H5SMmodule.h35
-rw-r--r--src/H5SMpkg.h2
-rw-r--r--src/H5SMprivate.h2
-rw-r--r--src/H5SMtest.c2
-rw-r--r--src/H5Sall.c2
-rw-r--r--src/H5Sdbg.c2
-rw-r--r--src/H5Shyper.c129
-rw-r--r--src/H5Smodule.h35
-rw-r--r--src/H5Smpio.c2
-rw-r--r--src/H5Snone.c2
-rw-r--r--src/H5Spkg.h2
-rw-r--r--src/H5Spoint.c10
-rw-r--r--src/H5Sprivate.h6
-rw-r--r--src/H5Sselect.c48
-rw-r--r--src/H5Stest.c6
-rw-r--r--src/H5T.c498
-rw-r--r--src/H5TS.c5
-rw-r--r--src/H5Tarray.c31
-rw-r--r--src/H5Tbit.c4
-rw-r--r--src/H5Tcommit.c41
-rw-r--r--src/H5Tcompound.c27
-rw-r--r--src/H5Tconv.c14
-rw-r--r--src/H5Tcset.c27
-rw-r--r--src/H5Tdbg.c2
-rw-r--r--src/H5Tdeprec.c50
-rw-r--r--src/H5Tenum.c30
-rw-r--r--src/H5Tfields.c31
-rw-r--r--src/H5Tfixed.c45
-rw-r--r--src/H5Tfloat.c26
-rw-r--r--src/H5Tmodule.h35
-rw-r--r--src/H5Tnative.c34
-rw-r--r--src/H5Toffset.c28
-rw-r--r--src/H5Toh.c12
-rw-r--r--src/H5Topaque.c46
-rw-r--r--src/H5Torder.c26
-rw-r--r--src/H5Tpad.c44
-rw-r--r--src/H5Tpkg.h4
-rw-r--r--src/H5Tprecis.c60
-rw-r--r--src/H5Tprivate.h7
-rw-r--r--src/H5Tstrpad.c42
-rw-r--r--src/H5Tvisit.c15
-rw-r--r--src/H5Tvlen.c58
-rw-r--r--src/H5VL.c140
-rw-r--r--src/H5VLint.c28
-rw-r--r--src/H5VLmodule.h34
-rw-r--r--src/H5VLnative.c87
-rw-r--r--src/H5VLpkg.h2
-rw-r--r--src/H5Z.c117
-rw-r--r--src/H5Zdeflate.c4
-rw-r--r--src/H5Zfletcher32.c6
-rw-r--r--src/H5Zmodule.h35
-rw-r--r--src/H5Znbit.c125
-rw-r--r--src/H5Zpkg.h2
-rw-r--r--src/H5Zscaleoffset.c6
-rw-r--r--src/H5Zshuffle.c4
-rw-r--r--src/H5Zszip.c2
-rw-r--r--src/H5Ztrans.c219
-rw-r--r--src/H5api_adpt.h22
-rw-r--r--src/H5config.h.in75
-rw-r--r--src/H5detect.c10
-rw-r--r--src/H5err.txt1
-rw-r--r--src/H5private.h766
-rw-r--r--src/H5public.h8
-rw-r--r--src/H5system.c62
-rw-r--r--src/H5trace.c2
-rw-r--r--src/Makefile.am4
-rw-r--r--src/Makefile.in38
-rw-r--r--src/libhdf5.settings.in1
341 files changed, 7267 insertions, 6030 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 26682f3..c70a6a4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -820,7 +820,7 @@ add_custom_command (
)
if (GENERATE_ERROR_HEADERS)
- find_pacakge (Perl)
+ find_package (Perl)
if (PERL_FOUND)
add_custom_command (
OUTPUT ${HDF5_BINARY_DIR}/H5Edefin.h
@@ -914,9 +914,15 @@ if (BUILD_SHARED_LIBS)
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1
)
+ if (HDF5_ENABLE_THREADSAFE)
+ set_property (TARGET ${HDF5_LIBSH_TARGET}
+ APPEND PROPERTY COMPILE_DEFINITIONS
+ "H5_HAVE_THREADSAFE"
+ )
+ endif (HDF5_ENABLE_THREADSAFE)
if (HDF5_ENABLE_DEBUG_APIS)
- set_property (TARGET ${HDF5_LIBSH_TARGET}
+ set_property (TARGET ${HDF5_LIBSH_TARGET}
APPEND PROPERTY COMPILE_DEFINITIONS
"H5Z_DEBUG;H5VM_DEBUG;H5T_DEBUG;H5S_DEBUG;H5P_DEBUG;H5O_DEBUG;H5MM_DEBUG;H5MF_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5HG_DEBUG;H5G_DEBUG;H5F_DEBUG;H5E_DEBUG;H5D_DEBUG;H5B_DEBUG;H5AC_DEBUG"
)
diff --git a/src/H5.c b/src/H5.c
index c703024..260b6e9 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -21,16 +21,16 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5Lprivate.h" /* Links */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Lprivate.h" /* Links */
#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5Tprivate.h" /* Datatypes */
+#include "H5Pprivate.h" /* Property lists */
#include "H5SLprivate.h" /* Skip lists */
+#include "H5Tprivate.h" /* Datatypes */
#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
@@ -75,6 +75,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
@@ -265,6 +266,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);
@@ -274,7 +278,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): \
@@ -285,20 +289,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
@@ -323,7 +353,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) {
@@ -367,12 +397,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() */
@@ -977,6 +1012,36 @@ H5free_memory(void *mem)
} /* end H5free_memory() */
+/*-------------------------------------------------------------------------
+ * Function: H5is_library_threadsafe
+ *
+ * Purpose: Checks to see if the library was built with thread-safety
+ * enabled.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5is_library_threadsafe(hbool_t *is_ts)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE1("e", "*b", is_ts);
+
+ HDassert(is_ts);
+
+#ifdef H5_HAVE_THREADSAFE
+ *is_ts = TRUE;
+#else /* H5_HAVE_THREADSAFE */
+ *is_ts = FALSE;
+#endif /* H5_HAVE_THREADSAFE */
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5is_library_threadsafe() */
+
+
#if defined(H5_HAVE_THREADSAFE) && defined(H5_BUILT_AS_DYNAMIC_LIB) \
&& defined(H5_HAVE_WIN32_API) && defined(H5_HAVE_WIN_THREADS)
/*-------------------------------------------------------------------------
diff --git a/src/H5A.c b/src/H5A.c
index 34b8fa1..4aba6f3 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -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 */
/***********/
@@ -38,6 +35,7 @@
#include "H5SMprivate.h" /* Shared Object Header Messages */
#include "H5VLprivate.h" /* VOL plugins */
+
/****************/
/* Local Macros */
/****************/
@@ -69,6 +67,9 @@ typedef struct H5A_iter_cb1 {
/* Package Variables */
/*********************/
+/* Package initialization variable */
+hbool_t H5_PKG_INIT_VAR = FALSE;
+
/*****************************/
/* Library Private Variables */
@@ -96,39 +97,16 @@ static const H5I_class_t H5I_ATTR_CLS[1] = {{
(H5I_free_t)H5A_close_attr /* 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
@@ -136,12 +114,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.
@@ -149,21 +127,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...
@@ -171,32 +153,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() */
/*--------------------------------------------------------------------------
diff --git a/src/H5AC.c b/src/H5AC.c
index a94a727..6cf77c2 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -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 */
@@ -135,7 +136,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
@@ -146,7 +146,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 */
@@ -157,7 +157,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5AC_init_interface
+ * Function: H5AC__init_package
*
* Purpose: Initialize interface-specific information
*
@@ -168,8 +168,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 */
@@ -177,7 +177,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 */
@@ -224,17 +224,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
@@ -243,13 +242,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) {
/* Indicate more work to do */
@@ -258,30 +257,20 @@ H5AC_term_interface(void)
/* Close H5AC dxpl */
if(H5I_dec_ref(H5AC_dxpl_id) < 0 || H5I_dec_ref(H5AC_ind_dxpl_id) < 0)
H5E_clear_stack(NULL); /*ignore error*/
- else {
- /* Reset static IDs */
- H5AC_dxpl_id = (-1);
- H5AC_ind_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);
-#ifdef H5_HAVE_PARALLEL
- } /* end else */
#endif /* H5_HAVE_PARALLEL */
+
+ /* Reset static IDs */
+ H5AC_dxpl_id = (-1);
+ H5AC_ind_dxpl_id = (-1);
/* 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() */
/*-------------------------------------------------------------------------
@@ -1066,7 +1055,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)
@@ -2321,3 +2310,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 6c2b924..fdad19a 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 584ce9d..fded15c 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) */
@@ -350,9 +361,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 b85bee3..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 */
/***********/
@@ -85,8 +85,7 @@ static herr_t H5A__dense_btree2_corder_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5A__dense_btree2_corder_decode(const uint8_t *raw, void *native,
void *ctx);
-static herr_t H5A__dense_btree2_corder_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
- int indent, int fwidth, const void *record, const void *_udata);
+static herr_t H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *record);
/* v2 B-tree driver callbacks for 'name' index */
static herr_t H5A__dense_btree2_name_store(void *native, const void *udata);
@@ -95,8 +94,7 @@ static herr_t H5A__dense_btree2_name_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5A__dense_btree2_name_decode(const uint8_t *raw, void *native,
void *ctx);
-static herr_t H5A__dense_btree2_name_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
- int indent, int fwidth, const void *record, const void *_udata);
+static herr_t H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *record);
/* Fractal heap function callbacks */
static herr_t H5A__dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data);
@@ -116,9 +114,7 @@ const H5B2_class_t H5A_BT2_NAME[1]={{ /* B-tree class information */
H5A__dense_btree2_name_compare, /* Record comparison callback */
H5A__dense_btree2_name_encode, /* Record encoding callback */
H5A__dense_btree2_name_decode, /* Record decoding callback */
- H5A__dense_btree2_name_debug, /* Record debugging callback */
- NULL, /* Create debugging context */
- NULL /* Destroy debugging context */
+ H5A__dense_btree2_name_debug /* Record debugging callback */
}};
/* v2 B-tree class for indexing 'creation order' field of attributes */
@@ -132,9 +128,7 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */
H5A__dense_btree2_corder_compare, /* Record comparison callback */
H5A__dense_btree2_corder_encode, /* Record encoding callback */
H5A__dense_btree2_corder_decode, /* Record decoding callback */
- H5A__dense_btree2_corder_debug, /* Record debugging callback */
- NULL, /* Create debugging context */
- NULL /* Destroy debugging context */
+ H5A__dense_btree2_corder_debug /* Record debugging callback */
}};
@@ -253,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
@@ -381,8 +375,7 @@ H5A__dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_U
*-------------------------------------------------------------------------
*/
static herr_t
-H5A__dense_btree2_name_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
- int indent, int fwidth, const void *_nrecord, const void H5_ATTR_UNUSED *_udata)
+H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_nrecord)
{
const H5A_dense_bt2_name_rec_t *nrecord = (const H5A_dense_bt2_name_rec_t *)_nrecord;
@@ -445,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
@@ -539,8 +532,7 @@ H5A__dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR
*-------------------------------------------------------------------------
*/
static herr_t
-H5A__dense_btree2_corder_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
- int indent, int fwidth, const void *_nrecord, const void H5_ATTR_UNUSED *_udata)
+H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *_nrecord)
{
const H5A_dense_bt2_corder_rec_t *nrecord = (const H5A_dense_bt2_corder_rec_t *)_nrecord;
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 28e4c3f..10d966c 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 */
/***********/
@@ -85,51 +82,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 21cf135..fd2159f 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
@@ -857,7 +857,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)))
@@ -896,7 +897,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);
@@ -914,7 +917,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() */
@@ -1107,15 +1111,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() */
@@ -1138,15 +1143,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() */
@@ -1167,15 +1173,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() */
@@ -1201,7 +1208,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
@@ -1560,7 +1567,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
@@ -1595,7 +1602,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
@@ -1798,8 +1805,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)
@@ -1865,8 +1872,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);
@@ -1896,7 +1904,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() */
@@ -1933,8 +1942,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 cc8d590..4116070 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 2061ba3..54bbdce 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
diff --git a/src/H5B.c b/src/H5B.c
index b1f3388..48be703 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -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
diff --git a/src/H5B2.c b/src/H5B2.c
index 7b5aa16..7eb88c4 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -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 6e1250b..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 */
@@ -91,7 +92,6 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
const H5B2_class_t *type, haddr_t obj_addr)
{
H5B2_hdr_t *hdr = NULL; /* B-tree header info */
- void *dbg_ctx = NULL; /* v2 B-tree debugging context */
unsigned u; /* Local index variable */
char temp_str[128]; /* Temporary string, for formatting */
H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
@@ -109,22 +109,13 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HDassert(indent >= 0);
HDassert(fwidth >= 0);
HDassert(type);
- HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) ||
- (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx));
-
- /* Check for debugging context callback available */
- if(type->crt_dbg_ctx) {
- /* Create debugging context */
- if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context")
- } /* end if */
/*
* Load the B-tree header.
*/
cache_udata.f = f;
cache_udata.addr = addr;
- cache_udata.ctx_udata = dbg_ctx;
+ cache_udata.ctx_udata = f;
if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
@@ -139,12 +130,12 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
*/
HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth,
"Tree type ID:", hdr->cls->name, (unsigned)hdr->cls->id);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Size of node:",
- hdr->node_size);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ (unsigned)hdr->node_size);
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Size of raw (disk) record:",
- hdr->rrec_size);
+ (unsigned)hdr->rrec_size);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Dirty flag:",
hdr->cache_info.is_dirty ? "True" : "False");
@@ -177,8 +168,6 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
} /* end for */
done:
- if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context")
if(hdr) {
hdr->f = NULL;
if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, hdr, H5AC__NO_FLAGS_SET) < 0)
@@ -208,7 +197,6 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
{
H5B2_hdr_t *hdr = NULL; /* B-tree header */
H5B2_internal_t *internal = NULL; /* B-tree internal node */
- void *dbg_ctx = NULL; /* v2 B-tree debugging context */
unsigned u; /* Local index variable */
char temp_str[128]; /* Temporary string, for formatting */
H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
@@ -225,25 +213,16 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HDassert(indent >= 0);
HDassert(fwidth >= 0);
HDassert(type);
- HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) ||
- (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx));
HDassert(H5F_addr_defined(hdr_addr));
HDassert(H5F_addr_defined(obj_addr));
HDassert(nrec > 0);
- /* Check for debugging context callback available */
- if(type->crt_dbg_ctx) {
- /* Create debugging context */
- if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context")
- } /* end if */
-
/*
* Load the B-tree header.
*/
cache_udata.f = f;
cache_udata.addr = hdr_addr;
- cache_udata.ctx_udata = dbg_ctx;
+ cache_udata.ctx_udata = f;
if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
@@ -259,22 +238,19 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree internal node")
/* Print opening message */
- if(internal->depth == 1)
- HDfprintf(stream, "%*sv2 B-tree Internal 'Leaf' Node...\n", indent, "");
- else
- HDfprintf(stream, "%*sv2 B-tree Internal 'Branch' Node...\n", indent, "");
+ HDfprintf(stream, "%*sv2 B-tree Internal Node...\n", indent, "");
/*
* Print the values.
*/
HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth,
"Tree type ID:", hdr->cls->name, (unsigned)hdr->cls->id);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Size of node:",
- hdr->node_size);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ (unsigned)hdr->node_size);
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Size of raw (disk) record:",
- hdr->rrec_size);
+ (unsigned)hdr->rrec_size);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Dirty flag:",
internal->cache_info.is_dirty ? "True" : "False");
@@ -297,8 +273,8 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
temp_str);
HDassert(H5B2_INT_NREC(internal, hdr, u));
- (void)(type->debug)(stream, f, dxpl_id, indent + 6, MAX (0, fwidth-6),
- H5B2_INT_NREC(internal, hdr, u), dbg_ctx);
+ (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6),
+ H5B2_INT_NREC(internal, hdr, u));
} /* end for */
/* Print final node pointer */
@@ -310,8 +286,6 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
internal->node_ptrs[u].addr);
done:
- if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context")
if(hdr) {
hdr->f = NULL;
if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
@@ -344,7 +318,6 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent
H5B2_hdr_t *hdr = NULL; /* B-tree header */
H5B2_leaf_t *leaf = NULL; /* B-tree leaf node */
H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
- void *dbg_ctx = NULL; /* v2 B-tree debugging context */
unsigned u; /* Local index variable */
char temp_str[128]; /* Temporary string, for formatting */
herr_t ret_value = SUCCEED; /* Return value */
@@ -360,25 +333,16 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent
HDassert(indent >= 0);
HDassert(fwidth >= 0);
HDassert(type);
- HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) ||
- (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx));
HDassert(H5F_addr_defined(hdr_addr));
HDassert(H5F_addr_defined(obj_addr));
HDassert(nrec > 0);
- /* Check for debugging context callback available */
- if(type->crt_dbg_ctx) {
- /* Create debugging context */
- if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context")
- } /* end if */
-
/*
* Load the B-tree header.
*/
cache_udata.f = f;
cache_udata.addr = hdr_addr;
- cache_udata.ctx_udata = dbg_ctx;
+ cache_udata.ctx_udata = f;
if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree header")
@@ -400,12 +364,12 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent
*/
HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth,
"Tree type ID:", hdr->cls->name, (unsigned)hdr->cls->id);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Size of node:",
- hdr->node_size);
- HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ (unsigned)hdr->node_size);
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Size of raw (disk) record:",
- hdr->rrec_size);
+ (unsigned)hdr->rrec_size);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Dirty flag:",
leaf->cache_info.is_dirty ? "True" : "False");
@@ -420,13 +384,11 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent
HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
temp_str);
HDassert(H5B2_LEAF_NREC(leaf, hdr, u));
- (void)(type->debug)(stream, f, dxpl_id, indent + 6, MAX (0, fwidth-6),
- H5B2_LEAF_NREC(leaf, hdr, u), dbg_ctx);
+ (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6),
+ H5B2_LEAF_NREC(leaf, hdr, u));
} /* end for */
done:
- if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context")
if(hdr) {
hdr->f = NULL;
if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
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/H5B2private.h b/src/H5B2private.h
index 08d3ce1..45b6737 100644
--- a/src/H5B2private.h
+++ b/src/H5B2private.h
@@ -92,10 +92,8 @@ struct H5B2_class_t {
herr_t (*compare)(const void *rec1, const void *rec2); /* Compare two native records */
herr_t (*encode)(uint8_t *raw, const void *record, void *ctx); /* Encode record from native form to disk storage form */
herr_t (*decode)(const uint8_t *raw, void *record, void *ctx); /* Decode record from disk storage form to native form */
- herr_t (*debug)(FILE *stream, const H5F_t *f, hid_t dxpl_id, /* Print a record for debugging */
- int indent, int fwidth, const void *record, const void *ctx);
- void *(*crt_dbg_ctx)(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr); /* Create debugging context */
- herr_t (*dst_dbg_ctx)(void *dbg_ctx); /* Destroy debugging context */
+ herr_t (*debug)(FILE *stream, int indent, int fwidth, /* Print a record for debugging */
+ const void *record);
};
/* v2 B-tree creation parameters */
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 35771f2..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*/
@@ -67,9 +67,7 @@ static herr_t H5B2__test_store(void *nrecord, const void *udata);
static herr_t H5B2__test_compare(const void *rec1, const void *rec2);
static herr_t H5B2__test_encode(uint8_t *raw, const void *nrecord, void *ctx);
static herr_t H5B2__test_decode(const uint8_t *raw, void *nrecord, void *ctx);
-static herr_t H5B2__test_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
- int indent, int fwidth, const void *record, const void *_udata);
-static void *H5B2__test_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr);
+static herr_t H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record);
/*********************/
@@ -86,9 +84,7 @@ const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */
H5B2__test_compare, /* Record comparison callback */
H5B2__test_encode, /* Record encoding callback */
H5B2__test_decode, /* Record decoding callback */
- H5B2__test_debug, /* Record debugging callback */
- H5B2__test_crt_dbg_context, /* Create debugging context */
- H5B2__test_dst_context /* Destroy debugging context */
+ H5B2__test_debug /* Record debugging callback */
}};
@@ -124,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
@@ -295,13 +291,11 @@ H5B2__test_decode(const uint8_t *raw, void *nrecord, void *_ctx)
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2__test_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
- int indent, int fwidth, const void *record,
- const void H5_ATTR_UNUSED *_udata)
+H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record)
{
FUNC_ENTER_STATIC_NOERR
- HDassert (record);
+ HDassert(record);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Record:",
*(const hsize_t *)record);
@@ -311,45 +305,6 @@ H5B2__test_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUS
/*-------------------------------------------------------------------------
- * Function: H5B2__test_crt_dbg_context
- *
- * Purpose: Create context for debugging callback
- *
- * Return: Success: non-NULL
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * Tuesday, December 1, 2009
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5B2__test_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr)
-{
- H5B2_test_ctx_t *ctx; /* Callback context structure */
- void *ret_value; /* Return value */
-
- FUNC_ENTER_STATIC
-
- /* Sanity check */
- HDassert(f);
-
- /* Allocate callback context */
- if(NULL == (ctx = H5FL_MALLOC(H5B2_test_ctx_t)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate callback context")
-
- /* Determine the size of addresses & lengths in the file */
- ctx->sizeof_size = H5F_SIZEOF_SIZE(f);
-
- /* Set return value */
- ret_value = ctx;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2__test_crt_dbg_context() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5B2_get_root_addr_test
*
* Purpose: Retrieve the root node's address
@@ -514,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
diff --git a/src/H5C.c b/src/H5C.c
index c478173..2a4b4cf 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -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 */
/***********/
@@ -107,6 +107,7 @@
#define H5C_IMAGE_EXTRA_SPACE 0
#endif /* H5C_DO_MEMORY_SANITY_CHECKS */
+
/******************/
/* Local Typedefs */
/******************/
@@ -147,6 +148,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,
const H5C_class_t * type,
@@ -197,6 +204,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 */
@@ -496,6 +506,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;
@@ -510,10 +530,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;
@@ -1009,13 +1027,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.
*
@@ -1036,408 +1047,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) < 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) < 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() */
@@ -2045,7 +1753,8 @@ H5C_insert_entry(H5F_t * f,
unsigned int flags)
{
H5C_t * cache_ptr;
- herr_t result;
+ H5P_genplist_t *dxpl;
+ H5AC_ring_t ring = H5C_RING_UNDEFINED;
hbool_t insert_pinned;
hbool_t flush_last;
#ifdef H5_HAVE_PARALLEL
@@ -2092,6 +1801,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
@@ -2169,6 +1886,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++)
@@ -2189,13 +1908,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)
@@ -2212,33 +1926,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
@@ -2265,16 +1966,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)
@@ -2896,6 +2589,8 @@ H5C_protect(H5F_t * f,
unsigned flags)
{
H5C_t * cache_ptr;
+ H5P_genplist_t *dxpl;
+ H5AC_ring_t ring = H5C_RING_UNDEFINED;
hbool_t hit;
hbool_t have_write_permitted = FALSE;
hbool_t read_only = FALSE;
@@ -2904,11 +2599,10 @@ H5C_protect(H5F_t * f,
hbool_t flush_collectively;
#endif /* H5_HAVE_PARALLEL */
hbool_t write_permitted;
- herr_t result;
size_t empty_space;
void * thing;
H5C_cache_entry_t * entry_ptr;
- void * ret_value; /* Return value */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -2928,7 +2622,7 @@ H5C_protect(H5F_t * f,
( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) ||
( H5C_validate_lru_list(cache_ptr) < 0 ) ) {
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, \
"an extreme sanity check failed on entry.\n");
}
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
@@ -2939,10 +2633,20 @@ H5C_protect(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, 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")
+
/* first check to see if the target is in cache */
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)
@@ -2950,7 +2654,6 @@ H5C_protect(H5F_t * f,
#if H5C_DO_TAGGING_SANITY_CHECKS
{
- H5P_genplist_t *dxpl; /* dataset transfer property list */
haddr_t tag = HADDR_UNDEF;
/* The entry is already in the cache, but make sure that the tag value
@@ -2959,21 +2662,15 @@ H5C_protect(H5F_t * f,
and it would have received a legal tag value after getting loaded
from disk. */
- /* Get the dataset transfer property list */
- if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list");
-
/* 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
@@ -2996,6 +2693,8 @@ H5C_protect(H5F_t * f,
entry_ptr = (H5C_cache_entry_t *)thing;
+ entry_ptr->ring = ring;
+
/* Apply tag to newly protected entry */
if(H5C_tag_entry(cache_ptr, entry_ptr, dxpl_id) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, NULL, "Cannot tag metadata entry")
@@ -3006,14 +2705,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)
@@ -3039,20 +2732,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;
@@ -3099,16 +2783,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
@@ -3202,19 +2878,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;
@@ -3228,14 +2895,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 ) {
@@ -3264,16 +2925,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.")
}
}
}
@@ -5394,6 +5047,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);
@@ -6860,48 +6514,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;
@@ -6921,27 +6666,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
@@ -6967,19 +6714,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
@@ -7034,37 +6789,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;
@@ -7079,27 +6824,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
@@ -7111,30 +6856,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
@@ -7151,7 +6892,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) < 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.
@@ -7160,10 +6900,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.
@@ -7172,18 +6910,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
@@ -7198,9 +6935,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) < 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) < 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.
@@ -7210,9 +6948,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.
@@ -7221,15 +6958,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 */
@@ -7244,13 +6980,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
@@ -7264,42 +6999,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
@@ -7327,24 +7057,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) < 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) < 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
@@ -7371,16 +7102,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 */
@@ -7399,68 +7125,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)
+ 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.")
- if ( protected_entries > 0 ) {
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_flush_invalidate_ring() */
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
- "Cache has protected entries.")
+
+/*-------------------------------------------------------------------------
+ * 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) < 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) < 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() */
/*-------------------------------------------------------------------------
@@ -7550,6 +7647,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)
@@ -7630,7 +7728,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_
unsigned coll_meta; /* Collective metadata write flag */
/* Get the dataset transfer property list */
- if(NULL == (dxpl = H5I_object(dxpl_id)))
+ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id)))
HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
/* Get the collective metadata write property */
@@ -8197,7 +8295,7 @@ H5C_load_entry(H5F_t * f,
H5C_cache_entry_t * entry; /* Alias for thing loaded, as cache entry */
size_t len; /* Size of image in file */
unsigned u; /* Local index variable */
- void * ret_value; /* Return value */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -8558,6 +8656,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++)
@@ -9925,3 +10025,47 @@ 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() */
+
diff --git a/src/H5CS.c b/src/H5CS.c
index 29182ce..f1d3a8b 100644
--- a/src/H5CS.c
+++ b/src/H5CS.c
@@ -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 ec34285..6b63ad5 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 7d9d0f9..6c8996d 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,6 +824,12 @@ 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. */
@@ -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 */
@@ -2854,6 +3047,16 @@ if ( ( (cache_ptr)->index_size != \
* 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.
@@ -2868,12 +3071,22 @@ if ( ( (cache_ptr)->index_size != \
* 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.
@@ -2962,6 +3175,16 @@ if ( ( (cache_ptr)->index_size != \
* 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:
@@ -3602,8 +3825,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 */
@@ -3619,6 +3846,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 3cd74c1..2a3efc9 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
@@ -1543,6 +1616,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];
@@ -1917,6 +1993,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,
diff --git a/src/H5D.c b/src/H5D.c
index 971ba4f..67d1009 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -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 */
/***********/
@@ -53,6 +50,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);
@@ -70,51 +70,6 @@ H5FL_BLK_EXTERN(vlen_fl_buf);
-/*--------------------------------------------------------------------------
-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
*
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 af5123c..03548b9 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -44,7 +44,7 @@
/* Module Setup */
/****************/
-#define H5D_PACKAGE /*suppress error about including H5Dpkg */
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
@@ -192,6 +192,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);
@@ -585,7 +587,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 */
@@ -593,7 +595,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);
@@ -681,7 +683,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
@@ -2118,10 +2120,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")
@@ -2403,7 +2401,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
@@ -2896,7 +2894,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
@@ -5366,7 +5364,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..b738698 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 */
/***********/
@@ -285,7 +285,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 +326,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
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index 29ab1ff..00a9098 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,
@@ -451,6 +453,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 *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 +540,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 +918,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 +1245,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 bcbbc36..38fcbc2 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 2a39aaa..e95084e 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
/*-------------------------------------------------------------------------
@@ -237,8 +189,8 @@ done:
hid_t
H5Dopen1(hid_t loc_id, const char *name)
{
- void *dset = NULL; /* dset token from VOL plugin */
- H5VL_object_t *obj = NULL; /* object token of loc_id */
+ void *dset = NULL; /* dset token from VOL plugin */
+ H5VL_object_t *obj = NULL; /* object token of loc_id */
H5VL_loc_params_t loc_params;
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 */
diff --git a/src/H5Defl.c b/src/H5Defl.c
index 9e5872a..7d13fab 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 */
/***********/
@@ -455,7 +455,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 +535,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 f834219..f1b29b6 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_dataset /* 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() */
+
+
+/*-------------------------------------------------------------------------
+ * 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 */
- H5_interface_initialize_g = 0;
- } /* end else */
+ /* Mark closed */
+ if(0 == n)
+ H5_PKG_INIT_VAR = FALSE;
} /* end if */
FUNC_LEAVE_NOAPI(n)
-} /* end H5D_term_interface() */
+} /* end H5D_term_package() */
/*--------------------------------------------------------------------------
@@ -424,7 +457,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 +582,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
@@ -973,7 +1006,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
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 */
H5G_loc_t dset_loc; /* Dataset location */
- H5D_t *ret_value; /* Return value */
+ H5D_t *ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1051,12 +1084,14 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
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")
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")
+ /* 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)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "invalid space allocation state")
@@ -1094,7 +1129,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. */
@@ -1147,6 +1182,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
@@ -1167,7 +1265,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)
@@ -1426,7 +1524,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)
@@ -1446,16 +1544,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:
@@ -1502,8 +1602,9 @@ H5D_close(H5D_t *dataset)
* 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);
+ 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)
@@ -1985,7 +2086,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
@@ -2022,7 +2123,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)
@@ -2063,7 +2164,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
@@ -2216,6 +2317,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)
@@ -2251,10 +2353,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;
@@ -2406,44 +2507,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)
@@ -2585,7 +2690,7 @@ H5D_get_create_plist(H5D_t *dset)
H5P_genplist_t *new_plist; /* Copy of dataset's DCPL */
H5O_fill_t copied_fill; /* Fill value 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)
@@ -2835,3 +2940,4 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_get_type() */
+
diff --git a/src/H5Dio.c b/src/H5Dio.c
index e5d8009..1711c94 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..ae73ca5 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
@@ -382,68 +382,9 @@ 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 */
+ /* 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")
done:
FUNC_LEAVE_NOAPI(ret_value)
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..01c2e5d 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 */
/***********/
diff --git a/src/H5Doh.c b/src/H5Doh.c
index 74521b9..ed4352e 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 315fe53..4f302e6 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
@@ -408,6 +408,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 +529,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,
@@ -608,14 +609,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);
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 e528494..c66bcc8 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*/
diff --git a/src/H5E.c b/src/H5E.c
index c3c7685..4374f1d 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -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
diff --git a/src/H5EA.c b/src/H5EA.c
index d96f9c2..be60301 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -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
index 4c4b4df..a244a3b 100644
--- a/src/H5Edefin.h
+++ b/src/H5Edefin.h
@@ -195,6 +195,7 @@ 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 */
+hid_t H5E_CANTAPPEND_g = FAIL; /* Can't append object */
/* Argument errors */
hid_t H5E_UNINITIALIZED_g = FAIL; /* Information is uinitialized */
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
index 75c0b70..c388c81 100644
--- a/src/H5Einit.h
+++ b/src/H5Einit.h
@@ -745,6 +745,11 @@ 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")
+assert(H5E_CANTAPPEND_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "Can't append object"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_CANTAPPEND_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));
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
index e5ecd10..a120e6b 100644
--- a/src/H5Epubgen.h
+++ b/src/H5Epubgen.h
@@ -330,12 +330,14 @@ H5_DLLVAR hid_t H5E_CANTRECV_g; /* Can't receive data */
#define H5E_CANTNEXT (H5OPEN H5E_CANTNEXT_g)
#define H5E_BADSELECT (H5OPEN H5E_BADSELECT_g)
#define H5E_CANTCOMPARE (H5OPEN H5E_CANTCOMPARE_g)
+#define H5E_CANTAPPEND (H5OPEN H5E_CANTAPPEND_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 */
+H5_DLLVAR hid_t H5E_CANTAPPEND_g; /* Can't append object */
/* Argument errors */
#define H5E_UNINITIALIZED (H5OPEN H5E_UNINITIALIZED_g)
diff --git a/src/H5Eterm.h b/src/H5Eterm.h
index aecef3e..d9f9827 100644
--- a/src/H5Eterm.h
+++ b/src/H5Eterm.h
@@ -196,7 +196,8 @@ H5E_CANTCOUNT_g=
H5E_CANTSELECT_g=
H5E_CANTNEXT_g=
H5E_BADSELECT_g=
-H5E_CANTCOMPARE_g=
+H5E_CANTCOMPARE_g=
+H5E_CANTAPPEND_g=
/* Argument errors */
H5E_UNINITIALIZED_g=
diff --git a/src/H5F.c b/src/H5F.c
index d213c32..be74baa 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -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 */
/***********/
@@ -59,6 +56,9 @@
/* Package Variables */
/*********************/
+/* Package initialization variable */
+hbool_t H5_PKG_INIT_VAR = FALSE;
+
/*****************************/
/* Library Private Variables */
@@ -85,22 +85,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 */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_PACKAGE
/*
* Initialize the atom group for the file IDs.
@@ -108,40 +107,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() */
+} /* H5F__init_package() */
/*-------------------------------------------------------------------------
- * 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() */
-
-
-/*-------------------------------------------------------------------------
- * 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
@@ -159,13 +131,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*/
@@ -174,20 +146,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() */
/*-------------------------------------------------------------------------
diff --git a/src/H5FA.c b/src/H5FA.c
index bfb2a00..b0d13ec 100644
--- a/src/H5FA.c
+++ b/src/H5FA.c
@@ -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
diff --git a/src/H5FD.c b/src/H5FD.c
index b995319..c7775ab 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -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 */
/***********/
@@ -78,6 +75,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 +113,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 +140,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 +153,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 +191,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 +318,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)
@@ -974,7 +942,7 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
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)
@@ -1189,7 +1157,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 +1570,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 32f23fb..ac5d7ed 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 */
@@ -65,11 +64,7 @@ typedef struct H5FD_core_t {
* identify a file.
*/
dev_t device; /*file device number */
-#ifdef H5_VMS
- ino_t inode[3]; /*file i-node number */
-#else
ino_t inode; /*file i-node number */
-#endif /*H5_VMS*/
#else
/* Files in windows are uniquely identified by the volume serial
* number and the file index (both low and high parts).
@@ -126,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 */
@@ -187,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.
@@ -197,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;
@@ -210,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);
@@ -314,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.
*
@@ -327,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);
@@ -356,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.
*
@@ -368,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)
@@ -424,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.
*
@@ -438,7 +433,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_core_init_interface(void)
+H5FD__init_package(void)
{
herr_t ret_value = SUCCEED;
@@ -449,7 +444,7 @@ H5FD_core_init_interface(void)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5FD_core_init_interface() */
+} /* H5FD__init_package() */
/*-------------------------------------------------------------------------
@@ -469,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
*
@@ -497,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() */
/*-------------------------------------------------------------------------
@@ -543,7 +538,7 @@ H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store)
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pset_fapl_core() */
/*-------------------------------------------------------------------------
@@ -582,16 +577,15 @@ H5Pget_fapl_core(hid_t fapl_id, size_t *increment /*out*/, hbool_t *backing_stor
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
@@ -600,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")
@@ -619,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
@@ -639,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;
@@ -651,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)
@@ -741,14 +734,7 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
file->dwVolumeSerialNumber = fileinfo.dwVolumeSerialNumber;
#else /* H5_HAVE_WIN32_API */
file->device = sb.st_dev;
-#ifdef H5_VMS
- file->inode[0] = sb.st_ino[0];
- file->inode[1] = sb.st_ino[1];
- file->inode[2] = sb.st_ino[2];
-#else
file->inode = sb.st_ino;
-#endif /* H5_VMS */
-
#endif /* H5_HAVE_WIN32_API */
} /* end if */
@@ -875,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.
*
@@ -891,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 */
@@ -926,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.
@@ -938,7 +924,6 @@ done:
* address.
*
* Return: Success: A value like strcmp()
- *
* Failure: never fails (arguments were checked by the
* caller).
*
@@ -948,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 */
@@ -981,13 +966,8 @@ H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t))>0) HGOTO_DONE(1)
#endif /* H5_DEV_T_IS_SCALAR */
-#ifndef H5_VMS
if (f1->inode < f2->inode) HGOTO_DONE(-1)
if (f1->inode > f2->inode) HGOTO_DONE(1)
-#else
- if(HDmemcmp(&(f1->inode),&(f2->inode),3*sizeof(ino_t))<0) HGOTO_DONE(-1)
- if(HDmemcmp(&(f1->inode),&(f2->inode),3*sizeof(ino_t))>0) HGOTO_DONE(1)
-#endif /* H5_VMS */
#endif /*H5_HAVE_WIN32_API*/
} /* end if */
@@ -1010,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)
@@ -1027,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) {
@@ -1049,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
@@ -1067,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
@@ -1092,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")
@@ -1106,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
@@ -1126,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.
*
@@ -1149,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)
@@ -1193,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
@@ -1205,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
@@ -1214,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);
@@ -1256,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
@@ -1274,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);
@@ -1326,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)
}
@@ -1338,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.
@@ -1355,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) {
@@ -1387,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 */
@@ -1401,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.
@@ -1453,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,12 +1502,6 @@ H5FD_core_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing)
if(0 == bError)
HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#else /* H5_HAVE_WIN32_API */
-#ifdef H5_VMS
- /* Reset seek offset to the beginning of the file, so that the file isn't
- * re-extended later. This may happen on Open VMS. */
- if(-1 == HDlseek(file->fd, (HDoff_t)0, SEEK_SET))
- HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
-#endif /* H5_VMS */
if(-1 == HDftruncate(file->fd, (HDoff_t)new_eof))
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#endif /* H5_HAVE_WIN32_API */
@@ -1545,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 e9fd1ea..82241a1 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 */
@@ -83,11 +79,7 @@ typedef struct H5FD_direct_t {
* identify a file.
*/
dev_t device; /*file device number */
-#ifdef H5_VMS
- ino_t inode[3]; /*file i-node number */
-#else
ino_t inode; /*file i-node number */
-#endif /*H5_VMS*/
#else
/*
* On H5_HAVE_WIN32_API the low-order word of a unique identifier associated with the
@@ -186,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
@@ -198,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() */
/*-------------------------------------------------------------------------
@@ -240,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)
@@ -525,13 +516,7 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
file->fileindexlo = fileinfo.nFileIndexLow;
#else
file->device = sb.st_dev;
-#ifdef H5_VMS
- file->inode[0] = sb.st_ino[0];
- file->inode[1] = sb.st_ino[1];
- file->inode[2] = sb.st_ino[2];
-#else
file->inode = sb.st_ino;
-#endif /*H5_VMS*/
#endif /*H5_HAVE_WIN32_API*/
file->fa.mboundary = fa->mboundary;
file->fa.fbsize = fa->fbsize;
@@ -673,13 +658,8 @@ H5FD_direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t))>0) HGOTO_DONE(1)
#endif /* H5_DEV_T_IS_SCALAR */
-#ifndef H5_VMS
if (f1->inode < f2->inode) HGOTO_DONE(-1)
if (f1->inode > f2->inode) HGOTO_DONE(1)
-#else
- if(HDmemcmp(&(f1->inode),&(f2->inode),3*sizeof(ino_t))<0) HGOTO_DONE(-1)
- if(HDmemcmp(&(f1->inode),&(f2->inode),3*sizeof(ino_t))>0) HGOTO_DONE(1)
-#endif /*H5_VMS*/
#endif
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 eeb1dc9..e2c7709 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() */
/*-------------------------------------------------------------------------
@@ -368,7 +366,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 +412,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
@@ -1042,7 +1040,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
@@ -1096,7 +1094,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 d2289fd..4987c16 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 */
@@ -92,11 +91,7 @@ typedef struct H5FD_log_t {
* Windows code further below.
*/
dev_t device; /* file device number */
-#ifdef H5_VMS
- ino_t inode[3]; /* file i-node number */
-#else
ino_t inode; /* file i-node number */
-#endif /*H5_VMS*/
#else
/* Files in windows are uniquely identified by the volume serial
* number and the file index (both low and high parts).
@@ -225,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.
*
@@ -234,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() */
/*-------------------------------------------------------------------------
@@ -265,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)
@@ -365,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
@@ -394,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
@@ -487,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
@@ -587,14 +582,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
file->dwVolumeSerialNumber = fileinfo.dwVolumeSerialNumber;
#else /* H5_HAVE_WIN32_API */
file->device = sb.st_dev;
-#ifdef H5_VMS
- file->inode[0] = sb.st_ino[0];
- file->inode[1] = sb.st_ino[1];
- file->inode[2] = sb.st_ino[2];
-#else
file->inode = sb.st_ino;
-#endif /*H5_VMS*/
-
#endif /* H5_HAVE_WIN32_API */
/* Retain a copy of the name used to open the file, for possible error reporting */
@@ -867,13 +855,8 @@ H5FD_log_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t)) > 0) HGOTO_DONE(1)
#endif /* H5_DEV_T_IS_SCALAR */
-#ifndef H5_VMS
if(f1->inode < f2->inode) HGOTO_DONE(-1)
if(f1->inode > f2->inode) HGOTO_DONE(1)
-#else
- if(HDmemcmp(&(f1->inode), &(f2->inode), 3 * sizeof(ino_t)) < 0) HGOTO_DONE(-1)
- if(HDmemcmp(&(f1->inode), &(f2->inode), 3 * sizeof(ino_t)) > 0) HGOTO_DONE(1)
-#endif /*H5_VMS*/
#endif
@@ -938,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
@@ -1553,13 +1536,6 @@ H5FD_log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_U
if(0 == bError)
HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#else /* H5_HAVE_WIN32_API */
-#ifdef H5_VMS
- /* Reset seek offset to the beginning of the file, so that the file isn't
- * re-extended later. This may happen on Open VMS. */
- if(-1 == HDlseek(file->fd, (HDoff_t)0, SEEK_SET))
- HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
-#endif
-
if(-1 == HDftruncate(file->fd, (HDoff_t)file->eoa))
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#endif /* H5_HAVE_WIN32_API */
@@ -1579,3 +1555,4 @@ H5FD_log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_U
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_log_truncate() */
+
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/H5FDmpio.c b/src/H5FDmpio.c
index 5f36d2a..5c3bf05 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() */
/*-------------------------------------------------------------------------
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/H5FDsec2.c b/src/H5FDsec2.c
index 73dd7a0..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 */
@@ -69,11 +68,7 @@ typedef struct H5FD_sec2_t {
* Windows code further below.
*/
dev_t device; /* file device number */
-#ifdef H5_VMS
- ino_t inode[3]; /* file i-node number */
-#else
ino_t inode; /* file i-node number */
-#endif /* H5_VMS */
#else
/* Files in windows are uniquely identified by the volume serial
* number and the file index (both low and high parts).
@@ -183,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.
*
@@ -192,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() */
/*-------------------------------------------------------------------------
@@ -223,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)
@@ -320,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
@@ -374,13 +369,7 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
file->dwVolumeSerialNumber = fileinfo.dwVolumeSerialNumber;
#else /* H5_HAVE_WIN32_API */
file->device = sb.st_dev;
-#ifdef H5_VMS
- file->inode[0] = sb.st_ino[0];
- file->inode[1] = sb.st_ino[1];
- file->inode[2] = sb.st_ino[2];
-#else /* H5_VMS */
file->inode = sb.st_ino;
-#endif /* H5_VMS */
#endif /* H5_HAVE_WIN32_API */
/* Retain a copy of the name used to open the file, for possible error reporting */
@@ -501,13 +490,8 @@ H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t)) < 0) HGOTO_DONE(-1)
if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t)) > 0) HGOTO_DONE(1)
#endif /* H5_DEV_T_IS_SCALAR */
-#ifdef H5_VMS
- if(HDmemcmp(&(f1->inode), &(f2->inode), 3 * sizeof(ino_t)) < 0) HGOTO_DONE(-1)
- if(HDmemcmp(&(f1->inode), &(f2->inode), 3 * sizeof(ino_t)) > 0) HGOTO_DONE(1)
-#else /* H5_VMS */
if(f1->inode < f2->inode) HGOTO_DONE(-1)
if(f1->inode > f2->inode) HGOTO_DONE(1)
-#endif /* H5_VMS */
#endif /* H5_HAVE_WIN32_API */
done:
@@ -901,12 +885,6 @@ H5FD_sec2_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_
if(0 == bError)
HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#else /* H5_HAVE_WIN32_API */
-#ifdef H5_VMS
- /* Reset seek offset to the beginning of the file, so that the file isn't
- * re-extended later. This may happen on Open VMS. */
- if(-1 == HDlseek(file->fd, (HDoff_t)0, SEEK_SET))
- HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
-#endif
if(-1 == HDftruncate(file->fd, (HDoff_t)file->eoa))
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#endif /* H5_HAVE_WIN32_API */
@@ -922,3 +900,4 @@ H5FD_sec2_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_sec2_truncate() */
+
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 8e7eaf4..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;
@@ -97,11 +87,7 @@ typedef struct H5FD_stdio_t {
* Windows code further below.
*/
dev_t device; /* file device number */
-#ifdef H5_VMS
- ino_t inode[3]; /* file i-node number */
-#else
ino_t inode; /* file i-node number */
-#endif /* H5_VMS */
#else
/* Files in windows are uniquely identified by the volume serial
* number and the file index (both low and high parts).
@@ -335,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;
@@ -450,13 +436,7 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id,
H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADFILE, "unable to fstat file", NULL)
} /* end if */
file->device = sb.st_dev;
-#ifdef H5_VMS
- file->inode[0] = sb.st_ino[0];
- file->inode[1] = sb.st_ino[1];
- file->inode[2] = sb.st_ino[2];
-#else /* H5_VMS */
file->inode = sb.st_ino;
-#endif /* H5_VMS */
#endif /* H5_HAVE_WIN32_API */
return (H5FD_t*)file;
@@ -542,13 +522,8 @@ H5FD_stdio_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
if(memcmp(&(f1->device),&(f2->device),sizeof(dev_t)) < 0) return -1;
if(memcmp(&(f1->device),&(f2->device),sizeof(dev_t)) > 0) return 1;
#endif /* H5_DEV_T_IS_SCALAR */
-#ifdef H5_VMS
- if(memcmp(&(f1->inode), &(f2->inode), 3 * sizeof(ino_t)) < 0) return -1;
- if(memcmp(&(f1->inode), &(f2->inode), 3 * sizeof(ino_t)) > 0) return 1;
-#else /* H5_VMS */
if(f1->inode < f2->inode) return -1;
if(f1->inode > f2->inode) return 1;
-#endif /* H5_VMS */
#endif /* H5_HAVE_WIN32_API */
return 0;
@@ -571,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;
@@ -608,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;
@@ -653,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;
@@ -684,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;
@@ -719,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);
@@ -743,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 */
@@ -781,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 */
@@ -886,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 */
@@ -976,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 */
@@ -1021,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 */
diff --git a/src/H5FL.c b/src/H5FL.c
index aec92ff..2b8b11b 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -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", "H5FL_term_package");
+ 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(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 */
+
diff --git a/src/H5FO.c b/src/H5FO.c
index a6c47cb..a77e268 100644
--- a/src/H5FO.c
+++ b/src/H5FO.c
@@ -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 */
diff --git a/src/H5FS.c b/src/H5FS.c
index 182ac05..8e5985f 100644
--- a/src/H5FS.c
+++ b/src/H5FS.c
@@ -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 40d24e5..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 */
@@ -104,6 +104,8 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth)
"Symbol table leaf node 1/2 rank:", f->shared->sblock->sym_leaf_k);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Symbol table internal node 1/2 rank:", f->shared->sblock->btree_k[H5B_SNODE_ID]);
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Indexed storage internal node 1/2 rank:", f->shared->sblock->btree_k[H5B_CHUNK_ID]);
HDfprintf(stream, "%*s%-*s 0x%02x\n", indent, "", fwidth,
"File status flags:", (unsigned)(f->shared->sblock->status_flags));
HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth,
diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c
index 2878b75..986072b 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..831b737 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)
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 4d4efa0..2cea4ee 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 */
/***********/
@@ -107,30 +104,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
@@ -551,7 +524,7 @@ H5F_is_hdf5(const char *name, hid_t fapl_id)
{
H5F_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
@@ -605,7 +578,7 @@ done:
static 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
@@ -979,7 +952,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)
@@ -1521,7 +1494,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
@@ -2045,7 +2018,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 a9bc463..314ac56 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... */
@@ -34,28 +31,6 @@
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
*
@@ -437,7 +412,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 3b0b1e0..a6412f4 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 217401d..0cff752 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
@@ -364,8 +364,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);
H5_DLL H5F_t *H5F_reopen(H5F_t *f);
H5_DLL herr_t H5F_flush(H5F_t *f, hid_t dxpl_id, hbool_t closing);
H5_DLL htri_t H5F_is_hdf5(const char *name, hid_t fapl_id);
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 2aed15b..3f58e40 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -271,7 +271,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)
@@ -313,7 +313,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))
@@ -355,7 +355,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 */
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index 4c25a71..7490f4b 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 561b292..0478523 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*/
/***********/
diff --git a/src/H5G.c b/src/H5G.c
index 5939a39..0d571a7 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -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 */
/***********/
@@ -121,6 +118,9 @@
/* Package Variables */
/*********************/
+/* Package initialization variable */
+hbool_t H5_PKG_INIT_VAR = FALSE;
+
/*****************************/
/* Library Private Variables */
@@ -139,36 +139,13 @@ static const H5I_class_t H5I_GROUP_CLS[1] = {{
(H5I_free_t)H5G_close_group /* 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.
*
@@ -178,7 +155,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
@@ -186,64 +163,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 06af245..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 */
/***********/
@@ -83,8 +83,7 @@ static herr_t H5G_dense_btree2_corder_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5G_dense_btree2_corder_decode(const uint8_t *raw, void *native,
void *ctx);
-static herr_t H5G_dense_btree2_corder_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
- int indent, int fwidth, const void *record, const void *_udata);
+static herr_t H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *record);
/* v2 B-tree driver callbacks for 'name' index */
static herr_t H5G_dense_btree2_name_store(void *native, const void *udata);
@@ -93,8 +92,7 @@ static herr_t H5G_dense_btree2_name_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5G_dense_btree2_name_decode(const uint8_t *raw, void *native,
void *ctx);
-static herr_t H5G_dense_btree2_name_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
- int indent, int fwidth, const void *record, const void *_udata);
+static herr_t H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *record);
/* Fractal heap function callbacks */
static herr_t H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data);
@@ -114,9 +112,7 @@ const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */
H5G_dense_btree2_name_compare, /* Record comparison callback */
H5G_dense_btree2_name_encode, /* Record encoding callback */
H5G_dense_btree2_name_decode, /* Record decoding callback */
- H5G_dense_btree2_name_debug, /* Record debugging callback */
- NULL, /* Create debugging context */
- NULL /* Destroy debugging context */
+ H5G_dense_btree2_name_debug /* Record debugging callback */
}};
/* v2 B-tree class for indexing 'creation order' field of links */
@@ -130,9 +126,7 @@ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */
H5G_dense_btree2_corder_compare, /* Record comparison callback */
H5G_dense_btree2_corder_encode, /* Record encoding callback */
H5G_dense_btree2_corder_decode, /* Record decoding callback */
- H5G_dense_btree2_corder_debug, /* Record debugging callback */
- NULL, /* Create debugging context */
- NULL /* Destroy debugging context */
+ H5G_dense_btree2_corder_debug /* Record debugging callback */
}};
/*****************************/
@@ -238,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
@@ -362,9 +356,7 @@ H5G_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UN
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_dense_btree2_name_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
- int indent, int fwidth, const void *_nrecord,
- const void H5_ATTR_UNUSED *_udata)
+H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_nrecord)
{
const H5G_dense_bt2_name_rec_t *nrecord = (const H5G_dense_bt2_name_rec_t *)_nrecord;
unsigned u; /* Local index variable */
@@ -428,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
@@ -528,9 +520,7 @@ H5G_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_dense_btree2_corder_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
- int indent, int fwidth, const void *_nrecord,
- const void H5_ATTR_UNUSED *_udata)
+H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *_nrecord)
{
const H5G_dense_bt2_corder_rec_t *nrecord = (const H5G_dense_bt2_corder_rec_t *)_nrecord;
unsigned u; /* Local index variable */
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 f6c3799..63e5a23 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 */
/***********/
@@ -102,51 +99,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
/*-------------------------------------------------------------------------
@@ -164,7 +116,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
@@ -1225,7 +1177,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 ae78982..3e95b4e 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 */
/***********/
@@ -120,34 +117,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
*
@@ -168,7 +137,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
@@ -226,7 +195,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
@@ -303,7 +272,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
@@ -364,7 +333,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(H5G_loc_t *loc, 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)
@@ -1081,7 +1050,7 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type,
H5G_t *grp = NULL; /* Group opened */
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 66020fa..49f6fa8 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 */
/***********/
@@ -643,7 +643,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)
@@ -907,7 +907,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 6f2c8ba..5540a0e 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)
@@ -1293,7 +1293,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..d0a8210 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 */
/***********/
@@ -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 e70cbf2..75992e6 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 da2747d..e0f0e27 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 f629545..c35e5e1 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 9613c52..3a3a1c8 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 */
/***********/
diff --git a/src/H5HF.c b/src/H5HF.c
index 0464da4..efd57ae 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -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)
@@ -451,8 +455,8 @@ H5HF_get_obj_len(H5HF_t *fh, hid_t dxpl_id, const void *_id, size_t *obj_len_p)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'tiny' object's length")
} /* end if */
else {
- HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
- HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
+HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
+HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
} /* end else */
done:
@@ -461,6 +465,68 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5HF_get_obj_off
+ *
+ * Purpose: Get the offset of an entry in a fractal heap
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Aug 20 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5HF_get_obj_off(H5HF_t *fh, hid_t dxpl_id, const void *_id, hsize_t *obj_off_p)
+{
+ const uint8_t *id = (const uint8_t *)_id; /* Object ID */
+ uint8_t id_flags; /* Heap ID flag bits */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /*
+ * Check arguments.
+ */
+ HDassert(fh);
+ HDassert(id);
+ HDassert(obj_off_p);
+
+ /* Get the ID flags */
+ id_flags = *id;
+
+ /* Check for correct heap ID version */
+ if((id_flags & H5HF_ID_VERS_MASK) != H5HF_ID_VERS_CURR)
+ HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version")
+
+ /* Set the shared heap header's file context for this operation */
+ fh->hdr->f = fh->f;
+
+ /* Check type of object in heap */
+ if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_MAN) {
+ H5HF__man_get_obj_off(fh->hdr, id, obj_off_p);
+ } /* end if */
+ else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) {
+ /* Huge objects are located directly in the file */
+ if(H5HF__huge_get_obj_off(fh->hdr, dxpl_id, id, obj_off_p) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'huge' object's offset")
+ } /* end if */
+ else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) {
+ /* Tiny objects are not stored in the heap */
+ *obj_off_p = (hsize_t)0;
+ } /* end if */
+ else {
+HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
+HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HF_get_obj_off() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HF_read
*
* Purpose: Read an object from a fractal heap into a buffer
diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c
index 0229ebe..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 */
/***********/
@@ -70,7 +70,6 @@ typedef struct H5HF_huge_bt2_ctx_t {
static void *H5HF_huge_bt2_crt_context(void *udata);
static herr_t H5HF_huge_bt2_dst_context(void *ctx);
-static void *H5HF_huge_bt2_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr);
static herr_t H5HF_huge_bt2_indir_store(void *native, const void *udata);
static herr_t H5HF_huge_bt2_indir_compare(const void *rec1, const void *rec2);
@@ -78,8 +77,7 @@ static herr_t H5HF_huge_bt2_indir_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5HF_huge_bt2_indir_decode(const uint8_t *raw, void *native,
void *ctx);
-static herr_t H5HF_huge_bt2_indir_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
- int indent, int fwidth, const void *record, const void *_udata);
+static herr_t H5HF_huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, const void *record);
static herr_t H5HF_huge_bt2_filt_indir_store(void *native, const void *udata);
static herr_t H5HF_huge_bt2_filt_indir_compare(const void *rec1, const void *rec2);
@@ -87,8 +85,7 @@ static herr_t H5HF_huge_bt2_filt_indir_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5HF_huge_bt2_filt_indir_decode(const uint8_t *raw, void *native,
void *ctx);
-static herr_t H5HF_huge_bt2_filt_indir_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
- int indent, int fwidth, const void *record, const void *_udata);
+static herr_t H5HF_huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, const void *record);
static herr_t H5HF_huge_bt2_dir_store(void *native, const void *udata);
static herr_t H5HF_huge_bt2_dir_compare(const void *rec1, const void *rec2);
@@ -96,8 +93,7 @@ static herr_t H5HF_huge_bt2_dir_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5HF_huge_bt2_dir_decode(const uint8_t *raw, void *native,
void *ctx);
-static herr_t H5HF_huge_bt2_dir_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
- int indent, int fwidth, const void *record, const void *_udata);
+static herr_t H5HF_huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, const void *record);
static herr_t H5HF_huge_bt2_filt_dir_store(void *native, const void *udata);
static herr_t H5HF_huge_bt2_filt_dir_compare(const void *rec1, const void *rec2);
@@ -105,8 +101,7 @@ static herr_t H5HF_huge_bt2_filt_dir_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5HF_huge_bt2_filt_dir_decode(const uint8_t *raw, void *native,
void *ctx);
-static herr_t H5HF_huge_bt2_filt_dir_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
- int indent, int fwidth, const void *record, const void *_udata);
+static herr_t H5HF_huge_bt2_filt_dir_debug(FILE *stream, int indent, int fwidth, const void *record);
/*********************/
/* Package Variables */
@@ -122,9 +117,7 @@ const H5B2_class_t H5HF_HUGE_BT2_INDIR[1]={{ /* B-tree class information */
H5HF_huge_bt2_indir_compare, /* Record comparison callback */
H5HF_huge_bt2_indir_encode, /* Record encoding callback */
H5HF_huge_bt2_indir_decode, /* Record decoding callback */
- H5HF_huge_bt2_indir_debug, /* Record debugging callback */
- H5HF_huge_bt2_crt_dbg_context, /* Create debugging context */
- H5HF_huge_bt2_dst_context /* Destroy debugging context */
+ H5HF_huge_bt2_indir_debug /* Record debugging callback */
}};
/* v2 B-tree class for indirectly accessed, filtered 'huge' objects */
@@ -138,9 +131,7 @@ const H5B2_class_t H5HF_HUGE_BT2_FILT_INDIR[1]={{ /* B-tree class information */
H5HF_huge_bt2_filt_indir_compare, /* Record comparison callback */
H5HF_huge_bt2_filt_indir_encode, /* Record encoding callback */
H5HF_huge_bt2_filt_indir_decode, /* Record decoding callback */
- H5HF_huge_bt2_filt_indir_debug, /* Record debugging callback */
- H5HF_huge_bt2_crt_dbg_context, /* Create debugging context */
- H5HF_huge_bt2_dst_context /* Destroy debugging context */
+ H5HF_huge_bt2_filt_indir_debug /* Record debugging callback */
}};
/* v2 B-tree class for directly accessed 'huge' objects */
@@ -154,9 +145,7 @@ const H5B2_class_t H5HF_HUGE_BT2_DIR[1]={{ /* B-tree class information */
H5HF_huge_bt2_dir_compare, /* Record comparison callback */
H5HF_huge_bt2_dir_encode, /* Record encoding callback */
H5HF_huge_bt2_dir_decode, /* Record decoding callback */
- H5HF_huge_bt2_dir_debug, /* Record debugging callback */
- H5HF_huge_bt2_crt_dbg_context, /* Create debugging context */
- H5HF_huge_bt2_dst_context /* Destroy debugging context */
+ H5HF_huge_bt2_dir_debug /* Record debugging callback */
}};
/* v2 B-tree class for directly accessed, filtered 'huge' objects */
@@ -170,9 +159,7 @@ const H5B2_class_t H5HF_HUGE_BT2_FILT_DIR[1]={{ /* B-tree class information */
H5HF_huge_bt2_filt_dir_compare, /* Record comparison callback */
H5HF_huge_bt2_filt_dir_encode, /* Record encoding callback */
H5HF_huge_bt2_filt_dir_decode, /* Record decoding callback */
- H5HF_huge_bt2_filt_dir_debug, /* Record debugging callback */
- H5HF_huge_bt2_crt_dbg_context, /* Create debugging context */
- H5HF_huge_bt2_dst_context /* Destroy debugging context */
+ H5HF_huge_bt2_filt_dir_debug /* Record debugging callback */
}};
/*****************************/
@@ -209,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
@@ -265,46 +252,6 @@ H5HF_huge_bt2_dst_context(void *_ctx)
/*-------------------------------------------------------------------------
- * Function: H5HF_huge_bt2_crt_dbg_context
- *
- * Purpose: Create context for debugging callback
- *
- * Return: Success: non-NULL
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * Tuesday, December 1, 2009
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5HF_huge_bt2_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr)
-{
- H5HF_huge_bt2_ctx_t *ctx; /* Callback context structure */
- void *ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Sanity check */
- HDassert(f);
-
- /* Allocate callback context */
- if(NULL == (ctx = H5FL_MALLOC(H5HF_huge_bt2_ctx_t)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context")
-
- /* Determine the size of addresses & lengths in the file */
- ctx->sizeof_addr = H5F_SIZEOF_ADDR(f);
- ctx->sizeof_size = H5F_SIZEOF_SIZE(f);
-
- /* Set return value */
- ret_value = ctx;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5HF_huge_bt2_crt_dbg_context() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5HF_huge_bt2_indir_found
*
* Purpose: Retrieve record for indirectly accessed 'huge' object, when
@@ -505,9 +452,7 @@ H5HF_huge_bt2_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx)
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF_huge_bt2_indir_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
- int indent, int fwidth, const void *_nrecord,
- const void H5_ATTR_UNUSED *_udata)
+H5HF_huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, const void *_nrecord)
{
const H5HF_huge_bt2_indir_rec_t *nrecord = (const H5HF_huge_bt2_indir_rec_t *)_nrecord;
@@ -727,9 +672,7 @@ H5HF_huge_bt2_filt_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx)
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF_huge_bt2_filt_indir_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
- int indent, int fwidth, const void *_nrecord,
- const void H5_ATTR_UNUSED *_udata)
+H5HF_huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, const void *_nrecord)
{
const H5HF_huge_bt2_filt_indir_rec_t *nrecord = (const H5HF_huge_bt2_filt_indir_rec_t *)_nrecord;
@@ -819,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
@@ -920,9 +863,7 @@ H5HF_huge_bt2_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx)
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF_huge_bt2_dir_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
- int indent, int fwidth, const void *_nrecord,
- const void H5_ATTR_UNUSED *_udata)
+H5HF_huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, const void *_nrecord)
{
const H5HF_huge_bt2_dir_rec_t *nrecord = (const H5HF_huge_bt2_dir_rec_t *)_nrecord;
@@ -1044,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
@@ -1149,8 +1090,7 @@ H5HF_huge_bt2_filt_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx)
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF_huge_bt2_filt_dir_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
- int indent, int fwidth, const void *_nrecord, const void H5_ATTR_UNUSED *_udata)
+H5HF_huge_bt2_filt_dir_debug(FILE *stream, int indent, int fwidth, const void *_nrecord)
{
const H5HF_huge_bt2_filt_dir_rec_t *nrecord = (const H5HF_huge_bt2_filt_dir_rec_t *)_nrecord;
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index ec8d9a6..88973a5 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
diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c
index 5183b67..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 */
/***********/
@@ -100,6 +100,80 @@ static herr_t H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream,
/*-------------------------------------------------------------------------
+ * Function: H5HF_id_print
+ *
+ * Purpose: Prints a fractal heap ID.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Aug 20 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5HF_id_print(H5HF_t *fh, hid_t dxpl_id, const void *_id, FILE *stream, int indent, int fwidth)
+{
+ const uint8_t *id = (const uint8_t *)_id; /* Object ID */
+ uint8_t id_flags; /* Heap ID flag bits */
+ hsize_t obj_off; /* Offset of object */
+ size_t obj_len; /* Length of object */
+ char id_type; /* Character for the type of heap ID */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /*
+ * Check arguments.
+ */
+ HDassert(fh);
+ HDassert(id);
+ HDassert(stream);
+ HDassert(indent >= 0);
+ HDassert(fwidth >= 0);
+
+ /* Get the ID flags */
+ id_flags = *id;
+
+ /* Check for correct heap ID version */
+ if((id_flags & H5HF_ID_VERS_MASK) != H5HF_ID_VERS_CURR)
+ HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version")
+
+ /* Check type of object in heap */
+ if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_MAN) {
+ id_type = 'M';
+ } /* end if */
+ else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) {
+ id_type = 'H';
+ } /* end if */
+ else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) {
+ id_type = 'T';
+ } /* end if */
+ else {
+HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
+HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
+ } /* end else */
+
+ /* Get the length of the heap object */
+ if(H5HF_get_obj_len(fh, dxpl_id, id, &obj_len) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve heap ID length")
+
+ /* Get the offset of the heap object */
+ if(H5HF_get_obj_off(fh, dxpl_id, id, &obj_off) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve heap ID length")
+
+ /* Display the heap ID */
+ HDfprintf(stream, "%*s%-*s (%c, %Hu, %Zu)\n", indent, "", fwidth,
+ "Heap ID info: (type, offset, length)",
+ id_type, obj_off, obj_len);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HF_id_print() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HF_dtable_debug
*
* Purpose: Prints debugging info about a doubling table
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 7f0da02..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
@@ -585,6 +585,93 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5HF__huge_get_obj_off
+ *
+ * Purpose: Get the offset of a 'huge' object in a fractal heap
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Aug 8 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
+ hsize_t *obj_off_p)
+{
+ haddr_t obj_addr; /* Object's address in the file */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /*
+ * Check arguments.
+ */
+ HDassert(hdr);
+ HDassert(H5F_addr_defined(hdr->huge_bt2_addr));
+ HDassert(id);
+ HDassert(obj_off_p);
+
+ /* Skip over the flag byte */
+ id++;
+
+ /* Check if 'huge' object ID encodes address & length directly */
+ if(hdr->huge_ids_direct) {
+ /* Retrieve the object's address (common) */
+ H5F_addr_decode(hdr->f, &id, &obj_addr);
+ } /* end if */
+ else {
+ /* Sanity check */
+ HDassert(H5F_addr_defined(hdr->huge_bt2_addr));
+
+ /* Check if v2 B-tree is open yet */
+ if(NULL == hdr->huge_bt2) {
+ /* Open existing v2 B-tree */
+ if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' heap objects")
+ } /* end if */
+
+ if(hdr->filter_len > 0) {
+ H5HF_huge_bt2_filt_indir_rec_t found_rec; /* Record found from tracking object */
+ H5HF_huge_bt2_filt_indir_rec_t search_rec; /* Record for searching for object */
+
+ /* Get ID for looking up 'huge' object in v2 B-tree */
+ UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size)
+
+ /* Look up object in v2 B-tree */
+ if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE)
+ HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree")
+
+ /* Retrieve the object's address & length */
+ obj_addr = found_rec.addr;
+ } /* end if */
+ else {
+ H5HF_huge_bt2_indir_rec_t found_rec; /* Record found from tracking object */
+ H5HF_huge_bt2_indir_rec_t search_rec; /* Record for searching for object */
+
+ /* Get ID for looking up 'huge' object in v2 B-tree */
+ UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size)
+
+ /* Look up object in v2 B-tree */
+ if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE)
+ HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree")
+
+ /* Retrieve the object's address & length */
+ obj_addr = found_rec.addr;
+ } /* end else */
+ } /* end else */
+
+ /* Set the value to return */
+ *obj_off_p = (hsize_t)obj_addr;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5HF__huge_get_obj_off() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HF_huge_op_real
*
* Purpose: Internal routine to perform an operation on a 'huge' object
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 5f95a91..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 */
@@ -256,6 +257,41 @@ H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p)
/*-------------------------------------------------------------------------
+ * Function: H5HF__man_get_obj_off
+ *
+ * Purpose: Get the offset of a managed heap object
+ *
+ * Return: SUCCEED (Can't fail)
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Aug 20 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5HF__man_get_obj_off(const H5HF_hdr_t *hdr, const uint8_t *id, hsize_t *obj_off_p)
+{
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /*
+ * Check arguments.
+ */
+ HDassert(hdr);
+ HDassert(id);
+ HDassert(obj_off_p);
+
+ /* Skip over the flag byte */
+ id++;
+
+ /* Skip over object offset */
+ UINT64DECODE_VAR(id, *obj_off_p, hdr->heap_off_size);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5HF__man_get_obj_off() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HF_man_op_real
*
* Purpose: Internal routine to perform an operation on a managed heap
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 4655d83..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
@@ -702,6 +702,8 @@ H5_DLL herr_t H5HF_man_insert(H5HF_hdr_t *fh, hid_t dxpl_id, size_t obj_size,
const void *obj, void *id);
H5_DLL herr_t H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id,
size_t *obj_len_p);
+H5_DLL void H5HF__man_get_obj_off(const H5HF_hdr_t *hdr, const uint8_t *id,
+ hsize_t *obj_off_p);
H5_DLL herr_t H5HF_man_read(H5HF_hdr_t *fh, hid_t dxpl_id, const uint8_t *id,
void *obj);
H5_DLL herr_t H5HF_man_write(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
@@ -716,6 +718,8 @@ H5_DLL herr_t H5HF_huge_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size,
void *obj, void *id);
H5_DLL herr_t H5HF_huge_get_obj_len(H5HF_hdr_t *hdr, hid_t dxpl_id,
const uint8_t *id, size_t *obj_len_p);
+H5_DLL herr_t H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, hid_t dxpl_id,
+ const uint8_t *id, hsize_t *obj_off_p);
H5_DLL herr_t H5HF_huge_read(H5HF_hdr_t *fh, hid_t dxpl_id, const uint8_t *id,
void *obj);
H5_DLL herr_t H5HF_huge_write(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
@@ -748,7 +752,7 @@ H5_DLL herr_t H5HF_tiny_remove(H5HF_hdr_t *fh, const uint8_t *id);
/* Debugging routines for dumping file structures */
H5_DLL void H5HF_hdr_print(const H5HF_hdr_t *hdr, hid_t dxpl_id,
- hbool_t dump_internal, FILE *stream, int indent, int fwidth);
+ hbool_t dump_internal, FILE *stream, int indent, int fwidth);
H5_DLL herr_t H5HF_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
FILE *stream, int indent, int fwidth);
H5_DLL herr_t H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h
index 55daa30..441ad3e 100644
--- a/src/H5HFprivate.h
+++ b/src/H5HFprivate.h
@@ -116,6 +116,8 @@ H5_DLL herr_t H5HF_insert(H5HF_t *fh, hid_t dxpl_id, size_t size,
const void *obj, void *id/*out*/);
H5_DLL herr_t H5HF_get_obj_len(H5HF_t *fh, hid_t dxpl_id, const void *id,
size_t *obj_len_p/*out*/);
+H5_DLL herr_t H5HF_get_obj_off(H5HF_t *fh, hid_t dxpl_id, const void *_id,
+ hsize_t *obj_off_p/*out*/);
H5_DLL herr_t H5HF_read(H5HF_t *fh, hid_t dxpl_id, const void *id,
void *obj/*out*/);
H5_DLL herr_t H5HF_write(H5HF_t *fh, hid_t dxpl_id, void *id, hbool_t *id_changed,
@@ -131,6 +133,8 @@ H5_DLL herr_t H5HF_stat_info(const H5HF_t *fh, H5HF_stat_t *stats);
H5_DLL herr_t H5HF_size(const H5HF_t *fh, hid_t dxpl_id, hsize_t *heap_size/*out*/);
/* Debugging routines */
+H5_DLL herr_t H5HF_id_print(H5HF_t *fh, hid_t dxpl_id,
+ const void *id, FILE *stream, int indent, int fwidth);
#ifdef H5HF_DEBUGGING
H5_DLL herr_t H5HF_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
FILE *stream, int indent, int fwidth);
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 */
/***********/
diff --git a/src/H5HG.c b/src/H5HG.c
index 46b535d..bc9d5e3 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -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 */
/***********/
diff --git a/src/H5HL.c b/src/H5HL.c
index 49af528..7631e8c 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -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)
@@ -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 */
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
diff --git a/src/H5I.c b/src/H5I.c
index 0e8120e..1486603 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -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 */
@@ -57,7 +54,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 */
@@ -121,6 +118,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 */
@@ -159,29 +159,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
@@ -197,20 +176,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) {
@@ -220,16 +199,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() */
/*-------------------------------------------------------------------------
@@ -256,9 +237,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);
@@ -308,10 +289,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() */
@@ -485,8 +465,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)
@@ -522,7 +502,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);
@@ -643,7 +623,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() */
@@ -667,7 +646,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);
@@ -749,7 +728,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);
@@ -844,8 +823,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)
@@ -884,7 +863,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))) {
@@ -893,7 +872,6 @@ H5I_object(hid_t id)
ret_value = (void *)id_ptr->obj_ptr;
} /* end if */
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end if */
@@ -918,7 +896,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);
@@ -957,7 +935,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);
@@ -968,7 +946,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() */
@@ -992,16 +969,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() */
@@ -1024,7 +1000,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);
@@ -1059,7 +1035,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);
@@ -1126,8 +1102,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
@@ -1167,9 +1143,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)
@@ -1208,7 +1184,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);
@@ -1246,8 +1222,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)
@@ -1316,8 +1292,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)
@@ -1364,7 +1340,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)
@@ -1442,8 +1418,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)
@@ -1517,8 +1493,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)
@@ -1592,8 +1568,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
@@ -1676,8 +1652,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)
@@ -1765,7 +1741,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
@@ -1843,7 +1819,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
@@ -2111,7 +2087,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
@@ -2268,7 +2244,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 = FAIL; /* 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)
diff --git a/src/H5L.c b/src/H5L.c
index e4a7b4b..7828ca7 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -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 */
@@ -142,6 +140,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 */
@@ -186,7 +187,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L_init_interface
+ * Function: H5L__init_package
*
* Purpose: Initialize information specific to H5L interface.
*
@@ -197,12 +198,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)
@@ -210,13 +211,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
*
@@ -226,21 +227,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() */
/*-------------------------------------------------------------------------
@@ -2974,7 +2981,7 @@ 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
@@ -3160,7 +3167,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 90d2b68..7c6a2b7 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 */
@@ -30,13 +35,52 @@
#include "H5Pprivate.h" /* Property lists */
#include "H5VLprivate.h" /* Virtual Object Layer */
+
+/****************/
+/* 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 */
@@ -48,41 +92,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,
@@ -126,8 +138,6 @@ H5L_getenv_prefix_name(char **env_prefix/*in,out*/)
*
* Programmer: Vailin Choi, April 2, 2008
*
- * Modification: Raymond Lu, 14 Jan. 2009
- * Added support for OpenVMS pathname
--------------------------------------------------------------------------*/
static herr_t
H5L_build_name(char *prefix, char *file_name, char **full_name/*out*/)
@@ -213,7 +223,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)
@@ -282,7 +292,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 = %zu", group_name_len)
} /* end if */
else
parent_group_name = local_group_name;
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
diff --git a/src/H5MF.c b/src/H5MF.c
index 0c98654..52ea82a 100644
--- a/src/H5MF.c
+++ b/src/H5MF.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 */
/***********/
@@ -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
diff --git a/src/H5MP.c b/src/H5MP.c
index 4820b76..50fc598 100644
--- a/src/H5MP.c
+++ b/src/H5MP.c
@@ -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 */
diff --git a/src/H5O.c b/src/H5O.c
index 20e5a47..e7148f8 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -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 */
@@ -91,6 +89,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
@@ -175,7 +176,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.
*
@@ -184,16 +185,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));
@@ -202,7 +199,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() */
/*-------------------------------------------------------------------------
@@ -254,7 +251,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id)
/* Open the object through the VOL */
if(NULL == (opened_obj = H5VL_object_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls, &opened_type,
H5AC_dxpl_id, H5_REQUEST_NULL)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
if((ret_value = H5VL_register_id(opened_type, opened_obj, obj->vol_info, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize object handle")
@@ -327,7 +324,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
/* Open the object through the VOL */
if(NULL == (opened_obj = H5VL_object_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls, &opened_type,
H5AC_ind_dxpl_id, H5_REQUEST_NULL)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
if((ret_value = H5VL_register_id(opened_type, opened_obj, obj->vol_info, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize object handle")
@@ -395,7 +392,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
/* Open the object through the VOL */
if(NULL == (opened_obj = H5VL_object_open(obj->vol_obj, loc_params, obj->vol_info->vol_cls, &opened_type,
H5AC_ind_dxpl_id, H5_REQUEST_NULL)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
if((ret_value = H5VL_register_id(opened_type, opened_obj, obj->vol_info, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize object handle")
@@ -844,7 +841,7 @@ H5Oset_comment(hid_t obj_id, const char *comment)
/* set comment on object through the VOL */
if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to set comment value")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment value")
done:
FUNC_LEAVE_API(ret_value)
@@ -900,7 +897,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment,
/* set comment on object through the VOL */
if(H5VL_object_optional(obj->vol_obj, obj->vol_info->vol_cls, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to set comment value")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment value")
done:
FUNC_LEAVE_API(ret_value)
@@ -1065,7 +1062,7 @@ H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
if((ret_value = H5VL_object_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
H5VL_OBJECT_VISIT, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
idx_type, order, op, op_data)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "link iteration failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1144,7 +1141,7 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
if((ret_value = H5VL_object_specific(obj->vol_obj, loc_params, obj->vol_info->vol_cls,
H5VL_OBJECT_VISIT, H5AC_ind_dxpl_id, H5_REQUEST_NULL,
idx_type, order, op, op_data)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "link iteration failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1489,17 +1486,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() */
@@ -1522,7 +1519,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)
@@ -1619,7 +1616,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)
@@ -1735,7 +1732,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)
@@ -1786,7 +1783,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)
@@ -2005,8 +2002,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)
@@ -2500,7 +2497,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)
@@ -2537,7 +2534,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)
@@ -2579,7 +2576,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
@@ -3399,7 +3396,7 @@ H5O_visit(H5G_loc_t *loc, 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 b0e603c..d404101 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 f94dd3c..71af5b7e 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 */
diff --git a/src/H5Odbg.c b/src/H5Odbg.c
index 0388cd5..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)
@@ -454,20 +455,23 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i
if(oh->mesg[i].flags) {
hbool_t flag_printed = FALSE;
- if(oh->mesg[i].flags & H5O_MSG_FLAG_SHARED) {
- HDfprintf(stream, "<S");
- flag_printed = TRUE;
- } /* end if */
+ /* Sanity check that all flags in format are covered below */
+ HDcompile_assert(H5O_MSG_FLAG_BITS == (H5O_MSG_FLAG_CONSTANT|H5O_MSG_FLAG_SHARED|H5O_MSG_FLAG_DONTSHARE|H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE|H5O_MSG_FLAG_MARK_IF_UNKNOWN|H5O_MSG_FLAG_WAS_UNKNOWN|H5O_MSG_FLAG_SHAREABLE|H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS));
+
if(oh->mesg[i].flags & H5O_MSG_FLAG_CONSTANT) {
HDfprintf(stream, "%sC", (flag_printed ? ", " : "<"));
flag_printed = TRUE;
} /* end if */
+ if(oh->mesg[i].flags & H5O_MSG_FLAG_SHARED) {
+ HDfprintf(stream, "%sS", (flag_printed ? ", " : "<"));
+ flag_printed = TRUE;
+ } /* end if */
if(oh->mesg[i].flags & H5O_MSG_FLAG_DONTSHARE) {
HDfprintf(stream, "%sDS", (flag_printed ? ", " : "<"));
flag_printed = TRUE;
} /* end if */
if(oh->mesg[i].flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE) {
- HDfprintf(stream, "%sFIU", (flag_printed ? ", " : "<"));
+ HDfprintf(stream, "%sFIUW", (flag_printed ? ", " : "<"));
flag_printed = TRUE;
} /* end if */
if(oh->mesg[i].flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN) {
@@ -479,6 +483,14 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i
HDfprintf(stream, "%sWU", (flag_printed ? ", " : "<"));
flag_printed = TRUE;
} /* end if */
+ if(oh->mesg[i].flags & H5O_MSG_FLAG_SHAREABLE) {
+ HDfprintf(stream, "%sSA", (flag_printed ? ", " : "<"));
+ flag_printed = TRUE;
+ } /* end if */
+ if(oh->mesg[i].flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS) {
+ HDfprintf(stream, "%sFIUA", (flag_printed ? ", " : "<"));
+ flag_printed = TRUE;
+ } /* end if */
if(!flag_printed)
HDfprintf(stream, "-");
HDfprintf(stream, ">\n");
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 4062f19..2dfee20 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..34c0e9f 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,8 +258,8 @@ 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 */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -460,9 +460,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..cc8a7dd 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,35 @@ 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) {
+ /* 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")
+
+ /* Copy over the raw data */
+ HDmemcpy(dest->storage.u.compact.buf, mesg->storage.u.compact.buf, dest->storage.u.compact.size);
+ } /* end if */
+ break;
- /* Copy over the raw data */
- HDmemcpy(dest->storage.u.compact.buf, mesg->storage.u.compact.buf, dest->storage.u.compact.size);
- } /* end if */
+ 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;
- /* 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);
+ 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 +452,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 +610,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 +703,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 +726,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 53191ca..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
@@ -834,7 +835,7 @@ H5O_link_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Link Name Character Set:", (lnk->cset == H5T_CSET_ASCII ?
"ASCII" : (lnk->cset == H5T_CSET_UTF8 ? "UTF-8" : "Unknown")));
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s '%s'\n", indent, "", fwidth,
"Link Name:", lnk->name);
/* Display link-specific information */
@@ -845,7 +846,7 @@ H5O_link_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void
break;
case H5L_TYPE_SOFT:
- HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ HDfprintf(stream, "%*s%-*s '%s'\n", indent, "", fwidth,
"Link Value:", lnk->u.soft.name);
break;
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 f990fdd..c937786 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 94a438a..6accb1e 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..0f3eb5d 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
@@ -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
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 */
diff --git a/src/H5P.c b/src/H5P.c
index ff230ed..b58271c 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -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
diff --git a/src/H5PL.c b/src/H5PL.c
index 06bbe7e..7c31639 100644
--- a/src/H5PL.c
+++ b/src/H5PL.c
@@ -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 */
/***********/
@@ -53,7 +52,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 ";"
@@ -104,6 +102,7 @@ typedef const void *(*H5PL_get_plugin_info_t)(void);
/* Special symbol to indicate no plugin loading */
#define H5PL_NO_PLUGIN "::"
+
/******************/
/* Local Typedefs */
/******************/
@@ -132,6 +131,9 @@ static herr_t H5PL__close(H5PL_HANDLE handle);
/* Package Variables */
/*********************/
+/* Package initialization variable */
+hbool_t H5_PKG_INIT_VAR = FALSE;
+
/*****************************/
/* Library Private Variables */
@@ -160,36 +162,106 @@ 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_filter_table_g) {
+ for(u = 0; u < H5PL_filter_table_used_g; u++)
+ H5PL__close((H5PL_filter_table_g[u]).handle);
+
+ /* Free the table of dynamic libraries */
+ H5PL_filter_table_g = (H5PL_table_t *)H5MM_xfree(H5PL_filter_table_g);
+ H5PL_filter_table_used_g = H5PL_filter_table_alloc_g = 0;
+ n++;
+ }
+
+ /* Close opened dynamic vol libraries */
+ if(H5PL_vol_table_g) {
+ for(u = 0; u < H5PL_vol_table_used_g; u++) {
+ H5PL__close((H5PL_vol_table_g[u]).handle);
+ HDfree(H5PL_vol_table_g[u].pl_name);
+ }
+
+ /* Free the table of dynamic vol libraries */
+ H5PL_vol_table_g = (H5PL_table_t *)H5MM_xfree(H5PL_vol_table_g);
+ H5PL_vol_table_used_g = H5PL_vol_table_alloc_g = 0;
+ n++;
+ }
+
+ /* 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() */
/*-------------------------------------------------------------------------
@@ -216,21 +288,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
*
@@ -247,76 +322,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_filter_table_used_g; u++)
- H5PL__close((H5PL_filter_table_g[u]).handle);
-
- /* Close opened dynamic vol libraries */
- for(u = 0; u < H5PL_vol_table_used_g; u++) {
- H5PL__close((H5PL_vol_table_g[u]).handle);
- HDfree(H5PL_vol_table_g[u].pl_name);
- }
-
- /* Free the table of dynamic libraries */
- H5PL_filter_table_g = (H5PL_table_t *)H5MM_xfree(H5PL_filter_table_g);
- H5PL_filter_table_used_g = H5PL_filter_table_alloc_g = 0;
-
- /* Free the table of dynamic vol libraries */
- H5PL_vol_table_g = (H5PL_table_t *)H5MM_xfree(H5PL_vol_table_g);
- H5PL_vol_table_used_g = H5PL_vol_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
@@ -342,17 +358,19 @@ H5PL_load(H5PL_type_t type, int id, const char *name)
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;
- case H5PL_TYPE_VOL:
- if((H5PL_plugin_g & H5PL_VOL_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)
- }
+ 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_VOL:
+ if((H5PL_plugin_g & H5PL_VOL_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.
@@ -828,3 +846,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 89f4649..1f1d2c7 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..7b5108a 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 */
/***********/
@@ -282,5 +283,5 @@ 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 */
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index e41fe68..896e321 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 */
/****************/
@@ -496,7 +496,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 */
@@ -536,15 +536,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;
@@ -1203,8 +1203,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 */
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 b5bc720..33423f1 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 */
@@ -167,6 +168,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
/******************/
/* Local Typedefs */
@@ -271,6 +277,7 @@ static const hbool_t H5D_def_direct_chunk_flag_g = H5D_XFER_DIRECT_CHUNK_WRITE_F
static const uint32_t H5D_def_direct_chunk_filters_g = H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_DEF; /* Default value for the filters of direct chunk write */
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 H5AC_ring_t H5D_ring_g = H5AC_XFER_RING_DEF; /* Default value for the cache entry ring type */
/*-------------------------------------------------------------------------
@@ -465,6 +472,12 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass)
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 data transform property */
+ 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() */
diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c
index bd0a260..3ed150b 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
@@ -793,7 +765,7 @@ H5P__decode(const void *buf)
HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "property decoding routine failed, property: '%s'", name)
} /* end if */
else
- HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "no decode callback for property: '%s', name")
+ 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)
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index d31dd94..4dec167 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 */
/***********/
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 0736288..47a4354 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 05848fc7..b939310 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 */
/***********/
@@ -96,7 +93,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;
@@ -135,7 +132,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;
@@ -312,89 +309,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
@@ -412,22 +337,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.
@@ -490,16 +415,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
@@ -511,13 +436,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 */
@@ -597,25 +522,87 @@ 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
+
+ /* 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() */
/*--------------------------------------------------------------------------
@@ -934,7 +921,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
@@ -1050,8 +1037,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
@@ -1171,7 +1158,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
@@ -1231,7 +1218,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
@@ -1541,8 +1528,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)
@@ -1636,10 +1623,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
@@ -1775,10 +1762,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)
@@ -3383,7 +3370,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)
@@ -3436,7 +3423,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)
@@ -3486,7 +3473,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)
@@ -4759,7 +4746,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)
@@ -4797,7 +4784,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
@@ -4863,7 +4850,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
@@ -4943,7 +4930,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
@@ -5010,7 +4997,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 e3b3c4f..443e068 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 */
diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c
index 7d2b7f4..18164ed 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 d7d4bc9..4bca56a 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 */
/***********/
@@ -1639,6 +1640,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:
diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c
index 45ba778..4a47dbc 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 */
/***********/
@@ -295,6 +296,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);
@@ -439,6 +443,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,6 +608,8 @@ 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)))
diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h
index 2942a4d..105baf7 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 b74b1cd4..7c232b4 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -34,13 +34,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 */
/****************************/
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..6dd52f9 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)
diff --git a/src/H5R.c b/src/H5R.c
index 714d408..0e062d1 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -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 */
/***********/
@@ -58,6 +55,9 @@
/* Package Variables */
/*********************/
+/* Package initialization variable */
+hbool_t H5_PKG_INIT_VAR = FALSE;
+
/*****************************/
/* Library Private Variables */
@@ -76,39 +76,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
@@ -116,33 +93,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...
@@ -150,32 +131,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() */
- /* Mark closed */
- H5_interface_initialize_g = 0;
- } /* end else */
+
+/*--------------------------------------------------------------------------
+ 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 */
+ 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
@@ -924,9 +942,10 @@ H5R_get_name(H5G_loc_t *loc, hid_t lapl_id, hid_t dxpl_id, H5R_type_t ref_type,
const void *_ref, char *name, size_t size)
{
H5F_t *f;
- 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 d08236c..710adaf 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 */
/***********/
@@ -86,51 +83,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 c74329f..581d79b 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
@@ -55,8 +55,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,
diff --git a/src/H5S.c b/src/H5S.c
index 9b37797..8850369 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -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 */
/***********/
@@ -63,6 +60,9 @@ static H5S_t *H5S_decode(const unsigned char *buf);
/* Package Variables */
/*********************/
+/* Package initialization variable */
+hbool_t H5_PKG_INIT_VAR = FALSE;
+
/*****************************/
/* Library Private Variables */
@@ -80,7 +80,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 +90,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 +143,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_term_interface() */
+} /* 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_package() */
/*--------------------------------------------------------------------------
@@ -185,12 +230,12 @@ 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)
/* Create a new dataspace */
- if(NULL == (new_ds = H5FL_MALLOC(H5S_t)))
+ if(NULL == (new_ds = H5FL_CALLOC(H5S_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Initialize default dataspace state */
@@ -588,8 +633,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)
@@ -640,7 +685,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 +761,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 +866,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 +951,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 +1010,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 +1118,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 +1166,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
@@ -1426,7 +1471,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)
@@ -1623,7 +1668,7 @@ H5S_decode(const unsigned char *buf)
size_t extent_size; /* size of the extent message*/
H5F_t *f = NULL; /* Fake file structure*/
uint8_t sizeof_size; /* 'Size of sizes' for file */
- H5S_t *ret_value;
+ H5S_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1705,7 +1750,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 +1948,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
diff --git a/src/H5SL.c b/src/H5SL.c
index d766066..1cd64ec 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -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 */
+
diff --git a/src/H5SM.c b/src/H5SM.c
index 1d391f1..e25d780 100644
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -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")
@@ -2580,14 +2609,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr,
- FILE *stream, int indent, int fwidth,
- unsigned table_vers, size_t num_messages)
+H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr, FILE *stream,
+ int indent, int fwidth, haddr_t table_addr)
{
-
+ H5SM_master_table_t *table = NULL; /* SOHM master table */
H5SM_list_t *list = NULL; /* SOHM index list for message type (if in list form) */
- H5SM_index_header_t header; /* A "false" header used to read the list */
- H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */
+ H5SM_list_cache_ud_t lst_cache_udata; /* List user-data for metadata cache callback */
+ H5SM_table_cache_ud_t tbl_cache_udata; /* Table user-data for metadata cache callback */
+ H5HF_t *fh = NULL; /* Fractal heap for SOHM messages */
+ unsigned index_num; /* Index of list, within master table */
unsigned x; /* Counter variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2599,36 +2629,51 @@ H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr,
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- /* Check arguments. Version must be 0, the only version implemented so far */
- if(table_vers > H5SM_LIST_VERSION)
- HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, FAIL, "unknown shared message list version")
- if(num_messages == 0 || num_messages > H5O_SHMESG_MAX_LIST_SIZE)
- HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, FAIL, "number of indexes must be between 1 and H5O_SHMESG_MAX_NINDEXES")
+ /* Set up user data for callback */
+ tbl_cache_udata.f = f;
- /* Create a temporary header using the arguments. The cache needs this to load the list. */
- HDmemset(&header, 0, sizeof(H5SM_index_header_t));
- header.list_max = header.num_messages = num_messages;
- header.index_type = H5SM_LIST;
- header.index_addr = list_addr;
+ /* Look up the master SOHM table */
+ if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, &tbl_cache_udata, H5AC__READ_ONLY_FLAG)))
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
+
+ /* Determine which index the list is part of */
+ index_num = table->num_indexes;
+ for(x = 0; x < table->num_indexes; x++) {
+ if(H5F_addr_eq(table->indexes[x].index_addr, list_addr)) {
+ index_num = x;
+ break;
+ } /* end if */
+ } /* end for */
+ if(x == table->num_indexes)
+ HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, FAIL, "list address doesn't match address for any indices in table")
/* Set up user data for metadata cache callback */
- cache_udata.f = f;
- cache_udata.header = &header;
+ lst_cache_udata.f = f;
+ lst_cache_udata.header = &(table->indexes[index_num]);
/* Get the list from the cache */
- if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, list_addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
+ if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, list_addr, &lst_cache_udata, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
+ /* Open the heap, if one exists */
+ if(H5F_addr_defined(table->indexes[index_num].heap_addr))
+ if(NULL == (fh = H5HF_open(f, dxpl_id, table->indexes[index_num].heap_addr)))
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open SOHM heap")
+
HDfprintf(stream, "%*sShared Message List Index...\n", indent, "");
- for(x = 0; x < num_messages; ++x) {
+ for(x = 0; x < table->indexes[index_num].num_messages; ++x) {
HDfprintf(stream, "%*sShared Object Header Message %d...\n", indent, "", x);
HDfprintf(stream, "%*s%-*s %08lu\n", indent + 3, "", fwidth,
"Hash value:", (unsigned long)list->messages[x].hash);
if(list->messages[x].location == H5SM_IN_HEAP) {
+ HDassert(fh);
+
HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth,
"Location:", "in heap");
- HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", fwidth,
+ HDfprintf(stream, "%*s%-*s 0x%Zx\n", indent + 3, "", fwidth,
"Heap ID:", list->messages[x].u.heap_loc.fheap_id);
+H5HF_id_print(fh, dxpl_id,
+ &(list->messages[x].u.heap_loc.fheap_id), stream, indent + 6, (fwidth - 3));
HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", fwidth,
"Reference count:", list->messages[x].u.heap_loc.ref_count);
} /* end if */
@@ -2648,8 +2693,12 @@ H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr,
} /* end for */
done:
+ if(fh && H5HF_close(fh, dxpl_id) < 0)
+ HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "unable to close SOHM heap")
if(list && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_LIST, list_addr, list, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
+ if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
} /* end H5SM_list_debug() */
diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c
index e18e9fb..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 */
/***********/
@@ -48,9 +48,8 @@
static void *H5SM_bt2_crt_context(void *udata);
static herr_t H5SM_bt2_dst_context(void *ctx);
static herr_t H5SM_bt2_store(void *native, const void *udata);
-static herr_t H5SM_bt2_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
- int indent, int fwidth, const void *record, const void *_udata);
-static void *H5SM_bt2_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr);
+static herr_t H5SM_bt2_debug(FILE *stream, int indent, int fwidth,
+ const void *record);
/*****************************/
@@ -67,9 +66,7 @@ const H5B2_class_t H5SM_INDEX[1]={{ /* B-tree class information */
H5SM_message_compare, /* Record comparison callback */
H5SM_message_encode, /* Record encoding callback */
H5SM_message_decode, /* Record decoding callback */
- H5SM_bt2_debug, /* Record debugging callback */
- H5SM_bt2_crt_dbg_context, /* Create debugging context */
- H5SM_bt2_dst_context /* Destroy debugging context */
+ H5SM_bt2_debug /* Record debugging callback */
}};
@@ -100,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
@@ -195,8 +192,7 @@ H5SM_bt2_store(void *native, const void *udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5SM_bt2_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
- int indent, int fwidth, const void *record, const void H5_ATTR_UNUSED *_udata)
+H5SM_bt2_debug(FILE *stream, int indent, int fwidth, const void *record)
{
const H5SM_sohm_t *sohm = (const H5SM_sohm_t *)record;
@@ -218,45 +214,6 @@ H5SM_bt2_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED
/*-------------------------------------------------------------------------
- * Function: H5SM_bt2_crt_dbg_context
- *
- * Purpose: Create context for debugging callback
- *
- * Return: Success: non-NULL
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * Tuesday, December 1, 2009
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5SM_bt2_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr)
-{
- H5SM_bt2_ctx_t *ctx; /* Callback context structure */
- void *ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Sanity check */
- HDassert(f);
-
- /* Allocate callback context */
- if(NULL == (ctx = H5FL_MALLOC(H5SM_bt2_ctx_t)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context")
-
- /* Determine the size of addresses & lengths in the file */
- ctx->sizeof_addr = H5F_SIZEOF_ADDR(f);
-
- /* Set return value */
- ret_value = ctx;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5SM_bt2_crt_dbg_context() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5SM_bt2_convert_to_list_op
*
* Purpose: An H5B2_remove_t callback function to convert a SOHM
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/H5SMprivate.h b/src/H5SMprivate.h
index d072434..57afacf 100644
--- a/src/H5SMprivate.h
+++ b/src/H5SMprivate.h
@@ -74,7 +74,7 @@ H5_DLL herr_t H5SM_table_debug(H5F_t *f, hid_t dxpl_id, haddr_t table_addr,
FILE *stream, int indent, int fwidth, unsigned table_vers,
unsigned num_indexes);
H5_DLL herr_t H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr,
- FILE *stream, int indent, int fwidth, unsigned list_vers, size_t num_messages);
+ FILE *stream, int indent, int fwidth, haddr_t table_addr);
#endif /*_H5SMprivate_H*/
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..c373fd1 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 */
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..12e23fa 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
@@ -2890,7 +2890,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 +3045,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 +3076,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 +3141,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
@@ -4833,7 +4834,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 +4849,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 +4860,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 +4877,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 +4887,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 +4897,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 +4936,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 +4947,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 +4964,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 +4974,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 +4984,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 +5015,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 +5030,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 +5047,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 +5057,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 +5067,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 +5107,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 +5122,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 +5139,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 +5149,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 +5159,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 +5188,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 +5202,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 +5215,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 +5260,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 +5297,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 +5312,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 +5361,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 +5401,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 +5419,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 +5456,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 +5474,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 +5500,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 +5512,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 +5524,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 +5628,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 +5690,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 +7100,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,18 +7120,18 @@ 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")
/* Add in the new hyperslab information */
@@ -7144,7 +7145,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
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 +8721,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 +8795,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..6a4474d 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"
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index 5f84717..8213919 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
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index 20a60bb..d225ab2 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
@@ -1208,7 +1208,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 +1245,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 +1285,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..54c70f0 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))
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index e04ae16..3f0bc4f 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
@@ -452,10 +452,10 @@ H5S_select_valid(const H5S_t *space)
herr_t
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)
@@ -611,7 +611,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 +652,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 +690,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 +727,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 +764,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 +801,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 +839,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 +879,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 +914,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 +969,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 +1051,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 +1130,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 +1213,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 +1430,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)
diff --git a/src/H5T.c b/src/H5T.c
index 0e51d66..50ac511 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -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 */
/***********/
@@ -305,12 +301,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;
@@ -530,6 +529,9 @@ static const H5I_class_t H5I_DATATYPE_CLS[1] = {{
(H5I_free_t)H5T_close_datatype /* 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;
+
/*-------------------------------------------------------------------------
@@ -538,48 +540,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 */
@@ -588,7 +584,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)))
@@ -674,63 +670,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 */
@@ -778,17 +733,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 */
@@ -1005,7 +956,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
@@ -1022,7 +973,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)
@@ -1295,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 */
@@ -1314,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)
@@ -1339,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
@@ -1357,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() */
/*-------------------------------------------------------------------------
@@ -1866,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)
@@ -2913,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
@@ -3119,7 +3127,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)
@@ -3448,7 +3456,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
@@ -3536,21 +3544,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:
@@ -3566,11 +3576,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)
@@ -3645,7 +3657,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 */
@@ -4379,7 +4391,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
*
@@ -4398,7 +4410,7 @@ 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)
@@ -4757,7 +4769,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
@@ -5051,7 +5063,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)
diff --git a/src/H5TS.c b/src/H5TS.c
index d4b90db..987bead 100644
--- a/src/H5TS.c
+++ b/src/H5TS.c
@@ -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 c9a4420..8b70a7b 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 */
/***********/
@@ -88,28 +85,6 @@ H5FL_EXTERN(H5VL_t);
H5FL_EXTERN(H5VL_object_t);
-/*--------------------------------------------------------------------------
-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
*
@@ -211,10 +186,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
@@ -530,7 +505,7 @@ done:
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)
@@ -686,7 +661,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)
@@ -802,7 +777,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 b14f6e5..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) {
@@ -4255,7 +4256,11 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception")
goto padding;
-#ifndef H5_VMS /*Temporary solution to handle VAX special values*/
+ /* Temporary solution to handle VAX special values.
+ * Note that even though we don't support VAX anymore, we
+ * still need to handle legacy VAX files so this code must
+ * remain in place.
+ */
} else if (H5T__bit_find (s, src.u.f.epos, src.u.f.esize,
H5T_BIT_LSB, FALSE)<0) {
/* NaN */
@@ -4280,7 +4285,6 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception")
goto padding;
-#endif /*H5_VMS*/
}
/*
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 004911f..d2ba3a3 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 */
/***********/
@@ -88,51 +85,6 @@ H5FL_EXTERN(H5VL_t);
/* Declare a free list to manage the H5VL_object_t struct */
H5FL_EXTERN(H5VL_object_t);
-
-/*--------------------------------------------------------------------------
-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 aec3942..3685d03 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
@@ -174,7 +174,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
@@ -218,7 +218,7 @@ static H5O_loc_t *
H5O_dtype_get_oloc(hid_t obj_id)
{
H5T_t *type=NULL, *dt=NULL; /* 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 b807464..44bace9 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 f98be56..e72887e 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
@@ -425,7 +425,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 6a51bab..f7241e8 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,24 +152,24 @@ 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")
if (NULL != dt->vol_obj)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is committed")
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is committed")
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)
@@ -285,9 +261,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 d39ae36..c29b4c2 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -36,17 +36,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;
@@ -106,7 +106,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 */
diff --git a/src/H5VL.c b/src/H5VL.c
index 74e33b9..93019c9 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -27,10 +27,8 @@
/* Module Setup */
/****************/
-#define H5VL_PACKAGE /*suppress error about including H5VLpkg */
+#include "H5VLmodule.h" /* This source code file is part of the H5VL module */
-/* Interface initialization */
-#define H5_INTERFACE_INIT_FUNC H5VL_init_interface
/***********/
/* Headers */
@@ -49,6 +47,13 @@
/********************/
static herr_t H5VL_free_cls(H5VL_class_t *cls);
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* Package initialization variable */
+hbool_t H5_PKG_INIT_VAR = FALSE;
+
/*******************/
/* Local Variables */
/*******************/
@@ -65,16 +70,18 @@ static const H5I_class_t H5I_VOL_CLS[1] = {{
(H5I_free_t)H5VL_free_cls /* Callback routine for closing objects of this class */
}};
-
+/* Flag indicating "top" of interface has been initialized */
+static hbool_t H5VL_top_package_initialize_s = FALSE;
+
/*-------------------------------------------------------------------------
- * Function: H5VL_init
+ * Function:H5VL_init
*
- * Purpose: Initialize the interface from some other package.
+ * Purpose:Initialize the interface from some other package.
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return:Success:non-negative
+ *Failure:negative
*
- * Programmer: Mohamad Chaarawi
+ * Programmer:Mohamad Chaarawi
* January, 2012
*
*-------------------------------------------------------------------------
@@ -92,85 +99,76 @@ done:
} /* end H5VL_init() */
-/*-------------------------------------------------------------------------
- * Function: H5VL_init_interface
- *
- * Purpose: Initialize the virtual object layer.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * January, 2012
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL_init_interface(void)
+/*--------------------------------------------------------------------------
+NAME
+ H5VL__init_package -- Initialize interface-specific information
+USAGE
+ herr_t H5VL__init_package()
+RETURNS
+ Non-negative on success/Negative on failure
+DESCRIPTION
+ Initializes any interface-specific data or routines.
+--------------------------------------------------------------------------*/
+herr_t
+H5VL__init_package(void)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
- /* register VOL ID type */
+ /* Initialize the atom group for the VL IDs */
if(H5I_register_type(H5I_VOL_CLS) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize interface")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_init_interface() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_term_interface
- *
- * Purpose: Terminate this interface: free all memory and reset global
- * variables to their initial values. Release all ID groups
- * associated with this interface.
- *
- * Return: Success: Positive if anything was done that might
- * have affected other interfaces; zero
- * otherwise.
- *
- * Failure: Never fails.
- *
- * Programmer: Mohamad Chaarawi
- * January, 2012
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
+} /* end H5VL__init_package() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5VL_term_package
+ PURPOSE
+ Terminate various H5VL objects
+ USAGE
+ void H5VL_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 H5VL_top_term_package()
+ is called
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
int
-H5VL_term_interface(void)
+H5VL_term_package(void)
{
- int n = 0, n1 = 0;
- hbool_t term = TRUE;
+ int n = 0;
FUNC_ENTER_NOAPI_NOINIT_NOERR
- if(H5_interface_initialize_g) {
- if((n1=H5I_nmembers(H5I_VOL))!=0) {
- H5I_clear_type(H5I_VOL, FALSE, FALSE);
- term = FALSE;
- } else {
- H5I_dec_type_ref(H5I_VOL);
- }
-
- if (term) {
- H5_interface_initialize_g = 0;
- n = 1;
+ if(H5_PKG_INIT_VAR) {
+
+ if(H5I_nmembers(H5I_VOL) > 0) {
+ (void)H5I_clear_type(H5I_VOL, FALSE, FALSE);
+ n++;
}
else {
- n = n1;
+ n += (H5I_dec_type_ref(H5I_VOL) > 0);
+
+ /* Mark interface as closed */
+ if(0 == n)
+ H5_PKG_INIT_VAR = FALSE;
}
- }
+ } /* end if */
FUNC_LEAVE_NOAPI(n)
-}
+} /* end H5VL_term_package() */
/*-------------------------------------------------------------------------
@@ -653,7 +651,7 @@ done:
herr_t
H5VLget_object(hid_t obj_id, void **obj)
{
- hid_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i**x", obj_id, obj);
diff --git a/src/H5VLint.c b/src/H5VLint.c
index 142c762..24d4fd8 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -27,11 +27,9 @@
/* Module Setup */
/****************/
-#define H5VL_PACKAGE /*suppress error about including H5VLpkg */
-#define H5I_PACKAGE /*suppress error about including H5Ipkg */
+#define H5I_FRIEND /*suppress error about including H5Ipkg */
+#include "H5VLmodule.h" /* This source code file is part of the H5VL module */
-/* Interface initialization */
-#define H5_INTERFACE_INIT_FUNC H5VL_int_init_interface
/***********/
/* Headers */
@@ -88,28 +86,6 @@ H5FL_DEFINE(H5VL_t);
H5FL_DEFINE(H5VL_object_t);
-/*--------------------------------------------------------------------------
-NAME
- H5VL_int_init_interface -- Initialize interface-specific information
-USAGE
- herr_t H5VL_int_init_interface()
-
-RETURNS
- Non-negative on success/Negative on failure
-DESCRIPTION
- Initializes any interface-specific data or routines. (Just calls
- H5VL_init_iterface currently).
-
---------------------------------------------------------------------------*/
-static herr_t
-H5VL_int_init_interface(void)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- FUNC_LEAVE_NOAPI(H5VL_init())
-} /* H5VL_int_init_interface() */
-
-
/*-------------------------------------------------------------------------
* Function: H5VL_register
*
diff --git a/src/H5VLmodule.h b/src/H5VLmodule.h
new file mode 100644
index 0000000..434fe28
--- /dev/null
+++ b/src/H5VLmodule.h
@@ -0,0 +1,34 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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
+ * H5VL package. Including this header means that the source file
+ * is part of the H5VL package.
+ */
+#ifndef _H5VLmodule_H
+#define _H5VLmodule_H
+
+/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error
+ * reporting macros.
+ */
+#define H5VL_MODULE
+#define H5_MY_PKG H5VL
+#define H5_MY_PKG_ERR H5E_VOL
+#define H5_MY_PKG_INIT YES
+
+#endif /* _H5VLmodule_H */
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index 7063ad6..106319c 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -21,14 +21,14 @@
* using HDF5 VFDs.
*/
-#define H5A_PACKAGE /*suppress error about including H5Apkg */
-#define H5D_PACKAGE /*suppress error about including H5Dpkg */
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
-#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 H5R_PACKAGE /*suppress error about including H5Rpkg */
-#define H5T_PACKAGE /*suppress error about including H5Tpkg */
+#define H5A_FRIEND /*suppress error about including H5Apkg */
+#define H5D_FRIEND /*suppress error about including H5Dpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
+#define H5L_FRIEND /*suppress error about including H5Lpkg */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
+#define H5R_FRIEND /*suppress error about including H5Rpkg */
+#define H5T_FRIEND /*suppress error about including H5Tpkg */
/* Interface initialization */
#define H5_INTERFACE_INIT_FUNC H5VL_native_init_interface
@@ -1334,11 +1334,6 @@ H5VL_native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *na
{
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 */
void *ret_value = NULL;
FUNC_ENTER_NOAPI_NOINIT
@@ -1346,31 +1341,13 @@ H5VL_native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *na
if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object")
- /* 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")
+ if(NULL == (dset = H5D__open_name(&loc, name, dapl_id, dxpl_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open dataset")
ret_value = (void *)dset;
done:
- if(NULL == dset && 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 H5VL_native_dataset_open() */
@@ -2446,12 +2423,12 @@ H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void
/* Retrieve the group's information */
if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, dxpl_id) < 0) {
H5G_loc_free(&grp_loc);
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve group info")
}
/* Release the object location */
if(H5G_loc_free(&grp_loc) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
}
else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Gget_info_by_idx */
H5G_loc_t grp_loc; /* Location used to open group */
@@ -2470,17 +2447,17 @@ H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void
loc_params.loc_data.loc_by_idx.n, &grp_loc/*out*/,
loc_params.loc_data.loc_by_idx.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")
/* Retrieve the group's information */
if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, dxpl_id) < 0) {
H5G_loc_free(&grp_loc);
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve group info")
}
/* Release the object location */
if(H5G_loc_free(&grp_loc) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
}
else {
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters")
@@ -2591,7 +2568,7 @@ H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc
/* Link to the object */
if(H5L_link(&link_loc, loc_params.loc_data.loc_by_name.name, &cur_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")
}
break;
}
@@ -2992,7 +2969,7 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope
/* Open the object */
if((temp_id = H5O_open_name(&loc, loc_params.loc_data.loc_by_name.name,
loc_params.loc_data.loc_by_name.lapl_id, TRUE)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object")
break;
}
case H5VL_OBJECT_BY_IDX:
@@ -3008,13 +2985,13 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope
loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n,
&obj_loc/*out*/, loc_params.loc_data.loc_by_idx.lapl_id,
dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "group not found")
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "group not found")
loc_found = TRUE;
/* Open the object */
if((temp_id = H5O_open_by_loc(&obj_loc, loc_params.loc_data.loc_by_idx.lapl_id,
dxpl_id, TRUE)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object")
break;
}
case H5VL_OBJECT_BY_ADDR:
@@ -3033,7 +3010,7 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope
/* Open the object */
if((temp_id = H5O_open_by_loc(&obj_loc, H5P_LINK_ACCESS_DEFAULT,
dxpl_id, TRUE)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object")
break;
}
case H5VL_OBJECT_BY_REF:
@@ -3065,7 +3042,7 @@ done:
/* Release the object location if we failed after copying it */
if(temp_id < 0 && loc_found)
if(H5G_loc_free(&obj_loc) < 0)
- HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, NULL, "can't free location")
+ HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "can't free location")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_native_object_open() */
@@ -3251,12 +3228,12 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object
if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Ovisit */
if((ret_value = H5O_visit(&loc, ".", idx_type, order, op, op_data,
H5P_LINK_ACCESS_DEFAULT, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "object visitation failed")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
}
else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Ovisit_by_name */
if((ret_value = H5O_visit(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order,
op, op_data, loc_params.loc_data.loc_by_name.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")
}
else
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object visit params");
@@ -3324,13 +3301,13 @@ H5VL_native_object_optional(void *obj, hid_t dxpl_id, void H5_ATTR_UNUSED **req,
/* Retrieve the object's information */
if(H5G_loc_info(&loc, ".", TRUE, obj_info, H5P_LINK_ACCESS_DEFAULT,
dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
}
else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */
/* Retrieve the object's information */
if(H5G_loc_info(&loc, loc_params.loc_data.loc_by_name.name, TRUE, obj_info,
loc_params.loc_data.loc_by_name.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")
}
else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */
H5G_loc_t obj_loc; /* Location used to open group */
@@ -3349,17 +3326,17 @@ H5VL_native_object_optional(void *obj, hid_t dxpl_id, void H5_ATTR_UNUSED **req,
loc_params.loc_data.loc_by_idx.n, &obj_loc/*out*/,
loc_params.loc_data.loc_by_idx.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")
/* Retrieve the object's information */
if(H5O_get_info(obj_loc.oloc, dxpl_id, TRUE, obj_info) < 0) {
H5G_loc_free(&obj_loc);
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve object info")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
}
/* Release the object location */
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")
}
else {
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters")
@@ -3377,12 +3354,12 @@ H5VL_native_object_optional(void *obj, hid_t dxpl_id, void H5_ATTR_UNUSED **req,
if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Oget_comment */
if((*ret = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize,
H5P_LINK_ACCESS_DEFAULT, dxpl_id)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
}
else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Oget_comment_by_name */
if((*ret = H5G_loc_get_comment(&loc, loc_params.loc_data.loc_by_name.name, comment/*out*/, bufsize,
loc_params.loc_data.loc_by_name.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")
}
else {
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters")
@@ -3397,13 +3374,13 @@ H5VL_native_object_optional(void *obj, hid_t dxpl_id, void H5_ATTR_UNUSED **req,
if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Oset_comment */
/* (Re)set the object's comment */
if(H5G_loc_set_comment(&loc, ".", comment, H5P_LINK_ACCESS_DEFAULT, dxpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
}
else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Oset_comment_by_name */
/* (Re)set the object's comment */
if(H5G_loc_set_comment(&loc, loc_params.loc_data.loc_by_name.name, comment,
loc_params.loc_data.loc_by_name.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")
}
else {
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters")
diff --git a/src/H5VLpkg.h b/src/H5VLpkg.h
index 1b1d7b7..8dadd27 100644
--- a/src/H5VLpkg.h
+++ b/src/H5VLpkg.h
@@ -21,7 +21,7 @@
* the H5VL package. Source files outside the H5VL package should
* include H5VLprivate.h instead.
*/
-#ifndef H5VL_PACKAGE
+#if !(defined H5VL_FRIEND || defined H5VL_MODULE)
#error "Do not include this file outside the H5VL package!"
#endif
diff --git a/src/H5Z.c b/src/H5Z.c
index 66f60a1..47f85e5 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -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() */
/*-------------------------------------------------------------------------
@@ -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..3aed993 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 */
@@ -542,7 +542,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 +581,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 +675,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 +731,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 +775,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);
-
- if (!factor)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
- sscanf(current->tok_begin, "%ld", &factor->value.int_val);
- break;
+ case H5Z_XFORM_INTEGER:
+ factor = H5Z_new_node(H5Z_XFORM_INTEGER);
- 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")
+ sscanf(current->tok_begin, "%ld", &factor->value.int_val);
+ break;
- if (!factor)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
- sscanf(current->tok_begin, "%lf", &factor->value.float_val);
- break;
+ case H5Z_XFORM_FLOAT:
+ factor = H5Z_new_node(H5Z_XFORM_FLOAT);
- 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")
+ sscanf(current->tok_begin, "%lf", &factor->value.float_val);
+ break;
- if (!factor)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
+ case H5Z_XFORM_SYMBOL:
+ factor = H5Z_new_node(H5Z_XFORM_SYMBOL);
- factor->value.dat_val = &(dat_val_pointers->ptr_dat_val[dat_val_pointers->num_ptrs]);
- dat_val_pointers->num_ptrs++;
- break;
+ if (!factor)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
- case H5Z_XFORM_LPAREN:
- factor = H5Z_parse_expression(current, dat_val_pointers);
+ factor->value.dat_val = &(dat_val_pointers->ptr_dat_val[dat_val_pointers->num_ptrs]);
+ dat_val_pointers->num_ptrs++;
+ break;
- if (!factor)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
+ case H5Z_XFORM_LPAREN:
+ factor = H5Z_parse_expression(current, dat_val_pointers);
- current = H5Z_get_token(current);
+ if (!factor)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node")
- 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;
+ current = H5Z_get_token(current);
- 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 +917,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 +1103,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 */
@@ -1458,10 +1477,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)
@@ -1677,7 +1696,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
index c0f4466..9363813 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -30,6 +30,42 @@
/* 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 Fortran compiler ID */
+#undef Fortran_COMPILER_ID
+
+/* 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
@@ -82,6 +118,9 @@
/* 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
@@ -112,6 +151,9 @@
/* 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
@@ -130,9 +172,6 @@
/* 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
@@ -161,15 +200,9 @@
/* 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
@@ -212,6 +245,9 @@
/* 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
@@ -281,15 +317,9 @@
/* 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
@@ -299,9 +329,6 @@
/* 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
@@ -418,6 +445,12 @@
/* 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
@@ -535,6 +568,12 @@
/* 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
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 c3908e4..2251958 100644
--- a/src/H5err.txt
+++ b/src/H5err.txt
@@ -218,6 +218,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/H5private.h b/src/H5private.h
index 61ffddd..d26d198 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 */
@@ -1130,22 +1141,9 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
#ifndef HDrealpath
#define HDrealpath(F1,F2) realpath(F1,F2)
#endif /* HDrealloc */
-#ifdef H5_VMS
- #ifdef __cplusplus
- extern "C" {
- #endif /* __cplusplus */
- int HDremove_all(const char * fname);
- #ifdef __cplusplus
- }
- #endif /* __cplusplus */
- #ifndef HDremove
- #define HDremove(S) HDremove_all(S)
- #endif /* HDremove */
-#else /* H5_VMS */
- #ifndef HDremove
- #define HDremove(S) remove(S)
- #endif /* HDremove */
-#endif /*H5_VMS*/
+#ifndef HDremove
+ #define HDremove(S) remove(S)
+#endif /* HDremove */
#ifndef HDrename
#define HDrename(OLD,NEW) rename(OLD,NEW)
#endif /* HDrename */
@@ -1465,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
*/
@@ -1562,19 +1570,7 @@ extern char *strdup(const char *s);
(ptr = slash); \
}
-#elif defined(H5_HAVE_VMS_PATH)
-
-/* OpenVMS pathname: <disk name>$<partition>:[path]<file name>
- * i.g. SYS$SYSUSERS:[LU.HDF5.SRC]H5system.c */
-#define H5_DIR_SEPC ']'
-#define H5_DIR_SEPS "]"
-#define H5_CHECK_DELIMITER(SS) (SS == H5_DIR_SEPC)
-#define H5_CHECK_ABSOLUTE(NAME) (HDstrrchr(NAME, ':') && HDstrrchr(NAME, '['))
-#define H5_CHECK_ABS_DRIVE(NAME) (0)
-#define H5_CHECK_ABS_PATH(NAME) (0)
-#define H5_GET_LAST_DELIMITER(NAME, ptr) ptr = HDstrrchr(NAME, H5_DIR_SEPC);
-
-#else
+#else /* H5_HAVE_WINDOW_PATH */
#define H5_DIR_SEPC '/'
#define H5_DIR_SEPS "/"
@@ -1584,7 +1580,7 @@ extern char *strdup(const char *s);
#define H5_CHECK_ABS_PATH(NAME) (0)
#define H5_GET_LAST_DELIMITER(NAME, ptr) ptr = HDstrrchr(NAME, H5_DIR_SEPC);
-#endif
+#endif /* H5_HAVE_WINDOW_PATH */
#define H5_COLON_SEPC ':'
@@ -1752,9 +1748,24 @@ H5_DLL double H5_trace(const double *calltime, const char *func, const char *typ
*-------------------------------------------------------------------------
*/
-/* `S' is the name of a function which is being tested to check if its */
-/* an API function */
-#define H5_IS_API(S) ('_'!=((const char *)S)[2] && '_'!=((const char *)S)[3] && (!((const char *)S)[4] || '_'!=((const char *)S)[4]))
+/* `S' is the name of a function which is being tested to check if it's
+ * an API function.
+ *
+ * BADNESS:
+ * - Underscore at positions 2 or 3 (0-indexed string). Handles
+ * H5_ and H5X_.
+ * - Underscore at position 4 if position 3 is uppercase or a digit.
+ * Handles H5XY_.
+ */
+#define H5_IS_API(S) (\
+ '_'!=((const char *)S)[2] /* underscore at position 2 */ \
+ && '_'!=((const char *)S)[3] /* underscore at position 3 */ \
+ && !( /* NOT */ \
+ ((const char *)S)[4] /* pos 4 exists */ \
+ && (HDisupper(S[3]) || HDisdigit(S[3])) /* pos 3 dig | uc */ \
+ && '_'==((const char *)S)[4] /* pos 4 underscore */ \
+ )\
+)
/* `S' is the name of a function which is being tested to check if it's */
/* a public API function */
@@ -1787,10 +1798,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
@@ -1829,9 +1842,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 */
@@ -1851,101 +1866,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); \
{
/*
@@ -1954,7 +1978,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 \
@@ -1967,38 +1991,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. */
@@ -2008,21 +2114,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. */
@@ -2032,76 +2144,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") \
- 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)); \
+ HGOTO_ERROR(H5_MY_PKG_ERR, H5E_CANTTAG, err, "unable to apply metadata tag") \
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) {
/*-------------------------------------------------------------------------
@@ -2118,35 +2163,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*/
/*
@@ -2155,135 +2204,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
@@ -2293,23 +2353,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:
@@ -2317,73 +2377,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).
@@ -2392,23 +2452,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:
@@ -2421,21 +2471,31 @@ 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 H5VL_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 1d99c11..e1fdd9e 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 227 /* 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.227" /* 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)
@@ -331,6 +331,7 @@ H5_DLL herr_t H5get_libversion(unsigned *majnum, unsigned *minnum,
unsigned *relnum);
H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum,
unsigned relnum);
+H5_DLL herr_t H5is_library_threadsafe(hbool_t *is_ts);
H5_DLL herr_t H5free_memory(void *mem);
H5_DLL void *H5allocate_memory(size_t size, hbool_t clear);
H5_DLL void *H5resize_memory(void *mem, size_t size);
@@ -338,5 +339,6 @@ H5_DLL void *H5resize_memory(void *mem, size_t size);
#ifdef __cplusplus
}
#endif
-#endif
+#endif /* _H5public_H */
+
diff --git a/src/H5system.c b/src/H5system.c
index 56db380..e00e5a5 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -582,45 +582,8 @@ void HDsrand(unsigned int seed)
{
g_seed = seed;
}
-#endif
+#endif /* H5_HAVE_RAND_R */
-
-/*-------------------------------------------------------------------------
- * Function: HDremove_all
- *
- * Purpose: Wrapper function for remove on VMS systems
- *
- * This function deletes all versions of a file
- *
- * Return: Success: 0;
- *
- * Failure: -1
- *
- * Programmer: Elena Pourmal
- * March 22, 2006
- *
- *-------------------------------------------------------------------------
- */
-#ifdef H5_VMS
-int
-HDremove_all(const char *fname)
-{
- int ret_value = -1;
- size_t fname_len;
- char *_fname;
-
- fname_len = HDstrlen(fname) + 3; /* to accomodate ";*" and null terminator */
- _fname = (char *)H5MM_malloc(fname_len);
- if(_fname) {
- HDsnprintf(_fname, fname_len, "%s;*", fname);
- /* Do not use HDremove; function becomes recursive (see H5private.h file)*/
- remove(_fname);
- H5MM_xfree(_fname);
- ret_value = 0;
- }
- return ret_value;
-}
-#endif
/*-------------------------------------------------------------------------
* Function: Wgettimeofday
@@ -764,8 +727,6 @@ H5_build_extpath(const char *name, char **extpath/*out*/)
/*
* Unix: name[0] is a "/"
* Windows: name[0-2] is "<drive letter>:\" or "<drive-letter>:/"
- * OpenVMS: <disk name>$<partition>:[path]<file name>
- * i.g. SYS$SYSUSERS:[LU.HDF5.SRC]H5system.c
*/
if(H5_CHECK_ABSOLUTE(name)) {
if(NULL == (full_path = (char *)H5MM_strdup(name)))
@@ -786,7 +747,6 @@ H5_build_extpath(const char *name, char **extpath/*out*/)
* Windows: name[0-1] is "<drive-letter>:"
* Get current working directory on the drive specified in NAME
* Unix: does not apply
- * OpenVMS: does not apply
*/
if(H5_CHECK_ABS_DRIVE(name)) {
drive = name[0] - 'A' + 1;
@@ -797,14 +757,13 @@ H5_build_extpath(const char *name, char **extpath/*out*/)
* Windows: name[0] is a '/' or '\'
* Get current drive
* Unix: does not apply
- * OpenVMS: does not apply
*/
else if(H5_CHECK_ABS_PATH(name) && (0 != (drive = HDgetdrive()))) {
HDsnprintf(cwdpath, MAX_PATH_LEN, "%c:%c", (drive + 'A' - 1), name[0]);
retcwd = cwdpath;
HDstrncpy(new_name, &name[1], name_len);
}
- /* totally relative for Unix, Windows, and OpenVMS: get current working directory */
+ /* totally relative for Unix and Windows: get current working directory */
else {
retcwd = HDgetcwd(cwdpath, MAX_PATH_LEN);
HDstrncpy(new_name, name, name_len);
@@ -823,26 +782,9 @@ H5_build_extpath(const char *name, char **extpath/*out*/)
HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed")
HDstrncpy(full_path, cwdpath, cwdlen + 1);
-#ifdef H5_VMS
- /* If the file name contains relative path, cut off the beginning bracket. Also cut off the
- * ending bracket of CWDPATH to combine the full path name. i.g.
- * cwdpath = SYS$SYSUSERS:[LU.HDF5.TEST]
- * new_name = [.tmp]extlinks.h5
- * full_path = SYS$SYSUSERS:[LU.HDF5.TEST.tmp]extlinks.h5
- */
- if(new_name[0] == '[') {
- char *tmp = new_name;
-
- full_path[cwdlen - 1] = '\0';
- HDstrncat(full_path, ++tmp, HDstrlen(tmp));
- } /* end if */
- else
- HDstrncat(full_path, new_name, HDstrlen(new_name));
-#else
if(!H5_CHECK_DELIMITER(cwdpath[cwdlen - 1]))
HDstrncat(full_path, H5_DIR_SEPS, HDstrlen(H5_DIR_SEPS));
HDstrncat(full_path, new_name, HDstrlen(new_name));
-#endif
} /* end if */
} /* end else */
diff --git a/src/H5trace.c b/src/H5trace.c
index 2fb3b72..e9b351a 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -27,7 +27,7 @@
/****************/
/* Module Setup */
/****************/
-#define H5I_PACKAGE /*suppress error about including H5Ipkg */
+#define H5I_FRIEND /*suppress error about including H5Ipkg */
/***********/
diff --git a/src/Makefile.am b/src/Makefile.am
index 6060835..ffb8f69 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -108,8 +108,8 @@ 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
# Public headers
diff --git a/src/Makefile.in b/src/Makefile.in
index 102aa45..31e2c70 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -114,7 +114,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
-CONFIG_HEADER = H5config.h
+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'`;
@@ -200,7 +200,7 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.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 \
+ H5Znbit.lo H5Zshuffle.lo H5Zscaleoffset.lo H5Zszip.lo \
H5Ztrans.lo
libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
@@ -229,7 +229,7 @@ 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@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/fortran/src
depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
@@ -514,14 +514,22 @@ F9XMODEXT = @F9XMODEXT@
F9XMODFLAG = @F9XMODFLAG@
F9XSUFFIXFLAG = @F9XSUFFIXFLAG@
FC = @FC@
-FC2003 = @FC2003@
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@
+Fortran_COMPILER_ID = @Fortran_COMPILER_ID@
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@
@@ -531,13 +539,12 @@ H5_LDFLAGS = @H5_LDFLAGS@
H5_VERSION = @H5_VERSION@
HADDR_T = @HADDR_T@
HAVE_DMALLOC = @HAVE_DMALLOC@
-HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+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@
-HDF_FORTRAN2003 = @HDF_FORTRAN2003@
HID_T = @HID_T@
HL = @HL@
HL_FOR = @HL_FOR@
@@ -579,9 +586,20 @@ 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@
-PERL = @PERL@
RANLIB = @RANLIB@
ROOT = @ROOT@
RUNPARALLEL = @RUNPARALLEL@
@@ -725,7 +743,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2
# After making changes, run bin/reconfigure to update other configure related
# files like Makefile.in.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 217
+LT_VERS_REVISION = 222
LT_VERS_AGE = 0
# Our main target, the HDF5 library
@@ -808,8 +826,8 @@ 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
# Public headers
diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in
index 1eed645..2355543 100644
--- a/src/libhdf5.settings.in
+++ b/src/libhdf5.settings.in
@@ -39,7 +39,6 @@ Languages:
----------
Fortran: @HDF_FORTRAN@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @FC_VERSION@
-@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran 2003 Compiler: @HAVE_FORTRAN_2003@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Flags: @FCFLAGS@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ H5 Fortran Flags: @H5_FCFLAGS@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ AM Fortran Flags: @AM_FCFLAGS@