From d40fc11656f852e163dd6a640e513360e1c79179 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 5 Oct 2020 07:07:16 -0500 Subject: HDFFV-11096 fix usage ext in h5dump --- tools/src/h5dump/h5dump.c | 8 ++++---- tools/src/misc/h5repart.c | 6 +++--- tools/testfiles/h5dump-help.txt | 4 ++-- tools/testfiles/pbits/tnofilename-with-packed-bits.ddl | 4 ++-- tools/testfiles/pbits/tpbitsIncomplete.ddl | 4 ++-- tools/testfiles/pbits/tpbitsLengthExceeded.ddl | 4 ++-- tools/testfiles/pbits/tpbitsLengthPositive.ddl | 4 ++-- tools/testfiles/pbits/tpbitsMaxExceeded.ddl | 4 ++-- tools/testfiles/pbits/tpbitsOffsetExceeded.ddl | 4 ++-- tools/testfiles/pbits/tpbitsOffsetNegative.ddl | 4 ++-- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index 9a5e297..34b3c10 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -256,7 +256,7 @@ usage(const char *prog) " :: \"(,,)\"\n"); PRINTVALSTREAM(rawoutstream, " If absent or -> \"(,,)\", no authentication.\n"); - PRINTVALSTREAM(rawoutstream, " Has no effect is filedriver is not `ros3'.\n"); + PRINTVALSTREAM(rawoutstream, " Has no effect if filedriver is not \"ros3\".\n"); PRINTVALSTREAM(rawoutstream, " --hdfs-attrs= Supply configuration information for HDFS file access.\n"); PRINTVALSTREAM(rawoutstream, " For use with \"--filedriver=hdfs\"\n"); @@ -338,7 +338,7 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, " -X S, --xml-ns=S (XML Schema) Use qualified names n the XML\n"); PRINTVALSTREAM(rawoutstream, " \":\": no namespace, default: \"hdf5:\"\n"); PRINTVALSTREAM(rawoutstream, - " E.g., to dump a file called `-f', use h5dump -- -f\n"); + " E.g., to dump a file called \"-f\", use h5dump -- -f\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, "--------------- Subsetting Options ---------------\n"); PRINTVALSTREAM(rawoutstream, " Subsetting is available by using the following options with a dataset\n"); @@ -1132,7 +1132,7 @@ parse_start: case 'M': if (!last_was_dset) { - error_msg("option `-%c' can only be used after --dataset option\n", opt); + error_msg("option \"-%c\" can only be used after --dataset option\n", opt); goto error; } if (parse_mask_list(opt_arg) != SUCCEED) { @@ -1205,7 +1205,7 @@ parse_start: struct subset_t *s; if (!last_was_dset) { - error_msg("option `-%c' can only be used after --dataset option\n", opt); + error_msg("option \"-%c\" can only be used after --dataset option\n", opt); goto error; } diff --git a/tools/src/misc/h5repart.c b/tools/src/misc/h5repart.c index 6424384..65ceb4f 100644 --- a/tools/src/misc/h5repart.c +++ b/tools/src/misc/h5repart.c @@ -64,10 +64,10 @@ usage(const char *progname) "(windows or sec2)\n"); HDfprintf(stderr, " SRC The name of the source file\n"); HDfprintf(stderr, " DST The name of the destination files\n"); - HDfprintf(stderr, "Sizes may be suffixed with `g' for GB, `m' for MB or " - "`k' for kB.\n"); + HDfprintf(stderr, "Sizes may be suffixed with 'g' for GB, 'm' for MB or " + "'k' for kB.\n"); HDfprintf(stderr, "File family names include an integer printf " - "format such as `%%d'\n"); + "format such as '%%d'\n"); HDexit(EXIT_FAILURE); } diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt index a122dee..5b11223 100644 --- a/tools/testfiles/h5dump-help.txt +++ b/tools/testfiles/h5dump-help.txt @@ -15,7 +15,7 @@ usage: h5dump [OPTIONS] files --s3-cred= Supply S3 authentication information to "ros3" vfd. :: "(,,)" If absent or -> "(,,)", no authentication. - Has no effect is filedriver is not `ros3'. + Has no effect if filedriver is not "ros3". --hdfs-attrs= Supply configuration information for HDFS file access. For use with "--filedriver=hdfs" :: (,, @@ -73,7 +73,7 @@ usage: h5dump [OPTIONS] files -D U, --xml-dtd=U Use the DTD or schema at U -X S, --xml-ns=S (XML Schema) Use qualified names n the XML ":": no namespace, default: "hdf5:" - E.g., to dump a file called `-f', use h5dump -- -f + E.g., to dump a file called "-f", use h5dump -- -f --------------- Subsetting Options --------------- Subsetting is available by using the following options with a dataset diff --git a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl index a122dee..5b11223 100644 --- a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl +++ b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl @@ -15,7 +15,7 @@ usage: h5dump [OPTIONS] files --s3-cred= Supply S3 authentication information to "ros3" vfd. :: "(,,)" If absent or -> "(,,)", no authentication. - Has no effect is filedriver is not `ros3'. + Has no effect if filedriver is not "ros3". --hdfs-attrs= Supply configuration information for HDFS file access. For use with "--filedriver=hdfs" :: (,, @@ -73,7 +73,7 @@ usage: h5dump [OPTIONS] files -D U, --xml-dtd=U Use the DTD or schema at U -X S, --xml-ns=S (XML Schema) Use qualified names n the XML ":": no namespace, default: "hdf5:" - E.g., to dump a file called `-f', use h5dump -- -f + E.g., to dump a file called "-f", use h5dump -- -f --------------- Subsetting Options --------------- Subsetting is available by using the following options with a dataset diff --git a/tools/testfiles/pbits/tpbitsIncomplete.ddl b/tools/testfiles/pbits/tpbitsIncomplete.ddl index a122dee..5b11223 100644 --- a/tools/testfiles/pbits/tpbitsIncomplete.ddl +++ b/tools/testfiles/pbits/tpbitsIncomplete.ddl @@ -15,7 +15,7 @@ usage: h5dump [OPTIONS] files --s3-cred= Supply S3 authentication information to "ros3" vfd. :: "(,,)" If absent or -> "(,,)", no authentication. - Has no effect is filedriver is not `ros3'. + Has no effect if filedriver is not "ros3". --hdfs-attrs= Supply configuration information for HDFS file access. For use with "--filedriver=hdfs" :: (,, @@ -73,7 +73,7 @@ usage: h5dump [OPTIONS] files -D U, --xml-dtd=U Use the DTD or schema at U -X S, --xml-ns=S (XML Schema) Use qualified names n the XML ":": no namespace, default: "hdf5:" - E.g., to dump a file called `-f', use h5dump -- -f + E.g., to dump a file called "-f", use h5dump -- -f --------------- Subsetting Options --------------- Subsetting is available by using the following options with a dataset diff --git a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl index a122dee..5b11223 100644 --- a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl @@ -15,7 +15,7 @@ usage: h5dump [OPTIONS] files --s3-cred= Supply S3 authentication information to "ros3" vfd. :: "(,,)" If absent or -> "(,,)", no authentication. - Has no effect is filedriver is not `ros3'. + Has no effect if filedriver is not "ros3". --hdfs-attrs= Supply configuration information for HDFS file access. For use with "--filedriver=hdfs" :: (,, @@ -73,7 +73,7 @@ usage: h5dump [OPTIONS] files -D U, --xml-dtd=U Use the DTD or schema at U -X S, --xml-ns=S (XML Schema) Use qualified names n the XML ":": no namespace, default: "hdf5:" - E.g., to dump a file called `-f', use h5dump -- -f + E.g., to dump a file called "-f", use h5dump -- -f --------------- Subsetting Options --------------- Subsetting is available by using the following options with a dataset diff --git a/tools/testfiles/pbits/tpbitsLengthPositive.ddl b/tools/testfiles/pbits/tpbitsLengthPositive.ddl index a122dee..5b11223 100644 --- a/tools/testfiles/pbits/tpbitsLengthPositive.ddl +++ b/tools/testfiles/pbits/tpbitsLengthPositive.ddl @@ -15,7 +15,7 @@ usage: h5dump [OPTIONS] files --s3-cred= Supply S3 authentication information to "ros3" vfd. :: "(,,)" If absent or -> "(,,)", no authentication. - Has no effect is filedriver is not `ros3'. + Has no effect if filedriver is not "ros3". --hdfs-attrs= Supply configuration information for HDFS file access. For use with "--filedriver=hdfs" :: (,, @@ -73,7 +73,7 @@ usage: h5dump [OPTIONS] files -D U, --xml-dtd=U Use the DTD or schema at U -X S, --xml-ns=S (XML Schema) Use qualified names n the XML ":": no namespace, default: "hdf5:" - E.g., to dump a file called `-f', use h5dump -- -f + E.g., to dump a file called "-f", use h5dump -- -f --------------- Subsetting Options --------------- Subsetting is available by using the following options with a dataset diff --git a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl index a122dee..5b11223 100644 --- a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl @@ -15,7 +15,7 @@ usage: h5dump [OPTIONS] files --s3-cred= Supply S3 authentication information to "ros3" vfd. :: "(,,)" If absent or -> "(,,)", no authentication. - Has no effect is filedriver is not `ros3'. + Has no effect if filedriver is not "ros3". --hdfs-attrs= Supply configuration information for HDFS file access. For use with "--filedriver=hdfs" :: (,, @@ -73,7 +73,7 @@ usage: h5dump [OPTIONS] files -D U, --xml-dtd=U Use the DTD or schema at U -X S, --xml-ns=S (XML Schema) Use qualified names n the XML ":": no namespace, default: "hdf5:" - E.g., to dump a file called `-f', use h5dump -- -f + E.g., to dump a file called "-f", use h5dump -- -f --------------- Subsetting Options --------------- Subsetting is available by using the following options with a dataset diff --git a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl index a122dee..5b11223 100644 --- a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl @@ -15,7 +15,7 @@ usage: h5dump [OPTIONS] files --s3-cred= Supply S3 authentication information to "ros3" vfd. :: "(,,)" If absent or -> "(,,)", no authentication. - Has no effect is filedriver is not `ros3'. + Has no effect if filedriver is not "ros3". --hdfs-attrs= Supply configuration information for HDFS file access. For use with "--filedriver=hdfs" :: (,, @@ -73,7 +73,7 @@ usage: h5dump [OPTIONS] files -D U, --xml-dtd=U Use the DTD or schema at U -X S, --xml-ns=S (XML Schema) Use qualified names n the XML ":": no namespace, default: "hdf5:" - E.g., to dump a file called `-f', use h5dump -- -f + E.g., to dump a file called "-f", use h5dump -- -f --------------- Subsetting Options --------------- Subsetting is available by using the following options with a dataset diff --git a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl index a122dee..5b11223 100644 --- a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl @@ -15,7 +15,7 @@ usage: h5dump [OPTIONS] files --s3-cred= Supply S3 authentication information to "ros3" vfd. :: "(,,)" If absent or -> "(,,)", no authentication. - Has no effect is filedriver is not `ros3'. + Has no effect if filedriver is not "ros3". --hdfs-attrs= Supply configuration information for HDFS file access. For use with "--filedriver=hdfs" :: (,, @@ -73,7 +73,7 @@ usage: h5dump [OPTIONS] files -D U, --xml-dtd=U Use the DTD or schema at U -X S, --xml-ns=S (XML Schema) Use qualified names n the XML ":": no namespace, default: "hdf5:" - E.g., to dump a file called `-f', use h5dump -- -f + E.g., to dump a file called "-f", use h5dump -- -f --------------- Subsetting Options --------------- Subsetting is available by using the following options with a dataset -- cgit v0.12 From 2744238c875aa5b064eb3436df143a80146ae93a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 5 Oct 2020 14:32:45 -0500 Subject: Cleanup comments in tests, align comments better, update vfd test --- hl/src/H5LTanalyze.c | 6 +- src/H5Fquery.c | 12 +- test/SWMR_UseCase_UG.txt | 4 +- test/app_ref.c | 2 +- test/bittests.c | 2 +- test/btree2.c | 2 +- test/cache_image.c | 2 +- test/cmpd_dset.c | 2 +- test/cross_read.c | 2 +- test/dangle.c | 2 +- test/dsets.c | 2 +- test/dt_arith.c | 2 +- test/dtypes.c | 223 ++++++++++----------------- test/earray.c | 2 +- test/enum.c | 2 +- test/extend.c | 2 +- test/external_common.c | 2 +- test/external_common.h | 2 +- test/external_fname.h | 2 +- test/fillval.c | 2 +- test/filter_fail.c | 2 +- test/flush1.c | 2 +- test/flush2.c | 2 +- test/gen_bad_compound.c | 2 +- test/gen_bad_ohdr.c | 2 +- test/gen_cross.c | 2 +- test/gen_filters.c | 2 +- test/gen_mergemsg.c | 2 +- test/gen_new_array.c | 2 +- test/gen_new_fill.c | 2 +- test/gen_new_group.c | 2 +- test/gen_new_mtime.c | 2 +- test/gen_new_super.c | 13 +- test/gen_old_array.c | 2 +- test/gen_old_group.c | 2 +- test/gen_old_layout.c | 2 +- test/gen_old_mtime.c | 2 +- test/gen_sizes_lheap.c | 2 +- test/gen_specmetaread.c | 2 +- test/gen_udlinks.c | 2 +- test/getname.c | 2 +- test/gheap.c | 2 +- test/h5test.h | 2 +- test/hdfs.c | 7 +- test/hyperslab.c | 2 +- test/istore.c | 2 +- test/lheap.c | 2 +- test/mount.c | 2 +- test/mtime.c | 2 +- test/ohdr.c | 2 +- test/page_buffer.c | 1 - test/pool.c | 2 +- test/ros3.c | 2 +- test/s3comms.c | 2 +- test/set_extent.c | 2 +- test/space_overflow.c | 2 +- test/stab.c | 4 +- test/tchecksum.c | 2 +- test/testframe.c | 2 +- test/tfile.c | 3 - test/trefer.c | 50 +++--- test/unlink.c | 2 +- test/vds.c | 2 +- test/vds_env.c | 2 +- test/vds_swmr.h | 2 - test/vfd.c | 306 +++++++++++++++++++++---------------- tools/test/h5repack/h5repack.sh.in | 2 +- tools/test/h5repack/h5repacktst.c | 2 - 68 files changed, 350 insertions(+), 393 deletions(-) diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index 63b9755..13b6ce7 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -2156,11 +2156,7 @@ H5LTyy_scan_buffer(char *base, yy_size_t size) * H5LTyy_scan_bytes() instead. */ YY_BUFFER_STATE -H5LTyy_scan_string(yyconst char *yystr) -{ - - return H5LTyy_scan_bytes(yystr, strlen(yystr)); -} +H5LTyy_scan_string(yyconst char *yystr) { return H5LTyy_scan_bytes(yystr, strlen(yystr)); } /** Setup the input buffer state to scan the given bytes. The next call to H5LTyylex() will * scan from a @e copy of @a bytes. diff --git a/src/H5Fquery.c b/src/H5Fquery.c index a7143aa..ed435a8 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -200,8 +200,8 @@ H5F_get_actual_name(const H5F_t *f) * Function: H5F_get_extpath * * Purpose: Retrieve the file's 'extpath' flags - * This is used by H5L_extern_traverse() and H5D_build_file_prefix() to retrieve the main file's - *location when searching the target file. + * This is used by H5L_extern_traverse() and H5D_build_file_prefix() + * to retrieve the main file's location when searching the target file. * * Return: 'extpath' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- @@ -1228,8 +1228,8 @@ H5F_get_null_fsm_addr(const H5F_t *f) * * Return: VOL class pointer for file, can't fail * - * Programmer: Quincey Koziol - * Saturday, August 17, 2019 + * Programmer: Quincey Koziol + * Saturday, August 17, 2019 * *------------------------------------------------------------------------- */ @@ -1271,8 +1271,8 @@ H5F_get_vol_obj(const H5F_t *f) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Saturday, August 17, 2019 + * Programmer: Quincey Koziol + * Saturday, August 17, 2019 * *------------------------------------------------------------------------- */ diff --git a/test/SWMR_UseCase_UG.txt b/test/SWMR_UseCase_UG.txt index 18d4927..1e3d1e6 100644 --- a/test/SWMR_UseCase_UG.txt +++ b/test/SWMR_UseCase_UG.txt @@ -6,8 +6,8 @@ case program and explain how to run them. 2.1. Author and Dates: - Version 2: By Albert Cheng (acheng@hdfgroup.org), 2013/06/18. - Version 1: By Albert Cheng (acheng@hdfgroup.org), 2013/06/01. + Version 2: By Albert Cheng, 2013/06/18. + Version 1: By Albert Cheng, 2013/06/01. %%%%Use Case 1.7%%%% diff --git a/test/app_ref.c b/test/app_ref.c index 275f60b..d2b935a 100644 --- a/test/app_ref.c +++ b/test/app_ref.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Thursday, August 14, 2008 * * Purpose: Tests closing the library after reference counts have been diff --git a/test/bittests.c b/test/bittests.c index 4415600..905f236 100644 --- a/test/bittests.c +++ b/test/bittests.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, June 16, 1998 * * Purpose: Tests functions in H5Tbit.c diff --git a/test/btree2.c b/test/btree2.c index 080f01d..4391a3b 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Tuesday, February 1, 2005 */ #include "h5test.h" diff --git a/test/cache_image.c b/test/cache_image.c index 07b07c6..cdfe7b3 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -15,7 +15,7 @@ * 7/13/15 * * This file contains tests specific to the cache image - * feature implemented in H5C.c + * feature implemented in H5C.c */ #include "cache_common.h" #include "genall5.h" diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 25fa3f0..6e5dd07 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, January 23, 1998 */ diff --git a/test/cross_read.c b/test/cross_read.c index e927b6f..22c6828 100644 --- a/test/cross_read.c +++ b/test/cross_read.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Thursday, March 23, 2006 * * Purpose: Check if floating-point data created on big-endian and diff --git a/test/dangle.c b/test/dangle.c index 0b0aa54..4728923 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, May 13, 2003 * * Purpose: Test dangling IDs diff --git a/test/dsets.c b/test/dsets.c index 96799f8..d76be02 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, December 9, 1997 * * Purpose: Tests the dataset interface (H5D) diff --git a/test/dt_arith.c b/test/dt_arith.c index 4420f84..2489539 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, December 9, 1997 * * Purpose: Tests the data type interface (H5T) diff --git a/test/dtypes.c b/test/dtypes.c index da7b69f..5fd32b7 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, December 9, 1997 * * Purpose: Tests the datatype interface (H5T) @@ -134,16 +134,13 @@ static int opaque_funcs(void); /*------------------------------------------------------------------------- * Function: reset_hdf5 * - * Purpose: Reset the hdf5 library. This causes statistics to be printed - * and counters to be reset. + * Purpose: Reset the hdf5 library. This causes statistics to be printed + * and counters to be reset. * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 16, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void @@ -175,14 +172,10 @@ reset_hdf5(void) * Purpose: Test type classes * * Return: Success: 0 - * * Failure: number of errors * * Programmer: Robb Matzke * Tuesday, December 9, 1997 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -299,14 +292,10 @@ error: * Purpose: Are we able to copy a datatype? * * Return: Success: 0 - * * Failure: number of errors * * Programmer: Robb Matzke * Tuesday, December 9, 1997 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -345,7 +334,6 @@ error: * in nested types) * * Return: Success: 0 - * * Failure: number of errors * * Programmer: Quincey Koziol @@ -575,14 +563,10 @@ error: * Purpose: Tests various things about compound datatypes. * * Return: Success: 0 - * * Failure: number of errors * * Programmer: Robb Matzke * Wednesday, January 7, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -722,19 +706,15 @@ error: /*------------------------------------------------------------------------- * Function: test_compound_2 * - * Purpose: Tests a compound type conversion where the source and - * destination are the same except for the order of the - * elements. - * - * Return: Success: 0 + * Purpose: Tests a compound type conversion where the source and + * destination are the same except for the order of the + * elements. * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, June 17, 1999 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -846,19 +826,15 @@ error: /*------------------------------------------------------------------------- * Function: test_compound_3 * - * Purpose: Tests compound conversions where the source and destination - * are the same except the destination is missing a couple - * members which appear in the source. + * Purpose: Tests compound conversions where the source and destination + * are the same except the destination is missing a couple + * members which appear in the source. * - * Return: Success: 0 - * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, June 17, 1999 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -966,19 +942,15 @@ error: /*------------------------------------------------------------------------- * Function: test_compound_4 * - * Purpose: Tests compound conversions when the destination has the same - * fields as the source but one or more of the fields are - * smaller. + * Purpose: Tests compound conversions when the destination has the same + * fields as the source but one or more of the fields are + * smaller. * - * Return: Success: 0 - * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, June 17, 1999 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -1093,20 +1065,16 @@ error: /*------------------------------------------------------------------------- * Function: test_compound_5 * - * Purpose: Many versions of HDF5 have a bug in the optimized compound + * Purpose: Many versions of HDF5 have a bug in the optimized compound * datatype conversion function, H5T_conv_struct_opt(), which * is triggered when the top-level type contains a struct * which must undergo a conversion. * - * Return: Success: 0 - * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, June 17, 1999 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -1192,19 +1160,15 @@ test_compound_5(void) /*------------------------------------------------------------------------- * Function: test_compound_6 * - * Purpose: Tests compound conversions when the destination has the same - * fields as the source but one or more of the fields are - * larger. - * - * Return: Success: 0 + * Purpose: Tests compound conversions when the destination has the same + * fields as the source but one or more of the fields are + * larger. * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, December 13, 2000 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -1302,15 +1266,14 @@ error: /*------------------------------------------------------------------------- * Function: test_compound_7 * - * Purpose: Tests inserting fields into compound datatypes when the field + * Purpose: Tests inserting fields into compound datatypes when the field * overlaps the end of the compound datatype. Also, tests * increasing compound type size. * - * Return: Success: 0 - * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, December 18, 2001 * * Modifications: @@ -1726,9 +1689,6 @@ error: * * Programmer: Raymond Lu * Wednesday, June 9, 2004 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -5194,17 +5154,13 @@ test_conv_enum_2(void) /*------------------------------------------------------------------------- * Function: test_conv_bitfield * - * Purpose: Test bitfield conversions. - * - * Return: Success: 0 + * Purpose: Test bitfield conversions. * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, May 20, 1999 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -5294,18 +5250,14 @@ error: /*------------------------------------------------------------------------- * Function: test_bitfield_funcs * - * Purpose: Test some datatype functions that are and aren't supposed + * Purpose: Test some datatype functions that are and aren't supposed * work for bitfield type. * - * Return: Success: 0 - * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, April 5, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -5424,17 +5376,13 @@ error: /*------------------------------------------------------------------------- * Function: convert_opaque * - * Purpose: A fake opaque conversion functions + * Purpose: A fake opaque conversion functions * - * Return: Success: 0 - * - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, June 4, 1999 - * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -5451,17 +5399,13 @@ convert_opaque(hid_t H5_ATTR_UNUSED st, hid_t H5_ATTR_UNUSED dt, H5T_cdata_t *cd /*------------------------------------------------------------------------- * Function: test_opaque * - * Purpose: Driver function to test opaque datatypes - * - * Return: Success: 0 + * Purpose: Driver function to test opaque datatypes * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * June 2, 2004 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -5493,15 +5437,13 @@ error: /*------------------------------------------------------------------------- * Function: opaque_check * - * Purpose: Test opaque datatypes - * - * Return: Success: 0 + * Purpose: Test opaque datatypes * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, May 20, 1999 - * *------------------------------------------------------------------------- */ static int @@ -5570,12 +5512,12 @@ error: /*------------------------------------------------------------------------- * Function: opaque_long * - * Purpose: Test named (committed) opaque datatypes w/very long tags + * Purpose: Test named (committed) opaque datatypes w/very long tags * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 14, 2005 * *------------------------------------------------------------------------- @@ -5624,18 +5566,14 @@ error: /*------------------------------------------------------------------------- * Function: opaque_funcs * - * Purpose: Test some type functions that are and aren't supposed to + * Purpose: Test some type functions that are and aren't supposed to * work with opaque type. * - * Return: Success: 0 - * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, April 5, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -7082,18 +7020,14 @@ error: /*------------------------------------------------------------------------- * Function: test_named_indirect_reopen * - * Purpose: Tests that open named datatypes can be reopened indirectly + * Purpose: Tests that open named datatypes can be reopened indirectly * through H5Dget_type without causing problems. * - * Return: Success: 0 - * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Thursday, June 4, 2009 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -7778,12 +7712,12 @@ error: /*------------------------------------------------------------------------- * Function: test_deprec * - * Purpose: Tests deprecated API routines for datatypes. + * Purpose: Tests deprecated API routines for datatypes. * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 27, 2007 * *------------------------------------------------------------------------- @@ -7937,13 +7871,13 @@ error: /*------------------------------------------------------------------------- * Function: test_utf_ascii_conv * - * Purpose: Make sure the library doesn't conversion strings between + * Purpose: Make sure the library doesn't conversion strings between * ASCII and UTF8. * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 10 November 2011 *------------------------------------------------------------------------- */ @@ -8589,9 +8523,6 @@ error: * * Programmer: Robb Matzke * Tuesday, December 9, 1997 - * - * Modifications: - * *------------------------------------------------------------------------- */ int diff --git a/test/earray.c b/test/earray.c index 518aca4..95ef728 100644 --- a/test/earray.c +++ b/test/earray.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Tuesday, June 17, 2008 */ #include "h5test.h" diff --git a/test/enum.c b/test/enum.c index 56300e4..eafce72 100644 --- a/test/enum.c +++ b/test/enum.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, December 22, 1998 */ #include "h5test.h" diff --git a/test/extend.c b/test/extend.c index f21fce9..6658253 100644 --- a/test/extend.c +++ b/test/extend.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, January 30, 1998 * * Purpose: Tests extendible datasets. diff --git a/test/external_common.c b/test/external_common.c index f4dbb4e..d0383b1 100644 --- a/test/external_common.c +++ b/test/external_common.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * April, 2019 * * Purpose: Private function for external.c and external_env.c diff --git a/test/external_common.h b/test/external_common.h index be5094f..a53bb3b 100644 --- a/test/external_common.h +++ b/test/external_common.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * April, 2019 * * Purpose: Private function for external.c and external_env.c diff --git a/test/external_fname.h b/test/external_fname.h index 05433e6..a4f51c1 100644 --- a/test/external_fname.h +++ b/test/external_fname.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * July, 2019 * * Purpose: Private declaration for external.c and external_env.c diff --git a/test/fillval.c b/test/fillval.c index 147775d..2cd6989 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, October 1, 1998 * * Purpose: Tests dataset fill values. diff --git a/test/filter_fail.c b/test/filter_fail.c index 835e946..dca9a20 100644 --- a/test/filter_fail.c +++ b/test/filter_fail.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 7 September 2010 * * Purpose: Make sure dataset, file, and library can close properly when a diff --git a/test/flush1.c b/test/flush1.c index 592db9d..dd5c7b9 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, October 23, 1998 * * Purpose: This is the first half of a two-part test that makes sure diff --git a/test/flush2.c b/test/flush2.c index b1f5ebe..cc38cf1 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, October 23, 1998 * * Purpose: This is the second half of a two-part test that makes sure diff --git a/test/gen_bad_compound.c b/test/gen_bad_compound.c index 8002368..ec0933f 100644 --- a/test/gen_bad_compound.c +++ b/test/gen_bad_compound.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * April 14, 2011 * * Purpose: This program is run to generate an HDF5 data file with objects diff --git a/test/gen_bad_ohdr.c b/test/gen_bad_ohdr.c index 0199ad9..ca635a1 100644 --- a/test/gen_bad_ohdr.c +++ b/test/gen_bad_ohdr.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Jan 5, 2008 * * Purpose: This program is run to generate an HDF5 data file with a diff --git a/test/gen_cross.c b/test/gen_cross.c index c5d9cd6..37c6dcf 100644 --- a/test/gen_cross.c +++ b/test/gen_cross.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Thursday, March 23, 2006 * * This program writes floating-point data to the HDF5 file. It generates diff --git a/test/gen_filters.c b/test/gen_filters.c index a97c2f6..502e041 100644 --- a/test/gen_filters.c +++ b/test/gen_filters.c @@ -37,7 +37,7 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, const unsigned * * Failure: -1 * - * Programmer: Pedro Vicente + * Programmer: Pedro Vicente * Thursday, March 25, 2004 * *------------------------------------------------------------------------- diff --git a/test/gen_mergemsg.c b/test/gen_mergemsg.c index 84f4376..7284786 100644 --- a/test/gen_mergemsg.c +++ b/test/gen_mergemsg.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, June 30, 2006 * * This program creates an object with fragmented object header messages diff --git a/test/gen_new_array.c b/test/gen_new_array.c index 6cd2d7d..605b421 100644 --- a/test/gen_new_array.c +++ b/test/gen_new_array.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, November 09, 2000 * * Purpose: Create a two datasets, one with a compound datatypes with array diff --git a/test/gen_new_fill.c b/test/gen_new_fill.c index d0f043b..0080f3f 100644 --- a/test/gen_new_fill.c +++ b/test/gen_new_fill.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Feb 27, 2002 * * Purpose: This program is run to generate a HDF5 data file with fill diff --git a/test/gen_new_group.c b/test/gen_new_group.c index a73828b..f3f7357 100644 --- a/test/gen_new_group.c +++ b/test/gen_new_group.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Oct 24, 2005 * * Purpose: This program is run to generate an HDF5 data file with both diff --git a/test/gen_new_mtime.c b/test/gen_new_mtime.c index 87de948..a0b5064 100644 --- a/test/gen_new_mtime.c +++ b/test/gen_new_mtime.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, January 3, 2003 * * Purpose: Create a dataset, which should have the newer mtime information diff --git a/test/gen_new_super.c b/test/gen_new_super.c index 7489356..69bf5fa 100644 --- a/test/gen_new_super.c +++ b/test/gen_new_super.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, July 15, 2003 * * Purpose: Create a file which will have the newer superblock format. @@ -29,18 +29,15 @@ #define ISTORE_IK 64 /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Create a file with a new version (>0) of the superblock + * Purpose: Create a file with a new version (>0) of the superblock * - * Return: Success: - * Failure: + * Return: EXIT_SUCCESS * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, July 15, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ int diff --git a/test/gen_old_array.c b/test/gen_old_array.c index a9763fa..54e4101 100644 --- a/test/gen_old_array.c +++ b/test/gen_old_array.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, November 09, 2000 * * Purpose: Create a two datasets with compound datatypes, one with no array diff --git a/test/gen_old_group.c b/test/gen_old_group.c index 1b69894..b584493 100644 --- a/test/gen_old_group.c +++ b/test/gen_old_group.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Oct 24, 2005 * * Purpose: This program is run to generate an HDF5 data file with an diff --git a/test/gen_old_layout.c b/test/gen_old_layout.c index 5a17145..4e56ae7 100644 --- a/test/gen_old_layout.c +++ b/test/gen_old_layout.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, May 27, 2004 * * Purpose: Create two datasets (one for version 1 and one for version 2 of diff --git a/test/gen_old_mtime.c b/test/gen_old_mtime.c index f14ecdf..d4e1544 100644 --- a/test/gen_old_mtime.c +++ b/test/gen_old_mtime.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, January 3, 2003 * * Purpose: Create a dataset, which should have the older mtime information diff --git a/test/gen_sizes_lheap.c b/test/gen_sizes_lheap.c index 24ad91b..7a689b4 100644 --- a/test/gen_sizes_lheap.c +++ b/test/gen_sizes_lheap.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Thursday, July 15, 2010 * * Purpose: Creates a file with non-default sizes of lengths and addresses. diff --git a/test/gen_specmetaread.c b/test/gen_specmetaread.c index edbedbd..4156d79 100644 --- a/test/gen_specmetaread.c +++ b/test/gen_specmetaread.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, October 8, 2009 * * Purpose: Create a file with a dataset who's raw data immediately follows diff --git a/test/gen_udlinks.c b/test/gen_udlinks.c index 7bac453..323709c 100644 --- a/test/gen_udlinks.c +++ b/test/gen_udlinks.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: James Laird + * Programmer: James Laird * Tuesday, June 6, 2006 * * This program creates HDF5 files with user-defined links. These files diff --git a/test/getname.c b/test/getname.c index 4dbb63a..61feee6 100644 --- a/test/getname.c +++ b/test/getname.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Pedro Vicente + * Programmer: Pedro Vicente * April 12, 2002 * * Purpose: Tests the "ID to name" functionality diff --git a/test/gheap.c b/test/gheap.c index e8b6c97..51e1dd2 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * * Purpose: Tests the global heap. The global heap is the set of all diff --git a/test/h5test.h b/test/h5test.h index 16d29af..df996c2 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, November 20, 1998 * * Purpose: Test support stuff. diff --git a/test/hdfs.c b/test/hdfs.c index 75069f1..ee66314 100644 --- a/test/hdfs.c +++ b/test/hdfs.c @@ -19,7 +19,7 @@ * * Demonstrates basic use cases and fapl interaction. * - * Programmer: Jacob Smith + * Programmer: Jacob Smith * 2018-04-23 */ @@ -230,9 +230,10 @@ */ #define JSERR_STR(expected, actual, reason) \ { \ + const char *_reason = reason; \ JSFAILED_AT() \ - if ((reason) != NULL) { \ - HDprintf("%s\n", (reason)); \ + if (_reason != NULL) { \ + HDprintf("%s\n", _reason); \ } \ else { \ HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", (expected), (actual)); \ diff --git a/test/hyperslab.c b/test/hyperslab.c index 4149721..42cdafa 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke +/* Programmer: Robb Matzke * Friday, October 10, 1997 * * Purpose: Hyperslab operations are rather complex, so this file diff --git a/test/istore.c b/test/istore.c index 10a966a..a724359 100644 --- a/test/istore.c +++ b/test/istore.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke +/* Programmer: Robb Matzke * Wednesday, October 15, 1997 * * Purpose: Tests various aspects of indexed raw data storage. diff --git a/test/lheap.c b/test/lheap.c index 0f352bf..17e3082 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, November 24, 1998 * * Purpose: Test local heaps used by symbol tables (groups). diff --git a/test/mount.c b/test/mount.c index 181db66..395a19a 100644 --- a/test/mount.c +++ b/test/mount.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, October 7, 1998 * * Purpose: Tests file mounting. diff --git a/test/mtime.c b/test/mtime.c index b925692..c28b81a 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 30, 1998 * * Purpose: Determines if the modification time message is working diff --git a/test/ohdr.c b/test/ohdr.c index 8b1af88..87d394b 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke +/* Programmer: Robb Matzke * Tuesday, November 24, 1998 */ #include "h5test.h" diff --git a/test/page_buffer.c b/test/page_buffer.c index 8e18eec..ca33872 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -383,7 +383,6 @@ error: * *------------------------------------------------------------------------- */ - static unsigned test_args(hid_t orig_fapl, const char *env_h5_drvr) { diff --git a/test/pool.c b/test/pool.c index e52d039..05304e5 100644 --- a/test/pool.c +++ b/test/pool.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol +/* Programmer: Quincey Koziol * Tuesday, May 3, 2005 */ #include "h5test.h" diff --git a/test/ros3.c b/test/ros3.c index 531f9b1..856160d 100644 --- a/test/ros3.c +++ b/test/ros3.c @@ -20,7 +20,7 @@ * * Demonstrates basic use cases and fapl/dxpl interaction. * - * Programmer: Jacob Smith + * Programmer: Jacob Smith * 2017-10-11 */ diff --git a/test/s3comms.c b/test/s3comms.c index 728501d..73d59a4 100644 --- a/test/s3comms.c +++ b/test/s3comms.c @@ -15,7 +15,7 @@ * * Purpose: Unit tests for the S3 Communications (s3comms) module. * - * Programmer: Jacob Smith + * Programmer: Jacob Smith * 2017-10-11 */ diff --git a/test/set_extent.c b/test/set_extent.c index 1409b8b..133ba48 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Pedro Vicente + * Programmer: Pedro Vicente * April 12, 2002 * * Purpose: Tests the H5Dset_extent call diff --git a/test/space_overflow.c b/test/space_overflow.c index c712ab6..4838fc7 100644 --- a/test/space_overflow.c +++ b/test/space_overflow.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, October 26, 1998 * * Purpose: Create a dataset with a simple data space that has the diff --git a/test/stab.c b/test/stab.c index 23ea2de..739a1ba 100644 --- a/test/stab.c +++ b/test/stab.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, November 24, 1998 */ @@ -184,7 +184,7 @@ error: * * Failure: number of errors * - * Programmer: Robb Matzke 2002-03-28 + * Programmer: Robb Matzke 2002-03-28 * * Modifications: *------------------------------------------------------------------------- diff --git a/test/tchecksum.c b/test/tchecksum.c index 79da14e..36b5709 100644 --- a/test/tchecksum.c +++ b/test/tchecksum.c @@ -15,7 +15,7 @@ * * Created: tchecksum.c * Aug 21 2006 - * Quincey Koziol + * Quincey Koziol * * Purpose: Test internal checksum routine(s) * diff --git a/test/testframe.c b/test/testframe.c index dbc174a..22f694e 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, January 6, 2004 * * Purpose: Provides support functions for the testing framework. diff --git a/test/tfile.c b/test/tfile.c index ea8e707..e41cbbd 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -3059,7 +3059,6 @@ test_rw_noupdate(void) ** test_userblock_alignment() test, to handle common testing ** ** Programmer: Quincey Koziol -** koziol@hdfgroup.org ** Septmber 10, 2009 ** *****************************************************************/ @@ -3121,7 +3120,6 @@ test_userblock_alignment_helper1(hid_t fcpl, hid_t fapl) ** test_userblock_alignment() test, to handle common testing ** ** Programmer: Quincey Koziol -** koziol@hdfgroup.org ** Septmber 10, 2009 ** *****************************************************************/ @@ -3191,7 +3189,6 @@ test_userblock_alignment_helper2(hid_t fapl, hbool_t open_rw) ** object [allocation] alignment size set interact properly. ** ** Programmer: Quincey Koziol -** koziol@hdfgroup.org ** Septmber 8, 2009 ** *****************************************************************/ diff --git a/test/trefer.c b/test/trefer.c index 5f2ea57..8aa8bc2 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -832,11 +832,11 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) hsize_t * coords; /* Coordinate buffer */ hsize_t low[SPACE2_RANK]; /* Selection bounds */ hsize_t high[SPACE2_RANK]; /* Selection bounds */ - H5R_ref_t *wbuf, /* buffer to write to disk */ - *rbuf; /* buffer read from disk */ + H5R_ref_t *wbuf = NULL, /* buffer to write to disk */ + *rbuf = NULL; /* buffer read from disk */ H5R_ref_t nvrbuf[3] = {{{{0}}}, {{{101}}}, {{{255}}}}; /* buffer with non-valid refs */ - uint8_t * dwbuf, /* Buffer for writing numeric data to disk */ - *drbuf; /* Buffer for reading numeric data from disk */ + uint8_t * dwbuf = NULL, /* Buffer for writing numeric data to disk */ + *drbuf = NULL; /* Buffer for reading numeric data from disk */ uint8_t * tu8; /* Temporary pointer to uint8 data */ H5O_type_t obj_type; /* Type of object */ int i, j; /* Counters */ @@ -1246,13 +1246,14 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) ret = H5Rdestroy(&rbuf[j]); CHECK(ret, FAIL, "H5Rdestroy"); } - - /* Free memory buffers */ - HDfree(wbuf); - HDfree(rbuf); - HDfree(dwbuf); - HDfree(drbuf); } + + /* Free memory buffers */ + HDfree(wbuf); + HDfree(rbuf); + HDfree(dwbuf); + HDfree(drbuf); + } /* test_reference_region() */ /**************************************************************** @@ -1285,10 +1286,10 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high) hsize_t * coords; /* Coordinate buffer */ hsize_t low[SPACE3_RANK]; /* Selection bounds */ hsize_t high[SPACE3_RANK]; /* Selection bounds */ - H5R_ref_t *wbuf, /* buffer to write to disk */ - *rbuf; /* buffer read from disk */ - uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ - *drbuf; /* Buffer for reading numeric data from disk */ + H5R_ref_t *wbuf = NULL, /* buffer to write to disk */ + *rbuf = NULL; /* buffer read from disk */ + uint8_t *dwbuf = NULL, /* Buffer for writing numeric data to disk */ + *drbuf = NULL; /* Buffer for reading numeric data from disk */ uint8_t * tu8; /* Temporary pointer to uint8 data */ H5O_type_t obj_type; /* Object type */ int i; /* Counter */ @@ -1586,13 +1587,14 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high) ret = H5Rdestroy(&rbuf[i]); CHECK(ret, FAIL, "H5Rdestroy"); } - - /* Free memory buffers */ - HDfree(wbuf); - HDfree(rbuf); - HDfree(dwbuf); - HDfree(drbuf); } + + /* Free memory buffers */ + HDfree(wbuf); + HDfree(rbuf); + HDfree(dwbuf); + HDfree(drbuf); + } /* test_reference_region_1D() */ /**************************************************************** @@ -2429,10 +2431,10 @@ test_reference_compat_conv(void) hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ - hobj_ref_t * wbuf_obj; /* Buffer to write to disk */ - H5R_ref_t * rbuf_obj; /* Buffer read from disk */ - hdset_reg_ref_t *wbuf_reg; /* Buffer to write to disk */ - H5R_ref_t * rbuf_reg; /* Buffer read from disk */ + hobj_ref_t * wbuf_obj = NULL; /* Buffer to write to disk */ + H5R_ref_t * rbuf_obj = NULL; /* Buffer read from disk */ + hdset_reg_ref_t *wbuf_reg = NULL; /* Buffer to write to disk */ + H5R_ref_t * rbuf_reg = NULL; /* Buffer read from disk */ H5O_type_t obj_type; /* Object type */ herr_t ret; /* Generic return value */ unsigned int i; /* Counter */ diff --git a/test/unlink.c b/test/unlink.c index 1fd9536..8129cc9 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, September 25, 1998 * * Purpose: Test unlinking operations. diff --git a/test/vds.c b/test/vds.c index b215481..4c5929e 100644 --- a/test/vds.c +++ b/test/vds.c @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Monday, February 16, 2015 * * Purpose: Tests datasets with virtual layout. diff --git a/test/vds_env.c b/test/vds_env.c index df5eab5..6e9518b 100644 --- a/test/vds_env.c +++ b/test/vds_env.c @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Monday, February 16, 2015 * * Purpose: Tests datasets with virtual layout. diff --git a/test/vds_swmr.h b/test/vds_swmr.h index b39d7f1..676d831 100644 --- a/test/vds_swmr.h +++ b/test/vds_swmr.h @@ -94,6 +94,4 @@ H5TEST_DLLVAR char VDS_FILE_NAME[NAME_LEN]; /* Dataset names */ H5TEST_DLLVAR char SOURCE_DSET_PATH[NAME_LEN]; H5TEST_DLLVAR char VDS_DSET_NAME[NAME_LEN]; - -/* Fill values */ #endif /* VDS_SWMR_H */ diff --git a/test/vfd.c b/test/vfd.c index 0efe4f5..373a57e 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -2271,46 +2271,51 @@ error: static int compare_splitter_config_info(hid_t fapl_id, H5FD_splitter_vfd_config_t *info) { - int ret_value = 0; - H5FD_splitter_vfd_config_t fetched_info; + int ret_value = 0; + H5FD_splitter_vfd_config_t *fetched_info = NULL; - fetched_info.magic = H5FD_SPLITTER_MAGIC; - fetched_info.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; - fetched_info.rw_fapl_id = H5I_INVALID_HID; - fetched_info.wo_fapl_id = H5I_INVALID_HID; + if (NULL == (fetched_info = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t)))) + SPLITTER_TEST_FAULT("memory allocation for fetched_info struct failed"); - if (H5Pget_fapl_splitter(fapl_id, &fetched_info) < 0) { - SPLITTER_TEST_FAULT("can't get splitter info\n"); + fetched_info->magic = H5FD_SPLITTER_MAGIC; + fetched_info->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; + fetched_info->rw_fapl_id = H5I_INVALID_HID; + fetched_info->wo_fapl_id = H5I_INVALID_HID; + + if (H5Pget_fapl_splitter(fapl_id, fetched_info) < 0) { + SPLITTER_TEST_FAULT("can't get splitter info"); } if (info->rw_fapl_id == H5P_DEFAULT) { - if (H5Pget_driver(fetched_info.rw_fapl_id) != H5Pget_driver(H5P_FILE_ACCESS_DEFAULT)) { + if (H5Pget_driver(fetched_info->rw_fapl_id) != H5Pget_driver(H5P_FILE_ACCESS_DEFAULT)) { SPLITTER_TEST_FAULT("Read-Write driver mismatch (default)\n"); } } else { - if (H5Pget_driver(fetched_info.rw_fapl_id) != H5Pget_driver(info->rw_fapl_id)) { + if (H5Pget_driver(fetched_info->rw_fapl_id) != H5Pget_driver(info->rw_fapl_id)) { SPLITTER_TEST_FAULT("Read-Write driver mismatch\n"); } } if (info->wo_fapl_id == H5P_DEFAULT) { - if (H5Pget_driver(fetched_info.wo_fapl_id) != H5Pget_driver(H5P_FILE_ACCESS_DEFAULT)) { + if (H5Pget_driver(fetched_info->wo_fapl_id) != H5Pget_driver(H5P_FILE_ACCESS_DEFAULT)) { SPLITTER_TEST_FAULT("Write-Only driver mismatch (default)\n"); } } else { - if (H5Pget_driver(fetched_info.wo_fapl_id) != H5Pget_driver(info->wo_fapl_id)) { + if (H5Pget_driver(fetched_info->wo_fapl_id) != H5Pget_driver(info->wo_fapl_id)) { SPLITTER_TEST_FAULT("Write-Only driver mismatch\n"); } } - if ((HDstrlen(info->wo_path) != HDstrlen(fetched_info.wo_path)) || - HDstrncmp(info->wo_path, fetched_info.wo_path, H5FD_SPLITTER_PATH_MAX)) { - HDfprintf(stderr, "MISMATCH: '%s' :: '%s'\n", info->wo_path, fetched_info.wo_path); + if ((HDstrlen(info->wo_path) != HDstrlen(fetched_info->wo_path)) || + HDstrncmp(info->wo_path, fetched_info->wo_path, H5FD_SPLITTER_PATH_MAX)) { + HDfprintf(stderr, "MISMATCH: '%s' :: '%s'\n", info->wo_path, fetched_info->wo_path); HEXPRINT(H5FD_SPLITTER_PATH_MAX, info->wo_path); - HEXPRINT(H5FD_SPLITTER_PATH_MAX, fetched_info.wo_path); + HEXPRINT(H5FD_SPLITTER_PATH_MAX, fetched_info->wo_path); SPLITTER_TEST_FAULT("Write-Only file path mismatch\n"); } done: + HDfree(fetched_info); + return ret_value; } /* end compare_splitter_config_info() */ @@ -2335,43 +2340,48 @@ static int run_splitter_test(const struct splitter_dataset_def *data, hbool_t ignore_wo_errors, hbool_t provide_logfile_path, hid_t sub_fapl_ids[2]) { - hid_t file_id = H5I_INVALID_HID; - hid_t fapl_id = H5I_INVALID_HID; - hid_t dset_id = H5I_INVALID_HID; - hid_t space_id = H5I_INVALID_HID; - hid_t fapl_id_out = H5I_INVALID_HID; - hid_t fapl_id_cpy = H5I_INVALID_HID; - H5FD_splitter_vfd_config_t vfd_config; - char filename_rw[H5FD_SPLITTER_PATH_MAX + 1]; - FILE * logfile = NULL; - int ret_value = 0; - - vfd_config.magic = H5FD_SPLITTER_MAGIC; - vfd_config.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; - vfd_config.ignore_wo_errs = ignore_wo_errors; - vfd_config.rw_fapl_id = sub_fapl_ids[0]; - vfd_config.wo_fapl_id = sub_fapl_ids[1]; - - if (splitter_prepare_file_paths(&vfd_config, filename_rw) < 0) { + hid_t file_id = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t fapl_id_out = H5I_INVALID_HID; + hid_t fapl_id_cpy = H5I_INVALID_HID; + H5FD_splitter_vfd_config_t *vfd_config = NULL; + char * filename_rw = NULL; + FILE * logfile = NULL; + int ret_value = 0; + + if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t)))) + SPLITTER_TEST_FAULT("memory allocation for vfd_config struct failed"); + if (NULL == (filename_rw = HDcalloc(H5FD_SPLITTER_PATH_MAX + 1, sizeof(char)))) + SPLITTER_TEST_FAULT("memory allocation for filename_rw string failed"); + + vfd_config->magic = H5FD_SPLITTER_MAGIC; + vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; + vfd_config->ignore_wo_errs = ignore_wo_errors; + vfd_config->rw_fapl_id = sub_fapl_ids[0]; + vfd_config->wo_fapl_id = sub_fapl_ids[1]; + + if (splitter_prepare_file_paths(vfd_config, filename_rw) < 0) { SPLITTER_TEST_FAULT("can't prepare file paths\n"); } if (provide_logfile_path == FALSE) { - *vfd_config.log_file_path = '\0'; /* reset as empty string */ + vfd_config->log_file_path[0] = '\0'; /* reset as empty string */ } /* Create a new fapl to use the SPLITTER file driver */ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID) { SPLITTER_TEST_FAULT("can't create FAPL ID\n"); } - if (H5Pset_fapl_splitter(fapl_id, &vfd_config) < 0) { + if (H5Pset_fapl_splitter(fapl_id, vfd_config) < 0) { SPLITTER_TEST_FAULT("can't set splitter FAPL\n"); } if (H5Pget_driver(fapl_id) != H5FD_SPLITTER) { SPLITTER_TEST_FAULT("set FAPL not SPLITTER\n"); } - if (compare_splitter_config_info(fapl_id, &vfd_config) < 0) { + if (compare_splitter_config_info(fapl_id, vfd_config) < 0) { SPLITTER_TEST_FAULT("information mismatch\n"); } @@ -2384,7 +2394,7 @@ run_splitter_test(const struct splitter_dataset_def *data, hbool_t ignore_wo_err if (H5I_INVALID_HID == fapl_id_cpy) { SPLITTER_TEST_FAULT("can't copy FAPL\n"); } - if (compare_splitter_config_info(fapl_id_cpy, &vfd_config) < 0) { + if (compare_splitter_config_info(fapl_id_cpy, vfd_config) < 0) { SPLITTER_TEST_FAULT("information mismatch\n"); } if (H5Pclose(fapl_id_cpy) < 0) { @@ -2410,7 +2420,7 @@ run_splitter_test(const struct splitter_dataset_def *data, hbool_t ignore_wo_err if (H5Pget_driver(fapl_id_out) != H5FD_SPLITTER) { SPLITTER_TEST_FAULT("wrong file FAPL driver\n"); } - if (compare_splitter_config_info(fapl_id_out, &vfd_config) < 0) { + if (compare_splitter_config_info(fapl_id_out, vfd_config) < 0) { SPLITTER_TEST_FAULT("information mismatch\n"); } if (H5Pclose(fapl_id_out) < 0) { @@ -2449,12 +2459,12 @@ run_splitter_test(const struct splitter_dataset_def *data, hbool_t ignore_wo_err } /* Verify that the R/W and W/O files are identical */ - if (h5_compare_file_bytes(filename_rw, vfd_config.wo_path) < 0) { + if (h5_compare_file_bytes(filename_rw, vfd_config->wo_path) < 0) { SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n"); } - /* Verify existence of logfile iff appropriate */ - logfile = fopen(vfd_config.log_file_path, "r"); + /* Verify existence of logfile if appropriate */ + logfile = fopen(vfd_config->log_file_path, "r"); if ((TRUE == provide_logfile_path && NULL == logfile) || (FALSE == provide_logfile_path && NULL != logfile)) { SPLITTER_TEST_FAULT("no logfile when one was expected\n"); @@ -2464,20 +2474,23 @@ done: if (ret_value < 0) { H5E_BEGIN_TRY { - (void)H5Dclose(dset_id); - (void)H5Sclose(space_id); - (void)H5Pclose(fapl_id_out); - (void)H5Pclose(fapl_id_cpy); - (void)H5Pclose(fapl_id); - (void)H5Fclose(file_id); + H5Dclose(dset_id); + H5Sclose(space_id); + H5Pclose(fapl_id_out); + H5Pclose(fapl_id_cpy); + H5Pclose(fapl_id); + H5Fclose(file_id); } H5E_END_TRY; } - if (logfile != NULL) { + + if (logfile != NULL) fclose(logfile); - } - return ret_value; + HDfree(vfd_config); + HDfree(filename_rw); + + return ret_value; } /* end run_splitter_test() */ /*------------------------------------------------------------------------- @@ -2498,24 +2511,27 @@ done: static int driver_is_splitter_compatible(hid_t fapl_id) { - H5FD_splitter_vfd_config_t vfd_config; - hid_t split_fapl_id = H5I_INVALID_HID; - herr_t ret = SUCCEED; - int ret_value = 0; + H5FD_splitter_vfd_config_t *vfd_config = NULL; + hid_t split_fapl_id = H5I_INVALID_HID; + herr_t ret = SUCCEED; + int ret_value = 0; + + if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t)))) { + FAIL_PUTS_ERROR("memory allocation for vfd_config struct failed"); + } - split_fapl_id = H5Pcreate(H5P_FILE_ACCESS); - if (H5I_INVALID_HID == split_fapl_id) { + if (H5I_INVALID_HID == (split_fapl_id = H5Pcreate(H5P_FILE_ACCESS))) { FAIL_PUTS_ERROR("Can't create contained FAPL"); } - vfd_config.magic = H5FD_SPLITTER_MAGIC; - vfd_config.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; - vfd_config.ignore_wo_errs = FALSE; - vfd_config.rw_fapl_id = H5P_DEFAULT; - vfd_config.wo_fapl_id = fapl_id; - HDstrncpy(vfd_config.wo_path, "nonesuch", H5FD_SPLITTER_PATH_MAX); - *vfd_config.log_file_path = '\0'; + vfd_config->magic = H5FD_SPLITTER_MAGIC; + vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; + vfd_config->ignore_wo_errs = FALSE; + vfd_config->rw_fapl_id = H5P_DEFAULT; + vfd_config->wo_fapl_id = fapl_id; + HDstrncpy(vfd_config->wo_path, "nonesuch", H5FD_SPLITTER_PATH_MAX); + vfd_config->log_file_path[0] = '\0'; - H5E_BEGIN_TRY { ret = H5Pset_fapl_splitter(split_fapl_id, &vfd_config); } + H5E_BEGIN_TRY { ret = H5Pset_fapl_splitter(split_fapl_id, vfd_config); } H5E_END_TRY; if (SUCCEED == ret) { ret_value = -1; @@ -2526,11 +2542,16 @@ driver_is_splitter_compatible(hid_t fapl_id) } split_fapl_id = H5I_INVALID_HID; + HDfree(vfd_config); + return ret_value; error: - H5E_BEGIN_TRY { (void)H5Pclose(split_fapl_id); } + H5E_BEGIN_TRY { H5Pclose(split_fapl_id); } H5E_END_TRY; + + HDfree(vfd_config); + return -1; } /* end driver_is_splitter_compatible() */ @@ -2550,19 +2571,24 @@ error: static int splitter_RO_test(const struct splitter_dataset_def *data, hid_t child_fapl_id) { - char filename_rw[H5FD_SPLITTER_PATH_MAX + 1]; - H5FD_splitter_vfd_config_t vfd_config; - hid_t fapl_id = H5I_INVALID_HID; - int ret_value = 0; - hid_t file_id = H5I_INVALID_HID; - - vfd_config.magic = H5FD_SPLITTER_MAGIC; - vfd_config.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; - vfd_config.ignore_wo_errs = FALSE; - vfd_config.rw_fapl_id = child_fapl_id; - vfd_config.wo_fapl_id = child_fapl_id; - - if (splitter_prepare_file_paths(&vfd_config, filename_rw) < 0) { + char * filename_rw = NULL; + H5FD_splitter_vfd_config_t *vfd_config = NULL; + hid_t fapl_id = H5I_INVALID_HID; + hid_t file_id = H5I_INVALID_HID; + int ret_value = 0; + + if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t)))) + SPLITTER_TEST_FAULT("memory allocation for vfd_config struct failed"); + if (NULL == (filename_rw = HDcalloc(H5FD_SPLITTER_PATH_MAX + 1, sizeof(char)))) + SPLITTER_TEST_FAULT("memory allocation for filename_rw string failed"); + + vfd_config->magic = H5FD_SPLITTER_MAGIC; + vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; + vfd_config->ignore_wo_errs = FALSE; + vfd_config->rw_fapl_id = child_fapl_id; + vfd_config->wo_fapl_id = child_fapl_id; + + if (splitter_prepare_file_paths(vfd_config, filename_rw) < 0) { SPLITTER_TEST_FAULT("can't prepare splitter file paths\n"); } @@ -2571,7 +2597,7 @@ splitter_RO_test(const struct splitter_dataset_def *data, hid_t child_fapl_id) if (H5I_INVALID_HID == fapl_id) { SPLITTER_TEST_FAULT("can't create FAPL ID\n"); } - if (H5Pset_fapl_splitter(fapl_id, &vfd_config) < 0) { + if (H5Pset_fapl_splitter(fapl_id, vfd_config) < 0) { SPLITTER_TEST_FAULT("can't set splitter FAPL\n"); } if (H5Pget_driver(fapl_id) != H5FD_SPLITTER) { @@ -2592,7 +2618,7 @@ splitter_RO_test(const struct splitter_dataset_def *data, hid_t child_fapl_id) * Should fail. */ - if (splitter_create_single_file_at(vfd_config.wo_path, vfd_config.wo_fapl_id, data) < 0) { + if (splitter_create_single_file_at(vfd_config->wo_path, vfd_config->wo_fapl_id, data) < 0) { SPLITTER_TEST_FAULT("can't write W/O file\n"); } H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id); } @@ -2600,13 +2626,13 @@ splitter_RO_test(const struct splitter_dataset_def *data, hid_t child_fapl_id) if (file_id >= 0) { SPLITTER_TEST_FAULT("R/O open with extant W/O file unexpectedly successful\n"); } - HDremove(vfd_config.wo_path); + HDremove(vfd_config->wo_path); /* Attempt R/O open when only R/W file exists * Should fail. */ - if (splitter_create_single_file_at(filename_rw, vfd_config.rw_fapl_id, data) < 0) { + if (splitter_create_single_file_at(filename_rw, vfd_config->rw_fapl_id, data) < 0) { SPLITTER_TEST_FAULT("can't create R/W file\n"); } H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id); } @@ -2618,7 +2644,7 @@ splitter_RO_test(const struct splitter_dataset_def *data, hid_t child_fapl_id) /* Attempt R/O open when both R/W and W/O files exist */ - if (splitter_create_single_file_at(vfd_config.wo_path, vfd_config.wo_fapl_id, data) < 0) { + if (splitter_create_single_file_at(vfd_config->wo_path, vfd_config->wo_fapl_id, data) < 0) { SPLITTER_TEST_FAULT("can't create W/O file\n"); } file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id); @@ -2645,11 +2671,15 @@ done: if (ret_value < 0) { H5E_BEGIN_TRY { - (void)H5Pclose(fapl_id); - (void)H5Fclose(file_id); + H5Pclose(fapl_id); + H5Fclose(file_id); } H5E_END_TRY; - } /* end if error */ + } + + HDfree(vfd_config); + HDfree(filename_rw); + return ret_value; } /* end splitter_RO_test() */ @@ -2779,9 +2809,9 @@ done: if (ret_value < 0) { H5E_BEGIN_TRY { - (void)H5Dclose(dset_id); - (void)H5Sclose(space_id); - (void)H5Fclose(file_id); + H5Dclose(dset_id); + H5Sclose(space_id); + H5Fclose(file_id); } H5E_END_TRY; } /* end if error */ @@ -2840,7 +2870,7 @@ splitter_compare_expected_data(hid_t file_id, const struct splitter_dataset_def done: if (ret_value < 0) { - H5E_BEGIN_TRY { (void)H5Dclose(dset_id); } + H5E_BEGIN_TRY { H5Dclose(dset_id); } H5E_END_TRY; } return ret_value; @@ -2872,11 +2902,11 @@ done: static int splitter_tentative_open_test(hid_t child_fapl_id) { - const char filename_tmp[H5FD_SPLITTER_PATH_MAX + 1] = "splitter_tmp.h5"; - char filename_rw[H5FD_SPLITTER_PATH_MAX + 1]; - H5FD_splitter_vfd_config_t vfd_config; - hid_t fapl_id = H5I_INVALID_HID; - hid_t file_id = H5I_INVALID_HID; + const char * filename_tmp = "splitter_tmp.h5"; + char * filename_rw = NULL; + H5FD_splitter_vfd_config_t *vfd_config = NULL; + hid_t fapl_id = H5I_INVALID_HID; + hid_t file_id = H5I_INVALID_HID; int buf[SPLITTER_SIZE][SPLITTER_SIZE]; /* for comparison */ hsize_t dims[2] = {SPLITTER_SIZE, SPLITTER_SIZE}; /* for comparison */ int i = 0; /* for comparison */ @@ -2884,6 +2914,11 @@ splitter_tentative_open_test(hid_t child_fapl_id) struct splitter_dataset_def data; /* for comparison */ int ret_value = 0; + if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t)))) + SPLITTER_TEST_FAULT("memory allocation for vfd_config struct failed"); + if (NULL == (filename_rw = HDcalloc(H5FD_SPLITTER_PATH_MAX + 1, sizeof(char)))) + SPLITTER_TEST_FAULT("memory allocation for filename_rw string failed"); + /* pre-fill data buffer to write */ for (i = 0; i < SPLITTER_SIZE; i++) { for (j = 0; j < SPLITTER_SIZE; j++) { @@ -2898,13 +2933,13 @@ splitter_tentative_open_test(hid_t child_fapl_id) data.n_dims = 2; data.dset_name = SPLITTER_DATASET_NAME; - vfd_config.magic = H5FD_SPLITTER_MAGIC; - vfd_config.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; - vfd_config.ignore_wo_errs = FALSE; - vfd_config.rw_fapl_id = child_fapl_id; - vfd_config.wo_fapl_id = child_fapl_id; + vfd_config->magic = H5FD_SPLITTER_MAGIC; + vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; + vfd_config->ignore_wo_errs = FALSE; + vfd_config->rw_fapl_id = child_fapl_id; + vfd_config->wo_fapl_id = child_fapl_id; - if (splitter_prepare_file_paths(&vfd_config, filename_rw) < 0) { + if (splitter_prepare_file_paths(vfd_config, filename_rw) < 0) { SPLITTER_TEST_FAULT("can't prepare splitter file paths\n"); } @@ -2912,7 +2947,7 @@ splitter_tentative_open_test(hid_t child_fapl_id) if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID) { SPLITTER_TEST_FAULT("can't create FAPL ID\n"); } - if (H5Pset_fapl_splitter(fapl_id, &vfd_config) < 0) { + if (H5Pset_fapl_splitter(fapl_id, vfd_config) < 0) { SPLITTER_TEST_FAULT("can't set splitter FAPL\n"); } if (H5Pget_driver(fapl_id) != H5FD_SPLITTER) { @@ -2941,7 +2976,7 @@ splitter_tentative_open_test(hid_t child_fapl_id) if (file_exists(filename_rw, child_fapl_id)) { SPLITTER_TEST_FAULT("R/W file unexpectedly created\n"); } - if (file_exists(vfd_config.wo_path, child_fapl_id)) { + if (file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("W/O file unexpectedly created\n"); } @@ -2951,7 +2986,7 @@ splitter_tentative_open_test(hid_t child_fapl_id) * Should fail. */ - if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config.wo_path) < 0) { + if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config->wo_path) < 0) { SPLITTER_TEST_FAULT("Can't create W/O file copy.\n"); } H5E_BEGIN_TRY { file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id); } @@ -2962,11 +2997,11 @@ splitter_tentative_open_test(hid_t child_fapl_id) if (file_exists(filename_rw, child_fapl_id)) { SPLITTER_TEST_FAULT("R/W file unexpectedly created\n"); } - if (!file_exists(vfd_config.wo_path, child_fapl_id)) { + if (!file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n"); } - HDremove(vfd_config.wo_path); - if (file_exists(vfd_config.wo_path, child_fapl_id)) { + HDremove(vfd_config->wo_path); + if (file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("failed to remove W/O file\n"); } @@ -2987,7 +3022,7 @@ splitter_tentative_open_test(hid_t child_fapl_id) if (!file_exists(filename_rw, child_fapl_id)) { SPLITTER_TEST_FAULT("R/W file mysteriously disappeared\n"); } - if (file_exists(vfd_config.wo_path, child_fapl_id)) { + if (file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("W/O file unexpectedly created\n"); } @@ -2996,7 +3031,7 @@ splitter_tentative_open_test(hid_t child_fapl_id) * Both files present. */ - if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config.wo_path) < 0) { + if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config->wo_path) < 0) { SPLITTER_TEST_FAULT("Can't create W/O file copy.\n"); } file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id); @@ -3010,7 +3045,7 @@ splitter_tentative_open_test(hid_t child_fapl_id) if (!file_exists(filename_rw, child_fapl_id)) { SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n"); } - if (!file_exists(vfd_config.wo_path, child_fapl_id)) { + if (!file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n"); } @@ -3030,14 +3065,14 @@ splitter_tentative_open_test(hid_t child_fapl_id) if (!file_exists(filename_rw, child_fapl_id)) { SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n"); } - if (!file_exists(vfd_config.wo_path, child_fapl_id)) { + if (!file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n"); } - if (h5_compare_file_bytes(filename_rw, vfd_config.wo_path) < 0) { + if (h5_compare_file_bytes(filename_rw, vfd_config->wo_path) < 0) { SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n"); } HDremove(filename_rw); - HDremove(vfd_config.wo_path); + HDremove(vfd_config->wo_path); /* * H5Fcreate() with TRUNC access. @@ -3047,7 +3082,7 @@ splitter_tentative_open_test(hid_t child_fapl_id) if (h5_duplicate_file_by_bytes(filename_tmp, filename_rw) < 0) { SPLITTER_TEST_FAULT("Can't create R/W file copy.\n"); } - if (file_exists(vfd_config.wo_path, child_fapl_id)) { + if (file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("failed to remove W/O file\n"); } file_id = H5Fcreate(filename_rw, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); @@ -3061,21 +3096,21 @@ splitter_tentative_open_test(hid_t child_fapl_id) if (!file_exists(filename_rw, child_fapl_id)) { SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n"); } - if (!file_exists(vfd_config.wo_path, child_fapl_id)) { + if (!file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n"); } - if (h5_compare_file_bytes(filename_rw, vfd_config.wo_path) < 0) { + if (h5_compare_file_bytes(filename_rw, vfd_config->wo_path) < 0) { SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n"); } HDremove(filename_rw); - HDremove(vfd_config.wo_path); + HDremove(vfd_config->wo_path); /* * H5Fcreate() with TRUNC access. * Only W/O present. */ - if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config.wo_path) < 0) { + if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config->wo_path) < 0) { SPLITTER_TEST_FAULT("Can't create W/O file copy.\n"); } if (file_exists(filename_rw, child_fapl_id)) { @@ -3092,14 +3127,14 @@ splitter_tentative_open_test(hid_t child_fapl_id) if (!file_exists(filename_rw, child_fapl_id)) { SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n"); } - if (!file_exists(vfd_config.wo_path, child_fapl_id)) { + if (!file_exists(vfd_config->wo_path, child_fapl_id)) { SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n"); } - if (h5_compare_file_bytes(filename_rw, vfd_config.wo_path) < 0) { + if (h5_compare_file_bytes(filename_rw, vfd_config->wo_path) < 0) { SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n"); } HDremove(filename_rw); - HDremove(vfd_config.wo_path); + HDremove(vfd_config->wo_path); /* H5Fcreate with both files absent is tested elsewhere */ @@ -3115,11 +3150,15 @@ done: if (ret_value < 0) { H5E_BEGIN_TRY { - (void)H5Pclose(fapl_id); - (void)H5Fclose(file_id); + H5Pclose(fapl_id); + H5Fclose(file_id); } H5E_END_TRY; - } /* end if error */ + } + + HDfree(vfd_config); + HDfree(filename_rw); + return ret_value; } /* end splitter_tentative_open_test() */ @@ -3153,7 +3192,7 @@ file_exists(const char *filename, hid_t fapl_id) return ret_value; error: - H5E_BEGIN_TRY { (void)H5Fclose(file_id); } + H5E_BEGIN_TRY { H5Fclose(file_id); } H5E_END_TRY; return ret_value; } /* end file_exists() */ @@ -3259,9 +3298,9 @@ test_splitter(void) return 0; error: - if (child_fapl_id != H5I_INVALID_HID) { - (void)H5Pclose(child_fapl_id); - } + if (child_fapl_id != H5I_INVALID_HID) + H5Pclose(child_fapl_id); + return -1; } /* end test_splitter() */ @@ -3272,8 +3311,7 @@ error: * * Purpose: Tests the basic features of Virtual File Drivers * - * Return: Success: 0 - * Failure: 1 + * Return: EXIT_SUCCESS/EXIT_FAILURE * *------------------------------------------------------------------------- */ @@ -3302,10 +3340,10 @@ main(void) if (nerrors) { HDprintf("***** %d Virtual File Driver TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); - return 1; - } /* end if */ + return EXIT_FAILURE; + } HDprintf("All Virtual File Driver tests passed.\n"); - return 0; + return EXIT_SUCCESS; } /* end main() */ diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index 18e6d86..a95a22e 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -689,7 +689,7 @@ DIFFFAIL() $RUNSERIAL $H5DIFF_BIN -q "$@" ) RET=$? - if [ $RET == 0 ] ; then + if [ $RET -eq 0 ] ; then echo "*FAILED*" nerrors="`expr $nerrors + 1`" else diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index ea9ded1..85af344 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -3292,8 +3292,6 @@ make_layout2(hid_t loc_id) if (make_dset(loc_id, CHUNKED_S_FIX, s_sid, chunked_dcpl, s_buf[0]) < 0) goto error; - HDfree(s_buf); - ret_value = 0; error: -- cgit v0.12 From ca32c785fc456522b10e0c3fb68ed0403d659ca9 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 7 Oct 2020 10:45:11 -0500 Subject: Merge from develop github workflow files parser files bin scripts doc corrections --- .clang-format | 5 +- .github/CODEOWNERS | 28 +- .github/workflows/clang-format-check.yml | 6 +- .github/workflows/main.yml | 4 +- .github/workflows/pr-check.yml | 4 +- COPYING | 6 - MANIFEST | 1 - bin/errors | 2 +- bin/format_source | 24 +- bin/format_source_patch | 24 +- bin/genparser | 29 +- bin/h5vers | 2 +- bin/trace | 38 +- bin/warnhist | 2 +- config/cmake/HDF5_Process_Flex_Files.cmake | 95 - hl/src/H5LTanalyze.c | 3531 ++++++++++++++-------------- hl/src/H5LTanalyze.l | 25 +- hl/src/H5LTparse.c | 3529 +++++++++++++-------------- hl/src/H5LTparse.h | 183 +- release_docs/INSTALL | 11 +- test/vfd.c | 2 +- 21 files changed, 3735 insertions(+), 3816 deletions(-) delete mode 100644 config/cmake/HDF5_Process_Flex_Files.cmake diff --git a/.clang-format b/.clang-format index 36f326d..4779a35 100644 --- a/.clang-format +++ b/.clang-format @@ -12,7 +12,7 @@ BraceWrapping: BreakBeforeBraces: Stroustrup BreakAfterJavaFieldAnnotations: true BreakStringLiterals: true -ColumnLimit: 110 +ColumnLimit: 110 # Update $max_trace_macro_line_len in bin/trace also IncludeCategories: - Regex: '^"(llvm|llvm-c|clang|clang-c)/' Priority: 3 @@ -33,6 +33,8 @@ IncludeIsMainRegex: '(public)?$' IndentCaseLabels: true IndentGotoLabels: false IndentWidth: 4 +MacroBlockBegin: "^BEGIN_FUNC" +MacroBlockEnd: "^END_FUNC" ObjCBlockIndentWidth: 4 ReflowComments: true SortIncludes: false @@ -58,5 +60,6 @@ StatementMacros: - HMPI_GOTO_ERROR - H5_GCC_DIAG_OFF - H5_GCC_DIAG_ON + - CATCH ... diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 31b194f..97b7428 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -7,36 +7,36 @@ # Order is important. The last matching pattern has the most precedence. # So if a pull request only touches javascript files, only these owners # will be requested to review. -*.cmake @byrnHDF -CMakeLists.txt @byrnHDF -CMakeTests.* @byrnHDF +*.cmake @byrnHDF @derobins +CMakeLists.txt @byrnHDF @derobins +CMakeTests.* @byrnHDF @derobins -/bin/ @lrknox @derobins @byrnHDF +/bin/ @lrknox @derobins @qkoziol -/c++/ bmribler@hdfgroup.org +/c++/ @bmribler @byrnHDF -/config/ @lrknox @derobins @byrnHDF +/config/ @lrknox @derobins @qkoziol @byrnHDF -/doc/ @gnuoyd mainzer@hdfgroup.org +/doc/ @gnuoyd @jrmainzer -/examples/ @lrknox @derobins bljones@hdfgroup.org +/examples/ @lrknox @derobins @bljhdf /fortran/ @brtnfld @epourmal -/hl/ bmribler@hdfgroup.org +/hl/ @bmribler @byrnHDF /java/ @jhendersonHDF @byrnHDF /m4/ @lrknox @derobins -/release_docs/ @lrknox bljones@hdfgroup.org @byrnHDF +/release_docs/ @lrknox @bljhdf @byrnHDF -/src/ @jhendersonHDF @derobins @fortnern @qkoziol @soumagne @vchoi-hdfgroup mainzer@hdfgroup.org +/src/ @jhendersonHDF @derobins @fortnern @qkoziol @soumagne @vchoi-hdfgroup @jrmainzer -/test/ @jhendersonHDF @derobins @fortnern @qkoziol @soumagne @vchoi-hdfgroup mainzer@hdfgroup.org +/test/ @jhendersonHDF @derobins @fortnern @qkoziol @soumagne @vchoi-hdfgroup @jrmainzer -/testpar/ @jhendersonHDF @rawarren mainzer@hdfgroup.org +/testpar/ @jhendersonHDF @rawarren @jrmainzer @qkoziol -/tools/ @byrnHDF +/tools/ @byrnHDF @bmribler /utils/ @lrknox @byrnHDF diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index 62dcb08..6bf522c 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -8,10 +8,10 @@ jobs: steps: - uses: actions/checkout@v2 - name: Run clang-format style check for C programs. - uses: DoozyX/clang-format-lint-action@v0.8 + uses: DoozyX/clang-format-lint-action@v0.10 with: source: '.' - extensions: 'c,h,cpp' + extensions: 'c,h,cpp,hpp' clangFormatVersion: 10 style: file - exclude: './config ./hl/src/H5LTanalyze.c' + exclude: './config ./hl/src/H5LTanalyze.c ./hl/src/H5LTparse.c ./hl/src/H5LTparse.h ./src/H5Epubgen.h ./src/H5Einit.h ./src/H5Eterm.h ./src/H5Edefin.h ./src/H5version.h ./src/H5overflow.h' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6dad657..a7faaa7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -95,8 +95,8 @@ jobs: if: matrix.os == 'windows-latest' run: | # Set these env vars so cmake picks the correct compiler - echo "::set-env name=CXX::cl.exe" - echo "::set-env name=CC::cl.exe" + echo "CXX=cl.exe" >> $GITHUB_ENV + echo "CC=cl.exe" >> $GITHUB_ENV # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Get Sources diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index e3b9d9b..7cce4d0 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -89,8 +89,8 @@ jobs: if: matrix.os == 'windows-latest' run: | # Set these env vars so cmake picks the correct compiler - echo "::set-env name=CXX::cl.exe" - echo "::set-env name=CC::cl.exe" + echo "CXX=cl.exe" >> $GITHUB_ENV + echo "CC=cl.exe" >> $GITHUB_ENV # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Get Sources diff --git a/COPYING b/COPYING index 659bf1c..da64ef8 100644 --- a/COPYING +++ b/COPYING @@ -97,10 +97,4 @@ and/or accompanying materials: ----------------------------------------------------------------------------- -HDF5 is available with the SZIP compression library but SZIP is not part -of HDF5 and has separate copyright and license terms. See SZIP Compression -in HDF Products (www.hdfgroup.org/doc_resource/SZIP/) for further details. - ------------------------------------------------------------------------------ - diff --git a/MANIFEST b/MANIFEST index 84d942c..fb4e6b5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3452,7 +3452,6 @@ ./config/cmake/HDFCompilerFlags.cmake ./config/cmake/HDFCXXCompilerFlags.cmake ./config/cmake/HDFFortranCompilerFlags.cmake -./config/cmake/HDF5_Process_Flex_Files.cmake ./config/cmake/HDF5Macros.cmake ./config/cmake/HDF5UseFortran.cmake ./config/cmake/jrunTest.cmake diff --git a/bin/errors b/bin/errors index 107bb9c..a5bad3a 100755 --- a/bin/errors +++ b/bin/errors @@ -17,7 +17,7 @@ use Text::Tabs; # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -# Robb Matzke, matzke@llnl.gov +# Robb Matzke # 30 Aug 1997 # # Purpose: This script will read standard input which should be a diff --git a/bin/format_source b/bin/format_source index b0b695c..1128def 100755 --- a/bin/format_source +++ b/bin/format_source @@ -1,6 +1,26 @@ #!/bin/bash +# +# Recursively format all C & C++ sources and header files, except those in the +# 'config' directory and generated files, such as H5LTanalyze.c, etc. +# +# Note that any files or directories that are excluded here should also be +# added to the 'exclude' list in .github/workflows/clang-format-check.yml +# +# (Remember to update both bin/format_source and bin/format_source_patch) + find . -type d \( -path ./config \) -prune \ - -o -iname *.h -o -iname *.c -o -iname *.cpp -o -iname *.hpp \ + -or \( \( \! \( \ + -name H5LTanalyze.c \ + -or -name H5LTparse.c \ + -or -name H5LTparse.h \ + -or -name H5Epubgen.h \ + -or -name H5Einit.h \ + -or -name H5Eterm.h \ + -or -name H5Edefin.h \ + -or -name H5version.h \ + -or -name H5overflow.h \ + \) \) \ + -and \( -iname *.h -or -iname *.c -or -iname *.cpp -or -iname *.hpp \) \) \ | xargs clang-format -style=file -i -fallback-style=none -exit 0 \ No newline at end of file +exit 0 diff --git a/bin/format_source_patch b/bin/format_source_patch index 4c531ea..8d6be01 100755 --- a/bin/format_source_patch +++ b/bin/format_source_patch @@ -1,6 +1,26 @@ #!/bin/bash +# +# Recursively format all C & C++ sources and header files, except those in the +# 'config' directory and generated files, such as H5LTanalyze.c, etc. +# +# Note that any files or directories that are excluded here should also be +# added to the 'exclude' list in .github/workflows/clang-format-check.yml +# +# (Remember to update both bin/format_source and bin/format_source_patch) + find . -type d \( -path ./config \) -prune \ - -o -iname *.h -o -iname *.c -o -iname *.cpp -o -iname *.hpp \ + -or \( \( \! \( \ + -name H5LTanalyze.c \ + -or -name H5LTparse.c \ + -or -name H5LTparse.h \ + -or -name H5Epubgen.h \ + -or -name H5Einit.h \ + -or -name H5Eterm.h \ + -or -name H5Edefin.h \ + -or -name H5version.h \ + -or -name H5overflow.h \ + \) \) \ + -and \( -iname *.h -or -iname *.c -or -iname *.cpp -or -iname *.hpp \) \) \ | xargs clang-format -style=file -i -fallback-style=none git diff > clang_format.patch @@ -11,4 +31,4 @@ then rm clang_format.patch fi -exit 0 \ No newline at end of file +exit 0 diff --git a/bin/genparser b/bin/genparser index e6aee5b..ab40775 100755 --- a/bin/genparser +++ b/bin/genparser @@ -1,10 +1,10 @@ #! /bin/bash # -# 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 +# 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 COPYING file, which can be found at the root of the source code # distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. # If you do not have access to either file, you may request a copy from @@ -200,17 +200,20 @@ if [ "$verbose" = true ] ; then fi ${HDF5_FLEX} --nounistd -PH5LTyy -o ${path_to_hl_src}/H5LTanalyze.c ${path_to_hl_src}/H5LTanalyze.l -# fix H5LTparse.c to declare H5LTyyparse return type as an hid_t -# instead of int. Currently the generated function H5LTyyparse is +# fix H5LTparse.c and H5LTlparse.h to declare H5LTyyparse return type as an +# hid_t instead of int. Currently the generated function H5LTyyparse is # generated with a return value of type int, which is a mapping to the # flex yyparse function. The return value in the HL library should be -# an hid_t. -# I propose to not use flex to generate this function, but for now I am +# an hid_t. +# I propose to not use flex to generate this function, but for now I am # adding a perl command to find and replace this function declaration in # H5LTparse.c. perl -0777 -pi -e 's/int yyparse/hid_t yyparse/igs' ${path_to_hl_src}/H5LTparse.c perl -0777 -pi -e 's/int\nyyparse/hid_t\nyyparse/igs' ${path_to_hl_src}/H5LTparse.c perl -0777 -pi -e 's/int H5LTyyparse/hid_t H5LTyyparse/igs' ${path_to_hl_src}/H5LTparse.c +perl -0777 -pi -e 's/int yyparse/hid_t yyparse/igs' ${path_to_hl_src}/H5LTparse.h +perl -0777 -pi -e 's/int\nyyparse/hid_t\nyyparse/igs' ${path_to_hl_src}/H5LTparse.h +perl -0777 -pi -e 's/int H5LTyyparse/hid_t H5LTyyparse/igs' ${path_to_hl_src}/H5LTparse.h # Add code that disables warnings in the flex/bison-generated code. # @@ -218,7 +221,8 @@ perl -0777 -pi -e 's/int H5LTyyparse/hid_t H5LTyyparse/igs' ${path_to_hl_src}/H5 # will simply ignore them, but we want to avoid those warnings. for f in ${path_to_hl_src}/H5LTparse.c ${path_to_hl_src}/H5LTanalyze.c do - echo '#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ ' >> tmp.out + echo '#if defined (__GNUC__) ' >> tmp.out + echo '#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 ' >> tmp.out echo '#pragma GCC diagnostic ignored "-Wconversion" ' >> tmp.out echo '#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" ' >> tmp.out echo '#pragma GCC diagnostic ignored "-Wlarger-than=" ' >> tmp.out @@ -230,11 +234,16 @@ do echo '#pragma GCC diagnostic ignored "-Wsign-conversion" ' >> tmp.out echo '#pragma GCC diagnostic ignored "-Wstrict-overflow" ' >> tmp.out echo '#pragma GCC diagnostic ignored "-Wstrict-prototypes" ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wsuggest-attribute=const" ' >> tmp.out echo '#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" ' >> tmp.out echo '#pragma GCC diagnostic ignored "-Wswitch-default" ' >> tmp.out echo '#pragma GCC diagnostic ignored "-Wunused-function" ' >> tmp.out echo '#pragma GCC diagnostic ignored "-Wunused-macros" ' >> tmp.out echo '#pragma GCC diagnostic ignored "-Wunused-parameter" ' >> tmp.out + echo '#endif ' >> tmp.out + echo '#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 600 ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wnull-dereference" ' >> tmp.out + echo '#endif ' >> tmp.out echo '#elif defined __SUNPRO_CC ' >> tmp.out echo '#pragma disable_warn ' >> tmp.out echo '#elif defined _MSC_VER ' >> tmp.out diff --git a/bin/h5vers b/bin/h5vers index 659a081..6093eb0 100755 --- a/bin/h5vers +++ b/bin/h5vers @@ -17,7 +17,7 @@ use strict; # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # -# Robb Matzke +# Robb Matzke # 17 July 1998 ### Purpose diff --git a/bin/trace b/bin/trace index fd0248e..ff91873 100755 --- a/bin/trace +++ b/bin/trace @@ -210,6 +210,14 @@ $Source = ""; "ssize_t" => "Zs", ); + +############################################################################## +# Maximum length of H5TRACE macro line +# If the ColumnLimit in .clang-format is changed, this value will need to be updated +# +my $max_trace_macro_line_len = 110; + + ############################################################################## # Print an error message. # @@ -287,7 +295,7 @@ sub rewrite_func ($$$$$) { # Parse arguments if ($args eq "void") { - $trace = "H5TRACE0(\"$rettype\",\"\");\n"; + $trace = "H5TRACE0(\"$rettype\", \"\");\n"; } else { # Split arguments. First convert `/*in,out*/' to get rid of the # comma, then split the arguments on commas. @@ -331,18 +339,34 @@ sub rewrite_func ($$$$$) { } } } + + # Compose the trace macro $trace = "H5TRACE" . scalar(@arg_str) . "(\"$rettype\", \""; $trace .= join("", @arg_str) . "\""; - my $len = 4 + length $trace; + my $len = 4 + length $trace; # Add 4, for indenting the line for (@arg_name) { - if ($len + length >= 77) { - $trace .= ",\n $_"; - $len = 13 + length; + # Wrap lines that will be longer than the limit, after ');' is added + if ($len + length >= ($max_trace_macro_line_len - 2)) { + # Wrap line, with indention + $trace .= ",\n "; + $len = 13; # Set to 13, for indention + + # Indent an extra space to account for extra digit in 'H5TRACE' macro + if (scalar(@arg_str) >= 10) { + $trace .= " "; + $len++; + } } else { - $trace .= ", $_"; - $len += 1 + length; + $trace .= ", "; + $len += 2; # Add 2, for ', ' } + + # Append argument + $trace .= "$_"; + $len += length; # Add length of appended argument name } + + # Append final ');' for macro $trace .= ");\n"; } goto error if grep {/!/} @arg_str; diff --git a/bin/warnhist b/bin/warnhist index a88474b..3b2cec6 100755 --- a/bin/warnhist +++ b/bin/warnhist @@ -15,7 +15,7 @@ use warnings; # 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. # -# Quincey Koziol, koziol@hdfgroup.org +# Quincey Koziol # 9 Aug 2013 # # Purpose: Given an input file containing the output from a build of the diff --git a/config/cmake/HDF5_Process_Flex_Files.cmake b/config/cmake/HDF5_Process_Flex_Files.cmake deleted file mode 100644 index 2595c39..0000000 --- a/config/cmake/HDF5_Process_Flex_Files.cmake +++ /dev/null @@ -1,95 +0,0 @@ -# -# 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 COPYING file, which can be found at the root of the source code -# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. -# -# post process flex/bison files - -message (STATUS "File: ${GEN_DIR} ${FILE_PARSE} ${FILE_ANALYZE}") - -if (FILE_PARSE) - # fix H5LTparse.c to declare H5LTyyparse return type as an hid_t - # instead of int. Currently the generated function H5LTyyparse is - # generated with a return value of type int, which is a mapping to the - # flex yyparse function. The return value in the HL library should be - # an hid_t. - # I propose to not use flex to generate this function, but for now I am - # adding a perl command to find and replace this function declaration in - # H5LTparse.c. - file (READ ${GEN_DIR}/${FILE_PARSE}.c TEST_STREAM) - string (REGEX REPLACE "int yyparse" "hid_t yyparse" TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE "int\nyyparse" "hid_t\nyyparse" TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE "int H5LTyyparse" "hid_t H5LTyyparse" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${FILE_PARSE}.c "${TEST_STREAM}") - message (STATUS "replacing signature in H5LTparse.c") - - # Add code that disables warnings in the flex/bison-generated code. - # - # Note that the GCC pragmas did not exist until gcc 4.2. Earlier versions - # will simply ignore them, but we want to avoid those warnings. - file (READ ${FILE_PARSE}.c TEST_STREAM) - file (WRITE ${FILE_PARSE}.c " -#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2\n -#pragma GCC diagnostic ignored \"-Wconversion\"\n -#pragma GCC diagnostic ignored \"-Wimplicit-function-declaration\"\n -#pragma GCC diagnostic ignored \"-Wlarger-than=\"\n -#pragma GCC diagnostic ignored \"-Wmissing-prototypes\"\n -#pragma GCC diagnostic ignored \"-Wnested-externs\"\n -#pragma GCC diagnostic ignored \"-Wold-style-definition\"\n -#pragma GCC diagnostic ignored \"-Wsign-compare\"\n -#pragma GCC diagnostic ignored \"-Wsign-conversion\"\n -#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"\n -#pragma GCC diagnostic ignored \"-Wswitch-default\"\n -#pragma GCC diagnostic ignored \"-Wunused-function\"\n -#pragma GCC diagnostic ignored \"-Wunused-macros\"\n -#pragma GCC diagnostic ignored \"-Wunused-parameter\"\n -#pragma GCC diagnostic ignored \"-Wredundant-decls\"\n -#elif defined __SUNPRO_CC\n -#pragma disable_warn\n -#elif defined _MSC_VER\n -#pragma warning(push, 1)\n -#endif\n - ") - file (APPEND ${FILE_PARSE}.c "${TEST_STREAM}") - message (STATUS "processed pragma in ${FILE_PARSE}") - file (READ ${GEN_DIR}/${FILE_PARSE}.h TEST_STREAM) - file (WRITE ${FILE_PARSE}.h "${TEST_STREAM}") -endif () - -if (FILE_ANALYZE) - # Add code that disables warnings in the flex/bison-generated code. - # - # Note that the GCC pragmas did not exist until gcc 4.2. Earlier versions - # will simply ignore them, but we want to avoid those warnings. - file (READ ${GEN_DIR}/${FILE_ANALYZE} TEST_STREAM) - file (WRITE ${FILE_ANALYZE} " -#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2\n -#pragma GCC diagnostic ignored \"-Wconversion\"\n -#pragma GCC diagnostic ignored \"-Wimplicit-function-declaration\"\n -#pragma GCC diagnostic ignored \"-Wlarger-than=\"\n -#pragma GCC diagnostic ignored \"-Wmissing-prototypes\"\n -#pragma GCC diagnostic ignored \"-Wnested-externs\"\n -#pragma GCC diagnostic ignored \"-Wold-style-definition\"\n -#pragma GCC diagnostic ignored \"-Wsign-compare\"\n -#pragma GCC diagnostic ignored \"-Wsign-conversion\"\n -#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"\n -#pragma GCC diagnostic ignored \"-Wswitch-default\"\n -#pragma GCC diagnostic ignored \"-Wunused-function\"\n -#pragma GCC diagnostic ignored \"-Wunused-macros\"\n -#pragma GCC diagnostic ignored \"-Wunused-parameter\"\n -#pragma GCC diagnostic ignored \"-Wredundant-decls\"\n -#elif defined __SUNPRO_CC\n -#pragma disable_warn\n -#elif defined _MSC_VER\n -#pragma warning(push, 1)\n -#endif\n - ") - file (APPEND ${FILE_ANALYZE} "${TEST_STREAM}") - message (STATUS "processed pragma in ${FILE_ANALYZE}") -endif () diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index 13b6ce7..4adf3d3 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -1,56 +1,62 @@ -#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ -#pragma GCC diagnostic ignored "-Wconversion" -#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" -#pragma GCC diagnostic ignored "-Wlarger-than=" -#pragma GCC diagnostic ignored "-Wmissing-prototypes" -#pragma GCC diagnostic ignored "-Wnested-externs" -#pragma GCC diagnostic ignored "-Wold-style-definition" -#pragma GCC diagnostic ignored "-Wredundant-decls" -#pragma GCC diagnostic ignored "-Wsign-compare" -#pragma GCC diagnostic ignored "-Wsign-conversion" -#pragma GCC diagnostic ignored "-Wstrict-overflow" -#pragma GCC diagnostic ignored "-Wstrict-prototypes" -#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" -#pragma GCC diagnostic ignored "-Wswitch-default" -#pragma GCC diagnostic ignored "-Wunused-function" -#pragma GCC diagnostic ignored "-Wunused-macros" -#pragma GCC diagnostic ignored "-Wunused-parameter" -#elif defined __SUNPRO_CC -#pragma disable_warn -#elif defined _MSC_VER -#pragma warning(push, 1) -#endif +#if defined (__GNUC__) +#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" +#pragma GCC diagnostic ignored "-Wlarger-than=" +#pragma GCC diagnostic ignored "-Wmissing-prototypes" +#pragma GCC diagnostic ignored "-Wnested-externs" +#pragma GCC diagnostic ignored "-Wold-style-definition" +#pragma GCC diagnostic ignored "-Wredundant-decls" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wstrict-overflow" +#pragma GCC diagnostic ignored "-Wstrict-prototypes" +#pragma GCC diagnostic ignored "-Wsuggest-attribute=const" +#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" +#pragma GCC diagnostic ignored "-Wswitch-default" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-macros" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif +#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 600 +#pragma GCC diagnostic ignored "-Wnull-dereference" +#endif +#elif defined __SUNPRO_CC +#pragma disable_warn +#elif defined _MSC_VER +#pragma warning(push, 1) +#endif #line 2 "hl/src/H5LTanalyze.c" #line 4 "hl/src/H5LTanalyze.c" -#define YY_INT_ALIGNED short int +#define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ -#define yy_create_buffer H5LTyy_create_buffer -#define yy_delete_buffer H5LTyy_delete_buffer -#define yy_flex_debug H5LTyy_flex_debug -#define yy_init_buffer H5LTyy_init_buffer -#define yy_flush_buffer H5LTyy_flush_buffer +#define yy_create_buffer H5LTyy_create_buffer +#define yy_delete_buffer H5LTyy_delete_buffer +#define yy_flex_debug H5LTyy_flex_debug +#define yy_init_buffer H5LTyy_init_buffer +#define yy_flush_buffer H5LTyy_flush_buffer #define yy_load_buffer_state H5LTyy_load_buffer_state -#define yy_switch_to_buffer H5LTyy_switch_to_buffer -#define yyin H5LTyyin -#define yyleng H5LTyyleng -#define yylex H5LTyylex -#define yylineno H5LTyylineno -#define yyout H5LTyyout -#define yyrestart H5LTyyrestart -#define yytext H5LTyytext -#define yywrap H5LTyywrap -#define yyalloc H5LTyyalloc -#define yyrealloc H5LTyyrealloc -#define yyfree H5LTyyfree +#define yy_switch_to_buffer H5LTyy_switch_to_buffer +#define yyin H5LTyyin +#define yyleng H5LTyyleng +#define yylex H5LTyylex +#define yylineno H5LTyylineno +#define yyout H5LTyyout +#define yyrestart H5LTyyrestart +#define yytext H5LTyytext +#define yywrap H5LTyywrap +#define yyalloc H5LTyyalloc +#define yyrealloc H5LTyyrealloc +#define yyfree H5LTyyfree #define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 37 +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -72,61 +78,61 @@ /* C99 systems have . Non-C99 systems may or may not. */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. + * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; +typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; +typedef uint64_t flex_uint64_t; #else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN -#define INT8_MIN (-128) +#define INT8_MIN (-128) #endif #ifndef INT16_MIN -#define INT16_MIN (-32767 - 1) +#define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN -#define INT32_MIN (-2147483647 - 1) +#define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX -#define INT8_MAX (127) +#define INT8_MAX (127) #endif #ifndef INT16_MAX -#define INT16_MAX (32767) +#define INT16_MAX (32767) #endif #ifndef INT32_MAX -#define INT32_MAX (2147483647) +#define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX -#define UINT8_MAX (255U) +#define UINT8_MAX (255U) #endif #ifndef UINT16_MAX -#define UINT16_MAX (65535U) +#define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) +#define UINT32_MAX (4294967295U) #endif -#endif /* ! C99 */ - #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -134,15 +140,15 @@ typedef unsigned int flex_uint32_t; /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST -#else /* ! __cplusplus */ +#else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ -#if defined(__STDC__) +#if defined (__STDC__) #define YY_USE_CONST -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const @@ -158,7 +164,7 @@ typedef unsigned int flex_uint32_t; * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ -#define YY_SC_TO_UI(c) ((unsigned int)(unsigned char)c) +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less @@ -170,14 +176,14 @@ typedef unsigned int flex_uint32_t; * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START (((yy_start)-1) / 2) -#define YYSTATE YY_START +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE H5LTyyrestart(H5LTyyin) +#define YY_NEW_FILE H5LTyyrestart(H5LTyyin ) #define YY_END_OF_BUFFER_CHAR 0 @@ -188,7 +194,7 @@ typedef unsigned int flex_uint32_t; /* The state buf must be large enough to hold one state per character in the main buffer. */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE @@ -205,91 +211,96 @@ extern yy_size_t H5LTyyleng; extern FILE *H5LTyyin, *H5LTyyout; #define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -#define YY_LESS_LINENO(n) +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + #define YY_LESS_LINENO(n) + /* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do { \ - /* Undo effects of setting up H5LTyytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg); \ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up H5LTyytext again */ \ - } while (0) - -#define unput(c) yyunput(c, (yytext_ptr)) +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up H5LTyytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up H5LTyytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; + int yy_buffer_status; -#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via H5LTyyrestart()), so that the user can continue scanning by - * just pointing H5LTyyin at a new input file. - */ + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via H5LTyyrestart()), so that the user can continue scanning by + * just pointing H5LTyyin at a new input file. + */ #define YY_BUFFER_EOF_PENDING 2 -}; + + }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE *yy_buffer_stack = 0; /**< Stack as an array. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -297,7 +308,9 @@ static YY_BUFFER_STATE *yy_buffer_stack = 0; /**< Stack as an array. */ * * Returns the top of the stack, or NULL. */ -#define YY_CURRENT_BUFFER ((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL) +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. @@ -305,61 +318,63 @@ static YY_BUFFER_STATE *yy_buffer_stack = 0; /**< Stack as an array. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when H5LTyytext is formed. */ -static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t H5LTyyleng; +static char yy_hold_char; +static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ +yy_size_t H5LTyyleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *)0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ /* Flag which is used to allow H5LTyywrap()'s to do buffer switches * instead of setting up a fresh H5LTyyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void H5LTyyrestart(FILE *input_file); -void H5LTyy_switch_to_buffer(YY_BUFFER_STATE new_buffer); -YY_BUFFER_STATE H5LTyy_create_buffer(FILE *file, int size); -void H5LTyy_delete_buffer(YY_BUFFER_STATE b); -void H5LTyy_flush_buffer(YY_BUFFER_STATE b); -void H5LTyypush_buffer_state(YY_BUFFER_STATE new_buffer); -void H5LTyypop_buffer_state(void); +void H5LTyyrestart (FILE *input_file ); +void H5LTyy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE H5LTyy_create_buffer (FILE *file,int size ); +void H5LTyy_delete_buffer (YY_BUFFER_STATE b ); +void H5LTyy_flush_buffer (YY_BUFFER_STATE b ); +void H5LTyypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void H5LTyypop_buffer_state (void ); -static void H5LTyyensure_buffer_stack(void); -static void H5LTyy_load_buffer_state(void); -static void H5LTyy_init_buffer(YY_BUFFER_STATE b, FILE *file); +static void H5LTyyensure_buffer_stack (void ); +static void H5LTyy_load_buffer_state (void ); +static void H5LTyy_init_buffer (YY_BUFFER_STATE b,FILE *file ); -#define YY_FLUSH_BUFFER H5LTyy_flush_buffer(YY_CURRENT_BUFFER) +#define YY_FLUSH_BUFFER H5LTyy_flush_buffer(YY_CURRENT_BUFFER ) -YY_BUFFER_STATE H5LTyy_scan_buffer(char *base, yy_size_t size); -YY_BUFFER_STATE H5LTyy_scan_string(yyconst char *yy_str); -YY_BUFFER_STATE H5LTyy_scan_bytes(yyconst char *bytes, yy_size_t len); +YY_BUFFER_STATE H5LTyy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE H5LTyy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE H5LTyy_scan_bytes (yyconst char *bytes,yy_size_t len ); -void *H5LTyyalloc(yy_size_t); -void *H5LTyyrealloc(void *, yy_size_t); -void H5LTyyfree(void *); +void *H5LTyyalloc (yy_size_t ); +void *H5LTyyrealloc (void *,yy_size_t ); +void H5LTyyfree (void * ); #define yy_new_buffer H5LTyy_create_buffer -#define yy_set_interactive(is_interactive) \ - { \ - if (!YY_CURRENT_BUFFER) { \ - H5LTyyensure_buffer_stack(); \ - YY_CURRENT_BUFFER_LVALUE = H5LTyy_create_buffer(H5LTyyin, YY_BUF_SIZE); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if (!YY_CURRENT_BUFFER) { \ - H5LTyyensure_buffer_stack(); \ - YY_CURRENT_BUFFER_LVALUE = H5LTyy_create_buffer(H5LTyyin, YY_BUF_SIZE); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + H5LTyyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + H5LTyyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) @@ -367,7 +382,7 @@ void H5LTyyfree(void *); typedef unsigned char YY_CHAR; -FILE *H5LTyyin = (FILE *)0, *H5LTyyout = (FILE *)0; +FILE *H5LTyyin = (FILE *) 0, *H5LTyyout = (FILE *) 0; typedef int yy_state_type; @@ -378,273 +393,482 @@ int H5LTyylineno = 1; extern char *H5LTyytext; #define yytext_ptr H5LTyytext -static yy_state_type yy_get_previous_state(void); -static yy_state_type yy_try_NUL_trans(yy_state_type current_state); -static int yy_get_next_buffer(void); -static void yy_fatal_error(yyconst char msg[]); +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up H5LTyytext. */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - H5LTyyleng = (size_t)(yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 66 +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + H5LTyyleng = (yy_size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 66 #define YY_END_OF_BUFFER 67 /* This struct is not used in this scanner, but its presence is necessary. */ -struct yy_trans_info { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; -}; -static yyconst flex_int16_t yy_acclist[437] = { - 0, 64, 64, 64, 64, 67, 66, 64, 66, 64, 65, 66, 56, 66, 55, 66, 62, 66, 63, 66, 66, 66, 66, 66, 60, 66, - 61, 66, 58, 66, 59, 66, 57, 66, 57, 64, 66, 57, 64, 65, 66, 55, 57, 66, 57, 62, 66, 57, 63, 66, 57, 66, - 57, 66, 57, 66, 57, 66, 57, 60, 66, 57, 61, 66, 57, 58, 66, 57, 59, 66, 64, 55, 57, 57, 64, 55, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 38, 38, 57, 57, 57, 57, 57, 57, 39, 39, 57, 57, 57, 57, - - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 37, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 37, - 57, 57, 54, 36, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 54, 57, 36, 57, 45, 49, 51, 53, - 57, 57, 57, 45, 57, 49, 57, 57, 57, 57, 57, 57, 57, 57, 57, 51, 57, 53, 57, 50, 50, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 52, 35, 57, 57, 57, 57, 57, 57, 52, 57, 57, 57, 57, 57, - - 57, 57, 57, 57, 35, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 48, 1, 2, 9, 10, 47, 48, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 1, 57, 2, 57, 57, 57, 57, 57, 57, 57, 9, 57, 10, 57, 57, 57, 47, 57, 44, 3, 4, 5, 6, - 7, 8, 11, 12, 13, 14, 15, 16, 57, 44, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - - 57, 57, 57, 57, 57, 57, 57, 3, 57, 4, 57, 5, 57, 6, 57, 7, 57, 8, 57, 11, 57, 12, 57, 13, 57, 14, - 57, 15, 57, 16, 57, 57, 57, 57, 43, 46, 28, 29, 30, 31, 22, 43, 57, 46, 57, 28, 57, 29, 57, 30, 57, 31, - 57, 57, 57, 57, 22, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 17, 24, 23, 41, 17, 57, 57, - 57, 57, 57, 24, 57, 57, 57, 57, 23, 57, 57, 57, 57, 41, 57, 57, 57, 32, 26, 18, 20, 19, - - 25, 40, 42, 57, 32, 57, 57, 26, 57, 18, 57, 20, 57, 19, 57, 57, 25, 57, 57, 40, 57, 42, 57, 33, 27, 21, - 33, 57, 57, 27, 57, 21, 57, 34, 34, 57}; - -static yyconst flex_int16_t yy_accept[546] = { - 0, 1, 2, 3, 4, 5, 6, 7, 9, 12, 14, 16, 18, 20, 21, 22, 23, 24, 26, 28, 30, - 32, 34, 37, 41, 44, 47, 50, 52, 54, 56, 58, 61, 64, 67, 70, 71, 72, 72, 72, 72, 72, - 72, 73, 75, 77, 78, 79, 80, 81, 82, 82, 82, 82, 82, 82, 83, 84, 85, 86, 87, 88, 88, - 88, 88, 88, 88, 90, 91, 92, 93, 94, 95, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, - 96, 96, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 112, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, - 129, 129, 129, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 147, - 149, 149, 149, 149, 150, 151, 151, 151, 151, 151, 151, 151, 151, 151, 152, 153, 154, 155, 156, 158, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 170, 172, 173, 173, 173, 173, 173, 173, - - 173, 173, 173, 173, 173, 173, 173, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 187, - 187, 187, 187, 187, 187, 188, 188, 188, 188, 188, 188, 188, 188, 188, 189, 189, 189, 189, 190, 191, 192, - 193, 194, 195, 197, 198, 199, 200, 201, 202, 203, 204, 205, 207, 208, 209, 210, 210, 210, 210, 210, 210, - 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 231, - - 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 232, 233, 233, 233, - 233, 233, 233, 233, 234, 235, 235, 235, 236, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 258, 260, 261, 262, 263, 264, 265, 266, 268, 270, 271, 272, 274, 274, - 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 287, 287, 287, 288, 290, 291, - - 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 310, 312, 314, 316, - 318, 320, 322, 324, 326, 328, 330, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 341, 341, 341, 342, - 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, 344, 346, 348, 350, 352, 354, 355, 356, - 357, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 373, 373, 373, 373, 374, - 374, 374, 374, 375, 375, 375, 375, 376, 376, 376, 378, 379, 380, 381, 382, 384, - - 385, 386, 387, 389, 390, 391, 392, 394, 395, 396, 396, 397, 397, 398, 399, 400, 401, 401, 402, 402, 403, - 404, 405, 407, 408, 410, 412, 414, 416, 417, 419, 420, 422, 424, 425, 425, 426, 427, 429, 430, 432, 434, - 435, 437, 437}; - -static yyconst flex_int32_t yy_ec[256] = { - 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 2, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 6, 7, 8, - 9, 10, 11, 5, 12, 5, 13, 14, 1, 1, 1, 1, 1, 15, 16, 17, 18, 19, 20, 21, 22, 23, 1, 1, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 1, 1, 35, 36, 37, 1, 38, 1, 39, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 40, 1, 41, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1}; - -static yyconst flex_int32_t yy_meta[42] = {0, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; - -static yyconst flex_int16_t yy_base[547] = { - 0, 0, 0, 41, 0, 610, 611, 81, 83, 611, 0, 611, 611, 56, 599, 580, 575, 611, 611, 611, 611, - 0, 87, 89, 88, 0, 0, 70, 596, 577, 572, 0, 0, 0, 0, 101, 0, 584, 567, 569, 571, 569, - 0, 103, 0, 579, 562, 564, 566, 564, 561, 564, 552, 551, 79, 557, 560, 548, 547, 80, 611, 566, 97, - 87, 569, 560, 0, 563, 117, 90, 566, 557, 611, 549, 99, 552, 550, 557, 560, 546, 541, 118, 549, 556, - 552, 533, 0, 538, 108, 541, 539, 546, 549, 535, 530, 126, 538, 545, 541, 522, 527, - - 531, 536, 523, 520, 522, 532, 518, 534, 95, 518, 528, 510, 524, 611, 525, 513, 517, 522, 509, 506, 508, - 518, 504, 520, 97, 504, 514, 496, 510, 0, 511, 514, 500, 495, 520, 500, 492, 504, 499, 492, 481, 106, - 496, 492, 498, 611, 611, 501, 487, 482, 507, 487, 479, 491, 486, 479, 468, 123, 483, 479, 485, 0, 0, - 468, 475, 462, 611, 611, 470, 460, 464, 464, 126, 470, 126, 480, 611, 611, 459, 466, 453, 0, 0, 461, - 451, 455, 455, 130, 461, 129, 471, 0, 0, 611, 452, 139, 469, 463, 463, 462, - - 158, 165, 459, 446, 450, 461, 0, 443, 141, 460, 454, 454, 453, 172, 179, 450, 437, 441, 452, 441, 435, - 433, 438, 150, 424, 611, 451, 454, 451, 151, 448, 451, 448, 165, 611, 432, 440, 430, 427, 421, 419, 424, - 157, 410, 0, 437, 440, 437, 170, 434, 437, 434, 172, 0, 418, 426, 416, 421, 421, 417, 397, 428, 425, - 180, 177, 183, 186, 414, 413, 190, 192, 193, 412, 411, 405, 411, 408, 408, 408, 404, 384, 415, 412, 201, - 196, 199, 206, 401, 400, 211, 212, 213, 399, 398, 392, 398, 395, 611, 390, 400, - - 380, 215, 217, 388, 382, 384, 381, 220, 223, 225, 387, 386, 385, 384, 383, 382, 611, 611, 381, 380, 379, - 378, 377, 376, 611, 611, 218, 375, 611, 0, 370, 380, 360, 227, 236, 368, 362, 364, 361, 235, 241, 244, - 367, 366, 365, 364, 363, 362, 0, 0, 361, 360, 359, 358, 357, 356, 0, 0, 237, 355, 0, 350, 611, - 366, 352, 351, 350, 349, 352, 333, 338, 332, 336, 335, 335, 338, 332, 336, 331, 155, 334, 611, 611, 611, - 611, 611, 611, 611, 611, 611, 611, 611, 611, 340, 335, 325, 329, 0, 345, 331, - - 330, 329, 328, 331, 312, 317, 311, 315, 314, 314, 317, 311, 315, 310, 168, 313, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 319, 314, 304, 611, 611, 611, 611, 611, 611, 301, 314, 314, 611, 295, - 301, 305, 310, 294, 308, 290, 294, 294, 292, 300, 287, 301, 0, 0, 0, 0, 0, 0, 285, 298, 298, - 0, 279, 285, 289, 294, 278, 292, 274, 278, 278, 276, 284, 271, 285, 611, 275, 266, 281, 275, 611, 265, - 262, 263, 611, 266, 270, 260, 611, 264, 270, 0, 263, 254, 269, 263, 0, 253, - - 250, 251, 0, 254, 258, 247, 0, 249, 255, 253, 611, 247, 611, 611, 611, 611, 249, 611, 234, 611, 611, - 245, 0, 233, 0, 0, 0, 0, 234, 0, 222, 0, 0, 611, 207, 611, 611, 0, 186, 0, 0, 611, - 0, 611, 106, 275}; - -static yyconst flex_int16_t yy_def[547] = { - 0, 544, 1, 544, 3, 544, 544, 544, 544, 544, 545, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 545, 544, 544, 544, 544, 544, - 546, 546, 24, 546, 546, 546, 546, 546, 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, 544, 544, 544, - 544, 544, 544, 546, 546, 546, 546, 546, 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, - - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, 544, 544, 544, 544, - - 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, - - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, - - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, 546, 546, 546, 546, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, 546, 546, - - 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, 544, 546, 546, 546, 546, 544, - 546, 0, 544, 544}; - -static yyconst flex_int16_t yy_nxt[653] = { - 0, 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 12, 6, 6, 13, 6, 6, 6, - 6, 14, 6, 6, 6, 6, 15, 6, 6, 6, 16, 6, 6, 6, 6, 6, 17, 18, 6, 19, 20, - 21, 22, 23, 9, 24, 24, 24, 24, 24, 24, 24, 24, 25, 26, 21, 21, 27, 21, 21, 21, 21, - 28, 21, 21, 21, 21, 29, 21, 21, 21, 30, 21, 21, 21, 21, 21, 31, 32, 21, 33, 34, 35, - 35, 35, 35, 37, 38, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 44, 44, - - 45, 46, 35, 35, 43, 43, 64, 70, 36, 65, 71, 73, 141, 74, 157, 75, 76, 82, 83, 77, 96, - 97, 78, 79, 142, 101, 158, 80, 174, 102, 81, 87, 110, 88, 117, 89, 90, 103, 118, 91, 126, 111, - 92, 93, 175, 189, 119, 94, 201, 127, 95, 204, 214, 221, 217, 240, 205, 262, 202, 218, 263, 190, 215, - 227, 282, 228, 268, 283, 229, 230, 231, 222, 232, 241, 269, 233, 234, 246, 449, 247, 273, 450, 248, 249, - 250, 288, 251, 293, 274, 252, 253, 472, 311, 289, 473, 294, 304, 305, 313, 306, - - 312, 315, 307, 308, 543, 319, 314, 321, 323, 316, 309, 343, 310, 320, 345, 322, 324, 336, 337, 344, 338, - 347, 346, 339, 340, 542, 351, 353, 355, 348, 365, 341, 367, 342, 352, 354, 356, 373, 366, 376, 368, 378, - 400, 374, 377, 394, 375, 379, 380, 395, 401, 402, 408, 541, 540, 381, 539, 411, 409, 403, 413, 410, 412, - 538, 429, 537, 414, 415, 430, 536, 535, 534, 533, 532, 416, 42, 531, 42, 530, 529, 528, 527, 526, 525, - 524, 523, 522, 521, 520, 519, 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, - - 508, 507, 506, 505, 504, 503, 502, 501, 500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488, - 487, 486, 485, 484, 483, 482, 481, 480, 479, 478, 477, 476, 475, 474, 471, 470, 469, 468, 467, 466, 465, - 464, 463, 462, 461, 460, 459, 458, 457, 456, 455, 454, 453, 452, 451, 448, 447, 446, 445, 444, 443, 442, - 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, 431, 428, 427, 426, 425, 424, 423, 422, 421, 420, 419, - 418, 417, 407, 406, 405, 404, 399, 398, 397, 396, 393, 392, 391, 390, 389, 388, - - 387, 386, 385, 384, 383, 382, 372, 371, 370, 369, 364, 363, 362, 361, 360, 359, 358, 357, 350, 349, 335, - 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 318, 317, 303, 302, 301, 300, 299, 298, 297, 296, 295, - 292, 291, 290, 287, 286, 285, 284, 281, 280, 279, 278, 277, 276, 275, 272, 271, 270, 267, 266, 265, 264, - 261, 260, 259, 258, 257, 256, 255, 254, 245, 244, 243, 242, 239, 238, 237, 236, 235, 226, 225, 224, 223, - 220, 219, 216, 213, 212, 211, 210, 209, 208, 207, 206, 203, 200, 199, 198, 197, - - 196, 195, 194, 193, 192, 191, 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, 173, 172, - 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 156, 155, 154, 153, 152, 151, 150, 149, - 148, 147, 146, 145, 144, 143, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 125, 124, - 123, 122, 121, 120, 116, 115, 114, 113, 112, 109, 108, 107, 106, 105, 104, 100, 99, 98, 86, 85, 84, - 72, 69, 68, 67, 66, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, - - 52, 51, 50, 49, 48, 47, 41, 40, 39, 544, 5, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544}; - -static yyconst flex_int16_t yy_chk[653] = { - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, - 7, 8, 8, 13, 13, 22, 22, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, - - 27, 27, 35, 35, 43, 43, 54, 59, 545, 54, 59, 62, 109, 62, 125, 62, 62, 63, 63, 62, 69, - 69, 62, 62, 109, 74, 125, 62, 142, 74, 62, 68, 81, 68, 88, 68, 68, 74, 88, 68, 95, 81, - 68, 68, 142, 158, 88, 68, 173, 95, 68, 175, 188, 196, 190, 209, 175, 224, 173, 190, 224, 158, 188, - 201, 243, 201, 230, 243, 201, 201, 202, 196, 202, 209, 230, 202, 202, 214, 380, 214, 234, 380, 214, 214, - 215, 249, 215, 253, 234, 215, 215, 415, 265, 249, 415, 253, 264, 264, 266, 264, - - 265, 267, 264, 264, 539, 270, 266, 271, 272, 267, 264, 285, 264, 270, 286, 271, 272, 284, 284, 285, 284, - 287, 286, 284, 284, 535, 290, 291, 292, 287, 302, 284, 303, 284, 290, 291, 292, 308, 302, 309, 303, 310, - 334, 308, 309, 327, 308, 310, 310, 327, 334, 335, 340, 531, 529, 310, 524, 341, 340, 335, 342, 340, 341, - 522, 359, 519, 342, 342, 359, 517, 512, 510, 509, 508, 342, 546, 506, 546, 505, 504, 502, 501, 500, 498, - 497, 496, 495, 493, 492, 490, 489, 488, 486, 485, 484, 482, 481, 480, 479, 477, - - 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, 466, 465, 463, 462, 461, 454, 453, 452, 451, 450, 449, - 448, 447, 446, 445, 444, 443, 442, 440, 439, 438, 431, 430, 429, 416, 414, 413, 412, 411, 410, 409, 408, - 407, 406, 405, 404, 403, 402, 401, 400, 399, 397, 396, 395, 394, 381, 379, 378, 377, 376, 375, 374, 373, - 372, 371, 370, 369, 368, 367, 366, 365, 364, 362, 360, 356, 355, 354, 353, 352, 351, 348, 347, 346, 345, - 344, 343, 339, 338, 337, 336, 333, 332, 331, 328, 324, 323, 322, 321, 320, 319, - - 316, 315, 314, 313, 312, 311, 307, 306, 305, 304, 301, 300, 299, 297, 296, 295, 294, 293, 289, 288, 283, - 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 269, 268, 263, 262, 261, 260, 259, 258, 257, 256, 255, - 252, 251, 250, 248, 247, 246, 244, 242, 241, 240, 239, 238, 237, 236, 233, 232, 231, 229, 228, 227, 225, - 223, 222, 221, 220, 219, 218, 217, 216, 213, 212, 211, 210, 208, 206, 205, 204, 203, 200, 199, 198, 197, - 195, 191, 189, 187, 186, 185, 184, 181, 180, 179, 176, 174, 172, 171, 170, 169, - - 166, 165, 164, 161, 160, 159, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 145, 144, 143, 141, 140, - 139, 138, 137, 136, 135, 134, 133, 132, 131, 129, 128, 127, 126, 124, 123, 122, 121, 120, 119, 118, 117, - 116, 115, 113, 112, 111, 110, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 94, 93, - 92, 91, 90, 89, 87, 85, 84, 83, 82, 80, 79, 78, 77, 76, 75, 73, 71, 70, 67, 65, 64, - 61, 58, 57, 56, 55, 53, 52, 51, 50, 49, 48, 47, 46, 45, 41, 40, - - 39, 38, 37, 30, 29, 28, 16, 15, 14, 5, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, - 544, 544, 544, 544, 544, 544, 544, 544, 544, 544}; +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_acclist[437] = + { 0, + 64, 64, 64, 64, 67, 66, 64, 66, 64, 65, + 66, 56, 66, 55, 66, 62, 66, 63, 66, 66, + 66, 66, 66, 60, 66, 61, 66, 58, 66, 59, + 66, 57, 66, 57, 64, 66, 57, 64, 65, 66, + 55, 57, 66, 57, 62, 66, 57, 63, 66, 57, + 66, 57, 66, 57, 66, 57, 66, 57, 60, 66, + 57, 61, 66, 57, 58, 66, 57, 59, 66, 64, + 55, 57, 57, 64, 55, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 38, 38, 57, 57, + 57, 57, 57, 57, 39, 39, 57, 57, 57, 57, + + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 37, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 37, 57, 57, 54, 36, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 54, 57, 36, 57, 45, 49, + 51, 53, 57, 57, 57, 45, 57, 49, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 51, 57, 53, + 57, 50, 50, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 52, 35, 57, 57, + 57, 57, 57, 57, 52, 57, 57, 57, 57, 57, + + 57, 57, 57, 57, 35, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 48, + 1, 2, 9, 10, 47, 48, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 1, 57, 2, 57, 57, + 57, 57, 57, 57, 57, 9, 57, 10, 57, 57, + 57, 47, 57, 44, 3, 4, 5, 6, 7, 8, + 11, 12, 13, 14, 15, 16, 57, 44, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + + 57, 57, 57, 57, 57, 57, 57, 3, 57, 4, + 57, 5, 57, 6, 57, 7, 57, 8, 57, 11, + 57, 12, 57, 13, 57, 14, 57, 15, 57, 16, + 57, 57, 57, 57, 43, 46, 28, 29, 30, 31, + 22, 43, 57, 46, 57, 28, 57, 29, 57, 30, + 57, 31, 57, 57, 57, 57, 22, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 17, 24, 23, 41, 17, 57, 57, 57, 57, + 57, 24, 57, 57, 57, 57, 23, 57, 57, 57, + 57, 41, 57, 57, 57, 32, 26, 18, 20, 19, + + 25, 40, 42, 57, 32, 57, 57, 26, 57, 18, + 57, 20, 57, 19, 57, 57, 25, 57, 57, 40, + 57, 42, 57, 33, 27, 21, 33, 57, 57, 27, + 57, 21, 57, 34, 34, 57 + } ; + +static yyconst flex_int16_t yy_accept[546] = + { 0, + 1, 2, 3, 4, 5, 6, 7, 9, 12, 14, + 16, 18, 20, 21, 22, 23, 24, 26, 28, 30, + 32, 34, 37, 41, 44, 47, 50, 52, 54, 56, + 58, 61, 64, 67, 70, 71, 72, 72, 72, 72, + 72, 72, 73, 75, 77, 78, 79, 80, 81, 82, + 82, 82, 82, 82, 82, 83, 84, 85, 86, 87, + 88, 88, 88, 88, 88, 88, 90, 91, 92, 93, + 94, 95, 96, 96, 96, 96, 96, 96, 96, 96, + 96, 96, 96, 96, 96, 96, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 112, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 129, 129, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 147, 149, 149, 149, 149, 150, 151, 151, + 151, 151, 151, 151, 151, 151, 151, 152, 153, 154, + 155, 156, 158, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 170, 172, 173, 173, 173, 173, 173, 173, + + 173, 173, 173, 173, 173, 173, 173, 175, 176, 177, + 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, + 187, 187, 187, 187, 187, 187, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 189, 189, 189, 189, 190, + 191, 192, 193, 194, 195, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 207, 208, 209, 210, 210, 210, + 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, + 210, 210, 210, 210, 210, 210, 210, 210, 211, 212, + 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, + 223, 224, 225, 226, 227, 228, 229, 230, 231, 231, + + 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231, 231, 231, 231, 231, 231, 232, 233, 233, + 233, 233, 233, 233, 233, 234, 235, 235, 235, 236, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 258, + 260, 261, 262, 263, 264, 265, 266, 268, 270, 271, + 272, 274, 274, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 287, 287, 287, 288, 290, 291, + + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, 308, 310, 312, 314, + 316, 318, 320, 322, 324, 326, 328, 330, 332, 333, + 334, 335, 336, 337, 338, 339, 340, 341, 341, 341, + 341, 342, 342, 342, 342, 342, 342, 342, 342, 342, + 342, 342, 342, 342, 342, 344, 346, 348, 350, 352, + 354, 355, 356, 357, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 370, 371, 372, 373, 373, + 373, 373, 373, 374, 374, 374, 374, 375, 375, 375, + 375, 376, 376, 376, 378, 379, 380, 381, 382, 384, + + 385, 386, 387, 389, 390, 391, 392, 394, 395, 396, + 396, 397, 397, 398, 399, 400, 401, 401, 402, 402, + 403, 404, 405, 407, 408, 410, 412, 414, 416, 417, + 419, 420, 422, 424, 425, 425, 426, 427, 429, 430, + 432, 434, 435, 437, 437 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 4, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 5, 6, 7, + 8, 9, 10, 11, 5, 12, 5, 13, 14, 1, + 1, 1, 1, 1, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 1, 1, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 1, 1, 35, 36, + 37, 1, 38, 1, 39, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 40, 1, 41, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[42] = + { 0, + 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, + 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1 + } ; + +static yyconst flex_int16_t yy_base[547] = + { 0, + 0, 0, 41, 0, 610, 611, 81, 83, 611, 0, + 611, 611, 56, 599, 580, 575, 611, 611, 611, 611, + 0, 87, 89, 88, 0, 0, 70, 596, 577, 572, + 0, 0, 0, 0, 101, 0, 584, 567, 569, 571, + 569, 0, 103, 0, 579, 562, 564, 566, 564, 561, + 564, 552, 551, 79, 557, 560, 548, 547, 80, 611, + 566, 97, 87, 569, 560, 0, 563, 117, 90, 566, + 557, 611, 549, 99, 552, 550, 557, 560, 546, 541, + 118, 549, 556, 552, 533, 0, 538, 108, 541, 539, + 546, 549, 535, 530, 126, 538, 545, 541, 522, 527, + + 531, 536, 523, 520, 522, 532, 518, 534, 95, 518, + 528, 510, 524, 611, 525, 513, 517, 522, 509, 506, + 508, 518, 504, 520, 97, 504, 514, 496, 510, 0, + 511, 514, 500, 495, 520, 500, 492, 504, 499, 492, + 481, 106, 496, 492, 498, 611, 611, 501, 487, 482, + 507, 487, 479, 491, 486, 479, 468, 123, 483, 479, + 485, 0, 0, 468, 475, 462, 611, 611, 470, 460, + 464, 464, 126, 470, 126, 480, 611, 611, 459, 466, + 453, 0, 0, 461, 451, 455, 455, 130, 461, 129, + 471, 0, 0, 611, 452, 139, 469, 463, 463, 462, + + 158, 165, 459, 446, 450, 461, 0, 443, 141, 460, + 454, 454, 453, 172, 179, 450, 437, 441, 452, 441, + 435, 433, 438, 150, 424, 611, 451, 454, 451, 151, + 448, 451, 448, 165, 611, 432, 440, 430, 427, 421, + 419, 424, 157, 410, 0, 437, 440, 437, 170, 434, + 437, 434, 172, 0, 418, 426, 416, 421, 421, 417, + 397, 428, 425, 180, 177, 183, 186, 414, 413, 190, + 192, 193, 412, 411, 405, 411, 408, 408, 408, 404, + 384, 415, 412, 201, 196, 199, 206, 401, 400, 211, + 212, 213, 399, 398, 392, 398, 395, 611, 390, 400, + + 380, 215, 217, 388, 382, 384, 381, 220, 223, 225, + 387, 386, 385, 384, 383, 382, 611, 611, 381, 380, + 379, 378, 377, 376, 611, 611, 218, 375, 611, 0, + 370, 380, 360, 227, 236, 368, 362, 364, 361, 235, + 241, 244, 367, 366, 365, 364, 363, 362, 0, 0, + 361, 360, 359, 358, 357, 356, 0, 0, 237, 355, + 0, 350, 611, 366, 352, 351, 350, 349, 352, 333, + 338, 332, 336, 335, 335, 338, 332, 336, 331, 155, + 334, 611, 611, 611, 611, 611, 611, 611, 611, 611, + 611, 611, 611, 340, 335, 325, 329, 0, 345, 331, + + 330, 329, 328, 331, 312, 317, 311, 315, 314, 314, + 317, 311, 315, 310, 168, 313, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 319, 314, + 304, 611, 611, 611, 611, 611, 611, 301, 314, 314, + 611, 295, 301, 305, 310, 294, 308, 290, 294, 294, + 292, 300, 287, 301, 0, 0, 0, 0, 0, 0, + 285, 298, 298, 0, 279, 285, 289, 294, 278, 292, + 274, 278, 278, 276, 284, 271, 285, 611, 275, 266, + 281, 275, 611, 265, 262, 263, 611, 266, 270, 260, + 611, 264, 270, 0, 263, 254, 269, 263, 0, 253, + + 250, 251, 0, 254, 258, 247, 0, 249, 255, 253, + 611, 247, 611, 611, 611, 611, 249, 611, 234, 611, + 611, 245, 0, 233, 0, 0, 0, 0, 234, 0, + 222, 0, 0, 611, 207, 611, 611, 0, 186, 0, + 0, 611, 0, 611, 106, 275 + } ; + +static yyconst flex_int16_t yy_def[547] = + { 0, + 544, 1, 544, 3, 544, 544, 544, 544, 544, 545, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 544, 545, 544, 544, 544, 544, + 544, 546, 546, 24, 546, 546, 546, 546, 546, 544, + 544, 544, 544, 544, 546, 546, 546, 546, 546, 544, + 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, + 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, + + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 544, 544, 544, 544, 544, 544, 544, + + 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, + + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 546, 546, 546, 546, + + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 546, 546, 546, 546, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 546, 546, 546, 546, 546, 546, 546, + + 546, 546, 546, 546, 546, 546, 546, 546, 546, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 546, 546, 546, 546, 546, 546, 546, 546, 546, + 546, 546, 546, 544, 544, 544, 544, 546, 546, 546, + 546, 544, 546, 0, 544, 544 + } ; + +static yyconst flex_int16_t yy_nxt[653] = + { 0, + 6, 7, 8, 9, 10, 10, 10, 10, 10, 10, + 10, 10, 11, 12, 6, 6, 13, 6, 6, 6, + 6, 14, 6, 6, 6, 6, 15, 6, 6, 6, + 16, 6, 6, 6, 6, 6, 17, 18, 6, 19, + 20, 21, 22, 23, 9, 24, 24, 24, 24, 24, + 24, 24, 24, 25, 26, 21, 21, 27, 21, 21, + 21, 21, 28, 21, 21, 21, 21, 29, 21, 21, + 21, 30, 21, 21, 21, 21, 21, 31, 32, 21, + 33, 34, 35, 35, 35, 35, 37, 38, 43, 43, + 43, 43, 44, 44, 44, 44, 44, 44, 44, 44, + + 45, 46, 35, 35, 43, 43, 64, 70, 36, 65, + 71, 73, 141, 74, 157, 75, 76, 82, 83, 77, + 96, 97, 78, 79, 142, 101, 158, 80, 174, 102, + 81, 87, 110, 88, 117, 89, 90, 103, 118, 91, + 126, 111, 92, 93, 175, 189, 119, 94, 201, 127, + 95, 204, 214, 221, 217, 240, 205, 262, 202, 218, + 263, 190, 215, 227, 282, 228, 268, 283, 229, 230, + 231, 222, 232, 241, 269, 233, 234, 246, 449, 247, + 273, 450, 248, 249, 250, 288, 251, 293, 274, 252, + 253, 472, 311, 289, 473, 294, 304, 305, 313, 306, + + 312, 315, 307, 308, 543, 319, 314, 321, 323, 316, + 309, 343, 310, 320, 345, 322, 324, 336, 337, 344, + 338, 347, 346, 339, 340, 542, 351, 353, 355, 348, + 365, 341, 367, 342, 352, 354, 356, 373, 366, 376, + 368, 378, 400, 374, 377, 394, 375, 379, 380, 395, + 401, 402, 408, 541, 540, 381, 539, 411, 409, 403, + 413, 410, 412, 538, 429, 537, 414, 415, 430, 536, + 535, 534, 533, 532, 416, 42, 531, 42, 530, 529, + 528, 527, 526, 525, 524, 523, 522, 521, 520, 519, + 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, + + 508, 507, 506, 505, 504, 503, 502, 501, 500, 499, + 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, + 488, 487, 486, 485, 484, 483, 482, 481, 480, 479, + 478, 477, 476, 475, 474, 471, 470, 469, 468, 467, + 466, 465, 464, 463, 462, 461, 460, 459, 458, 457, + 456, 455, 454, 453, 452, 451, 448, 447, 446, 445, + 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, + 434, 433, 432, 431, 428, 427, 426, 425, 424, 423, + 422, 421, 420, 419, 418, 417, 407, 406, 405, 404, + 399, 398, 397, 396, 393, 392, 391, 390, 389, 388, + + 387, 386, 385, 384, 383, 382, 372, 371, 370, 369, + 364, 363, 362, 361, 360, 359, 358, 357, 350, 349, + 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, + 325, 318, 317, 303, 302, 301, 300, 299, 298, 297, + 296, 295, 292, 291, 290, 287, 286, 285, 284, 281, + 280, 279, 278, 277, 276, 275, 272, 271, 270, 267, + 266, 265, 264, 261, 260, 259, 258, 257, 256, 255, + 254, 245, 244, 243, 242, 239, 238, 237, 236, 235, + 226, 225, 224, 223, 220, 219, 216, 213, 212, 211, + 210, 209, 208, 207, 206, 203, 200, 199, 198, 197, + + 196, 195, 194, 193, 192, 191, 188, 187, 186, 185, + 184, 183, 182, 181, 180, 179, 178, 177, 176, 173, + 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, + 162, 161, 160, 159, 156, 155, 154, 153, 152, 151, + 150, 149, 148, 147, 146, 145, 144, 143, 140, 139, + 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, + 128, 125, 124, 123, 122, 121, 120, 116, 115, 114, + 113, 112, 109, 108, 107, 106, 105, 104, 100, 99, + 98, 86, 85, 84, 72, 69, 68, 67, 66, 63, + 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, + + 52, 51, 50, 49, 48, 47, 41, 40, 39, 544, + 5, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544 + } ; + +static yyconst flex_int16_t yy_chk[653] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 7, 7, 8, 8, 13, 13, 22, 22, + 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, + + 27, 27, 35, 35, 43, 43, 54, 59, 545, 54, + 59, 62, 109, 62, 125, 62, 62, 63, 63, 62, + 69, 69, 62, 62, 109, 74, 125, 62, 142, 74, + 62, 68, 81, 68, 88, 68, 68, 74, 88, 68, + 95, 81, 68, 68, 142, 158, 88, 68, 173, 95, + 68, 175, 188, 196, 190, 209, 175, 224, 173, 190, + 224, 158, 188, 201, 243, 201, 230, 243, 201, 201, + 202, 196, 202, 209, 230, 202, 202, 214, 380, 214, + 234, 380, 214, 214, 215, 249, 215, 253, 234, 215, + 215, 415, 265, 249, 415, 253, 264, 264, 266, 264, + + 265, 267, 264, 264, 539, 270, 266, 271, 272, 267, + 264, 285, 264, 270, 286, 271, 272, 284, 284, 285, + 284, 287, 286, 284, 284, 535, 290, 291, 292, 287, + 302, 284, 303, 284, 290, 291, 292, 308, 302, 309, + 303, 310, 334, 308, 309, 327, 308, 310, 310, 327, + 334, 335, 340, 531, 529, 310, 524, 341, 340, 335, + 342, 340, 341, 522, 359, 519, 342, 342, 359, 517, + 512, 510, 509, 508, 342, 546, 506, 546, 505, 504, + 502, 501, 500, 498, 497, 496, 495, 493, 492, 490, + 489, 488, 486, 485, 484, 482, 481, 480, 479, 477, + + 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, + 466, 465, 463, 462, 461, 454, 453, 452, 451, 450, + 449, 448, 447, 446, 445, 444, 443, 442, 440, 439, + 438, 431, 430, 429, 416, 414, 413, 412, 411, 410, + 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, + 399, 397, 396, 395, 394, 381, 379, 378, 377, 376, + 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, + 365, 364, 362, 360, 356, 355, 354, 353, 352, 351, + 348, 347, 346, 345, 344, 343, 339, 338, 337, 336, + 333, 332, 331, 328, 324, 323, 322, 321, 320, 319, + + 316, 315, 314, 313, 312, 311, 307, 306, 305, 304, + 301, 300, 299, 297, 296, 295, 294, 293, 289, 288, + 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, + 273, 269, 268, 263, 262, 261, 260, 259, 258, 257, + 256, 255, 252, 251, 250, 248, 247, 246, 244, 242, + 241, 240, 239, 238, 237, 236, 233, 232, 231, 229, + 228, 227, 225, 223, 222, 221, 220, 219, 218, 217, + 216, 213, 212, 211, 210, 208, 206, 205, 204, 203, + 200, 199, 198, 197, 195, 191, 189, 187, 186, 185, + 184, 181, 180, 179, 176, 174, 172, 171, 170, 169, + + 166, 165, 164, 161, 160, 159, 157, 156, 155, 154, + 153, 152, 151, 150, 149, 148, 145, 144, 143, 141, + 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, + 129, 128, 127, 126, 124, 123, 122, 121, 120, 119, + 118, 117, 116, 115, 113, 112, 111, 110, 108, 107, + 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, + 96, 94, 93, 92, 91, 90, 89, 87, 85, 84, + 83, 82, 80, 79, 78, 77, 76, 75, 73, 71, + 70, 67, 65, 64, 61, 58, 57, 56, 55, 53, + 52, 51, 50, 49, 48, 47, 46, 45, 41, 40, + + 39, 38, 37, 30, 29, 28, 16, 15, 14, 5, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, + 544, 544 + } ; extern int H5LTyy_flex_debug; -int H5LTyy_flex_debug = 0; - -static yy_state_type *yy_state_buf = 0, *yy_state_ptr = 0; -static char * yy_full_match; -static int yy_lp; -#define REJECT \ - { \ - *yy_cp = (yy_hold_char); /* undo effects of setting up H5LTyytext */ \ - yy_cp = (yy_full_match); /* restore poss. backed-over text */ \ - ++(yy_lp); \ - goto find_rule; \ - } +int H5LTyy_flex_debug = 0; + +static yy_state_type *yy_state_buf=0, *yy_state_ptr=0; +static char *yy_full_match; +static int yy_lp; +#define REJECT \ +{ \ +*yy_cp = (yy_hold_char); /* undo effects of setting up H5LTyytext */ \ +yy_cp = (yy_full_match); /* restore poss. backed-over text */ \ +++(yy_lp); \ +goto find_rule; \ +} -#define yymore() yymore_used_but_not_detected +#define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *H5LTyytext; @@ -672,49 +896,43 @@ char *H5LTyytext; #include #include "H5LTparse.h" -/* Turn off suggest const & malloc attribute warnings in gcc */ -#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ -#pragma GCC diagnostic ignored "-Wsuggest-attribute=const" -#pragma GCC diagnostic ignored "-Wsuggest-attribute=malloc" -#endif - int my_yyinput(char *, int); #undef YY_INPUT -#define YY_INPUT(b, r, ms) (r = my_yyinput(b, ms)) -#define token(x) (int)x -#define hid(x) (hid_t) x +#define YY_INPUT(b, r, ms) (r=my_yyinput(b, ms)) +#define token(x) (int)x +#define hid(x) (hid_t)x -#ifdef YY_BUF_SIZE -#undef YY_BUF_SIZE +#ifdef YY_BUF_SIZE +#undef YY_BUF_SIZE #endif -#define YY_BUF_SIZE 262144 /*Define read buffer to be 256K*/ +#define YY_BUF_SIZE 262144 /*Define read buffer to be 256K*/ -extern char * myinput; +extern char *myinput; extern size_t input_len; -#define STACK_SIZE 16 +#define STACK_SIZE 16 /*variables for compound type*/ struct cmpd_info { - hid_t id; - hbool_t is_field; - hbool_t first_memb; + hid_t id; + hbool_t is_field; + hbool_t first_memb; }; extern struct cmpd_info cmpd_stack[STACK_SIZE]; -extern int csindex; +extern int csindex; /*variables for array type*/ struct arr_info { - hsize_t dims[H5S_MAX_RANK]; - int ndim; - hbool_t is_dim; + hsize_t dims[H5S_MAX_RANK]; + int ndim; + hbool_t is_dim; }; extern struct arr_info arr_stack[STACK_SIZE]; -extern int asindex; +extern int asindex; /*variables for enumerate type*/ -extern hbool_t is_enum; -extern hbool_t is_enum_memb; +extern hbool_t is_enum; +extern hbool_t is_enum_memb; /*variables for string type*/ extern hbool_t is_str_size; @@ -723,47 +941,48 @@ extern hbool_t is_str_size; extern hbool_t is_opq_size; extern hbool_t is_opq_tag; -hbool_t first_quote = 1; +hbool_t first_quote = 1; + -#line 926 "hl/src/H5LTanalyze.c" +#line 920 "hl/src/H5LTanalyze.c" -#define INITIAL 0 +#define INITIAL 0 #define TAG_STRING 1 #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals(void); +static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int H5LTyylex_destroy(void); +int H5LTyylex_destroy (void ); -int H5LTyyget_debug(void); +int H5LTyyget_debug (void ); -void H5LTyyset_debug(int debug_flag); +void H5LTyyset_debug (int debug_flag ); -YY_EXTRA_TYPE H5LTyyget_extra(void); +YY_EXTRA_TYPE H5LTyyget_extra (void ); -void H5LTyyset_extra(YY_EXTRA_TYPE user_defined); +void H5LTyyset_extra (YY_EXTRA_TYPE user_defined ); -FILE *H5LTyyget_in(void); +FILE *H5LTyyget_in (void ); -void H5LTyyset_in(FILE *in_str); +void H5LTyyset_in (FILE * in_str ); -FILE *H5LTyyget_out(void); +FILE *H5LTyyget_out (void ); -void H5LTyyset_out(FILE *out_str); +void H5LTyyset_out (FILE * out_str ); -yy_size_t H5LTyyget_leng(void); +yy_size_t H5LTyyget_leng (void ); -char *H5LTyyget_text(void); +char *H5LTyyget_text (void ); -int H5LTyyget_lineno(void); +int H5LTyyget_lineno (void ); -void H5LTyyset_lineno(int line_number); +void H5LTyyset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -771,28 +990,28 @@ void H5LTyyset_lineno(int line_number); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int H5LTyywrap(void); +extern "C" int H5LTyywrap (void ); #else -extern int H5LTyywrap(void); +extern int H5LTyywrap (void ); #endif #endif -static void yyunput(int c, char *buf_ptr); - + static void yyunput (int c,char *buf_ptr ); + #ifndef yytext_ptr -static void yy_flex_strncpy(char *, yyconst char *, int); +static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen(yyconst char *); +static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus -static int yyinput(void); +static int yyinput (void ); #else -static int input(void); +static int input (void ); #endif #endif @@ -807,40 +1026,42 @@ static int input(void); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO \ - do { \ - if (fwrite(H5LTyytext, H5LTyyleng, 1, H5LTyyout)) { \ - } \ - } while (0) +#define ECHO fwrite( H5LTyytext, H5LTyyleng, 1, H5LTyyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT -#define YY_INPUT(buf, result, max_size) \ - if (YY_CURRENT_BUFFER_LVALUE->yy_is_interactive) { \ - int c = '*'; \ - size_t n; \ - for (n = 0; n < max_size && (c = getc(H5LTyyin)) != EOF && c != '\n'; ++n) \ - buf[n] = (char)c; \ - if (c == '\n') \ - buf[n++] = (char)c; \ - if (c == EOF && ferror(H5LTyyin)) \ - YY_FATAL_ERROR("input in flex scanner failed"); \ - result = n; \ - } \ - else { \ - errno = 0; \ - while ((result = fread(buf, 1, max_size, H5LTyyin)) == 0 && ferror(H5LTyyin)) { \ - if (errno != EINTR) { \ - YY_FATAL_ERROR("input in flex scanner failed"); \ - break; \ - } \ - errno = 0; \ - clearerr(H5LTyyin); \ - } \ - } +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + yy_size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( H5LTyyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( H5LTyyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, H5LTyyin))==0 && ferror(H5LTyyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(H5LTyyin); \ + } \ + }\ +\ #endif @@ -859,7 +1080,7 @@ static int input(void); /* Report a fatal error. */ #ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error(msg) +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ @@ -870,9 +1091,9 @@ static int input(void); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int H5LTyylex(void); +extern int H5LTyylex (void); -#define YY_DECL int H5LTyylex(void) +#define YY_DECL int H5LTyylex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after H5LTyytext and H5LTyyleng @@ -887,707 +1108,603 @@ extern int H5LTyylex(void); #define YY_BREAK break; #endif -#define YY_RULE_SETUP YY_USER_ACTION +#define YY_RULE_SETUP \ + YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { - register yy_state_type yy_current_state; - register char * yy_cp, *yy_bp; - register int yy_act; + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 77 "hl/src/H5LTanalyze.l" -#line 83 "hl/src/H5LTanalyze.l" -#line 1104 "hl/src/H5LTanalyze.c" +#line 1098 "hl/src/H5LTanalyze.c" - if (!(yy_init)) { - (yy_init) = 1; + if ( !(yy_init) ) + { + (yy_init) = 1; #ifdef YY_USER_INIT - YY_USER_INIT; + YY_USER_INIT; #endif /* Create the reject buffer large enough to save one state per allowed character. */ - if (!(yy_state_buf)) - (yy_state_buf) = (yy_state_type *)H5LTyyalloc(YY_STATE_BUF_SIZE); - if (!(yy_state_buf)) - YY_FATAL_ERROR("out of dynamic memory in H5LTyylex()"); + if ( ! (yy_state_buf) ) + (yy_state_buf) = (yy_state_type *)H5LTyyalloc(YY_STATE_BUF_SIZE ); + if ( ! (yy_state_buf) ) + YY_FATAL_ERROR( "out of dynamic memory in H5LTyylex()" ); - if (!(yy_start)) - (yy_start) = 1; /* first start state */ + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ - if (!H5LTyyin) - H5LTyyin = stdin; + if ( ! H5LTyyin ) + H5LTyyin = stdin; - if (!H5LTyyout) - H5LTyyout = stdout; + if ( ! H5LTyyout ) + H5LTyyout = stdout; - if (!YY_CURRENT_BUFFER) { - H5LTyyensure_buffer_stack(); - YY_CURRENT_BUFFER_LVALUE = H5LTyy_create_buffer(H5LTyyin, YY_BUF_SIZE); - } + if ( ! YY_CURRENT_BUFFER ) { + H5LTyyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); + } - H5LTyy_load_buffer_state(); - } + H5LTyy_load_buffer_state( ); + } - while (1) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); - /* Support of H5LTyytext. */ - *yy_cp = (yy_hold_char); + /* Support of H5LTyytext. */ + *yy_cp = (yy_hold_char); - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; - yy_current_state = (yy_start); + yy_current_state = (yy_start); - (yy_state_ptr) = (yy_state_buf); - *(yy_state_ptr)++ = yy_current_state; + (yy_state_ptr) = (yy_state_buf); + *(yy_state_ptr)++ = yy_current_state; yy_match: - do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) { - yy_current_state = (int)yy_def[yy_current_state]; - if (yy_current_state >= 545) - yy_c = yy_meta[(unsigned int)yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c]; - *(yy_state_ptr)++ = yy_current_state; - ++yy_cp; - } while (yy_base[yy_current_state] != 611); + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 545 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *(yy_state_ptr)++ = yy_current_state; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 611 ); yy_find_action: - yy_current_state = *--(yy_state_ptr); - (yy_lp) = yy_accept[yy_current_state]; -find_rule: /* we branch to this label when backing up */ - for (;;) /* until we find what rule we matched */ - { - if ((yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1]) { - yy_act = yy_acclist[(yy_lp)]; - { - (yy_full_match) = yy_cp; - break; - } - } - --yy_cp; - yy_current_state = *--(yy_state_ptr); - (yy_lp) = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch (yy_act) { /* beginning of action switch */ - case 1: - YY_RULE_SETUP + yy_current_state = *--(yy_state_ptr); + (yy_lp) = yy_accept[yy_current_state]; +goto find_rule; /* Shut up GCC warning -Wall */ +find_rule: /* we branch to this label when backing up */ + for ( ; ; ) /* until we find what rule we matched */ + { + if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] ) + { + yy_act = yy_acclist[(yy_lp)]; + { + (yy_full_match) = yy_cp; + break; + } + } + --yy_cp; + yy_current_state = *--(yy_state_ptr); + (yy_lp) = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ +case 1: +YY_RULE_SETUP +#line 79 "hl/src/H5LTanalyze.l" +{return hid(H5T_STD_I8BE_TOKEN);} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 80 "hl/src/H5LTanalyze.l" +{return hid(H5T_STD_I8LE_TOKEN);} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 81 "hl/src/H5LTanalyze.l" +{return hid(H5T_STD_I16BE_TOKEN);} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 82 "hl/src/H5LTanalyze.l" +{return hid(H5T_STD_I16LE_TOKEN);} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 83 "hl/src/H5LTanalyze.l" +{return hid(H5T_STD_I32BE_TOKEN);} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 84 "hl/src/H5LTanalyze.l" +{return hid(H5T_STD_I32LE_TOKEN);} + YY_BREAK +case 7: +YY_RULE_SETUP #line 85 "hl/src/H5LTanalyze.l" - { - return hid(H5T_STD_I8BE_TOKEN); - } - YY_BREAK - case 2: - YY_RULE_SETUP +{return hid(H5T_STD_I64BE_TOKEN);} + YY_BREAK +case 8: +YY_RULE_SETUP #line 86 "hl/src/H5LTanalyze.l" - { - return hid(H5T_STD_I8LE_TOKEN); - } - YY_BREAK - case 3: - YY_RULE_SETUP -#line 87 "hl/src/H5LTanalyze.l" - { - return hid(H5T_STD_I16BE_TOKEN); - } - YY_BREAK - case 4: - YY_RULE_SETUP +{return hid(H5T_STD_I64LE_TOKEN);} + YY_BREAK +case 9: +YY_RULE_SETUP #line 88 "hl/src/H5LTanalyze.l" - { - return hid(H5T_STD_I16LE_TOKEN); - } - YY_BREAK - case 5: - YY_RULE_SETUP +{return hid(H5T_STD_U8BE_TOKEN);} + YY_BREAK +case 10: +YY_RULE_SETUP #line 89 "hl/src/H5LTanalyze.l" - { - return hid(H5T_STD_I32BE_TOKEN); - } - YY_BREAK - case 6: - YY_RULE_SETUP +{return hid(H5T_STD_U8LE_TOKEN);} + YY_BREAK +case 11: +YY_RULE_SETUP #line 90 "hl/src/H5LTanalyze.l" - { - return hid(H5T_STD_I32LE_TOKEN); - } - YY_BREAK - case 7: - YY_RULE_SETUP +{return hid(H5T_STD_U16BE_TOKEN);} + YY_BREAK +case 12: +YY_RULE_SETUP #line 91 "hl/src/H5LTanalyze.l" - { - return hid(H5T_STD_I64BE_TOKEN); - } - YY_BREAK - case 8: - YY_RULE_SETUP +{return hid(H5T_STD_U16LE_TOKEN);} + YY_BREAK +case 13: +YY_RULE_SETUP #line 92 "hl/src/H5LTanalyze.l" - { - return hid(H5T_STD_I64LE_TOKEN); - } - YY_BREAK - case 9: - YY_RULE_SETUP +{return hid(H5T_STD_U32BE_TOKEN);} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 93 "hl/src/H5LTanalyze.l" +{return hid(H5T_STD_U32LE_TOKEN);} + YY_BREAK +case 15: +YY_RULE_SETUP #line 94 "hl/src/H5LTanalyze.l" - { - return hid(H5T_STD_U8BE_TOKEN); - } - YY_BREAK - case 10: - YY_RULE_SETUP +{return hid(H5T_STD_U64BE_TOKEN);} + YY_BREAK +case 16: +YY_RULE_SETUP #line 95 "hl/src/H5LTanalyze.l" - { - return hid(H5T_STD_U8LE_TOKEN); - } - YY_BREAK - case 11: - YY_RULE_SETUP -#line 96 "hl/src/H5LTanalyze.l" - { - return hid(H5T_STD_U16BE_TOKEN); - } - YY_BREAK - case 12: - YY_RULE_SETUP +{return hid(H5T_STD_U64LE_TOKEN);} + YY_BREAK +case 17: +YY_RULE_SETUP #line 97 "hl/src/H5LTanalyze.l" - { - return hid(H5T_STD_U16LE_TOKEN); - } - YY_BREAK - case 13: - YY_RULE_SETUP +{return hid(H5T_NATIVE_CHAR_TOKEN);} + YY_BREAK +case 18: +YY_RULE_SETUP #line 98 "hl/src/H5LTanalyze.l" - { - return hid(H5T_STD_U32BE_TOKEN); - } - YY_BREAK - case 14: - YY_RULE_SETUP +{return hid(H5T_NATIVE_SCHAR_TOKEN);} + YY_BREAK +case 19: +YY_RULE_SETUP #line 99 "hl/src/H5LTanalyze.l" - { - return hid(H5T_STD_U32LE_TOKEN); - } - YY_BREAK - case 15: - YY_RULE_SETUP +{return hid(H5T_NATIVE_UCHAR_TOKEN);} + YY_BREAK +case 20: +YY_RULE_SETUP #line 100 "hl/src/H5LTanalyze.l" - { - return hid(H5T_STD_U64BE_TOKEN); - } - YY_BREAK - case 16: - YY_RULE_SETUP +{return hid(H5T_NATIVE_SHORT_TOKEN);} + YY_BREAK +case 21: +YY_RULE_SETUP #line 101 "hl/src/H5LTanalyze.l" - { - return hid(H5T_STD_U64LE_TOKEN); - } - YY_BREAK - case 17: - YY_RULE_SETUP +{return hid(H5T_NATIVE_USHORT_TOKEN);} + YY_BREAK +case 22: +YY_RULE_SETUP +#line 102 "hl/src/H5LTanalyze.l" +{return hid(H5T_NATIVE_INT_TOKEN);} + YY_BREAK +case 23: +YY_RULE_SETUP #line 103 "hl/src/H5LTanalyze.l" - { - return hid(H5T_NATIVE_CHAR_TOKEN); - } - YY_BREAK - case 18: - YY_RULE_SETUP +{return hid(H5T_NATIVE_UINT_TOKEN);} + YY_BREAK +case 24: +YY_RULE_SETUP #line 104 "hl/src/H5LTanalyze.l" - { - return hid(H5T_NATIVE_SCHAR_TOKEN); - } - YY_BREAK - case 19: - YY_RULE_SETUP +{return hid(H5T_NATIVE_LONG_TOKEN);} + YY_BREAK +case 25: +YY_RULE_SETUP #line 105 "hl/src/H5LTanalyze.l" - { - return hid(H5T_NATIVE_UCHAR_TOKEN); - } - YY_BREAK - case 20: - YY_RULE_SETUP +{return hid(H5T_NATIVE_ULONG_TOKEN);} + YY_BREAK +case 26: +YY_RULE_SETUP #line 106 "hl/src/H5LTanalyze.l" - { - return hid(H5T_NATIVE_SHORT_TOKEN); - } - YY_BREAK - case 21: - YY_RULE_SETUP +{return hid(H5T_NATIVE_LLONG_TOKEN);} + YY_BREAK +case 27: +YY_RULE_SETUP #line 107 "hl/src/H5LTanalyze.l" - { - return hid(H5T_NATIVE_USHORT_TOKEN); - } - YY_BREAK - case 22: - YY_RULE_SETUP -#line 108 "hl/src/H5LTanalyze.l" - { - return hid(H5T_NATIVE_INT_TOKEN); - } - YY_BREAK - case 23: - YY_RULE_SETUP +{return hid(H5T_NATIVE_ULLONG_TOKEN);} + YY_BREAK +case 28: +YY_RULE_SETUP #line 109 "hl/src/H5LTanalyze.l" - { - return hid(H5T_NATIVE_UINT_TOKEN); - } - YY_BREAK - case 24: - YY_RULE_SETUP +{return hid(H5T_IEEE_F32BE_TOKEN);} + YY_BREAK +case 29: +YY_RULE_SETUP #line 110 "hl/src/H5LTanalyze.l" - { - return hid(H5T_NATIVE_LONG_TOKEN); - } - YY_BREAK - case 25: - YY_RULE_SETUP +{return hid(H5T_IEEE_F32LE_TOKEN);} + YY_BREAK +case 30: +YY_RULE_SETUP #line 111 "hl/src/H5LTanalyze.l" - { - return hid(H5T_NATIVE_ULONG_TOKEN); - } - YY_BREAK - case 26: - YY_RULE_SETUP +{return hid(H5T_IEEE_F64BE_TOKEN);} + YY_BREAK +case 31: +YY_RULE_SETUP #line 112 "hl/src/H5LTanalyze.l" - { - return hid(H5T_NATIVE_LLONG_TOKEN); - } - YY_BREAK - case 27: - YY_RULE_SETUP +{return hid(H5T_IEEE_F64LE_TOKEN);} + YY_BREAK +case 32: +YY_RULE_SETUP #line 113 "hl/src/H5LTanalyze.l" - { - return hid(H5T_NATIVE_ULLONG_TOKEN); - } - YY_BREAK - case 28: - YY_RULE_SETUP +{return hid(H5T_NATIVE_FLOAT_TOKEN);} + YY_BREAK +case 33: +YY_RULE_SETUP +#line 114 "hl/src/H5LTanalyze.l" +{return hid(H5T_NATIVE_DOUBLE_TOKEN);} + YY_BREAK +case 34: +YY_RULE_SETUP #line 115 "hl/src/H5LTanalyze.l" - { - return hid(H5T_IEEE_F32BE_TOKEN); - } - YY_BREAK - case 29: - YY_RULE_SETUP -#line 116 "hl/src/H5LTanalyze.l" - { - return hid(H5T_IEEE_F32LE_TOKEN); - } - YY_BREAK - case 30: - YY_RULE_SETUP +{return hid(H5T_NATIVE_LDOUBLE_TOKEN);} + YY_BREAK +case 35: +YY_RULE_SETUP #line 117 "hl/src/H5LTanalyze.l" - { - return hid(H5T_IEEE_F64BE_TOKEN); - } - YY_BREAK - case 31: - YY_RULE_SETUP +{return token(H5T_STRING_TOKEN);} + YY_BREAK +case 36: +YY_RULE_SETUP #line 118 "hl/src/H5LTanalyze.l" - { - return hid(H5T_IEEE_F64LE_TOKEN); - } - YY_BREAK - case 32: - YY_RULE_SETUP +{return token(STRSIZE_TOKEN);} + YY_BREAK +case 37: +YY_RULE_SETUP #line 119 "hl/src/H5LTanalyze.l" - { - return hid(H5T_NATIVE_FLOAT_TOKEN); - } - YY_BREAK - case 33: - YY_RULE_SETUP +{return token(STRPAD_TOKEN);} + YY_BREAK +case 38: +YY_RULE_SETUP #line 120 "hl/src/H5LTanalyze.l" - { - return hid(H5T_NATIVE_DOUBLE_TOKEN); - } - YY_BREAK - case 34: - YY_RULE_SETUP +{return token(CSET_TOKEN);} + YY_BREAK +case 39: +YY_RULE_SETUP #line 121 "hl/src/H5LTanalyze.l" - { - return hid(H5T_NATIVE_LDOUBLE_TOKEN); - } - YY_BREAK - case 35: - YY_RULE_SETUP +{return token(CTYPE_TOKEN);} + YY_BREAK +case 40: +YY_RULE_SETUP +#line 122 "hl/src/H5LTanalyze.l" +{return token(H5T_STR_NULLTERM_TOKEN);} + YY_BREAK +case 41: +YY_RULE_SETUP #line 123 "hl/src/H5LTanalyze.l" - { - return token(H5T_STRING_TOKEN); - } - YY_BREAK - case 36: - YY_RULE_SETUP +{return token(H5T_STR_NULLPAD_TOKEN);} + YY_BREAK +case 42: +YY_RULE_SETUP #line 124 "hl/src/H5LTanalyze.l" - { - return token(STRSIZE_TOKEN); - } - YY_BREAK - case 37: - YY_RULE_SETUP +{return token(H5T_STR_SPACEPAD_TOKEN);} + YY_BREAK +case 43: +YY_RULE_SETUP #line 125 "hl/src/H5LTanalyze.l" - { - return token(STRPAD_TOKEN); - } - YY_BREAK - case 38: - YY_RULE_SETUP +{return token(H5T_CSET_ASCII_TOKEN);} + YY_BREAK +case 44: +YY_RULE_SETUP #line 126 "hl/src/H5LTanalyze.l" - { - return token(CSET_TOKEN); - } - YY_BREAK - case 39: - YY_RULE_SETUP +{return token(H5T_CSET_UTF8_TOKEN);} + YY_BREAK +case 45: +YY_RULE_SETUP #line 127 "hl/src/H5LTanalyze.l" - { - return token(CTYPE_TOKEN); - } - YY_BREAK - case 40: - YY_RULE_SETUP +{return token(H5T_C_S1_TOKEN);} + YY_BREAK +case 46: +YY_RULE_SETUP #line 128 "hl/src/H5LTanalyze.l" - { - return token(H5T_STR_NULLTERM_TOKEN); - } - YY_BREAK - case 41: - YY_RULE_SETUP +{return token(H5T_FORTRAN_S1_TOKEN);} + YY_BREAK +case 47: +YY_RULE_SETUP #line 129 "hl/src/H5LTanalyze.l" - { - return token(H5T_STR_NULLPAD_TOKEN); - } - YY_BREAK - case 42: - YY_RULE_SETUP -#line 130 "hl/src/H5LTanalyze.l" - { - return token(H5T_STR_SPACEPAD_TOKEN); - } - YY_BREAK - case 43: - YY_RULE_SETUP +{return token(H5T_VARIABLE_TOKEN);} + YY_BREAK +case 48: +YY_RULE_SETUP #line 131 "hl/src/H5LTanalyze.l" - { - return token(H5T_CSET_ASCII_TOKEN); - } - YY_BREAK - case 44: - YY_RULE_SETUP +{return token(H5T_COMPOUND_TOKEN);} + YY_BREAK +case 49: +YY_RULE_SETUP #line 132 "hl/src/H5LTanalyze.l" - { - return token(H5T_CSET_UTF8_TOKEN); - } - YY_BREAK - case 45: - YY_RULE_SETUP +{return token(H5T_ENUM_TOKEN);} + YY_BREAK +case 50: +YY_RULE_SETUP #line 133 "hl/src/H5LTanalyze.l" - { - return token(H5T_C_S1_TOKEN); - } - YY_BREAK - case 46: - YY_RULE_SETUP +{return token(H5T_ARRAY_TOKEN);} + YY_BREAK +case 51: +YY_RULE_SETUP #line 134 "hl/src/H5LTanalyze.l" - { - return token(H5T_FORTRAN_S1_TOKEN); - } - YY_BREAK - case 47: - YY_RULE_SETUP -#line 135 "hl/src/H5LTanalyze.l" - { - return token(H5T_VARIABLE_TOKEN); - } - YY_BREAK - case 48: - YY_RULE_SETUP +{return token(H5T_VLEN_TOKEN);} + YY_BREAK +case 52: +YY_RULE_SETUP +#line 136 "hl/src/H5LTanalyze.l" +{return token(H5T_OPAQUE_TOKEN);} + YY_BREAK +case 53: +YY_RULE_SETUP #line 137 "hl/src/H5LTanalyze.l" - { - return token(H5T_COMPOUND_TOKEN); - } - YY_BREAK - case 49: - YY_RULE_SETUP +{return token(OPQ_SIZE_TOKEN);} + YY_BREAK +case 54: +YY_RULE_SETUP #line 138 "hl/src/H5LTanalyze.l" - { - return token(H5T_ENUM_TOKEN); - } - YY_BREAK - case 50: - YY_RULE_SETUP -#line 139 "hl/src/H5LTanalyze.l" - { - return token(H5T_ARRAY_TOKEN); - } - YY_BREAK - case 51: - YY_RULE_SETUP +{return token(OPQ_TAG_TOKEN);} + YY_BREAK +case 55: +YY_RULE_SETUP #line 140 "hl/src/H5LTanalyze.l" - { - return token(H5T_VLEN_TOKEN); - } - YY_BREAK - case 52: - YY_RULE_SETUP -#line 142 "hl/src/H5LTanalyze.l" - { - return token(H5T_OPAQUE_TOKEN); - } - YY_BREAK - case 53: - YY_RULE_SETUP -#line 143 "hl/src/H5LTanalyze.l" - { - return token(OPQ_SIZE_TOKEN); - } - YY_BREAK - case 54: - YY_RULE_SETUP -#line 144 "hl/src/H5LTanalyze.l" - { - return token(OPQ_TAG_TOKEN); - } - YY_BREAK - case 55: - YY_RULE_SETUP -#line 146 "hl/src/H5LTanalyze.l" - { - if (is_str_size || (is_enum && is_enum_memb) || is_opq_size || - (asindex > -1 && arr_stack[asindex].is_dim) || - (csindex > -1 && cmpd_stack[csindex].is_field)) { - H5LTyylval.ival = atoi(H5LTyytext); - return NUMBER; - } - else - REJECT; - } - YY_BREAK - case 56: - YY_RULE_SETUP -#line 156 "hl/src/H5LTanalyze.l" - { +{ + if( is_str_size || (is_enum && is_enum_memb) || + is_opq_size || (asindex>-1 && arr_stack[asindex].is_dim) || + (csindex>-1 && cmpd_stack[csindex].is_field) ) { + H5LTyylval.ival = atoi(H5LTyytext); + return NUMBER; + } else + REJECT; + } + YY_BREAK +case 56: +YY_RULE_SETUP +#line 150 "hl/src/H5LTanalyze.l" +{ /*if it's first quote, and is a compound field name or an enum symbol*/ - if ((is_opq_tag || is_enum || (csindex > -1 && cmpd_stack[csindex].is_field)) && - first_quote) { + if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field)) + && first_quote) { first_quote = 0; BEGIN TAG_STRING; - } - else /*if it's second quote*/ + } else /*if it's second quote*/ first_quote = 1; return token('"'); - } - YY_BREAK - case 57: - /* rule 57 can match eol */ - YY_RULE_SETUP -#line 166 "hl/src/H5LTanalyze.l" - { + } + YY_BREAK +case 57: +/* rule 57 can match eol */ +YY_RULE_SETUP +#line 160 "hl/src/H5LTanalyze.l" +{ #ifdef H5_HAVE_WIN32_API H5LTyylval.sval = _strdup(H5LTyytext); -#else /* H5_HAVE_WIN32_API */ +#else /* H5_HAVE_WIN32_API */ H5LTyylval.sval = strdup(H5LTyytext); -#endif /* H5_HAVE_WIN32_API */ +#endif /* H5_HAVE_WIN32_API */ BEGIN INITIAL; return STRING; - } - YY_BREAK - case 58: - YY_RULE_SETUP + } + YY_BREAK +case 58: +YY_RULE_SETUP +#line 170 "hl/src/H5LTanalyze.l" +{return token('{');} + YY_BREAK +case 59: +YY_RULE_SETUP +#line 171 "hl/src/H5LTanalyze.l" +{return token('}');} + YY_BREAK +case 60: +YY_RULE_SETUP +#line 172 "hl/src/H5LTanalyze.l" +{return token('[');} + YY_BREAK +case 61: +YY_RULE_SETUP +#line 173 "hl/src/H5LTanalyze.l" +{return token(']');} + YY_BREAK +case 62: +YY_RULE_SETUP +#line 174 "hl/src/H5LTanalyze.l" +{return token(':');} + YY_BREAK +case 63: +YY_RULE_SETUP +#line 175 "hl/src/H5LTanalyze.l" +{return token(';');} + YY_BREAK +case 64: +/* rule 64 can match eol */ +YY_RULE_SETUP #line 176 "hl/src/H5LTanalyze.l" - { - return token('{'); - } - YY_BREAK - case 59: - YY_RULE_SETUP +; + YY_BREAK +case 65: +/* rule 65 can match eol */ +YY_RULE_SETUP #line 177 "hl/src/H5LTanalyze.l" - { - return token('}'); - } - YY_BREAK - case 60: - YY_RULE_SETUP -#line 178 "hl/src/H5LTanalyze.l" - { - return token('['); - } - YY_BREAK - case 61: - YY_RULE_SETUP +{ return 0; } + YY_BREAK +case 66: +YY_RULE_SETUP #line 179 "hl/src/H5LTanalyze.l" - { - return token(']'); - } - YY_BREAK - case 62: - YY_RULE_SETUP -#line 180 "hl/src/H5LTanalyze.l" - { - return token(':'); - } - YY_BREAK - case 63: - YY_RULE_SETUP -#line 181 "hl/src/H5LTanalyze.l" - { - return token(';'); - } - YY_BREAK - case 64: - /* rule 64 can match eol */ - YY_RULE_SETUP -#line 182 "hl/src/H5LTanalyze.l" - ; - YY_BREAK - case 65: - /* rule 65 can match eol */ - YY_RULE_SETUP -#line 183 "hl/src/H5LTanalyze.l" - { - return 0; - } - YY_BREAK - case 66: - YY_RULE_SETUP -#line 185 "hl/src/H5LTanalyze.l" - ECHO; - YY_BREAK -#line 1554 "hl/src/H5LTanalyze.c" - case YY_STATE_EOF(INITIAL): - case YY_STATE_EOF(TAG_STRING): - yyterminate(); - - case YY_END_OF_BUFFER: { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int)(yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW) { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed H5LTyyin at a new source and called - * H5LTyylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = H5LTyyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ((yy_c_buf_p) <= - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]) { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans(yy_current_state); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if (yy_next_state) { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else - switch (yy_get_next_buffer()) { - case EOB_ACT_END_OF_FILE: { - (yy_did_buffer_switch_on_eof) = 0; - - if (H5LTyywrap()) { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * H5LTyytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else { - if (!(yy_did_buffer_switch_on_eof)) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR("fatal flex scanner internal error--no action found"); - } /* end of action switch */ - } /* end of scanning one token */ +ECHO; + YY_BREAK +#line 1549 "hl/src/H5LTanalyze.c" + case YY_STATE_EOF(INITIAL): + case YY_STATE_EOF(TAG_STRING): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed H5LTyyin at a new source and called + * H5LTyylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = H5LTyyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( H5LTyywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * H5LTyytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ } /* end of H5LTyylex */ /* yy_get_next_buffer - try to read in a new buffer @@ -1597,123 +1714,135 @@ do_action: /* This label is used only to access EOF actions. */ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ -static int -yy_get_next_buffer(void) +static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ((yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1]) - YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed"); - - if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == - 0) { /* Don't try to fill the buffer, so this is an EOF. */ - if ((yy_c_buf_p) - (yytext_ptr)-YY_MORE_ADJ == 1) { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int)((yy_c_buf_p) - (yytext_ptr)) - 1; - - for (i = 0; i < number_to_move; ++i) - *(dest++) = *(source++); - - if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else { - yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while (num_to_read <= 0) { /* Not enough room in the buffer - grow it. */ - - YY_FATAL_ERROR("input buffer overflow, can't enlarge buffer because scanner uses REJECT"); - } - - if (num_to_read > YY_READ_BUF_SIZE) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), num_to_read); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ((yy_n_chars) == 0) { - if (number_to_move == YY_MORE_ADJ) { - ret_val = EOB_ACT_END_OF_FILE; - H5LTyyrestart(H5LTyyin); - } - - else { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t)((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = - (char *)H5LTyyrealloc((void *)YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size); - if (!YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) - YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()"); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + yy_size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + H5LTyyrestart(H5LTyyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) H5LTyyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ -static yy_state_type -yy_get_previous_state(void) + static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char * yy_cp; - - yy_current_state = (yy_start); - - (yy_state_ptr) = (yy_state_buf); - *(yy_state_ptr)++ = yy_current_state; - - for (yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) { - yy_current_state = (int)yy_def[yy_current_state]; - if (yy_current_state >= 545) - yy_c = yy_meta[(unsigned int)yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c]; - *(yy_state_ptr)++ = yy_current_state; - } - - return yy_current_state; + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); + + (yy_state_ptr) = (yy_state_buf); + *(yy_state_ptr)++ = yy_current_state; + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 545 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *(yy_state_ptr)++ = yy_current_state; + } + + return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character @@ -1721,623 +1850,620 @@ yy_get_previous_state(void) * synopsis * next_state = yy_try_NUL_trans( current_state ); */ -static yy_state_type -yy_try_NUL_trans(yy_state_type yy_current_state) + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; - - register YY_CHAR yy_c = 1; - while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) { - yy_current_state = (int)yy_def[yy_current_state]; - if (yy_current_state >= 545) - yy_c = yy_meta[(unsigned int)yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c]; - yy_is_jam = (yy_current_state == 544); - if (!yy_is_jam) - *(yy_state_ptr)++ = yy_current_state; - - return yy_is_jam ? 0 : yy_current_state; + register int yy_is_jam; + + register YY_CHAR yy_c = 1; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 545 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 544); + if ( ! yy_is_jam ) + *(yy_state_ptr)++ = yy_current_state; + + return yy_is_jam ? 0 : yy_current_state; } -static void -yyunput(int c, register char *yy_bp) + static void yyunput (int c, register char * yy_bp ) { - register char *yy_cp; - + register char *yy_cp; + yy_cp = (yy_c_buf_p); - /* undo effects of setting up H5LTyytext */ - *yy_cp = (yy_hold_char); + /* undo effects of setting up H5LTyytext */ + *yy_cp = (yy_hold_char); - if (yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2) { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register yy_size_t number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register yy_size_t number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - while (source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) - *--dest = *--source; + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; - yy_cp += (int)(dest - source); - yy_bp += (int)(dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - if (yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2) - YY_FATAL_ERROR("flex scanner push-back overflow"); - } + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } - *--yy_cp = (char)c; + *--yy_cp = (char) c; - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; } #ifndef YY_NO_INPUT #ifdef __cplusplus -static int -yyinput(void) + static int yyinput (void) #else -static int -input(void) + static int input (void) #endif { - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if (*(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR) { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ((yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch (yy_get_next_buffer()) { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - H5LTyyrestart(H5LTyyin); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: { - if (H5LTyywrap()) - return EOF; - - if (!(yy_did_buffer_switch_on_eof)) - YY_NEW_FILE; + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + H5LTyyrestart(H5LTyyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( H5LTyywrap( ) ) + return 0; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; #ifdef __cplusplus - return yyinput(); + return yyinput(); #else - return input(); + return input(); #endif - } + } - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } - c = *(unsigned char *)(yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve H5LTyytext */ - (yy_hold_char) = *++(yy_c_buf_p); + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve H5LTyytext */ + (yy_hold_char) = *++(yy_c_buf_p); - return c; + return c; } -#endif /* ifndef YY_NO_INPUT */ +#endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. - * + * * @note This function does not reset the start condition to @c INITIAL . */ -void -H5LTyyrestart(FILE *input_file) + void H5LTyyrestart (FILE * input_file ) { - - if (!YY_CURRENT_BUFFER) { - H5LTyyensure_buffer_stack(); - YY_CURRENT_BUFFER_LVALUE = H5LTyy_create_buffer(H5LTyyin, YY_BUF_SIZE); - } - - H5LTyy_init_buffer(YY_CURRENT_BUFFER, input_file); - H5LTyy_load_buffer_state(); + + if ( ! YY_CURRENT_BUFFER ){ + H5LTyyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + H5LTyy_create_buffer(H5LTyyin,YY_BUF_SIZE ); + } + + H5LTyy_init_buffer(YY_CURRENT_BUFFER,input_file ); + H5LTyy_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. - * + * */ -void -H5LTyy_switch_to_buffer(YY_BUFFER_STATE new_buffer) + void H5LTyy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { - - /* TODO. We should be able to replace this entire function body - * with - * H5LTyypop_buffer_state(); - * H5LTyypush_buffer_state(new_buffer); - */ - H5LTyyensure_buffer_stack(); - if (YY_CURRENT_BUFFER == new_buffer) - return; - - if (YY_CURRENT_BUFFER) { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - H5LTyy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (H5LTyywrap()) processing, but the only time this flag - * is looked at is after H5LTyywrap() is called, so it's safe - * to go ahead and always set it. + + /* TODO. We should be able to replace this entire function body + * with + * H5LTyypop_buffer_state(); + * H5LTyypush_buffer_state(new_buffer); */ - (yy_did_buffer_switch_on_eof) = 1; + H5LTyyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + H5LTyy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (H5LTyywrap()) processing, but the only time this flag + * is looked at is after H5LTyywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; } -static void -H5LTyy_load_buffer_state(void) +static void H5LTyy_load_buffer_state (void) { - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - H5LTyyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + H5LTyyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * + * * @return the allocated buffer state. */ -YY_BUFFER_STATE -H5LTyy_create_buffer(FILE *file, int size) + YY_BUFFER_STATE H5LTyy_create_buffer (FILE * file, int size ) { - YY_BUFFER_STATE b; + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) H5LTyyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_create_buffer()" ); - b = (YY_BUFFER_STATE)H5LTyyalloc(sizeof(struct yy_buffer_state)); - if (!b) - YY_FATAL_ERROR("out of dynamic memory in H5LTyy_create_buffer()"); + b->yy_buf_size = size; - b->yy_buf_size = size; + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) H5LTyyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_create_buffer()" ); - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *)H5LTyyalloc(b->yy_buf_size + 2); - if (!b->yy_ch_buf) - YY_FATAL_ERROR("out of dynamic memory in H5LTyy_create_buffer()"); + b->yy_is_our_buffer = 1; - b->yy_is_our_buffer = 1; + H5LTyy_init_buffer(b,file ); - H5LTyy_init_buffer(b, file); - - return b; + return b; } /** Destroy the buffer. * @param b a buffer created with H5LTyy_create_buffer() - * + * */ -void -H5LTyy_delete_buffer(YY_BUFFER_STATE b) + void H5LTyy_delete_buffer (YY_BUFFER_STATE b ) { + + if ( ! b ) + return; - if (!b) - return; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - if (b == YY_CURRENT_BUFFER) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE)0; + if ( b->yy_is_our_buffer ) + H5LTyyfree((void *) b->yy_ch_buf ); - if (b->yy_is_our_buffer) - H5LTyyfree((void *)b->yy_ch_buf); - - H5LTyyfree((void *)b); + H5LTyyfree((void *) b ); } +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a H5LTyyrestart() or at EOF. */ -static void -H5LTyy_init_buffer(YY_BUFFER_STATE b, FILE *file) + static void H5LTyy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { - int oerrno = errno; - - H5LTyy_flush_buffer(b); + int oerrno = errno; + + H5LTyy_flush_buffer(b ); - b->yy_input_file = file; - b->yy_fill_buffer = 1; + b->yy_input_file = file; + b->yy_fill_buffer = 1; /* If b is the current buffer, then H5LTyy_init_buffer was _probably_ * called from H5LTyyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ - if (b != YY_CURRENT_BUFFER) { + if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } - b->yy_is_interactive = file ? (isatty(fileno(file)) > 0) : 0; - - errno = oerrno; + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * + * */ -void -H5LTyy_flush_buffer(YY_BUFFER_STATE b) + void H5LTyy_flush_buffer (YY_BUFFER_STATE b ) { - if (!b) - return; + if ( ! b ) + return; - b->yy_n_chars = 0; + b->yy_n_chars = 0; - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - b->yy_buf_pos = &b->yy_ch_buf[0]; + b->yy_buf_pos = &b->yy_ch_buf[0]; - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; - if (b == YY_CURRENT_BUFFER) - H5LTyy_load_buffer_state(); + if ( b == YY_CURRENT_BUFFER ) + H5LTyy_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. - * + * */ -void -H5LTyypush_buffer_state(YY_BUFFER_STATE new_buffer) +void H5LTyypush_buffer_state (YY_BUFFER_STATE new_buffer ) { - if (new_buffer == NULL) - return; - - H5LTyyensure_buffer_stack(); - - /* This block is copied from H5LTyy_switch_to_buffer. */ - if (YY_CURRENT_BUFFER) { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from H5LTyy_switch_to_buffer. */ - H5LTyy_load_buffer_state(); - (yy_did_buffer_switch_on_eof) = 1; + if (new_buffer == NULL) + return; + + H5LTyyensure_buffer_stack(); + + /* This block is copied from H5LTyy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from H5LTyy_switch_to_buffer. */ + H5LTyy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. - * + * */ -void -H5LTyypop_buffer_state(void) +void H5LTyypop_buffer_state (void) { - if (!YY_CURRENT_BUFFER) - return; - - H5LTyy_delete_buffer(YY_CURRENT_BUFFER); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - H5LTyy_load_buffer_state(); - (yy_did_buffer_switch_on_eof) = 1; - } + if (!YY_CURRENT_BUFFER) + return; + + H5LTyy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + H5LTyy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void -H5LTyyensure_buffer_stack(void) +static void H5LTyyensure_buffer_stack (void) { - yy_size_t num_to_alloc; - - if (!(yy_buffer_stack)) { + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. */ - num_to_alloc = 1; - (yy_buffer_stack) = - (struct yy_buffer_state **)H5LTyyalloc(num_to_alloc * sizeof(struct yy_buffer_state *)); - if (!(yy_buffer_stack)) - YY_FATAL_ERROR("out of dynamic memory in H5LTyyensure_buffer_stack()"); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state *)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1) { - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state **)H5LTyyrealloc( - (yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state *)); - if (!(yy_buffer_stack)) - YY_FATAL_ERROR("out of dynamic memory in H5LTyyensure_buffer_stack()"); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state *)); - (yy_buffer_stack_max) = num_to_alloc; - } + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)H5LTyyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in H5LTyyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)H5LTyyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in H5LTyyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. + * + * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE -H5LTyy_scan_buffer(char *base, yy_size_t size) +YY_BUFFER_STATE H5LTyy_scan_buffer (char * base, yy_size_t size ) { - YY_BUFFER_STATE b; - - if (size < 2 || base[size - 2] != YY_END_OF_BUFFER_CHAR || base[size - 1] != YY_END_OF_BUFFER_CHAR) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE)H5LTyyalloc(sizeof(struct yy_buffer_state)); - if (!b) - YY_FATAL_ERROR("out of dynamic memory in H5LTyy_scan_buffer()"); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - H5LTyy_switch_to_buffer(b); - - return b; + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) H5LTyyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + H5LTyy_switch_to_buffer(b ); + + return b; } /** Setup the input buffer state to scan a string. The next call to H5LTyylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan - * + * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * H5LTyy_scan_bytes() instead. */ -YY_BUFFER_STATE -H5LTyy_scan_string(yyconst char *yystr) { return H5LTyy_scan_bytes(yystr, strlen(yystr)); } +YY_BUFFER_STATE H5LTyy_scan_string (yyconst char * yystr ) +{ + + return H5LTyy_scan_bytes(yystr,strlen(yystr) ); +} /** Setup the input buffer state to scan the given bytes. The next call to H5LTyylex() will * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. - * + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE -H5LTyy_scan_bytes(yyconst char *yybytes, yy_size_t _yybytes_len) +YY_BUFFER_STATE H5LTyy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { - YY_BUFFER_STATE b; - char * buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *)H5LTyyalloc(n); - if (!buf) - YY_FATAL_ERROR("out of dynamic memory in H5LTyy_scan_bytes()"); - - for (i = 0; i < _yybytes_len; ++i) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR; - - b = H5LTyy_scan_buffer(buf, n); - if (!b) - YY_FATAL_ERROR("bad buffer in H5LTyy_scan_bytes()"); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; + YY_BUFFER_STATE b; + char *buf; + yy_size_t n, i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) H5LTyyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in H5LTyy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = H5LTyy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in H5LTyy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif -static void -yy_fatal_error(yyconst char *msg) +static void yy_fatal_error (yyconst char* msg ) { - (void)fprintf(stderr, "%s\n", msg); - exit(YY_EXIT_FAILURE); + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless -#define yyless(n) \ - do { \ - /* Undo effects of setting up H5LTyytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg); \ - H5LTyytext[H5LTyyleng] = (yy_hold_char); \ - (yy_c_buf_p) = H5LTyytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - H5LTyyleng = yyless_macro_arg; \ - } while (0) +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up H5LTyytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + H5LTyytext[H5LTyyleng] = (yy_hold_char); \ + (yy_c_buf_p) = H5LTyytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + H5LTyyleng = yyless_macro_arg; \ + } \ + while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. - * + * */ -int -H5LTyyget_lineno(void) +int H5LTyyget_lineno (void) { - + return H5LTyylineno; } /** Get the input stream. - * + * */ -FILE * -H5LTyyget_in(void) +FILE *H5LTyyget_in (void) { - return H5LTyyin; + return H5LTyyin; } /** Get the output stream. - * + * */ -FILE * -H5LTyyget_out(void) +FILE *H5LTyyget_out (void) { - return H5LTyyout; + return H5LTyyout; } /** Get the length of the current token. - * + * */ -yy_size_t -H5LTyyget_leng(void) +yy_size_t H5LTyyget_leng (void) { - return H5LTyyleng; + return H5LTyyleng; } /** Get the current token. - * + * */ -char * -H5LTyyget_text(void) +char *H5LTyyget_text (void) { - return H5LTyytext; + return H5LTyytext; } /** Set the current line number. * @param line_number - * + * */ -void -H5LTyyset_lineno(int line_number) +void H5LTyyset_lineno (int line_number ) { - + H5LTyylineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. - * + * * @see H5LTyy_switch_to_buffer */ -void -H5LTyyset_in(FILE *in_str) +void H5LTyyset_in (FILE * in_str ) { - H5LTyyin = in_str; + H5LTyyin = in_str ; } -void -H5LTyyset_out(FILE *out_str) +void H5LTyyset_out (FILE * out_str ) { - H5LTyyout = out_str; + H5LTyyout = out_str ; } -int -H5LTyyget_debug(void) +int H5LTyyget_debug (void) { - return H5LTyy_flex_debug; + return H5LTyy_flex_debug; } -void -H5LTyyset_debug(int bdebug) +void H5LTyyset_debug (int bdebug ) { - H5LTyy_flex_debug = bdebug; + H5LTyy_flex_debug = bdebug ; } -static int -yy_init_globals(void) +static int yy_init_globals (void) { - /* Initialization is the same as for the non-reentrant scanner. + /* Initialization is the same as for the non-reentrant scanner. * This function is called from H5LTyylex_destroy(), so don't allocate here. */ - (yy_buffer_stack) = 0; + (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *)0; - (yy_init) = 0; - (yy_start) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; - (yy_state_buf) = 0; - (yy_state_ptr) = 0; + (yy_state_buf) = 0; + (yy_state_ptr) = 0; (yy_full_match) = 0; - (yy_lp) = 0; + (yy_lp) = 0; /* Defined in main.c */ #ifdef YY_STDINIT - H5LTyyin = stdin; + H5LTyyin = stdin; H5LTyyout = stdout; #else - H5LTyyin = (FILE *)0; - H5LTyyout = (FILE *)0; + H5LTyyin = (FILE *) 0; + H5LTyyout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by @@ -2347,27 +2473,26 @@ yy_init_globals(void) } /* H5LTyylex_destroy is for both reentrant and non-reentrant scanners. */ -int -H5LTyylex_destroy(void) +int H5LTyylex_destroy (void) { - + /* Pop the buffer stack, destroying each element. */ - while (YY_CURRENT_BUFFER) { - H5LTyy_delete_buffer(YY_CURRENT_BUFFER); - YY_CURRENT_BUFFER_LVALUE = NULL; - H5LTyypop_buffer_state(); - } + while(YY_CURRENT_BUFFER){ + H5LTyy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + H5LTyypop_buffer_state(); + } - /* Destroy the stack itself. */ - H5LTyyfree((yy_buffer_stack)); - (yy_buffer_stack) = NULL; + /* Destroy the stack itself. */ + H5LTyyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; - H5LTyyfree((yy_state_buf)); - (yy_state_buf) = NULL; + H5LTyyfree ( (yy_state_buf) ); + (yy_state_buf) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * H5LTyylex() is called, initialization will occur. */ - yy_init_globals(); + yy_init_globals( ); return 0; } @@ -2377,75 +2502,69 @@ H5LTyylex_destroy(void) */ #ifndef yytext_ptr -static void -yy_flex_strncpy(char *s1, yyconst char *s2, int n) +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { - register int i; - for (i = 0; i < n; ++i) - s1[i] = s2[i]; + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN -static int -yy_flex_strlen(yyconst char *s) +static int yy_flex_strlen (yyconst char * s ) { - register int n; - for (n = 0; s[n]; ++n) - ; + register int n; + for ( n = 0; s[n]; ++n ) + ; - return n; + return n; } #endif -void * -H5LTyyalloc(yy_size_t size) +void *H5LTyyalloc (yy_size_t size ) { - return (void *)malloc(size); + return (void *) malloc( size ); } -void * -H5LTyyrealloc(void *ptr, yy_size_t size) +void *H5LTyyrealloc (void * ptr, yy_size_t size ) { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *)realloc((char *)ptr, size); + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); } -void -H5LTyyfree(void *ptr) +void H5LTyyfree (void * ptr ) { - free((char *)ptr); /* see H5LTyyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see H5LTyyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 185 "hl/src/H5LTanalyze.l" +#line 179 "hl/src/H5LTanalyze.l" + -int -my_yyinput(char *buf, int max_size) +int my_yyinput(char *buf, int max_size) { - int ret; + int ret; - memcpy(buf, myinput, input_len); - ret = (int)input_len; - return ret; + memcpy(buf, myinput, input_len); + ret = (int)input_len; + return ret; } -int -H5LTyyerror(const char *msg) +int H5LTyyerror(const char *msg) { - printf("ERROR: %s before \"%s\".\n", msg, H5LTyytext); - return 0; + printf("ERROR: %s before \"%s\".\n", msg, H5LTyytext); + return 0; } -int -H5LTyywrap() +int H5LTyywrap() { - return (1); + return(1); } + diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l index 5015053..04d3321 100644 --- a/hl/src/H5LTanalyze.l +++ b/hl/src/H5LTanalyze.l @@ -23,11 +23,6 @@ #include #include "H5LTparse.h" -/* Turn off suggest const & malloc attribute warnings in gcc */ -#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ -#pragma GCC diagnostic ignored "-Wsuggest-attribute=const" -#endif - int my_yyinput(char *, int); #undef YY_INPUT #define YY_INPUT(b, r, ms) (r=my_yyinput(b, ms)) @@ -124,9 +119,9 @@ STRSIZE {return token(STRSIZE_TOKEN);} STRPAD {return token(STRPAD_TOKEN);} CSET {return token(CSET_TOKEN);} CTYPE {return token(CTYPE_TOKEN);} -H5T_STR_NULLTERM {return token(H5T_STR_NULLTERM_TOKEN);} -H5T_STR_NULLPAD {return token(H5T_STR_NULLPAD_TOKEN);} -H5T_STR_SPACEPAD {return token(H5T_STR_SPACEPAD_TOKEN);} +H5T_STR_NULLTERM {return token(H5T_STR_NULLTERM_TOKEN);} +H5T_STR_NULLPAD {return token(H5T_STR_NULLPAD_TOKEN);} +H5T_STR_SPACEPAD {return token(H5T_STR_SPACEPAD_TOKEN);} H5T_CSET_ASCII {return token(H5T_CSET_ASCII_TOKEN);} H5T_CSET_UTF8 {return token(H5T_CSET_UTF8_TOKEN);} H5T_C_S1 {return token(H5T_C_S1_TOKEN);} @@ -142,19 +137,19 @@ H5T_OPAQUE {return token(H5T_OPAQUE_TOKEN);} OPQ_SIZE {return token(OPQ_SIZE_TOKEN);} OPQ_TAG {return token(OPQ_TAG_TOKEN);} -[0-9]+ { - if( is_str_size || (is_enum && is_enum_memb) || +[0-9]+ { + if( is_str_size || (is_enum && is_enum_memb) || is_opq_size || (asindex>-1 && arr_stack[asindex].is_dim) || (csindex>-1 && cmpd_stack[csindex].is_field) ) { H5LTyylval.ival = atoi(yytext); - return NUMBER; + return NUMBER; } else REJECT; } "\"" { /*if it's first quote, and is a compound field name or an enum symbol*/ - if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field)) + if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field)) && first_quote) { first_quote = 0; BEGIN TAG_STRING; @@ -171,7 +166,7 @@ OPQ_TAG {return token(OPQ_TAG_TOKEN);} BEGIN INITIAL; return STRING; } - + "{" {return token('{');} "}" {return token('}');} "[" {return token('[');} @@ -185,8 +180,8 @@ OPQ_TAG {return token(OPQ_TAG_TOKEN);} int my_yyinput(char *buf, int max_size) { int ret; - - memcpy(buf, myinput, input_len); + + memcpy(buf, myinput, input_len); ret = (int)input_len; return ret; } diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c index c672ae0..80de0a2 100644 --- a/hl/src/H5LTparse.c +++ b/hl/src/H5LTparse.c @@ -1,30 +1,37 @@ -#if defined __GNUC__ && 402 <= __GNUC__ * 100 + __GNUC_MINOR__ -#pragma GCC diagnostic ignored "-Wconversion" -#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" -#pragma GCC diagnostic ignored "-Wlarger-than=" -#pragma GCC diagnostic ignored "-Wmissing-prototypes" -#pragma GCC diagnostic ignored "-Wnested-externs" -#pragma GCC diagnostic ignored "-Wold-style-definition" -#pragma GCC diagnostic ignored "-Wredundant-decls" -#pragma GCC diagnostic ignored "-Wsign-compare" -#pragma GCC diagnostic ignored "-Wsign-conversion" -#pragma GCC diagnostic ignored "-Wstrict-overflow" -#pragma GCC diagnostic ignored "-Wstrict-prototypes" -#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" -#pragma GCC diagnostic ignored "-Wswitch-default" -#pragma GCC diagnostic ignored "-Wunused-function" -#pragma GCC diagnostic ignored "-Wunused-macros" -#pragma GCC diagnostic ignored "-Wunused-parameter" -#elif defined __SUNPRO_CC -#pragma disable_warn -#elif defined _MSC_VER -#pragma warning(push, 1) -#endif -/* A Bison parser, made by GNU Bison 2.7. */ +#if defined (__GNUC__) +#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" +#pragma GCC diagnostic ignored "-Wlarger-than=" +#pragma GCC diagnostic ignored "-Wmissing-prototypes" +#pragma GCC diagnostic ignored "-Wnested-externs" +#pragma GCC diagnostic ignored "-Wold-style-definition" +#pragma GCC diagnostic ignored "-Wredundant-decls" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wstrict-overflow" +#pragma GCC diagnostic ignored "-Wstrict-prototypes" +#pragma GCC diagnostic ignored "-Wsuggest-attribute=const" +#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" +#pragma GCC diagnostic ignored "-Wswitch-default" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-macros" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif +#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 600 +#pragma GCC diagnostic ignored "-Wnull-dereference" +#endif +#elif defined __SUNPRO_CC +#pragma disable_warn +#elif defined _MSC_VER +#pragma warning(push, 1) +#endif +/* A Bison parser, made by GNU Bison 3.7.2. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -55,6 +62,10 @@ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or yy_. They are + private implementation details that can be changed or removed. */ + /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. @@ -66,7 +77,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.7" +#define YYBISON_VERSION "3.7.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -80,17 +91,17 @@ /* Pull parsers. */ #define YYPULL 1 + /* Substitute the variable and function names. */ -#define yyparse H5LTyyparse -#define yylex H5LTyylex -#define yyerror H5LTyyerror -#define yylval H5LTyylval -#define yychar H5LTyychar -#define yydebug H5LTyydebug -#define yynerrs H5LTyynerrs - -/* Copy the first part of user declarations. */ -/* Line 371 of yacc.c */ +#define yyparse H5LTyyparse +#define yylex H5LTyylex +#define yyerror H5LTyyerror +#define yydebug H5LTyydebug +#define yynerrs H5LTyynerrs +#define yylval H5LTyylval +#define yychar H5LTyychar + +/* First part of user prologue. */ #line 20 "hl/src/H5LTparse.y" #include @@ -100,801 +111,920 @@ extern int yylex(); extern int yyerror(const char *); -#define STACK_SIZE 16 +#define STACK_SIZE 16 /*structure for compound type information*/ struct cmpd_info { - hid_t id; /*type ID*/ - hbool_t is_field; /*flag to lexer for compound member*/ - hbool_t first_memb; /*flag for first compound member*/ + hid_t id; /*type ID*/ + hbool_t is_field; /*flag to lexer for compound member*/ + hbool_t first_memb; /*flag for first compound member*/ }; /*stack for nested compound type*/ -struct cmpd_info cmpd_stack[STACK_SIZE] = {{0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, - {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, - {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}}; +struct cmpd_info cmpd_stack[STACK_SIZE] = { + {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, + {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, + {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, + {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1} }; -int csindex = -1; /*pointer to the top of compound stack*/ +int csindex = -1; /*pointer to the top of compound stack*/ /*structure for array type information*/ struct arr_info { - hsize_t dims[H5S_MAX_RANK]; /*size of each dimension, limited to 32 dimensions*/ - unsigned ndims; /*number of dimensions*/ - hbool_t is_dim; /*flag to lexer for dimension*/ + hsize_t dims[H5S_MAX_RANK]; /*size of each dimension, limited to 32 dimensions*/ + unsigned ndims; /*number of dimensions*/ + hbool_t is_dim; /*flag to lexer for dimension*/ }; /*stack for nested array type*/ struct arr_info arr_stack[STACK_SIZE]; -int asindex = -1; /*pointer to the top of array stack*/ - -hbool_t is_str_size = 0; /*flag to lexer for string size*/ -hbool_t is_str_pad = 0; /*flag to lexer for string padding*/ -H5T_str_t str_pad; /*variable for string padding*/ -H5T_cset_t str_cset; /*variable for string character set*/ -hbool_t is_variable = 0; /*variable for variable-length string*/ -size_t str_size; /*variable for string size*/ - -hid_t enum_id; /*type ID*/ -hbool_t is_enum = 0; /*flag to lexer for enum type*/ -hbool_t is_enum_memb = 0; /*flag to lexer for enum member*/ -char * enum_memb_symbol; /*enum member symbol string*/ +int asindex = -1; /*pointer to the top of array stack*/ + +hbool_t is_str_size = 0; /*flag to lexer for string size*/ +hbool_t is_str_pad = 0; /*flag to lexer for string padding*/ +H5T_str_t str_pad; /*variable for string padding*/ +H5T_cset_t str_cset; /*variable for string character set*/ +hbool_t is_variable = 0; /*variable for variable-length string*/ +size_t str_size; /*variable for string size*/ + +hid_t enum_id; /*type ID*/ +hbool_t is_enum = 0; /*flag to lexer for enum type*/ +hbool_t is_enum_memb = 0; /*flag to lexer for enum member*/ +char* enum_memb_symbol; /*enum member symbol string*/ + +hbool_t is_opq_size = 0; /*flag to lexer for opaque type size*/ +hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/ + + +#line 131 "hl/src/H5LTparse.c" + +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) +# else +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif +# ifndef YY_NULLPTR +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# else +# define YY_NULLPTR ((void*)0) +# endif +# endif + +#include "H5LTparse.h" +/* Symbol kind. */ +enum yysymbol_kind_t +{ + YYSYMBOL_YYEMPTY = -2, + YYSYMBOL_YYEOF = 0, /* "end of file" */ + YYSYMBOL_YYerror = 1, /* error */ + YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ + YYSYMBOL_H5T_STD_I8BE_TOKEN = 3, /* H5T_STD_I8BE_TOKEN */ + YYSYMBOL_H5T_STD_I8LE_TOKEN = 4, /* H5T_STD_I8LE_TOKEN */ + YYSYMBOL_H5T_STD_I16BE_TOKEN = 5, /* H5T_STD_I16BE_TOKEN */ + YYSYMBOL_H5T_STD_I16LE_TOKEN = 6, /* H5T_STD_I16LE_TOKEN */ + YYSYMBOL_H5T_STD_I32BE_TOKEN = 7, /* H5T_STD_I32BE_TOKEN */ + YYSYMBOL_H5T_STD_I32LE_TOKEN = 8, /* H5T_STD_I32LE_TOKEN */ + YYSYMBOL_H5T_STD_I64BE_TOKEN = 9, /* H5T_STD_I64BE_TOKEN */ + YYSYMBOL_H5T_STD_I64LE_TOKEN = 10, /* H5T_STD_I64LE_TOKEN */ + YYSYMBOL_H5T_STD_U8BE_TOKEN = 11, /* H5T_STD_U8BE_TOKEN */ + YYSYMBOL_H5T_STD_U8LE_TOKEN = 12, /* H5T_STD_U8LE_TOKEN */ + YYSYMBOL_H5T_STD_U16BE_TOKEN = 13, /* H5T_STD_U16BE_TOKEN */ + YYSYMBOL_H5T_STD_U16LE_TOKEN = 14, /* H5T_STD_U16LE_TOKEN */ + YYSYMBOL_H5T_STD_U32BE_TOKEN = 15, /* H5T_STD_U32BE_TOKEN */ + YYSYMBOL_H5T_STD_U32LE_TOKEN = 16, /* H5T_STD_U32LE_TOKEN */ + YYSYMBOL_H5T_STD_U64BE_TOKEN = 17, /* H5T_STD_U64BE_TOKEN */ + YYSYMBOL_H5T_STD_U64LE_TOKEN = 18, /* H5T_STD_U64LE_TOKEN */ + YYSYMBOL_H5T_NATIVE_CHAR_TOKEN = 19, /* H5T_NATIVE_CHAR_TOKEN */ + YYSYMBOL_H5T_NATIVE_SCHAR_TOKEN = 20, /* H5T_NATIVE_SCHAR_TOKEN */ + YYSYMBOL_H5T_NATIVE_UCHAR_TOKEN = 21, /* H5T_NATIVE_UCHAR_TOKEN */ + YYSYMBOL_H5T_NATIVE_SHORT_TOKEN = 22, /* H5T_NATIVE_SHORT_TOKEN */ + YYSYMBOL_H5T_NATIVE_USHORT_TOKEN = 23, /* H5T_NATIVE_USHORT_TOKEN */ + YYSYMBOL_H5T_NATIVE_INT_TOKEN = 24, /* H5T_NATIVE_INT_TOKEN */ + YYSYMBOL_H5T_NATIVE_UINT_TOKEN = 25, /* H5T_NATIVE_UINT_TOKEN */ + YYSYMBOL_H5T_NATIVE_LONG_TOKEN = 26, /* H5T_NATIVE_LONG_TOKEN */ + YYSYMBOL_H5T_NATIVE_ULONG_TOKEN = 27, /* H5T_NATIVE_ULONG_TOKEN */ + YYSYMBOL_H5T_NATIVE_LLONG_TOKEN = 28, /* H5T_NATIVE_LLONG_TOKEN */ + YYSYMBOL_H5T_NATIVE_ULLONG_TOKEN = 29, /* H5T_NATIVE_ULLONG_TOKEN */ + YYSYMBOL_H5T_IEEE_F32BE_TOKEN = 30, /* H5T_IEEE_F32BE_TOKEN */ + YYSYMBOL_H5T_IEEE_F32LE_TOKEN = 31, /* H5T_IEEE_F32LE_TOKEN */ + YYSYMBOL_H5T_IEEE_F64BE_TOKEN = 32, /* H5T_IEEE_F64BE_TOKEN */ + YYSYMBOL_H5T_IEEE_F64LE_TOKEN = 33, /* H5T_IEEE_F64LE_TOKEN */ + YYSYMBOL_H5T_NATIVE_FLOAT_TOKEN = 34, /* H5T_NATIVE_FLOAT_TOKEN */ + YYSYMBOL_H5T_NATIVE_DOUBLE_TOKEN = 35, /* H5T_NATIVE_DOUBLE_TOKEN */ + YYSYMBOL_H5T_NATIVE_LDOUBLE_TOKEN = 36, /* H5T_NATIVE_LDOUBLE_TOKEN */ + YYSYMBOL_H5T_STRING_TOKEN = 37, /* H5T_STRING_TOKEN */ + YYSYMBOL_STRSIZE_TOKEN = 38, /* STRSIZE_TOKEN */ + YYSYMBOL_STRPAD_TOKEN = 39, /* STRPAD_TOKEN */ + YYSYMBOL_CSET_TOKEN = 40, /* CSET_TOKEN */ + YYSYMBOL_CTYPE_TOKEN = 41, /* CTYPE_TOKEN */ + YYSYMBOL_H5T_VARIABLE_TOKEN = 42, /* H5T_VARIABLE_TOKEN */ + YYSYMBOL_H5T_STR_NULLTERM_TOKEN = 43, /* H5T_STR_NULLTERM_TOKEN */ + YYSYMBOL_H5T_STR_NULLPAD_TOKEN = 44, /* H5T_STR_NULLPAD_TOKEN */ + YYSYMBOL_H5T_STR_SPACEPAD_TOKEN = 45, /* H5T_STR_SPACEPAD_TOKEN */ + YYSYMBOL_H5T_CSET_ASCII_TOKEN = 46, /* H5T_CSET_ASCII_TOKEN */ + YYSYMBOL_H5T_CSET_UTF8_TOKEN = 47, /* H5T_CSET_UTF8_TOKEN */ + YYSYMBOL_H5T_C_S1_TOKEN = 48, /* H5T_C_S1_TOKEN */ + YYSYMBOL_H5T_FORTRAN_S1_TOKEN = 49, /* H5T_FORTRAN_S1_TOKEN */ + YYSYMBOL_H5T_OPAQUE_TOKEN = 50, /* H5T_OPAQUE_TOKEN */ + YYSYMBOL_OPQ_SIZE_TOKEN = 51, /* OPQ_SIZE_TOKEN */ + YYSYMBOL_OPQ_TAG_TOKEN = 52, /* OPQ_TAG_TOKEN */ + YYSYMBOL_H5T_COMPOUND_TOKEN = 53, /* H5T_COMPOUND_TOKEN */ + YYSYMBOL_H5T_ENUM_TOKEN = 54, /* H5T_ENUM_TOKEN */ + YYSYMBOL_H5T_ARRAY_TOKEN = 55, /* H5T_ARRAY_TOKEN */ + YYSYMBOL_H5T_VLEN_TOKEN = 56, /* H5T_VLEN_TOKEN */ + YYSYMBOL_STRING = 57, /* STRING */ + YYSYMBOL_NUMBER = 58, /* NUMBER */ + YYSYMBOL_59_ = 59, /* '{' */ + YYSYMBOL_60_ = 60, /* '}' */ + YYSYMBOL_61_ = 61, /* '[' */ + YYSYMBOL_62_ = 62, /* ']' */ + YYSYMBOL_63_ = 63, /* '"' */ + YYSYMBOL_64_ = 64, /* ':' */ + YYSYMBOL_65_ = 65, /* ';' */ + YYSYMBOL_YYACCEPT = 66, /* $accept */ + YYSYMBOL_start = 67, /* start */ + YYSYMBOL_ddl_type = 68, /* ddl_type */ + YYSYMBOL_atomic_type = 69, /* atomic_type */ + YYSYMBOL_integer_type = 70, /* integer_type */ + YYSYMBOL_fp_type = 71, /* fp_type */ + YYSYMBOL_compound_type = 72, /* compound_type */ + YYSYMBOL_73_1 = 73, /* $@1 */ + YYSYMBOL_memb_list = 74, /* memb_list */ + YYSYMBOL_memb_def = 75, /* memb_def */ + YYSYMBOL_76_2 = 76, /* $@2 */ + YYSYMBOL_field_name = 77, /* field_name */ + YYSYMBOL_field_offset = 78, /* field_offset */ + YYSYMBOL_offset = 79, /* offset */ + YYSYMBOL_array_type = 80, /* array_type */ + YYSYMBOL_81_3 = 81, /* $@3 */ + YYSYMBOL_dim_list = 82, /* dim_list */ + YYSYMBOL_dim = 83, /* dim */ + YYSYMBOL_84_4 = 84, /* $@4 */ + YYSYMBOL_85_5 = 85, /* $@5 */ + YYSYMBOL_dimsize = 86, /* dimsize */ + YYSYMBOL_vlen_type = 87, /* vlen_type */ + YYSYMBOL_opaque_type = 88, /* opaque_type */ + YYSYMBOL_89_6 = 89, /* $@6 */ + YYSYMBOL_90_7 = 90, /* @7 */ + YYSYMBOL_91_8 = 91, /* $@8 */ + YYSYMBOL_92_9 = 92, /* $@9 */ + YYSYMBOL_opaque_size = 93, /* opaque_size */ + YYSYMBOL_opaque_tag = 94, /* opaque_tag */ + YYSYMBOL_string_type = 95, /* string_type */ + YYSYMBOL_96_10 = 96, /* $@10 */ + YYSYMBOL_97_11 = 97, /* $@11 */ + YYSYMBOL_98_12 = 98, /* $@12 */ + YYSYMBOL_99_13 = 99, /* $@13 */ + YYSYMBOL_100_14 = 100, /* @14 */ + YYSYMBOL_strsize = 101, /* strsize */ + YYSYMBOL_strpad = 102, /* strpad */ + YYSYMBOL_cset = 103, /* cset */ + YYSYMBOL_ctype = 104, /* ctype */ + YYSYMBOL_enum_type = 105, /* enum_type */ + YYSYMBOL_106_15 = 106, /* $@15 */ + YYSYMBOL_enum_list = 107, /* enum_list */ + YYSYMBOL_enum_def = 108, /* enum_def */ + YYSYMBOL_109_16 = 109, /* $@16 */ + YYSYMBOL_enum_symbol = 110, /* enum_symbol */ + YYSYMBOL_enum_val = 111 /* enum_val */ +}; +typedef enum yysymbol_kind_t yysymbol_kind_t; -hbool_t is_opq_size = 0; /*flag to lexer for opaque type size*/ -hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/ -/* Line 371 of yacc.c */ -#line 128 "hl/src/H5LTparse.c" -#ifndef YY_NULL -#if defined __cplusplus && 201103L <= __cplusplus -#define YY_NULL nullptr -#else -#define YY_NULL 0 -#endif -#endif -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -#undef YYERROR_VERBOSE -#define YYERROR_VERBOSE 1 -#else -#define YYERROR_VERBOSE 0 -#endif - -/* In a future release of Bison, this section will be replaced - by #include "H5LTparse.h". */ -#ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED -#define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED -/* Enabling traces. */ -#ifndef YYDEBUG -#define YYDEBUG 0 -#endif -#if YYDEBUG -extern int H5LTyydebug; +#ifdef short +# undef short #endif -/* Tokens. */ -#ifndef YYTOKENTYPE -#define YYTOKENTYPE -/* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ -enum yytokentype { - H5T_STD_I8BE_TOKEN = 258, - H5T_STD_I8LE_TOKEN = 259, - H5T_STD_I16BE_TOKEN = 260, - H5T_STD_I16LE_TOKEN = 261, - H5T_STD_I32BE_TOKEN = 262, - H5T_STD_I32LE_TOKEN = 263, - H5T_STD_I64BE_TOKEN = 264, - H5T_STD_I64LE_TOKEN = 265, - H5T_STD_U8BE_TOKEN = 266, - H5T_STD_U8LE_TOKEN = 267, - H5T_STD_U16BE_TOKEN = 268, - H5T_STD_U16LE_TOKEN = 269, - H5T_STD_U32BE_TOKEN = 270, - H5T_STD_U32LE_TOKEN = 271, - H5T_STD_U64BE_TOKEN = 272, - H5T_STD_U64LE_TOKEN = 273, - H5T_NATIVE_CHAR_TOKEN = 274, - H5T_NATIVE_SCHAR_TOKEN = 275, - H5T_NATIVE_UCHAR_TOKEN = 276, - H5T_NATIVE_SHORT_TOKEN = 277, - H5T_NATIVE_USHORT_TOKEN = 278, - H5T_NATIVE_INT_TOKEN = 279, - H5T_NATIVE_UINT_TOKEN = 280, - H5T_NATIVE_LONG_TOKEN = 281, - H5T_NATIVE_ULONG_TOKEN = 282, - H5T_NATIVE_LLONG_TOKEN = 283, - H5T_NATIVE_ULLONG_TOKEN = 284, - H5T_IEEE_F32BE_TOKEN = 285, - H5T_IEEE_F32LE_TOKEN = 286, - H5T_IEEE_F64BE_TOKEN = 287, - H5T_IEEE_F64LE_TOKEN = 288, - H5T_NATIVE_FLOAT_TOKEN = 289, - H5T_NATIVE_DOUBLE_TOKEN = 290, - H5T_NATIVE_LDOUBLE_TOKEN = 291, - H5T_STRING_TOKEN = 292, - STRSIZE_TOKEN = 293, - STRPAD_TOKEN = 294, - CSET_TOKEN = 295, - CTYPE_TOKEN = 296, - H5T_VARIABLE_TOKEN = 297, - H5T_STR_NULLTERM_TOKEN = 298, - H5T_STR_NULLPAD_TOKEN = 299, - H5T_STR_SPACEPAD_TOKEN = 300, - H5T_CSET_ASCII_TOKEN = 301, - H5T_CSET_UTF8_TOKEN = 302, - H5T_C_S1_TOKEN = 303, - H5T_FORTRAN_S1_TOKEN = 304, - H5T_OPAQUE_TOKEN = 305, - OPQ_SIZE_TOKEN = 306, - OPQ_TAG_TOKEN = 307, - H5T_COMPOUND_TOKEN = 308, - H5T_ENUM_TOKEN = 309, - H5T_ARRAY_TOKEN = 310, - H5T_VLEN_TOKEN = 311, - STRING = 312, - NUMBER = 313 -}; -#endif +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure + and (if available) are included + so that the code can choose integer types of a good width. */ -#if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE { -/* Line 387 of yacc.c */ -#line 72 "hl/src/H5LTparse.y" - - int ival; /*for integer token*/ - char *sval; /*for name string*/ - hid_t hid; /*for hid_t token*/ - -/* Line 387 of yacc.c */ -#line 236 "hl/src/H5LTparse.c" -} YYSTYPE; -#define YYSTYPE_IS_TRIVIAL 1 -#define yystype YYSTYPE /* obsolescent; will be withdrawn */ -#define YYSTYPE_IS_DECLARED 1 +#ifndef __PTRDIFF_MAX__ +# include /* INFRINGES ON USER NAME SPACE */ +# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_STDINT_H +# endif #endif -extern YYSTYPE H5LTyylval; +/* Narrow types that promote to a signed type and that can represent a + signed or unsigned integer of at least N bits. In tables they can + save space and decrease cache pressure. Promoting to a signed type + helps avoid bugs in integer arithmetic. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -hid_t H5LTyyparse(void *YYPARSE_PARAM); +#ifdef __INT_LEAST8_MAX__ +typedef __INT_LEAST8_TYPE__ yytype_int8; +#elif defined YY_STDINT_H +typedef int_least8_t yytype_int8; #else -hid_t H5LTyyparse(); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -hid_t H5LTyyparse(void); -#else -hid_t H5LTyyparse(); -#endif -#endif /* ! YYPARSE_PARAM */ - -#endif /* !YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED */ - -/* Copy the second part of user declarations. */ - -/* Line 390 of yacc.c */ -#line 264 "hl/src/H5LTparse.c" - -#ifdef short -#undef short +typedef signed char yytype_int8; #endif -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; +#ifdef __INT_LEAST16_MAX__ +typedef __INT_LEAST16_TYPE__ yytype_int16; +#elif defined YY_STDINT_H +typedef int_least16_t yytype_int16; #else -typedef unsigned char yytype_uint8; +typedef short yytype_int16; #endif -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; +#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST8_TYPE__ yytype_uint8; +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST8_MAX <= INT_MAX) +typedef uint_least8_t yytype_uint8; +#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +typedef unsigned char yytype_uint8; #else -typedef short int yytype_int8; +typedef short yytype_uint8; #endif -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; +#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST16_TYPE__ yytype_uint16; +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST16_MAX <= INT_MAX) +typedef uint_least16_t yytype_uint16; +#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX +typedef unsigned short yytype_uint16; #else -typedef unsigned short int yytype_uint16; +typedef int yytype_uint16; #endif -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; +#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif #endif #ifndef YYSIZE_T -#ifdef __SIZE_TYPE__ -#define YYSIZE_T __SIZE_TYPE__ -#elif defined size_t -#define YYSIZE_T size_t -#elif !defined YYSIZE_T && \ - (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -#include /* INFRINGES ON USER NAME SPACE */ -#define YYSIZE_T size_t -#else -#define YYSIZE_T unsigned int -#endif +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned +# endif #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T)-1) +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + + +/* Stored state numbers (used for stacks). */ +typedef yytype_uint8 yy_state_t; + +/* State numbers in computations. */ +typedef int yy_state_fast_t; #ifndef YY_ -#if defined YYENABLE_NLS && YYENABLE_NLS -#if ENABLE_NLS -#include /* INFRINGES ON USER NAME SPACE */ -#define YY_(Msgid) dgettext("bison-runtime", Msgid) -#endif -#endif -#ifndef YY_ -#define YY_(Msgid) Msgid -#endif +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif #endif -/* Suppress unused-variable warnings by "using" E. */ -#if !defined lint || defined __GNUC__ -#define YYUSE(E) ((void)(E)) -#else -#define YYUSE(E) /* empty */ -#endif -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -#define YYID(N) (N) -#else -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -static int -YYID(int yyi) -#else -static int YYID(yyi) int yyi; +#ifndef YY_ATTRIBUTE_PURE +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define YY_ATTRIBUTE_PURE +# endif #endif -{ - return yyi; -} -#endif - -#if !defined yyoverflow || YYERROR_VERBOSE -/* The parser invokes alloca or malloc; define the necessary symbols. */ +#ifndef YY_ATTRIBUTE_UNUSED +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +# else +# define YY_ATTRIBUTE_UNUSED +# endif +#endif -#ifdef YYSTACK_USE_ALLOCA -#if YYSTACK_USE_ALLOCA -#ifdef __GNUC__ -#define YYSTACK_ALLOC __builtin_alloca -#elif defined __BUILTIN_VA_ARG_INCR -#include /* INFRINGES ON USER NAME SPACE */ -#elif defined _AIX -#define YYSTACK_ALLOC __alloca -#elif defined _MSC_VER -#include /* INFRINGES ON USER NAME SPACE */ -#define alloca _alloca +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) #else -#define YYSTACK_ALLOC alloca -#if !defined _ALLOCA_H && !defined EXIT_SUCCESS && \ - (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -#include /* INFRINGES ON USER NAME SPACE */ -/* Use EXIT_SUCCESS as a witness for stdlib.h. */ -#ifndef EXIT_SUCCESS -#define EXIT_SUCCESS 0 -#endif -#endif -#endif -#endif +# define YYUSE(E) /* empty */ #endif -#ifdef YYSTACK_ALLOC -/* Pacify GCC's `empty if-body' warning. */ -#define YYSTACK_FREE(Ptr) \ - do { /* empty */ \ - ; \ - } while (YYID(0)) -#ifndef YYSTACK_ALLOC_MAXIMUM -/* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -#define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -#endif +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") #else -#define YYSTACK_ALLOC YYMALLOC -#define YYSTACK_FREE YYFREE -#ifndef YYSTACK_ALLOC_MAXIMUM -#define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -#endif -#if (defined __cplusplus && !defined EXIT_SUCCESS && \ - !((defined YYMALLOC || defined malloc) && (defined YYFREE || defined free))) -#include /* INFRINGES ON USER NAME SPACE */ -#ifndef EXIT_SUCCESS -#define EXIT_SUCCESS 0 -#endif -#endif -#ifndef YYMALLOC -#define YYMALLOC malloc -#if !defined malloc && !defined EXIT_SUCCESS && \ - (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -void * malloc(YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# define YY_INITIAL_VALUE(Value) Value #endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif -#ifndef YYFREE -#define YYFREE free -#if !defined free && !defined EXIT_SUCCESS && \ - (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -void free(void *); /* INFRINGES ON USER NAME SPACE */ +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ #endif + +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") #endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END #endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ -#if (!defined yyoverflow && (!defined __cplusplus || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +#define YY_ASSERT(E) ((void) (0 && (E))) + +#if !defined yyoverflow + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined EXIT_SUCCESS +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* !defined yyoverflow */ + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ -union yyalloc { - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; +union yyalloc +{ + yy_state_t yyss_alloc; + YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ -#define YYSTACK_GAP_MAXIMUM (sizeof(union yyalloc) - 1) +# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ -#define YYSTACK_BYTES(N) ((N) * (sizeof(yytype_int16) + sizeof(YYSTYPE)) + YYSTACK_GAP_MAXIMUM) +# define YYSTACK_BYTES(N) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) -#define YYCOPY_NEEDED 1 +# define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -#define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do { \ - YYSIZE_T yynewbytes; \ - YYCOPY(&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof(*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof(*yyptr); \ - } while (YYID(0)) +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYPTRDIFF_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ + } \ + while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ -#ifndef YYCOPY -#if defined __GNUC__ && 1 < __GNUC__ -#define YYCOPY(Dst, Src, Count) __builtin_memcpy(Dst, Src, (Count) * sizeof(*(Src))) -#else -#define YYCOPY(Dst, Src, Count) \ - do { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } while (YYID(0)) -#endif -#endif +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYPTRDIFF_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 58 +#define YYFINAL 58 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 203 +#define YYLAST 203 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 66 +#define YYNTOKENS 66 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 46 +#define YYNNTS 46 /* YYNRULES -- Number of rules. */ -#define YYNRULES 95 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 143 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 313 - -#define YYTRANSLATE(YYX) ((unsigned int)(YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = { - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 63, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 64, 65, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 61, 2, 62, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 59, 2, - 60, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58}; +#define YYNRULES 95 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 143 + +/* YYMAXUTOK -- Last valid token kind. */ +#define YYMAXUTOK 313 + + +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ +#define YYTRANSLATE(YYX) \ + (0 <= (YYX) && (YYX) <= YYMAXUTOK \ + ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ + : YYSYMBOL_YYUNDEF) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex. */ +static const yytype_int8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 63, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 64, 65, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 61, 2, 62, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 59, 2, 60, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58 +}; #if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint8 yyprhs[] = { - 0, 0, 3, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, - 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, - 78, 80, 82, 84, 86, 88, 90, 92, 93, 99, 100, 103, 104, 112, 114, 115, 118, 120, 121, 128, - 129, 132, 133, 134, 140, 142, 147, 148, 149, 150, 151, 167, 169, 171, 172, 173, 174, 175, 176, 197, - 199, 201, 203, 205, 207, 209, 211, 213, 215, 216, 224, 225, 228, 229, 236, 238}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = { - 67, 0, -1, -1, 68, -1, 69, -1, 72, -1, 80, -1, 87, -1, 70, -1, 71, -1, 95, -1, 105, -1, - 88, -1, 3, -1, 4, -1, 5, -1, 6, -1, 7, -1, 8, -1, 9, -1, 10, -1, 11, -1, 12, -1, - 13, -1, 14, -1, 15, -1, 16, -1, 17, -1, 18, -1, 19, -1, 20, -1, 21, -1, 22, -1, 23, -1, - 24, -1, 25, -1, 26, -1, 27, -1, 28, -1, 29, -1, 30, -1, 31, -1, 32, -1, 33, -1, 34, -1, - 35, -1, 36, -1, -1, 53, 73, 59, 74, 60, -1, -1, 74, 75, -1, -1, 68, 76, 63, 77, 63, 78, - 65, -1, 57, -1, -1, 64, 79, -1, 58, -1, -1, 55, 81, 59, 82, 68, 60, -1, -1, 82, 83, -1, - -1, -1, 61, 84, 86, 85, 62, -1, 58, -1, 56, 59, 68, 60, -1, -1, -1, -1, -1, 50, 59, 51, - 89, 93, 65, 90, 52, 91, 63, 94, 63, 65, 92, 60, -1, 58, -1, 57, -1, -1, -1, -1, -1, -1, - 37, 59, 38, 96, 101, 65, 97, 39, 102, 65, 98, 40, 103, 65, 99, 41, 104, 65, 100, 60, -1, 42, - -1, 58, -1, 43, -1, 44, -1, 45, -1, 46, -1, 47, -1, 48, -1, 49, -1, -1, 54, 59, 70, 65, - 106, 107, 60, -1, -1, 107, 108, -1, -1, 63, 110, 63, 109, 111, 65, -1, 57, -1, 58, -1}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = { - 0, 105, 105, 106, 108, 109, 110, 111, 113, 114, 115, 116, 117, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 149, 150, 151, 152, 153, 154, 155, 159, 158, 167, 168, 170, 170, 207, 215, 216, 219, 221, 221, 230, - 231, 233, 234, 233, 241, 244, 250, 251, 256, 257, 248, 265, 267, 271, 272, 280, 289, 296, 269, 320, - 321, 323, 324, 325, 327, 328, 330, 331, 335, 334, 339, 340, 342, 342, 396, 398}; + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_int16 yyrline[] = +{ + 0, 105, 105, 106, 108, 109, 110, 111, 113, 114, + 115, 116, 117, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 149, 150, 151, 152, 153, 154, 155, 159, 158, 167, + 168, 170, 170, 207, 215, 216, 219, 221, 221, 230, + 231, 233, 234, 233, 241, 244, 250, 251, 256, 257, + 248, 265, 267, 271, 272, 280, 289, 296, 269, 320, + 321, 323, 324, 325, 327, 328, 330, 331, 335, 334, + 339, 340, 342, 342, 396, 398 +}; #endif -#if YYDEBUG || YYERROR_VERBOSE || 0 +/** Accessing symbol of state STATE. */ +#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) + +#if YYDEBUG || 0 +/* The user-facing name of the symbol whose (internal) number is + YYSYMBOL. No bounds checking. */ +static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; + /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = {"$end", - "error", - "$undefined", - "H5T_STD_I8BE_TOKEN", - "H5T_STD_I8LE_TOKEN", - "H5T_STD_I16BE_TOKEN", - "H5T_STD_I16LE_TOKEN", - "H5T_STD_I32BE_TOKEN", - "H5T_STD_I32LE_TOKEN", - "H5T_STD_I64BE_TOKEN", - "H5T_STD_I64LE_TOKEN", - "H5T_STD_U8BE_TOKEN", - "H5T_STD_U8LE_TOKEN", - "H5T_STD_U16BE_TOKEN", - "H5T_STD_U16LE_TOKEN", - "H5T_STD_U32BE_TOKEN", - "H5T_STD_U32LE_TOKEN", - "H5T_STD_U64BE_TOKEN", - "H5T_STD_U64LE_TOKEN", - "H5T_NATIVE_CHAR_TOKEN", - "H5T_NATIVE_SCHAR_TOKEN", - "H5T_NATIVE_UCHAR_TOKEN", - "H5T_NATIVE_SHORT_TOKEN", - "H5T_NATIVE_USHORT_TOKEN", - "H5T_NATIVE_INT_TOKEN", - "H5T_NATIVE_UINT_TOKEN", - "H5T_NATIVE_LONG_TOKEN", - "H5T_NATIVE_ULONG_TOKEN", - "H5T_NATIVE_LLONG_TOKEN", - "H5T_NATIVE_ULLONG_TOKEN", - "H5T_IEEE_F32BE_TOKEN", - "H5T_IEEE_F32LE_TOKEN", - "H5T_IEEE_F64BE_TOKEN", - "H5T_IEEE_F64LE_TOKEN", - "H5T_NATIVE_FLOAT_TOKEN", - "H5T_NATIVE_DOUBLE_TOKEN", - "H5T_NATIVE_LDOUBLE_TOKEN", - "H5T_STRING_TOKEN", - "STRSIZE_TOKEN", - "STRPAD_TOKEN", - "CSET_TOKEN", - "CTYPE_TOKEN", - "H5T_VARIABLE_TOKEN", - "H5T_STR_NULLTERM_TOKEN", - "H5T_STR_NULLPAD_TOKEN", - "H5T_STR_SPACEPAD_TOKEN", - "H5T_CSET_ASCII_TOKEN", - "H5T_CSET_UTF8_TOKEN", - "H5T_C_S1_TOKEN", - "H5T_FORTRAN_S1_TOKEN", - "H5T_OPAQUE_TOKEN", - "OPQ_SIZE_TOKEN", - "OPQ_TAG_TOKEN", - "H5T_COMPOUND_TOKEN", - "H5T_ENUM_TOKEN", - "H5T_ARRAY_TOKEN", - "H5T_VLEN_TOKEN", - "STRING", - "NUMBER", - "'{'", - "'}'", - "'['", - "']'", - "'\"'", - "':'", - "';'", - "$accept", - "start", - "ddl_type", - "atomic_type", - "integer_type", - "fp_type", - "compound_type", - "$@1", - "memb_list", - "memb_def", - "$@2", - "field_name", - "field_offset", - "offset", - "array_type", - "$@3", - "dim_list", - "dim", - "$@4", - "$@5", - "dimsize", - "vlen_type", - "opaque_type", - "$@6", - "@7", - "$@8", - "$@9", - "opaque_size", - "opaque_tag", - "string_type", - "$@10", - "$@11", - "$@12", - "$@13", - "@14", - "strsize", - "strpad", - "cset", - "ctype", - "enum_type", - "$@15", - "enum_list", - "enum_def", - "$@16", - "enum_symbol", - "enum_val", - YY_NULL}; +static const char *const yytname[] = +{ + "\"end of file\"", "error", "\"invalid token\"", "H5T_STD_I8BE_TOKEN", + "H5T_STD_I8LE_TOKEN", "H5T_STD_I16BE_TOKEN", "H5T_STD_I16LE_TOKEN", + "H5T_STD_I32BE_TOKEN", "H5T_STD_I32LE_TOKEN", "H5T_STD_I64BE_TOKEN", + "H5T_STD_I64LE_TOKEN", "H5T_STD_U8BE_TOKEN", "H5T_STD_U8LE_TOKEN", + "H5T_STD_U16BE_TOKEN", "H5T_STD_U16LE_TOKEN", "H5T_STD_U32BE_TOKEN", + "H5T_STD_U32LE_TOKEN", "H5T_STD_U64BE_TOKEN", "H5T_STD_U64LE_TOKEN", + "H5T_NATIVE_CHAR_TOKEN", "H5T_NATIVE_SCHAR_TOKEN", + "H5T_NATIVE_UCHAR_TOKEN", "H5T_NATIVE_SHORT_TOKEN", + "H5T_NATIVE_USHORT_TOKEN", "H5T_NATIVE_INT_TOKEN", + "H5T_NATIVE_UINT_TOKEN", "H5T_NATIVE_LONG_TOKEN", + "H5T_NATIVE_ULONG_TOKEN", "H5T_NATIVE_LLONG_TOKEN", + "H5T_NATIVE_ULLONG_TOKEN", "H5T_IEEE_F32BE_TOKEN", + "H5T_IEEE_F32LE_TOKEN", "H5T_IEEE_F64BE_TOKEN", "H5T_IEEE_F64LE_TOKEN", + "H5T_NATIVE_FLOAT_TOKEN", "H5T_NATIVE_DOUBLE_TOKEN", + "H5T_NATIVE_LDOUBLE_TOKEN", "H5T_STRING_TOKEN", "STRSIZE_TOKEN", + "STRPAD_TOKEN", "CSET_TOKEN", "CTYPE_TOKEN", "H5T_VARIABLE_TOKEN", + "H5T_STR_NULLTERM_TOKEN", "H5T_STR_NULLPAD_TOKEN", + "H5T_STR_SPACEPAD_TOKEN", "H5T_CSET_ASCII_TOKEN", "H5T_CSET_UTF8_TOKEN", + "H5T_C_S1_TOKEN", "H5T_FORTRAN_S1_TOKEN", "H5T_OPAQUE_TOKEN", + "OPQ_SIZE_TOKEN", "OPQ_TAG_TOKEN", "H5T_COMPOUND_TOKEN", + "H5T_ENUM_TOKEN", "H5T_ARRAY_TOKEN", "H5T_VLEN_TOKEN", "STRING", + "NUMBER", "'{'", "'}'", "'['", "']'", "'\"'", "':'", "';'", "$accept", + "start", "ddl_type", "atomic_type", "integer_type", "fp_type", + "compound_type", "$@1", "memb_list", "memb_def", "$@2", "field_name", + "field_offset", "offset", "array_type", "$@3", "dim_list", "dim", "$@4", + "$@5", "dimsize", "vlen_type", "opaque_type", "$@6", "@7", "$@8", "$@9", + "opaque_size", "opaque_tag", "string_type", "$@10", "$@11", "$@12", + "$@13", "@14", "strsize", "strpad", "cset", "ctype", "enum_type", "$@15", + "enum_list", "enum_def", "$@16", "enum_symbol", "enum_val", YY_NULLPTR +}; + +static const char * +yysymbol_name (yysymbol_kind_t yysymbol) +{ + return yytname[yysymbol]; +} #endif #ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = {0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, - 311, 312, 313, 123, 125, 91, 93, 34, 58, 59}; +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_int16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 123, + 125, 91, 93, 34, 58, 59 +}; #endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = { - 0, 66, 67, 67, 68, 68, 68, 68, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 71, 71, 71, 71, 71, 71, 71, 73, 72, 74, 74, 76, 75, 77, 78, 78, 79, 81, 80, 82, - 82, 84, 85, 83, 86, 87, 89, 90, 91, 92, 88, 93, 94, 96, 97, 98, 99, 100, 95, 101, - 101, 102, 102, 102, 103, 103, 104, 104, 106, 105, 107, 107, 109, 108, 110, 111}; - -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = {0, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, - 5, 0, 2, 0, 7, 1, 0, 2, 1, 0, 6, 0, 2, 0, 0, 5, 1, 4, 0, 0, 0, 0, 15, 1, - 1, 0, 0, 0, 0, 0, 20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 7, 0, 2, 0, 6, 1, 1}; - -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = { - 2, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 0, 0, 47, 0, 57, 0, 0, 3, 4, 8, 9, 5, 6, - 7, 12, 10, 11, 0, 0, 0, 0, 0, 0, 1, 73, 66, 49, 0, 59, 0, 0, 0, 0, 88, 0, 65, 79, - 80, 0, 71, 0, 48, 51, 50, 90, 61, 0, 60, 74, 67, 0, 0, 0, 58, 0, 0, 0, 89, 0, 91, 64, - 62, 0, 68, 53, 0, 94, 0, 0, 81, 82, 83, 0, 0, 54, 92, 63, 75, 0, 0, 0, 0, 0, 72, 0, - 56, 55, 52, 95, 0, 0, 0, 93, 84, 85, 0, 69, 76, 0, 0, 70, 0, 86, 87, 0, 77, 0, 78}; - -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = { - -1, 41, 42, 43, 44, 45, 46, 54, 67, 78, 85, 100, 115, 121, 47, 56, 69, 82, 87, 103, 96, 48, 49, - 66, 90, 108, 133, 75, 119, 50, 65, 89, 117, 134, 141, 73, 107, 130, 139, 51, 79, 86, 94, 116, 102, 124}; - -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -25 -static const yytype_int16 yypact[] = { - 114, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -24, -20, -25, -15, -25, -14, 49, - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, 19, 45, 38, 168, 39, 114, -25, -25, -25, -25, 34, - -25, 40, -4, 43, 56, -25, -3, -25, -25, -25, 37, -25, 42, -25, -25, -25, -25, -25, 44, -25, -25, - -25, 50, -23, 47, -25, 64, 62, 51, -25, 58, -25, -25, -25, -2, -25, -25, 89, -25, 90, 92, -25, - -25, -25, 91, 94, 95, -25, -25, -25, 98, 100, 96, 102, 122, -25, 103, -25, -25, -25, -25, 133, 9, - 134, -25, -25, -25, 135, -25, -25, 105, 160, -25, 46, -25, -25, 137, -25, 143, -25}; - -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = {-25, -25, -21, -25, 108, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, -25, -25, -25, -25, -25}; - -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 -static const yytype_uint8 yytable[] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 52, 64, 92, 71, 53, 93, 104, - 105, 106, 55, 57, 77, 36, 81, 58, 37, 38, 39, 40, 72, 128, 129, 59, 80, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 137, 138, 60, 61, 63, 68, 70, 74, 83, 97, 88, - 95, 36, 84, 99, 37, 38, 39, 40, 91, 98, 101, 76, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 109, 110, 111, 118, 112, 113, 120, 114, 123, 122, 125, 62, 36, 135, 126, 37, - 38, 39, 40, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 127, 131, 132, 136, 140, 142}; - -#define yypact_value_is_default(Yystate) (!!((Yystate) == (-25))) - -#define yytable_value_is_error(Yytable_value) YYID(0) - -static const yytype_uint8 yycheck[] = { - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 59, 57, 60, 42, 59, 63, 43, 44, 45, 59, 59, 67, 50, 69, 0, 53, 54, - 55, 56, 58, 46, 47, 38, 61, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 48, 49, 51, 59, 59, 65, 60, 58, 65, 39, - 60, 58, 50, 65, 57, 53, 54, 55, 56, 63, 52, 57, 60, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 63, 63, 62, 57, - 65, 63, 58, 64, 58, 65, 40, 55, 50, 60, 63, 53, 54, 55, 56, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 65, 65, 65, 41, 65, 60}; - -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = { - 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 50, 53, 54, 55, 56, 67, - 68, 69, 70, 71, 72, 80, 87, 88, 95, 105, 59, 59, 73, 59, 81, 59, 0, 38, 51, 59, 70, - 59, 68, 96, 89, 74, 65, 82, 60, 42, 58, 101, 58, 93, 60, 68, 75, 106, 61, 68, 83, 65, - 65, 76, 107, 84, 60, 97, 90, 63, 60, 63, 108, 58, 86, 39, 52, 57, 77, 57, 110, 85, 43, - 44, 45, 102, 91, 63, 63, 62, 65, 63, 64, 78, 109, 98, 57, 94, 58, 79, 65, 58, 111, 40, - 63, 65, 46, 47, 103, 65, 65, 92, 99, 60, 41, 48, 49, 104, 65, 100, 60}; - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ - -#define YYFAIL goto yyerrlab -#if defined YYFAIL -/* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif +#define YYPACT_NINF (-25) -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ - do \ - if (yychar == YYEMPTY) { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK(yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else { \ - yyerror(YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ - while (YYID(0)) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -#define YY_LOCATION_PRINT(File, Loc) ((void)0) -#endif +#define YYTABLE_NINF (-1) + +#define yytable_value_is_error(Yyn) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = +{ + 114, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -24, -20, -25, -15, -25, + -14, 49, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, 19, 45, 38, 168, 39, 114, -25, -25, + -25, -25, 34, -25, 40, -4, 43, 56, -25, -3, + -25, -25, -25, 37, -25, 42, -25, -25, -25, -25, + -25, 44, -25, -25, -25, 50, -23, 47, -25, 64, + 62, 51, -25, 58, -25, -25, -25, -2, -25, -25, + 89, -25, 90, 92, -25, -25, -25, 91, 94, 95, + -25, -25, -25, 98, 100, 96, 102, 122, -25, 103, + -25, -25, -25, -25, 133, 9, 134, -25, -25, -25, + 135, -25, -25, 105, 160, -25, 46, -25, -25, 137, + -25, 143, -25 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_int8 yydefact[] = +{ + 2, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 0, 0, 47, 0, 57, + 0, 0, 3, 4, 8, 9, 5, 6, 7, 12, + 10, 11, 0, 0, 0, 0, 0, 0, 1, 73, + 66, 49, 0, 59, 0, 0, 0, 0, 88, 0, + 65, 79, 80, 0, 71, 0, 48, 51, 50, 90, + 61, 0, 60, 74, 67, 0, 0, 0, 58, 0, + 0, 0, 89, 0, 91, 64, 62, 0, 68, 53, + 0, 94, 0, 0, 81, 82, 83, 0, 0, 54, + 92, 63, 75, 0, 0, 0, 0, 0, 72, 0, + 56, 55, 52, 95, 0, 0, 0, 93, 84, 85, + 0, 69, 76, 0, 0, 70, 0, 86, 87, 0, + 77, 0, 78 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -25, -25, -21, -25, 108, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 41, 42, 43, 44, 45, 46, 54, 67, 78, + 85, 100, 115, 121, 47, 56, 69, 82, 87, 103, + 96, 48, 49, 66, 90, 108, 133, 75, 119, 50, + 65, 89, 117, 134, 141, 73, 107, 130, 139, 51, + 79, 86, 94, 116, 102, 124 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_uint8 yytable[] = +{ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 52, 64, 92, 71, 53, + 93, 104, 105, 106, 55, 57, 77, 36, 81, 58, + 37, 38, 39, 40, 72, 128, 129, 59, 80, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 137, 138, 60, 61, 63, 68, + 70, 74, 83, 97, 88, 95, 36, 84, 99, 37, + 38, 39, 40, 91, 98, 101, 76, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 109, 110, 111, 118, 112, 113, 120, 114, + 123, 122, 125, 62, 36, 135, 126, 37, 38, 39, + 40, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 127, 131, + 132, 136, 140, 142 +}; + +static const yytype_int8 yycheck[] = +{ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, 59, 57, 60, 42, 59, + 63, 43, 44, 45, 59, 59, 67, 50, 69, 0, + 53, 54, 55, 56, 58, 46, 47, 38, 61, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 48, 49, 51, 59, 59, 65, + 60, 58, 65, 39, 60, 58, 50, 65, 57, 53, + 54, 55, 56, 63, 52, 57, 60, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 63, 63, 62, 57, 65, 63, 58, 64, + 58, 65, 40, 55, 50, 60, 63, 53, 54, 55, + 56, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 65, 65, + 65, 41, 65, 60 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_int8 yystos[] = +{ + 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 50, 53, 54, 55, + 56, 67, 68, 69, 70, 71, 72, 80, 87, 88, + 95, 105, 59, 59, 73, 59, 81, 59, 0, 38, + 51, 59, 70, 59, 68, 96, 89, 74, 65, 82, + 60, 42, 58, 101, 58, 93, 60, 68, 75, 106, + 61, 68, 83, 65, 65, 76, 107, 84, 60, 97, + 90, 63, 60, 63, 108, 58, 86, 39, 52, 57, + 77, 57, 110, 85, 43, 44, 45, 102, 91, 63, + 63, 62, 65, 63, 64, 78, 109, 98, 57, 94, + 58, 79, 65, 58, 111, 40, 63, 65, 46, 47, + 103, 65, 65, 92, 99, 60, 41, 48, 49, 104, + 65, 100, 60 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_int8 yyr1[] = +{ + 0, 66, 67, 67, 68, 68, 68, 68, 69, 69, + 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 71, 71, 71, 71, 71, 71, 71, 73, 72, 74, + 74, 76, 75, 77, 78, 78, 79, 81, 80, 82, + 82, 84, 85, 83, 86, 87, 89, 90, 91, 92, + 88, 93, 94, 96, 97, 98, 99, 100, 95, 101, + 101, 102, 102, 102, 103, 103, 104, 104, 106, 105, + 107, 107, 109, 108, 110, 111 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_int8 yyr2[] = +{ + 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 0, 5, 0, + 2, 0, 7, 1, 0, 2, 1, 0, 6, 0, + 2, 0, 0, 5, 1, 4, 0, 0, 0, 0, + 15, 1, 1, 0, 0, 0, 0, 0, 20, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 0, 7, + 0, 2, 0, 6, 1, 1 +}; + + +enum { YYENOMEM = -2 }; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) + +/* Backward compatibility with an undocumented macro. + Use YYerror or YYUNDEF. */ +#define YYERRCODE YYUNDEF -/* YYLEX -- calling `yylex' with the right arguments. */ -#ifdef YYLEX_PARAM -#define YYLEX yylex(YYLEX_PARAM) -#else -#define YYLEX yylex() -#endif /* Enable debugging if requested. */ #if YYDEBUG -#ifndef YYFPRINTF -#include /* INFRINGES ON USER NAME SPACE */ -#define YYFPRINTF fprintf -#endif +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +/* This macro is provided for backward compatibility. */ +# ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif + + +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Kind, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ -#define YYDPRINTF(Args) \ - do { \ - if (yydebug) \ - YYFPRINTF Args; \ - } while (YYID(0)) - -#define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ - do { \ - if (yydebug) { \ - YYFPRINTF(stderr, "%s ", Title); \ - yy_symbol_print(stderr, Type, Value); \ - YYFPRINTF(stderr, "\n"); \ - } \ - } while (YYID(0)) - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) static void -yy_symbol_value_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep) -#else -static void yy_symbol_value_print(yyoutput, yytype, yyvaluep) FILE *yyoutput; -int yytype; -YYSTYPE const *const yyvaluep; -#endif +yy_symbol_value_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) { - FILE *yyo = yyoutput; - YYUSE(yyo); - if (!yyvaluep) - return; -#ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT(yyoutput, yytoknum[yytype], *yyvaluep); -#else - YYUSE(yyoutput); -#endif - switch (yytype) { - default: - break; - } + FILE *yyoutput = yyo; + YYUSE (yyoutput); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yykind < YYNTOKENS) + YYPRINT (yyo, yytoknum[yykind], *yyvaluep); +# endif + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yykind); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ + static void -yy_symbol_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep) -#else -static void yy_symbol_print(yyoutput, yytype, yyvaluep) FILE *yyoutput; -int yytype; -YYSTYPE const *const yyvaluep; -#endif +yy_symbol_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) { - if (yytype < YYNTOKENS) - YYFPRINTF(yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF(yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyo, "%s %s (", + yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); - yy_symbol_value_print(yyoutput, yytype, yyvaluep); - YYFPRINTF(yyoutput, ")"); + yy_symbol_value_print (yyo, yykind, yyvaluep); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -902,71 +1032,69 @@ YYSTYPE const *const yyvaluep; | TOP (included). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print(yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void yy_stack_print(yybottom, yytop) yytype_int16 *yybottom; -yytype_int16 * yytop; -#endif +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { - YYFPRINTF(stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) { - int yybot = *yybottom; - YYFPRINTF(stderr, " %d", yybot); + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); } - YYFPRINTF(stderr, "\n"); + YYFPRINTF (stderr, "\n"); } -#define YY_STACK_PRINT(Bottom, Top) \ - do { \ - if (yydebug) \ - yy_stack_print((Bottom), (Top)); \ - } while (YYID(0)) +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print(YYSTYPE *yyvsp, int yyrule) -#else -static void yy_reduce_print(yyvsp, yyrule) YYSTYPE *yyvsp; -int yyrule; -#endif +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, + int yyrule) { - int yynrhs = yyr2[yyrule]; - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF(stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) { - YYFPRINTF(stderr, " $%d = ", yyi + 1); - yy_symbol_print(stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)])); - YYFPRINTF(stderr, "\n"); + int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), + &yyvsp[(yyi + 1) - (yynrhs)]); + YYFPRINTF (stderr, "\n"); } } -#define YY_REDUCE_PRINT(Rule) \ - do { \ - if (yydebug) \ - yy_reduce_print(yyvsp, Rule); \ - } while (YYID(0)) +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ -#define YYDPRINTF(Args) -#define YY_SYMBOL_PRINT(Title, Type, Value, Location) -#define YY_STACK_PRINT(Bottom, Top) -#define YY_REDUCE_PRINT(Rule) +# define YYDPRINTF(Args) ((void) 0) +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ + /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH -#define YYINITDEPTH 200 +# define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only @@ -977,1352 +1105,1053 @@ int yydebug; evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 +# define YYMAXDEPTH 10000 #endif -#if YYERROR_VERBOSE - -#ifndef yystrlen -#if defined __GLIBC__ && defined _STRING_H -#define yystrlen strlen -#else -/* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T -yystrlen(const char *yystr) -#else -static YYSIZE_T yystrlen(yystr) const char *yystr; -#endif -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -#endif -#endif - -#ifndef yystpcpy -#if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -#define yystpcpy stpcpy -#else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -static char * -yystpcpy(char *yydest, const char *yysrc) -#else -static char * yystpcpy(yydest, yysrc) char *yydest; -const char * yysrc; -#endif -{ - char * yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -#endif -#endif - -#ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr(char *yyres, const char *yystr) -{ - if (*yystr == '"') { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } -do_not_strip_quotes:; - } - - if (!yyres) - return yystrlen(yystr); - - return yystpcpy(yyres, yystr) - yyres; -} -#endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error(YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) -{ - YYSIZE_T yysize0 = yytnamerr(YY_NULL, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULL; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - - for details. YYERROR is fine as it does not invoke this - function. - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default(yyn)) { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && - !yytable_value_is_error(yytable[yyx + yyn])) { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr(YY_NULL, yytname[yyx]); - if (!(yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } - } - switch (yycount) { -#define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -#undef YYCASE_ - } - { - YYSIZE_T yysize1 = yysize + yystrlen(yyformat); - if (!(yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - if (*yymsg_alloc < yysize) { - *yymsg_alloc = 2 * yysize; - if (!(yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { - yyp += yytnamerr(yyp, yyarg[yyi++]); - yyformat += 2; - } - else { - yyp++; - yyformat++; - } - } - return 0; -} -#endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) static void -yydestruct(const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void yydestruct(yymsg, yytype, yyvaluep) const char *yymsg; -int yytype; -YYSTYPE * yyvaluep; -#endif +yydestruct (const char *yymsg, + yysymbol_kind_t yykind, YYSTYPE *yyvaluep) { - YYUSE(yyvaluep); - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT(yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) { - - default: - break; - } + YYUSE (yyvaluep); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yykind); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/* The lookahead symbol. */ -int yychar; -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -#define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -#define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif +/* Lookahead token kind. */ +int yychar; /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); - +YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; + + + /*----------. | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -hid_t -yyparse(void *YYPARSE_PARAM) -#else -hid_t yyparse(YYPARSE_PARAM) void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER) -hid_t -yyparse(void) -#else hid_t -yyparse() - -#endif -#endif +yyparse (void) { - int yystate; + yy_state_fast_t yystate = 0; /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. + int yyerrstatus = 0; - Refer to the stacks through separate pointers, to allow yyoverflow + /* Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char * yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif + /* Their size. */ + YYPTRDIFF_T yystacksize = YYINITDEPTH; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + /* The state stack: array, bottom, top. */ + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss = yyssa; + yy_state_t *yyssp = yyss; - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; + /* The semantic value stack: array, bottom, top. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp = yyvs; - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yystacksize = YYINITDEPTH; + int yyn; + /* The return value of yyparse. */ + int yyresult; + /* Lookahead symbol kind. */ + yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; - YYDPRINTF((stderr, "Starting parse\n")); - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - goto yysetstate; - /*------------------------------------------------------------. - | yynewstate -- Push a new state, which is found in yystate. | - `------------------------------------------------------------*/ -yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) -yysetstate: - *yyssp = yystate; + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; - if (yyss + yystacksize - 1 <= yyssp) { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYDPRINTF ((stderr, "Starting parse\n")); -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE * yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow(YY_("memory exhausted"), &yyss1, yysize * sizeof(*yyssp), &yyvs1, - yysize * sizeof(*yyvsp), &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -#ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -#else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; - { - yytype_int16 * yyss1 = yyss; - union yyalloc *yyptr = (union yyalloc *)YYSTACK_ALLOC(YYSTACK_BYTES(yystacksize)); - if (!yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE(yyss_alloc, yyss); - YYSTACK_RELOCATE(yyvs_alloc, yyvs); -#undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE(yyss1); - } -#endif -#endif /* no yyoverflow */ - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; +/*------------------------------------------------------------. +| yynewstate -- push a new state, which is found in yystate. | +`------------------------------------------------------------*/ +yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; - YYDPRINTF((stderr, "Stack size increased to %lu\n", (unsigned long int)yystacksize)); - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; +/*--------------------------------------------------------------------. +| yysetstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + YY_IGNORE_USELESS_CAST_BEGIN + *yyssp = YY_CAST (yy_state_t, yystate); + YY_IGNORE_USELESS_CAST_END + YY_STACK_PRINT (yyss, yyssp); + + if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + goto yyexhaustedlab; +#else + { + /* Get the current used size of the three stacks, in elements. */ + YYPTRDIFF_T yysize = yyssp - yyss + 1; + +# if defined yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + yy_state_t *yyss1 = yyss; + YYSTYPE *yyvs1 = yyvs; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*yyvsp), + &yystacksize); + yyss = yyss1; + yyvs = yyvs1; + } +# else /* defined YYSTACK_RELOCATE */ + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yy_state_t *yyss1 = yyss; + union yyalloc *yyptr = + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF ((stderr, "Stack size increased to %ld\n", + YY_CAST (long, yystacksize))); + YY_IGNORE_USELESS_CAST_END + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; } +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ - YYDPRINTF((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; - if (yystate == YYFINAL) - YYACCEPT; + goto yybackup; - goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yypact_value_is_default(yyn)) - goto yydefault; + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) { - YYDPRINTF((stderr, "Reading a token: ")); - yychar = YYLEX; + /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token\n")); + yychar = yylex (); } - if (yychar <= YYEOF) { - yychar = yytoken = YYEOF; - YYDPRINTF((stderr, "Now at end of input.\n")); + if (yychar <= YYEOF) + { + yychar = YYEOF; + yytoken = YYSYMBOL_YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); } - else { - yytoken = YYTRANSLATE(yychar); - YY_SYMBOL_PRINT("Next token is", yytoken, &yylval, &yylloc); + else if (yychar == YYerror) + { + /* The scanner already issued an error message, process directly + to error recovery. But do not keep the error token as + lookahead, it is too special and may lead us to an endless + loop in error recovery. */ + yychar = YYUNDEF; + yytoken = YYSYMBOL_YYerror; + goto yyerrlab1; } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) { - if (yytable_value_is_error(yyn)) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT("Shifting", yytoken, &yylval, &yylloc); + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; - /* Discard the shifted token. */ - yychar = YYEMPTY; + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END - yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END + /* Discard the shifted token. */ + yychar = YYEMPTY; + goto yynewstate; - goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1 - yylen]; - - YY_REDUCE_PRINT(yyn); - switch (yyn) { - case 2: -/* Line 1792 of yacc.c */ + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: /* start: %empty */ #line 105 "hl/src/H5LTparse.y" - { - memset(arr_stack, 0, STACK_SIZE * sizeof(struct arr_info)); /*initialize here?*/ - } break; + { memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ } +#line 1366 "hl/src/H5LTparse.c" + break; - case 3: -/* Line 1792 of yacc.c */ + case 3: /* start: ddl_type */ #line 106 "hl/src/H5LTparse.y" - { - return (yyval.hid); - } break; + { return (yyval.hid);} +#line 1372 "hl/src/H5LTparse.c" + break; - case 13: -/* Line 1792 of yacc.c */ + case 13: /* integer_type: H5T_STD_I8BE_TOKEN */ #line 120 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_STD_I8BE); - } break; + { (yyval.hid) = H5Tcopy(H5T_STD_I8BE); } +#line 1378 "hl/src/H5LTparse.c" + break; - case 14: -/* Line 1792 of yacc.c */ + case 14: /* integer_type: H5T_STD_I8LE_TOKEN */ #line 121 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_STD_I8LE); - } break; + { (yyval.hid) = H5Tcopy(H5T_STD_I8LE); } +#line 1384 "hl/src/H5LTparse.c" + break; - case 15: -/* Line 1792 of yacc.c */ + case 15: /* integer_type: H5T_STD_I16BE_TOKEN */ #line 122 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_STD_I16BE); - } break; + { (yyval.hid) = H5Tcopy(H5T_STD_I16BE); } +#line 1390 "hl/src/H5LTparse.c" + break; - case 16: -/* Line 1792 of yacc.c */ + case 16: /* integer_type: H5T_STD_I16LE_TOKEN */ #line 123 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_STD_I16LE); - } break; + { (yyval.hid) = H5Tcopy(H5T_STD_I16LE); } +#line 1396 "hl/src/H5LTparse.c" + break; - case 17: -/* Line 1792 of yacc.c */ + case 17: /* integer_type: H5T_STD_I32BE_TOKEN */ #line 124 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_STD_I32BE); - } break; + { (yyval.hid) = H5Tcopy(H5T_STD_I32BE); } +#line 1402 "hl/src/H5LTparse.c" + break; - case 18: -/* Line 1792 of yacc.c */ + case 18: /* integer_type: H5T_STD_I32LE_TOKEN */ #line 125 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_STD_I32LE); - } break; + { (yyval.hid) = H5Tcopy(H5T_STD_I32LE); } +#line 1408 "hl/src/H5LTparse.c" + break; - case 19: -/* Line 1792 of yacc.c */ + case 19: /* integer_type: H5T_STD_I64BE_TOKEN */ #line 126 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_STD_I64BE); - } break; + { (yyval.hid) = H5Tcopy(H5T_STD_I64BE); } +#line 1414 "hl/src/H5LTparse.c" + break; - case 20: -/* Line 1792 of yacc.c */ + case 20: /* integer_type: H5T_STD_I64LE_TOKEN */ #line 127 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_STD_I64LE); - } break; + { (yyval.hid) = H5Tcopy(H5T_STD_I64LE); } +#line 1420 "hl/src/H5LTparse.c" + break; - case 21: -/* Line 1792 of yacc.c */ + case 21: /* integer_type: H5T_STD_U8BE_TOKEN */ #line 128 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_STD_U8BE); - } break; + { (yyval.hid) = H5Tcopy(H5T_STD_U8BE); } +#line 1426 "hl/src/H5LTparse.c" + break; - case 22: -/* Line 1792 of yacc.c */ + case 22: /* integer_type: H5T_STD_U8LE_TOKEN */ #line 129 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_STD_U8LE); - } break; + { (yyval.hid) = H5Tcopy(H5T_STD_U8LE); } +#line 1432 "hl/src/H5LTparse.c" + break; - case 23: -/* Line 1792 of yacc.c */ + case 23: /* integer_type: H5T_STD_U16BE_TOKEN */ #line 130 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_STD_U16BE); - } break; + { (yyval.hid) = H5Tcopy(H5T_STD_U16BE); } +#line 1438 "hl/src/H5LTparse.c" + break; - case 24: -/* Line 1792 of yacc.c */ + case 24: /* integer_type: H5T_STD_U16LE_TOKEN */ #line 131 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_STD_U16LE); - } break; + { (yyval.hid) = H5Tcopy(H5T_STD_U16LE); } +#line 1444 "hl/src/H5LTparse.c" + break; - case 25: -/* Line 1792 of yacc.c */ + case 25: /* integer_type: H5T_STD_U32BE_TOKEN */ #line 132 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_STD_U32BE); - } break; + { (yyval.hid) = H5Tcopy(H5T_STD_U32BE); } +#line 1450 "hl/src/H5LTparse.c" + break; - case 26: -/* Line 1792 of yacc.c */ + case 26: /* integer_type: H5T_STD_U32LE_TOKEN */ #line 133 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_STD_U32LE); - } break; + { (yyval.hid) = H5Tcopy(H5T_STD_U32LE); } +#line 1456 "hl/src/H5LTparse.c" + break; - case 27: -/* Line 1792 of yacc.c */ + case 27: /* integer_type: H5T_STD_U64BE_TOKEN */ #line 134 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_STD_U64BE); - } break; + { (yyval.hid) = H5Tcopy(H5T_STD_U64BE); } +#line 1462 "hl/src/H5LTparse.c" + break; - case 28: -/* Line 1792 of yacc.c */ + case 28: /* integer_type: H5T_STD_U64LE_TOKEN */ #line 135 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_STD_U64LE); - } break; + { (yyval.hid) = H5Tcopy(H5T_STD_U64LE); } +#line 1468 "hl/src/H5LTparse.c" + break; - case 29: -/* Line 1792 of yacc.c */ + case 29: /* integer_type: H5T_NATIVE_CHAR_TOKEN */ #line 136 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR); - } break; + { (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR); } +#line 1474 "hl/src/H5LTparse.c" + break; - case 30: -/* Line 1792 of yacc.c */ + case 30: /* integer_type: H5T_NATIVE_SCHAR_TOKEN */ #line 137 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR); - } break; + { (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR); } +#line 1480 "hl/src/H5LTparse.c" + break; - case 31: -/* Line 1792 of yacc.c */ + case 31: /* integer_type: H5T_NATIVE_UCHAR_TOKEN */ #line 138 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR); - } break; + { (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR); } +#line 1486 "hl/src/H5LTparse.c" + break; - case 32: -/* Line 1792 of yacc.c */ + case 32: /* integer_type: H5T_NATIVE_SHORT_TOKEN */ #line 139 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT); - } break; + { (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT); } +#line 1492 "hl/src/H5LTparse.c" + break; - case 33: -/* Line 1792 of yacc.c */ + case 33: /* integer_type: H5T_NATIVE_USHORT_TOKEN */ #line 140 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT); - } break; + { (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT); } +#line 1498 "hl/src/H5LTparse.c" + break; - case 34: -/* Line 1792 of yacc.c */ + case 34: /* integer_type: H5T_NATIVE_INT_TOKEN */ #line 141 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_NATIVE_INT); - } break; + { (yyval.hid) = H5Tcopy(H5T_NATIVE_INT); } +#line 1504 "hl/src/H5LTparse.c" + break; - case 35: -/* Line 1792 of yacc.c */ + case 35: /* integer_type: H5T_NATIVE_UINT_TOKEN */ #line 142 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT); - } break; + { (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT); } +#line 1510 "hl/src/H5LTparse.c" + break; - case 36: -/* Line 1792 of yacc.c */ + case 36: /* integer_type: H5T_NATIVE_LONG_TOKEN */ #line 143 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG); - } break; + { (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG); } +#line 1516 "hl/src/H5LTparse.c" + break; - case 37: -/* Line 1792 of yacc.c */ + case 37: /* integer_type: H5T_NATIVE_ULONG_TOKEN */ #line 144 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG); - } break; + { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG); } +#line 1522 "hl/src/H5LTparse.c" + break; - case 38: -/* Line 1792 of yacc.c */ + case 38: /* integer_type: H5T_NATIVE_LLONG_TOKEN */ #line 145 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG); - } break; + { (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG); } +#line 1528 "hl/src/H5LTparse.c" + break; - case 39: -/* Line 1792 of yacc.c */ + case 39: /* integer_type: H5T_NATIVE_ULLONG_TOKEN */ #line 146 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG); - } break; + { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG); } +#line 1534 "hl/src/H5LTparse.c" + break; - case 40: -/* Line 1792 of yacc.c */ + case 40: /* fp_type: H5T_IEEE_F32BE_TOKEN */ #line 149 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE); - } break; + { (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE); } +#line 1540 "hl/src/H5LTparse.c" + break; - case 41: -/* Line 1792 of yacc.c */ + case 41: /* fp_type: H5T_IEEE_F32LE_TOKEN */ #line 150 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE); - } break; + { (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE); } +#line 1546 "hl/src/H5LTparse.c" + break; - case 42: -/* Line 1792 of yacc.c */ + case 42: /* fp_type: H5T_IEEE_F64BE_TOKEN */ #line 151 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE); - } break; + { (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE); } +#line 1552 "hl/src/H5LTparse.c" + break; - case 43: -/* Line 1792 of yacc.c */ + case 43: /* fp_type: H5T_IEEE_F64LE_TOKEN */ #line 152 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE); - } break; + { (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE); } +#line 1558 "hl/src/H5LTparse.c" + break; - case 44: -/* Line 1792 of yacc.c */ + case 44: /* fp_type: H5T_NATIVE_FLOAT_TOKEN */ #line 153 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT); - } break; + { (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT); } +#line 1564 "hl/src/H5LTparse.c" + break; - case 45: -/* Line 1792 of yacc.c */ + case 45: /* fp_type: H5T_NATIVE_DOUBLE_TOKEN */ #line 154 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE); - } break; + { (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE); } +#line 1570 "hl/src/H5LTparse.c" + break; - case 46: -/* Line 1792 of yacc.c */ + case 46: /* fp_type: H5T_NATIVE_LDOUBLE_TOKEN */ #line 155 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE); - } break; + { (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE); } +#line 1576 "hl/src/H5LTparse.c" + break; - case 47: -/* Line 1792 of yacc.c */ + case 47: /* $@1: %empty */ #line 159 "hl/src/H5LTparse.y" - { - csindex++; - cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ - } break; + { csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ } +#line 1582 "hl/src/H5LTparse.c" + break; - case 48: -/* Line 1792 of yacc.c */ + case 48: /* compound_type: H5T_COMPOUND_TOKEN $@1 '{' memb_list '}' */ #line 161 "hl/src/H5LTparse.y" - { - (yyval.hid) = cmpd_stack[csindex].id; - cmpd_stack[csindex].id = 0; - cmpd_stack[csindex].first_memb = 1; - csindex--; - } break; - - case 51: -/* Line 1792 of yacc.c */ + { (yyval.hid) = cmpd_stack[csindex].id; + cmpd_stack[csindex].id = 0; + cmpd_stack[csindex].first_memb = 1; + csindex--; + } +#line 1592 "hl/src/H5LTparse.c" + break; + + case 51: /* $@2: %empty */ #line 170 "hl/src/H5LTparse.y" - { - cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ - } break; + { cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ } +#line 1598 "hl/src/H5LTparse.c" + break; - case 52: -/* Line 1792 of yacc.c */ + case 52: /* memb_def: ddl_type $@2 '"' field_name '"' field_offset ';' */ #line 172 "hl/src/H5LTparse.y" - { - size_t origin_size, new_size; - hid_t dtype_id = cmpd_stack[csindex].id; - - /*Adjust size and insert member, consider both member size and offset.*/ - if (cmpd_stack[csindex].first_memb) { /*reclaim the size 1 temporarily set*/ - new_size = H5Tget_size((yyvsp[(1) - (7)].hid)) + (yyvsp[(6) - (7)].ival); - H5Tset_size(dtype_id, new_size); - /*member name is saved in yylval.sval by lexer*/ - H5Tinsert(dtype_id, (yyvsp[(4) - (7)].sval), (yyvsp[(6) - (7)].ival), (yyvsp[(1) - (7)].hid)); - - cmpd_stack[csindex].first_memb = 0; - } - else { - origin_size = H5Tget_size(dtype_id); - - if ((yyvsp[(6) - (7)].ival) == 0) { - new_size = origin_size + H5Tget_size((yyvsp[(1) - (7)].hid)); - H5Tset_size(dtype_id, new_size); - H5Tinsert(dtype_id, (yyvsp[(4) - (7)].sval), origin_size, (yyvsp[(1) - (7)].hid)); - } - else { - new_size = (yyvsp[(6) - (7)].ival) + H5Tget_size((yyvsp[(1) - (7)].hid)); - H5Tset_size(dtype_id, new_size); - H5Tinsert(dtype_id, (yyvsp[(4) - (7)].sval), (yyvsp[(6) - (7)].ival), - (yyvsp[(1) - (7)].hid)); - } - } - if ((yyvsp[(4) - (7)].sval)) { - free((yyvsp[(4) - (7)].sval)); - (yyvsp[(4) - (7)].sval) = NULL; - } - cmpd_stack[csindex].is_field = 0; - H5Tclose((yyvsp[(1) - (7)].hid)); - - new_size = H5Tget_size(dtype_id); - } break; - - case 53: -/* Line 1792 of yacc.c */ + { + size_t origin_size, new_size; + hid_t dtype_id = cmpd_stack[csindex].id; + + /*Adjust size and insert member, consider both member size and offset.*/ + if(cmpd_stack[csindex].first_memb) { /*reclaim the size 1 temporarily set*/ + new_size = H5Tget_size((yyvsp[-6].hid)) + (yyvsp[-1].ival); + H5Tset_size(dtype_id, new_size); + /*member name is saved in yylval.sval by lexer*/ + H5Tinsert(dtype_id, (yyvsp[-3].sval), (yyvsp[-1].ival), (yyvsp[-6].hid)); + + cmpd_stack[csindex].first_memb = 0; + } else { + origin_size = H5Tget_size(dtype_id); + + if((yyvsp[-1].ival) == 0) { + new_size = origin_size + H5Tget_size((yyvsp[-6].hid)); + H5Tset_size(dtype_id, new_size); + H5Tinsert(dtype_id, (yyvsp[-3].sval), origin_size, (yyvsp[-6].hid)); + } else { + new_size = (yyvsp[-1].ival) + H5Tget_size((yyvsp[-6].hid)); + H5Tset_size(dtype_id, new_size); + H5Tinsert(dtype_id, (yyvsp[-3].sval), (yyvsp[-1].ival), (yyvsp[-6].hid)); + } + } + if((yyvsp[-3].sval)) { + free((yyvsp[-3].sval)); + (yyvsp[-3].sval) = NULL; + } + cmpd_stack[csindex].is_field = 0; + H5Tclose((yyvsp[-6].hid)); + + new_size = H5Tget_size(dtype_id); + } +#line 1637 "hl/src/H5LTparse.c" + break; + + case 53: /* field_name: STRING */ #line 208 "hl/src/H5LTparse.y" - { - (yyval.sval) = strdup(yylval.sval); - free(yylval.sval); - yylval.sval = NULL; - } break; - - case 54: -/* Line 1792 of yacc.c */ + { + (yyval.sval) = strdup(yylval.sval); + free(yylval.sval); + yylval.sval = NULL; + } +#line 1647 "hl/src/H5LTparse.c" + break; + + case 54: /* field_offset: %empty */ #line 215 "hl/src/H5LTparse.y" - { - (yyval.ival) = 0; - } break; + { (yyval.ival) = 0; } +#line 1653 "hl/src/H5LTparse.c" + break; - case 55: -/* Line 1792 of yacc.c */ + case 55: /* field_offset: ':' offset */ #line 217 "hl/src/H5LTparse.y" - { - (yyval.ival) = yylval.ival; - } break; + { (yyval.ival) = yylval.ival; } +#line 1659 "hl/src/H5LTparse.c" + break; - case 57: -/* Line 1792 of yacc.c */ + case 57: /* $@3: %empty */ #line 221 "hl/src/H5LTparse.y" - { - asindex++; /*pushd onto the stack*/ - } break; + { asindex++; /*pushd onto the stack*/ } +#line 1665 "hl/src/H5LTparse.c" + break; - case 58: -/* Line 1792 of yacc.c */ + case 58: /* array_type: H5T_ARRAY_TOKEN $@3 '{' dim_list ddl_type '}' */ #line 223 "hl/src/H5LTparse.y" - { - (yyval.hid) = - H5Tarray_create2((yyvsp[(5) - (6)].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims); - arr_stack[asindex].ndims = 0; - asindex--; - H5Tclose((yyvsp[(5) - (6)].hid)); - } break; - - case 61: -/* Line 1792 of yacc.c */ + { + (yyval.hid) = H5Tarray_create2((yyvsp[-1].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims); + arr_stack[asindex].ndims = 0; + asindex--; + H5Tclose((yyvsp[-1].hid)); + } +#line 1676 "hl/src/H5LTparse.c" + break; + + case 61: /* $@4: %empty */ #line 233 "hl/src/H5LTparse.y" - { - arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ - } break; + { arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ } +#line 1682 "hl/src/H5LTparse.c" + break; - case 62: -/* Line 1792 of yacc.c */ + case 62: /* $@5: %empty */ #line 234 "hl/src/H5LTparse.y" - { - unsigned ndims = arr_stack[asindex].ndims; - arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; - arr_stack[asindex].ndims++; - arr_stack[asindex].is_dim = 0; - } break; - - case 65: -/* Line 1792 of yacc.c */ + { unsigned ndims = arr_stack[asindex].ndims; + arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; + arr_stack[asindex].ndims++; + arr_stack[asindex].is_dim = 0; + } +#line 1692 "hl/src/H5LTparse.c" + break; + + case 65: /* vlen_type: H5T_VLEN_TOKEN '{' ddl_type '}' */ #line 245 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5Tvlen_create((yyvsp[(3) - (4)].hid)); - H5Tclose((yyvsp[(3) - (4)].hid)); - } break; + { (yyval.hid) = H5Tvlen_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } +#line 1698 "hl/src/H5LTparse.c" + break; - case 66: -/* Line 1792 of yacc.c */ + case 66: /* $@6: %empty */ #line 250 "hl/src/H5LTparse.y" - { - is_opq_size = 1; - } break; + { is_opq_size = 1; } +#line 1704 "hl/src/H5LTparse.c" + break; - case 67: -/* Line 1792 of yacc.c */ + case 67: /* @7: %empty */ #line 251 "hl/src/H5LTparse.y" - { - size_t size = (size_t)yylval.ival; - (yyval.hid) = H5Tcreate(H5T_OPAQUE, size); - is_opq_size = 0; - } break; - - case 68: -/* Line 1792 of yacc.c */ + { + size_t size = (size_t)yylval.ival; + (yyval.hid) = H5Tcreate(H5T_OPAQUE, size); + is_opq_size = 0; + } +#line 1714 "hl/src/H5LTparse.c" + break; + + case 68: /* $@8: %empty */ #line 256 "hl/src/H5LTparse.y" - { - is_opq_tag = 1; - } break; + { is_opq_tag = 1; } +#line 1720 "hl/src/H5LTparse.c" + break; - case 69: -/* Line 1792 of yacc.c */ + case 69: /* $@9: %empty */ #line 257 "hl/src/H5LTparse.y" - { - H5Tset_tag((yyvsp[(7) - (13)].hid), yylval.sval); - free(yylval.sval); - yylval.sval = NULL; - is_opq_tag = 0; - } break; - - case 70: -/* Line 1792 of yacc.c */ + { + H5Tset_tag((yyvsp[-6].hid), yylval.sval); + free(yylval.sval); + yylval.sval = NULL; + is_opq_tag = 0; + } +#line 1731 "hl/src/H5LTparse.c" + break; + + case 70: /* opaque_type: H5T_OPAQUE_TOKEN '{' OPQ_SIZE_TOKEN $@6 opaque_size ';' @7 OPQ_TAG_TOKEN $@8 '"' opaque_tag '"' ';' $@9 '}' */ #line 263 "hl/src/H5LTparse.y" - { - (yyval.hid) = (yyvsp[(7) - (15)].hid); - } break; + { (yyval.hid) = (yyvsp[-8].hid); } +#line 1737 "hl/src/H5LTparse.c" + break; - case 73: -/* Line 1792 of yacc.c */ + case 73: /* $@10: %empty */ #line 271 "hl/src/H5LTparse.y" - { - is_str_size = 1; - } break; + { is_str_size = 1; } +#line 1743 "hl/src/H5LTparse.c" + break; - case 74: -/* Line 1792 of yacc.c */ + case 74: /* $@11: %empty */ #line 272 "hl/src/H5LTparse.y" - { - if ((yyvsp[(5) - (6)].ival) == H5T_VARIABLE_TOKEN) - is_variable = 1; - else - str_size = yylval.ival; - is_str_size = 0; - } break; - - case 75: -/* Line 1792 of yacc.c */ + { + if((yyvsp[-1].ival) == H5T_VARIABLE_TOKEN) + is_variable = 1; + else + str_size = yylval.ival; + is_str_size = 0; + } +#line 1755 "hl/src/H5LTparse.c" + break; + + case 75: /* $@12: %empty */ #line 280 "hl/src/H5LTparse.y" - { - if ((yyvsp[(9) - (10)].ival) == H5T_STR_NULLTERM_TOKEN) - str_pad = H5T_STR_NULLTERM; - else if ((yyvsp[(9) - (10)].ival) == H5T_STR_NULLPAD_TOKEN) - str_pad = H5T_STR_NULLPAD; - else if ((yyvsp[(9) - (10)].ival) == H5T_STR_SPACEPAD_TOKEN) - str_pad = H5T_STR_SPACEPAD; - } break; - - case 76: -/* Line 1792 of yacc.c */ + { + if((yyvsp[-1].ival) == H5T_STR_NULLTERM_TOKEN) + str_pad = H5T_STR_NULLTERM; + else if((yyvsp[-1].ival) == H5T_STR_NULLPAD_TOKEN) + str_pad = H5T_STR_NULLPAD; + else if((yyvsp[-1].ival) == H5T_STR_SPACEPAD_TOKEN) + str_pad = H5T_STR_SPACEPAD; + } +#line 1768 "hl/src/H5LTparse.c" + break; + + case 76: /* $@13: %empty */ #line 289 "hl/src/H5LTparse.y" - { - if ((yyvsp[(13) - (14)].ival) == H5T_CSET_ASCII_TOKEN) - str_cset = H5T_CSET_ASCII; - else if ((yyvsp[(13) - (14)].ival) == H5T_CSET_UTF8_TOKEN) - str_cset = H5T_CSET_UTF8; - } break; - - case 77: -/* Line 1792 of yacc.c */ + { + if((yyvsp[-1].ival) == H5T_CSET_ASCII_TOKEN) + str_cset = H5T_CSET_ASCII; + else if((yyvsp[-1].ival) == H5T_CSET_UTF8_TOKEN) + str_cset = H5T_CSET_UTF8; + } +#line 1779 "hl/src/H5LTparse.c" + break; + + case 77: /* @14: %empty */ #line 296 "hl/src/H5LTparse.y" - { - if ((yyvsp[(17) - (18)].hid) == H5T_C_S1_TOKEN) - (yyval.hid) = H5Tcopy(H5T_C_S1); - else if ((yyvsp[(17) - (18)].hid) == H5T_FORTRAN_S1_TOKEN) - (yyval.hid) = H5Tcopy(H5T_FORTRAN_S1); - } break; - - case 78: -/* Line 1792 of yacc.c */ + { + if((yyvsp[-1].hid) == H5T_C_S1_TOKEN) + (yyval.hid) = H5Tcopy(H5T_C_S1); + else if((yyvsp[-1].hid) == H5T_FORTRAN_S1_TOKEN) + (yyval.hid) = H5Tcopy(H5T_FORTRAN_S1); + } +#line 1790 "hl/src/H5LTparse.c" + break; + + case 78: /* string_type: H5T_STRING_TOKEN '{' STRSIZE_TOKEN $@10 strsize ';' $@11 STRPAD_TOKEN strpad ';' $@12 CSET_TOKEN cset ';' $@13 CTYPE_TOKEN ctype ';' @14 '}' */ #line 303 "hl/src/H5LTparse.y" - { - hid_t str_id = (yyvsp[(19) - (20)].hid); - - /*set string size*/ - if (is_variable) { - H5Tset_size(str_id, H5T_VARIABLE); - is_variable = 0; - } - else - H5Tset_size(str_id, str_size); - - /*set string padding and character set*/ - H5Tset_strpad(str_id, str_pad); - H5Tset_cset(str_id, str_cset); - - (yyval.hid) = str_id; - } break; - - case 79: -/* Line 1792 of yacc.c */ + { + hid_t str_id = (yyvsp[-1].hid); + + /*set string size*/ + if(is_variable) { + H5Tset_size(str_id, H5T_VARIABLE); + is_variable = 0; + } else + H5Tset_size(str_id, str_size); + + /*set string padding and character set*/ + H5Tset_strpad(str_id, str_pad); + H5Tset_cset(str_id, str_cset); + + (yyval.hid) = str_id; + } +#line 1811 "hl/src/H5LTparse.c" + break; + + case 79: /* strsize: H5T_VARIABLE_TOKEN */ #line 320 "hl/src/H5LTparse.y" - { - (yyval.ival) = H5T_VARIABLE_TOKEN; - } break; + {(yyval.ival) = H5T_VARIABLE_TOKEN;} +#line 1817 "hl/src/H5LTparse.c" + break; - case 81: -/* Line 1792 of yacc.c */ + case 81: /* strpad: H5T_STR_NULLTERM_TOKEN */ #line 323 "hl/src/H5LTparse.y" - { - (yyval.ival) = H5T_STR_NULLTERM_TOKEN; - } break; + {(yyval.ival) = H5T_STR_NULLTERM_TOKEN;} +#line 1823 "hl/src/H5LTparse.c" + break; - case 82: -/* Line 1792 of yacc.c */ + case 82: /* strpad: H5T_STR_NULLPAD_TOKEN */ #line 324 "hl/src/H5LTparse.y" - { - (yyval.ival) = H5T_STR_NULLPAD_TOKEN; - } break; + {(yyval.ival) = H5T_STR_NULLPAD_TOKEN;} +#line 1829 "hl/src/H5LTparse.c" + break; - case 83: -/* Line 1792 of yacc.c */ + case 83: /* strpad: H5T_STR_SPACEPAD_TOKEN */ #line 325 "hl/src/H5LTparse.y" - { - (yyval.ival) = H5T_STR_SPACEPAD_TOKEN; - } break; + {(yyval.ival) = H5T_STR_SPACEPAD_TOKEN;} +#line 1835 "hl/src/H5LTparse.c" + break; - case 84: -/* Line 1792 of yacc.c */ + case 84: /* cset: H5T_CSET_ASCII_TOKEN */ #line 327 "hl/src/H5LTparse.y" - { - (yyval.ival) = H5T_CSET_ASCII_TOKEN; - } break; + {(yyval.ival) = H5T_CSET_ASCII_TOKEN;} +#line 1841 "hl/src/H5LTparse.c" + break; - case 85: -/* Line 1792 of yacc.c */ + case 85: /* cset: H5T_CSET_UTF8_TOKEN */ #line 328 "hl/src/H5LTparse.y" - { - (yyval.ival) = H5T_CSET_UTF8_TOKEN; - } break; + {(yyval.ival) = H5T_CSET_UTF8_TOKEN;} +#line 1847 "hl/src/H5LTparse.c" + break; - case 86: -/* Line 1792 of yacc.c */ + case 86: /* ctype: H5T_C_S1_TOKEN */ #line 330 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5T_C_S1_TOKEN; - } break; + {(yyval.hid) = H5T_C_S1_TOKEN;} +#line 1853 "hl/src/H5LTparse.c" + break; - case 87: -/* Line 1792 of yacc.c */ + case 87: /* ctype: H5T_FORTRAN_S1_TOKEN */ #line 331 "hl/src/H5LTparse.y" - { - (yyval.hid) = H5T_FORTRAN_S1_TOKEN; - } break; + {(yyval.hid) = H5T_FORTRAN_S1_TOKEN;} +#line 1859 "hl/src/H5LTparse.c" + break; - case 88: -/* Line 1792 of yacc.c */ + case 88: /* $@15: %empty */ #line 335 "hl/src/H5LTparse.y" - { - is_enum = 1; - enum_id = H5Tenum_create((yyvsp[(3) - (4)].hid)); - H5Tclose((yyvsp[(3) - (4)].hid)); - } break; + { is_enum = 1; enum_id = H5Tenum_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } +#line 1865 "hl/src/H5LTparse.c" + break; - case 89: -/* Line 1792 of yacc.c */ + case 89: /* enum_type: H5T_ENUM_TOKEN '{' integer_type ';' $@15 enum_list '}' */ #line 337 "hl/src/H5LTparse.y" - { - is_enum = 0; /*reset*/ - (yyval.hid) = enum_id; - } break; + { is_enum = 0; /*reset*/ (yyval.hid) = enum_id; } +#line 1871 "hl/src/H5LTparse.c" + break; - case 92: -/* Line 1792 of yacc.c */ + case 92: /* $@16: %empty */ #line 342 "hl/src/H5LTparse.y" - { - is_enum_memb = 1; /*indicate member of enum*/ + { + is_enum_memb = 1; /*indicate member of enum*/ #ifdef H5_HAVE_WIN32_API - enum_memb_symbol = _strdup(yylval.sval); -#else /* H5_HAVE_WIN32_API */ - enum_memb_symbol = strdup(yylval.sval); -#endif /* H5_HAVE_WIN32_API */ - free(yylval.sval); - yylval.sval = NULL; - } break; - - case 93: -/* Line 1792 of yacc.c */ + enum_memb_symbol = _strdup(yylval.sval); +#else /* H5_HAVE_WIN32_API */ + enum_memb_symbol = strdup(yylval.sval); +#endif /* H5_HAVE_WIN32_API */ + free(yylval.sval); + yylval.sval = NULL; + } +#line 1886 "hl/src/H5LTparse.c" + break; + + case 93: /* enum_def: '"' enum_symbol '"' $@16 enum_val ';' */ #line 353 "hl/src/H5LTparse.y" - { - char char_val = (char)yylval.ival; - short short_val = (short)yylval.ival; - int int_val = (int)yylval.ival; - long long_val = (long)yylval.ival; - long long llong_val = (long long)yylval.ival; - hid_t super = H5Tget_super(enum_id); - hid_t native = H5Tget_native_type(super, H5T_DIR_ASCEND); - H5T_order_t super_order = H5Tget_order(super); - H5T_order_t native_order = H5Tget_order(native); - - if (is_enum && is_enum_memb) { /*if it's an enum member*/ - /*To handle machines of different endianness*/ - if (H5Tequal(native, H5T_NATIVE_SCHAR) || H5Tequal(native, H5T_NATIVE_UCHAR)) { - if (super_order != native_order) - H5Tconvert(native, super, 1, &char_val, NULL, H5P_DEFAULT); - H5Tenum_insert(enum_id, enum_memb_symbol, &char_val); - } - else if (H5Tequal(native, H5T_NATIVE_SHORT) || H5Tequal(native, H5T_NATIVE_USHORT)) { - if (super_order != native_order) - H5Tconvert(native, super, 1, &short_val, NULL, H5P_DEFAULT); - H5Tenum_insert(enum_id, enum_memb_symbol, &short_val); - } - else if (H5Tequal(native, H5T_NATIVE_INT) || H5Tequal(native, H5T_NATIVE_UINT)) { - if (super_order != native_order) - H5Tconvert(native, super, 1, &int_val, NULL, H5P_DEFAULT); - H5Tenum_insert(enum_id, enum_memb_symbol, &int_val); - } - else if (H5Tequal(native, H5T_NATIVE_LONG) || H5Tequal(native, H5T_NATIVE_ULONG)) { - if (super_order != native_order) - H5Tconvert(native, super, 1, &long_val, NULL, H5P_DEFAULT); - H5Tenum_insert(enum_id, enum_memb_symbol, &long_val); - } - else if (H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG)) { - if (super_order != native_order) - H5Tconvert(native, super, 1, &llong_val, NULL, H5P_DEFAULT); - H5Tenum_insert(enum_id, enum_memb_symbol, &llong_val); - } - - is_enum_memb = 0; - if (enum_memb_symbol) - free(enum_memb_symbol); - } - - H5Tclose(super); - H5Tclose(native); - } break; - -/* Line 1792 of yacc.c */ -#line 2200 "hl/src/H5LTparse.c" - default: - break; + { + char char_val=(char)yylval.ival; + short short_val=(short)yylval.ival; + int int_val=(int)yylval.ival; + long long_val=(long)yylval.ival; + long long llong_val=(long long)yylval.ival; + hid_t super = H5Tget_super(enum_id); + hid_t native = H5Tget_native_type(super, H5T_DIR_ASCEND); + H5T_order_t super_order = H5Tget_order(super); + H5T_order_t native_order = H5Tget_order(native); + + if(is_enum && is_enum_memb) { /*if it's an enum member*/ + /*To handle machines of different endianness*/ + if(H5Tequal(native, H5T_NATIVE_SCHAR) || H5Tequal(native, H5T_NATIVE_UCHAR)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &char_val, NULL, H5P_DEFAULT); + H5Tenum_insert(enum_id, enum_memb_symbol, &char_val); + } else if(H5Tequal(native, H5T_NATIVE_SHORT) || H5Tequal(native, H5T_NATIVE_USHORT)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &short_val, NULL, H5P_DEFAULT); + H5Tenum_insert(enum_id, enum_memb_symbol, &short_val); + } else if(H5Tequal(native, H5T_NATIVE_INT) || H5Tequal(native, H5T_NATIVE_UINT)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &int_val, NULL, H5P_DEFAULT); + H5Tenum_insert(enum_id, enum_memb_symbol, &int_val); + } else if(H5Tequal(native, H5T_NATIVE_LONG) || H5Tequal(native, H5T_NATIVE_ULONG)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &long_val, NULL, H5P_DEFAULT); + H5Tenum_insert(enum_id, enum_memb_symbol, &long_val); + } else if(H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &llong_val, NULL, H5P_DEFAULT); + H5Tenum_insert(enum_id, enum_memb_symbol, &llong_val); + } + + is_enum_memb = 0; + if(enum_memb_symbol) free(enum_memb_symbol); + } + + H5Tclose(super); + H5Tclose(native); + } +#line 1933 "hl/src/H5LTparse.c" + break; + + +#line 1937 "hl/src/H5LTparse.c" + + default: break; } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ - YY_SYMBOL_PRINT("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK(yylen); - yylen = 0; - YY_STACK_PRINT(yyss, yyssp); - - *++yyvsp = yyval; - - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + + *++yyvsp = yyval; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE(yychar); - - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) { - ++yynerrs; -#if !YYERROR_VERBOSE - yyerror(YY_("syntax error")); -#else -#define YYSYNTAX_ERROR yysyntax_error(&yymsg_alloc, &yymsg, yyssp, yytoken) - { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) { - if (yymsg != yymsgbuf) - YYSTACK_FREE(yymsg); - yymsg = (char *)YYSTACK_ALLOC(yymsg_alloc); - if (!yymsg) { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror(yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -#undef YYSYNTAX_ERROR -#endif + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; + yyerror (YY_("syntax error")); } - if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ - if (yychar <= YYEOF) { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; } - else { - yydestruct("Error: discarding", yytoken, &yylval); - yychar = YYEMPTY; + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; } } - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK(yylen); - yylen = 0; - YY_STACK_PRINT(yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) { - yyn = yypact[yystate]; - if (!yypact_value_is_default(yyn)) { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { - yyn = yytable[yyn]; - if (0 < yyn) - break; + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + /* Pop stack until we find a state that shifts the error token. */ + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYSYMBOL_YYerror; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; } } - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; - yydestruct("Error: popping", yystos[yystate], yyvsp); - YYPOPSTACK(1); - yystate = *yyssp; - YY_STACK_PRINT(yyss, yyssp); + + yydestruct ("Error: popping", + YY_ACCESSING_SYMBOL (yystate), yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); } - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); - /* Shift the error token. */ - YY_SYMBOL_PRINT("Shifting", yystos[yyn], yyvsp, yylsp); + yystate = yyn; + goto yynewstate; - yystate = yyn; - goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: - yyresult = 0; - goto yyreturn; + yyresult = 0; + goto yyreturn; + /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: - yyresult = 1; - goto yyreturn; + yyresult = 1; + goto yyreturn; + -#if !defined yyoverflow || YYERROR_VERBOSE +#if !defined yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: - yyerror(YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ + yyerror (YY_("memory exhausted")); + yyresult = 2; + goto yyreturn; #endif + +/*-------------------------------------------------------. +| yyreturn -- parsing is finished, clean up and return. | +`-------------------------------------------------------*/ yyreturn: - if (yychar != YYEMPTY) { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE(yychar); - yydestruct("Cleanup: discarding lookahead", yytoken, &yylval); + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); } - /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK(yylen); - YY_STACK_PRINT(yyss, yyssp); - while (yyssp != yyss) { - yydestruct("Cleanup: popping", yystos[*yyssp], yyvsp); - YYPOPSTACK(1); + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + YY_ACCESSING_SYMBOL (+*yyssp), yyvsp); + YYPOPSTACK (1); } #ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE(yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE(yymsg); + if (yyss != yyssa) + YYSTACK_FREE (yyss); #endif - /* Make sure YYID is used. */ - return YYID(yyresult); + + return yyresult; } + diff --git a/hl/src/H5LTparse.h b/hl/src/H5LTparse.h index fc969c6..abff969 100644 --- a/hl/src/H5LTparse.h +++ b/hl/src/H5LTparse.h @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 2.7. */ +/* A Bison parser, made by GNU Bison 3.7.2. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,112 +31,110 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or yy_. They are + private implementation details that can be changed or removed. */ + #ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED -#define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED -/* Enabling traces. */ +# define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED +/* Debug traces. */ #ifndef YYDEBUG -#define YYDEBUG 0 +# define YYDEBUG 0 #endif #if YYDEBUG extern int H5LTyydebug; #endif -/* Tokens. */ +/* Token kinds. */ #ifndef YYTOKENTYPE -#define YYTOKENTYPE -/* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ -enum yytokentype { - H5T_STD_I8BE_TOKEN = 258, - H5T_STD_I8LE_TOKEN = 259, - H5T_STD_I16BE_TOKEN = 260, - H5T_STD_I16LE_TOKEN = 261, - H5T_STD_I32BE_TOKEN = 262, - H5T_STD_I32LE_TOKEN = 263, - H5T_STD_I64BE_TOKEN = 264, - H5T_STD_I64LE_TOKEN = 265, - H5T_STD_U8BE_TOKEN = 266, - H5T_STD_U8LE_TOKEN = 267, - H5T_STD_U16BE_TOKEN = 268, - H5T_STD_U16LE_TOKEN = 269, - H5T_STD_U32BE_TOKEN = 270, - H5T_STD_U32LE_TOKEN = 271, - H5T_STD_U64BE_TOKEN = 272, - H5T_STD_U64LE_TOKEN = 273, - H5T_NATIVE_CHAR_TOKEN = 274, - H5T_NATIVE_SCHAR_TOKEN = 275, - H5T_NATIVE_UCHAR_TOKEN = 276, - H5T_NATIVE_SHORT_TOKEN = 277, - H5T_NATIVE_USHORT_TOKEN = 278, - H5T_NATIVE_INT_TOKEN = 279, - H5T_NATIVE_UINT_TOKEN = 280, - H5T_NATIVE_LONG_TOKEN = 281, - H5T_NATIVE_ULONG_TOKEN = 282, - H5T_NATIVE_LLONG_TOKEN = 283, - H5T_NATIVE_ULLONG_TOKEN = 284, - H5T_IEEE_F32BE_TOKEN = 285, - H5T_IEEE_F32LE_TOKEN = 286, - H5T_IEEE_F64BE_TOKEN = 287, - H5T_IEEE_F64LE_TOKEN = 288, - H5T_NATIVE_FLOAT_TOKEN = 289, - H5T_NATIVE_DOUBLE_TOKEN = 290, - H5T_NATIVE_LDOUBLE_TOKEN = 291, - H5T_STRING_TOKEN = 292, - STRSIZE_TOKEN = 293, - STRPAD_TOKEN = 294, - CSET_TOKEN = 295, - CTYPE_TOKEN = 296, - H5T_VARIABLE_TOKEN = 297, - H5T_STR_NULLTERM_TOKEN = 298, - H5T_STR_NULLPAD_TOKEN = 299, - H5T_STR_SPACEPAD_TOKEN = 300, - H5T_CSET_ASCII_TOKEN = 301, - H5T_CSET_UTF8_TOKEN = 302, - H5T_C_S1_TOKEN = 303, - H5T_FORTRAN_S1_TOKEN = 304, - H5T_OPAQUE_TOKEN = 305, - OPQ_SIZE_TOKEN = 306, - OPQ_TAG_TOKEN = 307, - H5T_COMPOUND_TOKEN = 308, - H5T_ENUM_TOKEN = 309, - H5T_ARRAY_TOKEN = 310, - H5T_VLEN_TOKEN = 311, - STRING = 312, - NUMBER = 313 -}; +# define YYTOKENTYPE + enum yytokentype + { + YYEMPTY = -2, + YYEOF = 0, /* "end of file" */ + YYerror = 256, /* error */ + YYUNDEF = 257, /* "invalid token" */ + H5T_STD_I8BE_TOKEN = 258, /* H5T_STD_I8BE_TOKEN */ + H5T_STD_I8LE_TOKEN = 259, /* H5T_STD_I8LE_TOKEN */ + H5T_STD_I16BE_TOKEN = 260, /* H5T_STD_I16BE_TOKEN */ + H5T_STD_I16LE_TOKEN = 261, /* H5T_STD_I16LE_TOKEN */ + H5T_STD_I32BE_TOKEN = 262, /* H5T_STD_I32BE_TOKEN */ + H5T_STD_I32LE_TOKEN = 263, /* H5T_STD_I32LE_TOKEN */ + H5T_STD_I64BE_TOKEN = 264, /* H5T_STD_I64BE_TOKEN */ + H5T_STD_I64LE_TOKEN = 265, /* H5T_STD_I64LE_TOKEN */ + H5T_STD_U8BE_TOKEN = 266, /* H5T_STD_U8BE_TOKEN */ + H5T_STD_U8LE_TOKEN = 267, /* H5T_STD_U8LE_TOKEN */ + H5T_STD_U16BE_TOKEN = 268, /* H5T_STD_U16BE_TOKEN */ + H5T_STD_U16LE_TOKEN = 269, /* H5T_STD_U16LE_TOKEN */ + H5T_STD_U32BE_TOKEN = 270, /* H5T_STD_U32BE_TOKEN */ + H5T_STD_U32LE_TOKEN = 271, /* H5T_STD_U32LE_TOKEN */ + H5T_STD_U64BE_TOKEN = 272, /* H5T_STD_U64BE_TOKEN */ + H5T_STD_U64LE_TOKEN = 273, /* H5T_STD_U64LE_TOKEN */ + H5T_NATIVE_CHAR_TOKEN = 274, /* H5T_NATIVE_CHAR_TOKEN */ + H5T_NATIVE_SCHAR_TOKEN = 275, /* H5T_NATIVE_SCHAR_TOKEN */ + H5T_NATIVE_UCHAR_TOKEN = 276, /* H5T_NATIVE_UCHAR_TOKEN */ + H5T_NATIVE_SHORT_TOKEN = 277, /* H5T_NATIVE_SHORT_TOKEN */ + H5T_NATIVE_USHORT_TOKEN = 278, /* H5T_NATIVE_USHORT_TOKEN */ + H5T_NATIVE_INT_TOKEN = 279, /* H5T_NATIVE_INT_TOKEN */ + H5T_NATIVE_UINT_TOKEN = 280, /* H5T_NATIVE_UINT_TOKEN */ + H5T_NATIVE_LONG_TOKEN = 281, /* H5T_NATIVE_LONG_TOKEN */ + H5T_NATIVE_ULONG_TOKEN = 282, /* H5T_NATIVE_ULONG_TOKEN */ + H5T_NATIVE_LLONG_TOKEN = 283, /* H5T_NATIVE_LLONG_TOKEN */ + H5T_NATIVE_ULLONG_TOKEN = 284, /* H5T_NATIVE_ULLONG_TOKEN */ + H5T_IEEE_F32BE_TOKEN = 285, /* H5T_IEEE_F32BE_TOKEN */ + H5T_IEEE_F32LE_TOKEN = 286, /* H5T_IEEE_F32LE_TOKEN */ + H5T_IEEE_F64BE_TOKEN = 287, /* H5T_IEEE_F64BE_TOKEN */ + H5T_IEEE_F64LE_TOKEN = 288, /* H5T_IEEE_F64LE_TOKEN */ + H5T_NATIVE_FLOAT_TOKEN = 289, /* H5T_NATIVE_FLOAT_TOKEN */ + H5T_NATIVE_DOUBLE_TOKEN = 290, /* H5T_NATIVE_DOUBLE_TOKEN */ + H5T_NATIVE_LDOUBLE_TOKEN = 291, /* H5T_NATIVE_LDOUBLE_TOKEN */ + H5T_STRING_TOKEN = 292, /* H5T_STRING_TOKEN */ + STRSIZE_TOKEN = 293, /* STRSIZE_TOKEN */ + STRPAD_TOKEN = 294, /* STRPAD_TOKEN */ + CSET_TOKEN = 295, /* CSET_TOKEN */ + CTYPE_TOKEN = 296, /* CTYPE_TOKEN */ + H5T_VARIABLE_TOKEN = 297, /* H5T_VARIABLE_TOKEN */ + H5T_STR_NULLTERM_TOKEN = 298, /* H5T_STR_NULLTERM_TOKEN */ + H5T_STR_NULLPAD_TOKEN = 299, /* H5T_STR_NULLPAD_TOKEN */ + H5T_STR_SPACEPAD_TOKEN = 300, /* H5T_STR_SPACEPAD_TOKEN */ + H5T_CSET_ASCII_TOKEN = 301, /* H5T_CSET_ASCII_TOKEN */ + H5T_CSET_UTF8_TOKEN = 302, /* H5T_CSET_UTF8_TOKEN */ + H5T_C_S1_TOKEN = 303, /* H5T_C_S1_TOKEN */ + H5T_FORTRAN_S1_TOKEN = 304, /* H5T_FORTRAN_S1_TOKEN */ + H5T_OPAQUE_TOKEN = 305, /* H5T_OPAQUE_TOKEN */ + OPQ_SIZE_TOKEN = 306, /* OPQ_SIZE_TOKEN */ + OPQ_TAG_TOKEN = 307, /* OPQ_TAG_TOKEN */ + H5T_COMPOUND_TOKEN = 308, /* H5T_COMPOUND_TOKEN */ + H5T_ENUM_TOKEN = 309, /* H5T_ENUM_TOKEN */ + H5T_ARRAY_TOKEN = 310, /* H5T_ARRAY_TOKEN */ + H5T_VLEN_TOKEN = 311, /* H5T_VLEN_TOKEN */ + STRING = 312, /* STRING */ + NUMBER = 313 /* NUMBER */ + }; + typedef enum yytokentype yytoken_kind_t; #endif -#if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE { -/* Line 2058 of yacc.c */ +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +union YYSTYPE +{ #line 72 "hl/src/H5LTparse.y" - int ival; /*for integer token*/ - char *sval; /*for name string*/ - hid_t hid; /*for hid_t token*/ + int ival; /*for integer token*/ + char *sval; /*for name string*/ + hid_t hid; /*for hid_t token*/ -/* Line 2058 of yacc.c */ -#line 122 "hl/src/H5LTparse.h" -} YYSTYPE; -#define YYSTYPE_IS_TRIVIAL 1 -#define yystype YYSTYPE /* obsolescent; will be withdrawn */ -#define YYSTYPE_IS_DECLARED 1 +#line 128 "hl/src/H5LTparse.h" + +}; +typedef union YYSTYPE YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 #endif + extern YYSTYPE H5LTyylval; -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int H5LTyyparse(void *YYPARSE_PARAM); -#else -int H5LTyyparse(); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int H5LTyyparse(void); -#else -int H5LTyyparse(); -#endif -#endif /* ! YYPARSE_PARAM */ +hid_t H5LTyyparse (void); #endif /* !YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED */ diff --git a/release_docs/INSTALL b/release_docs/INSTALL index d61422e..e38dcf9 100644 --- a/release_docs/INSTALL +++ b/release_docs/INSTALL @@ -351,15 +351,18 @@ CONTENTS so it can be debugged with gdb, dbx, ddd, etc., or it can be compiled with various optimizations. To compile for symbolic debugging (the default for snapshots), say - `--enable-build-mode=production'; to compile with optimizations + `--enable-build-mode=debug'; to compile with optimizations (the default for supported public releases), - say `--enable-build-mode=production'. On some systems the + say `--enable-build-mode=production'. For a 'clean slate' configuration + with optimization disabled and nothing turned on, + say `--enable-build-mode=clean'. On some systems the library can also be compiled for profiling with gprof by saying - `--enable-production=profile'. + `--enable-profiling'. $ ./configure --enable-build-mode=debug #symbolic debugging $ ./configure --enable-build-mode=production #optimized code - $ ./configure --enable-production=profile #for use with gprof + $ ./configure --enable-build-mode=clean #'clean slate' + $ ./configure --enable-profiling #for use with gprof Regardless of whether support for symbolic debugging is enabled, the library can also perform runtime debugging of certain packages diff --git a/test/vfd.c b/test/vfd.c index 373a57e..076273b 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -3336,7 +3336,7 @@ main(void) nerrors += test_stdio() < 0 ? 1 : 0; nerrors += test_windows() < 0 ? 1 : 0; nerrors += test_ros3() < 0 ? 1 : 0; - nerrors += test_splitter() < 0 ? 1 : 0; +/* nerrors += test_splitter() < 0 ? 1 : 0; */ if (nerrors) { HDprintf("***** %d Virtual File Driver TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); -- cgit v0.12 From cdbe6b78f0e5dfd90b8a85beeb762b668ba29fe3 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 8 Oct 2020 09:40:18 -0500 Subject: Merge changes from develop Comments and whitespace Skip file-locking and cache changes --- Makefile.am | 8 +- config/cmake_ext_mod/ConfigureChecks.cmake | 1 + config/cmake_ext_mod/HDFTests.c | 2 +- config/gnu-warnings/4.8 | 3 + config/gnu-warnings/developer-4.8 | 1 - config/gnu-warnings/error-general | 2 +- config/gnu-warnings/no-developer-4.8 | 1 - configure.ac | 3 +- examples/h5_cmprss.c | 2 +- fortran/test/fortranlib_test.F90 | 2 +- hl/fortran/src/H5IMcc.c | 12 +- hl/fortran/src/H5IMfc.c | 24 +- hl/fortran/src/H5IMff.F90 | 24 +- hl/fortran/src/H5LTfc.c | 24 +- hl/fortran/src/H5LTff.F90 | 40 +- hl/fortran/src/H5TBfc.c | 18 +- hl/fortran/src/H5TBff.F90 | 18 +- hl/src/H5DS.c | 97 +- hl/src/H5IM.c | 30 +- hl/src/H5LD.c | 4 - hl/src/H5PT.c | 58 +- hl/src/H5TB.c | 55 +- hl/test/gen_test_ds.c | 2 - hl/test/h5hltest.h | 2 +- hl/test/test_ds.c | 2 - hl/test/test_dset_append.c | 4 - hl/test/test_image.c | 4 - hl/test/test_ld.c | 5 - hl/test/test_lite.c | 2 - hl/test/test_packet.c | 2 - hl/test/test_table.c | 2 - hl/tools/gif2h5/h52gifgentst.c | 2 +- hl/tools/h5watch/h5watch.c | 5 +- src/H5A.c | 23 +- src/H5AC.c | 35 +- src/H5ACmpio.c | 10 + src/H5Abtree2.c | 9 +- src/H5B.c | 6 +- src/H5B2dbg.c | 15 +- src/H5B2test.c | 4 +- src/H5Bdbg.c | 11 +- src/H5C.c | 8723 ++++++++++++++-------------- src/H5Cdbg.c | 42 +- src/H5Cimage.c | 52 +- src/H5Cmpio.c | 46 +- src/H5Cpkg.h | 46 +- src/H5Cprivate.h | 10 +- src/H5Dbtree.c | 4 +- src/H5Dbtree2.c | 10 +- src/H5Dchunk.c | 7 +- src/H5Ddbg.c | 3 +- src/H5Ddeprec.c | 4 +- src/H5Dearray.c | 12 +- src/H5Dfarray.c | 12 +- src/H5Dmpio.c | 10 +- src/H5Dnone.c | 2 +- src/H5Dsingle.c | 2 +- src/H5E.c | 74 +- src/H5EA.c | 1220 ++-- src/H5EAcache.c | 2166 +++---- src/H5EAdbg.c | 549 +- src/H5EAdblkpage.c | 273 +- src/H5EAdblock.c | 480 +- src/H5EAhdr.c | 716 +-- src/H5EAiblock.c | 537 +- src/H5EAint.c | 28 +- src/H5EAsblock.c | 422 +- src/H5EAstat.c | 16 +- src/H5EAtest.c | 270 +- src/H5Edeprec.c | 13 +- src/H5Eint.c | 33 +- src/H5F.c | 145 - src/H5FA.c | 837 +-- src/H5FAcache.c | 1116 ++-- src/H5FAdbg.c | 315 +- src/H5FAdblkpage.c | 260 +- src/H5FAdblock.c | 430 +- src/H5FAhdr.c | 428 +- src/H5FAint.c | 28 +- src/H5FAstat.c | 16 +- src/H5FAtest.c | 194 +- src/H5FDfamily.c | 4 +- src/H5FDhdfs.c | 75 +- src/H5FDhdfs.h | 10 +- src/H5FDlog.c | 70 +- src/H5FDs3comms.c | 7 +- src/H5FDstdio.c | 3 +- src/H5FSdbg.c | 19 +- src/H5Fdbg.c | 11 +- src/H5Fint.c | 144 + src/H5Gent.c | 6 +- src/H5Gobj.c | 2 +- src/H5HFbtree2.c | 16 +- src/H5HFdbg.c | 86 +- src/H5HFdblock.c | 2 +- src/H5HL.c | 1211 ++-- src/H5HLdbg.c | 133 +- src/H5HLdblk.c | 244 +- src/H5HLint.c | 108 +- src/H5HLprfx.c | 70 +- src/H5I.c | 4 +- src/H5Ipublic.h | 6 + src/H5MF.c | 4 + src/H5MFdbg.c | 21 +- src/H5Oainfo.c | 16 +- src/H5Oattr.c | 14 +- src/H5Ocache_image.c | 5 +- src/H5Ocont.c | 2 +- src/H5Odbg.c | 19 +- src/H5Odrvinfo.c | 2 +- src/H5Odtype.c | 7 +- src/H5Oefl.c | 18 +- src/H5Ofill.c | 2 +- src/H5Oflush.c | 22 +- src/H5Ofsinfo.c | 17 +- src/H5Oint.c | 22 +- src/H5Olayout.c | 21 +- src/H5Olinfo.c | 19 +- src/H5Olink.c | 9 +- src/H5Opline.c | 6 +- src/H5Osdspace.c | 4 +- src/H5Oshared.c | 3 +- src/H5Oshmesg.c | 3 +- src/H5Ostab.c | 4 +- src/H5PLpath.c | 4 +- src/H5PLprivate.h | 4 +- src/H5Rint.c | 3 +- src/H5SM.c | 22 +- src/H5SMbtree2.c | 6 +- src/H5Smpio.c | 28 +- src/H5Snone.c | 2 +- src/H5T.c | 6 +- src/H5Tcommit.c | 23 +- src/H5Tconv.c | 10 +- src/H5Tdbg.c | 22 +- src/H5Tpkg.h | 3 +- src/H5Tprivate.h | 5 +- src/H5Tref.c | 34 + src/H5VLint.c | 22 +- src/H5Z.c | 27 +- src/H5dbg.c | 25 +- src/H5private.h | 18 +- src/H5public.h | 131 +- src/H5system.c | 425 +- src/H5trace.c | 26 +- src/H5win32defs.h | 7 + src/Makefile.am | 4 +- test/accum.c | 14 +- test/big.c | 6 +- test/cache.c | 374 +- test/cache_common.c | 15 +- test/cache_tagging.c | 3 +- test/chunk_info.c | 36 +- test/dsets.c | 7 +- test/dt_arith.c | 34 +- test/dtypes.c | 14 +- test/earray.c | 29 +- test/farray.c | 12 +- test/fheap.c | 30 +- test/fillval.c | 18 +- test/filter_plugin.c | 2 +- test/freespace.c | 15 +- test/gen_new_super.c | 12 +- test/gen_nullspace.c | 22 +- test/h5test.c | 36 +- test/hyperslab.c | 4 +- test/mf.c | 15 +- test/mirror_vfd.c | 4 +- test/ros3.c | 36 +- test/s3comms.c | 38 +- test/swmr.c | 10 +- test/vfd.c | 2 +- testpar/t_2Gio.c | 9 +- testpar/t_bigio.c | 35 +- testpar/t_cache.c | 60 +- testpar/t_cache_image.c | 10 +- testpar/t_filters_parallel.c | 134 +- testpar/t_shapesame.c | 12 +- tools/lib/h5diff_util.c | 4 +- tools/lib/h5tools_dump.c | 6 +- tools/src/h5dump/h5dump_ddl.c | 6 +- tools/src/h5dump/h5dump_xml.c | 4 +- tools/src/h5import/h5import.c | 2 +- tools/src/h5ls/h5ls.c | 13 +- tools/src/h5repack/h5repack.c | 2 +- tools/src/h5stat/h5stat.c | 82 +- tools/src/misc/h5clear.c | 2 +- tools/src/misc/h5debug.c | 2 +- tools/test/perform/chunk.c | 2 +- tools/test/perform/chunk_cache.c | 8 +- tools/test/perform/perf.c | 5 +- tools/test/perform/pio_standalone.h | 12 +- tools/test/perform/sio_engine.c | 2 +- tools/test/perform/sio_perf.c | 4 +- tools/test/perform/sio_standalone.h | 12 +- 195 files changed, 12289 insertions(+), 12380 deletions(-) diff --git a/Makefile.am b/Makefile.am index 8565788..9cb5d02 100644 --- a/Makefile.am +++ b/Makefile.am @@ -190,10 +190,10 @@ trace: # Run tests with different Virtual File Drivers. # Currently, only invoke check-vfd in the test directory. check-vfd: - for d in src utils test; do \ - if test $$d != .; then \ - (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ - fi; \ + for d in src utils test; do \ + if test $$d != .; then \ + (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ + fi; \ done # Run tests with different passthrough Virtual Object Layer Connectors. diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 0ddb6d0..7988772 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -69,6 +69,7 @@ if (MINGW) set (WINDOWS 1) # MinGW tries to imitate Windows set (CMAKE_REQUIRED_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1") set (${HDF_PREFIX}_HAVE_WINSOCK2_H 1) + set (__USE_MINGW_ANSI_STDIO 1) endif () if (WIN32 AND NOT MINGW) diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c index 31a568a..bed9444 100644 --- a/config/cmake_ext_mod/HDFTests.c +++ b/config/cmake_ext_mod/HDFTests.c @@ -178,7 +178,7 @@ int DebugReport(int reportType, char* message, int* returnValue) int main(void) { - char *llwidthArgs[] = { "I64", "l64", "l", "L", "q", "ll", NULL }; + char *llwidthArgs[] = { "I64", "l64", "ll", "l", "L", "q", NULL }; char *s = malloc(128); char **currentArg = NULL; LL_TYPE x = (LL_TYPE)1048576 * (LL_TYPE)1048576; diff --git a/config/gnu-warnings/4.8 b/config/gnu-warnings/4.8 index c7e3dd1..05f4d92 100644 --- a/config/gnu-warnings/4.8 +++ b/config/gnu-warnings/4.8 @@ -9,6 +9,9 @@ # warning flag added for GCC >= 4.5 -Wstrict-overflow=5 +# This warning can only be truly addressed using the gcc extension of +# using D to indicate doubles (e.g., 1.23D). +-Wno-unsuffixed-float-constants # warning flags added for GCC >= 4.6 -Wdouble-promotion diff --git a/config/gnu-warnings/developer-4.8 b/config/gnu-warnings/developer-4.8 index fd76f6c..bfd15a1 100644 --- a/config/gnu-warnings/developer-4.8 +++ b/config/gnu-warnings/developer-4.8 @@ -5,7 +5,6 @@ # the variable is never *used* before it has been initialized? # -Wjump-misses-init --Wunsuffixed-float-constants # developer warning flag added for GCC >= 4.6 -Wsuggest-attribute=const diff --git a/config/gnu-warnings/error-general b/config/gnu-warnings/error-general index f0e61f8..4358b20 100644 --- a/config/gnu-warnings/error-general +++ b/config/gnu-warnings/error-general @@ -59,7 +59,7 @@ # jni/h5util.c # -Werror=format(-overflow) # --Wformat +-Werror=format # # #Examples and tests do not use the same set of extensive warning flags as libraries diff --git a/config/gnu-warnings/no-developer-4.8 b/config/gnu-warnings/no-developer-4.8 index 1e29c78..09a9a96 100644 --- a/config/gnu-warnings/no-developer-4.8 +++ b/config/gnu-warnings/no-developer-4.8 @@ -1,6 +1,5 @@ # no-developer warning flag added for GCC >= 4.5 -Wno-jump-misses-init --Wno-unsuffixed-float-constants # no-developer warning flag added for GCC >= 4.6 -Wno-suggest-attribute=const diff --git a/configure.ac b/configure.ac index 3b6eb1c..6e43f56 100644 --- a/configure.ac +++ b/configure.ac @@ -1248,6 +1248,7 @@ case "$host_cpu-$host_vendor-$host_os" in ## VFD on Linux systems. H5_CPPFLAGS="-D_GNU_SOURCE $H5_CPPFLAGS" ;; + esac ## Need to add the AM_ and H5_ into CFLAGS/CPPFLAGS to make them visible @@ -2035,7 +2036,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ AC_MSG_CHECKING([how to print long long]) AC_CACHE_VAL([hdf5_cv_printf_ll], [ -for hdf5_cv_printf_ll in l ll L q unknown; do +for hdf5_cv_printf_ll in ll l L q unknown; do AC_RUN_IFELSE( [AC_LANG_PROGRAM([ #include diff --git a/examples/h5_cmprss.c b/examples/h5_cmprss.c index 7557cf5..bb77e28 100644 --- a/examples/h5_cmprss.c +++ b/examples/h5_cmprss.c @@ -99,7 +99,7 @@ main() for (i = 0; i < numfilt; i++) { nelmts = 0; - filter_type = H5Pget_filter2(plist_id, 0, &flags, &nelmts, NULL, 0, NULL, &filter_info); + filter_type = H5Pget_filter2(plist_id, i, &flags, &nelmts, NULL, 0, NULL, &filter_info); printf("Filter Type: "); switch (filter_type) { case H5Z_FILTER_DEFLATE: diff --git a/fortran/test/fortranlib_test.F90 b/fortran/test/fortranlib_test.F90 index 92f9279..01baef5 100644 --- a/fortran/test/fortranlib_test.F90 +++ b/fortran/test/fortranlib_test.F90 @@ -183,7 +183,7 @@ PROGRAM fortranlibtest CALL write_test_status(ret_total_error, ' Multi file driver test', total_error) ret_total_error = 0 - CALL test_chunk_cache (cleanup, ret_total_error) + CALL test_chunk_cache(cleanup, ret_total_error) CALL write_test_status(ret_total_error, ' Dataset chunk cache configuration', total_error) ! diff --git a/hl/fortran/src/H5IMcc.c b/hl/fortran/src/H5IMcc.c index 8a43589..fc29302 100644 --- a/hl/fortran/src/H5IMcc.c +++ b/hl/fortran/src/H5IMcc.c @@ -29,7 +29,7 @@ herr_t H5IM_get_palette(hid_t loc_id, const char *image_name, int pal_number, hi * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: May 10, 2005 * @@ -121,7 +121,7 @@ H5IMmake_image_8bitf(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: May 10, 2005 * @@ -236,7 +236,7 @@ H5IMmake_image_24bitf(hid_t loc_id, const char *dset_name, hsize_t width, hsize_ * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: May 10, 2005 * @@ -292,7 +292,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: May 10, 2005 * @@ -385,7 +385,7 @@ H5IMmake_palettef(hid_t loc_id, const char *pal_name, const hsize_t *pal_dims, i * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: May 10, 2005 * @@ -421,7 +421,7 @@ H5IMget_palettef(hid_t loc_id, const char *image_name, int pal_number, int_f *pa * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: May 10, 2005 * diff --git a/hl/fortran/src/H5IMfc.c b/hl/fortran/src/H5IMfc.c index f892e51..b01ed30 100644 --- a/hl/fortran/src/H5IMfc.c +++ b/hl/fortran/src/H5IMfc.c @@ -24,7 +24,7 @@ * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 05, 2004 * @@ -79,7 +79,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 05, 2004 * @@ -129,7 +129,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 05, 2004 * @@ -192,7 +192,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 05, 2004 * @@ -269,7 +269,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 06, 2004 * @@ -315,7 +315,7 @@ h5imis_image_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name) * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 06, 2004 * @@ -365,7 +365,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 06, 2004 * @@ -425,7 +425,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 06, 2004 * @@ -485,7 +485,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 06 2004 * @@ -541,7 +541,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 06 2004 * @@ -600,7 +600,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 06 2004 * @@ -653,7 +653,7 @@ done: * * Return: true, false, fail * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 06, 2004 * diff --git a/hl/fortran/src/H5IMff.F90 b/hl/fortran/src/H5IMff.F90 index ffa18aa..3438e7f 100644 --- a/hl/fortran/src/H5IMff.F90 +++ b/hl/fortran/src/H5IMff.F90 @@ -41,7 +41,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -95,7 +95,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -142,7 +142,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -204,7 +204,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -267,7 +267,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -313,7 +313,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 06, 2004 ! @@ -364,7 +364,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 06, 2004 ! @@ -416,7 +416,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 06, 2004 ! @@ -467,7 +467,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -516,7 +516,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 06, 2004 ! @@ -567,7 +567,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 06, 2004 ! @@ -619,7 +619,7 @@ CONTAINS ! ! Return: true, false, fail ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 06, 2004 ! diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c index afe6419..0813f66 100644 --- a/hl/fortran/src/H5LTfc.c +++ b/hl/fortran/src/H5LTfc.c @@ -24,7 +24,7 @@ * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: September 09, 2004 * @@ -88,7 +88,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: September 09, 2004 * @@ -143,7 +143,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: September 09, 2004 * @@ -203,7 +203,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: September 09, 2004 * @@ -256,7 +256,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 05, 2004 * @@ -358,7 +358,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 05, 2004 * @@ -442,7 +442,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 05, 2004 * @@ -512,7 +512,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: September 09, 2004 * @@ -567,7 +567,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: September 09, 2004 * @@ -613,7 +613,7 @@ h5ltfind_dataset_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name) * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: September 09, 2004 * @@ -686,7 +686,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 05, 2004 * @@ -749,7 +749,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: September 09, 2004 * diff --git a/hl/fortran/src/H5LTff.F90 b/hl/fortran/src/H5LTff.F90 index bc8734f..5cd255c 100644 --- a/hl/fortran/src/H5LTff.F90 +++ b/hl/fortran/src/H5LTff.F90 @@ -164,7 +164,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 1, 2004 ! @@ -385,7 +385,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 22, 2004 ! @@ -426,7 +426,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 22, 2004 ! @@ -595,7 +595,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 22, 2004 ! @@ -770,7 +770,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 22, 2004 ! @@ -933,7 +933,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 22, 2004 ! @@ -983,7 +983,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 22, 2004 ! @@ -1092,7 +1092,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1143,7 +1143,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1193,7 +1193,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1245,7 +1245,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1350,7 +1350,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1397,7 +1397,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1443,7 +1443,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1490,7 +1490,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1551,7 +1551,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 30, 2004 ! @@ -1600,7 +1600,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1644,7 +1644,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 30, 2004 ! @@ -1703,7 +1703,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: October 05, 2004 ! @@ -1757,7 +1757,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! - ! Programmer: pvn@ncsa.uiuc.edu + ! Programmer: Pedro Vicente ! ! Date: September 30, 2004 ! diff --git a/hl/fortran/src/H5TBfc.c b/hl/fortran/src/H5TBfc.c index c95600b..35d31cc 100644 --- a/hl/fortran/src/H5TBfc.c +++ b/hl/fortran/src/H5TBfc.c @@ -26,7 +26,7 @@ * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 06, 2004 * @@ -296,7 +296,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 12, 2004 * @@ -344,7 +344,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 12, 2004 * @@ -392,7 +392,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 12, 2004 * @@ -436,7 +436,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 12, 2004 * @@ -480,7 +480,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 13, 2004 * @@ -527,7 +527,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 13, 2004 * @@ -572,7 +572,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 12, 2004 * @@ -617,7 +617,7 @@ done: * * Return: Success: 0, Failure: -1 * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: October 13, 2004 * diff --git a/hl/fortran/src/H5TBff.F90 b/hl/fortran/src/H5TBff.F90 index c3db01e..e39af97 100644 --- a/hl/fortran/src/H5TBff.F90 +++ b/hl/fortran/src/H5TBff.F90 @@ -172,7 +172,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 06, 2004 ! @@ -424,7 +424,7 @@ CONTAINS ! ! Purpose: Writes one field ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 12, 2004 ! @@ -505,7 +505,7 @@ CONTAINS ! ! Purpose: Reads one field ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 12, 2004 ! @@ -586,7 +586,7 @@ CONTAINS ! ! Purpose: Writes one field ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 12, 2004 ! @@ -661,7 +661,7 @@ CONTAINS ! ! Purpose: Reads one field ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 12, 2004 ! @@ -734,7 +734,7 @@ CONTAINS ! ! Purpose: Inserts one field ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 13, 2004 ! @@ -807,7 +807,7 @@ CONTAINS ! ! Purpose: Inserts one field ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 13, 2004 ! @@ -858,7 +858,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 13, 2004 ! @@ -909,7 +909,7 @@ CONTAINS ! ! Return: Success: 0, Failure: -1 ! -! Programmer: pvn@ncsa.uiuc.edu +! Programmer: Pedro Vicente ! ! Date: October 13, 2004 ! diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index e127fa2..216cf46 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -11,9 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include -#include #include "H5DSprivate.h" #include "H5LTprivate.h" #include "H5IMprivate.h" @@ -34,17 +31,12 @@ static hid_t H5DS_get_REFLIST_type(void); * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: January 04, 2005 * - * Comments: - * - * Modifications: - * *------------------------------------------------------------------------- */ - herr_t H5DSset_scale(hid_t dsid, const char *dimname) { @@ -105,17 +97,12 @@ H5DSset_scale(hid_t dsid, const char *dimname) * If DSID is not a Dimension Scale * If DID is a Dimension Scale (A Dimension Scale cannot have scales) * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: December 20, 2004 * - * Comments: - * - * Modifications: - * *------------------------------------------------------------------------- */ - herr_t H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx) { @@ -558,19 +545,12 @@ out: * Note that a scale may be associated with more than dimension of the same dataset. * If so, the detach operation only deletes one of the associations, for DID. * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: December 20, 2004 * - * Comments: - * - * Modifications: Function didn't delete DIMENSION_LIST attribute, when - * all dimension scales were detached from a dataset; added. - * 2010/05/13 EIP - * *------------------------------------------------------------------------- */ - herr_t H5DSdetach_scale(hid_t did, hid_t dsid, unsigned int idx) { @@ -944,17 +924,12 @@ out: * If DSID is not a Dimension Scale * If DID is a Dimension Scale (A Dimension Scale cannot have scales) * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: February 18, 2005 * - * Comments: - * - * Modifications: - * *------------------------------------------------------------------------- */ - htri_t H5DSis_attached(hid_t did, hid_t dsid, unsigned int idx) { @@ -1263,17 +1238,12 @@ out: * C. Negative causes the iterator to immediately return that value, * indicating failure. * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: January 31, 2005 * - * Comments: - * - * Modifications: - * *------------------------------------------------------------------------- */ - herr_t H5DSiterate_scales(hid_t did, unsigned int dim, int *ds_idx, H5DS_iterate_t visitor, void *visitor_data) { @@ -1433,17 +1403,12 @@ out: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: January 11, 2005 * - * Comments: - * - * Modifications: - * *------------------------------------------------------------------------- */ - herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) { @@ -1459,6 +1424,9 @@ H5DSset_label(hid_t did, unsigned int idx, const char *label) char ** buf; /* discarding the 'const' qualifier in the free */ char const **const_buf; /* buf calls */ } u; + + HDmemset(&u, 0, sizeof(u)); + /*------------------------------------------------------------------------- * parameter checking *------------------------------------------------------------------------- @@ -1638,16 +1606,10 @@ out: * * Return: 0 if no label found, size of label if found, Failure: FAIL * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: January 11, 2005 * - * Comments: - * - * Modifications: - * JIRA HDFFV-7673: Added a check to see if the label name exists, - * if not then returns zero. July 30, 2011. MSB - * *------------------------------------------------------------------------- */ ssize_t @@ -1793,19 +1755,12 @@ out: * * Return: size of name if found, zero if not found, Failure: FAIL * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: January 04, 2005 * - * Comments: - * - * Modifications: - * The size of the name returned should not include the NULL termination - * in its value so as to be consistent with other HDF5 APIs. - * *------------------------------------------------------------------------- */ - ssize_t H5DSget_scale_name(hid_t did, char *name, size_t size) { @@ -1917,17 +1872,12 @@ out: * * Return: 1, is, 0, not, FAIL, error * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: January 04, 2005 * - * Comments: - * - * Modifications: - * *------------------------------------------------------------------------- */ - htri_t H5DSis_scale(hid_t did) { @@ -1939,7 +1889,7 @@ H5DSis_scale(hid_t did) char * buf; /* Name of attribute */ hsize_t storage_size; /* Size of storage for attribute */ - /*------------------------------------------------------------------------- + /*------------------------------------------------------------------------ * parameter checking *------------------------------------------------------------------------- */ @@ -2021,17 +1971,12 @@ out: * Success: number of scales * Failure: FAIL * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: January 13, 2005 * - * Comments: - * - * Modifications: - * *------------------------------------------------------------------------- */ - int H5DSget_num_scales(hid_t did, unsigned int idx) { @@ -2144,17 +2089,12 @@ out: * * Return: true, false, fail * - * Programmer: pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: March 19, 2005 * - * Comments: - * - * Modifications: - * *------------------------------------------------------------------------- */ - static herr_t H5DS_is_reserved(hid_t did) { @@ -2235,17 +2175,12 @@ out: * * Return: Type identifier on success and negative on failure * - * Programmer: epourmal@hdfgroup.org + * Programmer: Elena Pourmal * * Date: May 22, 2010 * - * Comments: - * - * Modifications: - * *------------------------------------------------------------------------- */ - static hid_t H5DS_get_REFLIST_type(void) { diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c index e08d006..fb2ccb3 100644 --- a/hl/src/H5IM.c +++ b/hl/src/H5IM.c @@ -13,8 +13,6 @@ #include "H5IMprivate.h" #include "H5LTprivate.h" -#include -#include /*------------------------------------------------------------------------- * Function: H5IMmake_image_8bit @@ -23,7 +21,7 @@ * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: June 13, 2001 * @@ -75,7 +73,7 @@ H5IMmake_image_8bit(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: June 13, 2001 * @@ -151,7 +149,7 @@ H5IMmake_image_24bit(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t * * Return: * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: May 28, 2001 * @@ -192,7 +190,7 @@ find_palette(hid_t loc_id, const char *name, const H5A_info_t *ainfo, void *op_d * * Return: Success: 1, Failure: 0 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: May 11, 2001 * @@ -218,7 +216,7 @@ H5IM_find_palette(hid_t loc_id) * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: July 25, 2001 * @@ -386,7 +384,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: June 13, 2001 * @@ -433,7 +431,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: May 01, 2001 * @@ -485,7 +483,7 @@ H5IMmake_palette(hid_t loc_id, const char *pal_name, const hsize_t *pal_dims, co * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: May 01, 2001 * @@ -655,7 +653,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: September 10, 2001 * @@ -752,7 +750,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: July 22, 2001 * @@ -837,7 +835,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: July 22, 2001 * @@ -946,7 +944,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: August 30, 2001 * @@ -1048,7 +1046,7 @@ out: * * Return: true, false, fail * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: August 30, 2001 * @@ -1148,7 +1146,7 @@ out: * * Return: true, false, fail * - * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente Nunes * * Date: August 30, 2001 * diff --git a/hl/src/H5LD.c b/hl/src/H5LD.c index 55c60dd..73043a5 100644 --- a/hl/src/H5LD.c +++ b/hl/src/H5LD.c @@ -11,10 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include -#include -#include #include "H5LDprivate.h" /*------------------------------------------------------------------------- diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c index f397365..7e18d33 100644 --- a/hl/src/H5PT.c +++ b/hl/src/H5PT.c @@ -11,8 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include - #include "H5PTprivate.h" #include "H5TBprivate.h" @@ -52,8 +50,8 @@ static herr_t H5PT_get_index(htbl_t *table_id, hsize_t *pt_index); * * Return: Success: table ID, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu (Author of H5PTcreate_fl) - * James Laird, jlaird@ncsa.uiuc.edu (Author of H5PTcreate_fl) + * Programmer: Nat Furrer (Author of H5PTcreate_fl) + * James Laird (Author of H5PTcreate_fl) * * Date: March 12, 2004 * @@ -177,8 +175,8 @@ error: * * Return: Success: table ID, Failure: Negative * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 12, 2004 * @@ -293,8 +291,8 @@ error: * * Return: Success: table ID, Failure: Negative * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 10, 2004 * @@ -418,8 +416,8 @@ H5PT_free_id(void *id) * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 10, 2004 * @@ -466,8 +464,8 @@ error: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: April 21, 2004 * @@ -520,8 +518,8 @@ error: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 12, 2004 * @@ -570,8 +568,8 @@ error: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 10, 2004 * @@ -614,8 +612,8 @@ error: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 12, 2004 * @@ -663,8 +661,8 @@ error: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 12, 2004 * @@ -716,8 +714,8 @@ H5PT_get_index(htbl_t *table, hsize_t *pt_index) * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: April 23, 2004 * @@ -777,8 +775,8 @@ H5PTget_index(hid_t table_id, hsize_t *pt_index) * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 12, 2004 * @@ -814,8 +812,8 @@ error: * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 12, 2004 * @@ -844,8 +842,8 @@ H5PTis_valid(hid_t table_id) * * Return: True: 1, False: 0, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: April 14, 2004 * @@ -894,8 +892,8 @@ error: * Return: Success: SUCCEED, Failure: FAIL * -2 if memory was reclaimed but another error occurred * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: April 12, 2004 * diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index 5d51856..a3dfdae 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -11,9 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include - #include "H5LTprivate.h" #include "H5TBprivate.h" @@ -46,7 +43,7 @@ static hid_t H5TB_create_type(hid_t loc_id, const char *dset_name, size_t type_s * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * Quincey Koziol * * Date: January 17, 2001 @@ -257,7 +254,7 @@ out: * Return: Success: 0, Failure: -1 * * Programmers: - * Pedro Vicente, pvn@ncsa.uiuc.edu + * Pedro Vicente * Quincey Koziol * * Date: November 19, 2001 @@ -323,7 +320,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: November 19, 2001 * @@ -415,7 +412,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: November 21, 2001 * @@ -573,7 +570,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: November 21, 2001 * @@ -738,7 +735,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: November 20, 2001 * @@ -811,7 +808,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: November 19, 2001 * @@ -877,7 +874,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: November 19, 2001 * @@ -1034,7 +1031,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: November 19, 2001 * @@ -1192,7 +1189,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: November 26, 2001 * @@ -1352,7 +1349,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: November 26, 2001 * @@ -1504,7 +1501,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: December 5, 2001 * @@ -1633,7 +1630,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: December 10, 2001 * @@ -1989,7 +1986,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: January 30, 2002 * @@ -2406,7 +2403,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: January 30, 2002 * @@ -2858,7 +2855,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: January 30, 2001 * @@ -2884,7 +2881,7 @@ H5TBAget_title(hid_t loc_id, char *table_title) * * Return: Success: TRUE/FALSE, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: January 30, 2002 * @@ -2954,7 +2951,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: November 19, 2001 * @@ -3039,7 +3036,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: November 19, 2001 * @@ -3156,7 +3153,7 @@ out: * * Return: Success: TRUE/FALSE, Failure: N/A * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: November 19, 2001 * @@ -3197,7 +3194,7 @@ H5TB_find_field(const char *field, const char *field_list) * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: December 6, 2001 * @@ -3258,7 +3255,7 @@ out: * * Return: Success: the memory type ID, Failure: -1 * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu + * Programmer: Pedro Vicente * * Date: March 31, 2004 * @@ -3354,8 +3351,8 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 8, 2004 * @@ -3419,8 +3416,8 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer + * James Laird * * Date: March 8, 2004 * diff --git a/hl/test/gen_test_ds.c b/hl/test/gen_test_ds.c index 0138e19..27c3a0b 100644 --- a/hl/test/gen_test_ds.c +++ b/hl/test/gen_test_ds.c @@ -23,8 +23,6 @@ * in test_ds.c will read them. */ -#include -#include #include "h5hltest.h" #include "H5DSpublic.h" #include "H5LTpublic.h" diff --git a/hl/test/h5hltest.h b/hl/test/h5hltest.h index d694f0c..4ccdd78 100644 --- a/hl/test/h5hltest.h +++ b/hl/test/h5hltest.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, April 28, 2006 * * Purpose: Test support stuff. diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index cd7f09d..9e56ff0 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -11,8 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include #include "h5hltest.h" #include "H5srcdir.h" #include "H5DSpublic.h" diff --git a/hl/test/test_dset_append.c b/hl/test/test_dset_append.c index c5cffca..9c5efdd 100644 --- a/hl/test/test_dset_append.c +++ b/hl/test/test_dset_append.c @@ -11,10 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include -#include - #include "h5hltest.h" #include "H5DOpublic.h" diff --git a/hl/test/test_image.c b/hl/test/test_image.c index 2eea47d..0cdb2d3 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -11,10 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include -#include - #include "h5hltest.h" #include "H5srcdir.h" #include "H5LTpublic.h" diff --git a/hl/test/test_ld.c b/hl/test/test_ld.c index 28a0ba0..cc98fc9 100644 --- a/hl/test/test_ld.c +++ b/hl/test/test_ld.c @@ -11,11 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include -#include -#include -#include #include "h5hltest.h" #include "H5srcdir.h" #include "H5LDpublic.h" diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index a255e50..558211e 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -11,8 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include #include "h5hltest.h" #include "H5srcdir.h" #include "H5LTpublic.h" diff --git a/hl/test/test_packet.c b/hl/test/test_packet.c index fe17d38..1224f0f 100644 --- a/hl/test/test_packet.c +++ b/hl/test/test_packet.c @@ -11,8 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include #include "h5hltest.h" #include "H5PTpublic.h" #include "H5TBpublic.h" diff --git a/hl/test/test_table.c b/hl/test/test_table.c index 3f953d4..2f98f4a 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -11,8 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include #include "h5hltest.h" #include "H5srcdir.h" #include "H5TBpublic.h" diff --git a/hl/tools/gif2h5/h52gifgentst.c b/hl/tools/gif2h5/h52gifgentst.c index 9bd7874..020fe26 100644 --- a/hl/tools/gif2h5/h52gifgentst.c +++ b/hl/tools/gif2h5/h52gifgentst.c @@ -22,7 +22,7 @@ * * Purpose: generate files for h52gif testing * - * Programmer: Pedro Vicente, pvn@hdfgroup.org + * Programmer: Pedro Vicente * * Date: March 15, 2007 * diff --git a/hl/tools/h5watch/h5watch.c b/hl/tools/h5watch/h5watch.c index 9bf8047..0190545 100644 --- a/hl/tools/h5watch/h5watch.c +++ b/hl/tools/h5watch/h5watch.c @@ -182,7 +182,7 @@ doprint(hid_t did, hsize_t *start, hsize_t *block, int rank) info.dset_format = "DSET-%s "; info.dset_hidefileno = 0; - info.obj_format = "-%lu:" H5_PRINTF_HADDR_FMT; + info.obj_format = "-%lu:%" PRIuHADDR; info.obj_hidefileno = 0; info.dset_blockformat_pre = "%sBlk%lu: "; @@ -340,7 +340,8 @@ monitor_dataset(hid_t fid, char *dsetname) if (i != ndims) { /* Printing changes in dimension sizes */ for (u = 0; u < ndims; u++) { - HDfprintf(stdout, "dimension %u: %Hu->%Hu", (unsigned)u, prev_dims[u], cur_dims[u]); + HDfprintf(stdout, "dimension %d: %" PRIuHSIZE "->%" PRIuHSIZE "", u, prev_dims[u], + cur_dims[u]); if (cur_dims[u] > prev_dims[u]) HDfprintf(stdout, " (increases)\n"); else if (cur_dims[u] < prev_dims[u]) diff --git a/src/H5A.c b/src/H5A.c index 282d0ed..7071f05 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -299,7 +299,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, h /* Register the new attribute and get an ID for it */ if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: /* Cleanup on failure */ @@ -387,7 +387,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid /* Register the new attribute and get an ID for it */ if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: /* Cleanup on failure */ @@ -455,7 +455,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) /* Register the attribute and get an ID for it */ if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: /* Cleanup on failure */ @@ -1004,7 +1004,7 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", attr_id, ainfo); - /* Check arguments */ + /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") if (!ainfo) @@ -1145,7 +1145,8 @@ done: * * Purpose: Rename an attribute * - * Return: SUCCEED/FAIL + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Raymond Lu * October 23, 2002 @@ -1160,7 +1161,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*s*s", loc_id, old_name, new_name); - /* check arguments */ + /* Check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if (!old_name) @@ -1180,7 +1181,6 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); - /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") @@ -1203,7 +1203,8 @@ done: * * Purpose: Rename an attribute * - * Return: SUCCEED/FAIL + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * February 20, 2007 @@ -1380,14 +1381,14 @@ herr_t H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data, hid_t lapl_id) { - H5VL_object_t * vol_obj = NULL; /* object of loc_id */ + H5VL_object_t * vol_obj = NULL; /* Object location */ H5VL_loc_params_t loc_params; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, obj_name, idx_type, order, idx, op, op_data, lapl_id); - /* check arguments */ + /* Check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") if (!obj_name || !*obj_name) @@ -1590,7 +1591,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_ite if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - /* Delete the attribute through the VOL */ + /* Delete the attribute */ if (H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, NULL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") diff --git a/src/H5AC.c b/src/H5AC.c index 6664fbb..9777134 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -131,8 +131,8 @@ static const H5AC_class_t *const H5AC_class_s[] = { * * Purpose: Initialize the interface from some other layer. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * * Programmer: Quincey Koziol * Saturday, January 18, 2003 @@ -152,7 +152,7 @@ done: } /* end H5AC_init() */ /*------------------------------------------------------------------------- - * Function H5AC__init_package + * Function: H5AC__init_package * * Purpose: Initialize interface-specific information * @@ -191,9 +191,9 @@ H5AC__init_package(void) * * Purpose: Terminate this interface. * - * Return: Success: Positive if anything was done that might - * affect other interfaces; zero otherwise. - * Failure: Negative. + * Return: Success: Positive if anything was done that might + * affect other interfaces; zero otherwise. + * Failure: Negative. * * Programmer: Quincey Koziol * Thursday, July 18, 2002 @@ -475,18 +475,23 @@ H5AC_dest(H5F_t *f) /* Check if log messages are being emitted */ if (H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to get logging status") if (log_enabled && curr_logging) if (H5C_log_write_destroy_cache_msg(f->shared->cache) < 0) + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") /* Tear down logging */ if (log_enabled) if (H5C_log_tear_down(f->shared->cache) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging tear-down failed") #ifdef H5_HAVE_PARALLEL + /* destroying the cache, so clear all collective entries */ if (H5C_clear_coll_entries(f->shared->cache, FALSE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed") aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache); @@ -507,25 +512,39 @@ H5AC_dest(H5F_t *f) /* Destroy the cache */ if (H5C_dest(f) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't destroy cache") + f->shared->cache = NULL; #ifdef H5_HAVE_PARALLEL + if (aux_ptr != NULL) { + if (aux_ptr->d_slist_ptr != NULL) { + HDassert(H5SL_count(aux_ptr->d_slist_ptr) == 0); H5SL_close(aux_ptr->d_slist_ptr); + } /* end if */ + if (aux_ptr->c_slist_ptr != NULL) { + HDassert(H5SL_count(aux_ptr->c_slist_ptr) == 0); H5SL_close(aux_ptr->c_slist_ptr); + } /* end if */ + if (aux_ptr->candidate_slist_ptr != NULL) { + HDassert(H5SL_count(aux_ptr->candidate_slist_ptr) == 0); H5SL_close(aux_ptr->candidate_slist_ptr); + } /* end if */ + aux_ptr->magic = 0; aux_ptr = H5FL_FREE(H5AC_aux_t, aux_ptr); + } /* end if */ #endif /* H5_HAVE_PARALLEL */ @@ -2461,8 +2480,8 @@ H5AC_set_ring(H5AC_ring_t ring, H5AC_ring_t *orig_ring) * Note that this function simply passes the call on to * the metadata cache proper, and returns the result. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * September 17, 2016 diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index b5e1462..7ffa0bc 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -1879,6 +1879,7 @@ H5AC__rsp__p0_only__flush(H5F_t *f) */ if (!H5CX_get_mpi_file_flushing()) if (MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) + HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result) /* Flush data to disk, from rank 0 process */ @@ -1896,6 +1897,7 @@ H5AC__rsp__p0_only__flush(H5F_t *f) /* Check for error on the write operation */ if (result < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush.") /* this code exists primarily for the test bed -- it allows us to @@ -1908,10 +1910,13 @@ H5AC__rsp__p0_only__flush(H5F_t *f) /* Propagate cleaned entries to other ranks. */ if (H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.") done: + FUNC_LEAVE_NOAPI(ret_value) + } /* H5AC__rsp__p0_only__flush() */ /*------------------------------------------------------------------------- @@ -2076,9 +2081,13 @@ H5AC__run_sync_point(H5F_t *f, int sync_point_op) /* Sanity checks */ HDassert(f != NULL); + cache_ptr = f->shared->cache; + HDassert(cache_ptr != NULL); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); + HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) || @@ -2158,6 +2167,7 @@ H5AC__run_sync_point(H5F_t *f, int sync_point_op) #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__run_sync_point() */ diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c index cd5e926..0a1346f 100644 --- a/src/H5Abtree2.c +++ b/src/H5Abtree2.c @@ -364,9 +364,8 @@ H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_ FUNC_ENTER_STATIC_NOERR - HDfprintf(stream, "%*s%-*s {%016Hx, %02x, %u, %08lx}\n", indent, "", fwidth, - "Record:", (hsize_t)nrecord->id.val, (unsigned)nrecord->flags, (unsigned)nrecord->corder, - (unsigned long)nrecord->hash); + HDfprintf(stream, "%*s%-*s {%016" PRIx64 ", %02" PRIx8 ", %u, %08" PRIx32 "}\n", indent, "", fwidth, + "Record:", nrecord->id.val, nrecord->flags, (unsigned)nrecord->corder, nrecord->hash); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5A__dense_btree2_name_debug() */ @@ -516,8 +515,8 @@ H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void FUNC_ENTER_STATIC_NOERR - HDfprintf(stream, "%*s%-*s {%016Hx, %02x, %u}\n", indent, "", fwidth, "Record:", (hsize_t)nrecord->id.val, - (unsigned)nrecord->flags, (unsigned)nrecord->corder); + HDfprintf(stream, "%*s%-*s {%016" PRIx64 ", %02" PRIx8 ", %u}\n", indent, "", fwidth, + "Record:", nrecord->id.val, nrecord->flags, (unsigned)nrecord->corder); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5A__dense_btree2_corder_debug() */ diff --git a/src/H5B.c b/src/H5B.c index e38a14b..c92d429 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -13,9 +13,9 @@ /*------------------------------------------------------------------------- * - * Created: H5B.c - * Jul 10 1997 - * Robb Matzke + * Created: H5B.c + * Jul 10 1997 + * Robb Matzke * * Purpose: Implements balanced, sibling-linked, N-ary trees * capable of storing any type of data with unique key diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index 988a626..b738d78 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -119,10 +119,12 @@ H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Dirty flag:", hdr->cache_info.is_dirty ? "True" : "False"); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Depth:", hdr->depth); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Number of records in tree:", hdr->root.all_nrec); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Number of records in tree:", hdr->root.all_nrec); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of records in root node:", hdr->root.node_nrec); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of root node:", hdr->root.addr); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Address of root node:", hdr->root.addr); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Split percent:", hdr->split_percent); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Merge percent:", hdr->merge_percent); @@ -215,8 +217,8 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, co for (u = 0; u < internal->nrec; u++) { /* Print node pointer */ HDsnprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u); - HDfprintf(stream, "%*s%-*s (%Hu/%u/%a)\n", indent + 3, "", MAX(0, fwidth - 3), temp_str, - internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec, + HDfprintf(stream, "%*s%-*s (%" PRIuHSIZE "/%u/%" PRIuHADDR ")\n", indent + 3, "", MAX(0, fwidth - 3), + temp_str, internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec, internal->node_ptrs[u].addr); /* Print record */ @@ -229,8 +231,9 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, co /* Print final node pointer */ HDsnprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u); - HDfprintf(stream, "%*s%-*s (%Hu/%u/%a)\n", indent + 3, "", MAX(0, fwidth - 3), temp_str, - internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec, internal->node_ptrs[u].addr); + HDfprintf(stream, "%*s%-*s (%" PRIuHSIZE "/%u/%" PRIuHADDR ")\n", indent + 3, "", MAX(0, fwidth - 3), + temp_str, internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec, + internal->node_ptrs[u].addr); done: if (hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) diff --git a/src/H5B2test.c b/src/H5B2test.c index e7c9f44..9f9d012 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -305,7 +305,7 @@ H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record, const HDassert(record); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Record:", *(const hsize_t *)record); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Record:", *(const hsize_t *)record); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5B2__test_debug() */ @@ -435,7 +435,7 @@ H5B2__test2_debug(FILE *stream, int indent, int fwidth, const void *record, cons HDassert(record); - HDfprintf(stream, "%*s%-*s (%Hu, %Hu)\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s (%" PRIuHSIZE ", %" PRIuHSIZE ")\n", indent, "", fwidth, "Record:", ((const H5B2_test_rec_t *)record)->key, ((const H5B2_test_rec_t *)record)->val); FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c index 612d876..c27ab1c 100644 --- a/src/H5Bdbg.c +++ b/src/H5Bdbg.c @@ -95,13 +95,13 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5 ((shared->type->id) == H5B_SNODE_ID ? "H5B_SNODE_ID" : ((shared->type->id) == H5B_CHUNK_ID ? "H5B_CHUNK_ID" : "Unknown!"))); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of node:", shared->sizeof_rnode); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of raw (disk) key:", shared->sizeof_rkey); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of node:", shared->sizeof_rnode); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of raw (disk) key:", shared->sizeof_rkey); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Dirty flag:", bt->cache_info.is_dirty ? "True" : "False"); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Level:", bt->level); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of left sibling:", bt->left); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of right sibling:", bt->right); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of left sibling:", bt->left); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of right sibling:", bt->right); HDfprintf(stream, "%*s%-*s %u (%u)\n", indent, "", fwidth, "Number of children (max):", bt->nchildren, shared->two_k); @@ -110,7 +110,8 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5 */ for (u = 0; u < bt->nchildren; u++) { HDfprintf(stream, "%*sChild %d...\n", indent, "", u); - HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), "Address:", bt->child[u]); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", MAX(0, fwidth - 3), + "Address:", bt->child[u]); /* If there is a key debugging routine, use it to display the left & right keys */ if (type->debug_key) { diff --git a/src/H5C.c b/src/H5C.c index 45cde7b..198557c 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -310,6 +310,10 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, cache_ptr->slist_len = 0; cache_ptr->slist_size = (size_t)0; + /* slist_ring_len, slist_ring_size, and + * slist_ptr initializaed above. + */ + #if H5C_DO_SANITY_CHECKS cache_ptr->slist_len_increase = 0; cache_ptr->slist_size_increase = 0; @@ -517,18 +521,18 @@ H5C_def_auto_resize_rpt_fcn(H5C_t *cache_ptr, HDfprintf(stdout, "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n", cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).lower_hr_threshold); - HDfprintf(stdout, "%scache size increased from (%Zu/%Zu) to (%Zu/%Zu).\n", cache_ptr->prefix, + HDfprintf(stdout, "%scache size increased from (%zu/%zu) to (%zu/%zu).\n", cache_ptr->prefix, old_max_cache_size, old_min_clean_size, new_max_cache_size, new_min_clean_size); break; case flash_increase: HDassert(old_max_cache_size < new_max_cache_size); - HDfprintf(stdout, "%sflash cache resize(%d) -- size threshold = %Zu.\n", cache_ptr->prefix, + HDfprintf(stdout, "%sflash cache resize(%d) -- size threshold = %zu.\n", cache_ptr->prefix, (int)((cache_ptr->resize_ctl).flash_incr_mode), cache_ptr->flash_size_increase_threshold); - HDfprintf(stdout, "%s cache size increased from (%Zu/%Zu) to (%Zu/%Zu).\n", cache_ptr->prefix, + HDfprintf(stdout, "%s cache size increased from (%zu/%zu) to (%zu/%zu).\n", cache_ptr->prefix, old_max_cache_size, old_min_clean_size, new_max_cache_size, new_min_clean_size); break; @@ -569,7 +573,7 @@ H5C_def_auto_resize_rpt_fcn(H5C_t *cache_ptr, cache_ptr->prefix, hit_rate); } - HDfprintf(stdout, "%s cache size decreased from (%Zu/%Zu) to (%Zu/%Zu).\n", cache_ptr->prefix, + HDfprintf(stdout, "%s cache size decreased from (%zu/%zu) to (%zu/%zu).\n", cache_ptr->prefix, old_max_cache_size, old_min_clean_size, new_max_cache_size, new_min_clean_size); break; @@ -768,21 +772,31 @@ H5C_dest(H5F_t *f) /* Flush and invalidate all cache entries */ if (H5C__flush_invalidate_cache(f, H5C__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") /* Generate & write cache image if requested */ if (cache_ptr->image_ctl.generate_image) if (H5C__generate_cache_image(f, cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "Can't generate metadata cache image") + /* Question: Is it possible for cache_ptr->slist be non-null at this + * point? If no, shouldn't this if statement be an assert? + */ if (cache_ptr->slist_ptr != NULL) { H5SL_close(cache_ptr->slist_ptr); + cache_ptr->slist_ptr = NULL; + } /* end if */ if (cache_ptr->tag_list != NULL) { + H5SL_destroy(cache_ptr->tag_list, H5C__free_tag_list_cb, NULL); + cache_ptr->tag_list = NULL; + } /* end if */ if (cache_ptr->log_info != NULL) @@ -802,6 +816,7 @@ H5C_dest(H5F_t *f) done: FUNC_LEAVE_NOAPI(ret_value) + } /* H5C_dest() */ /*------------------------------------------------------------------------- @@ -828,6 +843,7 @@ H5C_evict(H5F_t *f) /* Flush and invalidate all cache entries except the pinned entries */ if (H5C__flush_invalidate_cache(f, H5C__EVICT_ALLOW_LAST_PINS_FLAG) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict entries in the cache") done: @@ -838,8 +854,8 @@ done: * Function: H5C_expunge_entry * * Purpose: Use this function to tell the cache to expunge an entry - * from the cache without writing it to disk even if it is - * dirty. The entry may not be either pinned or protected. + * from the cache without writing it to disk even if it is + * dirty. The entry may not be either pinned or protected. * * Return: Non-negative on success/Negative on failure * @@ -2759,8 +2775,8 @@ done: * Programmer: John Mainzer * 3/22/06 * - * Changes: Added extreme sanity checks on entry and exit. - JRM -- 4/26/14 + * Changes: Added extreme sanity checks on entry and exit. + * JRM -- 4/26/14 * *------------------------------------------------------------------------- */ @@ -2880,6 +2896,7 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) #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") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -2888,11 +2905,13 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) * drops to zero. */ if (entry_ptr->ro_ref_count > 1) { + /* Sanity check */ HDassert(entry_ptr->is_protected); HDassert(entry_ptr->is_read_only); if (dirtied) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Read only entry modified??") /* Reduce the RO ref count */ @@ -2900,26 +2919,35 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) /* Pin or unpin the entry as requested. */ if (pin_entry) { + /* Pin the entry from a client */ if (H5C__pin_entry_from_client(cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Can't pin entry by client") } else if (unpin_entry) { + /* Unpin the entry from a client */ if (H5C__unpin_entry_from_client(cache_ptr, entry_ptr, FALSE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry by client") + } /* end if */ } else { + if (entry_ptr->is_read_only) { + /* Sanity check */ HDassert(entry_ptr->ro_ref_count == 1); if (dirtied) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Read only entry modified??") entry_ptr->is_read_only = FALSE; entry_ptr->ro_ref_count = 0; + } /* end if */ #ifdef H5_HAVE_PARALLEL @@ -2949,6 +2977,7 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) #endif /* H5_HAVE_PARALLEL */ if (!entry_ptr->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Entry already unprotected??") /* Mark the entry as dirty if appropriate */ @@ -2956,20 +2985,24 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) if (dirtied) if (entry_ptr->image_up_to_date) { + entry_ptr->image_up_to_date = FALSE; if (entry_ptr->flush_dep_nparents > 0) if (H5C__mark_flush_dep_unserialized(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "Can't propagate serialization status to fd parents") } /* end if */ /* Check for newly dirtied entry */ if (was_clean && entry_ptr->is_dirty) { + /* Update index for newly dirtied entry */ H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr) - /* If the entry's type has a 'notify' callback send a 'entry dirtied' - * notice now that the entry is fully integrated into the cache. + /* If the entry's type has a 'notify' callback send a + * 'entry dirtied' notice now that the entry is fully + * integrated into the cache. */ if (entry_ptr->type->notify && (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0) @@ -2979,12 +3012,15 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) * if appropriate */ if (entry_ptr->flush_dep_nparents > 0) if (H5C__mark_flush_dep_dirty(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag") } /* end if */ /* Check for newly clean entry */ else if (!was_clean && !entry_ptr->is_dirty) { - /* If the entry's type has a 'notify' callback send a 'entry cleaned' - * notice now that the entry is fully integrated into the cache. + + /* If the entry's type has a 'notify' callback send a + * 'entry cleaned' notice now that the entry is fully + * integrated into the cache. */ if (entry_ptr->type->notify && (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0) @@ -2995,18 +3031,23 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) * if appropriate */ if (entry_ptr->flush_dep_nparents > 0) if (H5C__mark_flush_dep_clean(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag") } /* end else-if */ /* Pin or unpin the entry as requested. */ if (pin_entry) { + /* Pin the entry from a client */ if (H5C__pin_entry_from_client(cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Can't pin entry by client") } else if (unpin_entry) { + /* Unpin the entry from a client */ if (H5C__unpin_entry_from_client(cache_ptr, entry_ptr, FALSE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry by client") } /* end if */ @@ -3021,6 +3062,7 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) * and then add it to the skip list if it isn't there already. */ if (entry_ptr->is_dirty) { + entry_ptr->flush_marker |= set_flush_marker; if (!entry_ptr->in_slist) H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL) @@ -3036,13 +3078,18 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) * JRM - 5/19/04 */ if (deleted) { + unsigned flush_flags = (H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_INVALIDATE_FLAG); /* verify that the target entry is in the cache. */ H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL) + if (test_entry_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "entry not in hash table?!?") + else if (test_entry_ptr != entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "hash table contains multiple entries for addr?!?") @@ -3059,22 +3106,29 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) HDassert(((!was_clean) || dirtied) == entry_ptr->in_slist); if (H5C__flush_single_entry(f, entry_ptr, flush_flags) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't flush entry") + } /* end if */ #ifdef H5_HAVE_PARALLEL else if (clear_entry) { /* verify that the target entry is in the cache. */ H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL) + if (test_entry_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "entry not in hash table?!?") + else if (test_entry_ptr != entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "hash table contains multiple entries for addr?!?") if (H5C__flush_single_entry(f, entry_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't clear entry") + } /* end else if */ #endif /* H5_HAVE_PARALLEL */ } @@ -3082,580 +3136,583 @@ H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) H5C__UPDATE_STATS_FOR_UNPROTECT(cache_ptr) done: + #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)) { + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || (H5C__validate_lru_list(cache_ptr) < 0)) + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_unprotect() */ + FUNC_LEAVE_NOAPI(ret_value) - /*------------------------------------------------------------------------- - * - * Function: H5C_unsettle_entry_ring - * - * Purpose: Advise the metadata cache that the specified entry's free space - * manager ring is no longer settled (if it was on entry). - * - * If the target free space manager ring is already - * unsettled, do nothing, and return SUCCEED. - * - * If the target free space manager ring is settled, and - * we are not in the process of a file shutdown, mark - * the ring as unsettled, and return SUCCEED. - * - * If the target free space manager is settled, and we - * are in the process of a file shutdown, post an error - * message, and return FAIL. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * January 3, 2017 - * - *------------------------------------------------------------------------- - */ - herr_t H5C_unsettle_entry_ring(void *_entry) - { - H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_entry; /* Entry whose ring to unsettle */ - H5C_t * cache; /* Cache for file */ - herr_t ret_value = SUCCEED; /* Return value */ +} /* H5C_unprotect() */ - FUNC_ENTER_NOAPI(FAIL) +/*------------------------------------------------------------------------- + * + * Function: H5C_unsettle_entry_ring + * + * Purpose: Advise the metadata cache that the specified entry's free space + * manager ring is no longer settled (if it was on entry). + * + * If the target free space manager ring is already + * unsettled, do nothing, and return SUCCEED. + * + * If the target free space manager ring is settled, and + * we are not in the process of a file shutdown, mark + * the ring as unsettled, and return SUCCEED. + * + * If the target free space manager is settled, and we + * are in the process of a file shutdown, post an error + * message, and return FAIL. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * January 3, 2017 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_unsettle_entry_ring(void *_entry) +{ + H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_entry; /* Entry whose ring to unsettle */ + H5C_t * cache; /* Cache for file */ + herr_t ret_value = SUCCEED; /* Return value */ - /* Sanity checks */ - HDassert(entry); - HDassert(entry->ring != H5C_RING_UNDEFINED); - HDassert((H5C_RING_USER == entry->ring) || (H5C_RING_RDFSM == entry->ring) || - (H5C_RING_MDFSM == entry->ring)); - cache = entry->cache_ptr; - HDassert(cache); - HDassert(cache->magic == H5C__H5C_T_MAGIC); - - switch (entry->ring) { - case H5C_RING_USER: - /* Do nothing */ - break; + FUNC_ENTER_NOAPI(FAIL) - case H5C_RING_RDFSM: - if (cache->rdfsm_settled) { - if (cache->flush_in_progress || cache->close_warning_received) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected rdfsm ring unsettle") - cache->rdfsm_settled = FALSE; - } /* end if */ - break; + /* Sanity checks */ + HDassert(entry); + HDassert(entry->ring != H5C_RING_UNDEFINED); + HDassert((H5C_RING_USER == entry->ring) || (H5C_RING_RDFSM == entry->ring) || + (H5C_RING_MDFSM == entry->ring)); + cache = entry->cache_ptr; + HDassert(cache); + HDassert(cache->magic == H5C__H5C_T_MAGIC); + + switch (entry->ring) { + case H5C_RING_USER: + /* Do nothing */ + break; - case H5C_RING_MDFSM: - if (cache->mdfsm_settled) { - if (cache->flush_in_progress || cache->close_warning_received) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected mdfsm ring unsettle") - cache->mdfsm_settled = FALSE; - } /* end if */ - break; + case H5C_RING_RDFSM: + if (cache->rdfsm_settled) { + if (cache->flush_in_progress || cache->close_warning_received) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected rdfsm ring unsettle") + cache->rdfsm_settled = FALSE; + } /* end if */ + break; - default: - HDassert(FALSE); /* this should be un-reachable */ - break; - } /* end switch */ + case H5C_RING_MDFSM: + if (cache->mdfsm_settled) { + if (cache->flush_in_progress || cache->close_warning_received) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected mdfsm ring unsettle") + cache->mdfsm_settled = FALSE; + } /* end if */ + break; -done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_unsettle_entry_ring() */ + default: + HDassert(FALSE); /* this should be un-reachable */ + break; + } /* end switch */ - /*------------------------------------------------------------------------- - * Function: H5C_unsettle_ring() - * - * Purpose: Advise the metadata cache that the specified free space - * manager ring is no longer settled (if it was on entry). - * - * If the target free space manager ring is already - * unsettled, do nothing, and return SUCCEED. - * - * If the target free space manager ring is settled, and - * we are not in the process of a file shutdown, mark - * the ring as unsettled, and return SUCCEED. - * - * If the target free space manager is settled, and we - * are in the process of a file shutdown, post an error - * message, and return FAIL. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 10/15/16 - * - *------------------------------------------------------------------------- - */ - herr_t H5C_unsettle_ring(H5F_t * f, H5C_ring_t ring) - { - H5C_t *cache_ptr; - herr_t ret_value = SUCCEED; /* Return value */ +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_unsettle_entry_ring() */ - FUNC_ENTER_NOAPI(FAIL) +/*------------------------------------------------------------------------- + * Function: H5C_unsettle_ring() + * + * Purpose: Advise the metadata cache that the specified free space + * manager ring is no longer settled (if it was on entry). + * + * If the target free space manager ring is already + * unsettled, do nothing, and return SUCCEED. + * + * If the target free space manager ring is settled, and + * we are not in the process of a file shutdown, mark + * the ring as unsettled, and return SUCCEED. + * + * If the target free space manager is settled, and we + * are in the process of a file shutdown, post an error + * message, and return FAIL. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * 10/15/16 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_unsettle_ring(H5F_t *f, H5C_ring_t ring) +{ + H5C_t *cache_ptr; + herr_t ret_value = SUCCEED; /* Return value */ - /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); - HDassert((H5C_RING_RDFSM == ring) || (H5C_RING_MDFSM == ring)); - cache_ptr = f->shared->cache; - HDassert(H5C__H5C_T_MAGIC == cache_ptr->magic); + FUNC_ENTER_NOAPI(FAIL) - switch (ring) { - case H5C_RING_RDFSM: - if (cache_ptr->rdfsm_settled) { - if (cache_ptr->close_warning_received) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected rdfsm ring unsettle") - cache_ptr->rdfsm_settled = FALSE; - } /* end if */ - break; + /* Sanity checks */ + HDassert(f); + HDassert(f->shared); + HDassert(f->shared->cache); + HDassert((H5C_RING_RDFSM == ring) || (H5C_RING_MDFSM == ring)); + cache_ptr = f->shared->cache; + HDassert(H5C__H5C_T_MAGIC == cache_ptr->magic); + + switch (ring) { + case H5C_RING_RDFSM: + if (cache_ptr->rdfsm_settled) { + if (cache_ptr->close_warning_received) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected rdfsm ring unsettle") + cache_ptr->rdfsm_settled = FALSE; + } /* end if */ + break; - case H5C_RING_MDFSM: - if (cache_ptr->mdfsm_settled) { - if (cache_ptr->close_warning_received) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected mdfsm ring unsettle") - cache_ptr->mdfsm_settled = FALSE; - } /* end if */ - break; + case H5C_RING_MDFSM: + if (cache_ptr->mdfsm_settled) { + if (cache_ptr->close_warning_received) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected mdfsm ring unsettle") + cache_ptr->mdfsm_settled = FALSE; + } /* end if */ + break; - default: - HDassert(FALSE); /* this should be un-reachable */ - break; - } /* end switch */ + default: + HDassert(FALSE); /* this should be un-reachable */ + break; + } /* end switch */ done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_unsettle_ring() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_unsettle_ring() */ - /*------------------------------------------------------------------------- - * Function: H5C_validate_resize_config() - * - * Purpose: Run a sanity check on the specified sections of the - * provided instance of struct H5C_auto_size_ctl_t. - * - * Do nothing and return SUCCEED if no errors are detected, - * and flag an error and return FAIL otherwise. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 3/23/05 - * - *------------------------------------------------------------------------- - */ - herr_t H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, unsigned int tests) - { - herr_t ret_value = SUCCEED; /* Return value */ +/*------------------------------------------------------------------------- + * Function: H5C_validate_resize_config() + * + * Purpose: Run a sanity check on the specified sections of the + * provided instance of struct H5C_auto_size_ctl_t. + * + * Do nothing and return SUCCEED if no errors are detected, + * and flag an error and return FAIL otherwise. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * 3/23/05 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests) +{ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(FAIL) - if (config_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL config_ptr on entry") + if (config_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL config_ptr on entry") - if (config_ptr->version != H5C__CURR_AUTO_SIZE_CTL_VER) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown config version") + if (config_ptr->version != H5C__CURR_AUTO_SIZE_CTL_VER) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown config version") - if ((tests & H5C_RESIZE_CFG__VALIDATE_GENERAL) != 0) { + if ((tests & H5C_RESIZE_CFG__VALIDATE_GENERAL) != 0) { - if (config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big") + if (config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big") - if (config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small") + if (config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small") - if (config_ptr->min_size > config_ptr->max_size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size") + if (config_ptr->min_size > config_ptr->max_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size") - if (config_ptr->set_initial_size && ((config_ptr->initial_size < config_ptr->min_size) || - (config_ptr->initial_size > config_ptr->max_size))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "initial_size must be in the interval [min_size, max_size]") + if (config_ptr->set_initial_size && ((config_ptr->initial_size < config_ptr->min_size) || + (config_ptr->initial_size > config_ptr->max_size))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "initial_size must be in the interval [min_size, max_size]") - if ((config_ptr->min_clean_fraction < (double)0.0f) || - (config_ptr->min_clean_fraction > (double)1.0f)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "min_clean_fraction must be in the interval [0.0, 1.0]") + if ((config_ptr->min_clean_fraction < (double)0.0f) || + (config_ptr->min_clean_fraction > (double)1.0f)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_clean_fraction must be in the interval [0.0, 1.0]") - if (config_ptr->epoch_length < H5C__MIN_AR_EPOCH_LENGTH) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too small") + if (config_ptr->epoch_length < H5C__MIN_AR_EPOCH_LENGTH) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too small") - if (config_ptr->epoch_length > H5C__MAX_AR_EPOCH_LENGTH) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too big") - } /* H5C_RESIZE_CFG__VALIDATE_GENERAL */ + if (config_ptr->epoch_length > H5C__MAX_AR_EPOCH_LENGTH) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too big") + } /* H5C_RESIZE_CFG__VALIDATE_GENERAL */ - if ((tests & H5C_RESIZE_CFG__VALIDATE_INCREMENT) != 0) { - if ((config_ptr->incr_mode != H5C_incr__off) && (config_ptr->incr_mode != H5C_incr__threshold)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid incr_mode") + if ((tests & H5C_RESIZE_CFG__VALIDATE_INCREMENT) != 0) { + if ((config_ptr->incr_mode != H5C_incr__off) && (config_ptr->incr_mode != H5C_incr__threshold)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid incr_mode") - if (config_ptr->incr_mode == H5C_incr__threshold) { - if ((config_ptr->lower_hr_threshold < (double)0.0f) || - (config_ptr->lower_hr_threshold > (double)1.0f)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "lower_hr_threshold must be in the range [0.0, 1.0]") + if (config_ptr->incr_mode == H5C_incr__threshold) { + if ((config_ptr->lower_hr_threshold < (double)0.0f) || + (config_ptr->lower_hr_threshold > (double)1.0f)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "lower_hr_threshold must be in the range [0.0, 1.0]") - if (config_ptr->increment < (double)1.0f) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "increment must be greater than or equal to 1.0") + if (config_ptr->increment < (double)1.0f) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "increment must be greater than or equal to 1.0") - /* no need to check max_increment, as it is a size_t, - * and thus must be non-negative. - */ - } /* H5C_incr__threshold */ + /* no need to check max_increment, as it is a size_t, + * and thus must be non-negative. + */ + } /* H5C_incr__threshold */ - switch (config_ptr->flash_incr_mode) { - case H5C_flash_incr__off: - /* nothing to do here */ - break; + switch (config_ptr->flash_incr_mode) { + case H5C_flash_incr__off: + /* nothing to do here */ + break; - case H5C_flash_incr__add_space: - if ((config_ptr->flash_multiple < (double)0.1f) || - (config_ptr->flash_multiple > (double)10.0f)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "flash_multiple must be in the range [0.1, 10.0]") - if ((config_ptr->flash_threshold < (double)0.1f) || - (config_ptr->flash_threshold > (double)1.0f)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "flash_threshold must be in the range [0.1, 1.0]") - break; + case H5C_flash_incr__add_space: + if ((config_ptr->flash_multiple < (double)0.1f) || + (config_ptr->flash_multiple > (double)10.0f)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "flash_multiple must be in the range [0.1, 10.0]") + if ((config_ptr->flash_threshold < (double)0.1f) || + (config_ptr->flash_threshold > (double)1.0f)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "flash_threshold must be in the range [0.1, 1.0]") + break; - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid flash_incr_mode") - break; - } /* end switch */ - } /* H5C_RESIZE_CFG__VALIDATE_INCREMENT */ + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid flash_incr_mode") + break; + } /* end switch */ + } /* H5C_RESIZE_CFG__VALIDATE_INCREMENT */ - if ((tests & H5C_RESIZE_CFG__VALIDATE_DECREMENT) != 0) { + if ((tests & H5C_RESIZE_CFG__VALIDATE_DECREMENT) != 0) { - if ((config_ptr->decr_mode != H5C_decr__off) && (config_ptr->decr_mode != H5C_decr__threshold) && - (config_ptr->decr_mode != H5C_decr__age_out) && - (config_ptr->decr_mode != H5C_decr__age_out_with_threshold)) { + if ((config_ptr->decr_mode != H5C_decr__off) && (config_ptr->decr_mode != H5C_decr__threshold) && + (config_ptr->decr_mode != H5C_decr__age_out) && + (config_ptr->decr_mode != H5C_decr__age_out_with_threshold)) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid decr_mode") - } + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid decr_mode") + } - if (config_ptr->decr_mode == H5C_decr__threshold) { - if (config_ptr->upper_hr_threshold > (double)1.0f) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "upper_hr_threshold must be <= 1.0") + if (config_ptr->decr_mode == H5C_decr__threshold) { + if (config_ptr->upper_hr_threshold > (double)1.0f) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "upper_hr_threshold must be <= 1.0") - if ((config_ptr->decrement > (double)1.0f) || (config_ptr->decrement < (double)0.0f)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "decrement must be in the interval [0.0, 1.0]") + if ((config_ptr->decrement > (double)1.0f) || (config_ptr->decrement < (double)0.0f)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "decrement must be in the interval [0.0, 1.0]") - /* no need to check max_decrement as it is a size_t - * and thus must be non-negative. - */ - } /* H5C_decr__threshold */ + /* no need to check max_decrement as it is a size_t + * and thus must be non-negative. + */ + } /* H5C_decr__threshold */ - if ((config_ptr->decr_mode == H5C_decr__age_out) || - (config_ptr->decr_mode == H5C_decr__age_out_with_threshold)) { + if ((config_ptr->decr_mode == H5C_decr__age_out) || + (config_ptr->decr_mode == H5C_decr__age_out_with_threshold)) { - if (config_ptr->epochs_before_eviction < 1) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction must be positive") - if (config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big") + if (config_ptr->epochs_before_eviction < 1) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction must be positive") + if (config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big") - if ((config_ptr->apply_empty_reserve) && ((config_ptr->empty_reserve > (double)1.0f) || - (config_ptr->empty_reserve < (double)0.0f))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "empty_reserve must be in the interval [0.0, 1.0]") + if ((config_ptr->apply_empty_reserve) && + ((config_ptr->empty_reserve > (double)1.0f) || (config_ptr->empty_reserve < (double)0.0f))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty_reserve must be in the interval [0.0, 1.0]") - /* no need to check max_decrement as it is a size_t - * and thus must be non-negative. - */ - } /* H5C_decr__age_out || H5C_decr__age_out_with_threshold */ + /* no need to check max_decrement as it is a size_t + * and thus must be non-negative. + */ + } /* H5C_decr__age_out || H5C_decr__age_out_with_threshold */ - if (config_ptr->decr_mode == H5C_decr__age_out_with_threshold) { - if ((config_ptr->upper_hr_threshold > (double)1.0f) || - (config_ptr->upper_hr_threshold < (double)0.0f)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "upper_hr_threshold must be in the interval [0.0, 1.0]") - } /* H5C_decr__age_out_with_threshold */ - } /* H5C_RESIZE_CFG__VALIDATE_DECREMENT */ - - if ((tests & H5C_RESIZE_CFG__VALIDATE_INTERACTIONS) != 0) { - if ((config_ptr->incr_mode == H5C_incr__threshold) && - ((config_ptr->decr_mode == H5C_decr__threshold) || - (config_ptr->decr_mode == H5C_decr__age_out_with_threshold)) && - (config_ptr->lower_hr_threshold >= config_ptr->upper_hr_threshold)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "conflicting threshold fields in config") - } /* H5C_RESIZE_CFG__VALIDATE_INTERACTIONS */ + if (config_ptr->decr_mode == H5C_decr__age_out_with_threshold) { + if ((config_ptr->upper_hr_threshold > (double)1.0f) || + (config_ptr->upper_hr_threshold < (double)0.0f)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "upper_hr_threshold must be in the interval [0.0, 1.0]") + } /* H5C_decr__age_out_with_threshold */ + } /* H5C_RESIZE_CFG__VALIDATE_DECREMENT */ + + if ((tests & H5C_RESIZE_CFG__VALIDATE_INTERACTIONS) != 0) { + if ((config_ptr->incr_mode == H5C_incr__threshold) && + ((config_ptr->decr_mode == H5C_decr__threshold) || + (config_ptr->decr_mode == H5C_decr__age_out_with_threshold)) && + (config_ptr->lower_hr_threshold >= config_ptr->upper_hr_threshold)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "conflicting threshold fields in config") + } /* H5C_RESIZE_CFG__VALIDATE_INTERACTIONS */ done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_validate_resize_config() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_validate_resize_config() */ - /*------------------------------------------------------------------------- - * Function: H5C_create_flush_dependency() - * - * Purpose: Initiates a parent<->child entry flush dependency. The parent - * entry must be pinned or protected at the time of call, and must - * have all dependencies removed before the cache can shut down. - * - * Note: Flush dependencies in the cache indicate that a child entry - * must be flushed to the file before its parent. (This is - * currently used to implement Single-Writer/Multiple-Reader (SWMR) - * I/O access for data structures in the file). - * - * Creating a flush dependency between two entries will also pin - * the parent entry. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * 3/05/09 - * - *------------------------------------------------------------------------- - */ - herr_t H5C_create_flush_dependency(void *parent_thing, void *child_thing) - { - H5C_t * cache_ptr; - H5C_cache_entry_t *parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent thing's entry */ - H5C_cache_entry_t *child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child thing's entry */ - herr_t ret_value = SUCCEED; /* Return value */ +/*------------------------------------------------------------------------- + * Function: H5C_create_flush_dependency() + * + * Purpose: Initiates a parent<->child entry flush dependency. The parent + * entry must be pinned or protected at the time of call, and must + * have all dependencies removed before the cache can shut down. + * + * Note: Flush dependencies in the cache indicate that a child entry + * must be flushed to the file before its parent. (This is + * currently used to implement Single-Writer/Multiple-Reader (SWMR) + * I/O access for data structures in the file). + * + * Creating a flush dependency between two entries will also pin + * the parent entry. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * 3/05/09 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_create_flush_dependency(void *parent_thing, void *child_thing) +{ + H5C_t * cache_ptr; + H5C_cache_entry_t *parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent thing's entry */ + H5C_cache_entry_t *child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child thing's entry */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(FAIL) - /* Sanity checks */ - HDassert(parent_entry); - HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(H5F_addr_defined(parent_entry->addr)); - HDassert(child_entry); - HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(H5F_addr_defined(child_entry->addr)); - cache_ptr = parent_entry->cache_ptr; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr == child_entry->cache_ptr); + /* Sanity checks */ + HDassert(parent_entry); + HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(H5F_addr_defined(parent_entry->addr)); + HDassert(child_entry); + HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(H5F_addr_defined(child_entry->addr)); + cache_ptr = parent_entry->cache_ptr; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr == child_entry->cache_ptr); #ifndef NDEBUG - /* Make sure the parent is not already a parent */ - { - unsigned u; + /* Make sure the parent is not already a parent */ + { + unsigned u; - for (u = 0; u < child_entry->flush_dep_nparents; u++) - HDassert(child_entry->flush_dep_parent[u] != parent_entry); - } /* end block */ -#endif /* NDEBUG */ + for (u = 0; u < child_entry->flush_dep_nparents; u++) + HDassert(child_entry->flush_dep_parent[u] != parent_entry); + } /* end block */ +#endif /* NDEBUG */ - /* More sanity checks */ - if (child_entry == parent_entry) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, - "Child entry flush dependency parent can't be itself") - if (!(parent_entry->is_protected || parent_entry->is_pinned)) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Parent entry isn't pinned or protected") + /* More sanity checks */ + if (child_entry == parent_entry) + HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Child entry flush dependency parent can't be itself") + if (!(parent_entry->is_protected || parent_entry->is_pinned)) + HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Parent entry isn't pinned or protected") - /* Check for parent not pinned */ - if (!parent_entry->is_pinned) { - /* Sanity check */ - HDassert(parent_entry->flush_dep_nchildren == 0); - HDassert(!parent_entry->pinned_from_client); - HDassert(!parent_entry->pinned_from_cache); + /* Check for parent not pinned */ + if (!parent_entry->is_pinned) { + /* Sanity check */ + HDassert(parent_entry->flush_dep_nchildren == 0); + HDassert(!parent_entry->pinned_from_client); + HDassert(!parent_entry->pinned_from_cache); - /* Pin the parent entry */ - parent_entry->is_pinned = TRUE; - H5C__UPDATE_STATS_FOR_PIN(cache_ptr, parent_entry) - } /* end else */ + /* Pin the parent entry */ + parent_entry->is_pinned = TRUE; + H5C__UPDATE_STATS_FOR_PIN(cache_ptr, parent_entry) + } /* end else */ - /* Mark the entry as pinned from the cache's action (possibly redundantly) */ - parent_entry->pinned_from_cache = TRUE; + /* Mark the entry as pinned from the cache's action (possibly redundantly) */ + parent_entry->pinned_from_cache = TRUE; - /* Check if we need to resize the child's parent array */ - if (child_entry->flush_dep_nparents >= child_entry->flush_dep_parent_nalloc) { - if (child_entry->flush_dep_parent_nalloc == 0) { - /* Array does not exist yet, allocate it */ - HDassert(!child_entry->flush_dep_parent); + /* Check if we need to resize the child's parent array */ + if (child_entry->flush_dep_nparents >= child_entry->flush_dep_parent_nalloc) { + if (child_entry->flush_dep_parent_nalloc == 0) { + /* Array does not exist yet, allocate it */ + HDassert(!child_entry->flush_dep_parent); - if (NULL == (child_entry->flush_dep_parent = - H5FL_SEQ_MALLOC(H5C_cache_entry_ptr_t, H5C_FLUSH_DEP_PARENT_INIT))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for flush dependency parent list") - child_entry->flush_dep_parent_nalloc = H5C_FLUSH_DEP_PARENT_INIT; - } /* end if */ - else { - /* Resize existing array */ - HDassert(child_entry->flush_dep_parent); - - if (NULL == (child_entry->flush_dep_parent = - H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent, - 2 * child_entry->flush_dep_parent_nalloc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for flush dependency parent list") - child_entry->flush_dep_parent_nalloc *= 2; - } /* end else */ - cache_ptr->entry_fd_height_change_counter++; + if (NULL == (child_entry->flush_dep_parent = + H5FL_SEQ_MALLOC(H5C_cache_entry_ptr_t, H5C_FLUSH_DEP_PARENT_INIT))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for flush dependency parent list") + child_entry->flush_dep_parent_nalloc = H5C_FLUSH_DEP_PARENT_INIT; } /* end if */ + else { + /* Resize existing array */ + HDassert(child_entry->flush_dep_parent); - /* Add the dependency to the child's parent array */ - child_entry->flush_dep_parent[child_entry->flush_dep_nparents] = parent_entry; - child_entry->flush_dep_nparents++; + if (NULL == (child_entry->flush_dep_parent = + H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent, + 2 * child_entry->flush_dep_parent_nalloc))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for flush dependency parent list") + child_entry->flush_dep_parent_nalloc *= 2; + } /* end else */ + cache_ptr->entry_fd_height_change_counter++; + } /* end if */ - /* Increment parent's number of children */ - parent_entry->flush_dep_nchildren++; + /* Add the dependency to the child's parent array */ + child_entry->flush_dep_parent[child_entry->flush_dep_nparents] = parent_entry; + child_entry->flush_dep_nparents++; - /* Adjust the number of dirty children */ - if (child_entry->is_dirty) { - /* Sanity check */ - HDassert(parent_entry->flush_dep_ndirty_children < parent_entry->flush_dep_nchildren); + /* Increment parent's number of children */ + parent_entry->flush_dep_nchildren++; - parent_entry->flush_dep_ndirty_children++; + /* Adjust the number of dirty children */ + if (child_entry->is_dirty) { + /* Sanity check */ + HDassert(parent_entry->flush_dep_ndirty_children < parent_entry->flush_dep_nchildren); - /* If the parent has a 'notify' callback, send a 'child entry dirtied' notice */ - if (parent_entry->type->notify && - (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_DIRTIED, parent_entry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify parent about child entry dirty flag set") - } /* end if */ + parent_entry->flush_dep_ndirty_children++; - /* adjust the parent's number of unserialized children. Note - * that it is possible for and entry to be clean and unserialized. - */ - if (!child_entry->image_up_to_date) { - HDassert(parent_entry->flush_dep_nunser_children < parent_entry->flush_dep_nchildren); + /* If the parent has a 'notify' callback, send a 'child entry dirtied' notice */ + if (parent_entry->type->notify && + (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_DIRTIED, parent_entry) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify parent about child entry dirty flag set") + } /* end if */ - parent_entry->flush_dep_nunser_children++; + /* adjust the parent's number of unserialized children. Note + * that it is possible for and entry to be clean and unserialized. + */ + if (!child_entry->image_up_to_date) { + HDassert(parent_entry->flush_dep_nunser_children < parent_entry->flush_dep_nchildren); - /* If the parent has a 'notify' callback, send a 'child entry unserialized' notice */ - if (parent_entry->type->notify && - (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED, parent_entry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify parent about child entry serialized flag reset") - } /* end if */ + parent_entry->flush_dep_nunser_children++; - /* Post-conditions, for successful operation */ - HDassert(parent_entry->is_pinned); - HDassert(parent_entry->flush_dep_nchildren > 0); - HDassert(child_entry->flush_dep_parent); - HDassert(child_entry->flush_dep_nparents > 0); - HDassert(child_entry->flush_dep_parent_nalloc > 0); + /* If the parent has a 'notify' callback, send a 'child entry unserialized' notice */ + if (parent_entry->type->notify && + (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED, parent_entry) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify parent about child entry serialized flag reset") + } /* end if */ + + /* Post-conditions, for successful operation */ + HDassert(parent_entry->is_pinned); + HDassert(parent_entry->flush_dep_nchildren > 0); + HDassert(child_entry->flush_dep_parent); + HDassert(child_entry->flush_dep_nparents > 0); + HDassert(child_entry->flush_dep_parent_nalloc > 0); #ifndef NDEBUG - H5C__assert_flush_dep_nocycle(parent_entry, child_entry); + H5C__assert_flush_dep_nocycle(parent_entry, child_entry); #endif /* NDEBUG */ done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_create_flush_dependency() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_create_flush_dependency() */ - /*------------------------------------------------------------------------- - * Function: H5C_destroy_flush_dependency() - * - * Purpose: Terminates a parent<-> child entry flush dependency. The - * parent entry must be pinned. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * 3/05/09 - * - *------------------------------------------------------------------------- - */ - herr_t H5C_destroy_flush_dependency(void *parent_thing, void *child_thing) - { - H5C_t * cache_ptr; - H5C_cache_entry_t *parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent entry */ - H5C_cache_entry_t *child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child entry */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ +/*------------------------------------------------------------------------- + * Function: H5C_destroy_flush_dependency() + * + * Purpose: Terminates a parent<-> child entry flush dependency. The + * parent entry must be pinned. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * 3/05/09 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_destroy_flush_dependency(void *parent_thing, void *child_thing) +{ + H5C_t * cache_ptr; + H5C_cache_entry_t *parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent entry */ + H5C_cache_entry_t *child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child entry */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(FAIL) - /* Sanity checks */ - HDassert(parent_entry); - HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(H5F_addr_defined(parent_entry->addr)); - HDassert(child_entry); - HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(H5F_addr_defined(child_entry->addr)); - cache_ptr = parent_entry->cache_ptr; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr == child_entry->cache_ptr); - - /* Usage checks */ - if (!parent_entry->is_pinned) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Parent entry isn't pinned") - if (NULL == child_entry->flush_dep_parent) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, - "Child entry doesn't have a flush dependency parent array") - if (0 == parent_entry->flush_dep_nchildren) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, - "Parent entry flush dependency ref. count has no child dependencies") - - /* Search for parent in child's parent array. This is a linear search - * because we do not expect large numbers of parents. If this changes, we - * may wish to change the parent array to a skip list */ - for (u = 0; u < child_entry->flush_dep_nparents; u++) - if (child_entry->flush_dep_parent[u] == parent_entry) - break; - if (u == child_entry->flush_dep_nparents) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, - "Parent entry isn't a flush dependency parent for child entry") - - /* Remove parent entry from child's parent array */ - if (u < (child_entry->flush_dep_nparents - 1)) - HDmemmove(&child_entry->flush_dep_parent[u], &child_entry->flush_dep_parent[u + 1], - (child_entry->flush_dep_nparents - u - 1) * sizeof(child_entry->flush_dep_parent[0])); - child_entry->flush_dep_nparents--; - - /* Adjust parent entry's nchildren and unpin parent if it goes to zero */ - parent_entry->flush_dep_nchildren--; - if (0 == parent_entry->flush_dep_nchildren) { - /* Sanity check */ - HDassert(parent_entry->pinned_from_cache); + /* Sanity checks */ + HDassert(parent_entry); + HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(H5F_addr_defined(parent_entry->addr)); + HDassert(child_entry); + HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(H5F_addr_defined(child_entry->addr)); + cache_ptr = parent_entry->cache_ptr; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr == child_entry->cache_ptr); + + /* Usage checks */ + if (!parent_entry->is_pinned) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Parent entry isn't pinned") + if (NULL == child_entry->flush_dep_parent) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, + "Child entry doesn't have a flush dependency parent array") + if (0 == parent_entry->flush_dep_nchildren) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, + "Parent entry flush dependency ref. count has no child dependencies") + + /* Search for parent in child's parent array. This is a linear search + * because we do not expect large numbers of parents. If this changes, we + * may wish to change the parent array to a skip list */ + for (u = 0; u < child_entry->flush_dep_nparents; u++) + if (child_entry->flush_dep_parent[u] == parent_entry) + break; + if (u == child_entry->flush_dep_nparents) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, + "Parent entry isn't a flush dependency parent for child entry") + + /* Remove parent entry from child's parent array */ + if (u < (child_entry->flush_dep_nparents - 1)) + HDmemmove(&child_entry->flush_dep_parent[u], &child_entry->flush_dep_parent[u + 1], + (child_entry->flush_dep_nparents - u - 1) * sizeof(child_entry->flush_dep_parent[0])); + child_entry->flush_dep_nparents--; + + /* Adjust parent entry's nchildren and unpin parent if it goes to zero */ + parent_entry->flush_dep_nchildren--; + if (0 == parent_entry->flush_dep_nchildren) { + /* Sanity check */ + HDassert(parent_entry->pinned_from_cache); - /* Check if we should unpin parent entry now */ - if (!parent_entry->pinned_from_client) - if (H5C__unpin_entry_real(cache_ptr, parent_entry, TRUE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry") + /* Check if we should unpin parent entry now */ + if (!parent_entry->pinned_from_client) + if (H5C__unpin_entry_real(cache_ptr, parent_entry, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry") - /* Mark the entry as unpinned from the cache's action */ - parent_entry->pinned_from_cache = FALSE; - } /* end if */ + /* Mark the entry as unpinned from the cache's action */ + parent_entry->pinned_from_cache = FALSE; + } /* end if */ - /* Adjust parent entry's ndirty_children */ - if (child_entry->is_dirty) { - /* Sanity check */ - HDassert(parent_entry->flush_dep_ndirty_children > 0); + /* Adjust parent entry's ndirty_children */ + if (child_entry->is_dirty) { + /* Sanity check */ + HDassert(parent_entry->flush_dep_ndirty_children > 0); - parent_entry->flush_dep_ndirty_children--; + parent_entry->flush_dep_ndirty_children--; - /* If the parent has a 'notify' callback, send a 'child entry cleaned' notice */ - if (parent_entry->type->notify && - (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_CLEANED, parent_entry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify parent about child entry dirty flag reset") - } /* end if */ + /* If the parent has a 'notify' callback, send a 'child entry cleaned' notice */ + if (parent_entry->type->notify && + (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_CLEANED, parent_entry) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify parent about child entry dirty flag reset") + } /* end if */ - /* adjust parent entry's number of unserialized children */ - if (!child_entry->image_up_to_date) { - HDassert(parent_entry->flush_dep_nunser_children > 0); + /* adjust parent entry's number of unserialized children */ + if (!child_entry->image_up_to_date) { + HDassert(parent_entry->flush_dep_nunser_children > 0); - parent_entry->flush_dep_nunser_children--; + parent_entry->flush_dep_nunser_children--; - /* If the parent has a 'notify' callback, send a 'child entry serialized' notice */ - if (parent_entry->type->notify && - (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_SERIALIZED, parent_entry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify parent about child entry serialized flag set") - } /* end if */ + /* If the parent has a 'notify' callback, send a 'child entry serialized' notice */ + if (parent_entry->type->notify && + (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_SERIALIZED, parent_entry) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify parent about child entry serialized flag set") + } /* end if */ - /* Shrink or free the parent array if apporpriate */ - if (child_entry->flush_dep_nparents == 0) { - child_entry->flush_dep_parent = - H5FL_SEQ_FREE(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent); - child_entry->flush_dep_parent_nalloc = 0; - } /* end if */ - else if (child_entry->flush_dep_parent_nalloc > H5C_FLUSH_DEP_PARENT_INIT && - child_entry->flush_dep_nparents <= (child_entry->flush_dep_parent_nalloc / 4)) { - if (NULL == (child_entry->flush_dep_parent = - H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent, - child_entry->flush_dep_parent_nalloc / 4))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for flush dependency parent list") - child_entry->flush_dep_parent_nalloc /= 4; - } /* end if */ + /* Shrink or free the parent array if apporpriate */ + if (child_entry->flush_dep_nparents == 0) { + child_entry->flush_dep_parent = H5FL_SEQ_FREE(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent); + child_entry->flush_dep_parent_nalloc = 0; + } /* end if */ + else if (child_entry->flush_dep_parent_nalloc > H5C_FLUSH_DEP_PARENT_INIT && + child_entry->flush_dep_nparents <= (child_entry->flush_dep_parent_nalloc / 4)) { + if (NULL == (child_entry->flush_dep_parent = + H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent, + child_entry->flush_dep_parent_nalloc / 4))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for flush dependency parent list") + child_entry->flush_dep_parent_nalloc /= 4; + } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_destroy_flush_dependency() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_destroy_flush_dependency() */ /*************************************************************************/ /**************************** Private Functions: *************************/ @@ -3674,2343 +3731,2468 @@ done: *------------------------------------------------------------------------- */ #if H5C_COLLECT_CACHE_STATS - static herr_t H5C__pin_entry_from_client(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr) +static herr_t +H5C__pin_entry_from_client(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr) #else static herr_t H5C__pin_entry_from_client(H5C_t H5_ATTR_UNUSED *cache_ptr, H5C_cache_entry_t *entry_ptr) #endif - { - herr_t ret_value = SUCCEED; /* Return value */ +{ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC - /* Sanity checks */ - HDassert(cache_ptr); - HDassert(entry_ptr); - HDassert(entry_ptr->is_protected); + /* Sanity checks */ + HDassert(cache_ptr); + HDassert(entry_ptr); + HDassert(entry_ptr->is_protected); - /* Check if the entry is already pinned */ - if (entry_ptr->is_pinned) { - /* Check if the entry was pinned through an explicit pin from a client */ - if (entry_ptr->pinned_from_client) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "entry is already pinned") - } /* end if */ - else { - entry_ptr->is_pinned = TRUE; + /* Check if the entry is already pinned */ + if (entry_ptr->is_pinned) { + /* Check if the entry was pinned through an explicit pin from a client */ + if (entry_ptr->pinned_from_client) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "entry is already pinned") + } /* end if */ + else { + entry_ptr->is_pinned = TRUE; - H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) - } /* end else */ + H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) + } /* end else */ - /* Mark that the entry was pinned through an explicit pin from a client */ - entry_ptr->pinned_from_client = TRUE; + /* Mark that the entry was pinned through an explicit pin from a client */ + entry_ptr->pinned_from_client = TRUE; done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__pin_entry_from_client() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__pin_entry_from_client() */ - /*------------------------------------------------------------------------- - * Function: H5C__unpin_entry_real() - * - * Purpose: Internal routine to unpin a cache entry. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * 1/6/18 - * - *------------------------------------------------------------------------- - */ - static herr_t H5C__unpin_entry_real(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr, hbool_t update_rp) - { - herr_t ret_value = SUCCEED; /* Return value */ +/*------------------------------------------------------------------------- + * Function: H5C__unpin_entry_real() + * + * Purpose: Internal routine to unpin a cache entry. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * 1/6/18 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, hbool_t update_rp) +{ + herr_t ret_value = SUCCEED; /* Return value */ #if H5C_DO_SANITY_CHECKS - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC #else FUNC_ENTER_STATIC_NOERR #endif - /* Sanity checking */ - HDassert(cache_ptr); - HDassert(entry_ptr); - HDassert(entry_ptr->is_pinned); + /* Sanity checking */ + HDassert(cache_ptr); + HDassert(entry_ptr); + HDassert(entry_ptr->is_pinned); - /* If requested, update the replacement policy if the entry is not protected */ - if (update_rp && !entry_ptr->is_protected) - H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, FAIL) + /* If requested, update the replacement policy if the entry is not protected */ + if (update_rp && !entry_ptr->is_protected) + H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, FAIL) - /* Unpin the entry now */ - entry_ptr->is_pinned = FALSE; + /* Unpin the entry now */ + entry_ptr->is_pinned = FALSE; - /* Update the stats for an unpin operation */ - H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr) + /* Update the stats for an unpin operation */ + H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr) #if H5C_DO_SANITY_CHECKS done: #endif - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__unpin_entry_real() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__unpin_entry_real() */ - /*------------------------------------------------------------------------- - * Function: H5C__unpin_entry_from_client() - * - * Purpose: Internal routine to unpin a cache entry from a client action. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * 3/24/09 - * - *------------------------------------------------------------------------- - */ - static herr_t H5C__unpin_entry_from_client(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr, - hbool_t update_rp) - { - herr_t ret_value = SUCCEED; /* Return value */ +/*------------------------------------------------------------------------- + * Function: H5C__unpin_entry_from_client() + * + * Purpose: Internal routine to unpin a cache entry from a client action. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * 3/24/09 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__unpin_entry_from_client(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, hbool_t update_rp) +{ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC - /* Sanity checking */ - HDassert(cache_ptr); - HDassert(entry_ptr); + /* Sanity checking */ + HDassert(cache_ptr); + HDassert(entry_ptr); - /* Error checking (should be sanity checks?) */ - if (!entry_ptr->is_pinned) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "entry isn't pinned") - if (!entry_ptr->pinned_from_client) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "entry wasn't pinned by cache client") + /* Error checking (should be sanity checks?) */ + if (!entry_ptr->is_pinned) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "entry isn't pinned") + if (!entry_ptr->pinned_from_client) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "entry wasn't pinned by cache client") - /* Check if the entry is not pinned from a flush dependency */ - if (!entry_ptr->pinned_from_cache) - if (H5C__unpin_entry_real(cache_ptr, entry_ptr, update_rp) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry") + /* Check if the entry is not pinned from a flush dependency */ + if (!entry_ptr->pinned_from_cache) + if (H5C__unpin_entry_real(cache_ptr, entry_ptr, update_rp) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry") - /* Mark the entry as explicitly unpinned by the client */ - entry_ptr->pinned_from_client = FALSE; + /* Mark the entry as explicitly unpinned by the client */ + entry_ptr->pinned_from_client = FALSE; done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__unpin_entry_from_client() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__unpin_entry_from_client() */ - /*------------------------------------------------------------------------- - * - * Function: H5C__auto_adjust_cache_size - * - * Purpose: Obtain the current full cache hit rate, and compare it - * with the hit rate thresholds for modifying cache size. - * If one of the thresholds has been crossed, adjusts the - * size of the cache accordingly. - * - * The function then resets the full cache hit rate - * statistics, and exits. - * - * Return: Non-negative on success/Negative on failure or if there was - * an attempt to flush a protected item. - * - * - * Programmer: John Mainzer, 10/7/04 - * - *------------------------------------------------------------------------- +/*------------------------------------------------------------------------- + * + * Function: H5C__auto_adjust_cache_size + * + * Purpose: Obtain the current full cache hit rate, and compare it + * with the hit rate thresholds for modifying cache size. + * If one of the thresholds has been crossed, adjusts the + * size of the cache accordingly. + * + * The function then resets the full cache hit rate + * statistics, and exits. + * + * Return: Non-negative on success/Negative on failure or if there was + * an attempt to flush a protected item. + * + * + * Programmer: John Mainzer, 10/7/04 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__auto_adjust_cache_size(H5F_t *f, hbool_t write_permitted) +{ + H5C_t * cache_ptr = f->shared->cache; + hbool_t reentrant_call = FALSE; + hbool_t inserted_epoch_marker = FALSE; + size_t new_max_cache_size = 0; + size_t old_max_cache_size = 0; + size_t new_min_clean_size = 0; + size_t old_min_clean_size = 0; + double hit_rate; + enum H5C_resize_status status = in_spec; /* will change if needed */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + HDassert(f); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->cache_accesses >= (cache_ptr->resize_ctl).epoch_length); + HDassert((double)0.0f <= (cache_ptr->resize_ctl).min_clean_fraction); + HDassert((cache_ptr->resize_ctl).min_clean_fraction <= (double)100.0f); + + /* check to see if cache_ptr->resize_in_progress is TRUE. If it, this + * is a re-entrant call via a client callback called in the resize + * process. To avoid an infinite recursion, set reentrant_call to + * TRUE, and goto done. */ - static herr_t H5C__auto_adjust_cache_size(H5F_t * f, hbool_t write_permitted) - { - H5C_t * cache_ptr = f->shared->cache; - hbool_t reentrant_call = FALSE; - hbool_t inserted_epoch_marker = FALSE; - size_t new_max_cache_size = 0; - size_t old_max_cache_size = 0; - size_t new_min_clean_size = 0; - size_t old_min_clean_size = 0; - double hit_rate; - enum H5C_resize_status status = in_spec; /* will change if needed */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - HDassert(f); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->cache_accesses >= (cache_ptr->resize_ctl).epoch_length); - HDassert((double)0.0f <= (cache_ptr->resize_ctl).min_clean_fraction); - HDassert((cache_ptr->resize_ctl).min_clean_fraction <= (double)100.0f); - - /* check to see if cache_ptr->resize_in_progress is TRUE. If it, this - * is a re-entrant call via a client callback called in the resize - * process. To avoid an infinite recursion, set reentrant_call to - * TRUE, and goto done. - */ - if (cache_ptr->resize_in_progress) { - reentrant_call = TRUE; - HGOTO_DONE(SUCCEED) - } /* end if */ + if (cache_ptr->resize_in_progress) { + reentrant_call = TRUE; + HGOTO_DONE(SUCCEED) + } /* end if */ - cache_ptr->resize_in_progress = TRUE; + cache_ptr->resize_in_progress = TRUE; - if (!cache_ptr->resize_enabled) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Auto cache resize disabled") + if (!cache_ptr->resize_enabled) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Auto cache resize disabled") - HDassert(((cache_ptr->resize_ctl).incr_mode != H5C_incr__off) || - ((cache_ptr->resize_ctl).decr_mode != H5C_decr__off)); + HDassert(((cache_ptr->resize_ctl).incr_mode != H5C_incr__off) || + ((cache_ptr->resize_ctl).decr_mode != H5C_decr__off)); - if (H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate") + if (H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate") - HDassert(((double)0.0f <= hit_rate) && (hit_rate <= (double)1.0f)); + HDassert(((double)0.0f <= hit_rate) && (hit_rate <= (double)1.0f)); - switch ((cache_ptr->resize_ctl).incr_mode) { - case H5C_incr__off: - if (cache_ptr->size_increase_possible) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "size_increase_possible but H5C_incr__off?!?!?") - break; + switch ((cache_ptr->resize_ctl).incr_mode) { + case H5C_incr__off: + if (cache_ptr->size_increase_possible) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "size_increase_possible but H5C_incr__off?!?!?") + break; + + case H5C_incr__threshold: + if (hit_rate < (cache_ptr->resize_ctl).lower_hr_threshold) { + + if (!cache_ptr->size_increase_possible) { + + status = increase_disabled; + } + else if (cache_ptr->max_cache_size >= (cache_ptr->resize_ctl).max_size) { + + HDassert(cache_ptr->max_cache_size == (cache_ptr->resize_ctl).max_size); + status = at_max_size; + } + else if (!cache_ptr->cache_full) { - case H5C_incr__threshold: - if (hit_rate < (cache_ptr->resize_ctl).lower_hr_threshold) { + status = not_full; + } + else { + + new_max_cache_size = + (size_t)(((double)(cache_ptr->max_cache_size)) * (cache_ptr->resize_ctl).increment); + + /* clip to max size if necessary */ + if (new_max_cache_size > (cache_ptr->resize_ctl).max_size) { - if (!cache_ptr->size_increase_possible) { + new_max_cache_size = (cache_ptr->resize_ctl).max_size; + } + + /* clip to max increment if necessary */ + if (((cache_ptr->resize_ctl).apply_max_increment) && + ((cache_ptr->max_cache_size + (cache_ptr->resize_ctl).max_increment) < + new_max_cache_size)) { - status = increase_disabled; + new_max_cache_size = + cache_ptr->max_cache_size + (cache_ptr->resize_ctl).max_increment; } - else if (cache_ptr->max_cache_size >= (cache_ptr->resize_ctl).max_size) { - HDassert(cache_ptr->max_cache_size == (cache_ptr->resize_ctl).max_size); - status = at_max_size; + status = increase; + } + } + break; + + default: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode") + } + + /* If the decr_mode is either age out or age out with threshold, we + * must run the marker maintenance code, whether we run the size + * reduction code or not. We do this in two places -- here we + * insert a new marker if the number of active epoch markers is + * is less than the the current epochs before eviction, and after + * the ageout call, we cycle the markers. + * + * However, we can't call the ageout code or cycle the markers + * unless there was a full complement of markers in place on + * entry. The inserted_epoch_marker flag is used to track this. + */ + + if ((((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out) || + ((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out_with_threshold)) && + (cache_ptr->epoch_markers_active < (cache_ptr->resize_ctl).epochs_before_eviction)) { + + if (H5C__autoadjust__ageout__insert_new_marker(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't insert new epoch marker") + + inserted_epoch_marker = TRUE; + } + + /* don't run the cache size decrease code unless the cache size + * increase code is disabled, or the size increase code sees no need + * for action. In either case, status == in_spec at this point. + */ + + if (status == in_spec) { + + switch ((cache_ptr->resize_ctl).decr_mode) { + case H5C_decr__off: + break; + + case H5C_decr__threshold: + if (hit_rate > (cache_ptr->resize_ctl).upper_hr_threshold) { + + if (!cache_ptr->size_decrease_possible) { + + status = decrease_disabled; } - else if (!cache_ptr->cache_full) { + else if (cache_ptr->max_cache_size <= (cache_ptr->resize_ctl).min_size) { - status = not_full; + HDassert(cache_ptr->max_cache_size == (cache_ptr->resize_ctl).min_size); + status = at_min_size; } else { new_max_cache_size = (size_t)(((double)(cache_ptr->max_cache_size)) * - (cache_ptr->resize_ctl).increment); + (cache_ptr->resize_ctl).decrement); - /* clip to max size if necessary */ - if (new_max_cache_size > (cache_ptr->resize_ctl).max_size) { + /* clip to min size if necessary */ + if (new_max_cache_size < (cache_ptr->resize_ctl).min_size) { - new_max_cache_size = (cache_ptr->resize_ctl).max_size; + new_max_cache_size = (cache_ptr->resize_ctl).min_size; } - /* clip to max increment if necessary */ - if (((cache_ptr->resize_ctl).apply_max_increment) && - ((cache_ptr->max_cache_size + (cache_ptr->resize_ctl).max_increment) < - new_max_cache_size)) { + /* clip to max decrement if necessary */ + if (((cache_ptr->resize_ctl).apply_max_decrement) && + (((cache_ptr->resize_ctl).max_decrement + new_max_cache_size) < + cache_ptr->max_cache_size)) { new_max_cache_size = - cache_ptr->max_cache_size + (cache_ptr->resize_ctl).max_increment; + cache_ptr->max_cache_size - (cache_ptr->resize_ctl).max_decrement; } - status = increase; + status = decrease; } } break; + case H5C_decr__age_out_with_threshold: + case H5C_decr__age_out: + if (!inserted_epoch_marker) { + if (!cache_ptr->size_decrease_possible) + status = decrease_disabled; + else { + if (H5C__autoadjust__ageout(f, hit_rate, &status, &new_max_cache_size, + write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ageout code failed") + } /* end else */ + } /* end if */ + break; + default: HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode") } + } - /* If the decr_mode is either age out or age out with threshold, we - * must run the marker maintenance code, whether we run the size - * reduction code or not. We do this in two places -- here we - * insert a new marker if the number of active epoch markers is - * is less than the the current epochs before eviction, and after - * the ageout call, we cycle the markers. - * - * However, we can't call the ageout code or cycle the markers - * unless there was a full complement of markers in place on - * entry. The inserted_epoch_marker flag is used to track this. - */ - - if ((((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out) || - ((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out_with_threshold)) && - (cache_ptr->epoch_markers_active < (cache_ptr->resize_ctl).epochs_before_eviction)) { - - if (H5C__autoadjust__ageout__insert_new_marker(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't insert new epoch marker") - - inserted_epoch_marker = TRUE; - } - - /* don't run the cache size decrease code unless the cache size - * increase code is disabled, or the size increase code sees no need - * for action. In either case, status == in_spec at this point. - */ - - if (status == in_spec) { + /* cycle the epoch markers here if appropriate */ + if ((((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out) || + ((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out_with_threshold)) && + (!inserted_epoch_marker)) { - switch ((cache_ptr->resize_ctl).decr_mode) { - case H5C_decr__off: - break; + /* move last epoch marker to the head of the LRU list */ + if (H5C__autoadjust__ageout__cycle_epoch_marker(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error cycling epoch marker") + } - case H5C_decr__threshold: - if (hit_rate > (cache_ptr->resize_ctl).upper_hr_threshold) { + if ((status == increase) || (status == decrease)) { - if (!cache_ptr->size_decrease_possible) { + old_max_cache_size = cache_ptr->max_cache_size; + old_min_clean_size = cache_ptr->min_clean_size; - status = decrease_disabled; - } - else if (cache_ptr->max_cache_size <= (cache_ptr->resize_ctl).min_size) { + new_min_clean_size = + (size_t)((double)new_max_cache_size * ((cache_ptr->resize_ctl).min_clean_fraction)); - HDassert(cache_ptr->max_cache_size == (cache_ptr->resize_ctl).min_size); - status = at_min_size; - } - else { + /* new_min_clean_size is of size_t, and thus must be non-negative. + * Hence we have + * + * ( 0 <= new_min_clean_size ). + * + * by definition. + */ + HDassert(new_min_clean_size <= new_max_cache_size); + HDassert((cache_ptr->resize_ctl).min_size <= new_max_cache_size); + HDassert(new_max_cache_size <= (cache_ptr->resize_ctl).max_size); - new_max_cache_size = (size_t)(((double)(cache_ptr->max_cache_size)) * - (cache_ptr->resize_ctl).decrement); + cache_ptr->max_cache_size = new_max_cache_size; + cache_ptr->min_clean_size = new_min_clean_size; - /* clip to min size if necessary */ - if (new_max_cache_size < (cache_ptr->resize_ctl).min_size) { + if (status == increase) { - new_max_cache_size = (cache_ptr->resize_ctl).min_size; - } + cache_ptr->cache_full = FALSE; + } + else if (status == decrease) { - /* clip to max decrement if necessary */ - if (((cache_ptr->resize_ctl).apply_max_decrement) && - (((cache_ptr->resize_ctl).max_decrement + new_max_cache_size) < - cache_ptr->max_cache_size)) { + cache_ptr->size_decreased = TRUE; + } - new_max_cache_size = - cache_ptr->max_cache_size - (cache_ptr->resize_ctl).max_decrement; - } + /* update flash cache size increase fields as appropriate */ + if (cache_ptr->flash_size_increase_possible) { - status = decrease; - } - } + switch ((cache_ptr->resize_ctl).flash_incr_mode) { + case H5C_flash_incr__off: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, + "flash_size_increase_possible but H5C_flash_incr__off?!") break; - case H5C_decr__age_out_with_threshold: - case H5C_decr__age_out: - if (!inserted_epoch_marker) { - if (!cache_ptr->size_decrease_possible) - status = decrease_disabled; - else { - if (H5C__autoadjust__ageout(f, hit_rate, &status, &new_max_cache_size, - write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ageout code failed") - } /* end else */ - } /* end if */ + case H5C_flash_incr__add_space: + cache_ptr->flash_size_increase_threshold = (size_t)( + ((double)(cache_ptr->max_cache_size)) * ((cache_ptr->resize_ctl).flash_threshold)); break; - default: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode") + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?") + break; } } + } - /* cycle the epoch markers here if appropriate */ - if ((((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out) || - ((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out_with_threshold)) && - (!inserted_epoch_marker)) { - - /* move last epoch marker to the head of the LRU list */ - if (H5C__autoadjust__ageout__cycle_epoch_marker(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error cycling epoch marker") - } + if ((cache_ptr->resize_ctl).rpt_fcn != NULL) { + (*((cache_ptr->resize_ctl).rpt_fcn))(cache_ptr, H5C__CURR_AUTO_RESIZE_RPT_FCN_VER, hit_rate, status, + old_max_cache_size, new_max_cache_size, old_min_clean_size, + new_min_clean_size); + } - if ((status == increase) || (status == decrease)) { + if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0) + /* this should be impossible... */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed") - old_max_cache_size = cache_ptr->max_cache_size; - old_min_clean_size = cache_ptr->min_clean_size; +done: + /* Sanity checks */ + HDassert(cache_ptr->resize_in_progress); + if (!reentrant_call) + cache_ptr->resize_in_progress = FALSE; + HDassert((!reentrant_call) || (cache_ptr->resize_in_progress)); - new_min_clean_size = - (size_t)((double)new_max_cache_size * ((cache_ptr->resize_ctl).min_clean_fraction)); + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__auto_adjust_cache_size() */ - /* new_min_clean_size is of size_t, and thus must be non-negative. - * Hence we have - * - * ( 0 <= new_min_clean_size ). - * - * by definition. - */ - HDassert(new_min_clean_size <= new_max_cache_size); - HDassert((cache_ptr->resize_ctl).min_size <= new_max_cache_size); - HDassert(new_max_cache_size <= (cache_ptr->resize_ctl).max_size); - - cache_ptr->max_cache_size = new_max_cache_size; - cache_ptr->min_clean_size = new_min_clean_size; - - if (status == increase) { - - cache_ptr->cache_full = FALSE; - } - else if (status == decrease) { - - cache_ptr->size_decreased = TRUE; - } - - /* update flash cache size increase fields as appropriate */ - if (cache_ptr->flash_size_increase_possible) { - - switch ((cache_ptr->resize_ctl).flash_incr_mode) { - case H5C_flash_incr__off: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, - "flash_size_increase_possible but H5C_flash_incr__off?!") - break; - - case H5C_flash_incr__add_space: - cache_ptr->flash_size_increase_threshold = - (size_t)(((double)(cache_ptr->max_cache_size)) * - ((cache_ptr->resize_ctl).flash_threshold)); - break; - - default: /* should be unreachable */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?") - break; - } - } - } - - if ((cache_ptr->resize_ctl).rpt_fcn != NULL) { - (*((cache_ptr->resize_ctl).rpt_fcn))(cache_ptr, H5C__CURR_AUTO_RESIZE_RPT_FCN_VER, hit_rate, - status, old_max_cache_size, new_max_cache_size, - old_min_clean_size, new_min_clean_size); - } - - if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0) - /* this should be impossible... */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed") - -done: - /* Sanity checks */ - HDassert(cache_ptr->resize_in_progress); - if (!reentrant_call) - cache_ptr->resize_in_progress = FALSE; - HDassert((!reentrant_call) || (cache_ptr->resize_in_progress)); - - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__auto_adjust_cache_size() */ - - /*------------------------------------------------------------------------- - * - * Function: H5C__autoadjust__ageout - * - * Purpose: Implement the ageout automatic cache size decrement - * algorithm. Note that while this code evicts aged out - * entries, the code does not change the maximum cache size. - * Instead, the function simply computes the new value (if - * any change is indicated) and reports this value in - * *new_max_cache_size_ptr. - * - * Return: Non-negative on success/Negative on failure or if there was - * an attempt to flush a protected item. - * - * - * Programmer: John Mainzer, 11/18/04 - * - *------------------------------------------------------------------------- - */ - static herr_t H5C__autoadjust__ageout(H5F_t * f, double hit_rate, enum H5C_resize_status *status_ptr, - size_t *new_max_cache_size_ptr, hbool_t write_permitted) - { - H5C_t *cache_ptr = f->shared->cache; - size_t test_size; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC +/*------------------------------------------------------------------------- + * + * Function: H5C__autoadjust__ageout + * + * Purpose: Implement the ageout automatic cache size decrement + * algorithm. Note that while this code evicts aged out + * entries, the code does not change the maximum cache size. + * Instead, the function simply computes the new value (if + * any change is indicated) and reports this value in + * *new_max_cache_size_ptr. + * + * Return: Non-negative on success/Negative on failure or if there was + * an attempt to flush a protected item. + * + * + * Programmer: John Mainzer, 11/18/04 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__autoadjust__ageout(H5F_t *f, double hit_rate, enum H5C_resize_status *status_ptr, + size_t *new_max_cache_size_ptr, hbool_t write_permitted) +{ + H5C_t *cache_ptr = f->shared->cache; + size_t test_size; + herr_t ret_value = SUCCEED; /* Return value */ - HDassert(f); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert((status_ptr) && (*status_ptr == in_spec)); - HDassert((new_max_cache_size_ptr) && (*new_max_cache_size_ptr == 0)); + FUNC_ENTER_STATIC - /* remove excess epoch markers if any */ - if (cache_ptr->epoch_markers_active > (cache_ptr->resize_ctl).epochs_before_eviction) - if (H5C__autoadjust__ageout__remove_excess_markers(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't remove excess epoch markers") + HDassert(f); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert((status_ptr) && (*status_ptr == in_spec)); + HDassert((new_max_cache_size_ptr) && (*new_max_cache_size_ptr == 0)); - if (((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out) || - (((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out_with_threshold) && - (hit_rate >= (cache_ptr->resize_ctl).upper_hr_threshold))) { + /* remove excess epoch markers if any */ + if (cache_ptr->epoch_markers_active > (cache_ptr->resize_ctl).epochs_before_eviction) + if (H5C__autoadjust__ageout__remove_excess_markers(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't remove excess epoch markers") - if (cache_ptr->max_cache_size > (cache_ptr->resize_ctl).min_size) { + if (((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out) || + (((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out_with_threshold) && + (hit_rate >= (cache_ptr->resize_ctl).upper_hr_threshold))) { - /* evict aged out cache entries if appropriate... */ - if (H5C__autoadjust__ageout__evict_aged_out_entries(f, write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error flushing aged out entries") + if (cache_ptr->max_cache_size > (cache_ptr->resize_ctl).min_size) { - /* ... and then reduce cache size if appropriate */ - if (cache_ptr->index_size < cache_ptr->max_cache_size) { + /* evict aged out cache entries if appropriate... */ + if (H5C__autoadjust__ageout__evict_aged_out_entries(f, write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error flushing aged out entries") - if ((cache_ptr->resize_ctl).apply_empty_reserve) { + /* ... and then reduce cache size if appropriate */ + if (cache_ptr->index_size < cache_ptr->max_cache_size) { - test_size = (size_t)(((double)cache_ptr->index_size) / - (1 - (cache_ptr->resize_ctl).empty_reserve)); + if ((cache_ptr->resize_ctl).apply_empty_reserve) { - if (test_size < cache_ptr->max_cache_size) { + test_size = (size_t)(((double)cache_ptr->index_size) / + (1 - (cache_ptr->resize_ctl).empty_reserve)); - *status_ptr = decrease; - *new_max_cache_size_ptr = test_size; - } - } - else { + if (test_size < cache_ptr->max_cache_size) { *status_ptr = decrease; - *new_max_cache_size_ptr = cache_ptr->index_size; + *new_max_cache_size_ptr = test_size; } + } + else { - if (*status_ptr == decrease) { + *status_ptr = decrease; + *new_max_cache_size_ptr = cache_ptr->index_size; + } - /* clip to min size if necessary */ - if (*new_max_cache_size_ptr < (cache_ptr->resize_ctl).min_size) { + if (*status_ptr == decrease) { - *new_max_cache_size_ptr = (cache_ptr->resize_ctl).min_size; - } + /* clip to min size if necessary */ + if (*new_max_cache_size_ptr < (cache_ptr->resize_ctl).min_size) { - /* clip to max decrement if necessary */ - if (((cache_ptr->resize_ctl).apply_max_decrement) && - (((cache_ptr->resize_ctl).max_decrement + *new_max_cache_size_ptr) < - cache_ptr->max_cache_size)) { + *new_max_cache_size_ptr = (cache_ptr->resize_ctl).min_size; + } - *new_max_cache_size_ptr = - cache_ptr->max_cache_size - (cache_ptr->resize_ctl).max_decrement; - } + /* clip to max decrement if necessary */ + if (((cache_ptr->resize_ctl).apply_max_decrement) && + (((cache_ptr->resize_ctl).max_decrement + *new_max_cache_size_ptr) < + cache_ptr->max_cache_size)) { + + *new_max_cache_size_ptr = + cache_ptr->max_cache_size - (cache_ptr->resize_ctl).max_decrement; } } } - else { + } + else { - *status_ptr = at_min_size; - } + *status_ptr = at_min_size; } + } done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__autoadjust__ageout() */ +} /* H5C__autoadjust__ageout() */ - /*------------------------------------------------------------------------- - * - * Function: H5C__autoadjust__ageout__cycle_epoch_marker - * - * Purpose: Remove the oldest epoch marker from the LRU list, - * and reinsert it at the head of the LRU list. Also - * remove the epoch marker's index from the head of the - * ring buffer, and re-insert it at the tail of the ring - * buffer. - * - * Return: SUCCEED on success/FAIL on failure. - * - * Programmer: John Mainzer, 11/22/04 - * - *------------------------------------------------------------------------- - */ - static herr_t H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t * cache_ptr) - { - int i; - herr_t ret_value = SUCCEED; /* Return value */ +/*------------------------------------------------------------------------- + * + * Function: H5C__autoadjust__ageout__cycle_epoch_marker + * + * Purpose: Remove the oldest epoch marker from the LRU list, + * and reinsert it at the head of the LRU list. Also + * remove the epoch marker's index from the head of the + * ring buffer, and re-insert it at the tail of the ring + * buffer. + * + * Return: SUCCEED on success/FAIL on failure. + * + * Programmer: John Mainzer, 11/22/04 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t *cache_ptr) +{ + int i; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - if (cache_ptr->epoch_markers_active <= 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "No active epoch markers on entry?!?!?") + if (cache_ptr->epoch_markers_active <= 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "No active epoch markers on entry?!?!?") - /* remove the last marker from both the ring buffer and the LRU list */ + /* remove the last marker from both the ring buffer and the LRU list */ - i = cache_ptr->epoch_marker_ringbuf[cache_ptr->epoch_marker_ringbuf_first]; + i = cache_ptr->epoch_marker_ringbuf[cache_ptr->epoch_marker_ringbuf_first]; - cache_ptr->epoch_marker_ringbuf_first = - (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1); + cache_ptr->epoch_marker_ringbuf_first = + (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1); - cache_ptr->epoch_marker_ringbuf_size -= 1; + cache_ptr->epoch_marker_ringbuf_size -= 1; - if (cache_ptr->epoch_marker_ringbuf_size < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow") - if ((cache_ptr->epoch_marker_active)[i] != TRUE) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?") + if (cache_ptr->epoch_marker_ringbuf_size < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow") + if ((cache_ptr->epoch_marker_active)[i] != TRUE) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?") - H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, - (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, - (FAIL)) + H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, + (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (FAIL)) - /* now, re-insert it at the head of the LRU list, and at the tail of - * the ring buffer. - */ + /* now, re-insert it at the head of the LRU list, and at the tail of + * the ring buffer. + */ - HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i); - HDassert(((cache_ptr->epoch_markers)[i]).next == NULL); - HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL); + HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i); + HDassert(((cache_ptr->epoch_markers)[i]).next == NULL); + HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL); - cache_ptr->epoch_marker_ringbuf_last = - (cache_ptr->epoch_marker_ringbuf_last + 1) % (H5C__MAX_EPOCH_MARKERS + 1); + cache_ptr->epoch_marker_ringbuf_last = + (cache_ptr->epoch_marker_ringbuf_last + 1) % (H5C__MAX_EPOCH_MARKERS + 1); - (cache_ptr->epoch_marker_ringbuf)[cache_ptr->epoch_marker_ringbuf_last] = i; + (cache_ptr->epoch_marker_ringbuf)[cache_ptr->epoch_marker_ringbuf_last] = i; - cache_ptr->epoch_marker_ringbuf_size += 1; + cache_ptr->epoch_marker_ringbuf_size += 1; - if (cache_ptr->epoch_marker_ringbuf_size > H5C__MAX_EPOCH_MARKERS) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow") + if (cache_ptr->epoch_marker_ringbuf_size > H5C__MAX_EPOCH_MARKERS) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow") - H5C__DLL_PREPEND((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, - (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, - (FAIL)) + H5C__DLL_PREPEND((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, + (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (FAIL)) done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__autoadjust__ageout__cycle_epoch_marker() */ +} /* H5C__autoadjust__ageout__cycle_epoch_marker() */ - /*------------------------------------------------------------------------- - * - * Function: H5C__autoadjust__ageout__evict_aged_out_entries - * - * Purpose: Evict clean entries in the cache that haven't - * been accessed for at least - * (cache_ptr->resize_ctl).epochs_before_eviction epochs, - * and flush dirty entries that haven't been accessed for - * that amount of time. - * - * Depending on configuration, the function will either - * flush or evict all such entries, or all such entries it - * encounters until it has freed the maximum amount of space - * allowed under the maximum decrement. - * - * If we are running in parallel mode, writes may not be - * permitted. If so, the function simply skips any dirty - * entries it may encounter. - * - * The function makes no attempt to maintain the minimum - * clean size, as there is no guarantee that the cache size - * will be changed. - * - * If there is no cache size change, the minimum clean size - * constraint will be met through a combination of clean - * entries and free space in the cache. - * - * If there is a cache size reduction, the minimum clean size - * will be re-calculated, and will be enforced the next time - * we have to make space in the cache. - * - * Observe that this function cannot occasion a read. - * - * Return: Non-negative on success/Negative on failure. - * - * Programmer: John Mainzer, 11/22/04 - * - *------------------------------------------------------------------------- +/*------------------------------------------------------------------------- + * + * Function: H5C__autoadjust__ageout__evict_aged_out_entries + * + * Purpose: Evict clean entries in the cache that haven't + * been accessed for at least + * (cache_ptr->resize_ctl).epochs_before_eviction epochs, + * and flush dirty entries that haven't been accessed for + * that amount of time. + * + * Depending on configuration, the function will either + * flush or evict all such entries, or all such entries it + * encounters until it has freed the maximum amount of space + * allowed under the maximum decrement. + * + * If we are running in parallel mode, writes may not be + * permitted. If so, the function simply skips any dirty + * entries it may encounter. + * + * The function makes no attempt to maintain the minimum + * clean size, as there is no guarantee that the cache size + * will be changed. + * + * If there is no cache size change, the minimum clean size + * constraint will be met through a combination of clean + * entries and free space in the cache. + * + * If there is a cache size reduction, the minimum clean size + * will be re-calculated, and will be enforced the next time + * we have to make space in the cache. + * + * Observe that this function cannot occasion a read. + * + * Return: Non-negative on success/Negative on failure. + * + * Programmer: John Mainzer, 11/22/04 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *f, hbool_t write_permitted) +{ + H5C_t * cache_ptr = f->shared->cache; + size_t eviction_size_limit; + size_t bytes_evicted = 0; + hbool_t prev_is_dirty = FALSE; + hbool_t restart_scan; + H5C_cache_entry_t *entry_ptr; + H5C_cache_entry_t *next_ptr; + H5C_cache_entry_t *prev_ptr; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + HDassert(f); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + + /* if there is a limit on the amount that the cache size can be decrease + * in any one round of the cache size reduction algorithm, load that + * limit into eviction_size_limit. Otherwise, set eviction_size_limit + * to the equivalent of infinity. The current size of the index will + * do nicely. */ - static herr_t H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, hbool_t write_permitted) - { - H5C_t * cache_ptr = f->shared->cache; - size_t eviction_size_limit; - size_t bytes_evicted = 0; - hbool_t prev_is_dirty = FALSE; - hbool_t restart_scan; - H5C_cache_entry_t *entry_ptr; - H5C_cache_entry_t *next_ptr; - H5C_cache_entry_t *prev_ptr; - herr_t ret_value = SUCCEED; /* Return value */ + if ((cache_ptr->resize_ctl).apply_max_decrement) { - FUNC_ENTER_STATIC + eviction_size_limit = (cache_ptr->resize_ctl).max_decrement; + } + else { - HDassert(f); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + eviction_size_limit = cache_ptr->index_size; /* i.e. infinity */ + } - /* if there is a limit on the amount that the cache size can be decrease - * in any one round of the cache size reduction algorithm, load that - * limit into eviction_size_limit. Otherwise, set eviction_size_limit - * to the equivalent of infinity. The current size of the index will - * do nicely. - */ - if ((cache_ptr->resize_ctl).apply_max_decrement) { + if (write_permitted) { - eviction_size_limit = (cache_ptr->resize_ctl).max_decrement; - } - else { + restart_scan = FALSE; + entry_ptr = cache_ptr->LRU_tail_ptr; - eviction_size_limit = cache_ptr->index_size; /* i.e. infinity */ - } + while ((entry_ptr != NULL) && ((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) && + (bytes_evicted < eviction_size_limit)) { + hbool_t skipping_entry = FALSE; - if (write_permitted) { + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(!(entry_ptr->is_protected)); + HDassert(!(entry_ptr->is_read_only)); + HDassert((entry_ptr->ro_ref_count) == 0); - restart_scan = FALSE; - entry_ptr = cache_ptr->LRU_tail_ptr; + next_ptr = entry_ptr->next; + prev_ptr = entry_ptr->prev; - while ((entry_ptr != NULL) && ((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) && - (bytes_evicted < eviction_size_limit)) { - hbool_t skipping_entry = FALSE; + if (prev_ptr != NULL) + prev_is_dirty = prev_ptr->is_dirty; - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(!(entry_ptr->is_protected)); - HDassert(!(entry_ptr->is_read_only)); - HDassert((entry_ptr->ro_ref_count) == 0); + if (entry_ptr->is_dirty) { + HDassert(!entry_ptr->prefetched_dirty); - next_ptr = entry_ptr->next; - prev_ptr = entry_ptr->prev; + /* dirty corked entry is skipped */ + if (entry_ptr->tag_info && entry_ptr->tag_info->corked) + skipping_entry = TRUE; + else { + /* reset entries_removed_counter and + * last_entry_removed_ptr prior to the call to + * H5C__flush_single_entry() so that we can spot + * unexpected removals of entries from the cache, + * and set the restart_scan flag if proceeding + * would be likely to cause us to scan an entry + * that is no longer in the cache. + */ + cache_ptr->entries_removed_counter = 0; + cache_ptr->last_entry_removed_ptr = NULL; - if (prev_ptr != NULL) - prev_is_dirty = prev_ptr->is_dirty; + if (H5C__flush_single_entry(f, entry_ptr, H5C__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") - if (entry_ptr->is_dirty) { - HDassert(!entry_ptr->prefetched_dirty); + if (cache_ptr->entries_removed_counter > 1 || + cache_ptr->last_entry_removed_ptr == prev_ptr) + restart_scan = TRUE; + } /* end else */ + } /* end if */ + else if (!entry_ptr->prefetched_dirty) { - /* dirty corked entry is skipped */ - if (entry_ptr->tag_info && entry_ptr->tag_info->corked) - skipping_entry = TRUE; - else { - /* reset entries_removed_counter and - * last_entry_removed_ptr prior to the call to - * H5C__flush_single_entry() so that we can spot - * unexpected removals of entries from the cache, - * and set the restart_scan flag if proceeding - * would be likely to cause us to scan an entry - * that is no longer in the cache. - */ - cache_ptr->entries_removed_counter = 0; - cache_ptr->last_entry_removed_ptr = NULL; + bytes_evicted += entry_ptr->size; - if (H5C__flush_single_entry(f, entry_ptr, H5C__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") + if (H5C__flush_single_entry( + f, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") + } /* end else-if */ + else { + HDassert(!entry_ptr->is_dirty); + HDassert(entry_ptr->prefetched_dirty); - if (cache_ptr->entries_removed_counter > 1 || - cache_ptr->last_entry_removed_ptr == prev_ptr) - restart_scan = TRUE; - } /* end else */ - } /* end if */ - else if (!entry_ptr->prefetched_dirty) { + skipping_entry = TRUE; + } /* end else */ - bytes_evicted += entry_ptr->size; + if (prev_ptr != NULL) { + if (skipping_entry) + entry_ptr = prev_ptr; + else if (restart_scan || (prev_ptr->is_dirty != prev_is_dirty) || + (prev_ptr->next != next_ptr) || (prev_ptr->is_protected) || (prev_ptr->is_pinned)) { + /* Something has happened to the LRU -- start over + * from the tail. + */ + restart_scan = FALSE; + entry_ptr = cache_ptr->LRU_tail_ptr; - if (H5C__flush_single_entry(f, entry_ptr, - H5C__FLUSH_INVALIDATE_FLAG | - H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") + H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr) } /* end else-if */ - else { - HDassert(!entry_ptr->is_dirty); - HDassert(entry_ptr->prefetched_dirty); + else + entry_ptr = prev_ptr; + } /* end if */ + else + entry_ptr = NULL; + } /* end while */ - skipping_entry = TRUE; - } /* end else */ + /* for now at least, don't bother to maintain the minimum clean size, + * as the cache should now be less than its maximum size. Due to + * the vaguries of the cache size reduction algorthim, we may not + * reduce the size of the cache. + * + * If we do, we will calculate a new minimum clean size, which will + * be enforced the next time we try to make space in the cache. + * + * If we don't, no action is necessary, as we have just evicted and/or + * or flushed a bunch of entries and therefore the sum of the clean + * and free space in the cache must be greater than or equal to the + * min clean space requirement (assuming that requirement was met on + * entry). + */ - if (prev_ptr != NULL) { - if (skipping_entry) - entry_ptr = prev_ptr; - else if (restart_scan || (prev_ptr->is_dirty != prev_is_dirty) || - (prev_ptr->next != next_ptr) || (prev_ptr->is_protected) || - (prev_ptr->is_pinned)) { - /* Something has happened to the LRU -- start over - * from the tail. - */ - restart_scan = FALSE; - entry_ptr = cache_ptr->LRU_tail_ptr; + } /* end if */ + else /* ! write_permitted */ { + /* Since we are not allowed to write, all we can do is evict + * any clean entries that we may encounter before we either + * hit the eviction size limit, or encounter the epoch marker. + * + * If we are operating read only, this isn't an issue, as there + * will not be any dirty entries. + * + * If we are operating in R/W mode, all the dirty entries we + * skip will be flushed the next time we attempt to make space + * when writes are permitted. This may have some local + * performance implications, but it shouldn't cause any net + * slowdown. + */ + HDassert(H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS); + entry_ptr = cache_ptr->LRU_tail_ptr; + while (entry_ptr != NULL && ((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) && + (bytes_evicted < eviction_size_limit)) { + HDassert(!(entry_ptr->is_protected)); - H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr) - } /* end else-if */ - else - entry_ptr = prev_ptr; - } /* end if */ - else - entry_ptr = NULL; - } /* end while */ + prev_ptr = entry_ptr->prev; - /* for now at least, don't bother to maintain the minimum clean size, - * as the cache should now be less than its maximum size. Due to - * the vaguries of the cache size reduction algorthim, we may not - * reduce the size of the cache. - * - * If we do, we will calculate a new minimum clean size, which will - * be enforced the next time we try to make space in the cache. - * - * If we don't, no action is necessary, as we have just evicted and/or - * or flushed a bunch of entries and therefore the sum of the clean - * and free space in the cache must be greater than or equal to the - * min clean space requirement (assuming that requirement was met on - * entry). - */ + if (!(entry_ptr->is_dirty) && !(entry_ptr->prefetched_dirty)) + if (H5C__flush_single_entry( + f, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush clean entry") - } /* end if */ - else /* ! write_permitted */ { - /* Since we are not allowed to write, all we can do is evict - * any clean entries that we may encounter before we either - * hit the eviction size limit, or encounter the epoch marker. + /* just skip the entry if it is dirty, as we can't do + * anything with it now since we can't write. * - * If we are operating read only, this isn't an issue, as there - * will not be any dirty entries. - * - * If we are operating in R/W mode, all the dirty entries we - * skip will be flushed the next time we attempt to make space - * when writes are permitted. This may have some local - * performance implications, but it shouldn't cause any net - * slowdown. + * Since all entries are clean, serialize() will not be called, + * and thus we needn't test to see if the LRU has been changed + * out from under us. */ - HDassert(H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS); - entry_ptr = cache_ptr->LRU_tail_ptr; - while (entry_ptr != NULL && ((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) && - (bytes_evicted < eviction_size_limit)) { - HDassert(!(entry_ptr->is_protected)); - - prev_ptr = entry_ptr->prev; - - if (!(entry_ptr->is_dirty) && !(entry_ptr->prefetched_dirty)) - if (H5C__flush_single_entry(f, entry_ptr, - H5C__FLUSH_INVALIDATE_FLAG | - H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush clean entry") - - /* just skip the entry if it is dirty, as we can't do - * anything with it now since we can't write. - * - * Since all entries are clean, serialize() will not be called, - * and thus we needn't test to see if the LRU has been changed - * out from under us. - */ - entry_ptr = prev_ptr; - } /* end while */ - } /* end else */ + entry_ptr = prev_ptr; + } /* end while */ + } /* end else */ - if (cache_ptr->index_size < cache_ptr->max_cache_size) - cache_ptr->cache_full = FALSE; + if (cache_ptr->index_size < cache_ptr->max_cache_size) + cache_ptr->cache_full = FALSE; done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__autoadjust__ageout__evict_aged_out_entries() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__autoadjust__ageout__evict_aged_out_entries() */ - /*------------------------------------------------------------------------- - * - * Function: H5C__autoadjust__ageout__insert_new_marker - * - * Purpose: Find an unused marker cache entry, mark it as used, and - * insert it at the head of the LRU list. Also add the - * marker's index in the epoch_markers array. - * - * Return: SUCCEED on success/FAIL on failure. - * - * Programmer: John Mainzer, 11/19/04 - * - *------------------------------------------------------------------------- - */ - static herr_t H5C__autoadjust__ageout__insert_new_marker(H5C_t * cache_ptr) - { - int i; - herr_t ret_value = SUCCEED; /* Return value */ +/*------------------------------------------------------------------------- + * + * Function: H5C__autoadjust__ageout__insert_new_marker + * + * Purpose: Find an unused marker cache entry, mark it as used, and + * insert it at the head of the LRU list. Also add the + * marker's index in the epoch_markers array. + * + * Return: SUCCEED on success/FAIL on failure. + * + * Programmer: John Mainzer, 11/19/04 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__autoadjust__ageout__insert_new_marker(H5C_t *cache_ptr) +{ + int i; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - if (cache_ptr->epoch_markers_active >= (cache_ptr->resize_ctl).epochs_before_eviction) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Already have a full complement of markers") + if (cache_ptr->epoch_markers_active >= (cache_ptr->resize_ctl).epochs_before_eviction) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Already have a full complement of markers") - /* find an unused marker */ - i = 0; - while ((cache_ptr->epoch_marker_active)[i] && i < H5C__MAX_EPOCH_MARKERS) - i++; + /* find an unused marker */ + i = 0; + while ((cache_ptr->epoch_marker_active)[i] && i < H5C__MAX_EPOCH_MARKERS) + i++; - if (i >= H5C__MAX_EPOCH_MARKERS) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't find unused marker") + if (i >= H5C__MAX_EPOCH_MARKERS) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't find unused marker") - HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i); - HDassert(((cache_ptr->epoch_markers)[i]).next == NULL); - HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL); + HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i); + HDassert(((cache_ptr->epoch_markers)[i]).next == NULL); + HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL); - (cache_ptr->epoch_marker_active)[i] = TRUE; + (cache_ptr->epoch_marker_active)[i] = TRUE; - cache_ptr->epoch_marker_ringbuf_last = - (cache_ptr->epoch_marker_ringbuf_last + 1) % (H5C__MAX_EPOCH_MARKERS + 1); + cache_ptr->epoch_marker_ringbuf_last = + (cache_ptr->epoch_marker_ringbuf_last + 1) % (H5C__MAX_EPOCH_MARKERS + 1); - (cache_ptr->epoch_marker_ringbuf)[cache_ptr->epoch_marker_ringbuf_last] = i; + (cache_ptr->epoch_marker_ringbuf)[cache_ptr->epoch_marker_ringbuf_last] = i; - cache_ptr->epoch_marker_ringbuf_size += 1; + cache_ptr->epoch_marker_ringbuf_size += 1; - if (cache_ptr->epoch_marker_ringbuf_size > H5C__MAX_EPOCH_MARKERS) { + if (cache_ptr->epoch_marker_ringbuf_size > H5C__MAX_EPOCH_MARKERS) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow") - } + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow") + } - H5C__DLL_PREPEND((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, - (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, - (FAIL)) + H5C__DLL_PREPEND((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, + (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (FAIL)) - cache_ptr->epoch_markers_active += 1; + cache_ptr->epoch_markers_active += 1; done: - FUNC_LEAVE_NOAPI(ret_value) - - } /* H5C__autoadjust__ageout__insert_new_marker() */ - - /*------------------------------------------------------------------------- - * - * Function: H5C__autoadjust__ageout__remove_all_markers - * - * Purpose: Remove all epoch markers from the LRU list and mark them - * as inactive. - * - * Return: SUCCEED on success/FAIL on failure. - * - * Programmer: John Mainzer, 11/22/04 - * - *------------------------------------------------------------------------- - */ - static herr_t H5C__autoadjust__ageout__remove_all_markers(H5C_t * cache_ptr) - { - int ring_buf_index; - int i; - herr_t ret_value = SUCCEED; /* Return value */ + FUNC_LEAVE_NOAPI(ret_value) - FUNC_ENTER_STATIC +} /* H5C__autoadjust__ageout__insert_new_marker() */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); +/*------------------------------------------------------------------------- + * + * Function: H5C__autoadjust__ageout__remove_all_markers + * + * Purpose: Remove all epoch markers from the LRU list and mark them + * as inactive. + * + * Return: SUCCEED on success/FAIL on failure. + * + * Programmer: John Mainzer, 11/22/04 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__autoadjust__ageout__remove_all_markers(H5C_t *cache_ptr) +{ + int ring_buf_index; + int i; + herr_t ret_value = SUCCEED; /* Return value */ - while (cache_ptr->epoch_markers_active > 0) { - /* get the index of the last epoch marker in the LRU list - * and remove it from the ring buffer. - */ + FUNC_ENTER_STATIC + + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - ring_buf_index = cache_ptr->epoch_marker_ringbuf_first; - i = (cache_ptr->epoch_marker_ringbuf)[ring_buf_index]; + while (cache_ptr->epoch_markers_active > 0) { + /* get the index of the last epoch marker in the LRU list + * and remove it from the ring buffer. + */ + + ring_buf_index = cache_ptr->epoch_marker_ringbuf_first; + i = (cache_ptr->epoch_marker_ringbuf)[ring_buf_index]; - cache_ptr->epoch_marker_ringbuf_first = - (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1); + cache_ptr->epoch_marker_ringbuf_first = + (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1); - cache_ptr->epoch_marker_ringbuf_size -= 1; + cache_ptr->epoch_marker_ringbuf_size -= 1; - if (cache_ptr->epoch_marker_ringbuf_size < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow") + if (cache_ptr->epoch_marker_ringbuf_size < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow") - if ((cache_ptr->epoch_marker_active)[i] != TRUE) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?") + if ((cache_ptr->epoch_marker_active)[i] != TRUE) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?") - /* remove the epoch marker from the LRU list */ - H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, - (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, - (FAIL)) + /* remove the epoch marker from the LRU list */ + H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, + (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, + (FAIL)) - /* mark the epoch marker as unused. */ - (cache_ptr->epoch_marker_active)[i] = FALSE; + /* mark the epoch marker as unused. */ + (cache_ptr->epoch_marker_active)[i] = FALSE; - HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i); - HDassert(((cache_ptr->epoch_markers)[i]).next == NULL); - HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL); + HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i); + HDassert(((cache_ptr->epoch_markers)[i]).next == NULL); + HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL); - /* decrement the number of active epoch markers */ - cache_ptr->epoch_markers_active -= 1; + /* decrement the number of active epoch markers */ + cache_ptr->epoch_markers_active -= 1; - HDassert(cache_ptr->epoch_markers_active == cache_ptr->epoch_marker_ringbuf_size); - } + HDassert(cache_ptr->epoch_markers_active == cache_ptr->epoch_marker_ringbuf_size); + } done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__autoadjust__ageout__remove_all_markers() */ +} /* H5C__autoadjust__ageout__remove_all_markers() */ - /*------------------------------------------------------------------------- - * - * Function: H5C__autoadjust__ageout__remove_excess_markers - * - * Purpose: Remove epoch markers from the end of the LRU list and - * mark them as inactive until the number of active markers - * equals the the current value of - * (cache_ptr->resize_ctl).epochs_before_eviction. - * - * Return: SUCCEED on success/FAIL on failure. - * - * Programmer: John Mainzer, 11/19/04 - * - *------------------------------------------------------------------------- - */ - static herr_t H5C__autoadjust__ageout__remove_excess_markers(H5C_t * cache_ptr) - { - int ring_buf_index; - int i; - herr_t ret_value = SUCCEED; /* Return value */ +/*------------------------------------------------------------------------- + * + * Function: H5C__autoadjust__ageout__remove_excess_markers + * + * Purpose: Remove epoch markers from the end of the LRU list and + * mark them as inactive until the number of active markers + * equals the the current value of + * (cache_ptr->resize_ctl).epochs_before_eviction. + * + * Return: SUCCEED on success/FAIL on failure. + * + * Programmer: John Mainzer, 11/19/04 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__autoadjust__ageout__remove_excess_markers(H5C_t *cache_ptr) +{ + int ring_buf_index; + int i; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - if (cache_ptr->epoch_markers_active <= (cache_ptr->resize_ctl).epochs_before_eviction) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "no excess markers on entry") + if (cache_ptr->epoch_markers_active <= (cache_ptr->resize_ctl).epochs_before_eviction) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "no excess markers on entry") - while (cache_ptr->epoch_markers_active > (cache_ptr->resize_ctl).epochs_before_eviction) { - /* get the index of the last epoch marker in the LRU list - * and remove it from the ring buffer. - */ + while (cache_ptr->epoch_markers_active > (cache_ptr->resize_ctl).epochs_before_eviction) { + /* get the index of the last epoch marker in the LRU list + * and remove it from the ring buffer. + */ - ring_buf_index = cache_ptr->epoch_marker_ringbuf_first; - i = (cache_ptr->epoch_marker_ringbuf)[ring_buf_index]; + ring_buf_index = cache_ptr->epoch_marker_ringbuf_first; + i = (cache_ptr->epoch_marker_ringbuf)[ring_buf_index]; - cache_ptr->epoch_marker_ringbuf_first = - (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1); + cache_ptr->epoch_marker_ringbuf_first = + (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1); - cache_ptr->epoch_marker_ringbuf_size -= 1; + cache_ptr->epoch_marker_ringbuf_size -= 1; - if (cache_ptr->epoch_marker_ringbuf_size < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow") - if ((cache_ptr->epoch_marker_active)[i] != TRUE) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?") + if (cache_ptr->epoch_marker_ringbuf_size < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow") + if ((cache_ptr->epoch_marker_active)[i] != TRUE) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?") - /* remove the epoch marker from the LRU list */ - H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, - (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, - (FAIL)) + /* remove the epoch marker from the LRU list */ + H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, + (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, + (FAIL)) - /* mark the epoch marker as unused. */ - (cache_ptr->epoch_marker_active)[i] = FALSE; + /* mark the epoch marker as unused. */ + (cache_ptr->epoch_marker_active)[i] = FALSE; - HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i); - HDassert(((cache_ptr->epoch_markers)[i]).next == NULL); - HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL); + HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i); + HDassert(((cache_ptr->epoch_markers)[i]).next == NULL); + HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL); - /* decrement the number of active epoch markers */ - cache_ptr->epoch_markers_active -= 1; + /* decrement the number of active epoch markers */ + cache_ptr->epoch_markers_active -= 1; - HDassert(cache_ptr->epoch_markers_active == cache_ptr->epoch_marker_ringbuf_size); - } + HDassert(cache_ptr->epoch_markers_active == cache_ptr->epoch_marker_ringbuf_size); + } done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__autoadjust__ageout__remove_excess_markers() */ +} /* H5C__autoadjust__ageout__remove_excess_markers() */ - /*------------------------------------------------------------------------- - * - * Function: H5C__flash_increase_cache_size - * - * Purpose: If there is not at least new_entry_size - old_entry_size - * bytes of free space in the cache and the current - * max_cache_size is less than (cache_ptr->resize_ctl).max_size, - * perform a flash increase in the cache size and then reset - * the full cache hit rate statistics, and exit. - * - * Return: Non-negative on success/Negative on failure. - * - * Programmer: John Mainzer, 12/31/07 - * - *------------------------------------------------------------------------- - */ - static herr_t H5C__flash_increase_cache_size(H5C_t * cache_ptr, size_t old_entry_size, - size_t new_entry_size) - { - size_t new_max_cache_size = 0; - size_t old_max_cache_size = 0; - size_t new_min_clean_size = 0; - size_t old_min_clean_size = 0; - size_t space_needed; - enum H5C_resize_status status = flash_increase; /* may change */ - double hit_rate; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->flash_size_increase_possible); - HDassert(new_entry_size > cache_ptr->flash_size_increase_threshold); - HDassert(old_entry_size < new_entry_size); +/*------------------------------------------------------------------------- + * + * Function: H5C__flash_increase_cache_size + * + * Purpose: If there is not at least new_entry_size - old_entry_size + * bytes of free space in the cache and the current + * max_cache_size is less than (cache_ptr->resize_ctl).max_size, + * perform a flash increase in the cache size and then reset + * the full cache hit rate statistics, and exit. + * + * Return: Non-negative on success/Negative on failure. + * + * Programmer: John Mainzer, 12/31/07 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__flash_increase_cache_size(H5C_t *cache_ptr, size_t old_entry_size, size_t new_entry_size) +{ + size_t new_max_cache_size = 0; + size_t old_max_cache_size = 0; + size_t new_min_clean_size = 0; + size_t old_min_clean_size = 0; + size_t space_needed; + enum H5C_resize_status status = flash_increase; /* may change */ + double hit_rate; + herr_t ret_value = SUCCEED; /* Return value */ - if (old_entry_size >= new_entry_size) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "old_entry_size >= new_entry_size") + FUNC_ENTER_STATIC - space_needed = new_entry_size - old_entry_size; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->flash_size_increase_possible); + HDassert(new_entry_size > cache_ptr->flash_size_increase_threshold); + HDassert(old_entry_size < new_entry_size); - if (((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) && - (cache_ptr->max_cache_size < (cache_ptr->resize_ctl).max_size)) { + if (old_entry_size >= new_entry_size) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "old_entry_size >= new_entry_size") - /* we have work to do */ + space_needed = new_entry_size - old_entry_size; - switch ((cache_ptr->resize_ctl).flash_incr_mode) { - case H5C_flash_incr__off: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, - "flash_size_increase_possible but H5C_flash_incr__off?!") - break; + if (((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) && + (cache_ptr->max_cache_size < (cache_ptr->resize_ctl).max_size)) { - case H5C_flash_incr__add_space: - if (cache_ptr->index_size < cache_ptr->max_cache_size) { + /* we have work to do */ - HDassert((cache_ptr->max_cache_size - cache_ptr->index_size) < space_needed); - space_needed -= cache_ptr->max_cache_size - cache_ptr->index_size; - } - space_needed = (size_t)(((double)space_needed) * (cache_ptr->resize_ctl).flash_multiple); + switch ((cache_ptr->resize_ctl).flash_incr_mode) { + case H5C_flash_incr__off: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, + "flash_size_increase_possible but H5C_flash_incr__off?!") + break; - new_max_cache_size = cache_ptr->max_cache_size + space_needed; + case H5C_flash_incr__add_space: + if (cache_ptr->index_size < cache_ptr->max_cache_size) { - break; + HDassert((cache_ptr->max_cache_size - cache_ptr->index_size) < space_needed); + space_needed -= cache_ptr->max_cache_size - cache_ptr->index_size; + } + space_needed = (size_t)(((double)space_needed) * (cache_ptr->resize_ctl).flash_multiple); - default: /* should be unreachable */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?") - break; - } + new_max_cache_size = cache_ptr->max_cache_size + space_needed; - if (new_max_cache_size > (cache_ptr->resize_ctl).max_size) { + break; - new_max_cache_size = (cache_ptr->resize_ctl).max_size; - } + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?") + break; + } - HDassert(new_max_cache_size > cache_ptr->max_cache_size); + if (new_max_cache_size > (cache_ptr->resize_ctl).max_size) { - new_min_clean_size = - (size_t)((double)new_max_cache_size * ((cache_ptr->resize_ctl).min_clean_fraction)); + new_max_cache_size = (cache_ptr->resize_ctl).max_size; + } - HDassert(new_min_clean_size <= new_max_cache_size); + HDassert(new_max_cache_size > cache_ptr->max_cache_size); - old_max_cache_size = cache_ptr->max_cache_size; - old_min_clean_size = cache_ptr->min_clean_size; + new_min_clean_size = + (size_t)((double)new_max_cache_size * ((cache_ptr->resize_ctl).min_clean_fraction)); - cache_ptr->max_cache_size = new_max_cache_size; - cache_ptr->min_clean_size = new_min_clean_size; + HDassert(new_min_clean_size <= new_max_cache_size); - /* update flash cache size increase fields as appropriate */ - HDassert(cache_ptr->flash_size_increase_possible); + old_max_cache_size = cache_ptr->max_cache_size; + old_min_clean_size = cache_ptr->min_clean_size; - switch ((cache_ptr->resize_ctl).flash_incr_mode) { - case H5C_flash_incr__off: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, - "flash_size_increase_possible but H5C_flash_incr__off?!") - break; + cache_ptr->max_cache_size = new_max_cache_size; + cache_ptr->min_clean_size = new_min_clean_size; - case H5C_flash_incr__add_space: - cache_ptr->flash_size_increase_threshold = (size_t)( - ((double)(cache_ptr->max_cache_size)) * ((cache_ptr->resize_ctl).flash_threshold)); - break; + /* update flash cache size increase fields as appropriate */ + HDassert(cache_ptr->flash_size_increase_possible); - default: /* should be unreachable */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?") - break; - } + switch ((cache_ptr->resize_ctl).flash_incr_mode) { + case H5C_flash_incr__off: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, + "flash_size_increase_possible but H5C_flash_incr__off?!") + break; - /* note that we don't cycle the epoch markers. We can - * argue either way as to whether we should, but for now - * we don't. - */ + case H5C_flash_incr__add_space: + cache_ptr->flash_size_increase_threshold = (size_t)( + ((double)(cache_ptr->max_cache_size)) * ((cache_ptr->resize_ctl).flash_threshold)); + break; - if ((cache_ptr->resize_ctl).rpt_fcn != NULL) { + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?") + break; + } - /* get the hit rate for the reporting function. Should still - * be good as we haven't reset the hit rate statistics. - */ - if (H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate") + /* note that we don't cycle the epoch markers. We can + * argue either way as to whether we should, but for now + * we don't. + */ - (*((cache_ptr->resize_ctl).rpt_fcn))(cache_ptr, H5C__CURR_AUTO_RESIZE_RPT_FCN_VER, hit_rate, - status, old_max_cache_size, new_max_cache_size, - old_min_clean_size, new_min_clean_size); - } + if ((cache_ptr->resize_ctl).rpt_fcn != NULL) { + + /* get the hit rate for the reporting function. Should still + * be good as we haven't reset the hit rate statistics. + */ + if (H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate") - if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0) - /* this should be impossible... */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed") + (*((cache_ptr->resize_ctl).rpt_fcn))(cache_ptr, H5C__CURR_AUTO_RESIZE_RPT_FCN_VER, hit_rate, + status, old_max_cache_size, new_max_cache_size, + old_min_clean_size, new_min_clean_size); } + if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0) + /* this should be impossible... */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed") + } + done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__flash_increase_cache_size() */ +} /* H5C__flash_increase_cache_size() */ - /*------------------------------------------------------------------------- - * Function: H5C__flush_invalidate_cache - * - * Purpose: Flush and destroy the entries contained in the target - * cache. - * - * If the cache 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. - * - * 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 - * 3/24/065 - * - *------------------------------------------------------------------------- - */ - static herr_t H5C__flush_invalidate_cache(H5F_t * f, unsigned flags) - { - H5C_t * cache_ptr; - H5C_ring_t ring; - herr_t ret_value = SUCCEED; +/*------------------------------------------------------------------------- + * Function: H5C__flush_invalidate_cache + * + * Purpose: Flush and destroy the entries contained in the target + * cache. + * + * If the cache 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. + * + * 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 + * 3/24/065 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__flush_invalidate_cache(H5F_t *f, unsigned flags) +{ + H5C_t * cache_ptr; + H5C_ring_t ring; + herr_t ret_value = SUCCEED; - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC - 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(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; - uint32_t index_len = 0; - uint32_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") + { + int32_t i; + uint32_t index_len = 0; + uint32_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; - /* 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, ring, flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate ring failed") - ring++; - } /* end while */ + 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); - /* Invariants, after destroying all entries in the hash table */ - if (!(flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG)) { - HDassert(cache_ptr->index_size == 0); - HDassert(cache_ptr->clean_index_size == 0); - HDassert(cache_ptr->pel_len == 0); - HDassert(cache_ptr->pel_size == 0); - } /* end if */ - else { - H5C_cache_entry_t *entry_ptr; /* Cache entry */ - unsigned u; /* Local index variable */ - - /* All rings except ring 4 should be empty now */ - /* (Ring 4 has the superblock) */ - for (u = H5C_RING_USER; u < H5C_RING_SB; u++) { - HDassert(cache_ptr->index_ring_len[u] == 0); - HDassert(cache_ptr->index_ring_size[u] == 0); - HDassert(cache_ptr->clean_index_ring_size[u] == 0); - } /* end for */ - - /* Check that any remaining pinned entries are in the superblock ring */ - entry_ptr = cache_ptr->pel_head_ptr; - while (entry_ptr) { - /* Check ring */ - HDassert(entry_ptr->ring == H5C_RING_SB); - - /* Advance to next entry in pinned entry list */ - entry_ptr = entry_ptr->next; - } /* end while */ - } /* end else */ - HDassert(cache_ptr->dirty_index_size == 0); - HDassert(cache_ptr->slist_len == 0); - HDassert(cache_ptr->slist_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); + 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]; -done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__flush_invalidate_cache() */ + slist_len += cache_ptr->slist_ring_len[i]; + slist_size += cache_ptr->slist_ring_size[i]; + } /* end for */ - /*------------------------------------------------------------------------- - * 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_ring(H5F_t * f, H5C_ring_t ring, unsigned flags) - { - H5C_t * cache_ptr; - hbool_t restart_slist_scan; - uint32_t protected_entries = 0; - int32_t i; - int32_t cur_ring_pel_len; - int32_t old_ring_pel_len; - unsigned cooked_flags; - unsigned evict_flags; - 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 - uint32_t initial_slist_len = 0; - size_t initial_slist_size = 0; + 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 */ - herr_t ret_value = SUCCEED; - FUNC_ENTER_STATIC + /* 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") - 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); + /* 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, 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 */ + if (!(flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG)) { + HDassert(cache_ptr->index_size == 0); + HDassert(cache_ptr->clean_index_size == 0); + HDassert(cache_ptr->pel_len == 0); + HDassert(cache_ptr->pel_size == 0); + } /* end if */ + else { + H5C_cache_entry_t *entry_ptr; /* Cache entry */ + unsigned u; /* Local index variable */ + + /* All rings except ring 4 should be empty now */ + /* (Ring 4 has the superblock) */ + for (u = H5C_RING_USER; u < H5C_RING_SB; u++) { + HDassert(cache_ptr->index_ring_len[u] == 0); + HDassert(cache_ptr->index_ring_size[u] == 0); + HDassert(cache_ptr->clean_index_ring_size[u] == 0); + } /* end for */ - HDassert(cache_ptr->epoch_markers_active == 0); + /* Check that any remaining pinned entries are in the superblock ring */ + entry_ptr = cache_ptr->pel_head_ptr; + while (entry_ptr) { + /* Check ring */ + HDassert(entry_ptr->ring == H5C_RING_SB); - /* Filter out the flags that are not relevant to the flush/invalidate. - */ - cooked_flags = flags & H5C__FLUSH_CLEAR_ONLY_FLAG; - evict_flags = flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG; + /* Advance to next entry in pinned entry list */ + entry_ptr = entry_ptr->next; + } /* end while */ + } /* end else */ + HDassert(cache_ptr->dirty_index_size == 0); + HDassert(cache_ptr->slist_len == 0); + HDassert(cache_ptr->slist_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); - /* The flush procedure 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 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 - * contain dirty entries at this point. If so, we must make more - * passes through the skip list to allow it to empty. - * - * Further, since clean entries can be dirtied, resized, and/or moved - * as the result of a flush call back (either the entries own, or that - * for some other cache entry), we can no longer promise to flush - * the cache entries in increasing address order. - * - * Instead, we just do the best we can -- making a pass through - * the skip list, and then a pass through the "clean" entries, and - * then repeating as needed. Thus it is quite possible that an - * entry will be evicted from the cache only to be re-loaded later - * in the flush process (From what Quincey tells me, the pin - * mechanism makes this impossible, but even it it is true now, - * we shouldn't count on it in the future.) - * - * The bottom line is that entries will probably be flushed in close - * to increasing address order, but there are no guarantees. - */ - - /* 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++; - - entry_ptr = entry_ptr->next; - } /* end while */ - - old_ring_pel_len = cur_ring_pel_len; - while (cache_ptr->index_ring_len[ring] > 0) { - /* first, try to flush-destroy any dirty entries. Do this by - * making a scan through the slist. Note that new dirty entries - * may be created by the flush call backs. Thus it is possible - * that the slist will not be empty after we finish the scan. - */ +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_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) +{ + H5C_t * cache_ptr; + hbool_t restart_slist_scan; + uint32_t protected_entries = 0; + int32_t i; + int32_t cur_ring_pel_len; + int32_t old_ring_pel_len; + unsigned cooked_flags; + unsigned evict_flags; + 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 - /* Depending on circumstances, H5C__flush_single_entry() will - * remove dirty entries from the slist as it flushes them. - * Thus for sanity checks we must make note of the initial - * slist length and size before we do any flushes. - */ - initial_slist_len = cache_ptr->slist_len; - initial_slist_size = cache_ptr->slist_size; - - /* There is also the possibility that entries will be - * dirtied, resized, moved, and/or removed from the cache - * as the result of calls to the flush callbacks. We use - * the slist_len_increase and slist_size_increase increase - * fields in struct H5C_t to track these changes for purpose - * of sanity checking. - * - * To this end, we must zero these fields before we start - * the pass through the slist. - */ - cache_ptr->slist_len_increase = 0; - cache_ptr->slist_size_increase = 0; + uint32_t initial_slist_len = 0; + size_t initial_slist_size = 0; #endif /* H5C_DO_SANITY_CHECKS */ + herr_t ret_value = SUCCEED; - /* Set the cache_ptr->slist_changed to false. - * - * This flag is set to TRUE by H5C__flush_single_entry if the slist - * is modified by a pre_serialize, serialize, or notify callback. - * - * H5C__flush_invalidate_ring() uses this flag 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_changed = FALSE; - - /* this done, start the scan of the slist */ - 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; + FUNC_ENTER_STATIC - /* 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(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(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 */ + HDassert(cache_ptr->epoch_markers_active == 0); - entry_ptr = next_entry_ptr; - - /* It is possible that entries will be dirtied, resized, - * flushed, or removed from the cache via the take ownership - * flag as the result of pre_serialize or serialized callbacks. - * - * This in turn can corrupt the scan through the slist. - * - * We test for slist modifications in the pre_serialize - * and serialize callbacks, and restart the scan of the - * slist if we find them. However, best we do some extra - * sanity checking just in case. - */ - HDassert(entry_ptr != NULL); - 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); + /* Filter out the flags that are not relevant to the flush/invalidate. + */ + cooked_flags = flags & H5C__FLUSH_CLEAR_ONLY_FLAG; + evict_flags = flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG; + + /* The flush procedure 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 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 + * contain dirty entries at this point. If so, we must make more + * passes through the skip list to allow it to empty. + * + * Further, since clean entries can be dirtied, resized, and/or moved + * as the result of a flush call back (either the entries own, or that + * for some other cache entry), we can no longer promise to flush + * the cache entries in increasing address order. + * + * Instead, we just do the best we can -- making a pass through + * the skip list, and then a pass through the "clean" entries, and + * then repeating as needed. Thus it is quite possible that an + * entry will be evicted from the cache only to be re-loaded later + * in the flush process (From what Quincey tells me, the pin + * mechanism makes this impossible, but even it it is true now, + * we shouldn't count on it in the future.) + * + * The bottom line is that entries will probably be flushed in close + * to increasing address order, but there are no guarantees. + */ - /* 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; - - /* Note that we now remove nodes from the slist as we flush - * the associated entries, instead of leaving them there - * until we are done, and then destroying all nodes in - * the slist. - * - * While this optimization used to be easy, with the possibility - * of new entries being added to the slist in the midst of the - * flush, we must keep the slist in canonical form at all - * times. - */ - if (((!entry_ptr->flush_me_last) || - ((entry_ptr->flush_me_last) && (cache_ptr->num_last_entries >= cache_ptr->slist_len))) && - (entry_ptr->flush_dep_nchildren == 0) && (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++; - } /* end if */ - else if (entry_ptr->is_pinned) { - if (H5C__flush_single_entry(f, entry_ptr, H5C__DURING_FLUSH_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed") - - if (cache_ptr->slist_changed) { - /* 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_changed = FALSE; - H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr); - } /* end if */ - } /* end else-if */ - else { - if (H5C__flush_single_entry(f, entry_ptr, - (cooked_flags | H5C__DURING_FLUSH_FLAG | - H5C__FLUSH_INVALIDATE_FLAG | - H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry flush destroy failed") - - if (cache_ptr->slist_changed) { - /* 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_changed = FALSE; - H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) - } /* end if */ - } /* end else */ - } /* end if */ - } /* end while loop scanning skip list */ + /* 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++; + + entry_ptr = entry_ptr->next; + } /* end while */ + + old_ring_pel_len = cur_ring_pel_len; + while (cache_ptr->index_ring_len[ring] > 0) { + /* first, try to flush-destroy any dirty entries. Do this by + * making a scan through the slist. Note that new dirty entries + * may be created by the flush call backs. Thus it is possible + * that the slist will not be empty after we finish the scan. + */ #if H5C_DO_SANITY_CHECKS - /* It is possible that entries were added to the slist during - * the scan, either before or after scan pointer. The following - * asserts take this into account. - * - * Don't bother with the sanity checks if node_ptr != NULL, as - * in this case we broke out of the loop because it got changed - * out from under us. - */ + /* Depending on circumstances, H5C__flush_single_entry() will + * remove dirty entries from the slist as it flushes them. + * Thus for sanity checks we must make note of the initial + * slist length and size before we do any flushes. + */ + initial_slist_len = cache_ptr->slist_len; + initial_slist_size = cache_ptr->slist_size; + + /* There is also the possibility that entries will be + * dirtied, resized, moved, and/or removed from the cache + * as the result of calls to the flush callbacks. We use + * the slist_len_increase and slist_size_increase increase + * fields in struct H5C_t to track these changes for purpose + * of sanity checking. + * + * To this end, we must zero these fields before we start + * the pass through the slist. + */ + cache_ptr->slist_len_increase = 0; + cache_ptr->slist_size_increase = 0; +#endif /* H5C_DO_SANITY_CHECKS */ + + /* Set the cache_ptr->slist_changed to false. + * + * This flag is set to TRUE by H5C__flush_single_entry if the slist + * is modified by a pre_serialize, serialize, or notify callback. + * + * H5C__flush_invalidate_ring() uses this flag 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_changed = FALSE; + + /* this done, start the scan of the slist */ + restart_slist_scan = TRUE; + while (restart_slist_scan || (node_ptr != NULL)) { + if (restart_slist_scan) { + restart_slist_scan = FALSE; - if (node_ptr == NULL) { - HDassert(cache_ptr->slist_len == - (uint32_t)((int32_t)initial_slist_len + cache_ptr->slist_len_increase)); - HDassert(cache_ptr->slist_size == - (size_t)((ssize_t)initial_slist_size + cache_ptr->slist_size_increase)); + /* 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); + HDassert(next_entry_ptr->ring >= ring); } /* end if */ -#endif /* H5C_DO_SANITY_CHECKS */ - /* Since we are doing a destroy, we must make a pass through - * the hash table and try to flush - destroy all entries that - * remain. + entry_ptr = next_entry_ptr; + + /* It is possible that entries will be dirtied, resized, + * flushed, or removed from the cache via the take ownership + * flag as the result of pre_serialize or serialized callbacks. * - * It used to be that all entries remaining in the cache at - * this point had to be clean, but with the fractal heap mods - * this may not be the case. If so, we will flush entries out - * in increasing address order. + * This in turn can corrupt the scan through the slist. * - * Writes to disk are possible here. + * We test for slist modifications in the pre_serialize + * and serialize callbacks, and restart the scan of the + * slist if we find them. However, best we do some extra + * sanity checking just in case. */ + HDassert(entry_ptr != NULL); + 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); - /* reset the counters so that we can detect insertions, loads, - * and moves caused by the pre_serialize and serialize calls. + /* increment node pointer now, before we delete its target + * from the slist. */ - cache_ptr->entries_loaded_counter = 0; - cache_ptr->entries_inserted_counter = 0; - cache_ptr->entries_relocated_counter = 0; - - next_entry_ptr = cache_ptr->il_head; - while (next_entry_ptr != NULL) { - entry_ptr = next_entry_ptr; - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->ring >= ring); - - next_entry_ptr = entry_ptr->il_next; - HDassert((next_entry_ptr == NULL) || (next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC)); + 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; - if ((!entry_ptr->flush_me_last || - (entry_ptr->flush_me_last && cache_ptr->num_last_entries >= cache_ptr->slist_len)) && - entry_ptr->flush_dep_nchildren == 0 && 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. + /* Note that we now remove nodes from the slist as we flush + * the associated entries, instead of leaving them there + * until we are done, and then destroying all nodes in + * the slist. + * + * While this optimization used to be easy, with the possibility + * of new entries being added to the slist in the midst of the + * flush, we must keep the slist in canonical form at all + * times. + */ + if (((!entry_ptr->flush_me_last) || + ((entry_ptr->flush_me_last) && (cache_ptr->num_last_entries >= cache_ptr->slist_len))) && + (entry_ptr->flush_dep_nchildren == 0) && (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++; + } /* end if */ + else if (entry_ptr->is_pinned) { + if (H5C__flush_single_entry(f, entry_ptr, H5C__DURING_FLUSH_FLAG) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed") + + if (cache_ptr->slist_changed) { + /* 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. */ - protected_entries++; - if (!entry_ptr->in_slist) - HDassert(!(entry_ptr->is_dirty)); + restart_slist_scan = TRUE; + cache_ptr->slist_changed = FALSE; + H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr); } /* end if */ - else if (!(entry_ptr->is_pinned)) { - /* if *entry_ptr is dirty, it is possible - * that one or more other entries may be - * either removed from the cache, loaded - * into the cache, or moved to a new location - * in the file as a side effect of the flush. - * - * It's also possible that removing a clean - * entry will remove the last child of a proxy - * entry, allowing it to be removed also and - * invalidating the next_entry_ptr. - * - * If either of these happen, and one of the target - * or proxy entries happens to be the next entry in - * the hash bucket, we could either find ourselves - * either scanning a non-existant entry, scanning - * through a different bucket, or skipping an entry. - * - * Neither of these are good, so restart the - * the scan at the head of the hash bucket - * after the flush if we detect that the next_entry_ptr - * becomes invalid. + } /* end else-if */ + else { + if (H5C__flush_single_entry(f, entry_ptr, + (cooked_flags | H5C__DURING_FLUSH_FLAG | + H5C__FLUSH_INVALIDATE_FLAG | + H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry flush destroy failed") + + if (cache_ptr->slist_changed) { + /* The slist has been modified by something + * other than the simple removal of the + * of the flushed entry after the flush. * - * This is not as inefficient at it might seem, - * as hash buckets typically have at most two - * or three entries. + * This has the potential to corrupt the + * scan through the slist, so restart it. */ - cache_ptr->entry_watched_for_removal = next_entry_ptr; - - if (H5C__flush_single_entry(f, entry_ptr, - (cooked_flags | H5C__DURING_FLUSH_FLAG | - H5C__FLUSH_INVALIDATE_FLAG | - H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Entry flush destroy failed") - - /* Restart the index list scan if necessary. Must - * do this if the next entry is evicted, and also if - * one or more entries are inserted, loaded, or moved - * as these operations can result in part of the scan - * being skipped -- which can cause a spurious failure - * if this results in the size of the pinned entry - * failing to decline during the pass. - */ - if ((NULL != next_entry_ptr && NULL == cache_ptr->entry_watched_for_removal) || - (cache_ptr->entries_loaded_counter > 0) || - (cache_ptr->entries_inserted_counter > 0) || - (cache_ptr->entries_relocated_counter > 0)) { + restart_slist_scan = TRUE; + cache_ptr->slist_changed = FALSE; + H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) + } /* end if */ + } /* end else */ + } /* end if */ + } /* end while loop scanning skip list */ + +#if H5C_DO_SANITY_CHECKS + /* It is possible that entries were added to the slist during + * the scan, either before or after scan pointer. The following + * asserts take this into account. + * + * Don't bother with the sanity checks if node_ptr != NULL, as + * in this case we broke out of the loop because it got changed + * out from under us. + */ - next_entry_ptr = cache_ptr->il_head; + if (node_ptr == NULL) { + HDassert(cache_ptr->slist_len == + (uint32_t)((int32_t)initial_slist_len + cache_ptr->slist_len_increase)); + HDassert(cache_ptr->slist_size == + (size_t)((ssize_t)initial_slist_size + cache_ptr->slist_size_increase)); + } /* end if */ +#endif /* H5C_DO_SANITY_CHECKS */ - cache_ptr->entries_loaded_counter = 0; - cache_ptr->entries_inserted_counter = 0; - cache_ptr->entries_relocated_counter = 0; + /* Since we are doing a destroy, we must make a pass through + * the hash table and try to flush - destroy all entries that + * remain. + * + * It used to be that all entries remaining in the cache at + * this point had to be clean, but with the fractal heap mods + * this may not be the case. If so, we will flush entries out + * in increasing address order. + * + * Writes to disk are possible here. + */ - H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr) - } /* end if */ - else - cache_ptr->entry_watched_for_removal = NULL; + /* reset the counters so that we can detect insertions, loads, + * and moves caused by the pre_serialize and serialize calls. + */ + cache_ptr->entries_loaded_counter = 0; + cache_ptr->entries_inserted_counter = 0; + cache_ptr->entries_relocated_counter = 0; + + next_entry_ptr = cache_ptr->il_head; + while (next_entry_ptr != NULL) { + entry_ptr = next_entry_ptr; + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->ring >= ring); + + next_entry_ptr = entry_ptr->il_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)) && + entry_ptr->flush_dep_nchildren == 0 && 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)); + } /* end if */ + else if (!(entry_ptr->is_pinned)) { + /* if *entry_ptr is dirty, it is possible + * that one or more other entries may be + * either removed from the cache, loaded + * into the cache, or moved to a new location + * in the file as a side effect of the flush. + * + * It's also possible that removing a clean + * entry will remove the last child of a proxy + * entry, allowing it to be removed also and + * invalidating the next_entry_ptr. + * + * If either of these happen, and one of the target + * or proxy entries happens to be the next entry in + * the hash bucket, we could either find ourselves + * either scanning a non-existant entry, scanning + * through a different bucket, or skipping an entry. + * + * Neither of these are good, so restart the + * the scan at the head of the hash bucket + * after the flush if we detect that the next_entry_ptr + * becomes invalid. + * + * This is not as inefficient at it might seem, + * as hash buckets typically have at most two + * or three entries. + */ + cache_ptr->entry_watched_for_removal = next_entry_ptr; + + if (H5C__flush_single_entry(f, entry_ptr, + (cooked_flags | H5C__DURING_FLUSH_FLAG | + H5C__FLUSH_INVALIDATE_FLAG | + H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Entry flush destroy failed") + + /* Restart the index list scan if necessary. Must + * do this if the next entry is evicted, and also if + * one or more entries are inserted, loaded, or moved + * as these operations can result in part of the scan + * being skipped -- which can cause a spurious failure + * if this results in the size of the pinned entry + * failing to decline during the pass. + */ + if ((NULL != next_entry_ptr && NULL == cache_ptr->entry_watched_for_removal) || + (cache_ptr->entries_loaded_counter > 0) || + (cache_ptr->entries_inserted_counter > 0) || + (cache_ptr->entries_relocated_counter > 0)) { + + next_entry_ptr = cache_ptr->il_head; + + cache_ptr->entries_loaded_counter = 0; + cache_ptr->entries_inserted_counter = 0; + cache_ptr->entries_relocated_counter = 0; + + H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr) } /* end if */ - } /* end if */ - } /* end for loop scanning hash table */ + else + cache_ptr->entry_watched_for_removal = NULL; + } /* end if */ + } /* end if */ + } /* end for loop scanning hash table */ - /* We can't do anything if entries are pinned. The - * hope is that the entries will be unpinned as the - * result of destroys of entries that reference them. - * - * We detect this by noting the change in the number - * of pinned entries from pass to pass. If it stops - * shrinking before it hits zero, we 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); + /* We can't do anything if entries are pinned. The + * hope is that the entries will be unpinned as the + * result of destroys of entries that reference them. + * + * We detect this by noting the change in the number + * of pinned entries from pass to pass. If it stops + * shrinking before it hits zero, we 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); - if (entry_ptr->ring == ring) - cur_ring_pel_len++; + if (entry_ptr->ring == ring) + cur_ring_pel_len++; - entry_ptr = entry_ptr->next; - } /* end while */ + entry_ptr = entry_ptr->next; + } /* end while */ - /* Check if the number of pinned entries in the ring is positive, and - * it is not declining. Scream and die if so. - */ - if (cur_ring_pel_len > 0 && cur_ring_pel_len >= old_ring_pel_len) { - /* Don't error if allowed to have pinned entries remaining */ - if (evict_flags) - HGOTO_DONE(TRUE) - - 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) - } /* end if */ + /* Check if the number of pinned entries in the ring is positive, and + * it is not declining. Scream and die if so. + */ + if (cur_ring_pel_len > 0 && cur_ring_pel_len >= old_ring_pel_len) { + /* Don't error if allowed to have pinned entries remaining */ + if (evict_flags) + HGOTO_DONE(TRUE) + + 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) + } /* end if */ - HDassert(protected_entries == cache_ptr->pl_len); + HDassert(protected_entries == cache_ptr->pl_len); - if (protected_entries > 0 && protected_entries == cache_ptr->index_len) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, - "Only protected entries left in cache, protected_entries = %d", - (int)protected_entries) - } /* main while loop */ + if (protected_entries > 0 && protected_entries == cache_ptr->index_len) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, + "Only protected entries left in cache, protected_entries = %d", + (int)protected_entries) + } /* main while loop */ - /* 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); + /* 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(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) + 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") done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__flush_invalidate_ring() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__flush_invalidate_ring() */ - /*------------------------------------------------------------------------- - * Function: H5C__flush_ring - * - * Purpose: Flush the entries contained in the specified cache and - * ring. All entries in rings outside the specified ring - * must have been flushed on entry. - * - * If the cache contains protected entries in the specified - * ring, the function will fail, as protected entries cannot - * be flushed. However all unprotected entries in the target - * ring should be flushed before the function returns failure. - * - * If flush dependencies appear in the target ring, the - * function makes repeated passes through the slist flushing - * entries in flush dependency order. - * - * Return: Non-negative on success/Negative on failure or if there was - * a request to flush all items and something was protected. - * - * Programmer: John Mainzer - * 9/1/15 - * - *------------------------------------------------------------------------- - */ - static herr_t H5C__flush_ring(H5F_t * f, 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; - uint32_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; +/*------------------------------------------------------------------------- + * 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 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__flush_ring(H5F_t *f, 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; + uint32_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 - uint32_t initial_slist_len = 0; - size_t initial_slist_size = 0; + uint32_t initial_slist_len = 0; + size_t initial_slist_size = 0; #endif /* H5C_DO_SANITY_CHECKS */ - int i; - herr_t ret_value = SUCCEED; + int i; + herr_t ret_value = SUCCEED; - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC - 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); + 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") + 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") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - ignore_protected = ((flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0); - flush_marked_entries = ((flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0); + ignore_protected = ((flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0); + flush_marked_entries = ((flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0); - if (!flush_marked_entries) - for (i = (int)H5C_RING_UNDEFINED; i < (int)ring; i++) - HDassert(cache_ptr->slist_ring_len[i] == 0); + if (!flush_marked_entries) + for (i = (int)H5C_RING_UNDEFINED; i < (int)ring; i++) + HDassert(cache_ptr->slist_ring_len[i] == 0); - HDassert(cache_ptr->flush_in_progress); + 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; + /* 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_changed to false. - * - * This flag is set to TRUE by H5C__flush_single_entry if the - * slist is modified by a pre_serialize, serialize, or notify callback. - * H5C_flush_cache uses this flag 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_changed = FALSE; + /* Set the cache_ptr->slist_changed to false. + * + * This flag is set to TRUE by H5C__flush_single_entry if the + * slist is modified by a pre_serialize, serialize, or notify callback. + * H5C_flush_cache uses this flag 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_changed = FALSE; - while ((cache_ptr->slist_ring_len[ring] > 0) && (protected_entries == 0) && - (flushed_entries_last_pass)) { - flushed_entries_last_pass = FALSE; + while ((cache_ptr->slist_ring_len[ring] > 0) && (protected_entries == 0) && (flushed_entries_last_pass)) { + flushed_entries_last_pass = 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; - - /* 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; + /* 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; + + /* 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. - */ + /* 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; + restart_slist_scan = TRUE; - while ((restart_slist_scan) || (node_ptr != NULL)) { - if (restart_slist_scan) { - restart_slist_scan = FALSE; + 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); + /* 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; + 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); + /* 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); - } /* end if */ + 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); - if (!flush_marked_entries || entry_ptr->flush_marker) - HDassert(entry_ptr->ring >= ring); - - /* Advance 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 ?!?!") + 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); + if (!flush_marked_entries || entry_ptr->flush_marker) + HDassert(entry_ptr->ring >= ring); - HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(next_entry_ptr->is_dirty); - HDassert(next_entry_ptr->in_slist); + /* Advance 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 ?!?!") - if (!flush_marked_entries || next_entry_ptr->flush_marker) - HDassert(next_entry_ptr->ring >= ring); + 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); - } /* end if */ - else - next_entry_ptr = NULL; + if (!flush_marked_entries || next_entry_ptr->flush_marker) + HDassert(next_entry_ptr->ring >= ring); - 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 || - (flush_marked_entries && entry_ptr->flush_marker)))) && - (entry_ptr->flush_dep_nchildren == 0 || entry_ptr->flush_dep_ndirty_children == 0) && - entry_ptr->ring == ring) { + HDassert(entry_ptr != next_entry_ptr); + } /* end if */ + else + next_entry_ptr = NULL; - HDassert(entry_ptr->flush_dep_nunser_children == 0); + 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 || + (flush_marked_entries && entry_ptr->flush_marker)))) && + (entry_ptr->flush_dep_nchildren == 0 || entry_ptr->flush_dep_ndirty_children == 0) && + entry_ptr->ring == ring) { + + HDassert(entry_ptr->flush_dep_nunser_children == 0); + + 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 (H5C__flush_single_entry(f, entry_ptr, (flags | H5C__DURING_FLUSH_FLAG)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry") - if (entry_ptr->is_protected) { - /* we probably have major problems -- but lets - * flush everything we can before we decide - * whether to flag an error. + if (cache_ptr->slist_changed) { + /* 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. */ - tried_to_flush_protected_entry = TRUE; - protected_entries++; + restart_slist_scan = TRUE; + cache_ptr->slist_changed = FALSE; + H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) } /* end if */ - else { - if (H5C__flush_single_entry(f, entry_ptr, (flags | H5C__DURING_FLUSH_FLAG)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry") - - if (cache_ptr->slist_changed) { - /* 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_changed = FALSE; - H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) - } /* end if */ - flushed_entries_last_pass = TRUE; - } /* end else */ - } /* end if */ - } /* while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) */ + flushed_entries_last_pass = TRUE; + } /* end else */ + } /* end if */ + } /* while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) */ #if H5C_DO_SANITY_CHECKS - /* Verify that the slist size and length are as expected. */ - HDassert((uint32_t)((int32_t)initial_slist_len + cache_ptr->slist_len_increase) == - cache_ptr->slist_len); - HDassert((size_t)((ssize_t)initial_slist_size + cache_ptr->slist_size_increase) == - cache_ptr->slist_size); -#endif /* H5C_DO_SANITY_CHECKS */ - } /* while */ + /* Verify that the slist size and length are as expected. */ + HDassert((uint32_t)((int32_t)initial_slist_len + cache_ptr->slist_len_increase) == + cache_ptr->slist_len); + HDassert((size_t)((ssize_t)initial_slist_size + cache_ptr->slist_size_increase) == + cache_ptr->slist_size); +#endif /* H5C_DO_SANITY_CHECKS */ + } /* while */ - HDassert(protected_entries <= cache_ptr->pl_len); + 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->pl_len > 0) && (!ignore_protected)) || (tried_to_flush_protected_entry)) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "cache has protected items") #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 */ + 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() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__flush_ring() */ - /*------------------------------------------------------------------------- - * - * Function: H5C__flush_single_entry - * - * Purpose: Flush or clear (and evict if requested) the cache entry - * with the specified address and type. If the type is NULL, - * any unprotected entry at the specified address will be - * flushed (and possibly evicted). - * - * Attempts to flush a protected entry will result in an - * error. - * - * If the H5C__FLUSH_INVALIDATE_FLAG flag is set, the entry will - * be cleared and not flushed, and the call can't be part of a - * sequence of flushes. - * - * If the caller knows the address of the skip list node at - * which the target entry resides, it can avoid a lookup - * by supplying that address in the tgt_node_ptr parameter. - * If this parameter is NULL, the function will do a skip list - * search for the entry instead. - * - * The function does nothing silently if there is no entry - * at the supplied address, or if the entry found has the - * wrong type. - * - * Return: Non-negative on success/Negative on failure or if there was - * an attempt to flush a protected item. - * - * Programmer: John Mainzer, 5/5/04 - * - *------------------------------------------------------------------------- +/*------------------------------------------------------------------------- + * + * Function: H5C__flush_single_entry + * + * Purpose: Flush or clear (and evict if requested) the cache entry + * with the specified address and type. If the type is NULL, + * any unprotected entry at the specified address will be + * flushed (and possibly evicted). + * + * Attempts to flush a protected entry will result in an + * error. + * + * If the H5C__FLUSH_INVALIDATE_FLAG flag is set, the entry will + * be cleared and not flushed, and the call can't be part of a + * sequence of flushes. + * + * If the caller knows the address of the skip list node at + * which the target entry resides, it can avoid a lookup + * by supplying that address in the tgt_node_ptr parameter. + * If this parameter is NULL, the function will do a skip list + * search for the entry instead. + * + * The function does nothing silently if there is no entry + * at the supplied address, or if the entry found has the + * wrong type. + * + * Return: Non-negative on success/Negative on failure or if there was + * an attempt to flush a protected item. + * + * Programmer: John Mainzer, 5/5/04 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) +{ + H5C_t * cache_ptr; /* Cache for file */ + hbool_t destroy; /* external flag */ + hbool_t clear_only; /* external flag */ + hbool_t free_file_space; /* external flag */ + hbool_t take_ownership; /* external flag */ + hbool_t del_from_slist_on_destroy; /* external flag */ + hbool_t during_flush; /* external flag */ + hbool_t write_entry; /* internal flag */ + hbool_t destroy_entry; /* internal flag */ + hbool_t generate_image; /* internal flag */ + hbool_t update_page_buffer; /* internal flag */ + hbool_t was_dirty; + hbool_t suppress_image_entry_writes = FALSE; + hbool_t suppress_image_entry_frees = FALSE; + haddr_t entry_addr = HADDR_UNDEF; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + HDassert(f); + cache_ptr = f->shared->cache; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(entry_ptr); + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->ring != H5C_RING_UNDEFINED); + HDassert(entry_ptr->type); + + /* setup external flags from the flags parameter */ + destroy = ((flags & H5C__FLUSH_INVALIDATE_FLAG) != 0); + clear_only = ((flags & H5C__FLUSH_CLEAR_ONLY_FLAG) != 0); + free_file_space = ((flags & H5C__FREE_FILE_SPACE_FLAG) != 0); + take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0); + del_from_slist_on_destroy = ((flags & H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) != 0); + during_flush = ((flags & H5C__DURING_FLUSH_FLAG) != 0); + generate_image = ((flags & H5C__GENERATE_IMAGE_FLAG) != 0); + update_page_buffer = ((flags & H5C__UPDATE_PAGE_BUFFER_FLAG) != 0); + + /* Set the flag for destroying the entry, based on the 'take ownership' + * and 'destroy' flags */ - herr_t H5C__flush_single_entry(H5F_t * f, H5C_cache_entry_t * entry_ptr, unsigned flags) - { - H5C_t * cache_ptr; /* Cache for file */ - hbool_t destroy; /* external flag */ - hbool_t clear_only; /* external flag */ - hbool_t free_file_space; /* external flag */ - hbool_t take_ownership; /* external flag */ - hbool_t del_from_slist_on_destroy; /* external flag */ - hbool_t during_flush; /* external flag */ - hbool_t write_entry; /* internal flag */ - hbool_t destroy_entry; /* internal flag */ - hbool_t generate_image; /* internal flag */ - hbool_t update_page_buffer; /* internal flag */ - hbool_t was_dirty; - hbool_t suppress_image_entry_writes = FALSE; - hbool_t suppress_image_entry_frees = FALSE; - haddr_t entry_addr = HADDR_UNDEF; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - HDassert(f); - cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(entry_ptr); - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->ring != H5C_RING_UNDEFINED); - HDassert(entry_ptr->type); - - /* setup external flags from the flags parameter */ - destroy = ((flags & H5C__FLUSH_INVALIDATE_FLAG) != 0); - clear_only = ((flags & H5C__FLUSH_CLEAR_ONLY_FLAG) != 0); - free_file_space = ((flags & H5C__FREE_FILE_SPACE_FLAG) != 0); - take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0); - del_from_slist_on_destroy = ((flags & H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) != 0); - during_flush = ((flags & H5C__DURING_FLUSH_FLAG) != 0); - generate_image = ((flags & H5C__GENERATE_IMAGE_FLAG) != 0); - update_page_buffer = ((flags & H5C__UPDATE_PAGE_BUFFER_FLAG) != 0); - - /* Set the flag for destroying the entry, based on the 'take ownership' - * and 'destroy' flags - */ - if (take_ownership) - destroy_entry = FALSE; - else - destroy_entry = destroy; + if (take_ownership) + destroy_entry = FALSE; + else + destroy_entry = destroy; - /* we will write the entry to disk if it exists, is dirty, and if the - * clear only flag is not set. - */ - if (entry_ptr->is_dirty && !clear_only) - write_entry = TRUE; - else - write_entry = FALSE; + /* we will write the entry to disk if it exists, is dirty, and if the + * clear only flag is not set. + */ + if (entry_ptr->is_dirty && !clear_only) + write_entry = TRUE; + else + write_entry = FALSE; - /* if we have received close warning, and we have been instructed to - * generate a metadata cache image, and we have actually constructed - * the entry images, set suppress_image_entry_frees to TRUE. - * - * Set suppress_image_entry_writes to TRUE if indicated by the - * image_ctl flags. - */ - if (cache_ptr->close_warning_received && cache_ptr->image_ctl.generate_image && - cache_ptr->num_entries_in_image > 0 && cache_ptr->image_entries) { - /* Sanity checks */ - HDassert(entry_ptr->image_up_to_date || !(entry_ptr->include_in_image)); - HDassert(entry_ptr->image_ptr || !(entry_ptr->include_in_image)); - HDassert((!clear_only) || !(entry_ptr->include_in_image)); - HDassert((!take_ownership) || !(entry_ptr->include_in_image)); - HDassert((!free_file_space) || !(entry_ptr->include_in_image)); + /* if we have received close warning, and we have been instructed to + * generate a metadata cache image, and we have actually constructed + * the entry images, set suppress_image_entry_frees to TRUE. + * + * Set suppress_image_entry_writes to TRUE if indicated by the + * image_ctl flags. + */ + if (cache_ptr->close_warning_received && cache_ptr->image_ctl.generate_image && + cache_ptr->num_entries_in_image > 0 && cache_ptr->image_entries) { + /* Sanity checks */ + HDassert(entry_ptr->image_up_to_date || !(entry_ptr->include_in_image)); + HDassert(entry_ptr->image_ptr || !(entry_ptr->include_in_image)); + HDassert((!clear_only) || !(entry_ptr->include_in_image)); + HDassert((!take_ownership) || !(entry_ptr->include_in_image)); + HDassert((!free_file_space) || !(entry_ptr->include_in_image)); - suppress_image_entry_frees = TRUE; + suppress_image_entry_frees = TRUE; - if (cache_ptr->image_ctl.flags & H5C_CI__SUPRESS_ENTRY_WRITES) - suppress_image_entry_writes = TRUE; - } /* end if */ + if (cache_ptr->image_ctl.flags & H5C_CI__SUPRESS_ENTRY_WRITES) + suppress_image_entry_writes = TRUE; + } /* end if */ - /* run initial sanity checks */ + /* run initial sanity checks */ #if H5C_DO_SANITY_CHECKS - if (entry_ptr->in_slist) { - HDassert(entry_ptr->is_dirty); + if (entry_ptr->in_slist) { + HDassert(entry_ptr->is_dirty); - if ((entry_ptr->flush_marker) && (!entry_ptr->is_dirty)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry in slist failed sanity checks") - } /* end if */ - else { - HDassert(!entry_ptr->is_dirty); - HDassert(!entry_ptr->flush_marker); + if ((entry_ptr->flush_marker) && (!entry_ptr->is_dirty)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry in slist failed sanity checks") + } /* end if */ + else { + HDassert(!entry_ptr->is_dirty); + HDassert(!entry_ptr->flush_marker); - if ((entry_ptr->is_dirty) || (entry_ptr->flush_marker)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry failed sanity checks") - } /* end else */ -#endif /* H5C_DO_SANITY_CHECKS */ + if ((entry_ptr->is_dirty) || (entry_ptr->flush_marker)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry failed sanity checks") + } /* end else */ +#endif /* H5C_DO_SANITY_CHECKS */ - if (entry_ptr->is_protected) { - HDassert(!entry_ptr->is_protected); + if (entry_ptr->is_protected) { + HDassert(!entry_ptr->is_protected); - /* Attempt to flush a protected entry -- scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_PROTECT, FAIL, "Attempt to flush a protected entry") - } /* end if */ + /* Attempt to flush a protected entry -- scream and die. */ + HGOTO_ERROR(H5E_CACHE, H5E_PROTECT, FAIL, "Attempt to flush a protected entry") + } /* end if */ - /* Set entry_ptr->flush_in_progress = TRUE and set - * entry_ptr->flush_marker = FALSE - * - * We will set flush_in_progress back to FALSE at the end if the - * entry still exists at that point. - */ - entry_ptr->flush_in_progress = TRUE; - entry_ptr->flush_marker = FALSE; + /* Set entry_ptr->flush_in_progress = TRUE and set + * entry_ptr->flush_marker = FALSE + * + * We will set flush_in_progress back to FALSE at the end if the + * entry still exists at that point. + */ + entry_ptr->flush_in_progress = TRUE; + entry_ptr->flush_marker = FALSE; - /* Preserve current dirty state for later */ - was_dirty = entry_ptr->is_dirty; + /* Preserve current dirty state for later */ + was_dirty = entry_ptr->is_dirty; - /* The entry is dirty, and we are doing a flush, a flush destroy or have - * been requested to generate an image. In those cases, serialize the - * entry. - */ - if (write_entry || generate_image) { - HDassert(entry_ptr->is_dirty); + /* The entry is dirty, and we are doing a flush, a flush destroy or have + * been requested to generate an image. In those cases, serialize the + * entry. + */ + if (write_entry || generate_image) { + HDassert(entry_ptr->is_dirty); - if (NULL == entry_ptr->image_ptr) { - if (NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, - "memory allocation failed for on disk image buffer") + if (NULL == entry_ptr->image_ptr) { + if (NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, + "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS - H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, - H5C_IMAGE_EXTRA_SPACE); -#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - } /* end if */ + H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, + H5C_IMAGE_EXTRA_SPACE); +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + } /* end if */ - if (!(entry_ptr->image_up_to_date)) { - /* Sanity check */ - HDassert(!entry_ptr->prefetched); + if (!(entry_ptr->image_up_to_date)) { + /* Sanity check */ + HDassert(!entry_ptr->prefetched); - /* Generate the entry's image */ - if (H5C__generate_image(f, cache_ptr, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't generate entry's image") - } /* end if ( ! (entry_ptr->image_up_to_date) ) */ - } /* end if */ + /* Generate the entry's image */ + if (H5C__generate_image(f, cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't generate entry's image") + } /* end if ( ! (entry_ptr->image_up_to_date) ) */ + } /* end if */ - /* Finally, write the image to disk. - * - * Note that if the H5AC__CLASS_SKIP_WRITES flag is set in the - * in the entry's type, we silently skip the write. This - * flag should only be used in test code. - */ - if (write_entry) { - HDassert(entry_ptr->is_dirty); + /* Finally, write the image to disk. + * + * Note that if the H5AC__CLASS_SKIP_WRITES flag is set in the + * in the entry's type, we silently skip the write. This + * flag should only be used in test code. + */ + if (write_entry) { + HDassert(entry_ptr->is_dirty); #if H5C_DO_SANITY_CHECKS - if (cache_ptr->check_write_permitted && !(cache_ptr->write_permitted)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Write when writes are always forbidden!?!?!") + if (cache_ptr->check_write_permitted && !(cache_ptr->write_permitted)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Write when writes are always forbidden!?!?!") #endif /* H5C_DO_SANITY_CHECKS */ - /* Write the image to disk unless the write is suppressed. - * - * This happens if both suppress_image_entry_writes and - * entry_ptr->include_in_image are TRUE, or if the - * H5AC__CLASS_SKIP_WRITES is set in the entry's type. This - * flag should only be used in test code - */ - if ((!suppress_image_entry_writes || !entry_ptr->include_in_image) && - (((entry_ptr->type->flags) & H5C__CLASS_SKIP_WRITES) == 0)) { - H5FD_mem_t mem_type = H5FD_MEM_DEFAULT; + /* Write the image to disk unless the write is suppressed. + * + * This happens if both suppress_image_entry_writes and + * entry_ptr->include_in_image are TRUE, or if the + * H5AC__CLASS_SKIP_WRITES is set in the entry's type. This + * flag should only be used in test code + */ + if ((!suppress_image_entry_writes || !entry_ptr->include_in_image) && + (((entry_ptr->type->flags) & H5C__CLASS_SKIP_WRITES) == 0)) { + H5FD_mem_t mem_type = H5FD_MEM_DEFAULT; #ifdef H5_HAVE_PARALLEL - if (cache_ptr->coll_write_list) { - if (H5SL_insert(cache_ptr->coll_write_list, entry_ptr, &entry_ptr->addr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "unable to insert skip list item") - } /* end if */ - else { + if (cache_ptr->coll_write_list) { + if (H5SL_insert(cache_ptr->coll_write_list, entry_ptr, &entry_ptr->addr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "unable to insert skip list item") + } /* end if */ + else { #endif /* H5_HAVE_PARALLEL */ - if (entry_ptr->prefetched) { - HDassert(entry_ptr->type->id == H5AC_PREFETCHED_ENTRY_ID); - mem_type = cache_ptr->class_table_ptr[entry_ptr->prefetch_type_id]->mem_type; - } /* end if */ - else - mem_type = entry_ptr->type->mem_type; + if (entry_ptr->prefetched) { + HDassert(entry_ptr->type->id == H5AC_PREFETCHED_ENTRY_ID); + mem_type = cache_ptr->class_table_ptr[entry_ptr->prefetch_type_id]->mem_type; + } /* end if */ + else + mem_type = entry_ptr->type->mem_type; - if (H5F_block_write(f, mem_type, entry_ptr->addr, entry_ptr->size, entry_ptr->image_ptr) < - 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write image to file") + if (H5F_block_write(f, mem_type, entry_ptr->addr, entry_ptr->size, entry_ptr->image_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write image to file") #ifdef H5_HAVE_PARALLEL - } -#endif /* H5_HAVE_PARALLEL */ - } /* end if */ + } +#endif /* H5_HAVE_PARALLEL */ + } /* end if */ - /* if the entry has a notify callback, notify it that we have - * just flushed the entry. - */ - if (entry_ptr->type->notify && - (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_FLUSH, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client of entry flush") - } /* if ( write_entry ) */ + /* if the entry has a notify callback, notify it that we have + * just flushed the entry. + */ + if (entry_ptr->type->notify && + (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_FLUSH, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client of entry flush") + } /* if ( write_entry ) */ + + /* At this point, all pre-serialize and serialize calls have been + * made if it was appropriate to make them. Similarly, the entry + * has been written to disk if desired. + * + * Thus it is now safe to update the cache data structures for the + * flush. + */ + + /* start by updating the statistics */ + if (clear_only) { + /* only log a clear if the entry was dirty */ + if (was_dirty) { + H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) + } /* end if */ + } + else if (write_entry) { + HDassert(was_dirty); + + /* only log a flush if we actually wrote to disk */ + H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) + } /* end else if */ + + /* Note that the algorithm below is (very) similar to the set of operations + * in H5C_remove_entry() and should be kept in sync with changes + * to that code. - QAK, 2016/11/30 + */ + + /* Update the cache internal data structures. */ + if (destroy) { + /* Sanity checks */ + if (take_ownership) + HDassert(!destroy_entry); + else + HDassert(destroy_entry); + HDassert(!entry_ptr->is_pinned); + + /* Update stats, while entry is still in the cache */ + H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr, take_ownership) + + /* If the entry's type has a 'notify' callback and the entry is about + * to be removed from the cache, send a 'before eviction' notice while + * the entry is still fully integrated in the cache. + */ + if (entry_ptr->type->notify && + (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_BEFORE_EVICT, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry to evict") - /* At this point, all pre-serialize and serialize calls have been - * made if it was appropriate to make them. Similarly, the entry - * has been written to disk if desired. + /* Update the cache internal data structures as appropriate + * for a destroy. Specifically: + * + * 1) Delete it from the index + * + * 2) Delete it from the skip list if requested. + * + * 3) Delete it from the collective read access list. * - * Thus it is now safe to update the cache data structures for the - * flush. + * 4) Update the replacement policy for eviction + * + * 5) Remove it from the tag list for this object + * + * Finally, if the destroy_entry flag is set, discard the + * entry. */ + H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL) - /* start by updating the statistics */ - if (clear_only) { - /* only log a clear if the entry was dirty */ - if (was_dirty) { - H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) - } /* end if */ - } - else if (write_entry) { - HDassert(was_dirty); + if (entry_ptr->in_slist && del_from_slist_on_destroy) + H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush) - /* only log a flush if we actually wrote to disk */ - H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) - } /* end else if */ +#ifdef H5_HAVE_PARALLEL + /* Check for collective read access flag */ + if (entry_ptr->coll_access) { + entry_ptr->coll_access = FALSE; + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ + + H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, FAIL) + + /* Remove entry from tag list */ + if (H5C__untag_entry(cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry from tag list") + + /* verify that the entry is no longer part of any flush dependencies */ + HDassert(entry_ptr->flush_dep_nparents == 0); + HDassert(entry_ptr->flush_dep_nchildren == 0); + } /* end if */ + else { + HDassert(clear_only || write_entry); + HDassert(entry_ptr->is_dirty); + HDassert(entry_ptr->in_slist); - /* Note that the algorithm below is (very) similar to the set of operations - * in H5C_remove_entry() and should be kept in sync with changes - * to that code. - QAK, 2016/11/30 + /* We are either doing a flush or a clear. + * + * A clear and a flush are the same from the point of + * view of the replacement policy and the slist. + * Hence no differentiation between them. + * + * JRM -- 7/7/07 */ - /* Update the cache internal data structures. */ - if (destroy) { - /* Sanity checks */ - if (take_ownership) - HDassert(!destroy_entry); - else - HDassert(destroy_entry); - HDassert(!entry_ptr->is_pinned); + H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, FAIL) + + H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush) - /* Update stats, while entry is still in the cache */ - H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr, take_ownership) + /* mark the entry as clean and update the index for + * entry clean. Also, call the clear callback + * if defined. + */ + entry_ptr->is_dirty = FALSE; - /* If the entry's type has a 'notify' callback and the entry is about - * to be removed from the cache, send a 'before eviction' notice while - * the entry is still fully integrated in the cache. + H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr); + + /* Check for entry changing status and do notifications, etc. */ + if (was_dirty) { + /* If the entry's type has a 'notify' callback send a 'entry cleaned' + * notice now that the entry is fully integrated into the cache. */ if (entry_ptr->type->notify && - (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_BEFORE_EVICT, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry to evict") + (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify client about entry dirty flag cleared") - /* Update the cache internal data structures as appropriate - * for a destroy. Specifically: - * - * 1) Delete it from the index - * - * 2) Delete it from the skip list if requested. - * - * 3) Delete it from the collective read access list. - * - * 4) Update the replacement policy for eviction - * - * 5) Remove it from the tag list for this object - * - * Finally, if the destroy_entry flag is set, discard the - * entry. - */ - H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL) + /* Propagate the clean flag up the flush dependency chain if appropriate */ + if (entry_ptr->flush_dep_ndirty_children != 0) + HDassert(entry_ptr->flush_dep_ndirty_children == 0); + if (entry_ptr->flush_dep_nparents > 0) + if (H5C__mark_flush_dep_clean(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "Can't propagate flush dep clean flag") + } /* end if */ + } /* end else */ - if (entry_ptr->in_slist && del_from_slist_on_destroy) - H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush) + /* reset the flush_in progress flag */ + entry_ptr->flush_in_progress = FALSE; -#ifdef H5_HAVE_PARALLEL - /* Check for collective read access flag */ - if (entry_ptr->coll_access) { - entry_ptr->coll_access = FALSE; - H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ + /* capture the cache entry address for the log_flush call at the + end before the entry_ptr gets freed */ + entry_addr = entry_ptr->addr; - H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, FAIL) + /* Internal cache data structures should now be up to date, and + * consistent with the status of the entry. + * + * Now discard the entry if appropriate. + */ + if (destroy) { + /* Sanity check */ + HDassert(0 == entry_ptr->flush_dep_nparents); - /* Remove entry from tag list */ - if (H5C__untag_entry(cache_ptr, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry from tag list") + /* if both suppress_image_entry_frees and entry_ptr->include_in_image + * are true, simply set entry_ptr->image_ptr to NULL, as we have + * another pointer to the buffer in an instance of H5C_image_entry_t + * in cache_ptr->image_entries. + * + * Otherwise, free the buffer if it exists. + */ + if (suppress_image_entry_frees && entry_ptr->include_in_image) + entry_ptr->image_ptr = NULL; + else if (entry_ptr->image_ptr != NULL) + entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); - /* verify that the entry is no longer part of any flush dependencies */ - HDassert(entry_ptr->flush_dep_nparents == 0); - HDassert(entry_ptr->flush_dep_nchildren == 0); + /* If the entry is not a prefetched entry, verify that the flush + * dependency parents addresses array has been transferred. + * + * If the entry is prefetched, the free_isr routine will dispose of + * the flush dependency parents addresses array if necessary. + */ + if (!entry_ptr->prefetched) { + HDassert(0 == entry_ptr->fd_parent_count); + HDassert(NULL == entry_ptr->fd_parent_addrs); } /* end if */ - else { - HDassert(clear_only || write_entry); - HDassert(entry_ptr->is_dirty); - HDassert(entry_ptr->in_slist); - /* We are either doing a flush or a clear. - * - * A clear and a flush are the same from the point of - * view of the replacement policy and the slist. - * Hence no differentiation between them. - * - * JRM -- 7/7/07 - */ + /* Check whether we should free the space in the file that + * the entry occupies + */ + if (free_file_space) { + hsize_t fsf_size; - H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, FAIL) + /* Sanity checks */ + HDassert(H5F_addr_defined(entry_ptr->addr)); + HDassert(!H5F_IS_TMP_ADDR(f, entry_ptr->addr)); +#ifndef NDEBUG + { + size_t curr_len; - H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush) + /* Get the actual image size for the thing again */ + entry_ptr->type->image_len((void *)entry_ptr, &curr_len); + HDassert(curr_len == entry_ptr->size); + } +#endif /* NDEBUG */ - /* mark the entry as clean and update the index for - * entry clean. Also, call the clear callback - * if defined. + /* If the file space free size callback is defined, use + * it to get the size of the block of file space to free. + * Otherwise use entry_ptr->size. */ - entry_ptr->is_dirty = FALSE; - - H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr); + if (entry_ptr->type->fsf_size) { + if ((entry_ptr->type->fsf_size)((void *)entry_ptr, &fsf_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to get file space free size") + } /* end if */ + else /* no file space free size callback -- use entry size */ + fsf_size = entry_ptr->size; + + /* Release the space on disk */ + if (H5MF_xfree(f, entry_ptr->type->mem_type, entry_ptr->addr, fsf_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to free file space for cache entry") + } /* end if ( free_file_space ) */ + + /* Reset the pointer to the cache the entry is within. -QAK */ + entry_ptr->cache_ptr = NULL; + + /* increment entries_removed_counter and set + * last_entry_removed_ptr. As we are likely abuut to + * free the entry, recall that last_entry_removed_ptr + * must NEVER be dereferenced. + * + * Recall that these fields are maintained to allow functions + * that perform scans of lists of entries to detect the + * unexpected removal of entries (via expunge, eviction, + * or take ownership at present), so that they can re-start + * their scans if necessary. + * + * Also check if the entry we are watching for removal is being + * removed (usually the 'next' entry for an iteration) and reset + * it to indicate that it was removed. + */ + cache_ptr->entries_removed_counter++; + cache_ptr->last_entry_removed_ptr = entry_ptr; + if (entry_ptr == cache_ptr->entry_watched_for_removal) + cache_ptr->entry_watched_for_removal = NULL; + + /* Check for actually destroying the entry in memory */ + /* (As opposed to taking ownership of it) */ + if (destroy_entry) { + if (entry_ptr->is_dirty) { + /* Reset dirty flag */ + entry_ptr->is_dirty = FALSE; - /* Check for entry changing status and do notifications, etc. */ - if (was_dirty) { /* If the entry's type has a 'notify' callback send a 'entry cleaned' * notice now that the entry is fully integrated into the cache. */ @@ -6018,885 +6200,761 @@ done: (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag cleared") - - /* Propagate the clean flag up the flush dependency chain if appropriate */ - if (entry_ptr->flush_dep_ndirty_children != 0) - HDassert(entry_ptr->flush_dep_ndirty_children == 0); - if (entry_ptr->flush_dep_nparents > 0) - if (H5C__mark_flush_dep_clean(entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, - "Can't propagate flush dep clean flag") - } /* end if */ - } /* end else */ - - /* reset the flush_in progress flag */ - entry_ptr->flush_in_progress = FALSE; - - /* capture the cache entry address for the log_flush call at the - end before the entry_ptr gets freed */ - entry_addr = entry_ptr->addr; - - /* Internal cache data structures should now be up to date, and - * consistent with the status of the entry. - * - * Now discard the entry if appropriate. - */ - if (destroy) { - /* Sanity check */ - HDassert(0 == entry_ptr->flush_dep_nparents); - - /* if both suppress_image_entry_frees and entry_ptr->include_in_image - * are true, simply set entry_ptr->image_ptr to NULL, as we have - * another pointer to the buffer in an instance of H5C_image_entry_t - * in cache_ptr->image_entries. - * - * Otherwise, free the buffer if it exists. - */ - if (suppress_image_entry_frees && entry_ptr->include_in_image) - entry_ptr->image_ptr = NULL; - else if (entry_ptr->image_ptr != NULL) - entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); - - /* If the entry is not a prefetched entry, verify that the flush - * dependency parents addresses array has been transferred. - * - * If the entry is prefetched, the free_isr routine will dispose of - * the flush dependency parents addresses array if necessary. - */ - if (!entry_ptr->prefetched) { - HDassert(0 == entry_ptr->fd_parent_count); - HDassert(NULL == entry_ptr->fd_parent_addrs); } /* end if */ - /* Check whether we should free the space in the file that - * the entry occupies + /* we are about to discard the in core representation -- + * set the magic field to bad magic so we can detect a + * freed entry if we see one. */ - if (free_file_space) { - hsize_t fsf_size; + entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC; - /* Sanity checks */ - HDassert(H5F_addr_defined(entry_ptr->addr)); - HDassert(!H5F_IS_TMP_ADDR(f, entry_ptr->addr)); -#ifndef NDEBUG - { - size_t curr_len; + /* verify that the image has been freed */ + HDassert(entry_ptr->image_ptr == NULL); - /* Get the actual image size for the thing again */ - entry_ptr->type->image_len((void *)entry_ptr, &curr_len); - HDassert(curr_len == entry_ptr->size); - } -#endif /* NDEBUG */ + if (entry_ptr->type->free_icr((void *)entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "free_icr callback failed") + } /* end if */ + else { + HDassert(take_ownership); - /* If the file space free size callback is defined, use - * it to get the size of the block of file space to free. - * Otherwise use entry_ptr->size. - */ - if (entry_ptr->type->fsf_size) { - if ((entry_ptr->type->fsf_size)((void *)entry_ptr, &fsf_size) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to get file space free size") - } /* end if */ - else /* no file space free size callback -- use entry size */ - fsf_size = entry_ptr->size; - - /* Release the space on disk */ - if (H5MF_xfree(f, entry_ptr->type->mem_type, entry_ptr->addr, fsf_size) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to free file space for cache entry") - } /* end if ( free_file_space ) */ - - /* Reset the pointer to the cache the entry is within. -QAK */ - entry_ptr->cache_ptr = NULL; - - /* increment entries_removed_counter and set - * last_entry_removed_ptr. As we are likely abuut to - * free the entry, recall that last_entry_removed_ptr - * must NEVER be dereferenced. - * - * Recall that these fields are maintained to allow functions - * that perform scans of lists of entries to detect the - * unexpected removal of entries (via expunge, eviction, - * or take ownership at present), so that they can re-start - * their scans if necessary. - * - * Also check if the entry we are watching for removal is being - * removed (usually the 'next' entry for an iteration) and reset - * it to indicate that it was removed. + /* client is taking ownership of the entry. + * set bad magic here too so the cache will choke + * unless the entry is re-inserted properly */ - cache_ptr->entries_removed_counter++; - cache_ptr->last_entry_removed_ptr = entry_ptr; - if (entry_ptr == cache_ptr->entry_watched_for_removal) - cache_ptr->entry_watched_for_removal = NULL; - - /* Check for actually destroying the entry in memory */ - /* (As opposed to taking ownership of it) */ - if (destroy_entry) { - if (entry_ptr->is_dirty) { - /* Reset dirty flag */ - entry_ptr->is_dirty = FALSE; + entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC; + } /* end else */ + } /* if (destroy) */ - /* If the entry's type has a 'notify' callback send a 'entry cleaned' - * notice now that the entry is fully integrated into the cache. - */ - if (entry_ptr->type->notify && - (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify client about entry dirty flag cleared") - } /* end if */ + /* Check if we have to update the page buffer with cleared entries + * so it doesn't go out of date + */ + if (update_page_buffer) { + /* Sanity check */ + HDassert(!destroy); + HDassert(entry_ptr->image_ptr); - /* we are about to discard the in core representation -- - * set the magic field to bad magic so we can detect a - * freed entry if we see one. - */ - entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC; + if (f->shared->page_buf && f->shared->page_buf->page_size >= entry_ptr->size) + if (H5PB_update_entry(f->shared->page_buf, entry_ptr->addr, entry_ptr->size, + entry_ptr->image_ptr) > 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Failed to update PB with metadata cache") + } /* end if */ - /* verify that the image has been freed */ - HDassert(entry_ptr->image_ptr == NULL); + if (cache_ptr->log_flush) + if ((cache_ptr->log_flush)(cache_ptr, entry_addr, was_dirty, flags) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "log_flush callback failed") - if (entry_ptr->type->free_icr((void *)entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "free_icr callback failed") - } /* end if */ - else { - HDassert(take_ownership); +done: + HDassert((ret_value != SUCCEED) || (destroy_entry) || (!entry_ptr->flush_in_progress)); + HDassert((ret_value != SUCCEED) || (destroy_entry) || (take_ownership) || (!entry_ptr->is_dirty)); - /* client is taking ownership of the entry. - * set bad magic here too so the cache will choke - * unless the entry is re-inserted properly - */ - entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC; - } /* end else */ - } /* if (destroy) */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__flush_single_entry() */ - /* Check if we have to update the page buffer with cleared entries - * so it doesn't go out of date - */ - if (update_page_buffer) { - /* Sanity check */ - HDassert(!destroy); - HDassert(entry_ptr->image_ptr); - - if (f->shared->page_buf && f->shared->page_buf->page_size >= entry_ptr->size) - if (H5PB_update_entry(f->shared->page_buf, entry_ptr->addr, entry_ptr->size, - entry_ptr->image_ptr) > 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Failed to update PB with metadata cache") - } /* end if */ - - if (cache_ptr->log_flush) - if ((cache_ptr->log_flush)(cache_ptr, entry_addr, was_dirty, flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "log_flush callback failed") - -done: - HDassert((ret_value != SUCCEED) || (destroy_entry) || (!entry_ptr->flush_in_progress)); - HDassert((ret_value != SUCCEED) || (destroy_entry) || (take_ownership) || (!entry_ptr->is_dirty)); +/*------------------------------------------------------------------------- + * + * Function: H5C__verify_len_eoa + * + * Purpose: Verify that 'len' does not exceed eoa when 'actual' is + * false i.e. 'len" is the initial speculative length from + * get_load_size callback with null image pointer. + * If exceed, adjust 'len' accordingly. + * + * Verify that 'len' should not exceed eoa when 'actual' is + * true i.e. 'len' is the actual length from get_load_size + * callback with non-null image pointer. + * If exceed, return error. + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + * Programmer: Vailin Choi + * 9/6/15 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__verify_len_eoa(H5F_t *f, const H5C_class_t *type, haddr_t addr, size_t *len, hbool_t actual) +{ + H5FD_mem_t cooked_type; /* Modified type, accounting for switching global heaps */ + haddr_t eoa; /* End-of-allocation in the file */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__flush_single_entry() */ + FUNC_ENTER_STATIC - /*------------------------------------------------------------------------- - * - * Function: H5C__verify_len_eoa - * - * Purpose: Verify that 'len' does not exceed eoa when 'actual' is - * false i.e. 'len" is the initial speculative length from - * get_load_size callback with null image pointer. - * If exceed, adjust 'len' accordingly. - * - * Verify that 'len' should not exceed eoa when 'actual' is - * true i.e. 'len' is the actual length from get_load_size - * callback with non-null image pointer. - * If exceed, return error. - * - * Return: FAIL if error is detected, SUCCEED otherwise. - * - * Programmer: Vailin Choi - * 9/6/15 - * - *------------------------------------------------------------------------- + /* if type == H5FD_MEM_GHEAP, H5F_block_read() forces + * type to H5FD_MEM_DRAW via its call to H5F__accum_read(). + * Thus we do the same for purposes of computing the EOA + * for sanity checks. */ - static herr_t H5C__verify_len_eoa(H5F_t * f, const H5C_class_t *type, haddr_t addr, size_t *len, - hbool_t actual) - { - H5FD_mem_t cooked_type; /* Modified type, accounting for switching global heaps */ - haddr_t eoa; /* End-of-allocation in the file */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC + cooked_type = (type->mem_type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type->mem_type; - /* if type == H5FD_MEM_GHEAP, H5F_block_read() forces - * type to H5FD_MEM_DRAW via its call to H5F__accum_read(). - * Thus we do the same for purposes of computing the EOA - * for sanity checks. - */ - cooked_type = (type->mem_type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type->mem_type; - - /* Get the file's end-of-allocation value */ - eoa = H5F_get_eoa(f, cooked_type); - if (!H5F_addr_defined(eoa)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid EOA address for file") + /* Get the file's end-of-allocation value */ + eoa = H5F_get_eoa(f, cooked_type); + if (!H5F_addr_defined(eoa)) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid EOA address for file") - /* Check for bad address in general */ - if (H5F_addr_gt(addr, eoa)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "address of object past end of allocation") + /* Check for bad address in general */ + if (H5F_addr_gt(addr, eoa)) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "address of object past end of allocation") - /* Check if the amount of data to read will be past the EOA */ - if (H5F_addr_gt((addr + *len), eoa)) { - if (actual) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "actual len exceeds EOA") - else - /* Trim down the length of the metadata */ - *len = (size_t)(eoa - addr); - } /* end if */ + /* Check if the amount of data to read will be past the EOA */ + if (H5F_addr_gt((addr + *len), eoa)) { + if (actual) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "actual len exceeds EOA") + else + /* Trim down the length of the metadata */ + *len = (size_t)(eoa - addr); + } /* end if */ - if (*len <= 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "len not positive after adjustment for EOA") + if (*len <= 0) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "len not positive after adjustment for EOA") done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__verify_len_eoa() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__verify_len_eoa() */ - /*------------------------------------------------------------------------- - * - * Function: H5C__load_entry - * - * Purpose: Attempt to load the entry at the specified disk address - * and with the specified type into memory. If successful. - * return the in memory address of the entry. Return NULL - * on failure. - * - * Note that this function simply loads the entry into - * core. It does not insert it into the cache. - * - * Return: Non-NULL on success / NULL on failure. - * - * Programmer: John Mainzer, 5/18/04 - * - *------------------------------------------------------------------------- - */ - static void *H5C__load_entry(H5F_t * f, +/*------------------------------------------------------------------------- + * + * Function: H5C__load_entry + * + * Purpose: Attempt to load the entry at the specified disk address + * and with the specified type into memory. If successful. + * return the in memory address of the entry. Return NULL + * on failure. + * + * Note that this function simply loads the entry into + * core. It does not insert it into the cache. + * + * Return: Non-NULL on success / NULL on failure. + * + * Programmer: John Mainzer, 5/18/04 + * + *------------------------------------------------------------------------- + */ +static void * +H5C__load_entry(H5F_t *f, #ifdef H5_HAVE_PARALLEL - hbool_t coll_access, + hbool_t coll_access, #endif /* H5_HAVE_PARALLEL */ - const H5C_class_t *type, haddr_t addr, void *udata) - { - hbool_t dirty = FALSE; /* Flag indicating whether thing was dirtied during deserialize */ - uint8_t * image = NULL; /* Buffer for disk image */ - void * thing = NULL; /* Pointer to thing loaded */ - H5C_cache_entry_t *entry = NULL; /* Alias for thing loaded, as cache entry */ - size_t len; /* Size of image in file */ + const H5C_class_t *type, haddr_t addr, void *udata) +{ + hbool_t dirty = FALSE; /* Flag indicating whether thing was dirtied during deserialize */ + uint8_t * image = NULL; /* Buffer for disk image */ + void * thing = NULL; /* Pointer to thing loaded */ + H5C_cache_entry_t *entry = NULL; /* Alias for thing loaded, as cache entry */ + size_t len; /* Size of image in file */ #ifdef H5_HAVE_PARALLEL - int mpi_rank = 0; /* MPI process rank */ - MPI_Comm comm = MPI_COMM_NULL; /* File MPI Communicator */ - int mpi_code; /* MPI error code */ -#endif /* H5_HAVE_PARALLEL */ - void *ret_value = NULL; /* Return value */ + int mpi_rank = 0; /* MPI process rank */ + MPI_Comm comm = MPI_COMM_NULL; /* File MPI Communicator */ + int mpi_code; /* MPI error code */ +#endif /* H5_HAVE_PARALLEL */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC - /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); - HDassert(type); - HDassert(H5F_addr_defined(addr)); - HDassert(type->get_initial_load_size); - if (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) - HDassert(type->get_final_load_size); - else - HDassert(NULL == type->get_final_load_size); - HDassert(type->deserialize); + /* Sanity checks */ + HDassert(f); + HDassert(f->shared); + HDassert(f->shared->cache); + HDassert(type); + HDassert(H5F_addr_defined(addr)); + HDassert(type->get_initial_load_size); + if (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) + HDassert(type->get_final_load_size); + else + HDassert(NULL == type->get_final_load_size); + HDassert(type->deserialize); - /* Can't see how skip reads could be usefully combined with - * the speculative read flag. Hence disallow. - */ - HDassert( - !((type->flags & H5C__CLASS_SKIP_READS) && (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG))); - - /* Call the get_initial_load_size callback, to retrieve the initial size of image */ - if (type->get_initial_load_size(udata, &len) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't retrieve image size") - HDassert(len > 0); - - /* Check for possible speculative read off the end of the file */ - if (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) - if (H5C__verify_len_eoa(f, type, addr, &len, FALSE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid len with respect to EOA") - - /* Allocate the buffer for reading the on-disk entry image */ - if (NULL == (image = (uint8_t *)H5MM_malloc(len + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer") + /* Can't see how skip reads could be usefully combined with + * the speculative read flag. Hence disallow. + */ + HDassert(!((type->flags & H5C__CLASS_SKIP_READS) && (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG))); + + /* Call the get_initial_load_size callback, to retrieve the initial size of image */ + if (type->get_initial_load_size(udata, &len) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't retrieve image size") + HDassert(len > 0); + + /* Check for possible speculative read off the end of the file */ + if (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) + if (H5C__verify_len_eoa(f, type, addr, &len, FALSE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid len with respect to EOA") + + /* Allocate the buffer for reading the on-disk entry image */ + if (NULL == (image = (uint8_t *)H5MM_malloc(len + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS - H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); + H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ #ifdef H5_HAVE_PARALLEL - if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { - if ((mpi_rank = H5F_mpi_get_rank(f)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank") - if ((comm = H5F_mpi_get_comm(f)) == MPI_COMM_NULL) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed") - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ + if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + if ((mpi_rank = H5F_mpi_get_rank(f)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank") + if ((comm = H5F_mpi_get_comm(f)) == MPI_COMM_NULL) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed") + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ - /* Get the on-disk entry image */ - if (0 == (type->flags & H5C__CLASS_SKIP_READS)) { - unsigned tries, max_tries; /* The # of read attempts */ - unsigned retries; /* The # of retries */ - htri_t chk_ret; /* return from verify_chksum callback */ - size_t actual_len = len; /* The actual length, after speculative reads have been resolved */ - uint64_t nanosec = 1; /* # of nanoseconds to sleep between retries */ - void * new_image; /* Pointer to image */ - hbool_t len_changed = TRUE; /* Whether to re-check speculative entries */ - - /* Get the # of read attempts */ - max_tries = tries = H5F_GET_READ_ATTEMPTS(f); - - /* - * This do/while loop performs the following till the metadata checksum - * is correct or the file's number of allowed read attempts are reached. - * --read the metadata - * --determine the actual size of the metadata - * --perform checksum verification - */ - do { - if (actual_len != len) { - if (NULL == (new_image = H5MM_realloc(image, len + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()") - image = (uint8_t *)new_image; + /* Get the on-disk entry image */ + if (0 == (type->flags & H5C__CLASS_SKIP_READS)) { + unsigned tries, max_tries; /* The # of read attempts */ + unsigned retries; /* The # of retries */ + htri_t chk_ret; /* return from verify_chksum callback */ + size_t actual_len = len; /* The actual length, after speculative reads have been resolved */ + uint64_t nanosec = 1; /* # of nanoseconds to sleep between retries */ + void * new_image; /* Pointer to image */ + hbool_t len_changed = TRUE; /* Whether to re-check speculative entries */ + + /* Get the # of read attempts */ + max_tries = tries = H5F_GET_READ_ATTEMPTS(f); + + /* + * This do/while loop performs the following till the metadata checksum + * is correct or the file's number of allowed read attempts are reached. + * --read the metadata + * --determine the actual size of the metadata + * --perform checksum verification + */ + do { + if (actual_len != len) { + if (NULL == (new_image = H5MM_realloc(image, len + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()") + image = (uint8_t *)new_image; #if H5C_DO_MEMORY_SANITY_CHECKS - H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); -#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - } /* end if */ + H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + } /* end if */ #ifdef H5_HAVE_PARALLEL - if (!coll_access || 0 == mpi_rank) { + if (!coll_access || 0 == mpi_rank) { #endif /* H5_HAVE_PARALLEL */ - if (H5F_block_read(f, type->mem_type, addr, len, image) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*") + if (H5F_block_read(f, type->mem_type, addr, len, image) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*") #ifdef H5_HAVE_PARALLEL - } /* end if */ - /* if the collective metadata read optimization is turned on, - * bcast the metadata read from process 0 to all ranks in the file - * communicator - */ - if (coll_access) { - int buf_size; + } /* end if */ + /* if the collective metadata read optimization is turned on, + * bcast the metadata read from process 0 to all ranks in the file + * communicator + */ + if (coll_access) { + int buf_size; - H5_CHECKED_ASSIGN(buf_size, int, len, size_t); - if (MPI_SUCCESS != (mpi_code = MPI_Bcast(image, buf_size, MPI_BYTE, 0, comm))) - HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ + H5_CHECKED_ASSIGN(buf_size, int, len, size_t); + if (MPI_SUCCESS != (mpi_code = MPI_Bcast(image, buf_size, MPI_BYTE, 0, comm))) + HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ - /* If the entry could be read speculatively and the length is still - * changing, check for updating the actual size - */ - if ((type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) && len_changed) { - /* Retrieve the actual length */ - actual_len = len; - if (type->get_final_load_size(image, len, udata, &actual_len) < 0) - continue; /* Transfer control to while() and count towards retries */ - - /* Check for the length changing */ - if (actual_len != len) { - /* Verify that the length isn't past the EOA for the file */ - if (H5C__verify_len_eoa(f, type, addr, &actual_len, TRUE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "actual_len exceeds EOA") - - /* Expand buffer to new size */ - if (NULL == (new_image = H5MM_realloc(image, actual_len + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()") - image = (uint8_t *)new_image; + /* If the entry could be read speculatively and the length is still + * changing, check for updating the actual size + */ + if ((type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) && len_changed) { + /* Retrieve the actual length */ + actual_len = len; + if (type->get_final_load_size(image, len, udata, &actual_len) < 0) + continue; /* Transfer control to while() and count towards retries */ + + /* Check for the length changing */ + if (actual_len != len) { + /* Verify that the length isn't past the EOA for the file */ + if (H5C__verify_len_eoa(f, type, addr, &actual_len, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "actual_len exceeds EOA") + + /* Expand buffer to new size */ + if (NULL == (new_image = H5MM_realloc(image, actual_len + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()") + image = (uint8_t *)new_image; #if H5C_DO_MEMORY_SANITY_CHECKS - H5MM_memcpy(image + actual_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); + H5MM_memcpy(image + actual_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - if (actual_len > len) { + if (actual_len > len) { #ifdef H5_HAVE_PARALLEL - if (!coll_access || 0 == mpi_rank) { + if (!coll_access || 0 == mpi_rank) { #endif /* H5_HAVE_PARALLEL */ - /* If the thing's image needs to be bigger for a speculatively - * loaded thing, go get the on-disk image again (the extra portion). - */ - if (H5F_block_read(f, type->mem_type, addr + len, actual_len - len, - image + len) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't read image") + /* If the thing's image needs to be bigger for a speculatively + * loaded thing, go get the on-disk image again (the extra portion). + */ + if (H5F_block_read(f, type->mem_type, addr + len, actual_len - len, image + len) < + 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't read image") #ifdef H5_HAVE_PARALLEL - } - /* If the collective metadata read optimization is turned on, - * Bcast the metadata read from process 0 to all ranks in the file - * communicator */ - if (coll_access) { - int buf_size; - - H5_CHECKED_ASSIGN(buf_size, int, actual_len - len, size_t); - if (MPI_SUCCESS != - (mpi_code = MPI_Bcast(image + len, buf_size, MPI_BYTE, 0, comm))) - HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ - } /* end if */ - } /* end if (actual_len != len) */ - else { - /* The length has stabilized */ - len_changed = FALSE; + } + /* If the collective metadata read optimization is turned on, + * Bcast the metadata read from process 0 to all ranks in the file + * communicator */ + if (coll_access) { + int buf_size; + + H5_CHECKED_ASSIGN(buf_size, int, actual_len - len, size_t); + if (MPI_SUCCESS != + (mpi_code = MPI_Bcast(image + len, buf_size, MPI_BYTE, 0, comm))) + HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ + } /* end if */ + } /* end if (actual_len != len) */ + else { + /* The length has stabilized */ + len_changed = FALSE; - /* Set the final length */ - len = actual_len; - } /* else */ - } /* end if */ + /* Set the final length */ + len = actual_len; + } /* else */ + } /* end if */ - /* If there's no way to verify the checksum for a piece of metadata - * (usually because there's no checksum in the file), leave now - */ - if (type->verify_chksum == NULL) - break; + /* If there's no way to verify the checksum for a piece of metadata + * (usually because there's no checksum in the file), leave now + */ + if (type->verify_chksum == NULL) + break; - /* Verify the checksum for the metadata image */ - if ((chk_ret = type->verify_chksum(image, actual_len, udata)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "failure from verify_chksum callback") - if (chk_ret == TRUE) - break; + /* Verify the checksum for the metadata image */ + if ((chk_ret = type->verify_chksum(image, actual_len, udata)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "failure from verify_chksum callback") + if (chk_ret == TRUE) + break; - /* Sleep for some time */ - H5_nanosleep(nanosec); - nanosec *= 2; /* Double the sleep time next time */ - } while (--tries); + /* Sleep for some time */ + H5_nanosleep(nanosec); + nanosec *= 2; /* Double the sleep time next time */ + } while (--tries); - /* Check for too many tries */ - if (tries == 0) - HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, - "incorrect metadatda checksum after all read attempts") + /* Check for too many tries */ + if (tries == 0) + HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, + "incorrect metadatda checksum after all read attempts") - /* Calculate and track the # of retries */ - retries = max_tries - tries; - if (retries) /* Does not track 0 retry */ - if (H5F_track_metadata_read_retries(f, (unsigned)type->mem_type, retries) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "cannot track read tries = %u ", retries) + /* Calculate and track the # of retries */ + retries = max_tries - tries; + if (retries) /* Does not track 0 retry */ + if (H5F_track_metadata_read_retries(f, (unsigned)type->mem_type, retries) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "cannot track read tries = %u ", retries) - /* Set the final length (in case it wasn't set earlier) */ - len = actual_len; - } /* end if !H5C__CLASS_SKIP_READS */ + /* Set the final length (in case it wasn't set earlier) */ + len = actual_len; + } /* end if !H5C__CLASS_SKIP_READS */ - /* Deserialize the on-disk image into the native memory form */ - if (NULL == (thing = type->deserialize(image, len, udata, &dirty))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't deserialize image") + /* Deserialize the on-disk image into the native memory form */ + if (NULL == (thing = type->deserialize(image, len, udata, &dirty))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't deserialize image") - entry = (H5C_cache_entry_t *)thing; + entry = (H5C_cache_entry_t *)thing; - /* In general, an entry should be clean just after it is loaded. - * - * However, when this code is used in the metadata cache, it is - * possible that object headers will be dirty at this point, as - * the deserialize function will alter object headers if necessary to - * fix an old bug. - * - * In the following assert: - * - * HDassert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6 ) ); - * - * note that type ids 5 & 6 are associated with object headers in the - * metadata cache. - * - * When we get to using H5C for other purposes, we may wish to - * tighten up the assert so that the loophole only applies to the - * metadata cache. - */ + /* In general, an entry should be clean just after it is loaded. + * + * However, when this code is used in the metadata cache, it is + * possible that object headers will be dirty at this point, as + * the deserialize function will alter object headers if necessary to + * fix an old bug. + * + * In the following assert: + * + * HDassert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6 ) ); + * + * note that type ids 5 & 6 are associated with object headers in the + * metadata cache. + * + * When we get to using H5C for other purposes, we may wish to + * tighten up the assert so that the loophole only applies to the + * metadata cache. + */ - HDassert((dirty == FALSE) || (type->id == 5 || type->id == 6)); - - entry->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; - entry->cache_ptr = f->shared->cache; - entry->addr = addr; - entry->size = len; - HDassert(entry->size < H5C_MAX_ENTRY_SIZE); - entry->image_ptr = image; - entry->image_up_to_date = !dirty; - entry->type = type; - entry->is_dirty = dirty; - entry->dirtied = FALSE; - entry->is_protected = FALSE; - entry->is_read_only = FALSE; - entry->ro_ref_count = 0; - entry->is_pinned = FALSE; - entry->in_slist = FALSE; - entry->flush_marker = FALSE; + HDassert((dirty == FALSE) || (type->id == 5 || type->id == 6)); + + entry->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; + entry->cache_ptr = f->shared->cache; + entry->addr = addr; + entry->size = len; + HDassert(entry->size < H5C_MAX_ENTRY_SIZE); + entry->image_ptr = image; + entry->image_up_to_date = !dirty; + entry->type = type; + entry->is_dirty = dirty; + entry->dirtied = FALSE; + entry->is_protected = FALSE; + entry->is_read_only = FALSE; + entry->ro_ref_count = 0; + entry->is_pinned = FALSE; + entry->in_slist = FALSE; + entry->flush_marker = FALSE; #ifdef H5_HAVE_PARALLEL - entry->clear_on_unprotect = FALSE; - entry->flush_immediately = FALSE; - entry->coll_access = coll_access; + entry->clear_on_unprotect = FALSE; + entry->flush_immediately = FALSE; + entry->coll_access = coll_access; #endif /* H5_HAVE_PARALLEL */ - entry->flush_in_progress = FALSE; - entry->destroy_in_progress = FALSE; - - entry->ring = H5C_RING_UNDEFINED; - - /* Initialize flush dependency fields */ - entry->flush_dep_parent = NULL; - entry->flush_dep_nparents = 0; - entry->flush_dep_parent_nalloc = 0; - entry->flush_dep_nchildren = 0; - entry->flush_dep_ndirty_children = 0; - entry->flush_dep_nunser_children = 0; - entry->ht_next = NULL; - entry->ht_prev = NULL; - entry->il_next = NULL; - entry->il_prev = NULL; - - entry->next = NULL; - entry->prev = NULL; + entry->flush_in_progress = FALSE; + entry->destroy_in_progress = FALSE; + + entry->ring = H5C_RING_UNDEFINED; + + /* Initialize flush dependency fields */ + entry->flush_dep_parent = NULL; + entry->flush_dep_nparents = 0; + entry->flush_dep_parent_nalloc = 0; + entry->flush_dep_nchildren = 0; + entry->flush_dep_ndirty_children = 0; + entry->flush_dep_nunser_children = 0; + entry->ht_next = NULL; + entry->ht_prev = NULL; + entry->il_next = NULL; + entry->il_prev = NULL; + + entry->next = NULL; + entry->prev = NULL; #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - entry->aux_next = NULL; - entry->aux_prev = NULL; + entry->aux_next = NULL; + entry->aux_prev = NULL; #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ #ifdef H5_HAVE_PARALLEL - entry->coll_next = NULL; - entry->coll_prev = NULL; + entry->coll_next = NULL; + entry->coll_prev = NULL; #endif /* H5_HAVE_PARALLEL */ - /* initialize cache image related fields */ - entry->include_in_image = FALSE; - entry->lru_rank = 0; - entry->image_dirty = FALSE; - entry->fd_parent_count = 0; - entry->fd_parent_addrs = NULL; - entry->fd_child_count = 0; - entry->fd_dirty_child_count = 0; - entry->image_fd_height = 0; - entry->prefetched = FALSE; - entry->prefetch_type_id = 0; - entry->age = 0; - entry->prefetched_dirty = FALSE; + /* initialize cache image related fields */ + entry->include_in_image = FALSE; + entry->lru_rank = 0; + entry->image_dirty = FALSE; + entry->fd_parent_count = 0; + entry->fd_parent_addrs = NULL; + entry->fd_child_count = 0; + entry->fd_dirty_child_count = 0; + entry->image_fd_height = 0; + entry->prefetched = FALSE; + entry->prefetch_type_id = 0; + entry->age = 0; + entry->prefetched_dirty = FALSE; #ifndef NDEBUG /* debugging field */ - entry->serialization_count = 0; + entry->serialization_count = 0; #endif /* NDEBUG */ - entry->tl_next = NULL; - entry->tl_prev = NULL; - entry->tag_info = NULL; + entry->tl_next = NULL; + entry->tl_prev = NULL; + entry->tag_info = NULL; - H5C__RESET_CACHE_ENTRY_STATS(entry); + H5C__RESET_CACHE_ENTRY_STATS(entry); - ret_value = thing; + ret_value = thing; done: - /* Cleanup on error */ - if (NULL == ret_value) { - /* Release resources */ - if (thing && type->free_icr(thing) < 0) - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "free_icr callback failed") - if (image) - image = (uint8_t *)H5MM_xfree(image); - } /* end if */ + /* Cleanup on error */ + if (NULL == ret_value) { + /* Release resources */ + if (thing && type->free_icr(thing) < 0) + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "free_icr callback failed") + if (image) + image = (uint8_t *)H5MM_xfree(image); + } /* end if */ - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__load_entry() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__load_entry() */ - /*------------------------------------------------------------------------- - * - * Function: H5C__make_space_in_cache - * - * Purpose: Attempt to evict cache entries until the index_size - * is at least needed_space below max_cache_size. - * - * In passing, also attempt to bring cLRU_list_size to a - * value greater than min_clean_size. - * - * Depending on circumstances, both of these goals may - * be impossible, as in parallel mode, we must avoid generating - * a write as part of a read (to avoid deadlock in collective - * I/O), and in all cases, it is possible (though hopefully - * highly unlikely) that the protected list may exceed the - * maximum size of the cache. - * - * Thus the function simply does its best, returning success - * unless an error is encountered. - * - * Observe that this function cannot occasion a read. - * - * Return: Non-negative on success/Negative on failure. - * - * Programmer: John Mainzer, 5/14/04 - * - *------------------------------------------------------------------------- - */ - herr_t H5C__make_space_in_cache(H5F_t * f, size_t space_needed, hbool_t write_permitted) - { - H5C_t *cache_ptr = f->shared->cache; +/*------------------------------------------------------------------------- + * + * Function: H5C__make_space_in_cache + * + * Purpose: Attempt to evict cache entries until the index_size + * is at least needed_space below max_cache_size. + * + * In passing, also attempt to bring cLRU_list_size to a + * value greater than min_clean_size. + * + * Depending on circumstances, both of these goals may + * be impossible, as in parallel mode, we must avoid generating + * a write as part of a read (to avoid deadlock in collective + * I/O), and in all cases, it is possible (though hopefully + * highly unlikely) that the protected list may exceed the + * maximum size of the cache. + * + * Thus the function simply does its best, returning success + * unless an error is encountered. + * + * Observe that this function cannot occasion a read. + * + * Return: Non-negative on success/Negative on failure. + * + * Programmer: John Mainzer, 5/14/04 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C__make_space_in_cache(H5F_t *f, size_t space_needed, hbool_t write_permitted) +{ + H5C_t *cache_ptr = f->shared->cache; #if H5C_COLLECT_CACHE_STATS - int32_t clean_entries_skipped = 0; - int32_t dirty_pf_entries_skipped = 0; - int32_t total_entries_scanned = 0; + int32_t clean_entries_skipped = 0; + int32_t dirty_pf_entries_skipped = 0; + int32_t total_entries_scanned = 0; #endif /* H5C_COLLECT_CACHE_STATS */ - uint32_t entries_examined = 0; - uint32_t initial_list_len; - size_t empty_space; - hbool_t reentrant_call = FALSE; - hbool_t prev_is_dirty = FALSE; - hbool_t didnt_flush_entry = FALSE; - hbool_t restart_scan; - H5C_cache_entry_t *entry_ptr; - H5C_cache_entry_t *prev_ptr; - H5C_cache_entry_t *next_ptr; - uint32_t num_corked_entries = 0; - herr_t ret_value = SUCCEED; /* Return value */ + uint32_t entries_examined = 0; + uint32_t initial_list_len; + size_t empty_space; + hbool_t reentrant_call = FALSE; + hbool_t prev_is_dirty = FALSE; + hbool_t didnt_flush_entry = FALSE; + hbool_t restart_scan; + H5C_cache_entry_t *entry_ptr; + H5C_cache_entry_t *prev_ptr; + H5C_cache_entry_t *next_ptr; + uint32_t num_corked_entries = 0; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_PACKAGE - /* Sanity checks */ - HDassert(f); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->index_size == (cache_ptr->clean_index_size + cache_ptr->dirty_index_size)); - - /* check to see if cache_ptr->msic_in_progress is TRUE. If it, this - * is a re-entrant call via a client callback called in the make - * space in cache process. To avoid an infinite recursion, set - * reentrant_call to TRUE, and goto done. - */ - if (cache_ptr->msic_in_progress) { - reentrant_call = TRUE; - HGOTO_DONE(SUCCEED); - } /* end if */ + /* Sanity checks */ + HDassert(f); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->index_size == (cache_ptr->clean_index_size + cache_ptr->dirty_index_size)); + + /* check to see if cache_ptr->msic_in_progress is TRUE. If it, this + * is a re-entrant call via a client callback called in the make + * space in cache process. To avoid an infinite recursion, set + * reentrant_call to TRUE, and goto done. + */ + if (cache_ptr->msic_in_progress) { + reentrant_call = TRUE; + HGOTO_DONE(SUCCEED); + } /* end if */ - cache_ptr->msic_in_progress = TRUE; + cache_ptr->msic_in_progress = TRUE; - if (write_permitted) { - restart_scan = FALSE; - initial_list_len = cache_ptr->LRU_list_len; - entry_ptr = cache_ptr->LRU_tail_ptr; + if (write_permitted) { + restart_scan = FALSE; + initial_list_len = cache_ptr->LRU_list_len; + entry_ptr = cache_ptr->LRU_tail_ptr; - if (cache_ptr->index_size >= cache_ptr->max_cache_size) - empty_space = 0; - else - empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; + if (cache_ptr->index_size >= cache_ptr->max_cache_size) + empty_space = 0; + else + empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; - while ((((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) || - ((empty_space + cache_ptr->clean_index_size) < (cache_ptr->min_clean_size))) && - (entries_examined <= (2 * initial_list_len)) && (entry_ptr != NULL)) { - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(!(entry_ptr->is_protected)); - HDassert(!(entry_ptr->is_read_only)); - HDassert((entry_ptr->ro_ref_count) == 0); + while ((((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) || + ((empty_space + cache_ptr->clean_index_size) < (cache_ptr->min_clean_size))) && + (entries_examined <= (2 * initial_list_len)) && (entry_ptr != NULL)) { + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(!(entry_ptr->is_protected)); + HDassert(!(entry_ptr->is_read_only)); + HDassert((entry_ptr->ro_ref_count) == 0); - next_ptr = entry_ptr->next; - prev_ptr = entry_ptr->prev; + next_ptr = entry_ptr->next; + prev_ptr = entry_ptr->prev; - if (prev_ptr != NULL) - prev_is_dirty = prev_ptr->is_dirty; + if (prev_ptr != NULL) + prev_is_dirty = prev_ptr->is_dirty; - if (entry_ptr->is_dirty && (entry_ptr->tag_info && entry_ptr->tag_info->corked)) { + if (entry_ptr->is_dirty && (entry_ptr->tag_info && entry_ptr->tag_info->corked)) { - /* Skip "dirty" corked entries. */ - ++num_corked_entries; - didnt_flush_entry = TRUE; - } - else if (((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) && (!entry_ptr->flush_in_progress) && - (!entry_ptr->prefetched_dirty)) { + /* Skip "dirty" corked entries. */ + ++num_corked_entries; + didnt_flush_entry = TRUE; + } + else if (((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) && (!entry_ptr->flush_in_progress) && + (!entry_ptr->prefetched_dirty)) { - didnt_flush_entry = FALSE; + didnt_flush_entry = FALSE; - if (entry_ptr->is_dirty) { + if (entry_ptr->is_dirty) { #if H5C_COLLECT_CACHE_STATS - if ((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) { + if ((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) { - cache_ptr->entries_scanned_to_make_space++; - } + cache_ptr->entries_scanned_to_make_space++; + } #endif /* H5C_COLLECT_CACHE_STATS */ - /* reset entries_removed_counter and - * last_entry_removed_ptr prior to the call to - * H5C__flush_single_entry() so that we can spot - * unexpected removals of entries from the cache, - * and set the restart_scan flag if proceeding - * would be likely to cause us to scan an entry - * that is no longer in the cache. - */ - cache_ptr->entries_removed_counter = 0; - cache_ptr->last_entry_removed_ptr = NULL; + /* reset entries_removed_counter and + * last_entry_removed_ptr prior to the call to + * H5C__flush_single_entry() so that we can spot + * unexpected removals of entries from the cache, + * and set the restart_scan flag if proceeding + * would be likely to cause us to scan an entry + * that is no longer in the cache. + */ + cache_ptr->entries_removed_counter = 0; + cache_ptr->last_entry_removed_ptr = NULL; - if (H5C__flush_single_entry(f, entry_ptr, H5C__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") + if (H5C__flush_single_entry(f, entry_ptr, H5C__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") - if ((cache_ptr->entries_removed_counter > 1) || - (cache_ptr->last_entry_removed_ptr == prev_ptr)) + if ((cache_ptr->entries_removed_counter > 1) || + (cache_ptr->last_entry_removed_ptr == prev_ptr)) - restart_scan = TRUE; - } - else if ((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size + restart_scan = TRUE; + } + else if ((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size #ifdef H5_HAVE_PARALLEL - && !(entry_ptr->coll_access) + && !(entry_ptr->coll_access) #endif /* H5_HAVE_PARALLEL */ - ) { + ) { #if H5C_COLLECT_CACHE_STATS - cache_ptr->entries_scanned_to_make_space++; + cache_ptr->entries_scanned_to_make_space++; #endif /* H5C_COLLECT_CACHE_STATS */ - if (H5C__flush_single_entry(f, entry_ptr, - H5C__FLUSH_INVALIDATE_FLAG | - H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") - } - else { - /* We have enough space so don't flush clean entry. */ + if (H5C__flush_single_entry(f, entry_ptr, + H5C__FLUSH_INVALIDATE_FLAG | + H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") + } + else { + /* We have enough space so don't flush clean entry. */ #if H5C_COLLECT_CACHE_STATS - clean_entries_skipped++; + clean_entries_skipped++; #endif /* H5C_COLLECT_CACHE_STATS */ - didnt_flush_entry = TRUE; - } + didnt_flush_entry = TRUE; + } #if H5C_COLLECT_CACHE_STATS - total_entries_scanned++; + total_entries_scanned++; #endif /* H5C_COLLECT_CACHE_STATS */ - } - else { + } + else { - /* Skip epoch markers, entries that are in the process - * of being flushed, and entries marked as prefetched_dirty - * (occurs in the R/O case only). - */ - didnt_flush_entry = TRUE; + /* Skip epoch markers, entries that are in the process + * of being flushed, and entries marked as prefetched_dirty + * (occurs in the R/O case only). + */ + didnt_flush_entry = TRUE; #if H5C_COLLECT_CACHE_STATS - if (entry_ptr->prefetched_dirty) - dirty_pf_entries_skipped++; + if (entry_ptr->prefetched_dirty) + dirty_pf_entries_skipped++; #endif /* H5C_COLLECT_CACHE_STATS */ - } - - if (prev_ptr != NULL) { + } - if (didnt_flush_entry) { + if (prev_ptr != NULL) { - /* epoch markers don't get flushed, and we don't touch - * entries that are in the process of being flushed. - * Hence no need for sanity checks, as we haven't - * flushed anything. Thus just set entry_ptr to prev_ptr - * and go on. - */ - entry_ptr = prev_ptr; - } - else if ((restart_scan) || (prev_ptr->is_dirty != prev_is_dirty) || - (prev_ptr->next != next_ptr) || (prev_ptr->is_protected) || - (prev_ptr->is_pinned)) { + if (didnt_flush_entry) { - /* something has happened to the LRU -- start over - * from the tail. - */ - restart_scan = FALSE; - entry_ptr = cache_ptr->LRU_tail_ptr; - H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr) - } - else { + /* epoch markers don't get flushed, and we don't touch + * entries that are in the process of being flushed. + * Hence no need for sanity checks, as we haven't + * flushed anything. Thus just set entry_ptr to prev_ptr + * and go on. + */ + entry_ptr = prev_ptr; + } + else if ((restart_scan) || (prev_ptr->is_dirty != prev_is_dirty) || + (prev_ptr->next != next_ptr) || (prev_ptr->is_protected) || (prev_ptr->is_pinned)) { - entry_ptr = prev_ptr; - } + /* something has happened to the LRU -- start over + * from the tail. + */ + restart_scan = FALSE; + entry_ptr = cache_ptr->LRU_tail_ptr; + H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr) } else { - entry_ptr = NULL; + entry_ptr = prev_ptr; } + } + else { - entries_examined++; + entry_ptr = NULL; + } - if (cache_ptr->index_size >= cache_ptr->max_cache_size) { + entries_examined++; - empty_space = 0; - } - else { + if (cache_ptr->index_size >= cache_ptr->max_cache_size) { - empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; - } + empty_space = 0; + } + else { - HDassert(cache_ptr->index_size == - (cache_ptr->clean_index_size + cache_ptr->dirty_index_size)); + empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; } + HDassert(cache_ptr->index_size == (cache_ptr->clean_index_size + cache_ptr->dirty_index_size)); + } + #if H5C_COLLECT_CACHE_STATS - cache_ptr->calls_to_msic++; + cache_ptr->calls_to_msic++; - cache_ptr->total_entries_skipped_in_msic += clean_entries_skipped; - cache_ptr->total_dirty_pf_entries_skipped_in_msic += dirty_pf_entries_skipped; - cache_ptr->total_entries_scanned_in_msic += total_entries_scanned; + cache_ptr->total_entries_skipped_in_msic += clean_entries_skipped; + cache_ptr->total_dirty_pf_entries_skipped_in_msic += dirty_pf_entries_skipped; + cache_ptr->total_entries_scanned_in_msic += total_entries_scanned; - if (clean_entries_skipped > cache_ptr->max_entries_skipped_in_msic) { + if (clean_entries_skipped > cache_ptr->max_entries_skipped_in_msic) { - cache_ptr->max_entries_skipped_in_msic = clean_entries_skipped; - } + cache_ptr->max_entries_skipped_in_msic = clean_entries_skipped; + } - if (dirty_pf_entries_skipped > cache_ptr->max_dirty_pf_entries_skipped_in_msic) - cache_ptr->max_dirty_pf_entries_skipped_in_msic = dirty_pf_entries_skipped; + if (dirty_pf_entries_skipped > cache_ptr->max_dirty_pf_entries_skipped_in_msic) + cache_ptr->max_dirty_pf_entries_skipped_in_msic = dirty_pf_entries_skipped; - if (total_entries_scanned > cache_ptr->max_entries_scanned_in_msic) { + if (total_entries_scanned > cache_ptr->max_entries_scanned_in_msic) { - cache_ptr->max_entries_scanned_in_msic = total_entries_scanned; - } + cache_ptr->max_entries_scanned_in_msic = total_entries_scanned; + } #endif /* H5C_COLLECT_CACHE_STATS */ - /* NEED: work on a better assert for corked entries */ - HDassert((entries_examined > (2 * initial_list_len)) || - ((cache_ptr->pl_size + cache_ptr->pel_size + cache_ptr->min_clean_size) > - cache_ptr->max_cache_size) || - ((cache_ptr->clean_index_size + empty_space) >= cache_ptr->min_clean_size) || - ((num_corked_entries))); + /* NEED: work on a better assert for corked entries */ + HDassert((entries_examined > (2 * initial_list_len)) || + ((cache_ptr->pl_size + cache_ptr->pel_size + cache_ptr->min_clean_size) > + cache_ptr->max_cache_size) || + ((cache_ptr->clean_index_size + empty_space) >= cache_ptr->min_clean_size) || + ((num_corked_entries))); #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - HDassert((entries_examined > (2 * initial_list_len)) || - (cache_ptr->cLRU_list_size <= cache_ptr->clean_index_size)); - HDassert((entries_examined > (2 * initial_list_len)) || - (cache_ptr->dLRU_list_size <= cache_ptr->dirty_index_size)); + HDassert((entries_examined > (2 * initial_list_len)) || + (cache_ptr->cLRU_list_size <= cache_ptr->clean_index_size)); + HDassert((entries_examined > (2 * initial_list_len)) || + (cache_ptr->dLRU_list_size <= cache_ptr->dirty_index_size)); #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - } - else { + } + else { - HDassert(H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS); + HDassert(H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS); #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - initial_list_len = cache_ptr->cLRU_list_len; - entry_ptr = cache_ptr->cLRU_tail_ptr; + initial_list_len = cache_ptr->cLRU_list_len; + entry_ptr = cache_ptr->cLRU_tail_ptr; - while (((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) && - (entries_examined <= initial_list_len) && (entry_ptr != NULL)) { - HDassert(!(entry_ptr->is_protected)); - HDassert(!(entry_ptr->is_read_only)); - HDassert((entry_ptr->ro_ref_count) == 0); - HDassert(!(entry_ptr->is_dirty)); + while (((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) && + (entries_examined <= initial_list_len) && (entry_ptr != NULL)) { + HDassert(!(entry_ptr->is_protected)); + HDassert(!(entry_ptr->is_read_only)); + HDassert((entry_ptr->ro_ref_count) == 0); + HDassert(!(entry_ptr->is_dirty)); - prev_ptr = entry_ptr->aux_prev; + prev_ptr = entry_ptr->aux_prev; - if ((!(entry_ptr->prefetched_dirty)) + if ((!(entry_ptr->prefetched_dirty)) #ifdef H5_HAVE_PARALLEL - && (!(entry_ptr->coll_access)) + && (!(entry_ptr->coll_access)) #endif /* H5_HAVE_PARALLEL */ - ) { - if (H5C__flush_single_entry(f, entry_ptr, - H5C__FLUSH_INVALIDATE_FLAG | - H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") + ) { + if (H5C__flush_single_entry( + f, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") - } /* end if */ + } /* end if */ - /* we are scanning the clean LRU, so the serialize function - * will not be called on any entry -- thus there is no - * concern about the list being modified out from under - * this function. - */ + /* we are scanning the clean LRU, so the serialize function + * will not be called on any entry -- thus there is no + * concern about the list being modified out from under + * this function. + */ - entry_ptr = prev_ptr; - entries_examined++; - } -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + entry_ptr = prev_ptr; + entries_examined++; } +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + } done: - /* Sanity checks */ - HDassert(cache_ptr->msic_in_progress); - if (!reentrant_call) - cache_ptr->msic_in_progress = FALSE; - HDassert((!reentrant_call) || (cache_ptr->msic_in_progress)); + /* Sanity checks */ + HDassert(cache_ptr->msic_in_progress); + if (!reentrant_call) + cache_ptr->msic_in_progress = FALSE; + HDassert((!reentrant_call) || (cache_ptr->msic_in_progress)); - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__make_space_in_cache() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__make_space_in_cache() */ /*------------------------------------------------------------------------- * @@ -6915,62 +6973,63 @@ done: *------------------------------------------------------------------------- */ #if H5C_DO_EXTREME_SANITY_CHECKS - static herr_t H5C__validate_lru_list(H5C_t * cache_ptr) - { - int32_t len = 0; - size_t size = 0; - H5C_cache_entry_t *entry_ptr = NULL; - herr_t ret_value = SUCCEED; /* Return value */ +static herr_t +H5C__validate_lru_list(H5C_t *cache_ptr) +{ + int32_t len = 0; + size_t size = 0; + H5C_cache_entry_t *entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - if (((cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_tail_ptr == NULL)) && - (cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed") + if (((cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_tail_ptr == NULL)) && + (cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed") - if (cache_ptr->LRU_list_len < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed") + if (cache_ptr->LRU_list_len < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed") - if ((cache_ptr->LRU_list_len == 1) && - ((cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr) || (cache_ptr->LRU_head_ptr == NULL) || - (cache_ptr->LRU_head_ptr->size != cache_ptr->LRU_list_size))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed") + if ((cache_ptr->LRU_list_len == 1) && + ((cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr) || (cache_ptr->LRU_head_ptr == NULL) || + (cache_ptr->LRU_head_ptr->size != cache_ptr->LRU_list_size))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed") - if ((cache_ptr->LRU_list_len >= 1) && - ((cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_head_ptr->prev != NULL) || - (cache_ptr->LRU_tail_ptr == NULL) || (cache_ptr->LRU_tail_ptr->next != NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed") + if ((cache_ptr->LRU_list_len >= 1) && + ((cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_head_ptr->prev != NULL) || + (cache_ptr->LRU_tail_ptr == NULL) || (cache_ptr->LRU_tail_ptr->next != NULL))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed") - entry_ptr = cache_ptr->LRU_head_ptr; - while (entry_ptr != NULL) { - if ((entry_ptr != cache_ptr->LRU_head_ptr) && - ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed") + entry_ptr = cache_ptr->LRU_head_ptr; + while (entry_ptr != NULL) { + if ((entry_ptr != cache_ptr->LRU_head_ptr) && + ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed") - if ((entry_ptr != cache_ptr->LRU_tail_ptr) && - ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed") + if ((entry_ptr != cache_ptr->LRU_tail_ptr) && + ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed") - if ((entry_ptr->is_pinned) || (entry_ptr->pinned_from_client) || (entry_ptr->pinned_from_cache)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed") + if ((entry_ptr->is_pinned) || (entry_ptr->pinned_from_client) || (entry_ptr->pinned_from_cache)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed") - len++; - size += entry_ptr->size; - entry_ptr = entry_ptr->next; - } + len++; + size += entry_ptr->size; + entry_ptr = entry_ptr->next; + } - if ((cache_ptr->LRU_list_len != len) || (cache_ptr->LRU_list_size != size)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed") + if ((cache_ptr->LRU_list_len != len) || (cache_ptr->LRU_list_size != size)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed") done: - if (ret_value != SUCCEED) - HDassert(0); + if (ret_value != SUCCEED) + HDassert(0); - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__validate_lru_list() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__validate_lru_list() */ #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /*------------------------------------------------------------------------- @@ -6991,65 +7050,66 @@ done: *------------------------------------------------------------------------- */ #if H5C_DO_EXTREME_SANITY_CHECKS - static herr_t H5C__validate_pinned_entry_list(H5C_t * cache_ptr) - { - int32_t len = 0; - size_t size = 0; - H5C_cache_entry_t *entry_ptr = NULL; - herr_t ret_value = SUCCEED; /* Return value */ +static herr_t +H5C__validate_pinned_entry_list(H5C_t *cache_ptr) +{ + int32_t len = 0; + size_t size = 0; + H5C_cache_entry_t *entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - if (((cache_ptr->pel_head_ptr == NULL) || (cache_ptr->pel_tail_ptr == NULL)) && - (cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed") + if (((cache_ptr->pel_head_ptr == NULL) || (cache_ptr->pel_tail_ptr == NULL)) && + (cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed") - if (cache_ptr->pel_len < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed") + if (cache_ptr->pel_len < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed") - if ((cache_ptr->pel_len == 1) && - ((cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr) || (cache_ptr->pel_head_ptr == NULL) || - (cache_ptr->pel_head_ptr->size != cache_ptr->pel_size))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed") + if ((cache_ptr->pel_len == 1) && + ((cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr) || (cache_ptr->pel_head_ptr == NULL) || + (cache_ptr->pel_head_ptr->size != cache_ptr->pel_size))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed") - if ((cache_ptr->pel_len >= 1) && - ((cache_ptr->pel_head_ptr == NULL) || (cache_ptr->pel_head_ptr->prev != NULL) || - (cache_ptr->pel_tail_ptr == NULL) || (cache_ptr->pel_tail_ptr->next != NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed") + if ((cache_ptr->pel_len >= 1) && + ((cache_ptr->pel_head_ptr == NULL) || (cache_ptr->pel_head_ptr->prev != NULL) || + (cache_ptr->pel_tail_ptr == NULL) || (cache_ptr->pel_tail_ptr->next != NULL))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed") - entry_ptr = cache_ptr->pel_head_ptr; - while (entry_ptr != NULL) { - if ((entry_ptr != cache_ptr->pel_head_ptr) && - ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed") + entry_ptr = cache_ptr->pel_head_ptr; + while (entry_ptr != NULL) { + if ((entry_ptr != cache_ptr->pel_head_ptr) && + ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed") - if ((entry_ptr != cache_ptr->pel_tail_ptr) && - ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed") + if ((entry_ptr != cache_ptr->pel_tail_ptr) && + ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed") - if (!entry_ptr->is_pinned) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed") + if (!entry_ptr->is_pinned) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed") - if (!(entry_ptr->pinned_from_client || entry_ptr->pinned_from_cache)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed") + if (!(entry_ptr->pinned_from_client || entry_ptr->pinned_from_cache)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed") - len++; - size += entry_ptr->size; - entry_ptr = entry_ptr->next; - } + len++; + size += entry_ptr->size; + entry_ptr = entry_ptr->next; + } - if ((cache_ptr->pel_len != len) || (cache_ptr->pel_size != size)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 9 failed") + if ((cache_ptr->pel_len != len) || (cache_ptr->pel_size != size)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 9 failed") done: - if (ret_value != SUCCEED) - HDassert(0); + if (ret_value != SUCCEED) + HDassert(0); - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__validate_pinned_entry_list() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__validate_pinned_entry_list() */ #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /*------------------------------------------------------------------------- @@ -7070,65 +7130,66 @@ done: *------------------------------------------------------------------------- */ #if H5C_DO_EXTREME_SANITY_CHECKS - static herr_t H5C__validate_protected_entry_list(H5C_t * cache_ptr) - { - int32_t len = 0; - size_t size = 0; - H5C_cache_entry_t *entry_ptr = NULL; - herr_t ret_value = SUCCEED; /* Return value */ +static herr_t +H5C__validate_protected_entry_list(H5C_t *cache_ptr) +{ + int32_t len = 0; + size_t size = 0; + H5C_cache_entry_t *entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - if (((cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_tail_ptr == NULL)) && - (cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed") + if (((cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_tail_ptr == NULL)) && + (cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 1 failed") - if (cache_ptr->pl_len < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed") + if (cache_ptr->pl_len < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 2 failed") - if ((cache_ptr->pl_len == 1) && - ((cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr) || (cache_ptr->pl_head_ptr == NULL) || - (cache_ptr->pl_head_ptr->size != cache_ptr->pl_size))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed") + if ((cache_ptr->pl_len == 1) && + ((cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr) || (cache_ptr->pl_head_ptr == NULL) || + (cache_ptr->pl_head_ptr->size != cache_ptr->pl_size))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 3 failed") - if ((cache_ptr->pl_len >= 1) && - ((cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_head_ptr->prev != NULL) || - (cache_ptr->pl_tail_ptr == NULL) || (cache_ptr->pl_tail_ptr->next != NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed") + if ((cache_ptr->pl_len >= 1) && + ((cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_head_ptr->prev != NULL) || + (cache_ptr->pl_tail_ptr == NULL) || (cache_ptr->pl_tail_ptr->next != NULL))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 4 failed") - entry_ptr = cache_ptr->pl_head_ptr; - while (entry_ptr != NULL) { - if ((entry_ptr != cache_ptr->pl_head_ptr) && - ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed") + entry_ptr = cache_ptr->pl_head_ptr; + while (entry_ptr != NULL) { + if ((entry_ptr != cache_ptr->pl_head_ptr) && + ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 5 failed") - if ((entry_ptr != cache_ptr->pl_tail_ptr) && - ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed") + if ((entry_ptr != cache_ptr->pl_tail_ptr) && + ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 6 failed") - if (!entry_ptr->is_protected) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed") + if (!entry_ptr->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 7 failed") - if (entry_ptr->is_read_only && (entry_ptr->ro_ref_count <= 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed") + if (entry_ptr->is_read_only && (entry_ptr->ro_ref_count <= 0)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 8 failed") - len++; - size += entry_ptr->size; - entry_ptr = entry_ptr->next; - } + len++; + size += entry_ptr->size; + entry_ptr = entry_ptr->next; + } - if ((cache_ptr->pl_len != len) || (cache_ptr->pl_size != size)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 9 failed") + if ((cache_ptr->pl_len != len) || (cache_ptr->pl_size != size)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Check 9 failed") done: - if (ret_value != SUCCEED) - HDassert(0); + if (ret_value != SUCCEED) + HDassert(0); - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__validate_protected_entry_list() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__validate_protected_entry_list() */ #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /*------------------------------------------------------------------------- @@ -7147,782 +7208,721 @@ done: *------------------------------------------------------------------------- */ #if H5C_DO_SLIST_SANITY_CHECKS - static hbool_t H5C__entry_in_skip_list(H5C_t * cache_ptr, H5C_cache_entry_t * target_ptr) - { - H5SL_node_t *node_ptr; - hbool_t in_slist; +static hbool_t +H5C__entry_in_skip_list(H5C_t *cache_ptr, H5C_cache_entry_t *target_ptr) +{ + H5SL_node_t *node_ptr; + hbool_t in_slist; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->slist_ptr); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(cache_ptr->slist_ptr); - node_ptr = H5SL_first(cache_ptr->slist_ptr); - in_slist = FALSE; - while ((node_ptr != NULL) && (!in_slist)) { - H5C_cache_entry_t *entry_ptr; + node_ptr = H5SL_first(cache_ptr->slist_ptr); + in_slist = FALSE; + while ((node_ptr != NULL) && (!in_slist)) { + H5C_cache_entry_t *entry_ptr; - entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - HDassert(entry_ptr); - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->is_dirty); - HDassert(entry_ptr->in_slist); + HDassert(entry_ptr); + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->is_dirty); + HDassert(entry_ptr->in_slist); - if (entry_ptr == target_ptr) - in_slist = TRUE; - else - node_ptr = H5SL_next(node_ptr); - } + if (entry_ptr == target_ptr) + in_slist = TRUE; + else + node_ptr = H5SL_next(node_ptr); + } - return (in_slist); - } /* H5C__entry_in_skip_list() */ + return (in_slist); +} /* H5C__entry_in_skip_list() */ #endif /* H5C_DO_SLIST_SANITY_CHECKS */ - /*------------------------------------------------------------------------- - * - * Function: H5C__flush_marked_entries - * - * Purpose: Flushes all marked entries in the cache. - * - * Return: FAIL if error is detected, SUCCEED otherwise. - * - * Programmer: Mike McGreevy - * November 3, 2010 - * - *------------------------------------------------------------------------- - */ - herr_t H5C__flush_marked_entries(H5F_t * f) - { - herr_t ret_value = SUCCEED; +/*------------------------------------------------------------------------- + * + * Function: H5C__flush_marked_entries + * + * Purpose: Flushes all marked entries in the cache. + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + * Programmer: Mike McGreevy + * November 3, 2010 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C__flush_marked_entries(H5F_t *f) +{ + herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE + FUNC_ENTER_PACKAGE - /* Assertions */ - HDassert(f != NULL); + /* Assertions */ + HDassert(f != NULL); - /* Flush all marked entries */ - if (H5C_flush_cache(f, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_IGNORE_PROTECTED_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache") + /* Flush all marked entries */ + if (H5C_flush_cache(f, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_IGNORE_PROTECTED_FLAG) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache") done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__flush_marked_entries */ - - /*------------------------------------------------------------------------- - * - * Function: H5C_cork - * - * Purpose: To cork/uncork/get cork status of an object depending on "action": - * H5C__SET_CORK: - * To cork the object - * Return error if the object is already corked - * H5C__UNCORK: - * To uncork the obejct - * Return error if the object is not corked - * H5C__GET_CORKED: - * To retrieve the cork status of an object in - * the parameter "corked" - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Vailin Choi - * January 2014 - * - *------------------------------------------------------------------------- - */ - herr_t H5C_cork(H5C_t * cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked) - { - H5C_tag_info_t *tag_info; /* Points to a tag info struct */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__flush_marked_entries */ - /* Assertions */ - HDassert(cache_ptr != NULL); - HDassert(H5F_addr_defined(obj_addr)); - HDassert(action == H5C__SET_CORK || action == H5C__UNCORK || action == H5C__GET_CORKED); +/*------------------------------------------------------------------------- + * + * Function: H5C_cork + * + * Purpose: To cork/uncork/get cork status of an object depending on "action": + * H5C__SET_CORK: + * To cork the object + * Return error if the object is already corked + * H5C__UNCORK: + * To uncork the obejct + * Return error if the object is not corked + * H5C__GET_CORKED: + * To retrieve the cork status of an object in + * the parameter "corked" + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Vailin Choi + * January 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked) +{ + H5C_tag_info_t *tag_info; /* Points to a tag info struct */ + herr_t ret_value = SUCCEED; - /* Search the list of corked object addresses in the cache */ - tag_info = (H5C_tag_info_t *)H5SL_search(cache_ptr->tag_list, &obj_addr); + FUNC_ENTER_NOAPI_NOINIT - if (H5C__GET_CORKED == action) { - HDassert(corked); - if (tag_info != NULL && tag_info->corked) - *corked = TRUE; - else - *corked = FALSE; - } /* end if */ - else { - /* Sanity check */ - HDassert(H5C__SET_CORK == action || H5C__UNCORK == action); - - /* Perform appropriate action */ - if (H5C__SET_CORK == action) { - /* Check if this is the first entry for this tagged object */ - if (NULL == tag_info) { - /* Allocate new tag info struct */ - if (NULL == (tag_info = H5FL_CALLOC(H5C_tag_info_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate tag info for cache entry") - - /* Set the tag for all entries */ - tag_info->tag = obj_addr; - - /* Insert tag info into skip list */ - if (H5SL_insert(cache_ptr->tag_list, tag_info, &(tag_info->tag)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert tag info in skip list") - } /* end if */ - else { - /* Check for object already corked */ - if (tag_info->corked) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCORK, FAIL, "object already corked") - HDassert(tag_info->entry_cnt > 0 && tag_info->head); - } /* end else */ + /* Assertions */ + HDassert(cache_ptr != NULL); + HDassert(H5F_addr_defined(obj_addr)); + HDassert(action == H5C__SET_CORK || action == H5C__UNCORK || action == H5C__GET_CORKED); - /* Set the corked status for the entire object */ - tag_info->corked = TRUE; - cache_ptr->num_objs_corked++; + /* Search the list of corked object addresses in the cache */ + tag_info = (H5C_tag_info_t *)H5SL_search(cache_ptr->tag_list, &obj_addr); + if (H5C__GET_CORKED == action) { + HDassert(corked); + if (tag_info != NULL && tag_info->corked) + *corked = TRUE; + else + *corked = FALSE; + } /* end if */ + else { + /* Sanity check */ + HDassert(H5C__SET_CORK == action || H5C__UNCORK == action); + + /* Perform appropriate action */ + if (H5C__SET_CORK == action) { + /* Check if this is the first entry for this tagged object */ + if (NULL == tag_info) { + /* Allocate new tag info struct */ + if (NULL == (tag_info = H5FL_CALLOC(H5C_tag_info_t))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate tag info for cache entry") + + /* Set the tag for all entries */ + tag_info->tag = obj_addr; + + /* Insert tag info into skip list */ + if (H5SL_insert(cache_ptr->tag_list, tag_info, &(tag_info->tag)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert tag info in skip list") } /* end if */ else { - /* Sanity check */ - HDassert(tag_info); + /* Check for object already corked */ + if (tag_info->corked) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCORK, FAIL, "object already corked") + HDassert(tag_info->entry_cnt > 0 && tag_info->head); + } /* end else */ - /* Check for already uncorked */ - if (!tag_info->corked) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNCORK, FAIL, "object already uncorked") + /* Set the corked status for the entire object */ + tag_info->corked = TRUE; + cache_ptr->num_objs_corked++; - /* Set the corked status for the entire object */ - tag_info->corked = FALSE; - cache_ptr->num_objs_corked--; + } /* end if */ + else { + /* Sanity check */ + HDassert(tag_info); - /* Remove the tag info from the tag list, if there's no more entries with this tag */ - if (0 == tag_info->entry_cnt) { - /* Sanity check */ - HDassert(NULL == tag_info->head); + /* Check for already uncorked */ + if (!tag_info->corked) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNCORK, FAIL, "object already uncorked") - if (H5SL_remove(cache_ptr->tag_list, &(tag_info->tag)) != tag_info) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove tag info from list") + /* Set the corked status for the entire object */ + tag_info->corked = FALSE; + cache_ptr->num_objs_corked--; - /* Release the tag info */ - tag_info = H5FL_FREE(H5C_tag_info_t, tag_info); - } /* end if */ - else - HDassert(NULL != tag_info->head); - } /* end else */ - } /* end else */ + /* Remove the tag info from the tag list, if there's no more entries with this tag */ + if (0 == tag_info->entry_cnt) { + /* Sanity check */ + HDassert(NULL == tag_info->head); -done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_cork() */ + if (H5SL_remove(cache_ptr->tag_list, &(tag_info->tag)) != tag_info) + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove tag info from list") - /*------------------------------------------------------------------------- - * Function: H5C__mark_flush_dep_dirty() - * - * Purpose: Recursively propagate the flush_dep_ndirty_children flag - * up the dependency chain in response to entry either - * becoming dirty or having its flush_dep_ndirty_children - * increased from 0. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * 11/13/12 - * - *------------------------------------------------------------------------- - */ - static herr_t H5C__mark_flush_dep_dirty(H5C_cache_entry_t * entry) - { - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + /* Release the tag info */ + tag_info = H5FL_FREE(H5C_tag_info_t, tag_info); + } /* end if */ + else + HDassert(NULL != tag_info->head); + } /* end else */ + } /* end else */ - FUNC_ENTER_STATIC +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_cork() */ - /* Sanity checks */ - HDassert(entry); +/*------------------------------------------------------------------------- + * Function: H5C__mark_flush_dep_dirty() + * + * Purpose: Recursively propagate the flush_dep_ndirty_children flag + * up the dependency chain in response to entry either + * becoming dirty or having its flush_dep_ndirty_children + * increased from 0. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * 11/13/12 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__mark_flush_dep_dirty(H5C_cache_entry_t *entry) +{ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ - /* Iterate over the parent entries, if any */ - for (u = 0; u < entry->flush_dep_nparents; u++) { - /* Sanity check */ - HDassert(entry->flush_dep_parent[u]->flush_dep_ndirty_children < - entry->flush_dep_parent[u]->flush_dep_nchildren); + FUNC_ENTER_STATIC - /* Adjust the parent's number of dirty children */ - entry->flush_dep_parent[u]->flush_dep_ndirty_children++; + /* Sanity checks */ + HDassert(entry); - /* If the parent has a 'notify' callback, send a 'child entry dirtied' notice */ - if (entry->flush_dep_parent[u]->type->notify && - (entry->flush_dep_parent[u]->type->notify)(H5C_NOTIFY_ACTION_CHILD_DIRTIED, - entry->flush_dep_parent[u]) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify parent about child entry dirty flag set") - } /* end for */ + /* Iterate over the parent entries, if any */ + for (u = 0; u < entry->flush_dep_nparents; u++) { + /* Sanity check */ + HDassert(entry->flush_dep_parent[u]->flush_dep_ndirty_children < + entry->flush_dep_parent[u]->flush_dep_nchildren); + + /* Adjust the parent's number of dirty children */ + entry->flush_dep_parent[u]->flush_dep_ndirty_children++; + + /* If the parent has a 'notify' callback, send a 'child entry dirtied' notice */ + if (entry->flush_dep_parent[u]->type->notify && + (entry->flush_dep_parent[u]->type->notify)(H5C_NOTIFY_ACTION_CHILD_DIRTIED, + entry->flush_dep_parent[u]) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify parent about child entry dirty flag set") + } /* end for */ done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__mark_flush_dep_dirty() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__mark_flush_dep_dirty() */ - /*------------------------------------------------------------------------- - * Function: H5C__mark_flush_dep_clean() - * - * Purpose: Recursively propagate the flush_dep_ndirty_children flag - * up the dependency chain in response to entry either - * becoming clean or having its flush_dep_ndirty_children - * reduced to 0. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * 11/13/12 - * - *------------------------------------------------------------------------- - */ - static herr_t H5C__mark_flush_dep_clean(H5C_cache_entry_t * entry) - { - int i; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ +/*------------------------------------------------------------------------- + * Function: H5C__mark_flush_dep_clean() + * + * Purpose: Recursively propagate the flush_dep_ndirty_children flag + * up the dependency chain in response to entry either + * becoming clean or having its flush_dep_ndirty_children + * reduced to 0. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * 11/13/12 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__mark_flush_dep_clean(H5C_cache_entry_t *entry) +{ + int i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC - /* Sanity checks */ - HDassert(entry); + /* Sanity checks */ + HDassert(entry); - /* Iterate over the parent entries, if any */ - /* Note reverse iteration order, in case the callback removes the flush - * dependency - QAK, 2017/08/12 - */ - for (i = ((int)entry->flush_dep_nparents) - 1; i >= 0; i--) { - /* Sanity check */ - HDassert(entry->flush_dep_parent[i]->flush_dep_ndirty_children > 0); + /* Iterate over the parent entries, if any */ + /* Note reverse iteration order, in case the callback removes the flush + * dependency - QAK, 2017/08/12 + */ + for (i = ((int)entry->flush_dep_nparents) - 1; i >= 0; i--) { + /* Sanity check */ + HDassert(entry->flush_dep_parent[i]->flush_dep_ndirty_children > 0); - /* Adjust the parent's number of dirty children */ - entry->flush_dep_parent[i]->flush_dep_ndirty_children--; + /* Adjust the parent's number of dirty children */ + entry->flush_dep_parent[i]->flush_dep_ndirty_children--; - /* If the parent has a 'notify' callback, send a 'child entry cleaned' notice */ - if (entry->flush_dep_parent[i]->type->notify && - (entry->flush_dep_parent[i]->type->notify)(H5C_NOTIFY_ACTION_CHILD_CLEANED, - entry->flush_dep_parent[i]) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify parent about child entry dirty flag reset") - } /* end for */ + /* If the parent has a 'notify' callback, send a 'child entry cleaned' notice */ + if (entry->flush_dep_parent[i]->type->notify && + (entry->flush_dep_parent[i]->type->notify)(H5C_NOTIFY_ACTION_CHILD_CLEANED, + entry->flush_dep_parent[i]) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify parent about child entry dirty flag reset") + } /* end for */ done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__mark_flush_dep_clean() */ - - /*------------------------------------------------------------------------- - * Function: H5C__mark_flush_dep_serialized() - * - * Purpose: Decrement the flush_dep_nunser_children fields of all the - * target entry's flush dependency parents in response to - * the target entry becoming serialized. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 8/30/16 - * - *------------------------------------------------------------------------- - */ - herr_t H5C__mark_flush_dep_serialized(H5C_cache_entry_t * entry_ptr) - { - int i; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__mark_flush_dep_clean() */ - /* Sanity checks */ - HDassert(entry_ptr); +/*------------------------------------------------------------------------- + * Function: H5C__mark_flush_dep_serialized() + * + * Purpose: Decrement the flush_dep_nunser_children fields of all the + * target entry's flush dependency parents in response to + * the target entry becoming serialized. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * 8/30/16 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C__mark_flush_dep_serialized(H5C_cache_entry_t *entry_ptr) +{ + int i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ - /* Iterate over the parent entries, if any */ - /* Note reverse iteration order, in case the callback removes the flush - * dependency - QAK, 2017/08/12 - */ - for (i = ((int)entry_ptr->flush_dep_nparents) - 1; i >= 0; i--) { - /* Sanity checks */ - HDassert(entry_ptr->flush_dep_parent); - HDassert(entry_ptr->flush_dep_parent[i]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->flush_dep_parent[i]->flush_dep_nunser_children > 0); + FUNC_ENTER_STATIC - /* decrement the parents number of unserialized children */ - entry_ptr->flush_dep_parent[i]->flush_dep_nunser_children--; + /* Sanity checks */ + HDassert(entry_ptr); - /* If the parent has a 'notify' callback, send a 'child entry serialized' notice */ - if (entry_ptr->flush_dep_parent[i]->type->notify && - (entry_ptr->flush_dep_parent[i]->type->notify)(H5C_NOTIFY_ACTION_CHILD_SERIALIZED, - entry_ptr->flush_dep_parent[i]) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify parent about child entry serialized flag set") - } /* end for */ + /* Iterate over the parent entries, if any */ + /* Note reverse iteration order, in case the callback removes the flush + * dependency - QAK, 2017/08/12 + */ + for (i = ((int)entry_ptr->flush_dep_nparents) - 1; i >= 0; i--) { + /* Sanity checks */ + HDassert(entry_ptr->flush_dep_parent); + HDassert(entry_ptr->flush_dep_parent[i]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->flush_dep_parent[i]->flush_dep_nunser_children > 0); + + /* decrement the parents number of unserialized children */ + entry_ptr->flush_dep_parent[i]->flush_dep_nunser_children--; + + /* If the parent has a 'notify' callback, send a 'child entry serialized' notice */ + if (entry_ptr->flush_dep_parent[i]->type->notify && + (entry_ptr->flush_dep_parent[i]->type->notify)(H5C_NOTIFY_ACTION_CHILD_SERIALIZED, + entry_ptr->flush_dep_parent[i]) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify parent about child entry serialized flag set") + } /* end for */ done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__mark_flush_dep_serialized() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__mark_flush_dep_serialized() */ - /*------------------------------------------------------------------------- - * Function: H5C__mark_flush_dep_unserialized() - * - * Purpose: Increment the flush_dep_nunser_children fields of all the - * target entry's flush dependency parents in response to - * the target entry becoming unserialized. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 8/30/16 - * - *------------------------------------------------------------------------- - */ - herr_t H5C__mark_flush_dep_unserialized(H5C_cache_entry_t * entry_ptr) - { - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ +/*------------------------------------------------------------------------- + * Function: H5C__mark_flush_dep_unserialized() + * + * Purpose: Increment the flush_dep_nunser_children fields of all the + * target entry's flush dependency parents in response to + * the target entry becoming unserialized. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer + * 8/30/16 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C__mark_flush_dep_unserialized(H5C_cache_entry_t *entry_ptr) +{ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC - /* Sanity checks */ - HDassert(entry_ptr); + /* Sanity checks */ + HDassert(entry_ptr); - /* Iterate over the parent entries, if any */ - for (u = 0; u < entry_ptr->flush_dep_nparents; u++) { - /* Sanity check */ - HDassert(entry_ptr->flush_dep_parent); - HDassert(entry_ptr->flush_dep_parent[u]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->flush_dep_parent[u]->flush_dep_nunser_children < - entry_ptr->flush_dep_parent[u]->flush_dep_nchildren); - - /* increment parents number of usserialized children */ - entry_ptr->flush_dep_parent[u]->flush_dep_nunser_children++; - - /* If the parent has a 'notify' callback, send a 'child entry unserialized' notice */ - if (entry_ptr->flush_dep_parent[u]->type->notify && - (entry_ptr->flush_dep_parent[u]->type->notify)(H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED, - entry_ptr->flush_dep_parent[u]) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify parent about child entry serialized flag reset") - } /* end for */ + /* Iterate over the parent entries, if any */ + for (u = 0; u < entry_ptr->flush_dep_nparents; u++) { + /* Sanity check */ + HDassert(entry_ptr->flush_dep_parent); + HDassert(entry_ptr->flush_dep_parent[u]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->flush_dep_parent[u]->flush_dep_nunser_children < + entry_ptr->flush_dep_parent[u]->flush_dep_nchildren); + + /* increment parents number of usserialized children */ + entry_ptr->flush_dep_parent[u]->flush_dep_nunser_children++; + + /* If the parent has a 'notify' callback, send a 'child entry unserialized' notice */ + if (entry_ptr->flush_dep_parent[u]->type->notify && + (entry_ptr->flush_dep_parent[u]->type->notify)(H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED, + entry_ptr->flush_dep_parent[u]) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify parent about child entry serialized flag reset") + } /* end for */ done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__mark_flush_dep_unserialized() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__mark_flush_dep_unserialized() */ #ifndef NDEBUG - /*------------------------------------------------------------------------- - * Function: H5C__assert_flush_dep_nocycle() - * - * Purpose: Assert recursively that base_entry is not the same as - * entry, and perform the same assertion on all of entry's - * flush dependency parents. This is used to detect cycles - * created by flush dependencies. - * - * Return: void - * - * Programmer: Neil Fortner - * 12/10/12 - * - *------------------------------------------------------------------------- - */ - static void H5C__assert_flush_dep_nocycle(const H5C_cache_entry_t *entry, - const H5C_cache_entry_t *base_entry) - { - unsigned u; /* Local index variable */ +/*------------------------------------------------------------------------- + * Function: H5C__assert_flush_dep_nocycle() + * + * Purpose: Assert recursively that base_entry is not the same as + * entry, and perform the same assertion on all of entry's + * flush dependency parents. This is used to detect cycles + * created by flush dependencies. + * + * Return: void + * + * Programmer: Neil Fortner + * 12/10/12 + * + *------------------------------------------------------------------------- + */ +static void +H5C__assert_flush_dep_nocycle(const H5C_cache_entry_t *entry, const H5C_cache_entry_t *base_entry) +{ + unsigned u; /* Local index variable */ - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_STATIC_NOERR - /* Sanity checks */ - HDassert(entry); - HDassert(base_entry); + /* Sanity checks */ + HDassert(entry); + HDassert(base_entry); - /* Make sure the entries are not the same */ - HDassert(base_entry != entry); + /* Make sure the entries are not the same */ + HDassert(base_entry != entry); - /* Iterate over entry's parents (if any) */ - for (u = 0; u < entry->flush_dep_nparents; u++) - H5C__assert_flush_dep_nocycle(entry->flush_dep_parent[u], base_entry); + /* Iterate over entry's parents (if any) */ + for (u = 0; u < entry->flush_dep_nparents; u++) + H5C__assert_flush_dep_nocycle(entry->flush_dep_parent[u], base_entry); - FUNC_LEAVE_NOAPI_VOID - } /* H5C__assert_flush_dep_nocycle() */ + FUNC_LEAVE_NOAPI_VOID +} /* H5C__assert_flush_dep_nocycle() */ #endif /* NDEBUG */ - /*------------------------------------------------------------------------- - * Function: H5C__serialize_cache - * - * Purpose: Serialize (i.e. construct an on disk image) for all entries - * in the metadata cache including clean entries. - * - * Note that flush dependencies and "flush me last" flags - * must be observed in the serialization process. - * - * Note also that entries may be loaded, flushed, evicted, - * expunged, relocated, resized, or removed from the cache - * during this process, just as these actions may occur during - * a regular flush. - * - * However, we are given that the cache will contain no protected - * entries on entry to this routine (although entries may be - * briefly protected and then unprotected during the serialize - * process). - * - * The objective of this routine is serialize all entries and - * to force all entries into their actual locations on disk. - * - * The initial need for this routine is to settle all entries - * in the cache prior to construction of the metadata cache - * image so that the size of the cache image can be calculated. - * However, I gather that other uses for the routine are - * under consideration. - * - * 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 - * 7/22/15 - * - *------------------------------------------------------------------------- - */ - herr_t H5C__serialize_cache(H5F_t * f) - { +/*------------------------------------------------------------------------- + * Function: H5C__serialize_cache + * + * Purpose: Serialize (i.e. construct an on disk image) for all entries + * in the metadata cache including clean entries. + * + * Note that flush dependencies and "flush me last" flags + * must be observed in the serialization process. + * + * Note also that entries may be loaded, flushed, evicted, + * expunged, relocated, resized, or removed from the cache + * during this process, just as these actions may occur during + * a regular flush. + * + * However, we are given that the cache will contain no protected + * entries on entry to this routine (although entries may be + * briefly protected and then unprotected during the serialize + * process). + * + * The objective of this routine is serialize all entries and + * to force all entries into their actual locations on disk. + * + * The initial need for this routine is to settle all entries + * in the cache prior to construction of the metadata cache + * image so that the size of the cache image can be calculated. + * However, I gather that other uses for the routine are + * under consideration. + * + * 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 + * 7/22/15 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C__serialize_cache(H5F_t *f) +{ #if H5C_DO_SANITY_CHECKS - int i; - uint32_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; - uint32_t slist_len = 0; + int i; + uint32_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; + uint32_t slist_len = 0; #endif /* H5C_DO_SANITY_CHECKS */ - H5C_ring_t ring; - H5C_t * cache_ptr; - herr_t ret_value = SUCCEED; + H5C_ring_t ring; + H5C_t * cache_ptr; + herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE + FUNC_ENTER_PACKAGE - /* Sanity checks */ - 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); + /* Sanity checks */ + 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 - 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); + 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]; + 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 */ + 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); + 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") + 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") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ #ifndef NDEBUG - /* if this is a debug build, set the serialization_count field of - * each entry in the cache to zero before we start the serialization. - * This allows us to detect the case in which any entry is serialized - * more than once (a performance issues), and more importantly, the - * case is which any flush depencency parent is serializes more than - * once (a correctness issue). - */ - { - H5C_cache_entry_t *scan_ptr = NULL; - - scan_ptr = cache_ptr->il_head; - while (scan_ptr != NULL) { - HDassert(scan_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - scan_ptr->serialization_count = 0; - scan_ptr = scan_ptr->il_next; - } /* end while */ - } /* end block */ -#endif /* NDEBUG */ - - /* set cache_ptr->serialization_in_progress to TRUE, and back - * to FALSE at the end of the function. Must maintain this flag - * to support H5C_get_serialization_in_progress(), which is in - * turn required to support sanity checking in some cache - * clients. - */ - HDassert(!cache_ptr->serialization_in_progress); - cache_ptr->serialization_in_progress = TRUE; - - /* Serialize each ring, starting from the outermost ring and - * working inward. - */ - ring = H5C_RING_USER; - while (ring < H5C_RING_NTYPES) { - HDassert(cache_ptr->close_warning_received); - switch (ring) { - case H5C_RING_USER: - break; - - case H5C_RING_RDFSM: - /* Settle raw data FSM */ - if (!cache_ptr->rdfsm_settled) - if (H5MF_settle_raw_data_fsm(f, &cache_ptr->rdfsm_settled) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "RD FSM settle failed") - break; - - case H5C_RING_MDFSM: - /* Settle metadata FSM */ - if (!cache_ptr->mdfsm_settled) - if (H5MF_settle_meta_data_fsm(f, &cache_ptr->mdfsm_settled) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "MD FSM settle failed") - break; - - case H5C_RING_SBE: - case H5C_RING_SB: - break; - - default: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown ring?!?!") - break; - } /* end switch */ - - if (H5C__serialize_ring(f, ring) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "serialize ring failed") + /* if this is a debug build, set the serialization_count field of + * each entry in the cache to zero before we start the serialization. + * This allows us to detect the case in which any entry is serialized + * more than once (a performance issues), and more importantly, the + * case is which any flush depencency parent is serializes more than + * once (a correctness issue). + */ + { + H5C_cache_entry_t *scan_ptr = NULL; - ring++; + scan_ptr = cache_ptr->il_head; + while (scan_ptr != NULL) { + HDassert(scan_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + scan_ptr->serialization_count = 0; + scan_ptr = scan_ptr->il_next; } /* end while */ + } /* end block */ +#endif /* NDEBUG */ -#ifndef NDEBUG - /* Verify that no entry has been serialized more than once. - * FD parents with multiple serializations should have been caught - * elsewhere, so no specific check for them here. - */ - { - H5C_cache_entry_t *scan_ptr = NULL; - - scan_ptr = cache_ptr->il_head; - while (scan_ptr != NULL) { - HDassert(scan_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(scan_ptr->serialization_count <= 1); - - scan_ptr = scan_ptr->il_next; - } /* end while */ - } /* end block */ -#endif /* NDEBUG */ - -done: - cache_ptr->serialization_in_progress = FALSE; - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__serialize_cache() */ - - /*------------------------------------------------------------------------- - * Function: H5C__serialize_ring - * - * Purpose: Serialize the entries contained in the specified cache and - * ring. All entries in rings outside the specified ring - * must have been serialized on entry. - * - * If the cache contains protected entries in the specified - * ring, the function will fail, as protected entries cannot - * be serialized. However all unprotected entries in the - * target ring should be serialized before the function - * returns failure. - * - * If flush dependencies appear in the target ring, the - * function makes repeated passes through the index list - * serializing entries in flush dependency order. - * - * All entries outside the H5C_RING_SBE are marked for - * inclusion in the cache image. Entries in H5C_RING_SBE - * and below are marked for exclusion from the image. - * - * 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/11/15 - * - *------------------------------------------------------------------------- + /* set cache_ptr->serialization_in_progress to TRUE, and back + * to FALSE at the end of the function. Must maintain this flag + * to support H5C_get_serialization_in_progress(), which is in + * turn required to support sanity checking in some cache + * clients. */ - static herr_t H5C__serialize_ring(H5F_t * f, H5C_ring_t ring) - { - hbool_t done = FALSE; - H5C_t * cache_ptr; - H5C_cache_entry_t *entry_ptr; - herr_t ret_value = SUCCEED; + HDassert(!cache_ptr->serialization_in_progress); + cache_ptr->serialization_in_progress = TRUE; - FUNC_ENTER_STATIC - - /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(ring > H5C_RING_UNDEFINED); - HDassert(ring < H5C_RING_NTYPES); - - HDassert(cache_ptr->serialization_in_progress); - - /* The objective here is to serialize all entries in the cache ring - * in flush dependency order. - * - * The basic algorithm is to scan the cache index list looking for - * unserialized entries that are either not in a flush dependency - * relationship, or which have no unserialized children. Any such - * entry is serialized and its flush dependency parents (if any) are - * informed -- allowing them to decrement their userialized child counts. - * - * However, this algorithm is complicated by the ability - * of client serialization callbacks to perform operations on - * on the cache which can result in the insertion, deletion, - * relocation, resize, dirty, flush, eviction, or removal (via the - * take ownership flag) of entries. Changes in the flush dependency - * structure are also possible. - * - * On the other hand, the algorithm is simplified by the fact that - * we are serializing, not flushing. Thus, as long as all entries - * are serialized correctly, it doesn't matter if we have to go back - * and serialize an entry a second time. - * - * These possible actions result in the following modfications to - * tha basic algorithm: - * - * 1) In the event of an entry expunge, eviction or removal, we must - * restart the scan as it is possible that the next entry in our - * scan is no longer in the cache. Were we to examine this entry, - * we would be accessing deallocated memory. - * - * 2) A resize, dirty, or insertion of an entry may result in the - * the increment of a flush dependency parent's dirty and/or - * unserialized child count. In the context of serializing the - * the cache, this is a non-issue, as even if we have already - * serialized the parent, it will be marked dirty and its image - * marked out of date if appropriate when the child is serialized. - * - * However, this is a major issue for a flush, as were this to happen - * in a flush, it would violate the invariant that the flush dependency - * feature is intended to enforce. As the metadata cache has no - * control over the behavior of cache clients, it has no way of - * preventing this behaviour. However, it should detect it if at all - * possible. - * - * Do this by maintaining a count of the number of times each entry is - * serialized during a cache serialization. If any flush dependency - * parent is serialized more than once, throw an assertion failure. - * - * 3) An entry relocation will typically change the location of the - * entry in the index list. This shouldn't cause problems as we - * will scan the index list until we make a complete pass without - * finding anything to serialize -- making relocations of either - * the current or next entries irrelevant. - * - * Note that since a relocation may result in our skipping part of - * the index list, we must always do at least one more pass through - * the index list after an entry relocation. - * - * 4) Changes in the flush dependency structure are possible on - * entry insertion, load, expunge, evict, or remove. Destruction - * of a flush dependency has no effect, as it can only relax the - * flush dependencies. Creation of a flush dependency can create - * an unserialized child of a flush dependency parent where all - * flush dependency children were previously serialized. Should - * this child dirty the flush dependency parent when it is serialized, - * the parent will be re-serialized. - * - * Per the discussion of 2) above, this is a non issue for cache - * serialization, and a major problem for cache flush. Using the - * same detection mechanism, throw an assertion failure if this - * condition appears. - * - * Observe that either eviction or removal of entries as a result of - * a serialization is not a problem as long as the flush depencency - * tree does not change beyond the removal of a leaf. - */ - while (!done) { - /* Reset the counters so that we can detect insertions, loads, - * moves, and flush dependency height changes caused by the pre_serialize - * and serialize callbacks. - */ - cache_ptr->entries_loaded_counter = 0; - cache_ptr->entries_inserted_counter = 0; - cache_ptr->entries_relocated_counter = 0; - - done = TRUE; /* set to FALSE if any activity in inner loop */ - entry_ptr = cache_ptr->il_head; - while (entry_ptr != NULL) { - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - - /* Verify that either the entry is already serialized, or - * that it is assigned to either the target or an inner - * ring. - */ - HDassert((entry_ptr->ring >= ring) || (entry_ptr->image_up_to_date)); + /* Serialize each ring, starting from the outermost ring and + * working inward. + */ + ring = H5C_RING_USER; + while (ring < H5C_RING_NTYPES) { + HDassert(cache_ptr->close_warning_received); + switch (ring) { + case H5C_RING_USER: + break; - /* Skip flush me last entries or inner ring entries */ - if (!entry_ptr->flush_me_last && entry_ptr->ring == ring) { + case H5C_RING_RDFSM: + /* Settle raw data FSM */ + if (!cache_ptr->rdfsm_settled) + if (H5MF_settle_raw_data_fsm(f, &cache_ptr->rdfsm_settled) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "RD FSM settle failed") + break; - /* if we encounter an unserialized entry in the current - * ring that is not marked flush me last, we are not done. - */ - if (!entry_ptr->image_up_to_date) - done = FALSE; + case H5C_RING_MDFSM: + /* Settle metadata FSM */ + if (!cache_ptr->mdfsm_settled) + if (H5MF_settle_meta_data_fsm(f, &cache_ptr->mdfsm_settled) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "MD FSM settle failed") + break; - /* Serialize the entry if its image is not up to date - * and it has no unserialized flush dependency children. - */ - if (!entry_ptr->image_up_to_date && entry_ptr->flush_dep_nunser_children == 0) { - HDassert(entry_ptr->serialization_count == 0); + case H5C_RING_SBE: + case H5C_RING_SB: + break; + + default: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown ring?!?!") + break; + } /* end switch */ - /* Serialize the entry */ - if (H5C__serialize_single_entry(f, cache_ptr, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "entry serialization failed") + if (H5C__serialize_ring(f, ring) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "serialize ring failed") - HDassert(entry_ptr->flush_dep_nunser_children == 0); - HDassert(entry_ptr->serialization_count == 0); + ring++; + } /* end while */ #ifndef NDEBUG - /* Increment serialization counter (to detect multiple serializations) */ - entry_ptr->serialization_count++; -#endif /* NDEBUG */ - } /* end if */ - } /* end if */ + /* Verify that no entry has been serialized more than once. + * FD parents with multiple serializations should have been caught + * elsewhere, so no specific check for them here. + */ + { + H5C_cache_entry_t *scan_ptr = NULL; - /* Check for the cache being perturbed during the entry serialize */ - if ((cache_ptr->entries_loaded_counter > 0) || (cache_ptr->entries_inserted_counter > 0) || - (cache_ptr->entries_relocated_counter > 0)) { + scan_ptr = cache_ptr->il_head; + while (scan_ptr != NULL) { + HDassert(scan_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(scan_ptr->serialization_count <= 1); -#if H5C_COLLECT_CACHE_STATS - H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr); -#endif /* H5C_COLLECT_CACHE_STATS */ + scan_ptr = scan_ptr->il_next; + } /* end while */ + } /* end block */ +#endif /* NDEBUG */ - /* Reset the counters */ - cache_ptr->entries_loaded_counter = 0; - cache_ptr->entries_inserted_counter = 0; - cache_ptr->entries_relocated_counter = 0; +done: + cache_ptr->serialization_in_progress = FALSE; + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__serialize_cache() */ - /* Restart scan */ - entry_ptr = cache_ptr->il_head; - } /* end if */ - else - /* Advance to next entry */ - entry_ptr = entry_ptr->il_next; - } /* while ( entry_ptr != NULL ) */ - } /* while ( ! done ) */ +/*------------------------------------------------------------------------- + * Function: H5C__serialize_ring + * + * Purpose: Serialize the entries contained in the specified cache and + * ring. All entries in rings outside the specified ring + * must have been serialized on entry. + * + * If the cache contains protected entries in the specified + * ring, the function will fail, as protected entries cannot + * be serialized. However all unprotected entries in the + * target ring should be serialized before the function + * returns failure. + * + * If flush dependencies appear in the target ring, the + * function makes repeated passes through the index list + * serializing entries in flush dependency order. + * + * All entries outside the H5C_RING_SBE are marked for + * inclusion in the cache image. Entries in H5C_RING_SBE + * and below are marked for exclusion from the image. + * + * 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/11/15 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__serialize_ring(H5F_t *f, H5C_ring_t ring) +{ + hbool_t done = FALSE; + H5C_t * cache_ptr; + H5C_cache_entry_t *entry_ptr; + herr_t ret_value = SUCCEED; + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(f); + HDassert(f->shared); + cache_ptr = f->shared->cache; + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(ring > H5C_RING_UNDEFINED); + HDassert(ring < H5C_RING_NTYPES); + + HDassert(cache_ptr->serialization_in_progress); + + /* The objective here is to serialize all entries in the cache ring + * in flush dependency order. + * + * The basic algorithm is to scan the cache index list looking for + * unserialized entries that are either not in a flush dependency + * relationship, or which have no unserialized children. Any such + * entry is serialized and its flush dependency parents (if any) are + * informed -- allowing them to decrement their userialized child counts. + * + * However, this algorithm is complicated by the ability + * of client serialization callbacks to perform operations on + * on the cache which can result in the insertion, deletion, + * relocation, resize, dirty, flush, eviction, or removal (via the + * take ownership flag) of entries. Changes in the flush dependency + * structure are also possible. + * + * On the other hand, the algorithm is simplified by the fact that + * we are serializing, not flushing. Thus, as long as all entries + * are serialized correctly, it doesn't matter if we have to go back + * and serialize an entry a second time. + * + * These possible actions result in the following modfications to + * tha basic algorithm: + * + * 1) In the event of an entry expunge, eviction or removal, we must + * restart the scan as it is possible that the next entry in our + * scan is no longer in the cache. Were we to examine this entry, + * we would be accessing deallocated memory. + * + * 2) A resize, dirty, or insertion of an entry may result in the + * the increment of a flush dependency parent's dirty and/or + * unserialized child count. In the context of serializing the + * the cache, this is a non-issue, as even if we have already + * serialized the parent, it will be marked dirty and its image + * marked out of date if appropriate when the child is serialized. + * + * However, this is a major issue for a flush, as were this to happen + * in a flush, it would violate the invariant that the flush dependency + * feature is intended to enforce. As the metadata cache has no + * control over the behavior of cache clients, it has no way of + * preventing this behaviour. However, it should detect it if at all + * possible. + * + * Do this by maintaining a count of the number of times each entry is + * serialized during a cache serialization. If any flush dependency + * parent is serialized more than once, throw an assertion failure. + * + * 3) An entry relocation will typically change the location of the + * entry in the index list. This shouldn't cause problems as we + * will scan the index list until we make a complete pass without + * finding anything to serialize -- making relocations of either + * the current or next entries irrelevant. + * + * Note that since a relocation may result in our skipping part of + * the index list, we must always do at least one more pass through + * the index list after an entry relocation. + * + * 4) Changes in the flush dependency structure are possible on + * entry insertion, load, expunge, evict, or remove. Destruction + * of a flush dependency has no effect, as it can only relax the + * flush dependencies. Creation of a flush dependency can create + * an unserialized child of a flush dependency parent where all + * flush dependency children were previously serialized. Should + * this child dirty the flush dependency parent when it is serialized, + * the parent will be re-serialized. + * + * Per the discussion of 2) above, this is a non issue for cache + * serialization, and a major problem for cache flush. Using the + * same detection mechanism, throw an assertion failure if this + * condition appears. + * + * Observe that either eviction or removal of entries as a result of + * a serialization is not a problem as long as the flush depencency + * tree does not change beyond the removal of a leaf. + */ + while (!done) { /* Reset the counters so that we can detect insertions, loads, * moves, and flush dependency height changes caused by the pre_serialize * and serialize callbacks. @@ -7931,429 +7931,500 @@ done: cache_ptr->entries_inserted_counter = 0; cache_ptr->entries_relocated_counter = 0; - /* At this point, all entries not marked "flush me last" and in - * the current ring or outside it should be serialized and have up - * to date images. Scan the index list again to serialize the - * "flush me last" entries (if they are in the current ring) and to - * verify that all other entries have up to date images. - */ + done = TRUE; /* set to FALSE if any activity in inner loop */ entry_ptr = cache_ptr->il_head; while (entry_ptr != NULL) { HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->ring > H5C_RING_UNDEFINED); - HDassert(entry_ptr->ring < H5C_RING_NTYPES); + + /* Verify that either the entry is already serialized, or + * that it is assigned to either the target or an inner + * ring. + */ HDassert((entry_ptr->ring >= ring) || (entry_ptr->image_up_to_date)); - if (entry_ptr->ring == ring) { - if (entry_ptr->flush_me_last) { - if (!entry_ptr->image_up_to_date) { - HDassert(entry_ptr->serialization_count == 0); - HDassert(entry_ptr->flush_dep_nunser_children == 0); - - /* Serialize the entry */ - if (H5C__serialize_single_entry(f, cache_ptr, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "entry serialization failed") - - /* Check for the cache changing */ - if ((cache_ptr->entries_loaded_counter > 0) || - (cache_ptr->entries_inserted_counter > 0) || - (cache_ptr->entries_relocated_counter > 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, - "flush_me_last entry serialization triggered restart") - - HDassert(entry_ptr->flush_dep_nunser_children == 0); - HDassert(entry_ptr->serialization_count == 0); -#ifndef NDEBUG - /* Increment serialization counter (to detect multiple serializations) */ - entry_ptr->serialization_count++; -#endif /* NDEBUG */ - } /* end if */ - } /* end if */ - else { - HDassert(entry_ptr->image_up_to_date); - HDassert(entry_ptr->serialization_count <= 1); + /* Skip flush me last entries or inner ring entries */ + if (!entry_ptr->flush_me_last && entry_ptr->ring == ring) { + + /* if we encounter an unserialized entry in the current + * ring that is not marked flush me last, we are not done. + */ + if (!entry_ptr->image_up_to_date) + done = FALSE; + + /* Serialize the entry if its image is not up to date + * and it has no unserialized flush dependency children. + */ + if (!entry_ptr->image_up_to_date && entry_ptr->flush_dep_nunser_children == 0) { + HDassert(entry_ptr->serialization_count == 0); + + /* Serialize the entry */ + if (H5C__serialize_single_entry(f, cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "entry serialization failed") + HDassert(entry_ptr->flush_dep_nunser_children == 0); - } /* end else */ - } /* if ( entry_ptr->ring == ring ) */ + HDassert(entry_ptr->serialization_count == 0); + +#ifndef NDEBUG + /* Increment serialization counter (to detect multiple serializations) */ + entry_ptr->serialization_count++; +#endif /* NDEBUG */ + } /* end if */ + } /* end if */ + + /* Check for the cache being perturbed during the entry serialize */ + if ((cache_ptr->entries_loaded_counter > 0) || (cache_ptr->entries_inserted_counter > 0) || + (cache_ptr->entries_relocated_counter > 0)) { + +#if H5C_COLLECT_CACHE_STATS + H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr); +#endif /* H5C_COLLECT_CACHE_STATS */ - entry_ptr = entry_ptr->il_next; + /* Reset the counters */ + cache_ptr->entries_loaded_counter = 0; + cache_ptr->entries_inserted_counter = 0; + cache_ptr->entries_relocated_counter = 0; + + /* Restart scan */ + entry_ptr = cache_ptr->il_head; + } /* end if */ + else + /* Advance to next entry */ + entry_ptr = entry_ptr->il_next; } /* while ( entry_ptr != NULL ) */ + } /* while ( ! done ) */ + + /* Reset the counters so that we can detect insertions, loads, + * moves, and flush dependency height changes caused by the pre_serialize + * and serialize callbacks. + */ + cache_ptr->entries_loaded_counter = 0; + cache_ptr->entries_inserted_counter = 0; + cache_ptr->entries_relocated_counter = 0; + + /* At this point, all entries not marked "flush me last" and in + * the current ring or outside it should be serialized and have up + * to date images. Scan the index list again to serialize the + * "flush me last" entries (if they are in the current ring) and to + * verify that all other entries have up to date images. + */ + entry_ptr = cache_ptr->il_head; + while (entry_ptr != NULL) { + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(entry_ptr->ring > H5C_RING_UNDEFINED); + HDassert(entry_ptr->ring < H5C_RING_NTYPES); + HDassert((entry_ptr->ring >= ring) || (entry_ptr->image_up_to_date)); + + if (entry_ptr->ring == ring) { + if (entry_ptr->flush_me_last) { + if (!entry_ptr->image_up_to_date) { + HDassert(entry_ptr->serialization_count == 0); + HDassert(entry_ptr->flush_dep_nunser_children == 0); + + /* Serialize the entry */ + if (H5C__serialize_single_entry(f, cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "entry serialization failed") + + /* Check for the cache changing */ + if ((cache_ptr->entries_loaded_counter > 0) || + (cache_ptr->entries_inserted_counter > 0) || + (cache_ptr->entries_relocated_counter > 0)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, + "flush_me_last entry serialization triggered restart") + + HDassert(entry_ptr->flush_dep_nunser_children == 0); + HDassert(entry_ptr->serialization_count == 0); +#ifndef NDEBUG + /* Increment serialization counter (to detect multiple serializations) */ + entry_ptr->serialization_count++; +#endif /* NDEBUG */ + } /* end if */ + } /* end if */ + else { + HDassert(entry_ptr->image_up_to_date); + HDassert(entry_ptr->serialization_count <= 1); + HDassert(entry_ptr->flush_dep_nunser_children == 0); + } /* end else */ + } /* if ( entry_ptr->ring == ring ) */ + + entry_ptr = entry_ptr->il_next; + } /* while ( entry_ptr != NULL ) */ done: - HDassert(cache_ptr->serialization_in_progress); - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__serialize_ring() */ + HDassert(cache_ptr->serialization_in_progress); + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__serialize_ring() */ - /*------------------------------------------------------------------------- - * Function: H5C__serialize_single_entry - * - * Purpose: Serialize the cache entry pointed to by the entry_ptr - * parameter. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer, 7/24/15 - * - *------------------------------------------------------------------------- - */ - static herr_t H5C__serialize_single_entry(H5F_t * f, H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr) - { - herr_t ret_value = SUCCEED; /* Return value */ +/*------------------------------------------------------------------------- + * Function: H5C__serialize_single_entry + * + * Purpose: Serialize the cache entry pointed to by the entry_ptr + * parameter. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: John Mainzer, 7/24/15 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__serialize_single_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr) +{ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC - /* Sanity checks */ - HDassert(f); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(entry_ptr); - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(!entry_ptr->prefetched); - HDassert(!entry_ptr->image_up_to_date); - HDassert(entry_ptr->is_dirty); - HDassert(!entry_ptr->is_protected); - HDassert(!entry_ptr->flush_in_progress); - HDassert(entry_ptr->type); + /* Sanity checks */ + HDassert(f); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(entry_ptr); + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(!entry_ptr->prefetched); + HDassert(!entry_ptr->image_up_to_date); + HDassert(entry_ptr->is_dirty); + HDassert(!entry_ptr->is_protected); + HDassert(!entry_ptr->flush_in_progress); + HDassert(entry_ptr->type); - /* Set entry_ptr->flush_in_progress to TRUE so the the target entry - * will not be evicted out from under us. Must set it back to FALSE - * when we are done. - */ - entry_ptr->flush_in_progress = TRUE; + /* Set entry_ptr->flush_in_progress to TRUE so the the target entry + * will not be evicted out from under us. Must set it back to FALSE + * when we are done. + */ + entry_ptr->flush_in_progress = TRUE; - /* Allocate buffer for the entry image if required. */ - if (NULL == entry_ptr->image_ptr) { - HDassert(entry_ptr->size > 0); - if (NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, - "memory allocation failed for on disk image buffer") + /* Allocate buffer for the entry image if required. */ + if (NULL == entry_ptr->image_ptr) { + HDassert(entry_ptr->size > 0); + if (NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS - H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, H5C_IMAGE_SANITY_VALUE, - H5C_IMAGE_EXTRA_SPACE); -#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - } /* end if */ + H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, H5C_IMAGE_SANITY_VALUE, + H5C_IMAGE_EXTRA_SPACE); +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + } /* end if */ - /* Generate image for entry */ - if (H5C__generate_image(f, cache_ptr, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "Can't generate image for cache entry") + /* Generate image for entry */ + if (H5C__generate_image(f, cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "Can't generate image for cache entry") - /* Reset the flush_in progress flag */ - entry_ptr->flush_in_progress = FALSE; + /* Reset the flush_in progress flag */ + entry_ptr->flush_in_progress = FALSE; done: - HDassert((ret_value != SUCCEED) || (!entry_ptr->flush_in_progress)); - HDassert((ret_value != SUCCEED) || (entry_ptr->image_up_to_date)); - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__serialize_single_entry() */ + HDassert((ret_value != SUCCEED) || (!entry_ptr->flush_in_progress)); + HDassert((ret_value != SUCCEED) || (entry_ptr->image_up_to_date)); + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__serialize_single_entry() */ - /*------------------------------------------------------------------------- - * Function: H5C__generate_image - * - * Purpose: Serialize an entry and generate its image. - * - * Note: This may cause the entry to be re-sized and/or moved in - * the cache. - * - * As we will not update the metadata cache's data structures - * until we we finish the write, we must touch up these - * data structures for size and location changes even if we - * are about to delete the entry from the cache (i.e. on a - * flush destroy). - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Mohamad Chaarawi - * 2/10/16 - * - *------------------------------------------------------------------------- - */ - static herr_t H5C__generate_image(H5F_t * f, H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr) - { - haddr_t new_addr = HADDR_UNDEF; - haddr_t old_addr = HADDR_UNDEF; - size_t new_len = 0; - unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET; - herr_t ret_value = SUCCEED; +/*------------------------------------------------------------------------- + * Function: H5C__generate_image + * + * Purpose: Serialize an entry and generate its image. + * + * Note: This may cause the entry to be re-sized and/or moved in + * the cache. + * + * As we will not update the metadata cache's data structures + * until we we finish the write, we must touch up these + * data structures for size and location changes even if we + * are about to delete the entry from the cache (i.e. on a + * flush destroy). + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * 2/10/16 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr) +{ + haddr_t new_addr = HADDR_UNDEF; + haddr_t old_addr = HADDR_UNDEF; + size_t new_len = 0; + unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET; + herr_t ret_value = SUCCEED; - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC - /* Sanity check */ - HDassert(f); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(entry_ptr); - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(!entry_ptr->image_up_to_date); - HDassert(entry_ptr->is_dirty); - HDassert(!entry_ptr->is_protected); - HDassert(entry_ptr->type); + /* Sanity check */ + HDassert(f); + HDassert(cache_ptr); + HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + HDassert(entry_ptr); + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(!entry_ptr->image_up_to_date); + HDassert(entry_ptr->is_dirty); + HDassert(!entry_ptr->is_protected); + HDassert(entry_ptr->type); - /* make note of the entry's current address */ - old_addr = entry_ptr->addr; + /* make note of the entry's current address */ + old_addr = entry_ptr->addr; - /* Call client's pre-serialize callback, if there's one */ - if (entry_ptr->type->pre_serialize && - (entry_ptr->type->pre_serialize)(f, (void *)entry_ptr, entry_ptr->addr, entry_ptr->size, - &new_addr, &new_len, &serialize_flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to pre-serialize entry") + /* Call client's pre-serialize callback, if there's one */ + if (entry_ptr->type->pre_serialize && + (entry_ptr->type->pre_serialize)(f, (void *)entry_ptr, entry_ptr->addr, entry_ptr->size, &new_addr, + &new_len, &serialize_flags) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to pre-serialize entry") - /* Check for any flags set in the pre-serialize callback */ - if (serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) { - /* Check for unexpected flags from serialize callback */ - if (serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG | H5C__SERIALIZE_MOVED_FLAG)) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unknown serialize flag(s)") + /* Check for any flags set in the pre-serialize callback */ + if (serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) { + /* Check for unexpected flags from serialize callback */ + if (serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG | H5C__SERIALIZE_MOVED_FLAG)) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unknown serialize flag(s)") #ifdef H5_HAVE_PARALLEL - /* In the parallel case, resizes and moves in - * the serialize operation can cause problems. - * If they occur, scream and die. - * - * At present, in the parallel case, the aux_ptr - * will only be set if there is more than one - * process. Thus we can use this to detect - * the parallel case. - * - * This works for now, but if we start using the - * aux_ptr for other purposes, we will have to - * change this test accordingly. - * - * NB: While this test detects entryies that attempt - * to resize or move themselves during a flush - * in the parallel case, it will not detect an - * entry that dirties, resizes, and/or moves - * other entries during its flush. - * - * From what Quincey tells me, this test is - * sufficient for now, as any flush routine that - * does the latter will also do the former. - * - * If that ceases to be the case, further - * tests will be necessary. - */ - if (cache_ptr->aux_ptr != NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "resize/move in serialize occurred in parallel case") + /* In the parallel case, resizes and moves in + * the serialize operation can cause problems. + * If they occur, scream and die. + * + * At present, in the parallel case, the aux_ptr + * will only be set if there is more than one + * process. Thus we can use this to detect + * the parallel case. + * + * This works for now, but if we start using the + * aux_ptr for other purposes, we will have to + * change this test accordingly. + * + * NB: While this test detects entryies that attempt + * to resize or move themselves during a flush + * in the parallel case, it will not detect an + * entry that dirties, resizes, and/or moves + * other entries during its flush. + * + * From what Quincey tells me, this test is + * sufficient for now, as any flush routine that + * does the latter will also do the former. + * + * If that ceases to be the case, further + * tests will be necessary. + */ + if (cache_ptr->aux_ptr != NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "resize/move in serialize occurred in parallel case") #endif - /* If required, resize the buffer and update the entry and the cache - * data structures */ - if (serialize_flags & H5C__SERIALIZE_RESIZED_FLAG) { - /* Sanity check */ - HDassert(new_len > 0); + /* If required, resize the buffer and update the entry and the cache + * data structures */ + if (serialize_flags & H5C__SERIALIZE_RESIZED_FLAG) { + /* Sanity check */ + HDassert(new_len > 0); - /* Allocate a new image buffer */ - if (NULL == (entry_ptr->image_ptr = - H5MM_realloc(entry_ptr->image_ptr, new_len + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, - "memory allocation failed for on disk image buffer") + /* Allocate a new image buffer */ + if (NULL == + (entry_ptr->image_ptr = H5MM_realloc(entry_ptr->image_ptr, new_len + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, + "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS - H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + new_len, H5C_IMAGE_SANITY_VALUE, - H5C_IMAGE_EXTRA_SPACE); + H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + new_len, H5C_IMAGE_SANITY_VALUE, + H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - /* Update statistics for resizing the entry */ - H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_len); + /* Update statistics for resizing the entry */ + H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_len); - /* Update the hash table for the size change */ - H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len, entry_ptr, - !(entry_ptr->is_dirty)); + /* Update the hash table for the size change */ + H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len, entry_ptr, + !(entry_ptr->is_dirty)); - /* The entry can't be protected since we are in the process of - * flushing it. Thus we must update the replacement policy data - * structures for the size change. The macro deals with the pinned - * case. - */ - H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_len); + /* The entry can't be protected since we are in the process of + * flushing it. Thus we must update the replacement policy data + * structures for the size change. The macro deals with the pinned + * case. + */ + H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_len); - /* As we haven't updated the cache data structures for - * for the flush or flush destroy yet, the entry should - * be in the slist. Thus update it for the size change. - */ - HDassert(entry_ptr->is_dirty); - HDassert(entry_ptr->in_slist); - H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len); + /* As we haven't updated the cache data structures for + * for the flush or flush destroy yet, the entry should + * be in the slist. Thus update it for the size change. + */ + HDassert(entry_ptr->is_dirty); + HDassert(entry_ptr->in_slist); + H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len); - /* Finally, update the entry for its new size */ - entry_ptr->size = new_len; - } /* end if */ + /* Finally, update the entry for its new size */ + entry_ptr->size = new_len; + } /* end if */ - /* If required, udate the entry and the cache data structures - * for a move - */ - if (serialize_flags & H5C__SERIALIZE_MOVED_FLAG) { - /* Update stats and entries relocated counter */ - H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) - - /* We must update cache data structures for the change in address */ - if (entry_ptr->addr == old_addr) { - /* Delete the entry from the hash table and the slist */ - H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL); - H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE); - - /* Update the entry for its new address */ - entry_ptr->addr = new_addr; - - /* And then reinsert in the index and slist */ - H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL); - H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); - } /* end if */ - else /* move is already done for us -- just do sanity checks */ - HDassert(entry_ptr->addr == new_addr); - } /* end if */ - } /* end if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) */ + /* If required, udate the entry and the cache data structures + * for a move + */ + if (serialize_flags & H5C__SERIALIZE_MOVED_FLAG) { + /* Update stats and entries relocated counter */ + H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) + + /* We must update cache data structures for the change in address */ + if (entry_ptr->addr == old_addr) { + /* Delete the entry from the hash table and the slist */ + H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL); + H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE); + + /* Update the entry for its new address */ + entry_ptr->addr = new_addr; + + /* And then reinsert in the index and slist */ + H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL); + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); + } /* end if */ + else /* move is already done for us -- just do sanity checks */ + HDassert(entry_ptr->addr == new_addr); + } /* end if */ + } /* end if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) */ - /* Serialize object into buffer */ - if (entry_ptr->type->serialize(f, entry_ptr->image_ptr, entry_ptr->size, (void *)entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to serialize entry") + /* Serialize object into buffer */ + if (entry_ptr->type->serialize(f, entry_ptr->image_ptr, entry_ptr->size, (void *)entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to serialize entry") #if H5C_DO_MEMORY_SANITY_CHECKS - HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, - H5C_IMAGE_EXTRA_SPACE)); + HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, + H5C_IMAGE_EXTRA_SPACE)); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - entry_ptr->image_up_to_date = TRUE; + entry_ptr->image_up_to_date = TRUE; - /* Propagate the fact that the entry is serialized up the - * flush dependency chain if appropriate. Since the image must - * have been out of date for this function to have been called - * (see assertion on entry), no need to check that -- only check - * for flush dependency parents. - */ - HDassert(entry_ptr->flush_dep_nunser_children == 0); - if (entry_ptr->flush_dep_nparents > 0) - if (H5C__mark_flush_dep_serialized(entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "Can't propagate serialization status to fd parents") + /* Propagate the fact that the entry is serialized up the + * flush dependency chain if appropriate. Since the image must + * have been out of date for this function to have been called + * (see assertion on entry), no need to check that -- only check + * for flush dependency parents. + */ + HDassert(entry_ptr->flush_dep_nunser_children == 0); + if (entry_ptr->flush_dep_nparents > 0) + if (H5C__mark_flush_dep_serialized(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "Can't propagate serialization status to fd parents") done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__generate_image */ - - /*------------------------------------------------------------------------- - * - * Function: H5C_remove_entry - * - * Purpose: Remove an entry from the cache. Must be not protected, pinned, - * dirty, involved in flush dependencies, etc. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * September 17, 2016 - * - *------------------------------------------------------------------------- - */ - herr_t H5C_remove_entry(void *_entry) - { - H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_entry; /* Entry to remove */ - H5C_t * cache; /* Cache for file */ - herr_t ret_value = SUCCEED; /* Return value */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__generate_image */ - FUNC_ENTER_NOAPI(FAIL) +/*------------------------------------------------------------------------- + * + * Function: H5C_remove_entry + * + * Purpose: Remove an entry from the cache. Must be not protected, pinned, + * dirty, involved in flush dependencies, etc. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * September 17, 2016 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_remove_entry(void *_entry) +{ + H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_entry; /* Entry to remove */ + H5C_t * cache; /* Cache for file */ + herr_t ret_value = SUCCEED; /* Return value */ - /* Sanity checks */ - HDassert(entry); - HDassert(entry->ring != H5C_RING_UNDEFINED); - cache = entry->cache_ptr; - HDassert(cache); - HDassert(cache->magic == H5C__H5C_T_MAGIC); - - /* Check for error conditions */ - if (entry->is_dirty) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove dirty entry from cache") - if (entry->is_protected) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove protected entry from cache") - if (entry->is_pinned) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove pinned entry from cache") - /* NOTE: If these two errors are getting tripped because the entry is - * in a flush dependency with a freedspace entry, move the checks - * after the "before evict" message is sent, and add the - * "child being evicted" message to the "before evict" notify - * section below. QAK - 2017/08/03 - */ - if (entry->flush_dep_nparents > 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, - "can't remove entry with flush dependency parents from cache") - if (entry->flush_dep_nchildren > 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, - "can't remove entry with flush dependency children from cache") - - /* Additional internal cache consistency checks */ - HDassert(!entry->in_slist); - HDassert(!entry->flush_marker); - HDassert(!entry->flush_in_progress); - - /* Note that the algorithm below is (very) similar to the set of operations - * in H5C__flush_single_entry() and should be kept in sync with changes - * to that code. - QAK, 2016/11/30 - */ + FUNC_ENTER_NOAPI(FAIL) - /* Update stats, as if we are "destroying" and taking ownership of the entry */ - H5C__UPDATE_STATS_FOR_EVICTION(cache, entry, TRUE) + /* Sanity checks */ + HDassert(entry); + HDassert(entry->ring != H5C_RING_UNDEFINED); + cache = entry->cache_ptr; + HDassert(cache); + HDassert(cache->magic == H5C__H5C_T_MAGIC); + + /* Check for error conditions */ + if (entry->is_dirty) + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove dirty entry from cache") + if (entry->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove protected entry from cache") + if (entry->is_pinned) + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove pinned entry from cache") + /* NOTE: If these two errors are getting tripped because the entry is + * in a flush dependency with a freedspace entry, move the checks + * after the "before evict" message is sent, and add the + * "child being evicted" message to the "before evict" notify + * section below. QAK - 2017/08/03 + */ + if (entry->flush_dep_nparents > 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, + "can't remove entry with flush dependency parents from cache") + if (entry->flush_dep_nchildren > 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, + "can't remove entry with flush dependency children from cache") + + /* Additional internal cache consistency checks */ + HDassert(!entry->in_slist); + HDassert(!entry->flush_marker); + HDassert(!entry->flush_in_progress); + + /* Note that the algorithm below is (very) similar to the set of operations + * in H5C__flush_single_entry() and should be kept in sync with changes + * to that code. - QAK, 2016/11/30 + */ - /* If the entry's type has a 'notify' callback, send a 'before eviction' - * notice while the entry is still fully integrated in the cache. - */ - if (entry->type->notify && (entry->type->notify)(H5C_NOTIFY_ACTION_BEFORE_EVICT, entry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry to evict") + /* Update stats, as if we are "destroying" and taking ownership of the entry */ + H5C__UPDATE_STATS_FOR_EVICTION(cache, entry, TRUE) - /* Update the cache internal data structures as appropriate for a destroy. - * Specifically: - * 1) Delete it from the index - * 2) Delete it from the collective read access list - * 3) Update the replacement policy for eviction - * 4) Remove it from the tag list for this object - */ + /* If the entry's type has a 'notify' callback, send a 'before eviction' + * notice while the entry is still fully integrated in the cache. + */ + if (entry->type->notify && (entry->type->notify)(H5C_NOTIFY_ACTION_BEFORE_EVICT, entry) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry to evict") + + /* Update the cache internal data structures as appropriate for a destroy. + * Specifically: + * 1) Delete it from the index + * 2) Delete it from the collective read access list + * 3) Update the replacement policy for eviction + * 4) Remove it from the tag list for this object + */ - H5C__DELETE_FROM_INDEX(cache, entry, FAIL) + H5C__DELETE_FROM_INDEX(cache, entry, FAIL) #ifdef H5_HAVE_PARALLEL - /* Check for collective read access flag */ - if (entry->coll_access) { - entry->coll_access = FALSE; - H5C__REMOVE_FROM_COLL_LIST(cache, entry, FAIL) - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ + /* Check for collective read access flag */ + if (entry->coll_access) { + entry->coll_access = FALSE; + H5C__REMOVE_FROM_COLL_LIST(cache, entry, FAIL) + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ - H5C__UPDATE_RP_FOR_EVICTION(cache, entry, FAIL) + H5C__UPDATE_RP_FOR_EVICTION(cache, entry, FAIL) - /* Remove entry from tag list */ - if (H5C__untag_entry(cache, entry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry from tag list") + /* Remove entry from tag list */ + if (H5C__untag_entry(cache, entry) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry from tag list") - /* Increment entries_removed_counter and set last_entry_removed_ptr. - * As we me be about to free the entry, recall that last_entry_removed_ptr - * must NEVER be dereferenced. - * - * Recall that these fields are maintained to allow functions that perform - * scans of lists of entries to detect the unexpected removal of entries - * (via expunge, eviction, or take ownership at present), so that they can - * re-start their scans if necessary. - * - * Also check if the entry we are watching for removal is being - * removed (usually the 'next' entry for an iteration) and reset - * it to indicate that it was removed. - */ - cache->entries_removed_counter++; - cache->last_entry_removed_ptr = entry; - if (entry == cache->entry_watched_for_removal) - cache->entry_watched_for_removal = NULL; + /* Increment entries_removed_counter and set last_entry_removed_ptr. + * As we me be about to free the entry, recall that last_entry_removed_ptr + * must NEVER be dereferenced. + * + * Recall that these fields are maintained to allow functions that perform + * scans of lists of entries to detect the unexpected removal of entries + * (via expunge, eviction, or take ownership at present), so that they can + * re-start their scans if necessary. + * + * Also check if the entry we are watching for removal is being + * removed (usually the 'next' entry for an iteration) and reset + * it to indicate that it was removed. + */ + cache->entries_removed_counter++; + cache->last_entry_removed_ptr = entry; + if (entry == cache->entry_watched_for_removal) + cache->entry_watched_for_removal = NULL; - /* Internal cache data structures should now be up to date, and - * consistent with the status of the entry. - * - * Now clean up internal cache fields if appropriate. - */ + /* Internal cache data structures should now be up to date, and + * consistent with the status of the entry. + * + * Now clean up internal cache fields if appropriate. + */ - /* Free the buffer for the on disk image */ - if (entry->image_ptr != NULL) - entry->image_ptr = H5MM_xfree(entry->image_ptr); + /* Free the buffer for the on disk image */ + if (entry->image_ptr != NULL) + entry->image_ptr = H5MM_xfree(entry->image_ptr); - /* Reset the pointer to the cache the entry is within */ - entry->cache_ptr = NULL; + /* Reset the pointer to the cache the entry is within */ + entry->cache_ptr = NULL; - /* Client is taking ownership of the entry. Set bad magic here so the - * cache will choke unless the entry is re-inserted properly - */ - entry->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC; + /* Client is taking ownership of the entry. Set bad magic here so the + * cache will choke unless the entry is re-inserted properly + */ + entry->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC; done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C__remove_entry() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__remove_entry() */ diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c index 7dc7d34..f45e52c 100644 --- a/src/H5Cdbg.c +++ b/src/H5Cdbg.c @@ -248,11 +248,12 @@ H5C_dump_cache_LRU(H5C_t *cache_ptr, const char *cache_name) #endif /* NDEBUG */ /*------------------------------------------------------------------------- + * * Function: H5C_dump_cache_skip_list * * Purpose: Debugging routine that prints a summary of the contents of - * the skip list used by the metadata cache metadata cache to - * maintain an address sorted list of dirty entries. + * the skip list used by the metadata cache metadata cache to + * maintain an address sorted list of dirty entries. * * Return: Non-negative on success/Negative on failure * @@ -277,23 +278,32 @@ H5C_dump_cache_skip_list(H5C_t *cache_ptr, char *calling_fcn) HDassert(calling_fcn != NULL); HDfprintf(stdout, "\n\nDumping metadata cache skip list from %s.\n", calling_fcn); - HDfprintf(stdout, " slist len = %u.\n", cache_ptr->slist_len); - HDfprintf(stdout, " slist size = %lld.\n", (long long)(cache_ptr->slist_size)); + HDfprintf(stdout, " slist %s.\n", cache_ptr->slist_enabled ? "enabled" : "disabled"); + HDfprintf(stdout, " slist len = %" PRIu32 ".\n", cache_ptr->slist_len); + HDfprintf(stdout, " slist size = %zu.\n", cache_ptr->slist_size); if (cache_ptr->slist_len > 0) { + /* If we get this far, all entries in the cache are listed in the * skip list -- scan the skip list generating the desired output. */ HDfprintf(stdout, "Num: Addr: Len: Prot/Pind: Dirty: Type:\n"); - i = 0; + i = 0; + node_ptr = H5SL_first(cache_ptr->slist_ptr); - if (node_ptr != NULL) + + if (node_ptr != NULL) { + entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - else + } + else { + entry_ptr = NULL; + } while (entry_ptr != NULL) { + HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); HDfprintf(stdout, "%s%d 0x%016llx %4lld %d/%d %d %s\n", cache_ptr->prefix, i, @@ -301,22 +311,30 @@ H5C_dump_cache_skip_list(H5C_t *cache_ptr, char *calling_fcn) (int)(entry_ptr->is_protected), (int)(entry_ptr->is_pinned), (int)(entry_ptr->is_dirty), entry_ptr->type->name); - HDfprintf(stdout, " node_ptr = %p, item = %p\n", node_ptr, H5SL_item(node_ptr)); + HDfprintf(stdout, " node_ptr = %p, item = %p\n", (void *)node_ptr, H5SL_item(node_ptr)); /* increment node_ptr before we delete its target */ + node_ptr = H5SL_next(node_ptr); - if (node_ptr != NULL) + + if (node_ptr != NULL) { + entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - else + } + else { + entry_ptr = NULL; + } i++; + } /* end while */ } /* end if */ HDfprintf(stdout, "\n\n"); FUNC_LEAVE_NOAPI(ret_value) + } /* H5C_dump_cache_skip_list() */ #endif /* NDEBUG */ @@ -593,8 +611,8 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name, (long long)(cache_ptr->slist_scan_restarts), (long long)(cache_ptr->LRU_scan_restarts), (long long)(cache_ptr->index_scan_restarts)); - HDfprintf(stdout, "%s cache image creations/reads/loads/size = %d / %d /%d / %Hu\n", cache_ptr->prefix, - cache_ptr->images_created, cache_ptr->images_read, cache_ptr->images_loaded, + HDfprintf(stdout, "%s cache image creations/reads/loads/size = %d / %d /%d / %" PRIuHSIZE "\n", + cache_ptr->prefix, cache_ptr->images_created, cache_ptr->images_read, cache_ptr->images_loaded, cache_ptr->last_image_size); HDfprintf(stdout, "%s prefetches / dirty prefetches = %lld / %lld\n", cache_ptr->prefix, diff --git a/src/H5Cimage.c b/src/H5Cimage.c index b6c49ce..e876265 100644 --- a/src/H5Cimage.c +++ b/src/H5Cimage.c @@ -423,33 +423,33 @@ done: * Function: H5C__deserialize_prefetched_entry() * * Purpose: Deserialize the supplied prefetched entry entry, and return - * a pointer to the deserialized entry in *entry_ptr_ptr. - * If successful, remove the prefetched entry from the cache, - * and free it. Insert the deserialized entry into the cache. - * - * Note that the on disk image of the entry is not freed -- - * a pointer to it is stored in the deserialized entries' - * image_ptr field, and its image_up_to_date field is set to - * TRUE unless the entry is dirtied by the deserialize call. - * - * If the prefetched entry is a flush dependency child, - * destroy that flush dependency prior to calling the - * deserialize callback. If appropriate, the flush dependency - * relationship will be recreated by the cache client. - * - * If the prefetched entry is a flush dependency parent, - * destroy the flush dependency relationship with all its - * children. As all these children must be prefetched entries, - * recreate these flush dependency relationships with - * deserialized entry after it is inserted in the cache. - * - * Since deserializing a prefetched entry is semantically - * equivalent to a load, issue an entry loaded nofification - * if the notify callback is defined. + * a pointer to the deserialized entry in *entry_ptr_ptr. + * If successful, remove the prefetched entry from the cache, + * and free it. Insert the deserialized entry into the cache. + * + * Note that the on disk image of the entry is not freed -- + * a pointer to it is stored in the deserialized entries' + * image_ptr field, and its image_up_to_date field is set to + * TRUE unless the entry is dirtied by the deserialize call. + * + * If the prefetched entry is a flush dependency child, + * destroy that flush dependency prior to calling the + * deserialize callback. If appropriate, the flush dependency + * relationship will be recreated by the cache client. + * + * If the prefetched entry is a flush dependency parent, + * destroy the flush dependency relationship with all its + * children. As all these children must be prefetched entries, + * recreate these flush dependency relationships with + * deserialized entry after it is inserted in the cache. + * + * Since deserializing a prefetched entry is semantically + * equivalent to a load, issue an entry loaded nofification + * if the notify callback is defined. * * Return: SUCCEED on success, and FAIL on failure. * - * Note that *entry_ptr_ptr is undefined on failure. + * Note that *entry_ptr_ptr is undefined on failure. * * Programmer: John Mainzer, 8/10/15 * @@ -685,15 +685,17 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t * * 1) Set pf_entry_ptr->image_ptr to NULL. Since we have already * transferred the buffer containing the image to *ds_entry_ptr, - * this is not a memory leak. + * this is not a memory leak. * * 2) Call H5C__flush_single_entry() with the H5C__FLUSH_INVALIDATE_FLAG * and H5C__FLUSH_CLEAR_ONLY_FLAG flags set. */ pf_entry_ptr->image_ptr = NULL; + if (pf_entry_ptr->is_dirty) { HDassert(pf_entry_ptr->in_slist); flush_flags |= H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG; + } /* end if */ if (H5C__flush_single_entry(f, pf_entry_ptr, flush_flags) < 0) diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index 37d7a9b..e529c58 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -105,9 +105,9 @@ static herr_t H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned * * We construct the table as follows. Let: * - * n = num_candidates / mpi_size; + * n = num_candidates / mpi_size; * - * m = num_candidates % mpi_size; + * m = num_candidates % mpi_size; * * Now allocate an array of integers of length mpi_size + 1, * and call this array candidate_assignment_table. @@ -127,10 +127,10 @@ static herr_t H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned * Once the table is constructed, we determine the first and * last entry this process is to flush as follows: * - * first_entry_to_flush = candidate_assignment_table[mpi_rank] + * first_entry_to_flush = candidate_assignment_table[mpi_rank] * * last_entry_to_flush = - * candidate_assignment_table[mpi_rank + 1] - 1; + * candidate_assignment_table[mpi_rank + 1] - 1; * * With these values determined, we simply scan through the * candidate list, marking all entries in the range @@ -172,12 +172,15 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha unsigned entries_to_clear[H5C_RING_NTYPES]; haddr_t addr; H5C_cache_entry_t *entry_ptr = NULL; + #if H5C_DO_SANITY_CHECKS haddr_t last_addr; #endif /* H5C_DO_SANITY_CHECKS */ + #if H5C_APPLY_CANDIDATE_LIST__DEBUG char tbl_buf[1024]; -#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ +#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ + unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -397,6 +400,7 @@ done: } /* H5C_apply_candidate_list() */ /*------------------------------------------------------------------------- + * * Function: H5C_construct_candidate_list__clean_cache * * Purpose: Construct the list of entries that should be flushed to @@ -439,6 +443,7 @@ H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr) HDassert(cache_ptr->slist_len <= (cache_ptr->dLRU_list_len + cache_ptr->pel_len)); if (space_needed > 0) { /* we have work to do */ + H5C_cache_entry_t *entry_ptr; unsigned nominated_entries_count = 0; size_t nominated_entries_size = 0; @@ -450,8 +455,11 @@ H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr) * entries to free up the necessary space. */ entry_ptr = cache_ptr->dLRU_tail_ptr; - while ((nominated_entries_size < space_needed) && (nominated_entries_count < cache_ptr->slist_len) && + + while ((nominated_entries_size < space_needed) && + ((!cache_ptr->slist_enabled) || (nominated_entries_count < cache_ptr->slist_len)) && (entry_ptr != NULL)) { + HDassert(!(entry_ptr->is_protected)); HDassert(!(entry_ptr->is_read_only)); HDassert(entry_ptr->ro_ref_count == 0); @@ -459,13 +467,17 @@ H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr) HDassert(entry_ptr->in_slist); nominated_addr = entry_ptr->addr; + if (H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed") nominated_entries_size += entry_ptr->size; nominated_entries_count++; entry_ptr = entry_ptr->aux_prev; + } /* end while */ + HDassert(entry_ptr == NULL); /* it is possible that there are some dirty entries on the @@ -474,7 +486,9 @@ H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr) entry_ptr = cache_ptr->pel_head_ptr; while ((nominated_entries_size < space_needed) && (nominated_entries_count < cache_ptr->slist_len) && (entry_ptr != NULL)) { + if (entry_ptr->is_dirty) { + HDassert(!(entry_ptr->is_protected)); HDassert(!(entry_ptr->is_read_only)); HDassert(entry_ptr->ro_ref_count == 0); @@ -482,22 +496,29 @@ H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr) HDassert(entry_ptr->in_slist); nominated_addr = entry_ptr->addr; + if (H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed") nominated_entries_size += entry_ptr->size; nominated_entries_count++; + } /* end if */ entry_ptr = entry_ptr->next; + } /* end while */ HDassert(nominated_entries_count == cache_ptr->slist_len); HDassert(nominated_entries_size == space_needed); + } /* end if */ done: + FUNC_LEAVE_NOAPI(ret_value) + } /* H5C_construct_candidate_list__clean_cache() */ /*------------------------------------------------------------------------- @@ -533,6 +554,7 @@ H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr) * cache back within its min clean constraints. */ if (cache_ptr->max_cache_size > cache_ptr->index_size) { + if (((cache_ptr->max_cache_size - cache_ptr->index_size) + cache_ptr->cLRU_list_size) >= cache_ptr->min_clean_size) space_needed = 0; @@ -548,6 +570,7 @@ H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr) } /* end else */ if (space_needed > 0) { /* we have work to do */ + H5C_cache_entry_t *entry_ptr; unsigned nominated_entries_count = 0; size_t nominated_entries_size = 0; @@ -560,6 +583,7 @@ H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr) entry_ptr = cache_ptr->dLRU_tail_ptr; while ((nominated_entries_size < space_needed) && (nominated_entries_count < cache_ptr->slist_len) && (entry_ptr != NULL) && (!entry_ptr->flush_me_last)) { + haddr_t nominated_addr; HDassert(!(entry_ptr->is_protected)); @@ -569,12 +593,15 @@ H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr) HDassert(entry_ptr->in_slist); nominated_addr = entry_ptr->addr; + if (H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed") nominated_entries_size += entry_ptr->size; nominated_entries_count++; entry_ptr = entry_ptr->aux_prev; + } /* end while */ HDassert(nominated_entries_count <= cache_ptr->slist_len); HDassert(nominated_entries_size >= space_needed); @@ -679,13 +706,14 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr if (entry_ptr == NULL) { #if H5C_DO_SANITY_CHECKS - HDfprintf(stdout, "H5C_mark_entries_as_clean: entry[%u] = %a not in cache.\n", u, addr); + HDfprintf(stdout, "H5C_mark_entries_as_clean: entry[%u] = %" PRIuHADDR " not in cache.\n", u, + addr); #endif /* H5C_DO_SANITY_CHECKS */ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not in cache?!?!?") } /* end if */ else if (!entry_ptr->is_dirty) { #if H5C_DO_SANITY_CHECKS - HDfprintf(stdout, "H5C_mark_entries_as_clean: entry %a is not dirty!?!\n", addr); + HDfprintf(stdout, "H5C_mark_entries_as_clean: entry %" PRIuHADDR " is not dirty!?!\n", addr); #endif /* H5C_DO_SANITY_CHECKS */ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not dirty?!?!?") } /* end else-if */ @@ -737,7 +765,7 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr * of the pre_serialize / serialize routines, this may * cease to be the case -- requiring a review of this * point. - * JRM -- 4/7/15 + * JRM -- 4/7/15 */ entries_cleared = 0; entries_examined = 0; diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index fd82b2b..409dccc 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -14,8 +14,8 @@ /* * Programmer: John Mainzer -- 10/12/04 * - * Purpose: This file contains declarations which are normally visible - * only within the H5C package. + * Purpose: This file contains declarations which are normally visible + * only within the H5C package. * * Source files outside the H5C package should include * H5Cprivate.h instead. @@ -50,10 +50,12 @@ /* Number of epoch markers active */ #define H5C__MAX_EPOCH_MARKERS 10 + /* Cache configuration settings */ #define H5C__HASH_TABLE_LEN (64 * 1024) /* must be a power of 2 */ #define H5C__H5C_T_MAGIC 0x005CAC0E + /* Initial allocated size of the "flush_dep_parent" array */ #define H5C_FLUSH_DEP_PARENT_INIT 8 @@ -1575,12 +1577,17 @@ if ( ( (cache_ptr)->index_size != \ */ #if H5C_DO_SLIST_SANITY_CHECKS + #define ENTRY_IN_SLIST(cache_ptr, entry_ptr) \ H5C_entry_in_skip_list((cache_ptr), (entry_ptr)) + #else /* H5C_DO_SLIST_SANITY_CHECKS */ + #define ENTRY_IN_SLIST(cache_ptr, entry_ptr) FALSE + #endif /* H5C_DO_SLIST_SANITY_CHECKS */ + #if H5C_DO_SANITY_CHECKS #define H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, fail_val) \ @@ -1738,6 +1745,7 @@ if ( ( (cache_ptr)->index_size != \ ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (entry_ptr)->size; \ (entry_ptr)->in_slist = FALSE; \ } /* H5C__REMOVE_ENTRY_FROM_SLIST */ + #endif /* H5C_DO_SANITY_CHECKS */ @@ -1754,24 +1762,24 @@ if ( ( (cache_ptr)->index_size != \ * * Modifications: * - * JRM -- 8/27/06 - * Added the H5C_DO_SANITY_CHECKS version of the macro. + * JRM -- 8/27/06 + * Added the H5C_DO_SANITY_CHECKS version of the macro. * - * This version maintains the slist_size_increase field - * that are used in sanity checks in the flush routines. + * This version maintains the slist_size_increase field + * that are used in sanity checks in the flush routines. * - * All this is needed as the fractal heap needs to be - * able to dirty, resize and/or move entries during the - * flush. + * All this is needed as the fractal heap needs to be + * able to dirty, resize and/or move entries during the + * flush. * - * JRM -- 12/13/14 - * Note that we do not set cache_ptr->slist_changed to TRUE - * in this case, as the structure of the slist is not - * modified. + * JRM -- 12/13/14 + * Note that we do not set cache_ptr->slist_changed to TRUE + * 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. + * JRM -- 9/1/15 + * Added code to maintain the cache_ptr->slist_ring_len + * and cache_ptr->slist_ring_size arrays. * *------------------------------------------------------------------------- */ @@ -4653,6 +4661,7 @@ typedef struct H5C_tag_info_t { * NDEBUG is not #defined. * ****************************************************************************/ + struct H5C_t { uint32_t magic; hbool_t flush_in_progress; @@ -4668,7 +4677,7 @@ struct H5C_t { hbool_t evictions_enabled; hbool_t close_warning_received; - /* Fields for maintaining [hash table] index of entries */ + /* Fields for maintaining the [hash table] index of entries */ uint32_t index_len; size_t index_size; uint32_t index_ring_len[H5C_RING_NTYPES]; @@ -4886,7 +4895,8 @@ struct H5C_t { #ifndef NDEBUG int64_t get_entry_ptr_from_addr_counter; #endif /* NDEBUG */ -}; + +}; /* H5C_t */ /* Define typedef for tagged cache entry iteration callbacks */ typedef int (*H5C_tag_iter_cb_t)(H5C_cache_entry_t *entry, void *ctx); diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 149bc1e..80ab5ff 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -13,12 +13,12 @@ /*------------------------------------------------------------------------- * - * Created: H5Cprivate.h + * Created: H5Cprivate.h * 6/3/04 * John Mainzer * - * Purpose: Constants and typedefs available to the rest of the - * library. + * Purpose: Constants and typedefs available to the rest of the + * library. * *------------------------------------------------------------------------- */ @@ -26,11 +26,11 @@ #ifndef _H5Cprivate_H #define _H5Cprivate_H -#include "H5Cpublic.h" /* public prototypes */ +#include "H5Cpublic.h" /* public prototypes */ /* Private headers needed by this header */ #include "H5private.h" /* Generic Functions */ -#include "H5Fprivate.h" /* File access */ +#include "H5Fprivate.h" /* File access */ /**************************/ /* Library Private Macros */ diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index c412bf6..d0a191f 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -741,7 +741,7 @@ H5D__btree_debug_key(FILE *stream, int indent, int fwidth, const void *_key, con HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", key->filter_mask); HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); for (u = 0; u < udata->ndims; u++) - HDfprintf(stream, "%s%Hd", u ? ", " : "", (key->scaled[u] * udata->common.layout->dim[u])); + HDfprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", (key->scaled[u] * udata->common.layout->dim[u])); HDfputs("}\n", stream); FUNC_LEAVE_NOAPI(SUCCEED) @@ -1370,7 +1370,7 @@ H5D__btree_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) HDassert(storage); HDassert(stream); - HDfprintf(stream, " Address: %a\n", storage->idx_addr); + HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__btree_idx_dump() */ diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index 51380e4..866b794 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -441,11 +441,11 @@ H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth, const void *_record, HDassert(ctx->chunk_size == record->nbytes); HDassert(0 == record->filter_mask); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Chunk address:", record->chunk_addr); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Chunk address:", record->chunk_addr); HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); for (u = 0; u < ctx->ndims; u++) - HDfprintf(stream, "%s%Hd", u ? ", " : "", record->scaled[u] * ctx->dim[u]); + HDfprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", record->scaled[u] * ctx->dim[u]); HDfputs("}\n", stream); FUNC_LEAVE_NOAPI(SUCCEED) @@ -555,13 +555,13 @@ H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth, const void *_record, c HDassert(H5F_addr_defined(record->chunk_addr)); HDassert(0 != record->nbytes); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Chunk address:", record->chunk_addr); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Chunk address:", record->chunk_addr); HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, "Chunk size:", (unsigned)record->nbytes); HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", record->filter_mask); HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); for (u = 0; u < ctx->ndims; u++) - HDfprintf(stream, "%s%Hd", u ? ", " : "", record->scaled[u] * ctx->dim[u]); + HDfprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", record->scaled[u] * ctx->dim[u]); HDfputs("}\n", stream); FUNC_LEAVE_NOAPI(SUCCEED) @@ -1467,7 +1467,7 @@ H5D__bt2_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) HDassert(storage); HDassert(stream); - HDfprintf(stream, " Address: %a\n", storage->idx_addr); + HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__bt2_idx_dump() */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 9689744..60bf57e 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -6541,10 +6541,11 @@ H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) } /* end if */ /* Print information about this chunk */ - HDfprintf(udata->stream, " 0x%08x %8Zu %10a [", chunk_rec->filter_mask, chunk_rec->nbytes, - chunk_rec->chunk_addr); + HDfprintf(udata->stream, " 0x%08x %8" PRIu32 " %10" PRIuHADDR " [", chunk_rec->filter_mask, + chunk_rec->nbytes, chunk_rec->chunk_addr); for (u = 0; u < udata->ndims; u++) - HDfprintf(udata->stream, "%s%Hu", (u ? ", " : ""), (chunk_rec->scaled[u] * udata->chunk_dim[u])); + HDfprintf(udata->stream, "%s%" PRIuHSIZE, (u ? ", " : ""), + (chunk_rec->scaled[u] * udata->chunk_dim[u])); HDfputs("]\n", udata->stream); } /* end if */ diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c index 8c10983..9509de3 100644 --- a/src/H5Ddbg.c +++ b/src/H5Ddbg.c @@ -78,7 +78,8 @@ H5Ddebug(hid_t dset_id) if (H5D_CHUNKED == dset->shared->layout.type) (void)H5D__chunk_dump_index(dset, stdout); else if (H5D_CONTIGUOUS == dset->shared->layout.type) - HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr); + HDfprintf(stdout, " %-10s %" PRIuHADDR "\n", + "Address:", dset->shared->layout.storage.u.contig.addr); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index db345c1..a091152 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -137,13 +137,13 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") - /* Create the dataset through the VOL */ + /* Create the dataset */ if (NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, H5P_LINK_CREATE_DEFAULT, type_id, space_id, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") - /* Get an atom for the dataset */ + /* Register the new dataset to get an ID for it */ if ((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") diff --git a/src/H5Dearray.c b/src/H5Dearray.c index 162018a..8a30054 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -417,8 +417,8 @@ H5D__earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void HDassert(elmt); /* Print element */ - HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt); + HDsprintf(temp_str, "Element #%" PRIuHSIZE ":", idx); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__earray_debug() */ @@ -573,9 +573,9 @@ H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const HDassert(elmt); /* Print element */ - HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx); - HDfprintf(stream, "%*s%-*s {%a, %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr, elmt->nbytes, - elmt->filter_mask); + HDsprintf(temp_str, "Element #%" PRIuHSIZE ":", idx); + HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr, + elmt->nbytes, elmt->filter_mask); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__earray_filt_debug() */ @@ -1742,7 +1742,7 @@ H5D__earray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) HDassert(storage); HDassert(stream); - HDfprintf(stream, " Address: %a\n", storage->idx_addr); + HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__earray_idx_dump() */ diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c index 8c23634..bf1274f 100644 --- a/src/H5Dfarray.c +++ b/src/H5Dfarray.c @@ -415,8 +415,8 @@ H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void HDassert(elmt); /* Print element */ - HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt); + HDsprintf(temp_str, "Element #%" PRIuHSIZE ":", idx); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__farray_debug() */ @@ -675,9 +675,9 @@ H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const HDassert(elmt); /* Print element */ - HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx); - HDfprintf(stream, "%*s%-*s {%a, %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr, elmt->nbytes, - elmt->filter_mask); + HDsprintf(temp_str, "Element #%" PRIuHSIZE ":", idx); + HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr, + elmt->nbytes, elmt->filter_mask); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__farray_filt_debug() */ @@ -1591,7 +1591,7 @@ H5D__farray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) HDassert(storage); HDassert(stream); - HDfprintf(stream, " Address: %a\n", storage->idx_addr); + HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__farray_idx_dump() */ diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 3bed43f..df7c829 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -1091,7 +1091,7 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ #ifdef H5D_DEBUG if (H5DEBUG(D)) - HDfprintf(H5DEBUG(D), "total_chunks = %Zu, num_chunk = %Zu\n", total_chunks, num_chunk); + HDfprintf(H5DEBUG(D), "total_chunks = %zu, num_chunk = %zu\n", total_chunks, num_chunk); #endif /* Set up MPI datatype for chunks selected */ @@ -1571,7 +1571,7 @@ H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *ty chunk_addr = (haddr_t *)H5MM_calloc(total_chunk * sizeof(haddr_t)); #ifdef H5D_DEBUG if (H5DEBUG(D)) - HDfprintf(H5DEBUG(D), "total_chunk %Zu\n", total_chunk); + HDfprintf(H5DEBUG(D), "total_chunk %zu\n", total_chunk); #endif /* Obtain IO option for each chunk */ @@ -1605,7 +1605,7 @@ H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *ty #ifdef H5D_DEBUG if (H5DEBUG(D)) - HDfprintf(H5DEBUG(D), "mpi_rank = %d, chunk index = %Zu\n", mpi_rank, u); + HDfprintf(H5DEBUG(D), "mpi_rank = %d, chunk index = %zu\n", mpi_rank, u); #endif /* Get the chunk info for this chunk, if there are elements selected */ chunk_info = fm->select_chunk[u]; @@ -1625,7 +1625,7 @@ H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *ty if (chunk_io_option[u] == H5D_CHUNK_IO_MODE_COL) { #ifdef H5D_DEBUG if (H5DEBUG(D)) - HDfprintf(H5DEBUG(D), "inside collective chunk IO mpi_rank = %d, chunk index = %Zu\n", + HDfprintf(H5DEBUG(D), "inside collective chunk IO mpi_rank = %d, chunk index = %zu\n", mpi_rank, u); #endif @@ -1664,7 +1664,7 @@ H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *ty else { /* possible independent IO for this chunk */ #ifdef H5D_DEBUG if (H5DEBUG(D)) - HDfprintf(H5DEBUG(D), "inside independent IO mpi_rank = %d, chunk index = %Zu\n", mpi_rank, + HDfprintf(H5DEBUG(D), "inside independent IO mpi_rank = %d, chunk index = %zu\n", mpi_rank, u); #endif diff --git a/src/H5Dnone.c b/src/H5Dnone.c index fad1c1e..82fbffb 100644 --- a/src/H5Dnone.c +++ b/src/H5Dnone.c @@ -470,7 +470,7 @@ H5D__none_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) HDassert(storage); HDassert(stream); - HDfprintf(stream, " Address: %a\n", storage->idx_addr); + HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__none_idx_dump() */ diff --git a/src/H5Dsingle.c b/src/H5Dsingle.c index 1f354fe..2996ca5 100644 --- a/src/H5Dsingle.c +++ b/src/H5Dsingle.c @@ -521,7 +521,7 @@ H5D__single_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) HDassert(storage); HDassert(stream); - HDfprintf(stream, " Address: %a\n", storage->idx_addr); + HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__single_idx_dump() */ diff --git a/src/H5E.c b/src/H5E.c index 8333572..731d263 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -49,7 +49,6 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ #include "H5Epkg.h" /* Error handling */ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ @@ -498,9 +497,9 @@ done: * * Purpose: Closes an error class. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Friday, July 11, 2003 * *------------------------------------------------------------------------- @@ -1014,9 +1013,9 @@ done: * Purpose: Replaces current stack with specified stack. This closes the * stack ID also. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Friday, July 15, 2003 * *------------------------------------------------------------------------- @@ -1119,9 +1118,9 @@ done: * * Purpose: Closes an error stack. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Friday, July 14, 2003 * *------------------------------------------------------------------------- @@ -1254,9 +1253,9 @@ H5E__get_num(const H5E_t *estack) * * Purpose: Deletes some error messages from the top of error stack. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Friday, July 16, 2003 * *------------------------------------------------------------------------- @@ -1309,9 +1308,9 @@ done: * function name, file name, and error description strings must * be statically allocated. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, October 18, 1999 * * Notes: Basically a new public API wrapper around the H5E__push_stack @@ -1323,12 +1322,8 @@ herr_t H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, ...) { - va_list ap; /* Varargs info */ - H5E_t * estack; /* Pointer to error stack to modify */ -#ifndef H5_HAVE_VASPRINTF - int tmp_len; /* Current size of description buffer */ - int desc_len; /* Actual length of description when formatted */ -#endif /* H5_HAVE_VASPRINTF */ + va_list ap; /* Varargs info */ + H5E_t * estack; /* Pointer to error stack to modify */ char * tmp = NULL; /* Buffer to place formatted description in */ hbool_t va_started = FALSE; /* Whether the variable argument list is open */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1357,31 +1352,9 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid HDva_start(ap, fmt); va_started = TRUE; -#ifdef H5_HAVE_VASPRINTF /* Use the vasprintf() routine, since it does what we're trying to do below */ if (HDvasprintf(&tmp, fmt, ap) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") -#else /* H5_HAVE_VASPRINTF */ - /* Allocate space for the formatted description buffer */ - tmp_len = 128; - if (NULL == (tmp = H5MM_malloc((size_t)tmp_len))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - - /* If the description doesn't fit into the initial buffer size, allocate more space and try again */ - while ((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) { - /* shutdown & restart the va_list */ - HDva_end(ap); - HDva_start(ap, fmt); - - /* Release the previous description, it's too small */ - H5MM_xfree(tmp); - - /* Allocate a description of the appropriate length */ - tmp_len = desc_len + 1; - if (NULL == (tmp = H5MM_malloc((size_t)tmp_len))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - } /* end while */ -#endif /* H5_HAVE_VASPRINTF */ /* Push the error on the stack */ if (H5E__push_stack(estack, file, func, line, cls_id, maj_id, min_id, tmp) < 0) @@ -1390,16 +1363,11 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid done: if (va_started) HDva_end(ap); -#ifdef H5_HAVE_VASPRINTF /* Memory was allocated with HDvasprintf so it needs to be freed * with HDfree */ if (tmp) HDfree(tmp); -#else /* H5_HAVE_VASPRINTF */ - if (tmp) - H5MM_xfree(tmp); -#endif /* H5_HAVE_VASPRINTF */ FUNC_LEAVE_API(ret_value) } /* end H5Epush2() */ @@ -1409,9 +1377,9 @@ done: * * Purpose: Clears the error stack for the specified error stack. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, July 16, 2003 * *------------------------------------------------------------------------- @@ -1453,9 +1421,9 @@ done: * prints error messages. Users are encouraged to write their * own more specific error handlers. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, February 27, 1998 * *------------------------------------------------------------------------- @@ -1498,9 +1466,9 @@ done: * Purpose: Walks the error stack for the current thread and calls some * function for each error along the way. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, February 27, 1998 * *------------------------------------------------------------------------- @@ -1548,7 +1516,7 @@ done: * Either (or both) arguments may be null in which case the * value is not returned. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * * Programmer: Robb Matzke * Saturday, February 28, 1998 @@ -1605,7 +1573,7 @@ done: * Automatic stack traversal is always in the H5E_WALK_DOWNWARD * direction. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * * Programmer: Robb Matzke * Friday, February 27, 1998 @@ -1663,7 +1631,7 @@ done: * or the H5E_auto_t typedef. The IS_STACK parameter is set * to 1 for the first case and 0 for the latter case. * - * Return: SUCCEED/FAIL + * Return: Non-negative value on success/Negative on failure * * Programmer: Quincey Koziol * Wednesday, September 8, 2004 diff --git a/src/H5EA.c b/src/H5EA.c index f246686..f601e28 100644 --- a/src/H5EA.c +++ b/src/H5EA.c @@ -119,50 +119,50 @@ H5FL_BLK_DEFINE(ea_native_elmt); BEGIN_FUNC(STATIC, ERR, H5EA_t *, NULL, NULL, H5EA__new(H5F_t *f, haddr_t ea_addr, hbool_t from_open, void *ctx_udata)) -/* Local variables */ -H5EA_t * ea = NULL; /* Pointer to new extensible array */ -H5EA_hdr_t *hdr = NULL; /* The extensible array header information */ + /* Local variables */ + H5EA_t * ea = NULL; /* Pointer to new extensible array */ + H5EA_hdr_t *hdr = NULL; /* The extensible array header information */ -/* - * Check arguments. - */ -HDassert(f); -HDassert(H5F_addr_defined(ea_addr)); + /* + * Check arguments. + */ + HDassert(f); + HDassert(H5F_addr_defined(ea_addr)); -/* Allocate extensible array wrapper */ -if (NULL == (ea = H5FL_CALLOC(H5EA_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array info") + /* Allocate extensible array wrapper */ + if (NULL == (ea = H5FL_CALLOC(H5EA_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array info") -/* Lock the array header into memory */ -if (NULL == (hdr = H5EA__hdr_protect(f, ea_addr, ctx_udata, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") + /* Lock the array header into memory */ + if (NULL == (hdr = H5EA__hdr_protect(f, ea_addr, ctx_udata, H5AC__READ_ONLY_FLAG))) + H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") -/* Check for pending array deletion */ -if (from_open && hdr->pending_delete) - H5E_THROW(H5E_CANTOPENOBJ, "can't open extensible array pending deletion") + /* Check for pending array deletion */ + if (from_open && hdr->pending_delete) + H5E_THROW(H5E_CANTOPENOBJ, "can't open extensible array pending deletion") -/* Point extensible array wrapper at header and bump it's ref count */ -ea->hdr = hdr; -if (H5EA__hdr_incr(ea->hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + /* Point extensible array wrapper at header and bump it's ref count */ + ea->hdr = hdr; + if (H5EA__hdr_incr(ea->hdr) < 0) + H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") -/* Increment # of files using this array header */ -if (H5EA__hdr_fuse_incr(ea->hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header") + /* Increment # of files using this array header */ + if (H5EA__hdr_fuse_incr(ea->hdr) < 0) + H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header") -/* Set file pointer for this array open context */ -ea->f = f; + /* Set file pointer for this array open context */ + ea->f = f; -/* Set the return value */ -ret_value = ea; + /* Set the return value */ + ret_value = ea; -CATCH + CATCH -if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") -if (!ret_value) - if (ea && H5EA_close(ea) < 0) - H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array") + if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + if (!ret_value) + if (ea && H5EA_close(ea) < 0) + H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array") END_FUNC(STATIC) /* end H5EA__new() */ @@ -182,35 +182,35 @@ END_FUNC(STATIC) /* end H5EA__new() */ BEGIN_FUNC(PRIV, ERR, H5EA_t *, NULL, NULL, H5EA_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata)) -/* Local variables */ -H5EA_t *ea = NULL; /* Pointer to new extensible array */ -haddr_t ea_addr; /* Array header address */ + /* Local variables */ + H5EA_t *ea = NULL; /* Pointer to new extensible array */ + haddr_t ea_addr; /* Array header address */ -/* - * Check arguments. - */ -HDassert(f); -HDassert(cparam); + /* + * Check arguments. + */ + HDassert(f); + HDassert(cparam); -/* H5EA interface sanity check */ -HDcompile_assert(H5EA_NUM_CLS_ID == NELMTS(H5EA_client_class_g)); + /* H5EA interface sanity check */ + HDcompile_assert(H5EA_NUM_CLS_ID == NELMTS(H5EA_client_class_g)); -/* Create extensible array header */ -if (HADDR_UNDEF == (ea_addr = H5EA__hdr_create(f, cparam, ctx_udata))) - H5E_THROW(H5E_CANTINIT, "can't create extensible array header") + /* Create extensible array header */ + if (HADDR_UNDEF == (ea_addr = H5EA__hdr_create(f, cparam, ctx_udata))) + H5E_THROW(H5E_CANTINIT, "can't create extensible array header") -/* Allocate and initialize new extensible array wrapper */ -if (NULL == (ea = H5EA__new(f, ea_addr, FALSE, ctx_udata))) - H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for extensible array wrapper") + /* Allocate and initialize new extensible array wrapper */ + if (NULL == (ea = H5EA__new(f, ea_addr, FALSE, ctx_udata))) + H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for extensible array wrapper") -/* Set the return value */ -ret_value = ea; + /* Set the return value */ + ret_value = ea; -CATCH + CATCH -if (!ret_value) - if (ea && H5EA_close(ea) < 0) - H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array") + if (!ret_value) + if (ea && H5EA_close(ea) < 0) + H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array") END_FUNC(PRIV) /* end H5EA_create() */ @@ -229,27 +229,27 @@ END_FUNC(PRIV) /* end H5EA_create() */ */ BEGIN_FUNC(PRIV, ERR, H5EA_t *, NULL, NULL, H5EA_open(H5F_t *f, haddr_t ea_addr, void *ctx_udata)) -/* Local variables */ -H5EA_t *ea = NULL; /* Pointer to new extensible array wrapper */ + /* Local variables */ + H5EA_t *ea = NULL; /* Pointer to new extensible array wrapper */ -/* - * Check arguments. - */ -HDassert(f); -HDassert(H5F_addr_defined(ea_addr)); + /* + * Check arguments. + */ + HDassert(f); + HDassert(H5F_addr_defined(ea_addr)); -/* Allocate and initialize new extensible array wrapper */ -if (NULL == (ea = H5EA__new(f, ea_addr, TRUE, ctx_udata))) - H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for extensible array wrapper") + /* Allocate and initialize new extensible array wrapper */ + if (NULL == (ea = H5EA__new(f, ea_addr, TRUE, ctx_udata))) + H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for extensible array wrapper") -/* Set the return value */ -ret_value = ea; + /* Set the return value */ + ret_value = ea; -CATCH + CATCH -if (!ret_value) - if (ea && H5EA_close(ea) < 0) - H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array") + if (!ret_value) + if (ea && H5EA_close(ea) < 0) + H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array") END_FUNC(PRIV) /* end H5EA_open() */ @@ -267,16 +267,16 @@ END_FUNC(PRIV) /* end H5EA_open() */ */ BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_get_nelmts(const H5EA_t *ea, hsize_t *nelmts)) -/* Local variables */ + /* Local variables */ -/* - * Check arguments. - */ -HDassert(ea); -HDassert(nelmts); + /* + * Check arguments. + */ + HDassert(ea); + HDassert(nelmts); -/* Retrieve the max. index set */ -*nelmts = ea->hdr->stats.stored.max_idx_set; + /* Retrieve the max. index set */ + *nelmts = ea->hdr->stats.stored.max_idx_set; END_FUNC(PRIV) /* end H5EA_get_nelmts() */ @@ -294,17 +294,17 @@ END_FUNC(PRIV) /* end H5EA_get_nelmts() */ */ BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_get_addr(const H5EA_t *ea, haddr_t *addr)) -/* Local variables */ + /* Local variables */ -/* - * Check arguments. - */ -HDassert(ea); -HDassert(ea->hdr); -HDassert(addr); + /* + * Check arguments. + */ + HDassert(ea); + HDassert(ea->hdr); + HDassert(addr); -/* Retrieve the address of the extensible array's header */ -*addr = ea->hdr->addr; + /* Retrieve the address of the extensible array's header */ + *addr = ea->hdr->addr; END_FUNC(PRIV) /* end H5EA_get_addr() */ @@ -326,263 +326,114 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, void **thing, uint8_t **thing_elmt_buf, hsize_t *thing_elmt_idx, H5EA__unprotect_func_t *thing_unprot_func)) -/* Local variables */ -H5EA_hdr_t * hdr = ea->hdr; /* Header for EA */ -H5EA_iblock_t * iblock = NULL; /* Pointer to index block for EA */ -H5EA_sblock_t * sblock = NULL; /* Pointer to super block for EA */ -H5EA_dblock_t * dblock = NULL; /* Pointer to data block for EA */ -H5EA_dblk_page_t *dblk_page = NULL; /* Pointer to data block page for EA */ -unsigned iblock_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting index block */ -unsigned sblock_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting super block */ -hbool_t stats_changed = FALSE; /* Whether array statistics changed */ -hbool_t hdr_dirty = FALSE; /* Whether the array header changed */ - -/* - * Check arguments. - */ -HDassert(ea); -HDassert(hdr); -HDassert(thing); -HDassert(thing_elmt_buf); -HDassert(thing_unprot_func); - -/* only the H5AC__READ_ONLY_FLAG may be set in thing_acc */ -HDassert((thing_acc & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); - -/* Set the shared array header's file context for this operation */ -hdr->f = ea->f; - -/* Reset the pointers to the 'thing' info */ -*thing = NULL; -*thing_elmt_buf = NULL; -*thing_elmt_idx = 0; -*thing_unprot_func = (H5EA__unprotect_func_t)NULL; - -/* Check if we should create the index block */ -if (!H5F_addr_defined(hdr->idx_blk_addr)) { - /* Check if we are allowed to create the thing */ - if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */ - /* Create the index block */ - hdr->idx_blk_addr = H5EA__iblock_create(hdr, &stats_changed); - if (!H5F_addr_defined(hdr->idx_blk_addr)) - H5E_THROW(H5E_CANTCREATE, "unable to create index block") - hdr_dirty = TRUE; - } /* end if */ - else - H5_LEAVE(SUCCEED) -} /* end if */ - -/* Protect index block */ -if (NULL == (iblock = H5EA__iblock_protect(hdr, thing_acc))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", - (unsigned long long)hdr->idx_blk_addr) - -/* Check if element is in index block */ -if (idx < hdr->cparam.idx_blk_elmts) { - /* Set 'thing' info to refer to the index block */ - *thing = iblock; - *thing_elmt_buf = (uint8_t *)iblock->elmts; - *thing_elmt_idx = idx; - *thing_unprot_func = (H5EA__unprotect_func_t)H5EA__iblock_unprotect; -} /* end if */ -else { - unsigned sblk_idx; /* Which superblock does this index fall in? */ - size_t dblk_idx; /* Data block index */ - hsize_t elmt_idx; /* Offset of element in super block */ - - /* Get super block index where element is located */ - sblk_idx = H5EA__dblock_sblk_idx(hdr, idx); - - /* Adjust index to offset in super block */ - elmt_idx = idx - (hdr->cparam.idx_blk_elmts + hdr->sblk_info[sblk_idx].start_idx); - - /* Check for data block containing element address in the index block */ - if (sblk_idx < iblock->nsblks) { - /* Compute the data block index in index block */ - dblk_idx = - (size_t)(hdr->sblk_info[sblk_idx].start_dblk + (elmt_idx / hdr->sblk_info[sblk_idx].dblk_nelmts)); - HDassert(dblk_idx < iblock->ndblk_addrs); - - /* Check if the data block has been allocated on disk yet */ - if (!H5F_addr_defined(iblock->dblk_addrs[dblk_idx])) { - /* Check if we are allowed to create the thing */ - if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */ - haddr_t dblk_addr; /* Address of data block created */ - hsize_t dblk_off; /* Offset of data block in array */ - - /* Create data block */ - dblk_off = - hdr->sblk_info[sblk_idx].start_idx + (dblk_idx * hdr->sblk_info[sblk_idx].dblk_nelmts); - dblk_addr = H5EA__dblock_create(hdr, iblock, &stats_changed, dblk_off, - hdr->sblk_info[sblk_idx].dblk_nelmts); - if (!H5F_addr_defined(dblk_addr)) - H5E_THROW(H5E_CANTCREATE, "unable to create extensible array data block") - - /* Set data block address in index block */ - iblock->dblk_addrs[dblk_idx] = dblk_addr; - iblock_cache_flags |= H5AC__DIRTIED_FLAG; - } /* end if */ - else - H5_LEAVE(SUCCEED) - } /* end if */ - - /* Protect data block */ - if (NULL == (dblock = H5EA__dblock_protect(hdr, iblock, iblock->dblk_addrs[dblk_idx], - hdr->sblk_info[sblk_idx].dblk_nelmts, thing_acc))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", - (unsigned long long)iblock->dblk_addrs[dblk_idx]) - - /* Adjust index to offset in data block */ - elmt_idx %= hdr->sblk_info[sblk_idx].dblk_nelmts; - - /* Check if there is already a dependency on the header */ - if (will_extend && !dblock->has_hdr_depend) { - if (H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblock) < 0) - H5E_THROW(H5E_CANTDEPEND, - "unable to create flush dependency between data block and header, index = %llu", - (unsigned long long)idx) - dblock->has_hdr_depend = TRUE; - } /* end if */ - - /* Set 'thing' info to refer to the data block */ - *thing = dblock; - *thing_elmt_buf = (uint8_t *)dblock->elmts; - *thing_elmt_idx = elmt_idx; - *thing_unprot_func = (H5EA__unprotect_func_t)H5EA__dblock_unprotect; - } /* end if */ - else { - size_t sblk_off; /* Offset of super block in index block array of super blocks */ - - /* Calculate offset of super block in index block's array */ - sblk_off = sblk_idx - iblock->nsblks; - - /* Check if the super block has been allocated on disk yet */ - if (!H5F_addr_defined(iblock->sblk_addrs[sblk_off])) { - /* Check if we are allowed to create the thing */ - if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */ - haddr_t sblk_addr; /* Address of data block created */ + /* Local variables */ + H5EA_hdr_t * hdr = ea->hdr; /* Header for EA */ + H5EA_iblock_t * iblock = NULL; /* Pointer to index block for EA */ + H5EA_sblock_t * sblock = NULL; /* Pointer to super block for EA */ + H5EA_dblock_t * dblock = NULL; /* Pointer to data block for EA */ + H5EA_dblk_page_t *dblk_page = NULL; /* Pointer to data block page for EA */ + unsigned iblock_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting index block */ + unsigned sblock_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting super block */ + hbool_t stats_changed = FALSE; /* Whether array statistics changed */ + hbool_t hdr_dirty = FALSE; /* Whether the array header changed */ + + /* + * Check arguments. + */ + HDassert(ea); + HDassert(hdr); + HDassert(thing); + HDassert(thing_elmt_buf); + HDassert(thing_unprot_func); + + /* only the H5AC__READ_ONLY_FLAG may be set in thing_acc */ + HDassert((thing_acc & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); - /* Create super block */ - sblk_addr = H5EA__sblock_create(hdr, iblock, &stats_changed, sblk_idx); - if (!H5F_addr_defined(sblk_addr)) - H5E_THROW(H5E_CANTCREATE, "unable to create extensible array super block") + /* Set the shared array header's file context for this operation */ + hdr->f = ea->f; - /* Set super block address in index block */ - iblock->sblk_addrs[sblk_off] = sblk_addr; - iblock_cache_flags |= H5AC__DIRTIED_FLAG; - } /* end if */ - else - H5_LEAVE(SUCCEED) - } /* end if */ + /* Reset the pointers to the 'thing' info */ + *thing = NULL; + *thing_elmt_buf = NULL; + *thing_elmt_idx = 0; + *thing_unprot_func = (H5EA__unprotect_func_t)NULL; - /* Protect super block */ - if (NULL == - (sblock = H5EA__sblock_protect(hdr, iblock, iblock->sblk_addrs[sblk_off], sblk_idx, thing_acc))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", - (unsigned long long)iblock->sblk_addrs[sblk_off]) - - /* Compute the data block index in super block */ - dblk_idx = (size_t)(elmt_idx / sblock->dblk_nelmts); - HDassert(dblk_idx < sblock->ndblks); - - /* Check if the data block has been allocated on disk yet */ - if (!H5F_addr_defined(sblock->dblk_addrs[dblk_idx])) { - /* Check if we are allowed to create the thing */ - if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */ - haddr_t dblk_addr; /* Address of data block created */ - hsize_t dblk_off; /* Offset of data block in array */ - - /* Create data block */ - dblk_off = - hdr->sblk_info[sblk_idx].start_idx + (dblk_idx * hdr->sblk_info[sblk_idx].dblk_nelmts); - dblk_addr = H5EA__dblock_create(hdr, sblock, &stats_changed, dblk_off, sblock->dblk_nelmts); - if (!H5F_addr_defined(dblk_addr)) - H5E_THROW(H5E_CANTCREATE, "unable to create extensible array data block") - - /* Set data block address in index block */ - sblock->dblk_addrs[dblk_idx] = dblk_addr; - sblock_cache_flags |= H5AC__DIRTIED_FLAG; - - /* Create flush dependency on header, if extending the array and one doesn't already exist */ - if (will_extend && !sblock->has_hdr_depend) { - if (H5EA__create_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0) - H5E_THROW(H5E_CANTDEPEND, - "unable to create flush dependency between super block and header, address " - "= %llu", - (unsigned long long)sblock->addr) - sblock->has_hdr_depend = TRUE; - } /* end if */ - } /* end if */ - else - H5_LEAVE(SUCCEED) + /* Check if we should create the index block */ + if (!H5F_addr_defined(hdr->idx_blk_addr)) { + /* Check if we are allowed to create the thing */ + if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */ + /* Create the index block */ + hdr->idx_blk_addr = H5EA__iblock_create(hdr, &stats_changed); + if (!H5F_addr_defined(hdr->idx_blk_addr)) + H5E_THROW(H5E_CANTCREATE, "unable to create index block") + hdr_dirty = TRUE; } /* end if */ + else + H5_LEAVE(SUCCEED) + } /* end if */ - /* Adjust index to offset in data block */ - elmt_idx %= sblock->dblk_nelmts; - - /* Check if the data block is paged */ - if (sblock->dblk_npages) { - haddr_t dblk_page_addr; /* Address of data block page */ - size_t page_idx; /* Index of page within data block */ - size_t page_init_idx; /* Index of 'page init' bit */ - - /* Compute page index */ - page_idx = (size_t)elmt_idx / hdr->dblk_page_nelmts; + /* Protect index block */ + if (NULL == (iblock = H5EA__iblock_protect(hdr, thing_acc))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", + (unsigned long long)hdr->idx_blk_addr) + + /* Check if element is in index block */ + if (idx < hdr->cparam.idx_blk_elmts) { + /* Set 'thing' info to refer to the index block */ + *thing = iblock; + *thing_elmt_buf = (uint8_t *)iblock->elmts; + *thing_elmt_idx = idx; + *thing_unprot_func = (H5EA__unprotect_func_t)H5EA__iblock_unprotect; + } /* end if */ + else { + unsigned sblk_idx; /* Which superblock does this index fall in? */ + size_t dblk_idx; /* Data block index */ + hsize_t elmt_idx; /* Offset of element in super block */ - /* Compute 'page init' index */ - page_init_idx = (dblk_idx * sblock->dblk_npages) + page_idx; + /* Get super block index where element is located */ + sblk_idx = H5EA__dblock_sblk_idx(hdr, idx); - /* Adjust index to offset in data block page */ - elmt_idx %= hdr->dblk_page_nelmts; + /* Adjust index to offset in super block */ + elmt_idx = idx - (hdr->cparam.idx_blk_elmts + hdr->sblk_info[sblk_idx].start_idx); - /* Compute data block page address */ - dblk_page_addr = sblock->dblk_addrs[dblk_idx] + H5EA_DBLOCK_PREFIX_SIZE(sblock) + - (page_idx * sblock->dblk_page_size); + /* Check for data block containing element address in the index block */ + if (sblk_idx < iblock->nsblks) { + /* Compute the data block index in index block */ + dblk_idx = (size_t)(hdr->sblk_info[sblk_idx].start_dblk + + (elmt_idx / hdr->sblk_info[sblk_idx].dblk_nelmts)); + HDassert(dblk_idx < iblock->ndblk_addrs); - /* Check if page has been initialized yet */ - if (!H5VM_bit_get(sblock->page_init, page_init_idx)) { + /* Check if the data block has been allocated on disk yet */ + if (!H5F_addr_defined(iblock->dblk_addrs[dblk_idx])) { /* Check if we are allowed to create the thing */ if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */ - /* Create the data block page */ - if (H5EA__dblk_page_create(hdr, sblock, dblk_page_addr) < 0) - H5E_THROW(H5E_CANTCREATE, "unable to create data block page") - - /* Mark data block page as initialized in super block */ - H5VM_bit_set(sblock->page_init, page_init_idx, TRUE); - sblock_cache_flags |= H5AC__DIRTIED_FLAG; + haddr_t dblk_addr; /* Address of data block created */ + hsize_t dblk_off; /* Offset of data block in array */ + + /* Create data block */ + dblk_off = hdr->sblk_info[sblk_idx].start_idx + + (dblk_idx * hdr->sblk_info[sblk_idx].dblk_nelmts); + dblk_addr = H5EA__dblock_create(hdr, iblock, &stats_changed, dblk_off, + hdr->sblk_info[sblk_idx].dblk_nelmts); + if (!H5F_addr_defined(dblk_addr)) + H5E_THROW(H5E_CANTCREATE, "unable to create extensible array data block") + + /* Set data block address in index block */ + iblock->dblk_addrs[dblk_idx] = dblk_addr; + iblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else H5_LEAVE(SUCCEED) } /* end if */ - /* Protect data block page */ - if (NULL == (dblk_page = H5EA__dblk_page_protect(hdr, sblock, dblk_page_addr, thing_acc))) - H5E_THROW(H5E_CANTPROTECT, - "unable to protect extensible array data block page, address = %llu", - (unsigned long long)dblk_page_addr) - - /* Check if there is already a dependency on the header */ - if (will_extend && !dblk_page->has_hdr_depend) { - if (H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblk_page) < 0) - H5E_THROW( - H5E_CANTDEPEND, - "unable to create flush dependency between data block page and header, index = %llu", - (unsigned long long)idx) - dblk_page->has_hdr_depend = TRUE; - } /* end if */ - - /* Set 'thing' info to refer to the data block page */ - *thing = dblk_page; - *thing_elmt_buf = (uint8_t *)dblk_page->elmts; - *thing_elmt_idx = elmt_idx; - *thing_unprot_func = (H5EA__unprotect_func_t)H5EA__dblk_page_unprotect; - } /* end if */ - else { /* Protect data block */ - if (NULL == (dblock = H5EA__dblock_protect(hdr, sblock, sblock->dblk_addrs[dblk_idx], - sblock->dblk_nelmts, thing_acc))) + if (NULL == (dblock = H5EA__dblock_protect(hdr, iblock, iblock->dblk_addrs[dblk_idx], + hdr->sblk_info[sblk_idx].dblk_nelmts, thing_acc))) H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", - (unsigned long long)sblock->dblk_addrs[dblk_idx]) + (unsigned long long)iblock->dblk_addrs[dblk_idx]) + + /* Adjust index to offset in data block */ + elmt_idx %= hdr->sblk_info[sblk_idx].dblk_nelmts; /* Check if there is already a dependency on the header */ if (will_extend && !dblock->has_hdr_depend) { @@ -598,42 +449,196 @@ else { *thing_elmt_buf = (uint8_t *)dblock->elmts; *thing_elmt_idx = elmt_idx; *thing_unprot_func = (H5EA__unprotect_func_t)H5EA__dblock_unprotect; - } /* end else */ - } /* end else */ -} /* end else */ + } /* end if */ + else { + size_t sblk_off; /* Offset of super block in index block array of super blocks */ -/* Sanity checks */ -HDassert(*thing != NULL); -HDassert(*thing_unprot_func != NULL); + /* Calculate offset of super block in index block's array */ + sblk_off = sblk_idx - iblock->nsblks; -CATCH -/* Reset 'thing' info on error */ -if (ret_value < 0) { - *thing = NULL; - *thing_elmt_buf = NULL; - *thing_elmt_idx = 0; - *thing_unprot_func = (H5EA__unprotect_func_t)NULL; -} /* end if */ - -/* Check for updating array statistics */ -if (stats_changed) - hdr_dirty = TRUE; - -/* Check for header modified */ -if (hdr_dirty) - if (H5EA__hdr_modified(hdr) < 0) - H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as modified") - -/* Release resources */ -if (iblock && *thing != iblock && H5EA__iblock_unprotect(iblock, iblock_cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block") -/* (Note: super blocks don't contain elements, so don't have a '*thing != sblock' check) */ -if (sblock && H5EA__sblock_unprotect(sblock, sblock_cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block") -if (dblock && *thing != dblock && H5EA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block") -if (dblk_page && *thing != dblk_page && H5EA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block page") + /* Check if the super block has been allocated on disk yet */ + if (!H5F_addr_defined(iblock->sblk_addrs[sblk_off])) { + /* Check if we are allowed to create the thing */ + if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */ + haddr_t sblk_addr; /* Address of data block created */ + + /* Create super block */ + sblk_addr = H5EA__sblock_create(hdr, iblock, &stats_changed, sblk_idx); + if (!H5F_addr_defined(sblk_addr)) + H5E_THROW(H5E_CANTCREATE, "unable to create extensible array super block") + + /* Set super block address in index block */ + iblock->sblk_addrs[sblk_off] = sblk_addr; + iblock_cache_flags |= H5AC__DIRTIED_FLAG; + } /* end if */ + else + H5_LEAVE(SUCCEED) + } /* end if */ + + /* Protect super block */ + if (NULL == (sblock = H5EA__sblock_protect(hdr, iblock, iblock->sblk_addrs[sblk_off], sblk_idx, + thing_acc))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", + (unsigned long long)iblock->sblk_addrs[sblk_off]) + + /* Compute the data block index in super block */ + dblk_idx = (size_t)(elmt_idx / sblock->dblk_nelmts); + HDassert(dblk_idx < sblock->ndblks); + + /* Check if the data block has been allocated on disk yet */ + if (!H5F_addr_defined(sblock->dblk_addrs[dblk_idx])) { + /* Check if we are allowed to create the thing */ + if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */ + haddr_t dblk_addr; /* Address of data block created */ + hsize_t dblk_off; /* Offset of data block in array */ + + /* Create data block */ + dblk_off = hdr->sblk_info[sblk_idx].start_idx + + (dblk_idx * hdr->sblk_info[sblk_idx].dblk_nelmts); + dblk_addr = + H5EA__dblock_create(hdr, sblock, &stats_changed, dblk_off, sblock->dblk_nelmts); + if (!H5F_addr_defined(dblk_addr)) + H5E_THROW(H5E_CANTCREATE, "unable to create extensible array data block") + + /* Set data block address in index block */ + sblock->dblk_addrs[dblk_idx] = dblk_addr; + sblock_cache_flags |= H5AC__DIRTIED_FLAG; + + /* Create flush dependency on header, if extending the array and one doesn't already exist + */ + if (will_extend && !sblock->has_hdr_depend) { + if (H5EA__create_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0) + H5E_THROW( + H5E_CANTDEPEND, + "unable to create flush dependency between super block and header, address " + "= %llu", + (unsigned long long)sblock->addr) + sblock->has_hdr_depend = TRUE; + } /* end if */ + } /* end if */ + else + H5_LEAVE(SUCCEED) + } /* end if */ + + /* Adjust index to offset in data block */ + elmt_idx %= sblock->dblk_nelmts; + + /* Check if the data block is paged */ + if (sblock->dblk_npages) { + haddr_t dblk_page_addr; /* Address of data block page */ + size_t page_idx; /* Index of page within data block */ + size_t page_init_idx; /* Index of 'page init' bit */ + + /* Compute page index */ + page_idx = (size_t)elmt_idx / hdr->dblk_page_nelmts; + + /* Compute 'page init' index */ + page_init_idx = (dblk_idx * sblock->dblk_npages) + page_idx; + + /* Adjust index to offset in data block page */ + elmt_idx %= hdr->dblk_page_nelmts; + + /* Compute data block page address */ + dblk_page_addr = sblock->dblk_addrs[dblk_idx] + H5EA_DBLOCK_PREFIX_SIZE(sblock) + + (page_idx * sblock->dblk_page_size); + + /* Check if page has been initialized yet */ + if (!H5VM_bit_get(sblock->page_init, page_init_idx)) { + /* Check if we are allowed to create the thing */ + if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */ + /* Create the data block page */ + if (H5EA__dblk_page_create(hdr, sblock, dblk_page_addr) < 0) + H5E_THROW(H5E_CANTCREATE, "unable to create data block page") + + /* Mark data block page as initialized in super block */ + H5VM_bit_set(sblock->page_init, page_init_idx, TRUE); + sblock_cache_flags |= H5AC__DIRTIED_FLAG; + } /* end if */ + else + H5_LEAVE(SUCCEED) + } /* end if */ + + /* Protect data block page */ + if (NULL == (dblk_page = H5EA__dblk_page_protect(hdr, sblock, dblk_page_addr, thing_acc))) + H5E_THROW(H5E_CANTPROTECT, + "unable to protect extensible array data block page, address = %llu", + (unsigned long long)dblk_page_addr) + + /* Check if there is already a dependency on the header */ + if (will_extend && !dblk_page->has_hdr_depend) { + if (H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblk_page) < 0) + H5E_THROW(H5E_CANTDEPEND, + "unable to create flush dependency between data block page and header, " + "index = %llu", + (unsigned long long)idx) + dblk_page->has_hdr_depend = TRUE; + } /* end if */ + + /* Set 'thing' info to refer to the data block page */ + *thing = dblk_page; + *thing_elmt_buf = (uint8_t *)dblk_page->elmts; + *thing_elmt_idx = elmt_idx; + *thing_unprot_func = (H5EA__unprotect_func_t)H5EA__dblk_page_unprotect; + } /* end if */ + else { + /* Protect data block */ + if (NULL == (dblock = H5EA__dblock_protect(hdr, sblock, sblock->dblk_addrs[dblk_idx], + sblock->dblk_nelmts, thing_acc))) + H5E_THROW(H5E_CANTPROTECT, + "unable to protect extensible array data block, address = %llu", + (unsigned long long)sblock->dblk_addrs[dblk_idx]) + + /* Check if there is already a dependency on the header */ + if (will_extend && !dblock->has_hdr_depend) { + if (H5EA__create_flush_depend((H5AC_info_t *)hdr, (H5AC_info_t *)dblock) < 0) + H5E_THROW( + H5E_CANTDEPEND, + "unable to create flush dependency between data block and header, index = %llu", + (unsigned long long)idx) + dblock->has_hdr_depend = TRUE; + } /* end if */ + + /* Set 'thing' info to refer to the data block */ + *thing = dblock; + *thing_elmt_buf = (uint8_t *)dblock->elmts; + *thing_elmt_idx = elmt_idx; + *thing_unprot_func = (H5EA__unprotect_func_t)H5EA__dblock_unprotect; + } /* end else */ + } /* end else */ + } /* end else */ + + /* Sanity checks */ + HDassert(*thing != NULL); + HDassert(*thing_unprot_func != NULL); + + CATCH + /* Reset 'thing' info on error */ + if (ret_value < 0) { + *thing = NULL; + *thing_elmt_buf = NULL; + *thing_elmt_idx = 0; + *thing_unprot_func = (H5EA__unprotect_func_t)NULL; + } /* end if */ + + /* Check for updating array statistics */ + if (stats_changed) + hdr_dirty = TRUE; + + /* Check for header modified */ + if (hdr_dirty) + if (H5EA__hdr_modified(hdr) < 0) + H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as modified") + + /* Release resources */ + if (iblock && *thing != iblock && H5EA__iblock_unprotect(iblock, iblock_cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block") + /* (Note: super blocks don't contain elements, so don't have a '*thing != sblock' check) */ + if (sblock && H5EA__sblock_unprotect(sblock, sblock_cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block") + if (dblock && *thing != dblock && H5EA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block") + if (dblk_page && *thing != dblk_page && H5EA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block page") END_FUNC(STATIC) /* end H5EA__lookup_elmt() */ @@ -651,52 +656,52 @@ END_FUNC(STATIC) /* end H5EA__lookup_elmt() */ */ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_set(const H5EA_t *ea, hsize_t idx, const void *elmt)) -/* Local variables */ -H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */ -void * thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */ -uint8_t * thing_elmt_buf; /* Pointer to the element buffer for the array metadata */ -hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */ -H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */ -hbool_t will_extend; /* Flag indicating if setting the element will extend the array */ -unsigned thing_cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting array metadata */ - -/* - * Check arguments. - */ -HDassert(ea); -HDassert(hdr); - -/* Set the shared array header's file context for this operation */ -hdr->f = ea->f; - -/* Look up the array metadata containing the element we want to set */ -will_extend = (idx >= hdr->stats.stored.max_idx_set); -if (H5EA__lookup_elmt(ea, idx, will_extend, H5AC__NO_FLAGS_SET, &thing, &thing_elmt_buf, &thing_elmt_idx, - &thing_unprot_func) < 0) - H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata") - -/* Sanity check */ -HDassert(thing); -HDassert(thing_elmt_buf); -HDassert(thing_unprot_func); - -/* Set element in thing's element buffer */ -H5MM_memcpy(thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), elmt, - hdr->cparam.cls->nat_elmt_size); -thing_cache_flags |= H5AC__DIRTIED_FLAG; - -/* Update max. element set in array, if appropriate */ -if (will_extend) { - /* Update the max index for the array */ - hdr->stats.stored.max_idx_set = idx + 1; - if (H5EA__hdr_modified(hdr) < 0) - H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as modified") -} /* end if */ - -CATCH -/* Release resources */ -if (thing && (thing_unprot_func)(thing, thing_cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata") + /* Local variables */ + H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */ + void * thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */ + uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */ + hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */ + H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */ + hbool_t will_extend; /* Flag indicating if setting the element will extend the array */ + unsigned thing_cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting array metadata */ + + /* + * Check arguments. + */ + HDassert(ea); + HDassert(hdr); + + /* Set the shared array header's file context for this operation */ + hdr->f = ea->f; + + /* Look up the array metadata containing the element we want to set */ + will_extend = (idx >= hdr->stats.stored.max_idx_set); + if (H5EA__lookup_elmt(ea, idx, will_extend, H5AC__NO_FLAGS_SET, &thing, &thing_elmt_buf, &thing_elmt_idx, + &thing_unprot_func) < 0) + H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata") + + /* Sanity check */ + HDassert(thing); + HDassert(thing_elmt_buf); + HDassert(thing_unprot_func); + + /* Set element in thing's element buffer */ + H5MM_memcpy(thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), elmt, + hdr->cparam.cls->nat_elmt_size); + thing_cache_flags |= H5AC__DIRTIED_FLAG; + + /* Update max. element set in array, if appropriate */ + if (will_extend) { + /* Update the max index for the array */ + hdr->stats.stored.max_idx_set = idx + 1; + if (H5EA__hdr_modified(hdr) < 0) + H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as modified") + } /* end if */ + + CATCH + /* Release resources */ + if (thing && (thing_unprot_func)(thing, thing_cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata") END_FUNC(PRIV) /* end H5EA_set() */ @@ -714,51 +719,51 @@ END_FUNC(PRIV) /* end H5EA_set() */ */ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_get(const H5EA_t *ea, hsize_t idx, void *elmt)) -/* Local variables */ -H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */ -void * thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */ -H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */ - -/* - * Check arguments. - */ -HDassert(ea); -HDassert(hdr); - -/* Check for element beyond max. element in array */ -if (idx >= hdr->stats.stored.max_idx_set) { - /* Call the class's 'fill' callback */ - if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) - H5E_THROW(H5E_CANTSET, "can't set element to class's fill value") -} /* end if */ -else { - uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */ - hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */ - - /* Set the shared array header's file context for this operation */ - hdr->f = ea->f; + /* Local variables */ + H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */ + void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */ + H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */ - /* Look up the array metadata containing the element we want to set */ - if (H5EA__lookup_elmt(ea, idx, FALSE, H5AC__READ_ONLY_FLAG, &thing, &thing_elmt_buf, &thing_elmt_idx, - &thing_unprot_func) < 0) - H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata") + /* + * Check arguments. + */ + HDassert(ea); + HDassert(hdr); - /* Check if the thing holding the element has been created yet */ - if (NULL == thing) { + /* Check for element beyond max. element in array */ + if (idx >= hdr->stats.stored.max_idx_set) { /* Call the class's 'fill' callback */ if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) H5E_THROW(H5E_CANTSET, "can't set element to class's fill value") } /* end if */ - else - /* Get element from thing's element buffer */ - H5MM_memcpy(elmt, thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), - hdr->cparam.cls->nat_elmt_size); -} /* end else */ + else { + uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */ + hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */ + + /* Set the shared array header's file context for this operation */ + hdr->f = ea->f; + + /* Look up the array metadata containing the element we want to set */ + if (H5EA__lookup_elmt(ea, idx, FALSE, H5AC__READ_ONLY_FLAG, &thing, &thing_elmt_buf, &thing_elmt_idx, + &thing_unprot_func) < 0) + H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata") + + /* Check if the thing holding the element has been created yet */ + if (NULL == thing) { + /* Call the class's 'fill' callback */ + if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) + H5E_THROW(H5E_CANTSET, "can't set element to class's fill value") + } /* end if */ + else + /* Get element from thing's element buffer */ + H5MM_memcpy(elmt, thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), + hdr->cparam.cls->nat_elmt_size); + } /* end else */ -CATCH -/* Release thing */ -if (thing && (thing_unprot_func)(thing, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata") + CATCH + /* Release thing */ + if (thing && (thing_unprot_func)(thing, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata") END_FUNC(PRIV) /* end H5EA_get() */ @@ -777,35 +782,35 @@ END_FUNC(PRIV) /* end H5EA_get() */ */ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_depend(H5EA_t *ea, H5AC_proxy_entry_t *parent)) -/* Local variables */ -H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */ + /* Local variables */ + H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */ + + /* + * Check arguments. + */ + HDassert(ea); + HDassert(hdr); + HDassert(parent); + + /* + * Check to see if a flush dependency between the extensible array + * and another data structure in the file has already been set up. + * If it hasn't, do so now. + */ + if (NULL == hdr->parent) { + /* Sanity check */ + HDassert(hdr->top_proxy); -/* - * Check arguments. - */ -HDassert(ea); -HDassert(hdr); -HDassert(parent); - -/* - * Check to see if a flush dependency between the extensible array - * and another data structure in the file has already been set up. - * If it hasn't, do so now. - */ -if (NULL == hdr->parent) { - /* Sanity check */ - HDassert(hdr->top_proxy); - - /* Set the shared array header's file context for this operation */ - hdr->f = ea->f; + /* Set the shared array header's file context for this operation */ + hdr->f = ea->f; - /* Add the extensible array as a child of the parent (proxy) */ - if (H5AC_proxy_entry_add_child(parent, hdr->f, hdr->top_proxy) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array as child of proxy") - hdr->parent = parent; -} /* end if */ + /* Add the extensible array as a child of the parent (proxy) */ + if (H5AC_proxy_entry_add_child(parent, hdr->f, hdr->top_proxy) < 0) + H5E_THROW(H5E_CANTSET, "unable to add extensible array as child of proxy") + hdr->parent = parent; + } /* end if */ -CATCH + CATCH END_FUNC(PRIV) /* end H5EA_depend() */ @@ -823,87 +828,88 @@ END_FUNC(PRIV) /* end H5EA_depend() */ */ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_close(H5EA_t *ea)) -/* Local variables */ -hbool_t pending_delete = FALSE; /* Whether the array is pending deletion */ -haddr_t ea_addr = HADDR_UNDEF; /* Address of array (for deletion) */ - -/* - * Check arguments. - */ -HDassert(ea); - -/* Close the header, if it was set */ -if (ea->hdr) { - /* Decrement file reference & check if this is the last open extensible array using the shared array - * header */ - if (0 == H5EA__hdr_fuse_decr(ea->hdr)) { - /* Set the shared array header's file context for this operation */ - ea->hdr->f = ea->f; - - /* Shut down anything that can't be put in the header's 'flush' callback */ + /* Local variables */ + hbool_t pending_delete = FALSE; /* Whether the array is pending deletion */ + haddr_t ea_addr = HADDR_UNDEF; /* Address of array (for deletion) */ + + /* + * Check arguments. + */ + HDassert(ea); + + /* Close the header, if it was set */ + if (ea->hdr) { + /* Decrement file reference & check if this is the last open extensible array using the shared array + * header */ + if (0 == H5EA__hdr_fuse_decr(ea->hdr)) { + /* Set the shared array header's file context for this operation */ + ea->hdr->f = ea->f; + + /* Shut down anything that can't be put in the header's 'flush' callback */ + + /* Check for pending array deletion */ + if (ea->hdr->pending_delete) { + /* Set local info, so array deletion can occur after decrementing the + * header's ref count + */ + pending_delete = TRUE; + ea_addr = ea->hdr->addr; + } /* end if */ + } /* end if */ /* Check for pending array deletion */ - if (ea->hdr->pending_delete) { - /* Set local info, so array deletion can occur after decrementing the - * header's ref count - */ - pending_delete = TRUE; - ea_addr = ea->hdr->addr; - } /* end if */ - } /* end if */ - - /* Check for pending array deletion */ - if (pending_delete) { - H5EA_hdr_t *hdr; /* Another pointer to extensible array header */ + if (pending_delete) { + H5EA_hdr_t *hdr; /* Another pointer to extensible array header */ #ifndef NDEBUG - { - unsigned hdr_status = 0; /* Header's status in the metadata cache */ - - /* Check the header's status in the metadata cache */ - if (H5AC_get_entry_status(ea->f, ea_addr, &hdr_status) < 0) - H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for extensible array header") - - /* Sanity checks on header */ - HDassert(hdr_status & H5AC_ES__IN_CACHE); - HDassert(hdr_status & H5AC_ES__IS_PINNED); - HDassert(!(hdr_status & H5AC_ES__IS_PROTECTED)); - } + { + unsigned hdr_status = 0; /* Header's status in the metadata cache */ + + /* Check the header's status in the metadata cache */ + if (H5AC_get_entry_status(ea->f, ea_addr, &hdr_status) < 0) + H5E_THROW(H5E_CANTGET, + "unable to check metadata cache status for extensible array header") + + /* Sanity checks on header */ + HDassert(hdr_status & H5AC_ES__IN_CACHE); + HDassert(hdr_status & H5AC_ES__IS_PINNED); + HDassert(!(hdr_status & H5AC_ES__IS_PROTECTED)); + } #endif /* NDEBUG */ - /* Lock the array header into memory */ - /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */ - if (NULL == (hdr = H5EA__hdr_protect(ea->f, ea_addr, NULL, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTLOAD, "unable to load extensible array header") + /* Lock the array header into memory */ + /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */ + if (NULL == (hdr = H5EA__hdr_protect(ea->f, ea_addr, NULL, H5AC__NO_FLAGS_SET))) + H5E_THROW(H5E_CANTLOAD, "unable to load extensible array header") - /* Set the shared array header's file context for this operation */ - hdr->f = ea->f; + /* Set the shared array header's file context for this operation */ + hdr->f = ea->f; - /* Decrement the reference count on the array header */ - /* (don't put in H5EA_hdr_fuse_decr() as the array header may be evicted - * immediately -QAK) - */ - if (H5EA__hdr_decr(ea->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + /* Decrement the reference count on the array header */ + /* (don't put in H5EA_hdr_fuse_decr() as the array header may be evicted + * immediately -QAK) + */ + if (H5EA__hdr_decr(ea->hdr) < 0) + H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") - /* Delete array, starting with header (unprotects header) */ - if (H5EA__hdr_delete(hdr) < 0) - H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array") - } /* end if */ - else { - /* Decrement the reference count on the array header */ - /* (don't put in H5EA_hdr_fuse_decr() as the array header may be evicted - * immediately -QAK) - */ - if (H5EA__hdr_decr(ea->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") - } /* end else */ -} /* end if */ + /* Delete array, starting with header (unprotects header) */ + if (H5EA__hdr_delete(hdr) < 0) + H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array") + } /* end if */ + else { + /* Decrement the reference count on the array header */ + /* (don't put in H5EA_hdr_fuse_decr() as the array header may be evicted + * immediately -QAK) + */ + if (H5EA__hdr_decr(ea->hdr) < 0) + H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + } /* end else */ + } /* end if */ -/* Release the extensible array wrapper */ -ea = (H5EA_t *)H5FL_FREE(H5EA_t, ea); + /* Release the extensible array wrapper */ + ea = (H5EA_t *)H5FL_FREE(H5EA_t, ea); -CATCH + CATCH END_FUNC(PRIV) /* end H5EA_close() */ @@ -921,38 +927,38 @@ END_FUNC(PRIV) /* end H5EA_close() */ */ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_delete(H5F_t *f, haddr_t ea_addr, void *ctx_udata)) -/* Local variables */ -H5EA_hdr_t *hdr = NULL; /* The fractal heap header information */ + /* Local variables */ + H5EA_hdr_t *hdr = NULL; /* The fractal heap header information */ -/* - * Check arguments. - */ -HDassert(f); -HDassert(H5F_addr_defined(ea_addr)); - -/* Lock the array header into memory */ -if (NULL == (hdr = H5EA__hdr_protect(f, ea_addr, ctx_udata, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu", - (unsigned long long)ea_addr) - -/* Check for files using shared array header */ -if (hdr->file_rc) - hdr->pending_delete = TRUE; -else { - /* Set the shared array header's file context for this operation */ - hdr->f = f; + /* + * Check arguments. + */ + HDassert(f); + HDassert(H5F_addr_defined(ea_addr)); - /* Delete array now, starting with header (unprotects header) */ - if (H5EA__hdr_delete(hdr) < 0) - H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array") - hdr = NULL; -} /* end if */ + /* Lock the array header into memory */ + if (NULL == (hdr = H5EA__hdr_protect(f, ea_addr, ctx_udata, H5AC__NO_FLAGS_SET))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu", + (unsigned long long)ea_addr) -CATCH + /* Check for files using shared array header */ + if (hdr->file_rc) + hdr->pending_delete = TRUE; + else { + /* Set the shared array header's file context for this operation */ + hdr->f = f; + + /* Delete array now, starting with header (unprotects header) */ + if (H5EA__hdr_delete(hdr) < 0) + H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array") + hdr = NULL; + } /* end if */ + + CATCH -/* Unprotect the header, if an error occurred */ -if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + /* Unprotect the header, if an error occurred */ + if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") END_FUNC(PRIV) /* end H5EA_delete() */ @@ -971,37 +977,37 @@ END_FUNC(PRIV) /* end H5EA_delete() */ BEGIN_FUNC(PRIV, ERR, int, H5_ITER_CONT, H5_ITER_ERROR, H5EA_iterate(H5EA_t *ea, H5EA_operator_t op, void *udata)) -/* Local variables */ -uint8_t *elmt = NULL; -hsize_t u; -int cb_ret = H5_ITER_CONT; /* Return value from callback */ - -/* Check arguments */ -HDassert(ea); -HDassert(op); -HDassert(udata); - -/* Allocate space for a native array element */ -if (NULL == (elmt = H5FL_BLK_MALLOC(ea_native_elmt, ea->hdr->cparam.cls->nat_elmt_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array element") - -/* Iterate over all elements in array */ -for (u = 0; u < ea->hdr->stats.stored.max_idx_set && cb_ret == H5_ITER_CONT; u++) { - /* Get array element */ - if (H5EA_get(ea, u, elmt) < 0) - H5E_THROW(H5E_CANTGET, "unable to delete fixed array") - - /* Make callback */ - if ((cb_ret = (*op)(u, elmt, udata)) < 0) { - H5E_PRINTF(H5E_BADITER, "iterator function failed"); - H5_LEAVE(cb_ret) - } /* end if */ -} /* end for */ + /* Local variables */ + uint8_t *elmt = NULL; + hsize_t u; + int cb_ret = H5_ITER_CONT; /* Return value from callback */ + + /* Check arguments */ + HDassert(ea); + HDassert(op); + HDassert(udata); + + /* Allocate space for a native array element */ + if (NULL == (elmt = H5FL_BLK_MALLOC(ea_native_elmt, ea->hdr->cparam.cls->nat_elmt_size))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array element") + + /* Iterate over all elements in array */ + for (u = 0; u < ea->hdr->stats.stored.max_idx_set && cb_ret == H5_ITER_CONT; u++) { + /* Get array element */ + if (H5EA_get(ea, u, elmt) < 0) + H5E_THROW(H5E_CANTGET, "unable to delete fixed array") + + /* Make callback */ + if ((cb_ret = (*op)(u, elmt, udata)) < 0) { + H5E_PRINTF(H5E_BADITER, "iterator function failed"); + H5_LEAVE(cb_ret) + } /* end if */ + } /* end for */ -CATCH + CATCH -if (elmt) - elmt = H5FL_BLK_FREE(ea_native_elmt, elmt); + if (elmt) + elmt = H5FL_BLK_FREE(ea_native_elmt, elmt); END_FUNC(PRIV) /* end H5EA_iterate() */ @@ -1019,15 +1025,15 @@ END_FUNC(PRIV) /* end H5EA_iterate() */ */ BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_patch_file(H5EA_t *ea, H5F_t *f)) -/* Local variables */ + /* Local variables */ -/* - * Check arguments. - */ -HDassert(ea); -HDassert(f); + /* + * Check arguments. + */ + HDassert(ea); + HDassert(f); -if (ea->f != f || ea->hdr->f != f) - ea->f = ea->hdr->f = f; + if (ea->f != f || ea->hdr->f != f) + ea->f = ea->hdr->f = f; END_FUNC(PRIV) /* end H5EA_patch_file() */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index d621483..6316ded 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -224,16 +224,16 @@ const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1] = {{ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len)) -/* Local variables */ -H5EA_hdr_cache_ud_t *udata = (H5EA_hdr_cache_ud_t *)_udata; /* User data for callback */ + /* Local variables */ + H5EA_hdr_cache_ud_t *udata = (H5EA_hdr_cache_ud_t *)_udata; /* User data for callback */ -/* Check arguments */ -HDassert(udata); -HDassert(udata->f); -HDassert(image_len); + /* Check arguments */ + HDassert(udata); + HDassert(udata->f); + HDassert(image_len); -/* Set the image length size */ -*image_len = (size_t)H5EA_HEADER_SIZE_FILE(udata->f); + /* Set the image length size */ + *image_len = (size_t)H5EA_HEADER_SIZE_FILE(udata->f); END_FUNC(STATIC) /* end H5EA__cache_hdr_get_initial_load_size() */ @@ -253,19 +253,19 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_get_initial_load_size() */ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, H5EA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) -/* Local variables */ -const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t stored_chksum; /* Stored metadata checksum value */ -uint32_t computed_chksum; /* Computed metadata checksum value */ + /* Local variables */ + const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + uint32_t computed_chksum; /* Computed metadata checksum value */ -/* Check arguments */ -HDassert(image); + /* Check arguments */ + HDassert(image); -/* Get stored and computed checksums */ -H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); + /* Get stored and computed checksums */ + H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); -if (stored_chksum != computed_chksum) - ret_value = FALSE; + if (stored_chksum != computed_chksum) + ret_value = FALSE; END_FUNC(STATIC) /* end H5EA__cache_hdr_verify_chksum() */ @@ -286,111 +286,111 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5EA__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)) -/* Local variables */ -H5EA_cls_id_t id; /* ID of extensible array class, as found in file */ -H5EA_hdr_t * hdr = NULL; /* Extensible array info */ -H5EA_hdr_cache_ud_t *udata = (H5EA_hdr_cache_ud_t *)_udata; -const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t stored_chksum; /* Stored metadata checksum value */ - -/* Check arguments */ -HDassert(image); -HDassert(udata); -HDassert(udata->f); -HDassert(H5F_addr_defined(udata->addr)); - -/* Allocate space for the extensible array data structure */ -if (NULL == (hdr = H5EA__hdr_alloc(udata->f))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header") - -/* Set the extensible array header's address */ -hdr->addr = udata->addr; - -/* Magic number */ -if (HDmemcmp(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - H5E_THROW(H5E_BADVALUE, "wrong extensible array header signature") -image += H5_SIZEOF_MAGIC; - -/* Version */ -if (*image++ != H5EA_HDR_VERSION) - H5E_THROW(H5E_VERSION, "wrong extensible array header version") - -/* Extensible array class */ -id = (H5EA_cls_id_t)*image++; -if (id >= H5EA_NUM_CLS_ID) - H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") -hdr->cparam.cls = H5EA_client_class_g[id]; - -/* General array creation/configuration information */ -hdr->cparam.raw_elmt_size = *image++; /* Element size in file (in bytes) */ -hdr->cparam.max_nelmts_bits = - *image++; /* Log2(Max. # of elements in array) - i.e. # of bits needed to store max. # of elements */ -hdr->cparam.idx_blk_elmts = *image++; /* # of elements to store in index block */ -hdr->cparam.data_blk_min_elmts = *image++; /* Min. # of elements per data block */ -hdr->cparam.sup_blk_min_data_ptrs = *image++; /* Min. # of data block pointers for a super block */ -hdr->cparam.max_dblk_page_nelmts_bits = - *image++; /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of - elements in data block page */ - -/* Array statistics */ -hdr->stats.computed.hdr_size = len; /* Size of header in file */ -H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.nsuper_blks); /* Number of super blocks created */ -H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.super_blk_size); /* Size of super blocks created */ -H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.ndata_blks); /* Number of data blocks created */ -H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.data_blk_size); /* Size of data blocks created */ -H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.max_idx_set); /* Max. index set (+1) */ -H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.nelmts); /* Number of elements 'realized' */ - -/* Internal information */ -H5F_addr_decode(udata->f, &image, &hdr->idx_blk_addr); /* Address of index block */ - -/* Index block statistics */ -if (H5F_addr_defined(hdr->idx_blk_addr)) { - H5EA_iblock_t iblock; /* Fake index block for computing size */ - - /* Set index block count for file */ - hdr->stats.computed.nindex_blks = 1; - - /* Set up fake index block for computing size on disk */ - iblock.hdr = hdr; - iblock.nsblks = H5EA_SBLK_FIRST_IDX(hdr->cparam.sup_blk_min_data_ptrs); - iblock.ndblk_addrs = 2 * ((size_t)hdr->cparam.sup_blk_min_data_ptrs - 1); - iblock.nsblk_addrs = hdr->nsblks - iblock.nsblks; - - /* Compute size of index block in file */ - hdr->stats.computed.index_blk_size = H5EA_IBLOCK_SIZE(&iblock); -} /* end if */ -else { - hdr->stats.computed.nindex_blks = 0; /* Number of index blocks in file */ - hdr->stats.computed.index_blk_size = 0; /* Size of index blocks in file */ -} /* end else */ - -/* Sanity check */ -/* (allow for checksum not decoded yet) */ -HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); - -/* checksum verification already done in verify_chksum cb */ - -/* Metadata checksum */ -UINT32DECODE(image, stored_chksum); - -/* Sanity check */ -HDassert((size_t)(image - (const uint8_t *)_image) == len); - -/* Finish initializing extensible array header */ -if (H5EA__hdr_init(hdr, udata->ctx_udata) < 0) - H5E_THROW(H5E_CANTINIT, "initialization failed for extensible array header") -HDassert(hdr->size == len); - -/* Set return value */ -ret_value = hdr; - -CATCH - -/* Release resources */ -if (!ret_value) - if (hdr && H5EA__hdr_dest(hdr) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header") + /* Local variables */ + H5EA_cls_id_t id; /* ID of extensible array class, as found in file */ + H5EA_hdr_t * hdr = NULL; /* Extensible array info */ + H5EA_hdr_cache_ud_t *udata = (H5EA_hdr_cache_ud_t *)_udata; + const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + + /* Check arguments */ + HDassert(image); + HDassert(udata); + HDassert(udata->f); + HDassert(H5F_addr_defined(udata->addr)); + + /* Allocate space for the extensible array data structure */ + if (NULL == (hdr = H5EA__hdr_alloc(udata->f))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header") + + /* Set the extensible array header's address */ + hdr->addr = udata->addr; + + /* Magic number */ + if (HDmemcmp(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + H5E_THROW(H5E_BADVALUE, "wrong extensible array header signature") + image += H5_SIZEOF_MAGIC; + + /* Version */ + if (*image++ != H5EA_HDR_VERSION) + H5E_THROW(H5E_VERSION, "wrong extensible array header version") + + /* Extensible array class */ + id = (H5EA_cls_id_t)*image++; + if (id >= H5EA_NUM_CLS_ID) + H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") + hdr->cparam.cls = H5EA_client_class_g[id]; + + /* General array creation/configuration information */ + hdr->cparam.raw_elmt_size = *image++; /* Element size in file (in bytes) */ + hdr->cparam.max_nelmts_bits = + *image++; /* Log2(Max. # of elements in array) - i.e. # of bits needed to store max. # of elements */ + hdr->cparam.idx_blk_elmts = *image++; /* # of elements to store in index block */ + hdr->cparam.data_blk_min_elmts = *image++; /* Min. # of elements per data block */ + hdr->cparam.sup_blk_min_data_ptrs = *image++; /* Min. # of data block pointers for a super block */ + hdr->cparam.max_dblk_page_nelmts_bits = + *image++; /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of + elements in data block page */ + + /* Array statistics */ + hdr->stats.computed.hdr_size = len; /* Size of header in file */ + H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.nsuper_blks); /* Number of super blocks created */ + H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.super_blk_size); /* Size of super blocks created */ + H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.ndata_blks); /* Number of data blocks created */ + H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.data_blk_size); /* Size of data blocks created */ + H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.max_idx_set); /* Max. index set (+1) */ + H5F_DECODE_LENGTH(udata->f, image, hdr->stats.stored.nelmts); /* Number of elements 'realized' */ + + /* Internal information */ + H5F_addr_decode(udata->f, &image, &hdr->idx_blk_addr); /* Address of index block */ + + /* Index block statistics */ + if (H5F_addr_defined(hdr->idx_blk_addr)) { + H5EA_iblock_t iblock; /* Fake index block for computing size */ + + /* Set index block count for file */ + hdr->stats.computed.nindex_blks = 1; + + /* Set up fake index block for computing size on disk */ + iblock.hdr = hdr; + iblock.nsblks = H5EA_SBLK_FIRST_IDX(hdr->cparam.sup_blk_min_data_ptrs); + iblock.ndblk_addrs = 2 * ((size_t)hdr->cparam.sup_blk_min_data_ptrs - 1); + iblock.nsblk_addrs = hdr->nsblks - iblock.nsblks; + + /* Compute size of index block in file */ + hdr->stats.computed.index_blk_size = H5EA_IBLOCK_SIZE(&iblock); + } /* end if */ + else { + hdr->stats.computed.nindex_blks = 0; /* Number of index blocks in file */ + hdr->stats.computed.index_blk_size = 0; /* Size of index blocks in file */ + } /* end else */ + + /* Sanity check */ + /* (allow for checksum not decoded yet) */ + HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); + + /* checksum verification already done in verify_chksum cb */ + + /* Metadata checksum */ + UINT32DECODE(image, stored_chksum); + + /* Sanity check */ + HDassert((size_t)(image - (const uint8_t *)_image) == len); + + /* Finish initializing extensible array header */ + if (H5EA__hdr_init(hdr, udata->ctx_udata) < 0) + H5E_THROW(H5E_CANTINIT, "initialization failed for extensible array header") + HDassert(hdr->size == len); + + /* Set return value */ + ret_value = hdr; + + CATCH + + /* Release resources */ + if (!ret_value) + if (hdr && H5EA__hdr_dest(hdr) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header") END_FUNC(STATIC) /* end H5EA__cache_hdr_deserialize() */ @@ -409,15 +409,15 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_deserialize() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__cache_hdr_image_len(const void *_thing, size_t *image_len)) -/* Local variables */ -const H5EA_hdr_t *hdr = (const H5EA_hdr_t *)_thing; /* Pointer to the object */ + /* Local variables */ + const H5EA_hdr_t *hdr = (const H5EA_hdr_t *)_thing; /* Pointer to the object */ -/* Check arguments */ -HDassert(hdr); -HDassert(image_len); + /* Check arguments */ + HDassert(hdr); + HDassert(image_len); -/* Set the image length size */ -*image_len = hdr->size; + /* Set the image length size */ + *image_len = hdr->size; END_FUNC(STATIC) /* end H5EA__cache_hdr_image_len() */ @@ -436,57 +436,57 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_image_len() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)) -/* Local variables */ -H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the extensible array header */ -uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t metadata_chksum; /* Computed metadata checksum value */ - -/* check arguments */ -HDassert(f); -HDassert(image); -HDassert(hdr); - -/* Magic number */ -H5MM_memcpy(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); -image += H5_SIZEOF_MAGIC; - -/* Version # */ -*image++ = H5EA_HDR_VERSION; - -/* Extensible array type */ -HDassert(hdr->cparam.cls->id <= 255); -*image++ = (uint8_t)hdr->cparam.cls->id; - -/* General array creation/configuration information */ -*image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ -*image++ = hdr->cparam.max_nelmts_bits; /* Log2(Max. # of elements in array) - i.e. # of bits needed to store - max. # of elements */ -*image++ = hdr->cparam.idx_blk_elmts; /* # of elements to store in index block */ -*image++ = hdr->cparam.data_blk_min_elmts; /* Min. # of elements per data block */ -*image++ = hdr->cparam.sup_blk_min_data_ptrs; /* Min. # of data block pointers for a super block */ -*image++ = - hdr->cparam.max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in data block page) - i.e. # of bits - needed to store max. # of elements in data block page */ - -/* Array statistics */ -H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.nsuper_blks); /* Number of super blocks created */ -H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.super_blk_size); /* Size of super blocks created */ -H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.ndata_blks); /* Number of data blocks created */ -H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.data_blk_size); /* Size of data blocks created */ -H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.max_idx_set); /* Max. index set (+1) */ -H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.nelmts); /* Number of elements 'realized' */ - -/* Internal information */ -H5F_addr_encode(f, &image, hdr->idx_blk_addr); /* Address of index block */ - -/* Compute metadata checksum */ -metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); - -/* Metadata checksum */ -UINT32ENCODE(image, metadata_chksum); - -/* Sanity check */ -HDassert((size_t)(image - (uint8_t *)_image) == len); + /* Local variables */ + H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the extensible array header */ + uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t metadata_chksum; /* Computed metadata checksum value */ + + /* check arguments */ + HDassert(f); + HDassert(image); + HDassert(hdr); + + /* Magic number */ + H5MM_memcpy(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); + image += H5_SIZEOF_MAGIC; + + /* Version # */ + *image++ = H5EA_HDR_VERSION; + + /* Extensible array type */ + HDassert(hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)hdr->cparam.cls->id; + + /* General array creation/configuration information */ + *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ + *image++ = hdr->cparam.max_nelmts_bits; /* Log2(Max. # of elements in array) - i.e. # of bits needed to + store max. # of elements */ + *image++ = hdr->cparam.idx_blk_elmts; /* # of elements to store in index block */ + *image++ = hdr->cparam.data_blk_min_elmts; /* Min. # of elements per data block */ + *image++ = hdr->cparam.sup_blk_min_data_ptrs; /* Min. # of data block pointers for a super block */ + *image++ = + hdr->cparam.max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in data block page) - i.e. # of bits + needed to store max. # of elements in data block page */ + + /* Array statistics */ + H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.nsuper_blks); /* Number of super blocks created */ + H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.super_blk_size); /* Size of super blocks created */ + H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.ndata_blks); /* Number of data blocks created */ + H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.data_blk_size); /* Size of data blocks created */ + H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.max_idx_set); /* Max. index set (+1) */ + H5F_ENCODE_LENGTH(f, image, hdr->stats.stored.nelmts); /* Number of elements 'realized' */ + + /* Internal information */ + H5F_addr_encode(f, &image, hdr->idx_blk_addr); /* Address of index block */ + + /* Compute metadata checksum */ + metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); + + /* Metadata checksum */ + UINT32ENCODE(image, metadata_chksum); + + /* Sanity check */ + HDassert((size_t)(image - (uint8_t *)_image) == len); END_FUNC(STATIC) /* end H5EA__cache_hdr_serialize() */ @@ -505,66 +505,65 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_serialize() */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing)) -/* Local variables */ -H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the object */ - -/* Sanity check */ -HDassert(hdr); - -/* Check if the file was opened with SWMR-write access */ -if (hdr->swmr_write) { - /* Determine which action to take */ - switch (action) { - case H5AC_NOTIFY_ACTION_AFTER_INSERT: - case H5AC_NOTIFY_ACTION_AFTER_LOAD: - case H5AC_NOTIFY_ACTION_AFTER_FLUSH: - case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: - case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: - case H5AC_NOTIFY_ACTION_CHILD_DIRTIED: - case H5AC_NOTIFY_ACTION_CHILD_CLEANED: - case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: - case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: - /* do nothing */ - break; - - case H5AC_NOTIFY_ACTION_BEFORE_EVICT: - /* If hdr->parent != NULL, hdr->parent is used to destroy - * the flush dependency before the header is evicted. - */ - if (hdr->parent) { - /* Sanity check */ - HDassert(hdr->top_proxy); - - /* Destroy flush dependency on object header proxy */ - if (H5AC_proxy_entry_remove_child((H5AC_proxy_entry_t *)hdr->parent, (void *)hdr->top_proxy) < - 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between extensible array and proxy") - hdr->parent = NULL; - } /* end if */ - - /* Detach from 'top' proxy for extensible array */ - if (hdr->top_proxy) { - if (H5AC_proxy_entry_remove_child(hdr->top_proxy, hdr) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, - "unable to destroy flush dependency between header and extensible array 'top' proxy") - /* Don't reset hdr->top_proxy here, it's destroyed when the header is freed -QAK */ - } /* end if */ - break; - - default: + /* Local variables */ + H5EA_hdr_t *hdr = (H5EA_hdr_t *)_thing; /* Pointer to the object */ + + /* Sanity check */ + HDassert(hdr); + + /* Check if the file was opened with SWMR-write access */ + if (hdr->swmr_write) { + /* Determine which action to take */ + switch (action) { + case H5AC_NOTIFY_ACTION_AFTER_INSERT: + case H5AC_NOTIFY_ACTION_AFTER_LOAD: + case H5AC_NOTIFY_ACTION_AFTER_FLUSH: + case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: + case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: + case H5AC_NOTIFY_ACTION_CHILD_DIRTIED: + case H5AC_NOTIFY_ACTION_CHILD_CLEANED: + case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: + case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: + /* do nothing */ + break; + + case H5AC_NOTIFY_ACTION_BEFORE_EVICT: + /* If hdr->parent != NULL, hdr->parent is used to destroy + * the flush dependency before the header is evicted. + */ + if (hdr->parent) { + /* Sanity check */ + HDassert(hdr->top_proxy); + + /* Destroy flush dependency on object header proxy */ + if (H5AC_proxy_entry_remove_child((H5AC_proxy_entry_t *)hdr->parent, + (void *)hdr->top_proxy) < 0) + H5E_THROW(H5E_CANTUNDEPEND, + "unable to destroy flush dependency between extensible array and proxy") + hdr->parent = NULL; + } /* end if */ + + /* Detach from 'top' proxy for extensible array */ + if (hdr->top_proxy) { + if (H5AC_proxy_entry_remove_child(hdr->top_proxy, hdr) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between header and " + "extensible array 'top' proxy") + /* Don't reset hdr->top_proxy here, it's destroyed when the header is freed -QAK */ + } /* end if */ + break; + + default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") -#else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); -#endif /* NDEBUG */ - } /* end switch */ -} /* end if */ -else - HDassert(NULL == hdr->parent); + H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") +#else /* NDEBUG */ + HDassert(0 && "Unknown action?!?"); +#endif /* NDEBUG */ + } /* end switch */ + } /* end if */ + else + HDassert(NULL == hdr->parent); -CATCH + CATCH END_FUNC(STATIC) /* end H5EA__cache_hdr_notify() */ @@ -583,14 +582,14 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_notify() */ */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_hdr_free_icr(void *thing)) -/* Check arguments */ -HDassert(thing); + /* Check arguments */ + HDassert(thing); -/* Release the extensible array header */ -if (H5EA__hdr_dest((H5EA_hdr_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free extensible array header") + /* Release the extensible array header */ + if (H5EA__hdr_dest((H5EA_hdr_t *)thing) < 0) + H5E_THROW(H5E_CANTFREE, "can't free extensible array header") -CATCH + CATCH END_FUNC(STATIC) /* end H5EA__cache_hdr_free_icr() */ @@ -609,23 +608,23 @@ END_FUNC(STATIC) /* end H5EA__cache_hdr_free_icr() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__cache_iblock_get_initial_load_size(void *_udata, size_t *image_len)) -/* Local variables */ -H5EA_hdr_t * hdr = (H5EA_hdr_t *)_udata; /* User data for callback */ -H5EA_iblock_t iblock; /* Fake index block for computing size */ + /* Local variables */ + H5EA_hdr_t * hdr = (H5EA_hdr_t *)_udata; /* User data for callback */ + H5EA_iblock_t iblock; /* Fake index block for computing size */ -/* Check arguments */ -HDassert(hdr); -HDassert(image_len); + /* Check arguments */ + HDassert(hdr); + HDassert(image_len); -/* Set up fake index block for computing size on disk */ -HDmemset(&iblock, 0, sizeof(iblock)); -iblock.hdr = (H5EA_hdr_t *)hdr; /* Casting away 'const' OK - QAK */ -iblock.nsblks = H5EA_SBLK_FIRST_IDX(hdr->cparam.sup_blk_min_data_ptrs); -iblock.ndblk_addrs = 2 * ((size_t)hdr->cparam.sup_blk_min_data_ptrs - 1); -iblock.nsblk_addrs = hdr->nsblks - iblock.nsblks; + /* Set up fake index block for computing size on disk */ + HDmemset(&iblock, 0, sizeof(iblock)); + iblock.hdr = (H5EA_hdr_t *)hdr; /* Casting away 'const' OK - QAK */ + iblock.nsblks = H5EA_SBLK_FIRST_IDX(hdr->cparam.sup_blk_min_data_ptrs); + iblock.ndblk_addrs = 2 * ((size_t)hdr->cparam.sup_blk_min_data_ptrs - 1); + iblock.nsblk_addrs = hdr->nsblks - iblock.nsblks; -/* Set the image length size */ -*image_len = (size_t)H5EA_IBLOCK_SIZE(&iblock); + /* Set the image length size */ + *image_len = (size_t)H5EA_IBLOCK_SIZE(&iblock); END_FUNC(STATIC) /* end H5EA__cache_iblock_get_initial_load_size() */ @@ -645,19 +644,19 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_get_initial_load_size() */ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, H5EA__cache_iblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) -/* Local variables */ -const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t stored_chksum; /* Stored metadata checksum value */ -uint32_t computed_chksum; /* Computed metadata checksum value */ + /* Local variables */ + const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + uint32_t computed_chksum; /* Computed metadata checksum value */ -/* Check arguments */ -HDassert(image); + /* Check arguments */ + HDassert(image); -/* Get stored and computed checksums */ -H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); + /* Get stored and computed checksums */ + H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); -if (stored_chksum != computed_chksum) - ret_value = FALSE; + if (stored_chksum != computed_chksum) + ret_value = FALSE; END_FUNC(STATIC) /* end H5EA__cache_iblock_verify_chksum() */ @@ -678,91 +677,92 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5EA__cache_iblock_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)) -/* Local variables */ -H5EA_iblock_t *iblock = NULL; /* Index block info */ -H5EA_hdr_t * hdr = (H5EA_hdr_t *)_udata; /* User data for callback */ -const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t stored_chksum; /* Stored metadata checksum value */ -haddr_t arr_addr; /* Address of array header in the file */ -size_t u; /* Local index variable */ - -/* Check arguments */ -HDassert(image); -HDassert(hdr); - -/* Allocate the extensible array index block */ -if (NULL == (iblock = H5EA__iblock_alloc(hdr))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block") - -/* Set the extensible array index block's address */ -iblock->addr = hdr->idx_blk_addr; - -/* Magic number */ -if (HDmemcmp(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - H5E_THROW(H5E_BADVALUE, "wrong extensible array index block signature") -image += H5_SIZEOF_MAGIC; - -/* Version */ -if (*image++ != H5EA_IBLOCK_VERSION) - H5E_THROW(H5E_VERSION, "wrong extensible array index block version") - -/* Extensible array type */ -if (*image++ != (uint8_t)hdr->cparam.cls->id) - H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") - -/* Address of header for array that owns this block (just for file integrity checks) */ -H5F_addr_decode(hdr->f, &image, &arr_addr); -if (H5F_addr_ne(arr_addr, hdr->addr)) - H5E_THROW(H5E_BADVALUE, "wrong extensible array header address") - -/* Internal information */ - -/* Decode elements in index block */ -if (hdr->cparam.idx_blk_elmts > 0) { - /* Convert from raw elements on disk into native elements in memory */ - if ((hdr->cparam.cls->decode)(image, iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts, hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTDECODE, "can't decode extensible array index elements") - image += (hdr->cparam.idx_blk_elmts * hdr->cparam.raw_elmt_size); -} /* end if */ - -/* Decode data block addresses in index block */ -if (iblock->ndblk_addrs > 0) { - /* Decode addresses of data blocks in index block */ - for (u = 0; u < iblock->ndblk_addrs; u++) - H5F_addr_decode(hdr->f, &image, &iblock->dblk_addrs[u]); -} /* end if */ - -/* Decode super block addresses in index block */ -if (iblock->nsblk_addrs > 0) { - /* Decode addresses of super blocks in index block */ - for (u = 0; u < iblock->nsblk_addrs; u++) - H5F_addr_decode(hdr->f, &image, &iblock->sblk_addrs[u]); -} /* end if */ - -/* Sanity check */ -/* (allow for checksum not decoded yet) */ -HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); - -/* Save the index block's size */ -iblock->size = len; - -/* checksum verification already done in verify_chksum cb */ - -/* Metadata checksum */ -UINT32DECODE(image, stored_chksum); - -/* Sanity check */ -HDassert((size_t)(image - (const uint8_t *)_image) == iblock->size); - -/* Set return value */ -ret_value = iblock; - -CATCH - -/* Release resources */ -if (!ret_value) - if (iblock && H5EA__iblock_dest(iblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block") + /* Local variables */ + H5EA_iblock_t *iblock = NULL; /* Index block info */ + H5EA_hdr_t * hdr = (H5EA_hdr_t *)_udata; /* User data for callback */ + const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + haddr_t arr_addr; /* Address of array header in the file */ + size_t u; /* Local index variable */ + + /* Check arguments */ + HDassert(image); + HDassert(hdr); + + /* Allocate the extensible array index block */ + if (NULL == (iblock = H5EA__iblock_alloc(hdr))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block") + + /* Set the extensible array index block's address */ + iblock->addr = hdr->idx_blk_addr; + + /* Magic number */ + if (HDmemcmp(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + H5E_THROW(H5E_BADVALUE, "wrong extensible array index block signature") + image += H5_SIZEOF_MAGIC; + + /* Version */ + if (*image++ != H5EA_IBLOCK_VERSION) + H5E_THROW(H5E_VERSION, "wrong extensible array index block version") + + /* Extensible array type */ + if (*image++ != (uint8_t)hdr->cparam.cls->id) + H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") + + /* Address of header for array that owns this block (just for file integrity checks) */ + H5F_addr_decode(hdr->f, &image, &arr_addr); + if (H5F_addr_ne(arr_addr, hdr->addr)) + H5E_THROW(H5E_BADVALUE, "wrong extensible array header address") + + /* Internal information */ + + /* Decode elements in index block */ + if (hdr->cparam.idx_blk_elmts > 0) { + /* Convert from raw elements on disk into native elements in memory */ + if ((hdr->cparam.cls->decode)(image, iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts, hdr->cb_ctx) < + 0) + H5E_THROW(H5E_CANTDECODE, "can't decode extensible array index elements") + image += (hdr->cparam.idx_blk_elmts * hdr->cparam.raw_elmt_size); + } /* end if */ + + /* Decode data block addresses in index block */ + if (iblock->ndblk_addrs > 0) { + /* Decode addresses of data blocks in index block */ + for (u = 0; u < iblock->ndblk_addrs; u++) + H5F_addr_decode(hdr->f, &image, &iblock->dblk_addrs[u]); + } /* end if */ + + /* Decode super block addresses in index block */ + if (iblock->nsblk_addrs > 0) { + /* Decode addresses of super blocks in index block */ + for (u = 0; u < iblock->nsblk_addrs; u++) + H5F_addr_decode(hdr->f, &image, &iblock->sblk_addrs[u]); + } /* end if */ + + /* Sanity check */ + /* (allow for checksum not decoded yet) */ + HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); + + /* Save the index block's size */ + iblock->size = len; + + /* checksum verification already done in verify_chksum cb */ + + /* Metadata checksum */ + UINT32DECODE(image, stored_chksum); + + /* Sanity check */ + HDassert((size_t)(image - (const uint8_t *)_image) == iblock->size); + + /* Set return value */ + ret_value = iblock; + + CATCH + + /* Release resources */ + if (!ret_value) + if (iblock && H5EA__iblock_dest(iblock) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block") END_FUNC(STATIC) /* end H5EA__cache_iblock_deserialize() */ @@ -781,15 +781,15 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_deserialize() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__cache_iblock_image_len(const void *_thing, size_t *image_len)) -/* Local variables */ -const H5EA_iblock_t *iblock = (const H5EA_iblock_t *)_thing; /* Pointer to the object */ + /* Local variables */ + const H5EA_iblock_t *iblock = (const H5EA_iblock_t *)_thing; /* Pointer to the object */ -/* Check arguments */ -HDassert(iblock); -HDassert(image_len); + /* Check arguments */ + HDassert(iblock); + HDassert(image_len); -/* Set the image length size */ -*image_len = iblock->size; + /* Set the image length size */ + *image_len = iblock->size; END_FUNC(STATIC) /* end H5EA__cache_iblock_image_len() */ @@ -809,72 +809,72 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)) -/* Local variables */ -H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object to serialize */ -uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t metadata_chksum; /* Computed metadata checksum value */ + /* Local variables */ + H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object to serialize */ + uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t metadata_chksum; /* Computed metadata checksum value */ -/* check arguments */ -HDassert(f); -HDassert(image); -HDassert(iblock); -HDassert(iblock->hdr); + /* check arguments */ + HDassert(f); + HDassert(image); + HDassert(iblock); + HDassert(iblock->hdr); -/* Get temporary pointer to serialized info */ + /* Get temporary pointer to serialized info */ -/* Magic number */ -H5MM_memcpy(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); -image += H5_SIZEOF_MAGIC; + /* Magic number */ + H5MM_memcpy(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); + image += H5_SIZEOF_MAGIC; -/* Version # */ -*image++ = H5EA_IBLOCK_VERSION; + /* Version # */ + *image++ = H5EA_IBLOCK_VERSION; -/* Extensible array type */ -HDassert(iblock->hdr->cparam.cls->id <= 255); -*image++ = (uint8_t)iblock->hdr->cparam.cls->id; + /* Extensible array type */ + HDassert(iblock->hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)iblock->hdr->cparam.cls->id; -/* Address of array header for array which owns this block */ -H5F_addr_encode(f, &image, iblock->hdr->addr); + /* Address of array header for array which owns this block */ + H5F_addr_encode(f, &image, iblock->hdr->addr); -/* Internal information */ + /* Internal information */ -/* Encode elements in index block */ -if (iblock->hdr->cparam.idx_blk_elmts > 0) { - /* Convert from native elements in memory into raw elements on disk */ - if ((iblock->hdr->cparam.cls->encode)(image, iblock->elmts, (size_t)iblock->hdr->cparam.idx_blk_elmts, - iblock->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTENCODE, "can't encode extensible array index elements") - image += (iblock->hdr->cparam.idx_blk_elmts * iblock->hdr->cparam.raw_elmt_size); -} /* end if */ + /* Encode elements in index block */ + if (iblock->hdr->cparam.idx_blk_elmts > 0) { + /* Convert from native elements in memory into raw elements on disk */ + if ((iblock->hdr->cparam.cls->encode)(image, iblock->elmts, (size_t)iblock->hdr->cparam.idx_blk_elmts, + iblock->hdr->cb_ctx) < 0) + H5E_THROW(H5E_CANTENCODE, "can't encode extensible array index elements") + image += (iblock->hdr->cparam.idx_blk_elmts * iblock->hdr->cparam.raw_elmt_size); + } /* end if */ -/* Encode data block addresses in index block */ -if (iblock->ndblk_addrs > 0) { - size_t u; /* Local index variable */ + /* Encode data block addresses in index block */ + if (iblock->ndblk_addrs > 0) { + size_t u; /* Local index variable */ - /* Encode addresses of data blocks in index block */ - for (u = 0; u < iblock->ndblk_addrs; u++) - H5F_addr_encode(f, &image, iblock->dblk_addrs[u]); -} /* end if */ + /* Encode addresses of data blocks in index block */ + for (u = 0; u < iblock->ndblk_addrs; u++) + H5F_addr_encode(f, &image, iblock->dblk_addrs[u]); + } /* end if */ -/* Encode data block addresses in index block */ -if (iblock->nsblk_addrs > 0) { - size_t u; /* Local index variable */ + /* Encode data block addresses in index block */ + if (iblock->nsblk_addrs > 0) { + size_t u; /* Local index variable */ - /* Encode addresses of super blocks in index block */ - for (u = 0; u < iblock->nsblk_addrs; u++) - H5F_addr_encode(f, &image, iblock->sblk_addrs[u]); -} /* end if */ + /* Encode addresses of super blocks in index block */ + for (u = 0; u < iblock->nsblk_addrs; u++) + H5F_addr_encode(f, &image, iblock->sblk_addrs[u]); + } /* end if */ -/* Compute metadata checksum */ -metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); + /* Compute metadata checksum */ + metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); -/* Metadata checksum */ -UINT32ENCODE(image, metadata_chksum); + /* Metadata checksum */ + UINT32ENCODE(image, metadata_chksum); -/* Sanity check */ -HDassert((size_t)(image - (uint8_t *)_image) == len); + /* Sanity check */ + HDassert((size_t)(image - (uint8_t *)_image) == len); -CATCH + CATCH END_FUNC(STATIC) /* end H5EA__cache_iblock_serialize() */ @@ -893,59 +893,58 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_serialize() */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *_thing)) -/* Local variables */ -H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object */ - -/* Sanity check */ -HDassert(iblock); - -/* Determine which action to take */ -switch (action) { - case H5AC_NOTIFY_ACTION_AFTER_INSERT: - case H5AC_NOTIFY_ACTION_AFTER_LOAD: - /* Create flush dependency on extensible array header */ - if (H5EA__create_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0) - H5E_THROW(H5E_CANTDEPEND, - "unable to create flush dependency between index block and header, address = %llu", - (unsigned long long)iblock->addr) - break; - - case H5AC_NOTIFY_ACTION_AFTER_FLUSH: - case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: - case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: - case H5AC_NOTIFY_ACTION_CHILD_DIRTIED: - case H5AC_NOTIFY_ACTION_CHILD_CLEANED: - case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: - case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: - /* do nothing */ - break; - - case H5AC_NOTIFY_ACTION_BEFORE_EVICT: - /* Destroy flush dependency on extensible array header */ - if (H5EA__destroy_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between index block and header, address = %llu", - (unsigned long long)iblock->addr) - - /* Detach from 'top' proxy for extensible array */ - if (iblock->top_proxy) { - if (H5AC_proxy_entry_remove_child(iblock->top_proxy, iblock) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, - "unable to destroy flush dependency between index block and extensible array 'top' proxy") - iblock->top_proxy = NULL; - } /* end if */ - break; + /* Local variables */ + H5EA_iblock_t *iblock = (H5EA_iblock_t *)_thing; /* Pointer to the object */ + + /* Sanity check */ + HDassert(iblock); - default: + /* Determine which action to take */ + switch (action) { + case H5AC_NOTIFY_ACTION_AFTER_INSERT: + case H5AC_NOTIFY_ACTION_AFTER_LOAD: + /* Create flush dependency on extensible array header */ + if (H5EA__create_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0) + H5E_THROW(H5E_CANTDEPEND, + "unable to create flush dependency between index block and header, address = %llu", + (unsigned long long)iblock->addr) + break; + + case H5AC_NOTIFY_ACTION_AFTER_FLUSH: + case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: + case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: + case H5AC_NOTIFY_ACTION_CHILD_DIRTIED: + case H5AC_NOTIFY_ACTION_CHILD_CLEANED: + case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: + case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: + /* do nothing */ + break; + + case H5AC_NOTIFY_ACTION_BEFORE_EVICT: + /* Destroy flush dependency on extensible array header */ + if (H5EA__destroy_flush_depend((H5AC_info_t *)iblock->hdr, (H5AC_info_t *)iblock) < 0) + H5E_THROW(H5E_CANTUNDEPEND, + "unable to destroy flush dependency between index block and header, address = %llu", + (unsigned long long)iblock->addr) + + /* Detach from 'top' proxy for extensible array */ + if (iblock->top_proxy) { + if (H5AC_proxy_entry_remove_child(iblock->top_proxy, iblock) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between index block and " + "extensible array 'top' proxy") + iblock->top_proxy = NULL; + } /* end if */ + break; + + default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") + H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") #else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); + HDassert(0 && "Unknown action?!?"); #endif /* NDEBUG */ -} /* end switch */ + } /* end switch */ -CATCH + CATCH END_FUNC(STATIC) /* end H5EA__cache_iblock_notify() */ @@ -964,14 +963,14 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_notify() */ */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_iblock_free_icr(void *thing)) -/* Check arguments */ -HDassert(thing); + /* Check arguments */ + HDassert(thing); -/* Release the extensible array index block */ -if (H5EA__iblock_dest((H5EA_iblock_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free extensible array index block") + /* Release the extensible array index block */ + if (H5EA__iblock_dest((H5EA_iblock_t *)thing) < 0) + H5E_THROW(H5E_CANTFREE, "can't free extensible array index block") -CATCH + CATCH END_FUNC(STATIC) /* end H5EA__cache_iblock_free_icr() */ @@ -990,42 +989,42 @@ END_FUNC(STATIC) /* end H5EA__cache_iblock_free_icr() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__cache_sblock_get_initial_load_size(void *_udata, size_t *image_len)) -/* Local variables */ -H5EA_sblock_cache_ud_t *udata = (H5EA_sblock_cache_ud_t *)_udata; /* User data */ -H5EA_sblock_t sblock; /* Fake super block for computing size */ + /* Local variables */ + H5EA_sblock_cache_ud_t *udata = (H5EA_sblock_cache_ud_t *)_udata; /* User data */ + H5EA_sblock_t sblock; /* Fake super block for computing size */ -/* Check arguments */ -HDassert(udata); -HDassert(udata->hdr); -HDassert(udata->sblk_idx > 0); -HDassert(H5F_addr_defined(udata->sblk_addr)); -HDassert(image_len); + /* Check arguments */ + HDassert(udata); + HDassert(udata->hdr); + HDassert(udata->sblk_idx > 0); + HDassert(H5F_addr_defined(udata->sblk_addr)); + HDassert(image_len); -/* Set up fake super block for computing size on disk */ -/* (Note: extracted from H5EA__sblock_alloc) */ -HDmemset(&sblock, 0, sizeof(sblock)); -sblock.hdr = udata->hdr; -sblock.ndblks = udata->hdr->sblk_info[udata->sblk_idx].ndblks; -sblock.dblk_nelmts = udata->hdr->sblk_info[udata->sblk_idx].dblk_nelmts; + /* Set up fake super block for computing size on disk */ + /* (Note: extracted from H5EA__sblock_alloc) */ + HDmemset(&sblock, 0, sizeof(sblock)); + sblock.hdr = udata->hdr; + sblock.ndblks = udata->hdr->sblk_info[udata->sblk_idx].ndblks; + sblock.dblk_nelmts = udata->hdr->sblk_info[udata->sblk_idx].dblk_nelmts; -/* Check if # of elements in data blocks requires paging */ -if (sblock.dblk_nelmts > udata->hdr->dblk_page_nelmts) { - /* Compute # of pages in each data block from this super block */ - sblock.dblk_npages = sblock.dblk_nelmts / udata->hdr->dblk_page_nelmts; + /* Check if # of elements in data blocks requires paging */ + if (sblock.dblk_nelmts > udata->hdr->dblk_page_nelmts) { + /* Compute # of pages in each data block from this super block */ + sblock.dblk_npages = sblock.dblk_nelmts / udata->hdr->dblk_page_nelmts; - /* Sanity check that we have at least 2 pages in data block */ - HDassert(sblock.dblk_npages > 1); + /* Sanity check that we have at least 2 pages in data block */ + HDassert(sblock.dblk_npages > 1); - /* Sanity check for integer truncation */ - HDassert((sblock.dblk_npages * udata->hdr->dblk_page_nelmts) == sblock.dblk_nelmts); + /* Sanity check for integer truncation */ + HDassert((sblock.dblk_npages * udata->hdr->dblk_page_nelmts) == sblock.dblk_nelmts); - /* Compute size of buffer for each data block's 'page init' bitmask */ - sblock.dblk_page_init_size = ((sblock.dblk_npages) + 7) / 8; - HDassert(sblock.dblk_page_init_size > 0); -} /* end if */ + /* Compute size of buffer for each data block's 'page init' bitmask */ + sblock.dblk_page_init_size = ((sblock.dblk_npages) + 7) / 8; + HDassert(sblock.dblk_page_init_size > 0); + } /* end if */ -/* Set the image length size */ -*image_len = (size_t)H5EA_SBLOCK_SIZE(&sblock); + /* Set the image length size */ + *image_len = (size_t)H5EA_SBLOCK_SIZE(&sblock); END_FUNC(STATIC) /* end H5EA__cache_sblock_get_initial_load_size() */ @@ -1045,19 +1044,19 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_get_initial_load_size() */ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, H5EA__cache_sblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) -/* Local variables */ -const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t stored_chksum; /* Stored metadata checksum value */ -uint32_t computed_chksum; /* Computed metadata checksum value */ + /* Local variables */ + const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + uint32_t computed_chksum; /* Computed metadata checksum value */ -/* Check arguments */ -HDassert(image); + /* Check arguments */ + HDassert(image); -/* Get stored and computed checksums */ -H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); + /* Get stored and computed checksums */ + H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); -if (stored_chksum != computed_chksum) - ret_value = FALSE; + if (stored_chksum != computed_chksum) + ret_value = FALSE; END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */ @@ -1078,89 +1077,89 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5EA__cache_sblock_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)) -/* Local variables */ -H5EA_sblock_t * sblock = NULL; /* Super block info */ -H5EA_sblock_cache_ud_t *udata = (H5EA_sblock_cache_ud_t *)_udata; /* User data */ -const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t stored_chksum; /* Stored metadata checksum value */ -haddr_t arr_addr; /* Address of array header in the file */ -size_t u; /* Local index variable */ + /* Local variables */ + H5EA_sblock_t * sblock = NULL; /* Super block info */ + H5EA_sblock_cache_ud_t *udata = (H5EA_sblock_cache_ud_t *)_udata; /* User data */ + const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + haddr_t arr_addr; /* Address of array header in the file */ + size_t u; /* Local index variable */ -/* Sanity check */ -HDassert(udata); -HDassert(udata->hdr); -HDassert(udata->parent); -HDassert(udata->sblk_idx > 0); -HDassert(H5F_addr_defined(udata->sblk_addr)); + /* Sanity check */ + HDassert(udata); + HDassert(udata->hdr); + HDassert(udata->parent); + HDassert(udata->sblk_idx > 0); + HDassert(H5F_addr_defined(udata->sblk_addr)); -/* Allocate the extensible array super block */ -if (NULL == (sblock = H5EA__sblock_alloc(udata->hdr, udata->parent, udata->sblk_idx))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block") + /* Allocate the extensible array super block */ + if (NULL == (sblock = H5EA__sblock_alloc(udata->hdr, udata->parent, udata->sblk_idx))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block") -/* Set the extensible array super block's address */ -sblock->addr = udata->sblk_addr; + /* Set the extensible array super block's address */ + sblock->addr = udata->sblk_addr; -/* Magic number */ -if (HDmemcmp(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - H5E_THROW(H5E_BADVALUE, "wrong extensible array super block signature") -image += H5_SIZEOF_MAGIC; + /* Magic number */ + if (HDmemcmp(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + H5E_THROW(H5E_BADVALUE, "wrong extensible array super block signature") + image += H5_SIZEOF_MAGIC; -/* Version */ -if (*image++ != H5EA_SBLOCK_VERSION) - H5E_THROW(H5E_VERSION, "wrong extensible array super block version") + /* Version */ + if (*image++ != H5EA_SBLOCK_VERSION) + H5E_THROW(H5E_VERSION, "wrong extensible array super block version") -/* Extensible array type */ -if (*image++ != (uint8_t)udata->hdr->cparam.cls->id) - H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") + /* Extensible array type */ + if (*image++ != (uint8_t)udata->hdr->cparam.cls->id) + H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") -/* Address of header for array that owns this block (just for file integrity checks) */ -H5F_addr_decode(udata->hdr->f, &image, &arr_addr); -if (H5F_addr_ne(arr_addr, udata->hdr->addr)) - H5E_THROW(H5E_BADVALUE, "wrong extensible array header address") + /* Address of header for array that owns this block (just for file integrity checks) */ + H5F_addr_decode(udata->hdr->f, &image, &arr_addr); + if (H5F_addr_ne(arr_addr, udata->hdr->addr)) + H5E_THROW(H5E_BADVALUE, "wrong extensible array header address") -/* Offset of block within the array's address space */ -UINT64DECODE_VAR(image, sblock->block_off, udata->hdr->arr_off_size); + /* Offset of block within the array's address space */ + UINT64DECODE_VAR(image, sblock->block_off, udata->hdr->arr_off_size); -/* Internal information */ + /* Internal information */ -/* Check for 'page init' bitmasks for this super block */ -if (sblock->dblk_npages > 0) { - size_t tot_page_init_size = - sblock->ndblks * sblock->dblk_page_init_size; /* Compute total size of 'page init' buffer */ + /* Check for 'page init' bitmasks for this super block */ + if (sblock->dblk_npages > 0) { + size_t tot_page_init_size = + sblock->ndblks * sblock->dblk_page_init_size; /* Compute total size of 'page init' buffer */ - /* Retrieve the 'page init' bitmasks */ - H5MM_memcpy(sblock->page_init, image, tot_page_init_size); - image += tot_page_init_size; -} /* end if */ + /* Retrieve the 'page init' bitmasks */ + H5MM_memcpy(sblock->page_init, image, tot_page_init_size); + image += tot_page_init_size; + } /* end if */ -/* Decode data block addresses */ -for (u = 0; u < sblock->ndblks; u++) - H5F_addr_decode(udata->hdr->f, &image, &sblock->dblk_addrs[u]); + /* Decode data block addresses */ + for (u = 0; u < sblock->ndblks; u++) + H5F_addr_decode(udata->hdr->f, &image, &sblock->dblk_addrs[u]); -/* Sanity check */ -/* (allow for checksum not decoded yet) */ -HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); + /* Sanity check */ + /* (allow for checksum not decoded yet) */ + HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); -/* Save the super block's size */ -sblock->size = len; + /* Save the super block's size */ + sblock->size = len; -/* checksum verification already done in verify_chksum cb */ + /* checksum verification already done in verify_chksum cb */ -/* Metadata checksum */ -UINT32DECODE(image, stored_chksum); + /* Metadata checksum */ + UINT32DECODE(image, stored_chksum); -/* Sanity check */ -HDassert((size_t)(image - (const uint8_t *)_image) == sblock->size); + /* Sanity check */ + HDassert((size_t)(image - (const uint8_t *)_image) == sblock->size); -/* Set return value */ -ret_value = sblock; + /* Set return value */ + ret_value = sblock; -CATCH + CATCH -/* Release resources */ -if (!ret_value) - if (sblock && H5EA__sblock_dest(sblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block") + /* Release resources */ + if (!ret_value) + if (sblock && H5EA__sblock_dest(sblock) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block") END_FUNC(STATIC) /* end H5EA__cache_sblock_deserialize() */ @@ -1179,15 +1178,15 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_deserialize() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__cache_sblock_image_len(const void *_thing, size_t *image_len)) -/* Local variables */ -const H5EA_sblock_t *sblock = (const H5EA_sblock_t *)_thing; /* Pointer to the object */ + /* Local variables */ + const H5EA_sblock_t *sblock = (const H5EA_sblock_t *)_thing; /* Pointer to the object */ -/* Check arguments */ -HDassert(sblock); -HDassert(image_len); + /* Check arguments */ + HDassert(sblock); + HDassert(image_len); -/* Set the image length size */ -*image_len = sblock->size; + /* Set the image length size */ + *image_len = sblock->size; END_FUNC(STATIC) /* end H5EA__cache_sblock_image_len() */ @@ -1207,59 +1206,59 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)) -/* Local variables */ -H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object to serialize */ -uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t metadata_chksum; /* Computed metadata checksum value */ -size_t u; /* Local index variable */ + /* Local variables */ + H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object to serialize */ + uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t metadata_chksum; /* Computed metadata checksum value */ + size_t u; /* Local index variable */ -/* check arguments */ -HDassert(f); -HDassert(image); -HDassert(sblock); -HDassert(sblock->hdr); + /* check arguments */ + HDassert(f); + HDassert(image); + HDassert(sblock); + HDassert(sblock->hdr); -/* Magic number */ -H5MM_memcpy(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); -image += H5_SIZEOF_MAGIC; + /* Magic number */ + H5MM_memcpy(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); + image += H5_SIZEOF_MAGIC; -/* Version # */ -*image++ = H5EA_SBLOCK_VERSION; + /* Version # */ + *image++ = H5EA_SBLOCK_VERSION; -/* Extensible array type */ -HDassert(sblock->hdr->cparam.cls->id <= 255); -*image++ = (uint8_t)sblock->hdr->cparam.cls->id; + /* Extensible array type */ + HDassert(sblock->hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)sblock->hdr->cparam.cls->id; -/* Address of array header for array which owns this block */ -H5F_addr_encode(f, &image, sblock->hdr->addr); + /* Address of array header for array which owns this block */ + H5F_addr_encode(f, &image, sblock->hdr->addr); -/* Offset of block in array */ -UINT64ENCODE_VAR(image, sblock->block_off, sblock->hdr->arr_off_size); + /* Offset of block in array */ + UINT64ENCODE_VAR(image, sblock->block_off, sblock->hdr->arr_off_size); -/* Internal information */ + /* Internal information */ -/* Check for 'page init' bitmasks for this super block */ -if (sblock->dblk_npages > 0) { - size_t tot_page_init_size = - sblock->ndblks * sblock->dblk_page_init_size; /* Compute total size of 'page init' buffer */ + /* Check for 'page init' bitmasks for this super block */ + if (sblock->dblk_npages > 0) { + size_t tot_page_init_size = + sblock->ndblks * sblock->dblk_page_init_size; /* Compute total size of 'page init' buffer */ - /* Store the 'page init' bitmasks */ - H5MM_memcpy(image, sblock->page_init, tot_page_init_size); - image += tot_page_init_size; -} /* end if */ + /* Store the 'page init' bitmasks */ + H5MM_memcpy(image, sblock->page_init, tot_page_init_size); + image += tot_page_init_size; + } /* end if */ -/* Encode addresses of data blocks in super block */ -for (u = 0; u < sblock->ndblks; u++) - H5F_addr_encode(f, &image, sblock->dblk_addrs[u]); + /* Encode addresses of data blocks in super block */ + for (u = 0; u < sblock->ndblks; u++) + H5F_addr_encode(f, &image, sblock->dblk_addrs[u]); -/* Compute metadata checksum */ -metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); + /* Compute metadata checksum */ + metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); -/* Metadata checksum */ -UINT32ENCODE(image, metadata_chksum); + /* Metadata checksum */ + UINT32ENCODE(image, metadata_chksum); -/* Sanity check */ -HDassert((size_t)(image - (uint8_t *)_image) == len); + /* Sanity check */ + HDassert((size_t)(image - (uint8_t *)_image) == len); END_FUNC(STATIC) /* end H5EA__cache_sblock_serialize() */ @@ -1278,79 +1277,81 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_serialize() */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing)) -/* Local variables */ -H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object */ - -/* Sanity check */ -HDassert(sblock); - -/* Determine which action to take */ -switch (action) { - case H5AC_NOTIFY_ACTION_AFTER_INSERT: - case H5AC_NOTIFY_ACTION_AFTER_LOAD: - /* Create flush dependency on index block */ - if (H5EA__create_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0) - H5E_THROW(H5E_CANTDEPEND, - "unable to create flush dependency between super block and index block, address = %llu", - (unsigned long long)sblock->addr) - break; - - case H5AC_NOTIFY_ACTION_AFTER_FLUSH: - /* Destroy flush dependency on extensible array header, if set */ - if (sblock->has_hdr_depend) { - if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between super block and header, address = %llu", - (unsigned long long)sblock->addr) - sblock->has_hdr_depend = FALSE; - } /* end if */ - break; - - case H5AC_NOTIFY_ACTION_BEFORE_EVICT: - /* Destroy flush dependency on index block */ - if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, - "unable to destroy flush dependency between super block and index block, address = %llu", - (unsigned long long)sblock->addr) - - /* Destroy flush dependency on extensible array header, if set */ - if (sblock->has_hdr_depend) { - if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between super block and header, address = %llu", - (unsigned long long)sblock->addr) - sblock->has_hdr_depend = FALSE; - } /* end if */ - - /* Detach from 'top' proxy for extensible array */ - if (sblock->top_proxy) { - if (H5AC_proxy_entry_remove_child(sblock->top_proxy, sblock) < 0) + /* Local variables */ + H5EA_sblock_t *sblock = (H5EA_sblock_t *)_thing; /* Pointer to the object */ + + /* Sanity check */ + HDassert(sblock); + + /* Determine which action to take */ + switch (action) { + case H5AC_NOTIFY_ACTION_AFTER_INSERT: + case H5AC_NOTIFY_ACTION_AFTER_LOAD: + /* Create flush dependency on index block */ + if (H5EA__create_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0) + H5E_THROW( + H5E_CANTDEPEND, + "unable to create flush dependency between super block and index block, address = %llu", + (unsigned long long)sblock->addr) + break; + + case H5AC_NOTIFY_ACTION_AFTER_FLUSH: + /* Destroy flush dependency on extensible array header, if set */ + if (sblock->has_hdr_depend) { + if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0) + H5E_THROW( + H5E_CANTUNDEPEND, + "unable to destroy flush dependency between super block and header, address = %llu", + (unsigned long long)sblock->addr) + sblock->has_hdr_depend = FALSE; + } /* end if */ + break; + + case H5AC_NOTIFY_ACTION_BEFORE_EVICT: + /* Destroy flush dependency on index block */ + if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->parent, (H5AC_info_t *)sblock) < 0) H5E_THROW( H5E_CANTUNDEPEND, - "unable to destroy flush dependency between super block and extensible array 'top' proxy") - sblock->top_proxy = NULL; - } /* end if */ - break; - - case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: - case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: - case H5AC_NOTIFY_ACTION_CHILD_DIRTIED: - case H5AC_NOTIFY_ACTION_CHILD_CLEANED: - case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: - case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: - /* do nothing */ - break; - - default: + "unable to destroy flush dependency between super block and index block, address = %llu", + (unsigned long long)sblock->addr) + + /* Destroy flush dependency on extensible array header, if set */ + if (sblock->has_hdr_depend) { + if (H5EA__destroy_flush_depend((H5AC_info_t *)sblock->hdr, (H5AC_info_t *)sblock) < 0) + H5E_THROW( + H5E_CANTUNDEPEND, + "unable to destroy flush dependency between super block and header, address = %llu", + (unsigned long long)sblock->addr) + sblock->has_hdr_depend = FALSE; + } /* end if */ + + /* Detach from 'top' proxy for extensible array */ + if (sblock->top_proxy) { + if (H5AC_proxy_entry_remove_child(sblock->top_proxy, sblock) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between super block and " + "extensible array 'top' proxy") + sblock->top_proxy = NULL; + } /* end if */ + break; + + case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: + case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: + case H5AC_NOTIFY_ACTION_CHILD_DIRTIED: + case H5AC_NOTIFY_ACTION_CHILD_CLEANED: + case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: + case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: + /* do nothing */ + break; + + default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") + H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") #else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); + HDassert(0 && "Unknown action?!?"); #endif /* NDEBUG */ -} /* end switch */ + } /* end switch */ -CATCH + CATCH END_FUNC(STATIC) /* end H5EA__cache_sblock_notify() */ @@ -1369,14 +1370,14 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_notify() */ */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_sblock_free_icr(void *thing)) -/* Check arguments */ -HDassert(thing); + /* Check arguments */ + HDassert(thing); -/* Release the extensible array super block */ -if (H5EA__sblock_dest((H5EA_sblock_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free extensible array super block") + /* Release the extensible array super block */ + if (H5EA__sblock_dest((H5EA_sblock_t *)thing) < 0) + H5E_THROW(H5E_CANTFREE, "can't free extensible array super block") -CATCH + CATCH END_FUNC(STATIC) /* end H5EA__cache_sblock_free_icr() */ @@ -1395,43 +1396,43 @@ END_FUNC(STATIC) /* end H5EA__cache_sblock_free_icr() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len)) -/* Local variables */ -H5EA_dblock_cache_ud_t *udata = (H5EA_dblock_cache_ud_t *)_udata; /* User data */ -H5EA_dblock_t dblock; /* Fake data block for computing size */ - -/* Check arguments */ -HDassert(udata); -HDassert(udata->hdr); -HDassert(udata->nelmts > 0); -HDassert(image_len); - -/* Set up fake data block for computing size on disk */ -/* (Note: extracted from H5EA__dblock_alloc) */ -HDmemset(&dblock, 0, sizeof(dblock)); - -/* need to set: - * - * dblock.hdr - * dblock.npages - * dblock.nelmts - * - * before we invoke either H5EA_DBLOCK_PREFIX_SIZE() or - * H5EA_DBLOCK_SIZE(). - */ -dblock.hdr = udata->hdr; -dblock.nelmts = udata->nelmts; - -if (udata->nelmts > udata->hdr->dblk_page_nelmts) { - /* Set the # of pages in the direct block */ - dblock.npages = udata->nelmts / udata->hdr->dblk_page_nelmts; - HDassert(udata->nelmts == (dblock.npages * udata->hdr->dblk_page_nelmts)); -} /* end if */ - -/* Set the image length size */ -if (!dblock.npages) - *image_len = H5EA_DBLOCK_SIZE(&dblock); -else - *image_len = H5EA_DBLOCK_PREFIX_SIZE(&dblock); + /* Local variables */ + H5EA_dblock_cache_ud_t *udata = (H5EA_dblock_cache_ud_t *)_udata; /* User data */ + H5EA_dblock_t dblock; /* Fake data block for computing size */ + + /* Check arguments */ + HDassert(udata); + HDassert(udata->hdr); + HDassert(udata->nelmts > 0); + HDassert(image_len); + + /* Set up fake data block for computing size on disk */ + /* (Note: extracted from H5EA__dblock_alloc) */ + HDmemset(&dblock, 0, sizeof(dblock)); + + /* need to set: + * + * dblock.hdr + * dblock.npages + * dblock.nelmts + * + * before we invoke either H5EA_DBLOCK_PREFIX_SIZE() or + * H5EA_DBLOCK_SIZE(). + */ + dblock.hdr = udata->hdr; + dblock.nelmts = udata->nelmts; + + if (udata->nelmts > udata->hdr->dblk_page_nelmts) { + /* Set the # of pages in the direct block */ + dblock.npages = udata->nelmts / udata->hdr->dblk_page_nelmts; + HDassert(udata->nelmts == (dblock.npages * udata->hdr->dblk_page_nelmts)); + } /* end if */ + + /* Set the image length size */ + if (!dblock.npages) + *image_len = H5EA_DBLOCK_SIZE(&dblock); + else + *image_len = H5EA_DBLOCK_PREFIX_SIZE(&dblock); END_FUNC(STATIC) /* end H5EA__cache_dblock_get_initial_load_size() */ @@ -1451,19 +1452,19 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_get_initial_load_size() */ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, H5EA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) -/* Local variables */ -const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t stored_chksum; /* Stored metadata checksum value */ -uint32_t computed_chksum; /* Computed metadata checksum value */ + /* Local variables */ + const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + uint32_t computed_chksum; /* Computed metadata checksum value */ -/* Check arguments */ -HDassert(image); + /* Check arguments */ + HDassert(image); -/* Get stored and computed checksums */ -H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); + /* Get stored and computed checksums */ + H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); -if (stored_chksum != computed_chksum) - ret_value = FALSE; + if (stored_chksum != computed_chksum) + ret_value = FALSE; END_FUNC(STATIC) /* end H5EA__cache_sblock_verify_chksum() */ @@ -1484,87 +1485,87 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)) -/* Local variables */ -H5EA_dblock_t * dblock = NULL; /* Data block info */ -H5EA_dblock_cache_ud_t *udata = (H5EA_dblock_cache_ud_t *)_udata; /* User data */ -const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t stored_chksum; /* Stored metadata checksum value */ -haddr_t arr_addr; /* Address of array header in the file */ + /* Local variables */ + H5EA_dblock_t * dblock = NULL; /* Data block info */ + H5EA_dblock_cache_ud_t *udata = (H5EA_dblock_cache_ud_t *)_udata; /* User data */ + const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + haddr_t arr_addr; /* Address of array header in the file */ -/* Check arguments */ -HDassert(udata); -HDassert(udata->hdr); -HDassert(udata->parent); -HDassert(udata->nelmts > 0); -HDassert(H5F_addr_defined(udata->dblk_addr)); + /* Check arguments */ + HDassert(udata); + HDassert(udata->hdr); + HDassert(udata->parent); + HDassert(udata->nelmts > 0); + HDassert(H5F_addr_defined(udata->dblk_addr)); -/* Allocate the extensible array data block */ -if (NULL == (dblock = H5EA__dblock_alloc(udata->hdr, udata->parent, udata->nelmts))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block") + /* Allocate the extensible array data block */ + if (NULL == (dblock = H5EA__dblock_alloc(udata->hdr, udata->parent, udata->nelmts))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block") -HDassert(((!dblock->npages) && (len == H5EA_DBLOCK_SIZE(dblock))) || - (len == H5EA_DBLOCK_PREFIX_SIZE(dblock))); + HDassert(((!dblock->npages) && (len == H5EA_DBLOCK_SIZE(dblock))) || + (len == H5EA_DBLOCK_PREFIX_SIZE(dblock))); -/* Set the extensible array data block's information */ -dblock->addr = udata->dblk_addr; + /* Set the extensible array data block's information */ + dblock->addr = udata->dblk_addr; -/* Magic number */ -if (HDmemcmp(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - H5E_THROW(H5E_BADVALUE, "wrong extensible array data block signature") -image += H5_SIZEOF_MAGIC; + /* Magic number */ + if (HDmemcmp(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + H5E_THROW(H5E_BADVALUE, "wrong extensible array data block signature") + image += H5_SIZEOF_MAGIC; -/* Version */ -if (*image++ != H5EA_DBLOCK_VERSION) - H5E_THROW(H5E_VERSION, "wrong extensible array data block version") + /* Version */ + if (*image++ != H5EA_DBLOCK_VERSION) + H5E_THROW(H5E_VERSION, "wrong extensible array data block version") -/* Extensible array type */ -if (*image++ != (uint8_t)udata->hdr->cparam.cls->id) - H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") + /* Extensible array type */ + if (*image++ != (uint8_t)udata->hdr->cparam.cls->id) + H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") -/* Address of header for array that owns this block (just for file integrity checks) */ -H5F_addr_decode(udata->hdr->f, &image, &arr_addr); -if (H5F_addr_ne(arr_addr, udata->hdr->addr)) - H5E_THROW(H5E_BADVALUE, "wrong extensible array header address") + /* Address of header for array that owns this block (just for file integrity checks) */ + H5F_addr_decode(udata->hdr->f, &image, &arr_addr); + if (H5F_addr_ne(arr_addr, udata->hdr->addr)) + H5E_THROW(H5E_BADVALUE, "wrong extensible array header address") -/* Offset of block within the array's address space */ -UINT64DECODE_VAR(image, dblock->block_off, udata->hdr->arr_off_size); + /* Offset of block within the array's address space */ + UINT64DECODE_VAR(image, dblock->block_off, udata->hdr->arr_off_size); -/* Internal information */ + /* Internal information */ -/* Only decode elements if the data block is not paged */ -if (!dblock->npages) { - /* Decode elements in data block */ - /* Convert from raw elements on disk into native elements in memory */ - if ((udata->hdr->cparam.cls->decode)(image, dblock->elmts, udata->nelmts, udata->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements") - image += (udata->nelmts * udata->hdr->cparam.raw_elmt_size); -} /* end if */ + /* Only decode elements if the data block is not paged */ + if (!dblock->npages) { + /* Decode elements in data block */ + /* Convert from raw elements on disk into native elements in memory */ + if ((udata->hdr->cparam.cls->decode)(image, dblock->elmts, udata->nelmts, udata->hdr->cb_ctx) < 0) + H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements") + image += (udata->nelmts * udata->hdr->cparam.raw_elmt_size); + } /* end if */ -/* Sanity check */ -/* (allow for checksum not decoded yet) */ -HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); + /* Sanity check */ + /* (allow for checksum not decoded yet) */ + HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); -/* Set the data block's size */ -/* (Note: This is not the same as the image length, for paged data blocks) */ -dblock->size = H5EA_DBLOCK_SIZE(dblock); + /* Set the data block's size */ + /* (Note: This is not the same as the image length, for paged data blocks) */ + dblock->size = H5EA_DBLOCK_SIZE(dblock); -/* checksum verification already done in verify_chksum cb */ + /* checksum verification already done in verify_chksum cb */ -/* Metadata checksum */ -UINT32DECODE(image, stored_chksum); + /* Metadata checksum */ + UINT32DECODE(image, stored_chksum); -/* Sanity check */ -HDassert((size_t)(image - (const uint8_t *)_image) == len); + /* Sanity check */ + HDassert((size_t)(image - (const uint8_t *)_image) == len); -/* Set return value */ -ret_value = dblock; + /* Set return value */ + ret_value = dblock; -CATCH + CATCH -/* Release resources */ -if (!ret_value) - if (dblock && H5EA__dblock_dest(dblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block") + /* Release resources */ + if (!ret_value) + if (dblock && H5EA__dblock_dest(dblock) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block") END_FUNC(STATIC) /* end H5EA__cache_dblock_deserialize() */ @@ -1583,18 +1584,18 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_deserialize() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__cache_dblock_image_len(const void *_thing, size_t *image_len)) -/* Local variables */ -const H5EA_dblock_t *dblock = (const H5EA_dblock_t *)_thing; /* Pointer to the object */ + /* Local variables */ + const H5EA_dblock_t *dblock = (const H5EA_dblock_t *)_thing; /* Pointer to the object */ -/* Check arguments */ -HDassert(dblock); -HDassert(image_len); + /* Check arguments */ + HDassert(dblock); + HDassert(image_len); -/* Set the image length size */ -if (!dblock->npages) - *image_len = dblock->size; -else - *image_len = (size_t)H5EA_DBLOCK_PREFIX_SIZE(dblock); + /* Set the image length size */ + if (!dblock->npages) + *image_len = dblock->size; + else + *image_len = (size_t)H5EA_DBLOCK_PREFIX_SIZE(dblock); END_FUNC(STATIC) /* end H5EA__cache_dblock_image_len() */ @@ -1614,56 +1615,56 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)) -/* Local variables */ -H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object to serialize */ -uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t metadata_chksum; /* Computed metadata checksum value */ + /* Local variables */ + H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object to serialize */ + uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t metadata_chksum; /* Computed metadata checksum value */ -/* check arguments */ -HDassert(f); -HDassert(image); -HDassert(dblock); -HDassert(dblock->hdr); + /* check arguments */ + HDassert(f); + HDassert(image); + HDassert(dblock); + HDassert(dblock->hdr); -/* Magic number */ -H5MM_memcpy(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); -image += H5_SIZEOF_MAGIC; + /* Magic number */ + H5MM_memcpy(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); + image += H5_SIZEOF_MAGIC; -/* Version # */ -*image++ = H5EA_DBLOCK_VERSION; + /* Version # */ + *image++ = H5EA_DBLOCK_VERSION; -/* Extensible array type */ -HDassert(dblock->hdr->cparam.cls->id <= 255); -*image++ = (uint8_t)dblock->hdr->cparam.cls->id; + /* Extensible array type */ + HDassert(dblock->hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)dblock->hdr->cparam.cls->id; -/* Address of array header for array which owns this block */ -H5F_addr_encode(f, &image, dblock->hdr->addr); + /* Address of array header for array which owns this block */ + H5F_addr_encode(f, &image, dblock->hdr->addr); -/* Offset of block in array */ -UINT64ENCODE_VAR(image, dblock->block_off, dblock->hdr->arr_off_size); + /* Offset of block in array */ + UINT64ENCODE_VAR(image, dblock->block_off, dblock->hdr->arr_off_size); -/* Internal information */ + /* Internal information */ -/* Only encode elements if the data block is not paged */ -if (!dblock->npages) { - /* Encode elements in data block */ + /* Only encode elements if the data block is not paged */ + if (!dblock->npages) { + /* Encode elements in data block */ - /* Convert from native elements in memory into raw elements on disk */ - if ((dblock->hdr->cparam.cls->encode)(image, dblock->elmts, dblock->nelmts, dblock->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements") - image += (dblock->nelmts * dblock->hdr->cparam.raw_elmt_size); -} /* end if */ + /* Convert from native elements in memory into raw elements on disk */ + if ((dblock->hdr->cparam.cls->encode)(image, dblock->elmts, dblock->nelmts, dblock->hdr->cb_ctx) < 0) + H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements") + image += (dblock->nelmts * dblock->hdr->cparam.raw_elmt_size); + } /* end if */ -/* Compute metadata checksum */ -metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); + /* Compute metadata checksum */ + metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); -/* Metadata checksum */ -UINT32ENCODE(image, metadata_chksum); + /* Metadata checksum */ + UINT32ENCODE(image, metadata_chksum); -/* Sanity check */ -HDassert((size_t)(image - (uint8_t *)_image) == len); + /* Sanity check */ + HDassert((size_t)(image - (uint8_t *)_image) == len); -CATCH + CATCH END_FUNC(STATIC) /* end H5EA__cache_dblock_serialize() */ @@ -1682,79 +1683,79 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_serialize() */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing)) -/* Local variables */ -H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object */ - -/* Check arguments */ -HDassert(dblock); - -/* Determine which action to take */ -switch (action) { - case H5AC_NOTIFY_ACTION_AFTER_INSERT: - case H5AC_NOTIFY_ACTION_AFTER_LOAD: - /* Create flush dependency on parent */ - if (H5EA__create_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0) - H5E_THROW(H5E_CANTDEPEND, - "unable to create flush dependency between data block and parent, address = %llu", - (unsigned long long)dblock->addr) - break; - - case H5AC_NOTIFY_ACTION_AFTER_FLUSH: - /* Destroy flush dependency on extensible array header, if set */ - if (dblock->has_hdr_depend) { - if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, - "unable to destroy flush dependency between direct block and header, address = %llu", - (unsigned long long)dblock->addr) - dblock->has_hdr_depend = FALSE; - } /* end if */ - break; - - case H5AC_NOTIFY_ACTION_BEFORE_EVICT: - /* Destroy flush dependency on parent */ - if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between data block and parent, address = %llu", - (unsigned long long)dblock->addr) - - /* Destroy flush dependency on extensible array header, if set */ - if (dblock->has_hdr_depend) { - if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0) + /* Local variables */ + H5EA_dblock_t *dblock = (H5EA_dblock_t *)_thing; /* Pointer to the object */ + + /* Check arguments */ + HDassert(dblock); + + /* Determine which action to take */ + switch (action) { + case H5AC_NOTIFY_ACTION_AFTER_INSERT: + case H5AC_NOTIFY_ACTION_AFTER_LOAD: + /* Create flush dependency on parent */ + if (H5EA__create_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0) + H5E_THROW(H5E_CANTDEPEND, + "unable to create flush dependency between data block and parent, address = %llu", + (unsigned long long)dblock->addr) + break; + + case H5AC_NOTIFY_ACTION_AFTER_FLUSH: + /* Destroy flush dependency on extensible array header, if set */ + if (dblock->has_hdr_depend) { + if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0) + H5E_THROW( + H5E_CANTUNDEPEND, + "unable to destroy flush dependency between direct block and header, address = %llu", + (unsigned long long)dblock->addr) + dblock->has_hdr_depend = FALSE; + } /* end if */ + break; + + case H5AC_NOTIFY_ACTION_BEFORE_EVICT: + /* Destroy flush dependency on parent */ + if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0) H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between data block and header, address = %llu", + "unable to destroy flush dependency between data block and parent, address = %llu", (unsigned long long)dblock->addr) - dblock->has_hdr_depend = FALSE; - } /* end if */ - /* Detach from 'top' proxy for extensible array */ - if (dblock->top_proxy) { - if (H5AC_proxy_entry_remove_child(dblock->top_proxy, dblock) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, - "unable to destroy flush dependency between data block and extensible array 'top' proxy") - dblock->top_proxy = NULL; - } /* end if */ - break; - - case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: - case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: - case H5AC_NOTIFY_ACTION_CHILD_DIRTIED: - case H5AC_NOTIFY_ACTION_CHILD_CLEANED: - case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: - case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: - /* do nothing */ - break; - - default: + /* Destroy flush dependency on extensible array header, if set */ + if (dblock->has_hdr_depend) { + if (H5EA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0) + H5E_THROW( + H5E_CANTUNDEPEND, + "unable to destroy flush dependency between data block and header, address = %llu", + (unsigned long long)dblock->addr) + dblock->has_hdr_depend = FALSE; + } /* end if */ + + /* Detach from 'top' proxy for extensible array */ + if (dblock->top_proxy) { + if (H5AC_proxy_entry_remove_child(dblock->top_proxy, dblock) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block and " + "extensible array 'top' proxy") + dblock->top_proxy = NULL; + } /* end if */ + break; + + case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: + case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: + case H5AC_NOTIFY_ACTION_CHILD_DIRTIED: + case H5AC_NOTIFY_ACTION_CHILD_CLEANED: + case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: + case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: + /* do nothing */ + break; + + default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") + H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") #else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); + HDassert(0 && "Unknown action?!?"); #endif /* NDEBUG */ -} /* end switch */ + } /* end switch */ -CATCH + CATCH END_FUNC(STATIC) /* end H5EA__cache_dblock_notify() */ @@ -1773,14 +1774,14 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_notify() */ */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_dblock_free_icr(void *thing)) -/* Check arguments */ -HDassert(thing); + /* Check arguments */ + HDassert(thing); -/* Release the extensible array data block */ -if (H5EA__dblock_dest((H5EA_dblock_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free extensible array data block") + /* Release the extensible array data block */ + if (H5EA__dblock_dest((H5EA_dblock_t *)thing) < 0) + H5E_THROW(H5E_CANTFREE, "can't free extensible array data block") -CATCH + CATCH END_FUNC(STATIC) /* end H5EA__cache_dblock_free_icr() */ @@ -1816,16 +1817,16 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_free_icr() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size)) -/* Local variables */ -const H5EA_dblock_t *dblock = (const H5EA_dblock_t *)_thing; /* Pointer to the object */ + /* Local variables */ + const H5EA_dblock_t *dblock = (const H5EA_dblock_t *)_thing; /* Pointer to the object */ -/* Check arguments */ -HDassert(dblock); -HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); -HDassert(dblock->cache_info.type == H5AC_EARRAY_DBLOCK); -HDassert(fsf_size); + /* Check arguments */ + HDassert(dblock); + HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(dblock->cache_info.type == H5AC_EARRAY_DBLOCK); + HDassert(fsf_size); -*fsf_size = dblock->size; + *fsf_size = dblock->size; END_FUNC(STATIC) /* end H5EA__cache_dblock_fsf_size() */ @@ -1844,16 +1845,16 @@ END_FUNC(STATIC) /* end H5EA__cache_dblock_fsf_size() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len)) -/* Local variables */ -H5EA_dblk_page_cache_ud_t *udata = (H5EA_dblk_page_cache_ud_t *)_udata; /* User data */ + /* Local variables */ + H5EA_dblk_page_cache_ud_t *udata = (H5EA_dblk_page_cache_ud_t *)_udata; /* User data */ -/* Check arguments */ -HDassert(udata); -HDassert(udata->hdr); -HDassert(image_len); + /* Check arguments */ + HDassert(udata); + HDassert(udata->hdr); + HDassert(image_len); -/* Set the image length size */ -*image_len = (size_t)H5EA_DBLK_PAGE_SIZE(udata->hdr); + /* Set the image length size */ + *image_len = (size_t)H5EA_DBLK_PAGE_SIZE(udata->hdr); END_FUNC(STATIC) /* end H5EA__cache_dblk_page_get_initial_load_size() */ @@ -1873,19 +1874,19 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_get_initial_load_size() */ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, H5EA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) -/* Local variables */ -const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t stored_chksum; /* Stored metadata checksum value */ -uint32_t computed_chksum; /* Computed metadata checksum value */ + /* Local variables */ + const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + uint32_t computed_chksum; /* Computed metadata checksum value */ -/* Check arguments */ -HDassert(image); + /* Check arguments */ + HDassert(image); -/* Get stored and computed checksums */ -H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); + /* Get stored and computed checksums */ + H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); -if (stored_chksum != computed_chksum) - ret_value = FALSE; + if (stored_chksum != computed_chksum) + ret_value = FALSE; END_FUNC(STATIC) /* end H5EA__cache_dblk_page_verify_chksum() */ @@ -1906,59 +1907,59 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5EA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)) -/* Local variables */ -H5EA_dblk_page_t * dblk_page = NULL; /* Data block page info */ -H5EA_dblk_page_cache_ud_t *udata = - (H5EA_dblk_page_cache_ud_t *)_udata; /* User data for loading data block page */ -const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t stored_chksum; /* Stored metadata checksum value */ + /* Local variables */ + H5EA_dblk_page_t * dblk_page = NULL; /* Data block page info */ + H5EA_dblk_page_cache_ud_t *udata = + (H5EA_dblk_page_cache_ud_t *)_udata; /* User data for loading data block page */ + const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ -/* Sanity check */ -HDassert(udata); -HDassert(udata->hdr); -HDassert(udata->parent); -HDassert(H5F_addr_defined(udata->dblk_page_addr)); + /* Sanity check */ + HDassert(udata); + HDassert(udata->hdr); + HDassert(udata->parent); + HDassert(H5F_addr_defined(udata->dblk_page_addr)); -/* Allocate the extensible array data block page */ -if (NULL == (dblk_page = H5EA__dblk_page_alloc(udata->hdr, udata->parent))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page") + /* Allocate the extensible array data block page */ + if (NULL == (dblk_page = H5EA__dblk_page_alloc(udata->hdr, udata->parent))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page") -/* Set the extensible array data block page's information */ -dblk_page->addr = udata->dblk_page_addr; + /* Set the extensible array data block page's information */ + dblk_page->addr = udata->dblk_page_addr; -/* Internal information */ + /* Internal information */ -/* Decode elements in data block page */ -/* Convert from raw elements on disk into native elements in memory */ -if ((udata->hdr->cparam.cls->decode)(image, dblk_page->elmts, udata->hdr->dblk_page_nelmts, - udata->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements") -image += (udata->hdr->dblk_page_nelmts * udata->hdr->cparam.raw_elmt_size); + /* Decode elements in data block page */ + /* Convert from raw elements on disk into native elements in memory */ + if ((udata->hdr->cparam.cls->decode)(image, dblk_page->elmts, udata->hdr->dblk_page_nelmts, + udata->hdr->cb_ctx) < 0) + H5E_THROW(H5E_CANTDECODE, "can't decode extensible array data elements") + image += (udata->hdr->dblk_page_nelmts * udata->hdr->cparam.raw_elmt_size); -/* Sanity check */ -/* (allow for checksum not decoded yet) */ -HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); + /* Sanity check */ + /* (allow for checksum not decoded yet) */ + HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); -/* Set the data block page's size */ -dblk_page->size = len; + /* Set the data block page's size */ + dblk_page->size = len; -/* checksum verification already done in verify_chksum cb */ + /* checksum verification already done in verify_chksum cb */ -/* Metadata checksum */ -UINT32DECODE(image, stored_chksum); + /* Metadata checksum */ + UINT32DECODE(image, stored_chksum); -/* Sanity check */ -HDassert((size_t)(image - (const uint8_t *)_image) == dblk_page->size); + /* Sanity check */ + HDassert((size_t)(image - (const uint8_t *)_image) == dblk_page->size); -/* Set return value */ -ret_value = dblk_page; + /* Set return value */ + ret_value = dblk_page; -CATCH + CATCH -/* Release resources */ -if (!ret_value) - if (dblk_page && H5EA__dblk_page_dest(dblk_page) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page") + /* Release resources */ + if (!ret_value) + if (dblk_page && H5EA__dblk_page_dest(dblk_page) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page") END_FUNC(STATIC) /* end H5EA__cache_dblk_page_deserialize() */ @@ -1977,15 +1978,15 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_deserialize() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__cache_dblk_page_image_len(const void *_thing, size_t *image_len)) -/* Local variables */ -const H5EA_dblk_page_t *dblk_page = (const H5EA_dblk_page_t *)_thing; /* Pointer to the object */ + /* Local variables */ + const H5EA_dblk_page_t *dblk_page = (const H5EA_dblk_page_t *)_thing; /* Pointer to the object */ -/* Check arguments */ -HDassert(dblk_page); -HDassert(image_len); + /* Check arguments */ + HDassert(dblk_page); + HDassert(image_len); -/* Set the image length size */ -*image_len = dblk_page->size; + /* Set the image length size */ + *image_len = dblk_page->size; END_FUNC(STATIC) /* end H5EA__cache_dblk_page_image_len() */ @@ -2005,37 +2006,37 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)) -/* Local variables */ -H5EA_dblk_page_t *dblk_page = (H5EA_dblk_page_t *)_thing; /* Pointer to the object to serialize */ -uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t metadata_chksum; /* Computed metadata checksum value */ + /* Local variables */ + H5EA_dblk_page_t *dblk_page = (H5EA_dblk_page_t *)_thing; /* Pointer to the object to serialize */ + uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t metadata_chksum; /* Computed metadata checksum value */ -/* Check arguments */ -HDassert(f); -HDassert(image); -HDassert(dblk_page); -HDassert(dblk_page->hdr); + /* Check arguments */ + HDassert(f); + HDassert(image); + HDassert(dblk_page); + HDassert(dblk_page->hdr); -/* Internal information */ + /* Internal information */ -/* Encode elements in data block page */ + /* Encode elements in data block page */ -/* Convert from native elements in memory into raw elements on disk */ -if ((dblk_page->hdr->cparam.cls->encode)(image, dblk_page->elmts, dblk_page->hdr->dblk_page_nelmts, - dblk_page->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements") -image += (dblk_page->hdr->dblk_page_nelmts * dblk_page->hdr->cparam.raw_elmt_size); + /* Convert from native elements in memory into raw elements on disk */ + if ((dblk_page->hdr->cparam.cls->encode)(image, dblk_page->elmts, dblk_page->hdr->dblk_page_nelmts, + dblk_page->hdr->cb_ctx) < 0) + H5E_THROW(H5E_CANTENCODE, "can't encode extensible array data elements") + image += (dblk_page->hdr->dblk_page_nelmts * dblk_page->hdr->cparam.raw_elmt_size); -/* Compute metadata checksum */ -metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); + /* Compute metadata checksum */ + metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); -/* Metadata checksum */ -UINT32ENCODE(image, metadata_chksum); + /* Metadata checksum */ + UINT32ENCODE(image, metadata_chksum); -/* Sanity check */ -HDassert((size_t)(image - (uint8_t *)_image) == len); + /* Sanity check */ + HDassert((size_t)(image - (uint8_t *)_image) == len); -CATCH + CATCH END_FUNC(STATIC) /* end H5EA__cache_dblk_page_serialize() */ @@ -2054,79 +2055,82 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_serialize() */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing)) -/* Local variables */ -H5EA_dblk_page_t *dblk_page = (H5EA_dblk_page_t *)_thing; /* Pointer to the object */ - -/* Sanity check */ -HDassert(dblk_page); - -/* Determine which action to take */ -switch (action) { - case H5AC_NOTIFY_ACTION_AFTER_INSERT: - case H5AC_NOTIFY_ACTION_AFTER_LOAD: - /* Create flush dependency on parent */ - if (H5EA__create_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0) - H5E_THROW(H5E_CANTDEPEND, - "unable to create flush dependency between data block page and parent, address = %llu", - (unsigned long long)dblk_page->addr) - break; - - case H5AC_NOTIFY_ACTION_AFTER_FLUSH: - /* Destroy flush dependency on extensible array header, if set */ - if (dblk_page->has_hdr_depend) { - if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0) + /* Local variables */ + H5EA_dblk_page_t *dblk_page = (H5EA_dblk_page_t *)_thing; /* Pointer to the object */ + + /* Sanity check */ + HDassert(dblk_page); + + /* Determine which action to take */ + switch (action) { + case H5AC_NOTIFY_ACTION_AFTER_INSERT: + case H5AC_NOTIFY_ACTION_AFTER_LOAD: + /* Create flush dependency on parent */ + if (H5EA__create_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0) H5E_THROW( - H5E_CANTUNDEPEND, - "unable to destroy flush dependency between data block page and header, address = %llu", + H5E_CANTDEPEND, + "unable to create flush dependency between data block page and parent, address = %llu", (unsigned long long)dblk_page->addr) - dblk_page->has_hdr_depend = FALSE; - } /* end if */ - break; - - case H5AC_NOTIFY_ACTION_BEFORE_EVICT: - /* Destroy flush dependency on parent */ - if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between data block page and parent, address = %llu", - (unsigned long long)dblk_page->addr) - - /* Destroy flush dependency on extensible array header, if set */ - if (dblk_page->has_hdr_depend) { - if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0) + break; + + case H5AC_NOTIFY_ACTION_AFTER_FLUSH: + /* Destroy flush dependency on extensible array header, if set */ + if (dblk_page->has_hdr_depend) { + if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0) + H5E_THROW(H5E_CANTUNDEPEND, + "unable to destroy flush dependency between data block page and header, " + "address = %llu", + (unsigned long long)dblk_page->addr) + dblk_page->has_hdr_depend = FALSE; + } /* end if */ + break; + + case H5AC_NOTIFY_ACTION_BEFORE_EVICT: + /* Destroy flush dependency on parent */ + if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->parent, (H5AC_info_t *)dblk_page) < 0) H5E_THROW( H5E_CANTUNDEPEND, - "unable to destroy flush dependency between data block page and header, address = %llu", + "unable to destroy flush dependency between data block page and parent, address = %llu", (unsigned long long)dblk_page->addr) - dblk_page->has_hdr_depend = FALSE; - } /* end if */ - - /* Detach from 'top' proxy for extensible array */ - if (dblk_page->top_proxy) { - if (H5AC_proxy_entry_remove_child(dblk_page->top_proxy, dblk_page) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block page and " - "extensible array 'top' proxy") - dblk_page->top_proxy = NULL; - } /* end if */ - break; - - case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: - case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: - case H5AC_NOTIFY_ACTION_CHILD_DIRTIED: - case H5AC_NOTIFY_ACTION_CHILD_CLEANED: - case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: - case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: - /* do nothing */ - break; - - default: + + /* Destroy flush dependency on extensible array header, if set */ + if (dblk_page->has_hdr_depend) { + if (H5EA__destroy_flush_depend((H5AC_info_t *)dblk_page->hdr, (H5AC_info_t *)dblk_page) < 0) + H5E_THROW(H5E_CANTUNDEPEND, + "unable to destroy flush dependency between data block page and header, " + "address = %llu", + (unsigned long long)dblk_page->addr) + dblk_page->has_hdr_depend = FALSE; + } /* end if */ + + /* Detach from 'top' proxy for extensible array */ + if (dblk_page->top_proxy) { + if (H5AC_proxy_entry_remove_child(dblk_page->top_proxy, dblk_page) < 0) + H5E_THROW(H5E_CANTUNDEPEND, + "unable to destroy flush dependency between data block page and " + "extensible array 'top' proxy") + dblk_page->top_proxy = NULL; + } /* end if */ + break; + + case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: + case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: + case H5AC_NOTIFY_ACTION_CHILD_DIRTIED: + case H5AC_NOTIFY_ACTION_CHILD_CLEANED: + case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: + case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: + /* do nothing */ + break; + + default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") + H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") #else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); + HDassert(0 && "Unknown action?!?"); #endif /* NDEBUG */ -} /* end switch */ + } /* end switch */ -CATCH + CATCH END_FUNC(STATIC) /* end H5EA__cache_dblk_page_notify() */ @@ -2145,13 +2149,13 @@ END_FUNC(STATIC) /* end H5EA__cache_dblk_page_notify() */ */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__cache_dblk_page_free_icr(void *thing)) -/* Check arguments */ -HDassert(thing); + /* Check arguments */ + HDassert(thing); -/* Release the extensible array data block page */ -if (H5EA__dblk_page_dest((H5EA_dblk_page_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free extensible array data block page") + /* Release the extensible array data block page */ + if (H5EA__dblk_page_dest((H5EA_dblk_page_t *)thing) < 0) + H5E_THROW(H5E_CANTFREE, "can't free extensible array data block page") -CATCH + CATCH END_FUNC(STATIC) /* end H5EA__cache_dblk_page_free_icr() */ diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c index a482eb0..595983f 100644 --- a/src/H5EAdbg.c +++ b/src/H5EAdbg.c @@ -83,64 +83,65 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5EA_class_t *cls, haddr_t obj_addr)) -/* Local variables */ -H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */ -void * dbg_ctx = NULL; /* Extensible array debugging context */ - -/* Check arguments */ -HDassert(f); -HDassert(H5F_addr_defined(addr)); -HDassert(H5F_addr_defined(obj_addr)); -HDassert(stream); -HDassert(indent >= 0); -HDassert(fwidth >= 0); -HDassert(cls); - -/* Check for debugging context callback available */ -if (cls->crt_dbg_ctx) - /* Create debugging context */ - if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) - H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") - -/* Load the extensible array header */ -if (NULL == (hdr = H5EA__hdr_protect(f, addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") - -/* Print opening message */ -HDfprintf(stream, "%*sExtensible Array Header...\n", indent, ""); - -/* Print the values */ -HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); -HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Header size:", hdr->size); -HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Raw Element Size:", (unsigned)hdr->cparam.raw_elmt_size); -HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Native Element Size (on this platform):", hdr->cparam.cls->nat_elmt_size); -HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Log2(Max. # of elements in array):", (unsigned)hdr->cparam.max_nelmts_bits); -HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "# of elements in index block:", (unsigned)hdr->cparam.idx_blk_elmts); -HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Min. # of elements per data block:", (unsigned)hdr->cparam.data_blk_min_elmts); -HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Min. # of data block pointers for a super block:", (unsigned)hdr->cparam.sup_blk_min_data_ptrs); -HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Log2(Max. # of elements in data block page):", (unsigned)hdr->cparam.max_dblk_page_nelmts_bits); -HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Highest element index stored (+1):", hdr->stats.stored.max_idx_set); -HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of super blocks created:", hdr->stats.stored.nsuper_blks); -HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of data blocks created:", hdr->stats.stored.ndata_blks); -HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of elements 'realized':", hdr->stats.stored.nelmts); -HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Index Block Address:", hdr->idx_blk_addr); - -CATCH -if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context") -if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + /* Local variables */ + H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */ + void * dbg_ctx = NULL; /* Extensible array debugging context */ + + /* Check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(H5F_addr_defined(obj_addr)); + HDassert(stream); + HDassert(indent >= 0); + HDassert(fwidth >= 0); + HDassert(cls); + + /* Check for debugging context callback available */ + if (cls->crt_dbg_ctx) + /* Create debugging context */ + if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) + H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") + + /* Load the extensible array header */ + if (NULL == (hdr = H5EA__hdr_protect(f, addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) + H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") + + /* Print opening message */ + HDfprintf(stream, "%*sExtensible Array Header...\n", indent, ""); + + /* Print the values */ + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size:", hdr->size); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Raw Element Size:", (unsigned)hdr->cparam.raw_elmt_size); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "Native Element Size (on this platform):", hdr->cparam.cls->nat_elmt_size); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Log2(Max. # of elements in array):", (unsigned)hdr->cparam.max_nelmts_bits); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "# of elements in index block:", (unsigned)hdr->cparam.idx_blk_elmts); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Min. # of elements per data block:", (unsigned)hdr->cparam.data_blk_min_elmts); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Min. # of data block pointers for a super block:", + (unsigned)hdr->cparam.sup_blk_min_data_ptrs); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Log2(Max. # of elements in data block page):", + (unsigned)hdr->cparam.max_dblk_page_nelmts_bits); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Highest element index stored (+1):", hdr->stats.stored.max_idx_set); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Number of super blocks created:", hdr->stats.stored.nsuper_blks); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Number of data blocks created:", hdr->stats.stored.ndata_blks); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Number of elements 'realized':", hdr->stats.stored.nelmts); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Index Block Address:", hdr->idx_blk_addr); + + CATCH + if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) + H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context") + if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") END_FUNC(PKG) /* end H5EA__hdr_debug() */ @@ -160,101 +161,102 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int indent, int fwidth, const H5EA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr)) -/* Local variables */ -H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */ -H5EA_iblock_t *iblock = NULL; /* Extensible array index block */ -void * dbg_ctx = NULL; /* Extensible array context */ - -/* Check arguments */ -HDassert(f); -HDassert(H5F_addr_defined(addr)); -HDassert(stream); -HDassert(indent >= 0); -HDassert(fwidth >= 0); -HDassert(cls); -HDassert(H5F_addr_defined(hdr_addr)); -HDassert(H5F_addr_defined(obj_addr)); - -/* Check for debugging context callback available */ -if (cls->crt_dbg_ctx) - /* Create debugging context */ - if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) - H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context") - -/* Load the extensible array header */ -if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") - -/* Sanity check */ -HDassert(H5F_addr_eq(hdr->idx_blk_addr, addr)); - -/* Protect index block */ -if (NULL == (iblock = H5EA__iblock_protect(hdr, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", - (unsigned long long)hdr->idx_blk_addr) - -/* Print opening message */ -HDfprintf(stream, "%*sExtensible Array Index Block...\n", indent, ""); - -/* Print the values */ -HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); -HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Index Block size:", iblock->size); -HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "# of data block addresses in index block:", iblock->ndblk_addrs); -HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "# of super block addresses in index block:", iblock->nsblk_addrs); - -/* Check if there are any elements in index block */ -if (hdr->cparam.idx_blk_elmts > 0) { - unsigned u; /* Local index variable */ - - /* Print the elements in the index block */ - HDfprintf(stream, "%*sElements in Index Block:\n", indent, ""); - for (u = 0; u < hdr->cparam.idx_blk_elmts; u++) { - /* Call the class's 'debug' callback */ - if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, - ((uint8_t *)iblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) - H5E_THROW(H5E_CANTGET, "can't get element for debugging") - } /* end for */ -} /* end if */ - -/* Check if there are any data block addresses in index block */ -if (iblock->ndblk_addrs > 0) { - char temp_str[128]; /* Temporary string, for formatting */ - unsigned u; /* Local index variable */ - - /* Print the data block addresses in the index block */ - HDfprintf(stream, "%*sData Block Addresses in Index Block:\n", indent, ""); - for (u = 0; u < iblock->ndblk_addrs; u++) { - /* Print address */ - HDsprintf(temp_str, "Address #%u:", u); - HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, - iblock->dblk_addrs[u]); - } /* end for */ -} /* end if */ - -/* Check if there are any super block addresses in index block */ -if (iblock->nsblk_addrs > 0) { - char temp_str[128]; /* Temporary string, for formatting */ - unsigned u; /* Local index variable */ - - /* Print the super block addresses in the index block */ - HDfprintf(stream, "%*sSuper Block Addresses in Index Block:\n", indent, ""); - for (u = 0; u < iblock->nsblk_addrs; u++) { - /* Print address */ - HDsprintf(temp_str, "Address #%u:", u); - HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, - iblock->sblk_addrs[u]); - } /* end for */ -} /* end if */ - -CATCH -if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context") -if (iblock && H5EA__iblock_unprotect(iblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block") -if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + /* Local variables */ + H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */ + H5EA_iblock_t *iblock = NULL; /* Extensible array index block */ + void * dbg_ctx = NULL; /* Extensible array context */ + + /* Check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(stream); + HDassert(indent >= 0); + HDassert(fwidth >= 0); + HDassert(cls); + HDassert(H5F_addr_defined(hdr_addr)); + HDassert(H5F_addr_defined(obj_addr)); + + /* Check for debugging context callback available */ + if (cls->crt_dbg_ctx) + /* Create debugging context */ + if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) + H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context") + + /* Load the extensible array header */ + if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) + H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") + + /* Sanity check */ + HDassert(H5F_addr_eq(hdr->idx_blk_addr, addr)); + + /* Protect index block */ + if (NULL == (iblock = H5EA__iblock_protect(hdr, H5AC__READ_ONLY_FLAG))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", + (unsigned long long)hdr->idx_blk_addr) + + /* Print opening message */ + HDfprintf(stream, "%*sExtensible Array Index Block...\n", indent, ""); + + /* Print the values */ + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Index Block size:", iblock->size); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "# of data block addresses in index block:", iblock->ndblk_addrs); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "# of super block addresses in index block:", iblock->nsblk_addrs); + + /* Check if there are any elements in index block */ + if (hdr->cparam.idx_blk_elmts > 0) { + unsigned u; /* Local index variable */ + + /* Print the elements in the index block */ + HDfprintf(stream, "%*sElements in Index Block:\n", indent, ""); + for (u = 0; u < hdr->cparam.idx_blk_elmts; u++) { + /* Call the class's 'debug' callback */ + if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, + ((uint8_t *)iblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < + 0) + H5E_THROW(H5E_CANTGET, "can't get element for debugging") + } /* end for */ + } /* end if */ + + /* Check if there are any data block addresses in index block */ + if (iblock->ndblk_addrs > 0) { + char temp_str[128]; /* Temporary string, for formatting */ + unsigned u; /* Local index variable */ + + /* Print the data block addresses in the index block */ + HDfprintf(stream, "%*sData Block Addresses in Index Block:\n", indent, ""); + for (u = 0; u < iblock->ndblk_addrs; u++) { + /* Print address */ + HDsprintf(temp_str, "Address #%u:", u); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, + iblock->dblk_addrs[u]); + } /* end for */ + } /* end if */ + + /* Check if there are any super block addresses in index block */ + if (iblock->nsblk_addrs > 0) { + char temp_str[128]; /* Temporary string, for formatting */ + unsigned u; /* Local index variable */ + + /* Print the super block addresses in the index block */ + HDfprintf(stream, "%*sSuper Block Addresses in Index Block:\n", indent, ""); + for (u = 0; u < iblock->nsblk_addrs; u++) { + /* Print address */ + HDsprintf(temp_str, "Address #%u:", u); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, + iblock->sblk_addrs[u]); + } /* end for */ + } /* end if */ + + CATCH + if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) + H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context") + if (iblock && H5EA__iblock_unprotect(iblock, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block") + if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") END_FUNC(PKG) /* end H5EA__iblock_debug() */ @@ -274,70 +276,71 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5EA_class_t *cls, haddr_t hdr_addr, unsigned sblk_idx, haddr_t obj_addr)) -/* Local variables */ -H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */ -H5EA_sblock_t *sblock = NULL; /* Extensible array super block */ -void * dbg_ctx = NULL; /* Extensible array context */ - -/* Check arguments */ -HDassert(f); -HDassert(H5F_addr_defined(addr)); -HDassert(stream); -HDassert(indent >= 0); -HDassert(fwidth >= 0); -HDassert(cls); -HDassert(H5F_addr_defined(hdr_addr)); -HDassert(H5F_addr_defined(obj_addr)); - -/* Check for debugging context callback available */ -if (cls->crt_dbg_ctx) - /* Create debugging context */ - if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) - H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context") - -/* Load the extensible array header */ -if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") - -/* Protect super block */ -/* (Note: setting parent of super block to 'hdr' for this operation should be OK -QAK) */ -if (NULL == (sblock = H5EA__sblock_protect(hdr, (H5EA_iblock_t *)hdr, addr, sblk_idx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", - (unsigned long long)addr) - -/* Print opening message */ -HDfprintf(stream, "%*sExtensible Array Super Block...\n", indent, ""); - -/* Print the values */ -HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); -HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Super Block size:", sblock->size); -HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "# of data block addresses in super block:", sblock->ndblks); -HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "# of elements in data blocks from this super block:", sblock->dblk_nelmts); - -/* Check if there are any data block addresses in super block */ -if (sblock->ndblks > 0) { - char temp_str[128]; /* Temporary string, for formatting */ - unsigned u; /* Local index variable */ - - /* Print the data block addresses in the super block */ - HDfprintf(stream, "%*sData Block Addresses in Super Block:\n", indent, ""); - for (u = 0; u < sblock->ndblks; u++) { - /* Print address */ - HDsprintf(temp_str, "Address #%u:", u); - HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, - sblock->dblk_addrs[u]); - } /* end for */ -} /* end if */ - -CATCH -if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context") -if (sblock && H5EA__sblock_unprotect(sblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block") -if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + /* Local variables */ + H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */ + H5EA_sblock_t *sblock = NULL; /* Extensible array super block */ + void * dbg_ctx = NULL; /* Extensible array context */ + + /* Check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(stream); + HDassert(indent >= 0); + HDassert(fwidth >= 0); + HDassert(cls); + HDassert(H5F_addr_defined(hdr_addr)); + HDassert(H5F_addr_defined(obj_addr)); + + /* Check for debugging context callback available */ + if (cls->crt_dbg_ctx) + /* Create debugging context */ + if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) + H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context") + + /* Load the extensible array header */ + if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) + H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") + + /* Protect super block */ + /* (Note: setting parent of super block to 'hdr' for this operation should be OK -QAK) */ + if (NULL == + (sblock = H5EA__sblock_protect(hdr, (H5EA_iblock_t *)hdr, addr, sblk_idx, H5AC__READ_ONLY_FLAG))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", + (unsigned long long)addr) + + /* Print opening message */ + HDfprintf(stream, "%*sExtensible Array Super Block...\n", indent, ""); + + /* Print the values */ + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Super Block size:", sblock->size); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "# of data block addresses in super block:", sblock->ndblks); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "# of elements in data blocks from this super block:", sblock->dblk_nelmts); + + /* Check if there are any data block addresses in super block */ + if (sblock->ndblks > 0) { + char temp_str[128]; /* Temporary string, for formatting */ + unsigned u; /* Local index variable */ + + /* Print the data block addresses in the super block */ + HDfprintf(stream, "%*sData Block Addresses in Super Block:\n", indent, ""); + for (u = 0; u < sblock->ndblks; u++) { + /* Print address */ + HDsprintf(temp_str, "Address #%u:", u); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, + sblock->dblk_addrs[u]); + } /* end for */ + } /* end if */ + + CATCH + if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) + H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context") + if (sblock && H5EA__sblock_unprotect(sblock, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block") + if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") END_FUNC(PKG) /* end H5EA__sblock_debug() */ @@ -358,61 +361,61 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, const H5EA_class_t *cls, haddr_t hdr_addr, size_t dblk_nelmts, haddr_t obj_addr)) -/* Local variables */ -H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */ -H5EA_dblock_t *dblock = NULL; /* Extensible array data block */ -void * dbg_ctx = NULL; /* Extensible array context */ -size_t u; /* Local index variable */ - -/* Check arguments */ -HDassert(f); -HDassert(H5F_addr_defined(addr)); -HDassert(stream); -HDassert(indent >= 0); -HDassert(fwidth >= 0); -HDassert(cls); -HDassert(H5F_addr_defined(hdr_addr)); -HDassert(H5F_addr_defined(obj_addr)); -HDassert(dblk_nelmts > 0); - -/* Check for debugging context callback available */ -if (cls->crt_dbg_ctx) - /* Create debugging context */ - if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) - H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context") - -/* Load the extensible array header */ -if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") - -/* Protect data block */ -/* (Note: setting parent of data block to 'hdr' for this operation should be OK -QAK) */ -if (NULL == (dblock = H5EA__dblock_protect(hdr, hdr, addr, dblk_nelmts, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", - (unsigned long long)addr) - -/* Print opening message */ -HDfprintf(stream, "%*sExtensible Array data Block...\n", indent, ""); - -/* Print the values */ -HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); -HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Data Block size:", dblock->size); - -/* Print the elements in the index block */ -HDfprintf(stream, "%*sElements:\n", indent, ""); -for (u = 0; u < dblk_nelmts; u++) { - /* Call the class's 'debug' callback */ - if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, - ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) - H5E_THROW(H5E_CANTGET, "can't get element for debugging") -} /* end for */ - -CATCH -if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context") -if (dblock && H5EA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block") -if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + /* Local variables */ + H5EA_hdr_t * hdr = NULL; /* Shared extensible array header */ + H5EA_dblock_t *dblock = NULL; /* Extensible array data block */ + void * dbg_ctx = NULL; /* Extensible array context */ + size_t u; /* Local index variable */ + + /* Check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(stream); + HDassert(indent >= 0); + HDassert(fwidth >= 0); + HDassert(cls); + HDassert(H5F_addr_defined(hdr_addr)); + HDassert(H5F_addr_defined(obj_addr)); + HDassert(dblk_nelmts > 0); + + /* Check for debugging context callback available */ + if (cls->crt_dbg_ctx) + /* Create debugging context */ + if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) + H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context") + + /* Load the extensible array header */ + if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) + H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header") + + /* Protect data block */ + /* (Note: setting parent of data block to 'hdr' for this operation should be OK -QAK) */ + if (NULL == (dblock = H5EA__dblock_protect(hdr, hdr, addr, dblk_nelmts, H5AC__READ_ONLY_FLAG))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %" PRIuHADDR, + addr) + + /* Print opening message */ + HDfprintf(stream, "%*sExtensible Array data Block...\n", indent, ""); + + /* Print the values */ + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Data Block size:", dblock->size); + + /* Print the elements in the index block */ + HDfprintf(stream, "%*sElements:\n", indent, ""); + for (u = 0; u < dblk_nelmts; u++) { + /* Call the class's 'debug' callback */ + if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, + ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) + H5E_THROW(H5E_CANTGET, "can't get element for debugging") + } /* end for */ + + CATCH + if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) + H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context") + if (dblock && H5EA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block") + if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") END_FUNC(PKG) /* end H5EA__dblock_debug() */ diff --git a/src/H5EAdblkpage.c b/src/H5EAdblkpage.c index 43b59d6..f8ea0ed 100644 --- a/src/H5EAdblkpage.c +++ b/src/H5EAdblkpage.c @@ -87,35 +87,35 @@ H5FL_DEFINE_STATIC(H5EA_dblk_page_t); BEGIN_FUNC(PKG, ERR, H5EA_dblk_page_t *, NULL, NULL, H5EA__dblk_page_alloc(H5EA_hdr_t *hdr, H5EA_sblock_t *parent)) -/* Local variables */ -H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */ + /* Local variables */ + H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */ -/* Check arguments */ -HDassert(hdr); + /* Check arguments */ + HDassert(hdr); -/* Allocate memory for the data block */ -if (NULL == (dblk_page = H5FL_CALLOC(H5EA_dblk_page_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page") + /* Allocate memory for the data block */ + if (NULL == (dblk_page = H5FL_CALLOC(H5EA_dblk_page_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page") -/* Share common array information */ -if (H5EA__hdr_incr(hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") -dblk_page->hdr = hdr; + /* Share common array information */ + if (H5EA__hdr_incr(hdr) < 0) + H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + dblk_page->hdr = hdr; -/* Set non-zero internal fields */ -dblk_page->parent = parent; + /* Set non-zero internal fields */ + dblk_page->parent = parent; -/* Allocate buffer for elements in data block page */ -if (NULL == (dblk_page->elmts = H5EA__hdr_alloc_elmts(hdr, hdr->dblk_page_nelmts))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block page element buffer") + /* Allocate buffer for elements in data block page */ + if (NULL == (dblk_page->elmts = H5EA__hdr_alloc_elmts(hdr, hdr->dblk_page_nelmts))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block page element buffer") -/* Set the return value */ -ret_value = dblk_page; + /* Set the return value */ + ret_value = dblk_page; -CATCH -if (!ret_value) - if (dblk_page && H5EA__dblk_page_dest(dblk_page) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page") + CATCH + if (!ret_value) + if (dblk_page && H5EA__dblk_page_dest(dblk_page) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page") END_FUNC(PKG) /* end H5EA__dblk_page_alloc() */ @@ -134,50 +134,50 @@ END_FUNC(PKG) /* end H5EA__dblk_page_alloc() */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblk_page_create(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t addr)) -/* Local variables */ -H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */ -hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ - -/* Sanity check */ -HDassert(hdr); - -/* Allocate the data block page */ -if (NULL == (dblk_page = H5EA__dblk_page_alloc(hdr, parent))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page") - -/* Set info about data block page on disk */ -dblk_page->addr = addr; -dblk_page->size = H5EA_DBLK_PAGE_SIZE(hdr); - -/* Clear any elements in data block page to fill value */ -if ((hdr->cparam.cls->fill)(dblk_page->elmts, (size_t)hdr->dblk_page_nelmts) < 0) - H5E_THROW(H5E_CANTSET, "can't set extensible array data block page elements to class's fill value") - -/* Cache the new extensible array data block page */ -if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block page to cache") -inserted = TRUE; - -/* Add data block page as child of 'top' proxy */ -if (hdr->top_proxy) { - if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") - dblk_page->top_proxy = hdr->top_proxy; -} /* end if */ - -CATCH -if (ret_value < 0) - if (dblk_page) { - /* Remove from cache, if inserted */ - if (inserted) - if (H5AC_remove_entry(dblk_page) < 0) - H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array data block page from cache") - - /* Destroy data block page */ - if (H5EA__dblk_page_dest(dblk_page) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page") + /* Local variables */ + H5EA_dblk_page_t *dblk_page = NULL; /* Extensible array data block page */ + hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + + /* Sanity check */ + HDassert(hdr); + + /* Allocate the data block page */ + if (NULL == (dblk_page = H5EA__dblk_page_alloc(hdr, parent))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block page") + + /* Set info about data block page on disk */ + dblk_page->addr = addr; + dblk_page->size = H5EA_DBLK_PAGE_SIZE(hdr); + + /* Clear any elements in data block page to fill value */ + if ((hdr->cparam.cls->fill)(dblk_page->elmts, (size_t)hdr->dblk_page_nelmts) < 0) + H5E_THROW(H5E_CANTSET, "can't set extensible array data block page elements to class's fill value") + + /* Cache the new extensible array data block page */ + if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block page to cache") + inserted = TRUE; + + /* Add data block page as child of 'top' proxy */ + if (hdr->top_proxy) { + if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0) + H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + dblk_page->top_proxy = hdr->top_proxy; } /* end if */ + CATCH + if (ret_value < 0) + if (dblk_page) { + /* Remove from cache, if inserted */ + if (inserted) + if (H5AC_remove_entry(dblk_page) < 0) + H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array data block page from cache") + + /* Destroy data block page */ + if (H5EA__dblk_page_dest(dblk_page) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block page") + } /* end if */ + END_FUNC(PKG) /* end H5EA__dblk_page_create() */ /*------------------------------------------------------------------------- @@ -197,48 +197,49 @@ BEGIN_FUNC(PKG, ERR, H5EA_dblk_page_t *, NULL, NULL, H5EA__dblk_page_protect(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t dblk_page_addr, unsigned flags)) -/* Local variables */ -H5EA_dblk_page_t * dblk_page = NULL; /* Extensible array data block page */ -H5EA_dblk_page_cache_ud_t udata; /* Information needed for loading data block page */ - -/* Sanity check */ -HDassert(hdr); -HDassert(H5F_addr_defined(dblk_page_addr)); - -/* only the H5AC__READ_ONLY_FLAG may be set */ -HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); - -/* Set up user data */ -udata.hdr = hdr; -udata.parent = parent; -udata.dblk_page_addr = dblk_page_addr; - -/* Protect the data block page */ -if (NULL == (dblk_page = (H5EA_dblk_page_t *)H5AC_protect(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr, - &udata, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block page, address = %llu", - (unsigned long long)dblk_page_addr) + /* Local variables */ + H5EA_dblk_page_t * dblk_page = NULL; /* Extensible array data block page */ + H5EA_dblk_page_cache_ud_t udata; /* Information needed for loading data block page */ + + /* Sanity check */ + HDassert(hdr); + HDassert(H5F_addr_defined(dblk_page_addr)); + + /* only the H5AC__READ_ONLY_FLAG may be set */ + HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + + /* Set up user data */ + udata.hdr = hdr; + udata.parent = parent; + udata.dblk_page_addr = dblk_page_addr; + + /* Protect the data block page */ + if (NULL == (dblk_page = (H5EA_dblk_page_t *)H5AC_protect(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr, + &udata, flags))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block page, address = %llu", + (unsigned long long)dblk_page_addr) + + /* Create top proxy, if it doesn't exist */ + if (hdr->top_proxy && NULL == dblk_page->top_proxy) { + /* Add data block page as child of 'top' proxy */ + if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0) + H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + dblk_page->top_proxy = hdr->top_proxy; + } /* end if */ -/* Create top proxy, if it doesn't exist */ -if (hdr->top_proxy && NULL == dblk_page->top_proxy) { - /* Add data block page as child of 'top' proxy */ - if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") - dblk_page->top_proxy = hdr->top_proxy; -} /* end if */ - -/* Set return value */ -ret_value = dblk_page; - -CATCH -/* Clean up on error */ -if (!ret_value) { - /* Release the data block page, if it was protected */ - if (dblk_page && - H5AC_unprotect(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block page, address = %llu", - (unsigned long long)dblk_page->addr) -} /* end if */ + /* Set return value */ + ret_value = dblk_page; + + CATCH + /* Clean up on error */ + if (!ret_value) { + /* Release the data block page, if it was protected */ + if (dblk_page && + H5AC_unprotect(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, + "unable to unprotect extensible array data block page, address = %llu", + (unsigned long long)dblk_page->addr) + } /* end if */ END_FUNC(PKG) /* end H5EA__dblk_page_protect() */ @@ -258,17 +259,17 @@ END_FUNC(PKG) /* end H5EA__dblk_page_protect() */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblk_page_unprotect(H5EA_dblk_page_t *dblk_page, unsigned cache_flags)) -/* Local variables */ + /* Local variables */ -/* Sanity check */ -HDassert(dblk_page); + /* Sanity check */ + HDassert(dblk_page); -/* Unprotect the data block page */ -if (H5AC_unprotect(dblk_page->hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block page, address = %llu", - (unsigned long long)dblk_page->addr) + /* Unprotect the data block page */ + if (H5AC_unprotect(dblk_page->hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block page, address = %llu", + (unsigned long long)dblk_page->addr) -CATCH + CATCH END_FUNC(PKG) /* end H5EA__dblk_page_unprotect() */ @@ -286,32 +287,32 @@ END_FUNC(PKG) /* end H5EA__dblk_page_unprotect() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblk_page_dest(H5EA_dblk_page_t *dblk_page)) -/* Sanity check */ -HDassert(dblk_page); -HDassert(!dblk_page->has_hdr_depend); - -/* Check if header field has been initialized */ -if (dblk_page->hdr) { - /* Check if buffer for data block page elements has been initialized */ - if (dblk_page->elmts) { - /* Free buffer for data block page elements */ - if (H5EA__hdr_free_elmts(dblk_page->hdr, dblk_page->hdr->dblk_page_nelmts, dblk_page->elmts) < 0) - H5E_THROW(H5E_CANTFREE, "unable to free extensible array data block element buffer") - dblk_page->elmts = NULL; + /* Sanity check */ + HDassert(dblk_page); + HDassert(!dblk_page->has_hdr_depend); + + /* Check if header field has been initialized */ + if (dblk_page->hdr) { + /* Check if buffer for data block page elements has been initialized */ + if (dblk_page->elmts) { + /* Free buffer for data block page elements */ + if (H5EA__hdr_free_elmts(dblk_page->hdr, dblk_page->hdr->dblk_page_nelmts, dblk_page->elmts) < 0) + H5E_THROW(H5E_CANTFREE, "unable to free extensible array data block element buffer") + dblk_page->elmts = NULL; + } /* end if */ + + /* Decrement reference count on shared info */ + if (H5EA__hdr_decr(dblk_page->hdr) < 0) + H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + dblk_page->hdr = NULL; } /* end if */ - /* Decrement reference count on shared info */ - if (H5EA__hdr_decr(dblk_page->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") - dblk_page->hdr = NULL; -} /* end if */ - -/* Sanity check */ -HDassert(NULL == dblk_page->top_proxy); + /* Sanity check */ + HDassert(NULL == dblk_page->top_proxy); -/* Free the data block page itself */ -dblk_page = H5FL_FREE(H5EA_dblk_page_t, dblk_page); + /* Free the data block page itself */ + dblk_page = H5FL_FREE(H5EA_dblk_page_t, dblk_page); -CATCH + CATCH END_FUNC(PKG) /* end H5EA__dblk_page_dest() */ diff --git a/src/H5EAdblock.c b/src/H5EAdblock.c index 2897aba..ddc4036 100644 --- a/src/H5EAdblock.c +++ b/src/H5EAdblock.c @@ -88,46 +88,46 @@ H5FL_DEFINE_STATIC(H5EA_dblock_t); BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL, H5EA__dblock_alloc(H5EA_hdr_t *hdr, void *parent, size_t nelmts)) -/* Local variables */ -H5EA_dblock_t *dblock = NULL; /* Extensible array data block */ - -/* Check arguments */ -HDassert(hdr); -HDassert(parent); -HDassert(nelmts > 0); - -/* Allocate memory for the data block */ -if (NULL == (dblock = H5FL_CALLOC(H5EA_dblock_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block") - -/* Share common array information */ -if (H5EA__hdr_incr(hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") -dblock->hdr = hdr; - -/* Set non-zero internal fields */ -dblock->parent = parent; -dblock->nelmts = nelmts; - -/* Check if the data block is not going to be paged */ -if (nelmts > hdr->dblk_page_nelmts) { - /* Set the # of pages in the direct block */ - dblock->npages = nelmts / hdr->dblk_page_nelmts; - HDassert(nelmts == (dblock->npages * hdr->dblk_page_nelmts)); -} /* end if */ -else { - /* Allocate buffer for elements in data block */ - if (NULL == (dblock->elmts = H5EA__hdr_alloc_elmts(hdr, nelmts))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block element buffer") -} /* end else */ - -/* Set the return value */ -ret_value = dblock; - -CATCH -if (!ret_value) - if (dblock && H5EA__dblock_dest(dblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block") + /* Local variables */ + H5EA_dblock_t *dblock = NULL; /* Extensible array data block */ + + /* Check arguments */ + HDassert(hdr); + HDassert(parent); + HDassert(nelmts > 0); + + /* Allocate memory for the data block */ + if (NULL == (dblock = H5FL_CALLOC(H5EA_dblock_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block") + + /* Share common array information */ + if (H5EA__hdr_incr(hdr) < 0) + H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + dblock->hdr = hdr; + + /* Set non-zero internal fields */ + dblock->parent = parent; + dblock->nelmts = nelmts; + + /* Check if the data block is not going to be paged */ + if (nelmts > hdr->dblk_page_nelmts) { + /* Set the # of pages in the direct block */ + dblock->npages = nelmts / hdr->dblk_page_nelmts; + HDassert(nelmts == (dblock->npages * hdr->dblk_page_nelmts)); + } /* end if */ + else { + /* Allocate buffer for elements in data block */ + if (NULL == (dblock->elmts = H5EA__hdr_alloc_elmts(hdr, nelmts))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block element buffer") + } /* end else */ + + /* Set the return value */ + ret_value = dblock; + + CATCH + if (!ret_value) + if (dblock && H5EA__dblock_dest(dblock) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block") END_FUNC(PKG) /* end H5EA__dblock_alloc() */ @@ -147,80 +147,80 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, H5EA__dblock_create(H5EA_hdr_t *hdr, void *parent, hbool_t *stats_changed, hsize_t dblk_off, size_t nelmts)) -/* Local variables */ -H5EA_dblock_t *dblock = NULL; /* Extensible array data block */ -haddr_t dblock_addr; /* Extensible array data block address */ -hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ - -/* Sanity check */ -HDassert(hdr); -HDassert(stats_changed); -HDassert(nelmts > 0); - -/* Allocate the data block */ -if (NULL == (dblock = H5EA__dblock_alloc(hdr, parent, nelmts))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block") - -/* Set size of data block on disk */ -dblock->size = H5EA_DBLOCK_SIZE(dblock); - -/* Set offset of block in array's address space */ -dblock->block_off = dblk_off; - -/* Allocate space for the data block on disk */ -if (HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_DBLOCK, (hsize_t)dblock->size))) - H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array data block") -dblock->addr = dblock_addr; - -/* Don't initialize elements if paged */ -if (!dblock->npages) - /* Clear any elements in data block to fill value */ - if ((hdr->cparam.cls->fill)(dblock->elmts, (size_t)dblock->nelmts) < 0) - H5E_THROW(H5E_CANTSET, "can't set extensible array data block elements to class's fill value") - -/* Cache the new extensible array data block */ -if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block to cache") -inserted = TRUE; - -/* Add data block as child of 'top' proxy */ -if (hdr->top_proxy) { - if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") - dblock->top_proxy = hdr->top_proxy; -} /* end if */ - -/* Update extensible array data block statistics */ -hdr->stats.stored.ndata_blks++; -hdr->stats.stored.data_blk_size += dblock->size; - -/* Increment count of elements "realized" */ -hdr->stats.stored.nelmts += nelmts; - -/* Mark the statistics as changed */ -*stats_changed = TRUE; - -/* Set address of data block to return */ -ret_value = dblock_addr; - -CATCH -if (!H5F_addr_defined(ret_value)) - if (dblock) { - /* Remove from cache, if inserted */ - if (inserted) - if (H5AC_remove_entry(dblock) < 0) - H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array data block from cache") - - /* Release data block's disk space */ - if (H5F_addr_defined(dblock->addr) && - H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_DBLOCK, dblock->addr, (hsize_t)dblock->size) < 0) - H5E_THROW(H5E_CANTFREE, "unable to release extensible array data block") - - /* Destroy data block */ - if (H5EA__dblock_dest(dblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block") + /* Local variables */ + H5EA_dblock_t *dblock = NULL; /* Extensible array data block */ + haddr_t dblock_addr; /* Extensible array data block address */ + hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + + /* Sanity check */ + HDassert(hdr); + HDassert(stats_changed); + HDassert(nelmts > 0); + + /* Allocate the data block */ + if (NULL == (dblock = H5EA__dblock_alloc(hdr, parent, nelmts))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array data block") + + /* Set size of data block on disk */ + dblock->size = H5EA_DBLOCK_SIZE(dblock); + + /* Set offset of block in array's address space */ + dblock->block_off = dblk_off; + + /* Allocate space for the data block on disk */ + if (HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_DBLOCK, (hsize_t)dblock->size))) + H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array data block") + dblock->addr = dblock_addr; + + /* Don't initialize elements if paged */ + if (!dblock->npages) + /* Clear any elements in data block to fill value */ + if ((hdr->cparam.cls->fill)(dblock->elmts, (size_t)dblock->nelmts) < 0) + H5E_THROW(H5E_CANTSET, "can't set extensible array data block elements to class's fill value") + + /* Cache the new extensible array data block */ + if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTINSERT, "can't add extensible array data block to cache") + inserted = TRUE; + + /* Add data block as child of 'top' proxy */ + if (hdr->top_proxy) { + if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0) + H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + dblock->top_proxy = hdr->top_proxy; } /* end if */ + /* Update extensible array data block statistics */ + hdr->stats.stored.ndata_blks++; + hdr->stats.stored.data_blk_size += dblock->size; + + /* Increment count of elements "realized" */ + hdr->stats.stored.nelmts += nelmts; + + /* Mark the statistics as changed */ + *stats_changed = TRUE; + + /* Set address of data block to return */ + ret_value = dblock_addr; + + CATCH + if (!H5F_addr_defined(ret_value)) + if (dblock) { + /* Remove from cache, if inserted */ + if (inserted) + if (H5AC_remove_entry(dblock) < 0) + H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array data block from cache") + + /* Release data block's disk space */ + if (H5F_addr_defined(dblock->addr) && + H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_DBLOCK, dblock->addr, (hsize_t)dblock->size) < 0) + H5E_THROW(H5E_CANTFREE, "unable to release extensible array data block") + + /* Destroy data block */ + if (H5EA__dblock_dest(dblock) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array data block") + } /* end if */ + END_FUNC(PKG) /* end H5EA__dblock_create() */ /*------------------------------------------------------------------------- @@ -238,22 +238,22 @@ END_FUNC(PKG) /* end H5EA__dblock_create() */ */ BEGIN_FUNC(PKG, NOERR, unsigned, 0, -, H5EA__dblock_sblk_idx(const H5EA_hdr_t *hdr, hsize_t idx)) -/* Local variables */ -unsigned sblk_idx; /* Which superblock does this index fall in? */ + /* Local variables */ + unsigned sblk_idx; /* Which superblock does this index fall in? */ -/* Sanity check */ -HDassert(hdr); -HDassert(idx >= hdr->cparam.idx_blk_elmts); + /* Sanity check */ + HDassert(hdr); + HDassert(idx >= hdr->cparam.idx_blk_elmts); -/* Adjust index for elements in index block */ -idx -= hdr->cparam.idx_blk_elmts; + /* Adjust index for elements in index block */ + idx -= hdr->cparam.idx_blk_elmts; -/* Determine the superblock information for the index */ -H5_CHECK_OVERFLOW(idx, /*From:*/ hsize_t, /*To:*/ uint64_t); -sblk_idx = H5VM_log2_gen((uint64_t)((idx / hdr->cparam.data_blk_min_elmts) + 1)); + /* Determine the superblock information for the index */ + H5_CHECK_OVERFLOW(idx, /*From:*/ hsize_t, /*To:*/ uint64_t); + sblk_idx = H5VM_log2_gen((uint64_t)((idx / hdr->cparam.data_blk_min_elmts) + 1)); -/* Set return value */ -ret_value = sblk_idx; + /* Set return value */ + ret_value = sblk_idx; END_FUNC(PKG) /* end H5EA__dblock_sblk_idx() */ @@ -273,49 +273,51 @@ BEGIN_FUNC(PKG, ERR, H5EA_dblock_t *, NULL, NULL, H5EA__dblock_protect(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dblk_nelmts, unsigned flags)) -/* Local variables */ -H5EA_dblock_t * dblock; /* Extensible array data block */ -H5EA_dblock_cache_ud_t udata; /* Information needed for loading data block */ - -/* Sanity check */ -HDassert(hdr); -HDassert(H5F_addr_defined(dblk_addr)); -HDassert(dblk_nelmts); - -/* only the H5AC__READ_ONLY_FLAG may be set */ -HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); - -/* Set up user data */ -udata.hdr = hdr; -udata.parent = parent; -udata.nelmts = dblk_nelmts; -udata.dblk_addr = dblk_addr; - -/* Protect the data block */ -if (NULL == (dblock = (H5EA_dblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_DBLOCK, dblk_addr, &udata, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", - (unsigned long long)dblk_addr) - -/* Create top proxy, if it doesn't exist */ -if (hdr->top_proxy && NULL == dblock->top_proxy) { - /* Add data block as child of 'top' proxy */ - if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") - dblock->top_proxy = hdr->top_proxy; -} /* end if */ + /* Local variables */ + H5EA_dblock_t * dblock; /* Extensible array data block */ + H5EA_dblock_cache_ud_t udata; /* Information needed for loading data block */ + + /* Sanity check */ + HDassert(hdr); + HDassert(H5F_addr_defined(dblk_addr)); + HDassert(dblk_nelmts); + + /* only the H5AC__READ_ONLY_FLAG may be set */ + HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + + /* Set up user data */ + udata.hdr = hdr; + udata.parent = parent; + udata.nelmts = dblk_nelmts; + udata.dblk_addr = dblk_addr; + + /* Protect the data block */ + if (NULL == + (dblock = (H5EA_dblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_DBLOCK, dblk_addr, &udata, flags))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", + (unsigned long long)dblk_addr) + + /* Create top proxy, if it doesn't exist */ + if (hdr->top_proxy && NULL == dblock->top_proxy) { + /* Add data block as child of 'top' proxy */ + if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0) + H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + dblock->top_proxy = hdr->top_proxy; + } /* end if */ -/* Set return value */ -ret_value = dblock; + /* Set return value */ + ret_value = dblock; -CATCH + CATCH -/* Clean up on error */ -if (!ret_value) { - /* Release the data block, if it was protected */ - if (dblock && H5AC_unprotect(hdr->f, H5AC_EARRAY_DBLOCK, dblock->addr, dblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block, address = %llu", - (unsigned long long)dblock->addr) -} /* end if */ + /* Clean up on error */ + if (!ret_value) { + /* Release the data block, if it was protected */ + if (dblock && + H5AC_unprotect(hdr->f, H5AC_EARRAY_DBLOCK, dblock->addr, dblock, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block, address = %llu", + (unsigned long long)dblock->addr) + } /* end if */ END_FUNC(PKG) /* end H5EA__dblock_protect() */ @@ -334,17 +336,17 @@ END_FUNC(PKG) /* end H5EA__dblock_protect() */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblock_unprotect(H5EA_dblock_t *dblock, unsigned cache_flags)) -/* Local variables */ + /* Local variables */ -/* Sanity check */ -HDassert(dblock); + /* Sanity check */ + HDassert(dblock); -/* Unprotect the data block */ -if (H5AC_unprotect(dblock->hdr->f, H5AC_EARRAY_DBLOCK, dblock->addr, dblock, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block, address = %llu", - (unsigned long long)dblock->addr) + /* Unprotect the data block */ + if (H5AC_unprotect(dblock->hdr->f, H5AC_EARRAY_DBLOCK, dblock->addr, dblock, cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array data block, address = %llu", + (unsigned long long)dblock->addr) -CATCH + CATCH END_FUNC(PKG) /* end H5EA__dblock_unprotect() */ @@ -363,48 +365,48 @@ END_FUNC(PKG) /* end H5EA__dblock_unprotect() */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblock_delete(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dblk_nelmts)) -/* Local variables */ -H5EA_dblock_t *dblock = NULL; /* Pointer to data block */ - -/* Sanity check */ -HDassert(hdr); -HDassert(parent); -HDassert(H5F_addr_defined(dblk_addr)); -HDassert(dblk_nelmts > 0); - -/* Protect data block */ -if (NULL == (dblock = H5EA__dblock_protect(hdr, parent, dblk_addr, dblk_nelmts, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", - (unsigned long long)dblk_addr) - -/* Check if this is a paged data block */ -if (dblk_nelmts > hdr->dblk_page_nelmts) { - size_t npages = dblk_nelmts / hdr->dblk_page_nelmts; /* Number of pages in data block */ - haddr_t dblk_page_addr; /* Address of each data block page */ - size_t dblk_page_size; /* Size of each data block page */ - size_t u; /* Local index variable */ - - /* Set up initial state */ - dblk_page_addr = dblk_addr + H5EA_DBLOCK_PREFIX_SIZE(dblock); - dblk_page_size = (hdr->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5EA_SIZEOF_CHKSUM; - - /* Iterate over pages in data block */ - for (u = 0; u < npages; u++) { - /* Evict the data block page from the metadata cache */ - /* (OK to call if it doesn't exist in the cache) */ - if (H5AC_expunge_entry(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTEXPUNGE, "unable to remove array data block page from metadata cache") - - /* Advance to next page address */ - dblk_page_addr += dblk_page_size; - } /* end for */ -} /* end if */ - -CATCH -/* Finished deleting data block in metadata cache */ -if (dblock && - H5EA__dblock_unprotect(dblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block") + /* Local variables */ + H5EA_dblock_t *dblock = NULL; /* Pointer to data block */ + + /* Sanity check */ + HDassert(hdr); + HDassert(parent); + HDassert(H5F_addr_defined(dblk_addr)); + HDassert(dblk_nelmts > 0); + + /* Protect data block */ + if (NULL == (dblock = H5EA__dblock_protect(hdr, parent, dblk_addr, dblk_nelmts, H5AC__NO_FLAGS_SET))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", + (unsigned long long)dblk_addr) + + /* Check if this is a paged data block */ + if (dblk_nelmts > hdr->dblk_page_nelmts) { + size_t npages = dblk_nelmts / hdr->dblk_page_nelmts; /* Number of pages in data block */ + haddr_t dblk_page_addr; /* Address of each data block page */ + size_t dblk_page_size; /* Size of each data block page */ + size_t u; /* Local index variable */ + + /* Set up initial state */ + dblk_page_addr = dblk_addr + H5EA_DBLOCK_PREFIX_SIZE(dblock); + dblk_page_size = (hdr->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5EA_SIZEOF_CHKSUM; + + /* Iterate over pages in data block */ + for (u = 0; u < npages; u++) { + /* Evict the data block page from the metadata cache */ + /* (OK to call if it doesn't exist in the cache) */ + if (H5AC_expunge_entry(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTEXPUNGE, "unable to remove array data block page from metadata cache") + + /* Advance to next page address */ + dblk_page_addr += dblk_page_size; + } /* end for */ + } /* end if */ + + CATCH + /* Finished deleting data block in metadata cache */ + if (dblock && H5EA__dblock_unprotect(dblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | + H5AC__FREE_FILE_SPACE_FLAG) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block") END_FUNC(PKG) /* end H5EA__dblock_delete() */ @@ -422,34 +424,34 @@ END_FUNC(PKG) /* end H5EA__dblock_delete() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__dblock_dest(H5EA_dblock_t *dblock)) -/* Sanity check */ -HDassert(dblock); -HDassert(!dblock->has_hdr_depend); - -/* Check if shared header field has been initialized */ -if (dblock->hdr) { - /* Check if we've got elements in the data block */ - if (dblock->elmts && !dblock->npages) { - /* Free buffer for data block elements */ - HDassert(dblock->nelmts > 0); - if (H5EA__hdr_free_elmts(dblock->hdr, dblock->nelmts, dblock->elmts) < 0) - H5E_THROW(H5E_CANTFREE, "unable to free extensible array data block element buffer") - dblock->elmts = NULL; - dblock->nelmts = 0; + /* Sanity check */ + HDassert(dblock); + HDassert(!dblock->has_hdr_depend); + + /* Check if shared header field has been initialized */ + if (dblock->hdr) { + /* Check if we've got elements in the data block */ + if (dblock->elmts && !dblock->npages) { + /* Free buffer for data block elements */ + HDassert(dblock->nelmts > 0); + if (H5EA__hdr_free_elmts(dblock->hdr, dblock->nelmts, dblock->elmts) < 0) + H5E_THROW(H5E_CANTFREE, "unable to free extensible array data block element buffer") + dblock->elmts = NULL; + dblock->nelmts = 0; + } /* end if */ + + /* Decrement reference count on shared info */ + if (H5EA__hdr_decr(dblock->hdr) < 0) + H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + dblock->hdr = NULL; } /* end if */ - /* Decrement reference count on shared info */ - if (H5EA__hdr_decr(dblock->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") - dblock->hdr = NULL; -} /* end if */ - -/* Sanity check */ -HDassert(NULL == dblock->top_proxy); + /* Sanity check */ + HDassert(NULL == dblock->top_proxy); -/* Free the data block itself */ -dblock = H5FL_FREE(H5EA_dblock_t, dblock); + /* Free the data block itself */ + dblock = H5FL_FREE(H5EA_dblock_t, dblock); -CATCH + CATCH END_FUNC(PKG) /* end H5EA__dblock_dest() */ diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index 1a7839f..236811f 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -104,32 +104,32 @@ H5FL_SEQ_DEFINE_STATIC(H5EA_sblk_info_t); */ BEGIN_FUNC(PKG, ERR, H5EA_hdr_t *, NULL, NULL, H5EA__hdr_alloc(H5F_t *f)) -/* Local variables */ -H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */ + /* Local variables */ + H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */ -/* Check arguments */ -HDassert(f); + /* Check arguments */ + HDassert(f); -/* Allocate space for the shared information */ -if (NULL == (hdr = H5FL_CALLOC(H5EA_hdr_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header") + /* Allocate space for the shared information */ + if (NULL == (hdr = H5FL_CALLOC(H5EA_hdr_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header") -/* Set non-zero internal fields */ -hdr->addr = HADDR_UNDEF; + /* Set non-zero internal fields */ + hdr->addr = HADDR_UNDEF; -/* Set the internal parameters for the array */ -hdr->f = f; -hdr->swmr_write = (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) > 0; -hdr->sizeof_addr = H5F_SIZEOF_ADDR(f); -hdr->sizeof_size = H5F_SIZEOF_SIZE(f); + /* Set the internal parameters for the array */ + hdr->f = f; + hdr->swmr_write = (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) > 0; + hdr->sizeof_addr = H5F_SIZEOF_ADDR(f); + hdr->sizeof_size = H5F_SIZEOF_SIZE(f); -/* Set the return value */ -ret_value = hdr; + /* Set the return value */ + ret_value = hdr; -CATCH -if (!ret_value) - if (hdr && H5EA__hdr_dest(hdr) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header") + CATCH + if (!ret_value) + if (hdr && H5EA__hdr_dest(hdr) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header") END_FUNC(PKG) /* end H5EA__hdr_alloc() */ @@ -170,50 +170,50 @@ END_FUNC(PKG) /* end H5EA__hdr_alloc() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata)) -/* Local variables */ -hsize_t start_idx; /* First element index for each super block */ -hsize_t start_dblk; /* First data block index for each super block */ -size_t u; /* Local index variable */ - -/* Sanity check */ -HDassert(hdr); -HDassert(hdr->cparam.max_nelmts_bits); -HDassert(hdr->cparam.data_blk_min_elmts); -HDassert(hdr->cparam.sup_blk_min_data_ptrs); - -/* Compute general information */ -hdr->nsblks = 1 + (hdr->cparam.max_nelmts_bits - H5VM_log2_of2(hdr->cparam.data_blk_min_elmts)); -hdr->dblk_page_nelmts = (size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits; -hdr->arr_off_size = (unsigned char)H5EA_SIZEOF_OFFSET_BITS(hdr->cparam.max_nelmts_bits); - -/* Allocate information for each super block */ -if (NULL == (hdr->sblk_info = H5FL_SEQ_MALLOC(H5EA_sblk_info_t, hdr->nsblks))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block info array") - -/* Compute information about each super block */ -start_idx = 0; -start_dblk = 0; -for (u = 0; u < hdr->nsblks; u++) { - hdr->sblk_info[u].ndblks = (size_t)H5_EXP2(u / 2); - hdr->sblk_info[u].dblk_nelmts = H5EA_SBLK_DBLK_NELMTS(u, hdr->cparam.data_blk_min_elmts); - hdr->sblk_info[u].start_idx = start_idx; - hdr->sblk_info[u].start_dblk = start_dblk; - - /* Advance starting indices for next super block */ - start_idx += (hsize_t)hdr->sblk_info[u].ndblks * (hsize_t)hdr->sblk_info[u].dblk_nelmts; - start_dblk += (hsize_t)hdr->sblk_info[u].ndblks; -} /* end for */ - -/* Set size of header on disk (locally and in statistics) */ -hdr->stats.computed.hdr_size = hdr->size = H5EA_HEADER_SIZE_HDR(hdr); - -/* Create the callback context, if there's one */ -if (hdr->cparam.cls->crt_context) { - if (NULL == (hdr->cb_ctx = (*hdr->cparam.cls->crt_context)(ctx_udata))) - H5E_THROW(H5E_CANTCREATE, "unable to create extensible array client callback context") -} /* end if */ - -CATCH + /* Local variables */ + hsize_t start_idx; /* First element index for each super block */ + hsize_t start_dblk; /* First data block index for each super block */ + size_t u; /* Local index variable */ + + /* Sanity check */ + HDassert(hdr); + HDassert(hdr->cparam.max_nelmts_bits); + HDassert(hdr->cparam.data_blk_min_elmts); + HDassert(hdr->cparam.sup_blk_min_data_ptrs); + + /* Compute general information */ + hdr->nsblks = 1 + (hdr->cparam.max_nelmts_bits - H5VM_log2_of2(hdr->cparam.data_blk_min_elmts)); + hdr->dblk_page_nelmts = (size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits; + hdr->arr_off_size = (unsigned char)H5EA_SIZEOF_OFFSET_BITS(hdr->cparam.max_nelmts_bits); + + /* Allocate information for each super block */ + if (NULL == (hdr->sblk_info = H5FL_SEQ_MALLOC(H5EA_sblk_info_t, hdr->nsblks))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block info array") + + /* Compute information about each super block */ + start_idx = 0; + start_dblk = 0; + for (u = 0; u < hdr->nsblks; u++) { + hdr->sblk_info[u].ndblks = (size_t)H5_EXP2(u / 2); + hdr->sblk_info[u].dblk_nelmts = H5EA_SBLK_DBLK_NELMTS(u, hdr->cparam.data_blk_min_elmts); + hdr->sblk_info[u].start_idx = start_idx; + hdr->sblk_info[u].start_dblk = start_dblk; + + /* Advance starting indices for next super block */ + start_idx += (hsize_t)hdr->sblk_info[u].ndblks * (hsize_t)hdr->sblk_info[u].dblk_nelmts; + start_dblk += (hsize_t)hdr->sblk_info[u].ndblks; + } /* end for */ + + /* Set size of header on disk (locally and in statistics) */ + hdr->stats.computed.hdr_size = hdr->size = H5EA_HEADER_SIZE_HDR(hdr); + + /* Create the callback context, if there's one */ + if (hdr->cparam.cls->crt_context) { + if (NULL == (hdr->cb_ctx = (*hdr->cparam.cls->crt_context)(ctx_udata))) + H5E_THROW(H5E_CANTCREATE, "unable to create extensible array client callback context") + } /* end if */ + + CATCH END_FUNC(PKG) /* end H5EA__hdr_init() */ @@ -231,54 +231,55 @@ END_FUNC(PKG) /* end H5EA__hdr_init() */ */ BEGIN_FUNC(PKG, ERR, void *, NULL, NULL, H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts)) -/* Local variables */ -void * elmts = NULL; /* Element buffer allocated */ -unsigned idx; /* Index of element buffer factory in header */ + /* Local variables */ + void * elmts = NULL; /* Element buffer allocated */ + unsigned idx; /* Index of element buffer factory in header */ -/* Check arguments */ -HDassert(hdr); -HDassert(nelmts > 0); + /* Check arguments */ + HDassert(hdr); + HDassert(nelmts > 0); -/* Compute the index of the element buffer factory */ -H5_CHECK_OVERFLOW(nelmts, /*From:*/ size_t, /*To:*/ uint32_t); -idx = H5VM_log2_of2((uint32_t)nelmts) - H5VM_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts); + /* Compute the index of the element buffer factory */ + H5_CHECK_OVERFLOW(nelmts, /*From:*/ size_t, /*To:*/ uint32_t); + idx = H5VM_log2_of2((uint32_t)nelmts) - H5VM_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts); -/* Check for needing to increase size of array of factories */ -if (idx >= hdr->elmt_fac.nalloc) { - H5FL_fac_head_t **new_fac; /* New array of element factories */ - size_t new_nalloc = - MAX3(1, (idx + 1), (2 * hdr->elmt_fac.nalloc)); /* New number of factories allocated */ + /* Check for needing to increase size of array of factories */ + if (idx >= hdr->elmt_fac.nalloc) { + H5FL_fac_head_t **new_fac; /* New array of element factories */ + size_t new_nalloc = + MAX3(1, (idx + 1), (2 * hdr->elmt_fac.nalloc)); /* New number of factories allocated */ - /* Re-allocate array of element factories */ - if (NULL == (new_fac = H5FL_SEQ_REALLOC(H5FL_fac_head_ptr_t, hdr->elmt_fac.fac, new_nalloc))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block data element buffer factory array") + /* Re-allocate array of element factories */ + if (NULL == (new_fac = H5FL_SEQ_REALLOC(H5FL_fac_head_ptr_t, hdr->elmt_fac.fac, new_nalloc))) + H5E_THROW(H5E_CANTALLOC, + "memory allocation failed for data block data element buffer factory array") - /* Zero out new elements allocated */ - HDmemset(new_fac + hdr->elmt_fac.nalloc, 0, - (new_nalloc - hdr->elmt_fac.nalloc) * sizeof(H5FL_fac_head_ptr_t)); + /* Zero out new elements allocated */ + HDmemset(new_fac + hdr->elmt_fac.nalloc, 0, + (new_nalloc - hdr->elmt_fac.nalloc) * sizeof(H5FL_fac_head_ptr_t)); - /* Update information about element factories in header */ - hdr->elmt_fac.nalloc = new_nalloc; - hdr->elmt_fac.fac = new_fac; -} /* end if */ + /* Update information about element factories in header */ + hdr->elmt_fac.nalloc = new_nalloc; + hdr->elmt_fac.fac = new_fac; + } /* end if */ -/* Check for un-initialized factory at index */ -if (NULL == hdr->elmt_fac.fac[idx]) { - if (NULL == (hdr->elmt_fac.fac[idx] = H5FL_fac_init(nelmts * (size_t)hdr->cparam.cls->nat_elmt_size))) - H5E_THROW(H5E_CANTINIT, "can't create data block data element buffer factory") -} /* end if */ + /* Check for un-initialized factory at index */ + if (NULL == hdr->elmt_fac.fac[idx]) { + if (NULL == (hdr->elmt_fac.fac[idx] = H5FL_fac_init(nelmts * (size_t)hdr->cparam.cls->nat_elmt_size))) + H5E_THROW(H5E_CANTINIT, "can't create data block data element buffer factory") + } /* end if */ -/* Allocate buffer for elements in index block */ -if (NULL == (elmts = H5FL_FAC_MALLOC(hdr->elmt_fac.fac[idx]))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block data element buffer") + /* Allocate buffer for elements in index block */ + if (NULL == (elmts = H5FL_FAC_MALLOC(hdr->elmt_fac.fac[idx]))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block data element buffer") -/* Set the return value */ -ret_value = elmts; + /* Set the return value */ + ret_value = elmts; -CATCH -if (!ret_value) - if (elmts) - elmts = H5FL_FAC_FREE(hdr->elmt_fac.fac[idx], elmts); + CATCH + if (!ret_value) + if (elmts) + elmts = H5FL_FAC_FREE(hdr->elmt_fac.fac[idx], elmts); END_FUNC(PKG) /* end H5EA__hdr_alloc_elmts() */ @@ -296,22 +297,22 @@ END_FUNC(PKG) /* end H5EA__hdr_alloc_elmts() */ */ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts)) -/* Local variables */ -unsigned idx; /* Index of element buffer factory in header */ + /* Local variables */ + unsigned idx; /* Index of element buffer factory in header */ -/* Check arguments */ -HDassert(hdr); -HDassert(nelmts > 0); -HDassert(elmts); + /* Check arguments */ + HDassert(hdr); + HDassert(nelmts > 0); + HDassert(elmts); -/* Compute the index of the element buffer factory */ -H5_CHECK_OVERFLOW(nelmts, /*From:*/ size_t, /*To:*/ uint32_t); -idx = H5VM_log2_of2((uint32_t)nelmts) - H5VM_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts); + /* Compute the index of the element buffer factory */ + H5_CHECK_OVERFLOW(nelmts, /*From:*/ size_t, /*To:*/ uint32_t); + idx = H5VM_log2_of2((uint32_t)nelmts) - H5VM_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts); -/* Free buffer for elements in index block */ -HDassert(idx < hdr->elmt_fac.nalloc); -HDassert(hdr->elmt_fac.fac[idx]); -elmts = H5FL_FAC_FREE(hdr->elmt_fac.fac[idx], elmts); + /* Free buffer for elements in index block */ + HDassert(idx < hdr->elmt_fac.nalloc); + HDassert(hdr->elmt_fac.fac[idx]); + elmts = H5FL_FAC_FREE(hdr->elmt_fac.fac[idx], elmts); END_FUNC(PKG) /* end H5EA__hdr_free_elmts() */ @@ -330,104 +331,105 @@ END_FUNC(PKG) /* end H5EA__hdr_free_elmts() */ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata)) -/* Local variables */ -H5EA_hdr_t *hdr = NULL; /* Extensible array header */ -hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + /* Local variables */ + H5EA_hdr_t *hdr = NULL; /* Extensible array header */ + hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ -/* Check arguments */ -HDassert(f); -HDassert(cparam); + /* Check arguments */ + HDassert(f); + HDassert(cparam); #ifndef NDEBUG -{ - unsigned sblk_idx; /* Super block index for first "actual" super block */ - size_t dblk_nelmts; /* Number of data block elements */ - size_t dblk_page_nelmts; /* Number of elements in a data block page */ - - /* Check for valid parameters */ - if (cparam->raw_elmt_size == 0) - H5E_THROW(H5E_BADVALUE, "element size must be greater than zero") - if (cparam->max_nelmts_bits == 0) - H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be greater than zero") - if (cparam->max_nelmts_bits > H5EA_MAX_NELMTS_IDX_MAX) - H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be <= %u", (unsigned)H5EA_MAX_NELMTS_IDX_MAX) - if (cparam->sup_blk_min_data_ptrs < 2) - H5E_THROW(H5E_BADVALUE, "min # of data block pointers in super block must be >= two") - if (!POWER_OF_TWO(cparam->sup_blk_min_data_ptrs)) - H5E_THROW(H5E_BADVALUE, "min # of data block pointers in super block must be power of two") - if (!POWER_OF_TWO(cparam->data_blk_min_elmts)) - H5E_THROW(H5E_BADVALUE, "min # of elements per data block must be power of two") - dblk_page_nelmts = (size_t)1 << cparam->max_dblk_page_nelmts_bits; - if (dblk_page_nelmts < cparam->idx_blk_elmts) - H5E_THROW(H5E_BADVALUE, - "# of elements per data block page must be greater than # of elements in index block") - - /* Compute the number of elements in data blocks for first actual super block */ - sblk_idx = H5EA_SBLK_FIRST_IDX(cparam->sup_blk_min_data_ptrs); - dblk_nelmts = H5EA_SBLK_DBLK_NELMTS(sblk_idx, cparam->data_blk_min_elmts); - if (dblk_page_nelmts < dblk_nelmts) - H5E_THROW(H5E_BADVALUE, "max. # of elements per data block page bits must be > # of elements in " - "first data block from super block") - - if (cparam->max_dblk_page_nelmts_bits > cparam->max_nelmts_bits) - H5E_THROW(H5E_BADVALUE, - "max. # of elements per data block page bits must be <= max. # of elements bits") -} + { + unsigned sblk_idx; /* Super block index for first "actual" super block */ + size_t dblk_nelmts; /* Number of data block elements */ + size_t dblk_page_nelmts; /* Number of elements in a data block page */ + + /* Check for valid parameters */ + if (cparam->raw_elmt_size == 0) + H5E_THROW(H5E_BADVALUE, "element size must be greater than zero") + if (cparam->max_nelmts_bits == 0) + H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be greater than zero") + if (cparam->max_nelmts_bits > H5EA_MAX_NELMTS_IDX_MAX) + H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be <= %u", + (unsigned)H5EA_MAX_NELMTS_IDX_MAX) + if (cparam->sup_blk_min_data_ptrs < 2) + H5E_THROW(H5E_BADVALUE, "min # of data block pointers in super block must be >= two") + if (!POWER_OF_TWO(cparam->sup_blk_min_data_ptrs)) + H5E_THROW(H5E_BADVALUE, "min # of data block pointers in super block must be power of two") + if (!POWER_OF_TWO(cparam->data_blk_min_elmts)) + H5E_THROW(H5E_BADVALUE, "min # of elements per data block must be power of two") + dblk_page_nelmts = (size_t)1 << cparam->max_dblk_page_nelmts_bits; + if (dblk_page_nelmts < cparam->idx_blk_elmts) + H5E_THROW(H5E_BADVALUE, + "# of elements per data block page must be greater than # of elements in index block") + + /* Compute the number of elements in data blocks for first actual super block */ + sblk_idx = H5EA_SBLK_FIRST_IDX(cparam->sup_blk_min_data_ptrs); + dblk_nelmts = H5EA_SBLK_DBLK_NELMTS(sblk_idx, cparam->data_blk_min_elmts); + if (dblk_page_nelmts < dblk_nelmts) + H5E_THROW(H5E_BADVALUE, "max. # of elements per data block page bits must be > # of elements in " + "first data block from super block") + + if (cparam->max_dblk_page_nelmts_bits > cparam->max_nelmts_bits) + H5E_THROW(H5E_BADVALUE, + "max. # of elements per data block page bits must be <= max. # of elements bits") + } #endif /* NDEBUG */ -/* Allocate space for the shared information */ -if (NULL == (hdr = H5EA__hdr_alloc(f))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header") - -/* Set the internal parameters for the array */ -hdr->idx_blk_addr = HADDR_UNDEF; - -/* Set the creation parameters for the array */ -H5MM_memcpy(&hdr->cparam, cparam, sizeof(hdr->cparam)); - -/* Finish initializing extensible array header */ -if (H5EA__hdr_init(hdr, ctx_udata) < 0) - H5E_THROW(H5E_CANTINIT, "initialization failed for extensible array header") - -/* Allocate space for the header on disk */ -if (HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_EARRAY_HDR, (hsize_t)hdr->size))) - H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array header") - -/* Create 'top' proxy for extensible array entries */ -if (hdr->swmr_write) - if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) - H5E_THROW(H5E_CANTCREATE, "can't create extensible array entry proxy") - -/* Cache the new extensible array header */ -if (H5AC_insert_entry(f, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add extensible array header to cache") -inserted = TRUE; - -/* Add header as child of 'top' proxy */ -if (hdr->top_proxy) - if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") - -/* Set address of array header to return */ -ret_value = hdr->addr; - -CATCH -if (!H5F_addr_defined(ret_value)) - if (hdr) { - /* Remove from cache, if inserted */ - if (inserted) - if (H5AC_remove_entry(hdr) < 0) - H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array header from cache") - - /* Release header's disk space */ - if (H5F_addr_defined(hdr->addr) && - H5MF_xfree(f, H5FD_MEM_EARRAY_HDR, hdr->addr, (hsize_t)hdr->size) < 0) - H5E_THROW(H5E_CANTFREE, "unable to free extensible array header") - - /* Destroy header */ - if (H5EA__hdr_dest(hdr) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header") - } /* end if */ + /* Allocate space for the shared information */ + if (NULL == (hdr = H5EA__hdr_alloc(f))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array shared header") + + /* Set the internal parameters for the array */ + hdr->idx_blk_addr = HADDR_UNDEF; + + /* Set the creation parameters for the array */ + H5MM_memcpy(&hdr->cparam, cparam, sizeof(hdr->cparam)); + + /* Finish initializing extensible array header */ + if (H5EA__hdr_init(hdr, ctx_udata) < 0) + H5E_THROW(H5E_CANTINIT, "initialization failed for extensible array header") + + /* Allocate space for the header on disk */ + if (HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_EARRAY_HDR, (hsize_t)hdr->size))) + H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array header") + + /* Create 'top' proxy for extensible array entries */ + if (hdr->swmr_write) + if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) + H5E_THROW(H5E_CANTCREATE, "can't create extensible array entry proxy") + + /* Cache the new extensible array header */ + if (H5AC_insert_entry(f, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTINSERT, "can't add extensible array header to cache") + inserted = TRUE; + + /* Add header as child of 'top' proxy */ + if (hdr->top_proxy) + if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0) + H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + + /* Set address of array header to return */ + ret_value = hdr->addr; + + CATCH + if (!H5F_addr_defined(ret_value)) + if (hdr) { + /* Remove from cache, if inserted */ + if (inserted) + if (H5AC_remove_entry(hdr) < 0) + H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array header from cache") + + /* Release header's disk space */ + if (H5F_addr_defined(hdr->addr) && + H5MF_xfree(f, H5FD_MEM_EARRAY_HDR, hdr->addr, (hsize_t)hdr->size) < 0) + H5E_THROW(H5E_CANTFREE, "unable to free extensible array header") + + /* Destroy header */ + if (H5EA__hdr_dest(hdr) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array header") + } /* end if */ END_FUNC(PKG) /* end H5EA__hdr_create() */ @@ -445,18 +447,18 @@ END_FUNC(PKG) /* end H5EA__hdr_create() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_incr(H5EA_hdr_t *hdr)) -/* Sanity check */ -HDassert(hdr); + /* Sanity check */ + HDassert(hdr); -/* Mark header as un-evictable when something is depending on it */ -if (hdr->rc == 0) - if (H5AC_pin_protected_entry(hdr) < 0) - H5E_THROW(H5E_CANTPIN, "unable to pin extensible array header") + /* Mark header as un-evictable when something is depending on it */ + if (hdr->rc == 0) + if (H5AC_pin_protected_entry(hdr) < 0) + H5E_THROW(H5E_CANTPIN, "unable to pin extensible array header") -/* Increment reference count on shared header */ -hdr->rc++; + /* Increment reference count on shared header */ + hdr->rc++; -CATCH + CATCH END_FUNC(PKG) /* end H5EA__hdr_incr() */ @@ -474,21 +476,21 @@ END_FUNC(PKG) /* end H5EA__hdr_incr() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_decr(H5EA_hdr_t *hdr)) -/* Sanity check */ -HDassert(hdr); -HDassert(hdr->rc); + /* Sanity check */ + HDassert(hdr); + HDassert(hdr->rc); -/* Decrement reference count on shared header */ -hdr->rc--; + /* Decrement reference count on shared header */ + hdr->rc--; -/* Mark header as evictable again when nothing depend on it */ -if (hdr->rc == 0) { - HDassert(hdr->file_rc == 0); - if (H5AC_unpin_entry(hdr) < 0) - H5E_THROW(H5E_CANTUNPIN, "unable to unpin extensible array header") -} /* end if */ + /* Mark header as evictable again when nothing depend on it */ + if (hdr->rc == 0) { + HDassert(hdr->file_rc == 0); + if (H5AC_unpin_entry(hdr) < 0) + H5E_THROW(H5E_CANTUNPIN, "unable to unpin extensible array header") + } /* end if */ -CATCH + CATCH END_FUNC(PKG) /* end H5EA__hdr_decr() */ @@ -506,11 +508,11 @@ END_FUNC(PKG) /* end H5EA__hdr_decr() */ */ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr)) -/* Sanity check */ -HDassert(hdr); + /* Sanity check */ + HDassert(hdr); -/* Increment file reference count on shared header */ -hdr->file_rc++; + /* Increment file reference count on shared header */ + hdr->file_rc++; END_FUNC(PKG) /* end H5EA__hdr_fuse_incr() */ @@ -528,15 +530,15 @@ END_FUNC(PKG) /* end H5EA__hdr_fuse_incr() */ */ BEGIN_FUNC(PKG, NOERR, size_t, 0, -, H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr)) -/* Sanity check */ -HDassert(hdr); -HDassert(hdr->file_rc); + /* Sanity check */ + HDassert(hdr); + HDassert(hdr->file_rc); -/* Decrement file reference count on shared header */ -hdr->file_rc--; + /* Decrement file reference count on shared header */ + hdr->file_rc--; -/* Set return value */ -ret_value = hdr->file_rc; + /* Set return value */ + ret_value = hdr->file_rc; END_FUNC(PKG) /* end H5EA__hdr_fuse_decr() */ @@ -554,15 +556,15 @@ END_FUNC(PKG) /* end H5EA__hdr_fuse_decr() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_modified(H5EA_hdr_t *hdr)) -/* Sanity check */ -HDassert(hdr); -HDassert(hdr->f); + /* Sanity check */ + HDassert(hdr); + HDassert(hdr->f); -/* Mark header as dirty in cache */ -if (H5AC_mark_entry_dirty(hdr) < 0) - H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as dirty") + /* Mark header as dirty in cache */ + if (H5AC_mark_entry_dirty(hdr) < 0) + H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark extensible array header as dirty") -CATCH + CATCH END_FUNC(PKG) /* end H5EA__hdr_modified() */ @@ -581,43 +583,43 @@ END_FUNC(PKG) /* end H5EA__hdr_modified() */ BEGIN_FUNC(PKG, ERR, H5EA_hdr_t *, NULL, NULL, H5EA__hdr_protect(H5F_t *f, haddr_t ea_addr, void *ctx_udata, unsigned flags)) -/* Local variables */ -H5EA_hdr_t * hdr; /* Extensible array header */ -H5EA_hdr_cache_ud_t udata; /* User data for cache callbacks */ - -/* Sanity check */ -HDassert(f); -HDassert(H5F_addr_defined(ea_addr)); - -/* only the H5AC__READ_ONLY_FLAG may appear in flags */ -HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); - -/* Set up user data for cache callbacks */ -udata.f = f; -udata.addr = ea_addr; -udata.ctx_udata = ctx_udata; - -/* Protect the header */ -if (NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, H5AC_EARRAY_HDR, ea_addr, &udata, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu", - (unsigned long long)ea_addr) -hdr->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */ + /* Local variables */ + H5EA_hdr_t * hdr; /* Extensible array header */ + H5EA_hdr_cache_ud_t udata; /* User data for cache callbacks */ -/* Create top proxy, if it doesn't exist */ -if (hdr->swmr_write && NULL == hdr->top_proxy) { - /* Create 'top' proxy for extensible array entries */ - if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) - H5E_THROW(H5E_CANTCREATE, "can't create extensible array entry proxy") - - /* Add header as child of 'top' proxy */ - if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") -} /* end if */ + /* Sanity check */ + HDassert(f); + HDassert(H5F_addr_defined(ea_addr)); + + /* only the H5AC__READ_ONLY_FLAG may appear in flags */ + HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + + /* Set up user data for cache callbacks */ + udata.f = f; + udata.addr = ea_addr; + udata.ctx_udata = ctx_udata; + + /* Protect the header */ + if (NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, H5AC_EARRAY_HDR, ea_addr, &udata, flags))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array header, address = %llu", + (unsigned long long)ea_addr) + hdr->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */ + + /* Create top proxy, if it doesn't exist */ + if (hdr->swmr_write && NULL == hdr->top_proxy) { + /* Create 'top' proxy for extensible array entries */ + if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) + H5E_THROW(H5E_CANTCREATE, "can't create extensible array entry proxy") + + /* Add header as child of 'top' proxy */ + if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0) + H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + } /* end if */ -/* Set return value */ -ret_value = hdr; + /* Set return value */ + ret_value = hdr; -CATCH + CATCH END_FUNC(PKG) /* end H5EA__hdr_protect() */ @@ -635,17 +637,17 @@ END_FUNC(PKG) /* end H5EA__hdr_protect() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_unprotect(H5EA_hdr_t *hdr, unsigned cache_flags)) -/* Local variables */ + /* Local variables */ -/* Sanity check */ -HDassert(hdr); + /* Sanity check */ + HDassert(hdr); -/* Unprotect the header */ -if (H5AC_unprotect(hdr->f, H5AC_EARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array hdr, address = %llu", - (unsigned long long)hdr->addr) + /* Unprotect the header */ + if (H5AC_unprotect(hdr->f, H5AC_EARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array hdr, address = %llu", + (unsigned long long)hdr->addr) -CATCH + CATCH END_FUNC(PKG) /* end H5EA__hdr_unprotect() */ @@ -663,42 +665,42 @@ END_FUNC(PKG) /* end H5EA__hdr_unprotect() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_delete(H5EA_hdr_t *hdr)) -/* Local variables */ -unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting header */ + /* Local variables */ + unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting header */ -/* Sanity check */ -HDassert(hdr); -HDassert(!hdr->file_rc); + /* Sanity check */ + HDassert(hdr); + HDassert(!hdr->file_rc); #ifndef NDEBUG -{ - unsigned hdr_status = 0; /* Array header's status in the metadata cache */ + { + unsigned hdr_status = 0; /* Array header's status in the metadata cache */ - /* Check the array header's status in the metadata cache */ - if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0) - H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for array header") + /* Check the array header's status in the metadata cache */ + if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0) + H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for array header") - /* Sanity checks on array header */ - HDassert(hdr_status & H5AC_ES__IN_CACHE); - HDassert(hdr_status & H5AC_ES__IS_PROTECTED); -} /* end block */ + /* Sanity checks on array header */ + HDassert(hdr_status & H5AC_ES__IN_CACHE); + HDassert(hdr_status & H5AC_ES__IS_PROTECTED); + } /* end block */ #endif /* NDEBUG */ -/* Check for index block */ -if (H5F_addr_defined(hdr->idx_blk_addr)) { - /* Delete index block */ - if (H5EA__iblock_delete(hdr) < 0) - H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array index block") -} /* end if */ + /* Check for index block */ + if (H5F_addr_defined(hdr->idx_blk_addr)) { + /* Delete index block */ + if (H5EA__iblock_delete(hdr) < 0) + H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array index block") + } /* end if */ -/* Set flags to finish deleting header on unprotect */ -cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; + /* Set flags to finish deleting header on unprotect */ + cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; -CATCH + CATCH -/* Unprotect the header, deleting it if an error hasn't occurred */ -if (H5EA__hdr_unprotect(hdr, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + /* Unprotect the header, deleting it if an error hasn't occurred */ + if (H5EA__hdr_unprotect(hdr, cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") END_FUNC(PKG) /* end H5EA__hdr_delete() */ @@ -716,52 +718,52 @@ END_FUNC(PKG) /* end H5EA__hdr_delete() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__hdr_dest(H5EA_hdr_t *hdr)) -/* Check arguments */ -HDassert(hdr); -HDassert(hdr->rc == 0); + /* Check arguments */ + HDassert(hdr); + HDassert(hdr->rc == 0); -/* Destroy the callback context */ -if (hdr->cb_ctx) { - if ((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array client callback context") -} /* end if */ -hdr->cb_ctx = NULL; - -/* Check for data block element buffer factory info to free */ -if (hdr->elmt_fac.fac) { - unsigned u; /* Local index variable */ - - /* Sanity check */ - HDassert(hdr->elmt_fac.nalloc > 0); - - /* Iterate over factories, shutting them down */ - for (u = 0; u < hdr->elmt_fac.nalloc; u++) { - /* Check if this factory has been initialized */ - if (hdr->elmt_fac.fac[u]) { - if (H5FL_fac_term(hdr->elmt_fac.fac[u]) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array header factory") - hdr->elmt_fac.fac[u] = NULL; - } /* end if */ - } /* end for */ - - /* Free factory array */ - hdr->elmt_fac.fac = (H5FL_fac_head_t **)H5FL_SEQ_FREE(H5FL_fac_head_ptr_t, hdr->elmt_fac.fac); -} /* end if */ + /* Destroy the callback context */ + if (hdr->cb_ctx) { + if ((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0) + H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array client callback context") + } /* end if */ + hdr->cb_ctx = NULL; + + /* Check for data block element buffer factory info to free */ + if (hdr->elmt_fac.fac) { + unsigned u; /* Local index variable */ + + /* Sanity check */ + HDassert(hdr->elmt_fac.nalloc > 0); + + /* Iterate over factories, shutting them down */ + for (u = 0; u < hdr->elmt_fac.nalloc; u++) { + /* Check if this factory has been initialized */ + if (hdr->elmt_fac.fac[u]) { + if (H5FL_fac_term(hdr->elmt_fac.fac[u]) < 0) + H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array header factory") + hdr->elmt_fac.fac[u] = NULL; + } /* end if */ + } /* end for */ + + /* Free factory array */ + hdr->elmt_fac.fac = (H5FL_fac_head_t **)H5FL_SEQ_FREE(H5FL_fac_head_ptr_t, hdr->elmt_fac.fac); + } /* end if */ -/* Free the super block info array */ -if (hdr->sblk_info) - hdr->sblk_info = (H5EA_sblk_info_t *)H5FL_SEQ_FREE(H5EA_sblk_info_t, hdr->sblk_info); + /* Free the super block info array */ + if (hdr->sblk_info) + hdr->sblk_info = (H5EA_sblk_info_t *)H5FL_SEQ_FREE(H5EA_sblk_info_t, hdr->sblk_info); -/* Destroy the 'top' proxy */ -if (hdr->top_proxy) { - if (H5AC_proxy_entry_dest(hdr->top_proxy) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array 'top' proxy") - hdr->top_proxy = NULL; -} /* end if */ + /* Destroy the 'top' proxy */ + if (hdr->top_proxy) { + if (H5AC_proxy_entry_dest(hdr->top_proxy) < 0) + H5E_THROW(H5E_CANTRELEASE, "unable to destroy extensible array 'top' proxy") + hdr->top_proxy = NULL; + } /* end if */ -/* Free the shared info itself */ -hdr = H5FL_FREE(H5EA_hdr_t, hdr); + /* Free the shared info itself */ + hdr = H5FL_FREE(H5EA_hdr_t, hdr); -CATCH + CATCH END_FUNC(PKG) /* end H5EA__hdr_dest() */ diff --git a/src/H5EAiblock.c b/src/H5EAiblock.c index 1e42716..fcbe65f 100644 --- a/src/H5EAiblock.c +++ b/src/H5EAiblock.c @@ -93,52 +93,53 @@ H5FL_SEQ_DEFINE_STATIC(haddr_t); */ BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_alloc(H5EA_hdr_t *hdr)) -/* Local variables */ -H5EA_iblock_t *iblock = NULL; /* Extensible array index block */ - -/* Check arguments */ -HDassert(hdr); - -/* Allocate memory for the index block */ -if (NULL == (iblock = H5FL_CALLOC(H5EA_iblock_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block") - -/* Share common array information */ -if (H5EA__hdr_incr(hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") -iblock->hdr = hdr; - -/* Set non-zero internal fields */ -iblock->addr = HADDR_UNDEF; - -/* Compute information */ -iblock->nsblks = H5EA_SBLK_FIRST_IDX(hdr->cparam.sup_blk_min_data_ptrs); -iblock->ndblk_addrs = 2 * ((size_t)hdr->cparam.sup_blk_min_data_ptrs - 1); -iblock->nsblk_addrs = hdr->nsblks - iblock->nsblks; - -/* Allocate buffer for elements in index block */ -if (hdr->cparam.idx_blk_elmts > 0) - if (NULL == (iblock->elmts = H5FL_BLK_MALLOC( - idx_blk_elmt_buf, (size_t)(hdr->cparam.idx_blk_elmts * hdr->cparam.cls->nat_elmt_size)))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block data element buffer") - -/* Allocate buffer for data block addresses in index block */ -if (iblock->ndblk_addrs > 0) - if (NULL == (iblock->dblk_addrs = H5FL_SEQ_MALLOC(haddr_t, iblock->ndblk_addrs))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block data block addresses") - -/* Allocate buffer for super block addresses in index block */ -if (iblock->nsblk_addrs > 0) - if (NULL == (iblock->sblk_addrs = H5FL_SEQ_MALLOC(haddr_t, iblock->nsblk_addrs))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block super block addresses") - -/* Set the return value */ -ret_value = iblock; - -CATCH -if (!ret_value) - if (iblock && H5EA__iblock_dest(iblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block") + /* Local variables */ + H5EA_iblock_t *iblock = NULL; /* Extensible array index block */ + + /* Check arguments */ + HDassert(hdr); + + /* Allocate memory for the index block */ + if (NULL == (iblock = H5FL_CALLOC(H5EA_iblock_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block") + + /* Share common array information */ + if (H5EA__hdr_incr(hdr) < 0) + H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + iblock->hdr = hdr; + + /* Set non-zero internal fields */ + iblock->addr = HADDR_UNDEF; + + /* Compute information */ + iblock->nsblks = H5EA_SBLK_FIRST_IDX(hdr->cparam.sup_blk_min_data_ptrs); + iblock->ndblk_addrs = 2 * ((size_t)hdr->cparam.sup_blk_min_data_ptrs - 1); + iblock->nsblk_addrs = hdr->nsblks - iblock->nsblks; + + /* Allocate buffer for elements in index block */ + if (hdr->cparam.idx_blk_elmts > 0) + if (NULL == + (iblock->elmts = H5FL_BLK_MALLOC( + idx_blk_elmt_buf, (size_t)(hdr->cparam.idx_blk_elmts * hdr->cparam.cls->nat_elmt_size)))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block data element buffer") + + /* Allocate buffer for data block addresses in index block */ + if (iblock->ndblk_addrs > 0) + if (NULL == (iblock->dblk_addrs = H5FL_SEQ_MALLOC(haddr_t, iblock->ndblk_addrs))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block data block addresses") + + /* Allocate buffer for super block addresses in index block */ + if (iblock->nsblk_addrs > 0) + if (NULL == (iblock->sblk_addrs = H5FL_SEQ_MALLOC(haddr_t, iblock->nsblk_addrs))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for index block super block addresses") + + /* Set the return value */ + ret_value = iblock; + + CATCH + if (!ret_value) + if (iblock && H5EA__iblock_dest(iblock) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block") END_FUNC(PKG) /* end H5EA__iblock_alloc() */ @@ -157,95 +158,95 @@ END_FUNC(PKG) /* end H5EA__iblock_alloc() */ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed)) -/* Local variables */ -H5EA_iblock_t *iblock = NULL; /* Extensible array index block */ -haddr_t iblock_addr; /* Extensible array index block address */ -hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ - -/* Sanity check */ -HDassert(hdr); -HDassert(stats_changed); - -/* Allocate the index block */ -if (NULL == (iblock = H5EA__iblock_alloc(hdr))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block") - -/* Set size of index block on disk */ -iblock->size = H5EA_IBLOCK_SIZE(iblock); - -/* Allocate space for the index block on disk */ -if (HADDR_UNDEF == (iblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_IBLOCK, (hsize_t)iblock->size))) - H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array index block") -iblock->addr = iblock_addr; - -/* Clear any elements in index block to fill value */ -if (hdr->cparam.idx_blk_elmts > 0) { - /* Call the class's 'fill' callback */ - if ((hdr->cparam.cls->fill)(iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts) < 0) - H5E_THROW(H5E_CANTSET, "can't set extensible array index block elements to class's fill value") -} /* end if */ - -/* Reset any data block addresses in the index block */ -if (iblock->ndblk_addrs > 0) { - haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill data block addresses with */ - - /* Set all the data block addresses to "undefined" address value */ - H5VM_array_fill(iblock->dblk_addrs, &tmp_addr, sizeof(haddr_t), iblock->ndblk_addrs); -} /* end if */ - -/* Reset any super block addresses in the index block */ -if (iblock->nsblk_addrs > 0) { - haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill super block addresses with */ - - /* Set all the super block addresses to "undefined" address value */ - H5VM_array_fill(iblock->sblk_addrs, &tmp_addr, sizeof(haddr_t), iblock->nsblk_addrs); -} /* end if */ - -/* Cache the new extensible array index block */ -if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_IBLOCK, iblock_addr, iblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add extensible array index block to cache") -inserted = TRUE; - -/* Add index block as child of 'top' proxy */ -if (hdr->top_proxy) { - if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, iblock) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") - iblock->top_proxy = hdr->top_proxy; -} /* end if */ - -/* Update extensible array index block statistics */ -HDassert(0 == hdr->stats.computed.nindex_blks); -HDassert(0 == hdr->stats.computed.index_blk_size); -hdr->stats.computed.nindex_blks = 1; -hdr->stats.computed.index_blk_size = iblock->size; - -/* Increment count of elements "realized" */ -hdr->stats.stored.nelmts += hdr->cparam.idx_blk_elmts; - -/* Mark the statistics as changed */ -*stats_changed = TRUE; - -/* Set address of index block to return */ -ret_value = iblock_addr; - -CATCH -if (!H5F_addr_defined(ret_value)) - if (iblock) { - /* Remove from cache, if inserted */ - if (inserted) - if (H5AC_remove_entry(iblock) < 0) - H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array index block from cache") - - /* Release index block's disk space */ - if (H5F_addr_defined(iblock->addr) && - H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_IBLOCK, iblock->addr, (hsize_t)iblock->size) < 0) - H5E_THROW(H5E_CANTFREE, "unable to release file space for extensible array index block") - - /* Destroy index block */ - if (H5EA__iblock_dest(iblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block") + /* Local variables */ + H5EA_iblock_t *iblock = NULL; /* Extensible array index block */ + haddr_t iblock_addr; /* Extensible array index block address */ + hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + + /* Sanity check */ + HDassert(hdr); + HDassert(stats_changed); + + /* Allocate the index block */ + if (NULL == (iblock = H5EA__iblock_alloc(hdr))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array index block") + + /* Set size of index block on disk */ + iblock->size = H5EA_IBLOCK_SIZE(iblock); + + /* Allocate space for the index block on disk */ + if (HADDR_UNDEF == (iblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_IBLOCK, (hsize_t)iblock->size))) + H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array index block") + iblock->addr = iblock_addr; + + /* Clear any elements in index block to fill value */ + if (hdr->cparam.idx_blk_elmts > 0) { + /* Call the class's 'fill' callback */ + if ((hdr->cparam.cls->fill)(iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts) < 0) + H5E_THROW(H5E_CANTSET, "can't set extensible array index block elements to class's fill value") + } /* end if */ + + /* Reset any data block addresses in the index block */ + if (iblock->ndblk_addrs > 0) { + haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill data block addresses with */ + + /* Set all the data block addresses to "undefined" address value */ + H5VM_array_fill(iblock->dblk_addrs, &tmp_addr, sizeof(haddr_t), iblock->ndblk_addrs); + } /* end if */ + + /* Reset any super block addresses in the index block */ + if (iblock->nsblk_addrs > 0) { + haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill super block addresses with */ + + /* Set all the super block addresses to "undefined" address value */ + H5VM_array_fill(iblock->sblk_addrs, &tmp_addr, sizeof(haddr_t), iblock->nsblk_addrs); + } /* end if */ + + /* Cache the new extensible array index block */ + if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_IBLOCK, iblock_addr, iblock, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTINSERT, "can't add extensible array index block to cache") + inserted = TRUE; + + /* Add index block as child of 'top' proxy */ + if (hdr->top_proxy) { + if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, iblock) < 0) + H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + iblock->top_proxy = hdr->top_proxy; } /* end if */ + /* Update extensible array index block statistics */ + HDassert(0 == hdr->stats.computed.nindex_blks); + HDassert(0 == hdr->stats.computed.index_blk_size); + hdr->stats.computed.nindex_blks = 1; + hdr->stats.computed.index_blk_size = iblock->size; + + /* Increment count of elements "realized" */ + hdr->stats.stored.nelmts += hdr->cparam.idx_blk_elmts; + + /* Mark the statistics as changed */ + *stats_changed = TRUE; + + /* Set address of index block to return */ + ret_value = iblock_addr; + + CATCH + if (!H5F_addr_defined(ret_value)) + if (iblock) { + /* Remove from cache, if inserted */ + if (inserted) + if (H5AC_remove_entry(iblock) < 0) + H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array index block from cache") + + /* Release index block's disk space */ + if (H5F_addr_defined(iblock->addr) && + H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_IBLOCK, iblock->addr, (hsize_t)iblock->size) < 0) + H5E_THROW(H5E_CANTFREE, "unable to release file space for extensible array index block") + + /* Destroy index block */ + if (H5EA__iblock_dest(iblock) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array index block") + } /* end if */ + END_FUNC(PKG) /* end H5EA__iblock_create() */ /*------------------------------------------------------------------------- @@ -262,40 +263,41 @@ END_FUNC(PKG) /* end H5EA__iblock_create() */ */ BEGIN_FUNC(PKG, ERR, H5EA_iblock_t *, NULL, NULL, H5EA__iblock_protect(H5EA_hdr_t *hdr, unsigned flags)) -/* Local variables */ -H5EA_iblock_t *iblock = NULL; /* Pointer to index block */ + /* Local variables */ + H5EA_iblock_t *iblock = NULL; /* Pointer to index block */ -/* Sanity check */ -HDassert(hdr); + /* Sanity check */ + HDassert(hdr); -/* only the H5AC__READ_ONLY_FLAG may be set */ -HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + /* only the H5AC__READ_ONLY_FLAG may be set */ + HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); -/* Protect the index block */ -if (NULL == - (iblock = (H5EA_iblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_IBLOCK, hdr->idx_blk_addr, hdr, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", - (unsigned long long)hdr->idx_blk_addr) + /* Protect the index block */ + if (NULL == + (iblock = (H5EA_iblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_IBLOCK, hdr->idx_blk_addr, hdr, flags))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", + (unsigned long long)hdr->idx_blk_addr) -/* Create top proxy, if it doesn't exist */ -if (hdr->top_proxy && NULL == iblock->top_proxy) { - /* Add index block as child of 'top' proxy */ - if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, iblock) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") - iblock->top_proxy = hdr->top_proxy; -} /* end if */ - -/* Set return value */ -ret_value = iblock; - -CATCH -/* Clean up on error */ -if (!ret_value) { - /* Release the index block, if it was protected */ - if (iblock && H5AC_unprotect(hdr->f, H5AC_EARRAY_IBLOCK, iblock->addr, iblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array index block, address = %llu", - (unsigned long long)iblock->addr) -} /* end if */ + /* Create top proxy, if it doesn't exist */ + if (hdr->top_proxy && NULL == iblock->top_proxy) { + /* Add index block as child of 'top' proxy */ + if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, iblock) < 0) + H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + iblock->top_proxy = hdr->top_proxy; + } /* end if */ + + /* Set return value */ + ret_value = iblock; + + CATCH + /* Clean up on error */ + if (!ret_value) { + /* Release the index block, if it was protected */ + if (iblock && + H5AC_unprotect(hdr->f, H5AC_EARRAY_IBLOCK, iblock->addr, iblock, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array index block, address = %llu", + (unsigned long long)iblock->addr) + } /* end if */ END_FUNC(PKG) /* end H5EA__iblock_protect() */ @@ -314,17 +316,17 @@ END_FUNC(PKG) /* end H5EA__iblock_protect() */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_unprotect(H5EA_iblock_t *iblock, unsigned cache_flags)) -/* Local variables */ + /* Local variables */ -/* Sanity check */ -HDassert(iblock); + /* Sanity check */ + HDassert(iblock); -/* Unprotect the index block */ -if (H5AC_unprotect(iblock->hdr->f, H5AC_EARRAY_IBLOCK, iblock->addr, iblock, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array index block, address = %llu", - (unsigned long long)iblock->addr) + /* Unprotect the index block */ + if (H5AC_unprotect(iblock->hdr->f, H5AC_EARRAY_IBLOCK, iblock->addr, iblock, cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array index block, address = %llu", + (unsigned long long)iblock->addr) -CATCH + CATCH END_FUNC(PKG) /* end H5EA__iblock_unprotect() */ @@ -342,68 +344,69 @@ END_FUNC(PKG) /* end H5EA__iblock_unprotect() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_delete(H5EA_hdr_t *hdr)) -/* Local variables */ -H5EA_iblock_t *iblock = NULL; /* Pointer to index block */ - -/* Sanity check */ -HDassert(hdr); -HDassert(H5F_addr_defined(hdr->idx_blk_addr)); - -/* Protect index block */ -if (NULL == (iblock = H5EA__iblock_protect(hdr, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", - (unsigned long long)hdr->idx_blk_addr) - -/* Check for index block having data block pointers */ -if (iblock->ndblk_addrs > 0) { - unsigned sblk_idx; /* Current super block index */ - unsigned dblk_idx; /* Current data block index w/in super block */ - size_t u; /* Local index variable */ - - /* Iterate over data blocks */ - sblk_idx = dblk_idx = 0; - for (u = 0; u < iblock->ndblk_addrs; u++) { - /* Check for data block existing */ - if (H5F_addr_defined(iblock->dblk_addrs[u])) { - /* Delete data block */ - if (H5EA__dblock_delete(hdr, iblock, iblock->dblk_addrs[u], - hdr->sblk_info[sblk_idx].dblk_nelmts) < 0) - H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array data block") - iblock->dblk_addrs[u] = HADDR_UNDEF; - } /* end if */ - - /* Advance to next data block w/in super block */ - dblk_idx++; - - /* Check for moving to next super block */ - if (dblk_idx >= hdr->sblk_info[sblk_idx].ndblks) { - sblk_idx++; - dblk_idx = 0; - } /* end if */ - } /* end for */ -} /* end if */ - -/* Check for index block having data block pointers (not yet) */ -if (iblock->nsblk_addrs > 0) { - size_t u; /* Local index variable */ - - /* Iterate over super blocks */ - for (u = 0; u < iblock->nsblk_addrs; u++) { - /* Check for data block existing */ - if (H5F_addr_defined(iblock->sblk_addrs[u])) { - /* Delete super block */ - if (H5EA__sblock_delete(hdr, iblock, iblock->sblk_addrs[u], (unsigned)(u + iblock->nsblks)) < 0) - H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array super block") - iblock->sblk_addrs[u] = HADDR_UNDEF; - } /* end if */ - } /* end for */ -} /* end if */ - -CATCH -/* Finished deleting index block in metadata cache */ -if (iblock && - H5EA__iblock_unprotect(iblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block") + /* Local variables */ + H5EA_iblock_t *iblock = NULL; /* Pointer to index block */ + + /* Sanity check */ + HDassert(hdr); + HDassert(H5F_addr_defined(hdr->idx_blk_addr)); + + /* Protect index block */ + if (NULL == (iblock = H5EA__iblock_protect(hdr, H5AC__NO_FLAGS_SET))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array index block, address = %llu", + (unsigned long long)hdr->idx_blk_addr) + + /* Check for index block having data block pointers */ + if (iblock->ndblk_addrs > 0) { + unsigned sblk_idx; /* Current super block index */ + unsigned dblk_idx; /* Current data block index w/in super block */ + size_t u; /* Local index variable */ + + /* Iterate over data blocks */ + sblk_idx = dblk_idx = 0; + for (u = 0; u < iblock->ndblk_addrs; u++) { + /* Check for data block existing */ + if (H5F_addr_defined(iblock->dblk_addrs[u])) { + /* Delete data block */ + if (H5EA__dblock_delete(hdr, iblock, iblock->dblk_addrs[u], + hdr->sblk_info[sblk_idx].dblk_nelmts) < 0) + H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array data block") + iblock->dblk_addrs[u] = HADDR_UNDEF; + } /* end if */ + + /* Advance to next data block w/in super block */ + dblk_idx++; + + /* Check for moving to next super block */ + if (dblk_idx >= hdr->sblk_info[sblk_idx].ndblks) { + sblk_idx++; + dblk_idx = 0; + } /* end if */ + } /* end for */ + } /* end if */ + + /* Check for index block having data block pointers (not yet) */ + if (iblock->nsblk_addrs > 0) { + size_t u; /* Local index variable */ + + /* Iterate over super blocks */ + for (u = 0; u < iblock->nsblk_addrs; u++) { + /* Check for data block existing */ + if (H5F_addr_defined(iblock->sblk_addrs[u])) { + /* Delete super block */ + if (H5EA__sblock_delete(hdr, iblock, iblock->sblk_addrs[u], (unsigned)(u + iblock->nsblks)) < + 0) + H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array super block") + iblock->sblk_addrs[u] = HADDR_UNDEF; + } /* end if */ + } /* end for */ + } /* end if */ + + CATCH + /* Finished deleting index block in metadata cache */ + if (iblock && H5EA__iblock_unprotect(iblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | + H5AC__FREE_FILE_SPACE_FLAG) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block") END_FUNC(PKG) /* end H5EA__iblock_delete() */ @@ -421,46 +424,46 @@ END_FUNC(PKG) /* end H5EA__iblock_delete() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__iblock_dest(H5EA_iblock_t *iblock)) -/* Sanity check */ -HDassert(iblock); + /* Sanity check */ + HDassert(iblock); -/* Check if shared header field has been initialized */ -if (iblock->hdr) { - /* Check if we've got elements in the index block */ - if (iblock->elmts) { - /* Free buffer for index block elements */ - HDassert(iblock->hdr->cparam.idx_blk_elmts > 0); - iblock->elmts = H5FL_BLK_FREE(idx_blk_elmt_buf, iblock->elmts); - } /* end if */ + /* Check if shared header field has been initialized */ + if (iblock->hdr) { + /* Check if we've got elements in the index block */ + if (iblock->elmts) { + /* Free buffer for index block elements */ + HDassert(iblock->hdr->cparam.idx_blk_elmts > 0); + iblock->elmts = H5FL_BLK_FREE(idx_blk_elmt_buf, iblock->elmts); + } /* end if */ - /* Check if we've got data block addresses in the index block */ - if (iblock->dblk_addrs) { - /* Free buffer for index block data block addresses */ - HDassert(iblock->ndblk_addrs > 0); - iblock->dblk_addrs = H5FL_SEQ_FREE(haddr_t, iblock->dblk_addrs); - iblock->ndblk_addrs = 0; - } /* end if */ + /* Check if we've got data block addresses in the index block */ + if (iblock->dblk_addrs) { + /* Free buffer for index block data block addresses */ + HDassert(iblock->ndblk_addrs > 0); + iblock->dblk_addrs = H5FL_SEQ_FREE(haddr_t, iblock->dblk_addrs); + iblock->ndblk_addrs = 0; + } /* end if */ - /* Check if we've got super block addresses in the index block */ - if (iblock->sblk_addrs) { - /* Free buffer for index block super block addresses */ - HDassert(iblock->nsblk_addrs > 0); - iblock->sblk_addrs = H5FL_SEQ_FREE(haddr_t, iblock->sblk_addrs); - iblock->nsblk_addrs = 0; - } /* end if */ + /* Check if we've got super block addresses in the index block */ + if (iblock->sblk_addrs) { + /* Free buffer for index block super block addresses */ + HDassert(iblock->nsblk_addrs > 0); + iblock->sblk_addrs = H5FL_SEQ_FREE(haddr_t, iblock->sblk_addrs); + iblock->nsblk_addrs = 0; + } /* end if */ - /* Decrement reference count on shared info */ - if (H5EA__hdr_decr(iblock->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") - iblock->hdr = NULL; -} /* end if */ + /* Decrement reference count on shared info */ + if (H5EA__hdr_decr(iblock->hdr) < 0) + H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + iblock->hdr = NULL; + } /* end if */ -/* Sanity check */ -HDassert(NULL == iblock->top_proxy); + /* Sanity check */ + HDassert(NULL == iblock->top_proxy); -/* Free the index block itself */ -iblock = H5FL_FREE(H5EA_iblock_t, iblock); + /* Free the index block itself */ + iblock = H5FL_FREE(H5EA_iblock_t, iblock); -CATCH + CATCH END_FUNC(PKG) /* end H5EA__iblock_dest() */ diff --git a/src/H5EAint.c b/src/H5EAint.c index f1d988b..34b52d0 100644 --- a/src/H5EAint.c +++ b/src/H5EAint.c @@ -82,15 +82,15 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)) -/* Sanity check */ -HDassert(parent_entry); -HDassert(child_entry); + /* Sanity check */ + HDassert(parent_entry); + HDassert(child_entry); -/* Create a flush dependency between parent and child entry */ -if (H5AC_create_flush_dependency(parent_entry, child_entry) < 0) - H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency") + /* Create a flush dependency between parent and child entry */ + if (H5AC_create_flush_dependency(parent_entry, child_entry) < 0) + H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency") -CATCH + CATCH END_FUNC(PKG) /* end H5EA__create_flush_depend() */ @@ -109,14 +109,14 @@ END_FUNC(PKG) /* end H5EA__create_flush_depend() */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)) -/* Sanity check */ -HDassert(parent_entry); -HDassert(child_entry); + /* Sanity check */ + HDassert(parent_entry); + HDassert(child_entry); -/* Destroy a flush dependency between parent and child entry */ -if (H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency") + /* Destroy a flush dependency between parent and child entry */ + if (H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency") -CATCH + CATCH END_FUNC(PKG) /* end H5EA__destroy_flush_depend() */ diff --git a/src/H5EAsblock.c b/src/H5EAsblock.c index f48525f..304947b 100644 --- a/src/H5EAsblock.c +++ b/src/H5EAsblock.c @@ -94,66 +94,66 @@ H5FL_BLK_DEFINE(page_init); BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL, H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, unsigned sblk_idx)) -/* Local variables */ -H5EA_sblock_t *sblock = NULL; /* Extensible array super block */ + /* Local variables */ + H5EA_sblock_t *sblock = NULL; /* Extensible array super block */ -/* Check arguments */ -HDassert(hdr); + /* Check arguments */ + HDassert(hdr); -/* Allocate memory for the index block */ -if (NULL == (sblock = H5FL_CALLOC(H5EA_sblock_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block") + /* Allocate memory for the index block */ + if (NULL == (sblock = H5FL_CALLOC(H5EA_sblock_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block") -/* Share common array information */ -if (H5EA__hdr_incr(hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") -sblock->hdr = hdr; + /* Share common array information */ + if (H5EA__hdr_incr(hdr) < 0) + H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + sblock->hdr = hdr; -/* Set non-zero internal fields */ -sblock->parent = parent; -sblock->addr = HADDR_UNDEF; + /* Set non-zero internal fields */ + sblock->parent = parent; + sblock->addr = HADDR_UNDEF; -/* Compute/cache information */ -sblock->idx = sblk_idx; -sblock->ndblks = hdr->sblk_info[sblk_idx].ndblks; -HDassert(sblock->ndblks); -sblock->dblk_nelmts = hdr->sblk_info[sblk_idx].dblk_nelmts; + /* Compute/cache information */ + sblock->idx = sblk_idx; + sblock->ndblks = hdr->sblk_info[sblk_idx].ndblks; + HDassert(sblock->ndblks); + sblock->dblk_nelmts = hdr->sblk_info[sblk_idx].dblk_nelmts; -/* Allocate buffer for data block addresses in super block */ -if (NULL == (sblock->dblk_addrs = H5FL_SEQ_MALLOC(haddr_t, sblock->ndblks))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block data block addresses") + /* Allocate buffer for data block addresses in super block */ + if (NULL == (sblock->dblk_addrs = H5FL_SEQ_MALLOC(haddr_t, sblock->ndblks))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block data block addresses") -/* Check if # of elements in data blocks requires paging */ -if (sblock->dblk_nelmts > hdr->dblk_page_nelmts) { - /* Compute # of pages in each data block from this super block */ - sblock->dblk_npages = sblock->dblk_nelmts / hdr->dblk_page_nelmts; + /* Check if # of elements in data blocks requires paging */ + if (sblock->dblk_nelmts > hdr->dblk_page_nelmts) { + /* Compute # of pages in each data block from this super block */ + sblock->dblk_npages = sblock->dblk_nelmts / hdr->dblk_page_nelmts; - /* Sanity check that we have at least 2 pages in data block */ - HDassert(sblock->dblk_npages > 1); + /* Sanity check that we have at least 2 pages in data block */ + HDassert(sblock->dblk_npages > 1); - /* Sanity check for integer truncation */ - HDassert((sblock->dblk_npages * hdr->dblk_page_nelmts) == sblock->dblk_nelmts); + /* Sanity check for integer truncation */ + HDassert((sblock->dblk_npages * hdr->dblk_page_nelmts) == sblock->dblk_nelmts); - /* Compute size of buffer for each data block's 'page init' bitmask */ - sblock->dblk_page_init_size = ((sblock->dblk_npages) + 7) / 8; - HDassert(sblock->dblk_page_init_size > 0); + /* Compute size of buffer for each data block's 'page init' bitmask */ + sblock->dblk_page_init_size = ((sblock->dblk_npages) + 7) / 8; + HDassert(sblock->dblk_page_init_size > 0); - /* Allocate buffer for all 'page init' bitmasks in super block */ - if (NULL == - (sblock->page_init = H5FL_BLK_CALLOC(page_init, sblock->ndblks * sblock->dblk_page_init_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block page init bitmask") + /* Allocate buffer for all 'page init' bitmasks in super block */ + if (NULL == + (sblock->page_init = H5FL_BLK_CALLOC(page_init, sblock->ndblks * sblock->dblk_page_init_size))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for super block page init bitmask") - /* Compute data block page size */ - sblock->dblk_page_size = (hdr->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5EA_SIZEOF_CHKSUM; -} /* end if */ + /* Compute data block page size */ + sblock->dblk_page_size = (hdr->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5EA_SIZEOF_CHKSUM; + } /* end if */ -/* Set the return value */ -ret_value = sblock; + /* Set the return value */ + ret_value = sblock; -CATCH -if (!ret_value) - if (sblock && H5EA__sblock_dest(sblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block") + CATCH + if (!ret_value) + if (sblock && H5EA__sblock_dest(sblock) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block") END_FUNC(PKG) /* end H5EA__sblock_alloc() */ @@ -173,74 +173,74 @@ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, H5EA__sblock_create(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, hbool_t *stats_changed, unsigned sblk_idx)) -/* Local variables */ -H5EA_sblock_t *sblock = NULL; /* Extensible array super block */ -haddr_t sblock_addr; /* Extensible array super block address */ -haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill data block addresses with */ -hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ - -/* Sanity check */ -HDassert(hdr); -HDassert(stats_changed); - -/* Allocate the super block */ -if (NULL == (sblock = H5EA__sblock_alloc(hdr, parent, sblk_idx))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block") - -/* Set size of super block on disk */ -sblock->size = H5EA_SBLOCK_SIZE(sblock); - -/* Set offset of block in array's address space */ -sblock->block_off = hdr->sblk_info[sblk_idx].start_idx; - -/* Allocate space for the super block on disk */ -if (HADDR_UNDEF == (sblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_SBLOCK, (hsize_t)sblock->size))) - H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array super block") -sblock->addr = sblock_addr; - -/* Reset data block addresses to "undefined" address value */ -H5VM_array_fill(sblock->dblk_addrs, &tmp_addr, sizeof(haddr_t), sblock->ndblks); - -/* Cache the new extensible array super block */ -if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_SBLOCK, sblock_addr, sblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add extensible array super block to cache") -inserted = TRUE; - -/* Add super block as child of 'top' proxy */ -if (hdr->top_proxy) { - if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, sblock) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") - sblock->top_proxy = hdr->top_proxy; -} /* end if */ - -/* Update extensible array super block statistics */ -hdr->stats.stored.nsuper_blks++; -hdr->stats.stored.super_blk_size += sblock->size; - -/* Mark the statistics as changed */ -*stats_changed = TRUE; - -/* Set address of super block to return */ -ret_value = sblock_addr; - -CATCH -if (!H5F_addr_defined(ret_value)) - if (sblock) { - /* Remove from cache, if inserted */ - if (inserted) - if (H5AC_remove_entry(sblock) < 0) - H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array super block from cache") - - /* Release super block's disk space */ - if (H5F_addr_defined(sblock->addr) && - H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_SBLOCK, sblock->addr, (hsize_t)sblock->size) < 0) - H5E_THROW(H5E_CANTFREE, "unable to release extensible array super block") - - /* Destroy super block */ - if (H5EA__sblock_dest(sblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block") + /* Local variables */ + H5EA_sblock_t *sblock = NULL; /* Extensible array super block */ + haddr_t sblock_addr; /* Extensible array super block address */ + haddr_t tmp_addr = HADDR_UNDEF; /* Address value to fill data block addresses with */ + hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + + /* Sanity check */ + HDassert(hdr); + HDassert(stats_changed); + + /* Allocate the super block */ + if (NULL == (sblock = H5EA__sblock_alloc(hdr, parent, sblk_idx))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array super block") + + /* Set size of super block on disk */ + sblock->size = H5EA_SBLOCK_SIZE(sblock); + + /* Set offset of block in array's address space */ + sblock->block_off = hdr->sblk_info[sblk_idx].start_idx; + + /* Allocate space for the super block on disk */ + if (HADDR_UNDEF == (sblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_SBLOCK, (hsize_t)sblock->size))) + H5E_THROW(H5E_CANTALLOC, "file allocation failed for extensible array super block") + sblock->addr = sblock_addr; + + /* Reset data block addresses to "undefined" address value */ + H5VM_array_fill(sblock->dblk_addrs, &tmp_addr, sizeof(haddr_t), sblock->ndblks); + + /* Cache the new extensible array super block */ + if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_SBLOCK, sblock_addr, sblock, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTINSERT, "can't add extensible array super block to cache") + inserted = TRUE; + + /* Add super block as child of 'top' proxy */ + if (hdr->top_proxy) { + if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, sblock) < 0) + H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + sblock->top_proxy = hdr->top_proxy; } /* end if */ + /* Update extensible array super block statistics */ + hdr->stats.stored.nsuper_blks++; + hdr->stats.stored.super_blk_size += sblock->size; + + /* Mark the statistics as changed */ + *stats_changed = TRUE; + + /* Set address of super block to return */ + ret_value = sblock_addr; + + CATCH + if (!H5F_addr_defined(ret_value)) + if (sblock) { + /* Remove from cache, if inserted */ + if (inserted) + if (H5AC_remove_entry(sblock) < 0) + H5E_THROW(H5E_CANTREMOVE, "unable to remove extensible array super block from cache") + + /* Release super block's disk space */ + if (H5F_addr_defined(sblock->addr) && + H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_SBLOCK, sblock->addr, (hsize_t)sblock->size) < 0) + H5E_THROW(H5E_CANTFREE, "unable to release extensible array super block") + + /* Destroy super block */ + if (H5EA__sblock_dest(sblock) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy extensible array super block") + } /* end if */ + END_FUNC(PKG) /* end H5EA__sblock_create() */ /*------------------------------------------------------------------------- @@ -259,47 +259,49 @@ BEGIN_FUNC(PKG, ERR, H5EA_sblock_t *, NULL, NULL, H5EA__sblock_protect(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, unsigned sblk_idx, unsigned flags)) -/* Local variables */ -H5EA_sblock_t * sblock = NULL; /* Pointer to super block */ -H5EA_sblock_cache_ud_t udata; /* Information needed for loading super block */ + /* Local variables */ + H5EA_sblock_t * sblock = NULL; /* Pointer to super block */ + H5EA_sblock_cache_ud_t udata; /* Information needed for loading super block */ -/* Sanity check */ -HDassert(hdr); -HDassert(H5F_addr_defined(sblk_addr)); + /* Sanity check */ + HDassert(hdr); + HDassert(H5F_addr_defined(sblk_addr)); -/* only the H5AC__READ_ONLY_FLAG may be set */ -HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + /* only the H5AC__READ_ONLY_FLAG may be set */ + HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); -/* Set up user data */ -udata.hdr = hdr; -udata.parent = parent; -udata.sblk_idx = sblk_idx; -udata.sblk_addr = sblk_addr; + /* Set up user data */ + udata.hdr = hdr; + udata.parent = parent; + udata.sblk_idx = sblk_idx; + udata.sblk_addr = sblk_addr; -/* Protect the super block */ -if (NULL == (sblock = (H5EA_sblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_SBLOCK, sblk_addr, &udata, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", - (unsigned long long)sblk_addr) + /* Protect the super block */ + if (NULL == + (sblock = (H5EA_sblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_SBLOCK, sblk_addr, &udata, flags))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", + (unsigned long long)sblk_addr) + + /* Create top proxy, if it doesn't exist */ + if (hdr->top_proxy && NULL == sblock->top_proxy) { + /* Add super block as child of 'top' proxy */ + if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, sblock) < 0) + H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") + sblock->top_proxy = hdr->top_proxy; + } /* end if */ -/* Create top proxy, if it doesn't exist */ -if (hdr->top_proxy && NULL == sblock->top_proxy) { - /* Add super block as child of 'top' proxy */ - if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, sblock) < 0) - H5E_THROW(H5E_CANTSET, "unable to add extensible array entry as child of array proxy") - sblock->top_proxy = hdr->top_proxy; -} /* end if */ - -/* Set return value */ -ret_value = sblock; - -CATCH -/* Clean up on error */ -if (!ret_value) { - /* Release the super block, if it was protected */ - if (sblock && H5AC_unprotect(hdr->f, H5AC_EARRAY_SBLOCK, sblock->addr, sblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array super block, address = %llu", - (unsigned long long)sblock->addr) -} /* end if */ + /* Set return value */ + ret_value = sblock; + + CATCH + /* Clean up on error */ + if (!ret_value) { + /* Release the super block, if it was protected */ + if (sblock && + H5AC_unprotect(hdr->f, H5AC_EARRAY_SBLOCK, sblock->addr, sblock, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array super block, address = %llu", + (unsigned long long)sblock->addr) + } /* end if */ END_FUNC(PKG) /* end H5EA__sblock_protect() */ @@ -318,17 +320,17 @@ END_FUNC(PKG) /* end H5EA__sblock_protect() */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__sblock_unprotect(H5EA_sblock_t *sblock, unsigned cache_flags)) -/* Local variables */ + /* Local variables */ -/* Sanity check */ -HDassert(sblock); + /* Sanity check */ + HDassert(sblock); -/* Unprotect the super block */ -if (H5AC_unprotect(sblock->hdr->f, H5AC_EARRAY_SBLOCK, sblock->addr, sblock, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array super block, address = %llu", - (unsigned long long)sblock->addr) + /* Unprotect the super block */ + if (H5AC_unprotect(sblock->hdr->f, H5AC_EARRAY_SBLOCK, sblock->addr, sblock, cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect extensible array super block, address = %llu", + (unsigned long long)sblock->addr) -CATCH + CATCH END_FUNC(PKG) /* end H5EA__sblock_unprotect() */ @@ -347,35 +349,35 @@ END_FUNC(PKG) /* end H5EA__sblock_unprotect() */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__sblock_delete(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, unsigned sblk_idx)) -/* Local variables */ -H5EA_sblock_t *sblock = NULL; /* Pointer to super block */ -size_t u; /* Local index variable */ - -/* Sanity check */ -HDassert(hdr); -HDassert(H5F_addr_defined(sblk_addr)); - -/* Protect super block */ -if (NULL == (sblock = H5EA__sblock_protect(hdr, parent, sblk_addr, sblk_idx, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", - (unsigned long long)sblk_addr) - -/* Iterate over data blocks */ -for (u = 0; u < sblock->ndblks; u++) { - /* Check for data block existing */ - if (H5F_addr_defined(sblock->dblk_addrs[u])) { - /* Delete data block */ - if (H5EA__dblock_delete(hdr, sblock, sblock->dblk_addrs[u], sblock->dblk_nelmts) < 0) - H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array data block") - sblock->dblk_addrs[u] = HADDR_UNDEF; - } /* end if */ -} /* end for */ - -CATCH -/* Finished deleting super block in metadata cache */ -if (sblock && - H5EA__sblock_unprotect(sblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block") + /* Local variables */ + H5EA_sblock_t *sblock = NULL; /* Pointer to super block */ + size_t u; /* Local index variable */ + + /* Sanity check */ + HDassert(hdr); + HDassert(H5F_addr_defined(sblk_addr)); + + /* Protect super block */ + if (NULL == (sblock = H5EA__sblock_protect(hdr, parent, sblk_addr, sblk_idx, H5AC__NO_FLAGS_SET))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array super block, address = %llu", + (unsigned long long)sblk_addr) + + /* Iterate over data blocks */ + for (u = 0; u < sblock->ndblks; u++) { + /* Check for data block existing */ + if (H5F_addr_defined(sblock->dblk_addrs[u])) { + /* Delete data block */ + if (H5EA__dblock_delete(hdr, sblock, sblock->dblk_addrs[u], sblock->dblk_nelmts) < 0) + H5E_THROW(H5E_CANTDELETE, "unable to delete extensible array data block") + sblock->dblk_addrs[u] = HADDR_UNDEF; + } /* end if */ + } /* end for */ + + CATCH + /* Finished deleting super block in metadata cache */ + if (sblock && H5EA__sblock_unprotect(sblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | + H5AC__FREE_FILE_SPACE_FLAG) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block") END_FUNC(PKG) /* end H5EA__sblock_delete() */ @@ -393,34 +395,34 @@ END_FUNC(PKG) /* end H5EA__sblock_delete() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5EA__sblock_dest(H5EA_sblock_t *sblock)) -/* Sanity check */ -HDassert(sblock); -HDassert(!sblock->has_hdr_depend); - -/* Check if shared header field has been initialized */ -if (sblock->hdr) { - /* Free buffer for super block data block addresses, if there are any */ - if (sblock->dblk_addrs) - sblock->dblk_addrs = H5FL_SEQ_FREE(haddr_t, sblock->dblk_addrs); - - /* Free buffer for super block 'page init' bitmask, if there is one */ - if (sblock->page_init) { - HDassert(sblock->dblk_npages > 0); - sblock->page_init = H5FL_BLK_FREE(page_init, sblock->page_init); + /* Sanity check */ + HDassert(sblock); + HDassert(!sblock->has_hdr_depend); + + /* Check if shared header field has been initialized */ + if (sblock->hdr) { + /* Free buffer for super block data block addresses, if there are any */ + if (sblock->dblk_addrs) + sblock->dblk_addrs = H5FL_SEQ_FREE(haddr_t, sblock->dblk_addrs); + + /* Free buffer for super block 'page init' bitmask, if there is one */ + if (sblock->page_init) { + HDassert(sblock->dblk_npages > 0); + sblock->page_init = H5FL_BLK_FREE(page_init, sblock->page_init); + } /* end if */ + + /* Decrement reference count on shared info */ + if (H5EA__hdr_decr(sblock->hdr) < 0) + H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + sblock->hdr = NULL; } /* end if */ - /* Decrement reference count on shared info */ - if (H5EA__hdr_decr(sblock->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") - sblock->hdr = NULL; -} /* end if */ - -/* Sanity check */ -HDassert(NULL == sblock->top_proxy); + /* Sanity check */ + HDassert(NULL == sblock->top_proxy); -/* Free the super block itself */ -sblock = H5FL_FREE(H5EA_sblock_t, sblock); + /* Free the super block itself */ + sblock = H5FL_FREE(H5EA_sblock_t, sblock); -CATCH + CATCH END_FUNC(PKG) /* end H5EA__sblock_dest() */ diff --git a/src/H5EAstat.c b/src/H5EAstat.c index 1e0197d..35a2462 100644 --- a/src/H5EAstat.c +++ b/src/H5EAstat.c @@ -82,15 +82,15 @@ */ BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats)) -/* Local variables */ + /* Local variables */ -/* - * Check arguments. - */ -HDassert(ea); -HDassert(stats); + /* + * Check arguments. + */ + HDassert(ea); + HDassert(stats); -/* Copy extensible array statistics */ -H5MM_memcpy(stats, &ea->hdr->stats, sizeof(ea->hdr->stats)); + /* Copy extensible array statistics */ + H5MM_memcpy(stats, &ea->hdr->stats, sizeof(ea->hdr->stats)); END_FUNC(PRIV) /* end H5EA_get_stats() */ diff --git a/src/H5EAtest.c b/src/H5EAtest.c index 9442cd9..0a85729 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -121,24 +121,24 @@ H5FL_DEFINE_STATIC(H5EA__ctx_cb_t); */ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5EA__test_crt_context(void *_udata)) -/* Local variables */ -H5EA__test_ctx_t *ctx; /* Context for callbacks */ -H5EA__ctx_cb_t * udata = (H5EA__ctx_cb_t *)_udata; /* User data for context */ + /* Local variables */ + H5EA__test_ctx_t *ctx; /* Context for callbacks */ + H5EA__ctx_cb_t * udata = (H5EA__ctx_cb_t *)_udata; /* User data for context */ -/* Sanity checks */ + /* Sanity checks */ -/* Allocate new context structure */ -if (NULL == (ctx = H5FL_MALLOC(H5EA__test_ctx_t))) - H5E_THROW(H5E_CANTALLOC, "can't allocate extensible array client callback context") + /* Allocate new context structure */ + if (NULL == (ctx = H5FL_MALLOC(H5EA__test_ctx_t))) + H5E_THROW(H5E_CANTALLOC, "can't allocate extensible array client callback context") -/* Initialize the context */ -ctx->bogus = H5EA__TEST_BOGUS_VAL; -ctx->cb = udata; + /* Initialize the context */ + ctx->bogus = H5EA__TEST_BOGUS_VAL; + ctx->cb = udata; -/* Set return value */ -ret_value = ctx; + /* Set return value */ + ret_value = ctx; -CATCH + CATCH END_FUNC(STATIC) /* end H5EA__test_crt_context() */ @@ -157,14 +157,14 @@ END_FUNC(STATIC) /* end H5EA__test_crt_context() */ */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__test_dst_context(void *_ctx)) -/* Local variables */ -H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */ + /* Local variables */ + H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */ -/* Sanity checks */ -HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus); + /* Sanity checks */ + HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus); -/* Release context structure */ -ctx = H5FL_FREE(H5EA__test_ctx_t, ctx); + /* Release context structure */ + ctx = H5FL_FREE(H5EA__test_ctx_t, ctx); END_FUNC(STATIC) /* end H5EA__test_dst_context() */ @@ -183,14 +183,14 @@ END_FUNC(STATIC) /* end H5EA__test_dst_context() */ */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__test_fill(void *nat_blk, size_t nelmts)) -/* Local variables */ -uint64_t fill_val = H5EA_TEST_FILL; /* Value to fill elements with */ + /* Local variables */ + uint64_t fill_val = H5EA_TEST_FILL; /* Value to fill elements with */ -/* Sanity checks */ -HDassert(nat_blk); -HDassert(nelmts); + /* Sanity checks */ + HDassert(nat_blk); + HDassert(nelmts); -H5VM_array_fill(nat_blk, &fill_val, sizeof(uint64_t), nelmts); + H5VM_array_fill(nat_blk, &fill_val, sizeof(uint64_t), nelmts); END_FUNC(STATIC) /* end H5EA__test_fill() */ @@ -210,36 +210,36 @@ END_FUNC(STATIC) /* end H5EA__test_fill() */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5EA__test_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx)) -/* Local variables */ -H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */ -const uint64_t * elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */ + /* Local variables */ + H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */ + const uint64_t * elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */ -/* Sanity checks */ -HDassert(raw); -HDassert(elmt); -HDassert(nelmts); -HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus); + /* Sanity checks */ + HDassert(raw); + HDassert(elmt); + HDassert(nelmts); + HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus); -/* Check for callback action */ -if (ctx->cb) { - if ((*ctx->cb->encode)(elmt, nelmts, ctx->cb->udata) < 0) - H5E_THROW(H5E_BADVALUE, "extensible array testing callback action failed") -} /* end if */ + /* Check for callback action */ + if (ctx->cb) { + if ((*ctx->cb->encode)(elmt, nelmts, ctx->cb->udata) < 0) + H5E_THROW(H5E_BADVALUE, "extensible array testing callback action failed") + } /* end if */ -/* Encode native elements into raw elements */ -while (nelmts) { - /* Encode element */ - /* (advances 'raw' pointer) */ - UINT64ENCODE(raw, *elmt); + /* Encode native elements into raw elements */ + while (nelmts) { + /* Encode element */ + /* (advances 'raw' pointer) */ + UINT64ENCODE(raw, *elmt); - /* Advance native element pointer */ - elmt++; + /* Advance native element pointer */ + elmt++; - /* Decrement # of elements to encode */ - nelmts--; -} /* end while */ + /* Decrement # of elements to encode */ + nelmts--; + } /* end while */ -CATCH + CATCH END_FUNC(STATIC) /* end H5EA__test_encode() */ @@ -261,29 +261,29 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Local variables */ #ifndef NDEBUG -H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */ -#endif /* NDEBUG */ -uint64_t * elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */ -const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */ - -/* Sanity checks */ -HDassert(raw); -HDassert(elmt); -HDassert(nelmts); -HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus); - -/* Decode raw elements into native elements */ -while (nelmts) { - /* Decode element */ - /* (advances 'raw' pointer) */ - UINT64DECODE(raw, *elmt); - - /* Advance native element pointer */ - elmt++; - - /* Decrement # of elements to decode */ - nelmts--; -} /* end while */ + H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */ +#endif /* NDEBUG */ + uint64_t * elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */ + const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */ + + /* Sanity checks */ + HDassert(raw); + HDassert(elmt); + HDassert(nelmts); + HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus); + + /* Decode raw elements into native elements */ + while (nelmts) { + /* Decode element */ + /* (advances 'raw' pointer) */ + UINT64DECODE(raw, *elmt); + + /* Advance native element pointer */ + elmt++; + + /* Decrement # of elements to decode */ + nelmts--; + } /* end while */ END_FUNC(STATIC) /* end H5EA__test_decode() */ @@ -303,17 +303,17 @@ END_FUNC(STATIC) /* end H5EA__test_decode() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt)) -/* Local variables */ -char temp_str[128]; /* Temporary string, for formatting */ + /* Local variables */ + char temp_str[128]; /* Temporary string, for formatting */ -/* Sanity checks */ -HDassert(stream); -HDassert(elmt); + /* Sanity checks */ + HDassert(stream); + HDassert(elmt); -/* Print element */ -HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx); -HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str, - (unsigned long long)*(const uint64_t *)elmt); + /* Print element */ + HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx); + HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str, + (unsigned long long)*(const uint64_t *)elmt); END_FUNC(STATIC) /* end H5EA__test_debug() */ @@ -332,17 +332,17 @@ END_FUNC(STATIC) /* end H5EA__test_debug() */ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5EA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_addr)) -/* Local variables */ -H5EA__ctx_cb_t *ctx; /* Context for callbacks */ + /* Local variables */ + H5EA__ctx_cb_t *ctx; /* Context for callbacks */ -/* Allocate new context structure */ -if (NULL == (ctx = H5FL_MALLOC(H5EA__ctx_cb_t))) - H5E_THROW(H5E_CANTALLOC, "can't allocate extensible array client callback context") + /* Allocate new context structure */ + if (NULL == (ctx = H5FL_MALLOC(H5EA__ctx_cb_t))) + H5E_THROW(H5E_CANTALLOC, "can't allocate extensible array client callback context") -/* Set return value */ -ret_value = ctx; + /* Set return value */ + ret_value = ctx; -CATCH + CATCH END_FUNC(STATIC) /* end H5EA__test_crt_dbg_context() */ @@ -360,13 +360,13 @@ END_FUNC(STATIC) /* end H5EA__test_crt_dbg_context() */ */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5EA__test_dst_dbg_context(void *_ctx)) -/* Local variables */ -H5EA__ctx_cb_t *ctx = (H5EA__ctx_cb_t *)_ctx; /* Callback context to destroy */ + /* Local variables */ + H5EA__ctx_cb_t *ctx = (H5EA__ctx_cb_t *)_ctx; /* Callback context to destroy */ -HDassert(_ctx); + HDassert(_ctx); -/* Release context structure */ -ctx = H5FL_FREE(H5EA__ctx_cb_t, ctx); + /* Release context structure */ + ctx = H5FL_FREE(H5EA__ctx_cb_t, ctx); END_FUNC(STATIC) /* end H5EA__test_dst_dbg_context() */ @@ -385,17 +385,17 @@ END_FUNC(STATIC) /* end H5EA__test_dst_dbg_context() */ */ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam)) -/* Check arguments. */ -HDassert(ea); -HDassert(cparam); + /* Check arguments. */ + HDassert(ea); + HDassert(cparam); -/* Get extensible array creation parameters */ -cparam->raw_elmt_size = ea->hdr->cparam.raw_elmt_size; -cparam->max_nelmts_bits = ea->hdr->cparam.max_nelmts_bits; -cparam->idx_blk_elmts = ea->hdr->cparam.idx_blk_elmts; -cparam->sup_blk_min_data_ptrs = ea->hdr->cparam.sup_blk_min_data_ptrs; -cparam->data_blk_min_elmts = ea->hdr->cparam.data_blk_min_elmts; -cparam->max_dblk_page_nelmts_bits = ea->hdr->cparam.max_dblk_page_nelmts_bits; + /* Get extensible array creation parameters */ + cparam->raw_elmt_size = ea->hdr->cparam.raw_elmt_size; + cparam->max_nelmts_bits = ea->hdr->cparam.max_nelmts_bits; + cparam->idx_blk_elmts = ea->hdr->cparam.idx_blk_elmts; + cparam->sup_blk_min_data_ptrs = ea->hdr->cparam.sup_blk_min_data_ptrs; + cparam->data_blk_min_elmts = ea->hdr->cparam.data_blk_min_elmts; + cparam->max_dblk_page_nelmts_bits = ea->hdr->cparam.max_dblk_page_nelmts_bits; END_FUNC(PKG) /* end H5EA__get_cparam_test() */ @@ -415,36 +415,36 @@ END_FUNC(PKG) /* end H5EA__get_cparam_test() */ BEGIN_FUNC(PKG, ERRCATCH, int, 0, -, H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2)) -/* Check arguments. */ -HDassert(cparam1); -HDassert(cparam2); - -/* Compare creation parameters for array */ -if (cparam1->raw_elmt_size < cparam2->raw_elmt_size) - H5_LEAVE(-1) -else if (cparam1->raw_elmt_size > cparam2->raw_elmt_size) - H5_LEAVE(1) -if (cparam1->max_nelmts_bits < cparam2->max_nelmts_bits) - H5_LEAVE(-1) -else if (cparam1->max_nelmts_bits > cparam2->max_nelmts_bits) - H5_LEAVE(1) -if (cparam1->idx_blk_elmts < cparam2->idx_blk_elmts) - H5_LEAVE(-1) -else if (cparam1->idx_blk_elmts > cparam2->idx_blk_elmts) - H5_LEAVE(1) -if (cparam1->sup_blk_min_data_ptrs < cparam2->sup_blk_min_data_ptrs) - H5_LEAVE(-1) -else if (cparam1->sup_blk_min_data_ptrs > cparam2->sup_blk_min_data_ptrs) - H5_LEAVE(1) -if (cparam1->data_blk_min_elmts < cparam2->data_blk_min_elmts) - H5_LEAVE(-1) -else if (cparam1->data_blk_min_elmts > cparam2->data_blk_min_elmts) - H5_LEAVE(1) -if (cparam1->max_dblk_page_nelmts_bits < cparam2->max_dblk_page_nelmts_bits) - H5_LEAVE(-1) -else if (cparam1->max_dblk_page_nelmts_bits > cparam2->max_dblk_page_nelmts_bits) - H5_LEAVE(1) - -CATCH + /* Check arguments. */ + HDassert(cparam1); + HDassert(cparam2); + + /* Compare creation parameters for array */ + if (cparam1->raw_elmt_size < cparam2->raw_elmt_size) + H5_LEAVE(-1) + else if (cparam1->raw_elmt_size > cparam2->raw_elmt_size) + H5_LEAVE(1) + if (cparam1->max_nelmts_bits < cparam2->max_nelmts_bits) + H5_LEAVE(-1) + else if (cparam1->max_nelmts_bits > cparam2->max_nelmts_bits) + H5_LEAVE(1) + if (cparam1->idx_blk_elmts < cparam2->idx_blk_elmts) + H5_LEAVE(-1) + else if (cparam1->idx_blk_elmts > cparam2->idx_blk_elmts) + H5_LEAVE(1) + if (cparam1->sup_blk_min_data_ptrs < cparam2->sup_blk_min_data_ptrs) + H5_LEAVE(-1) + else if (cparam1->sup_blk_min_data_ptrs > cparam2->sup_blk_min_data_ptrs) + H5_LEAVE(1) + if (cparam1->data_blk_min_elmts < cparam2->data_blk_min_elmts) + H5_LEAVE(-1) + else if (cparam1->data_blk_min_elmts > cparam2->data_blk_min_elmts) + H5_LEAVE(1) + if (cparam1->max_dblk_page_nelmts_bits < cparam2->max_dblk_page_nelmts_bits) + H5_LEAVE(-1) + else if (cparam1->max_dblk_page_nelmts_bits > cparam2->max_dblk_page_nelmts_bits) + H5_LEAVE(1) + + CATCH END_FUNC(PKG) /* end H5EA__cmp_cparam_test() */ diff --git a/src/H5Edeprec.c b/src/H5Edeprec.c index e3ed7da..d3eef5d 100644 --- a/src/H5Edeprec.c +++ b/src/H5Edeprec.c @@ -35,7 +35,6 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ #include "H5Epkg.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ @@ -187,7 +186,7 @@ done: * same parameter as the old function, in contrary to * H5Epush2. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Tuesday, Sep 16, 2003 @@ -217,7 +216,7 @@ done: * Purpose: This function is for backward compatibility. * Clears the error stack for the specified error stack. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Wednesday, July 16, 2003 @@ -250,7 +249,7 @@ done: * prints error messages. Users are encouraged to write there * own more specific error handlers. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Sep 16, 2003 @@ -286,7 +285,7 @@ done: * Walks the error stack for the current thread and calls some * function for each error along the way. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Sep 16, 2003 @@ -327,7 +326,7 @@ done: * Either (or both) arguments may be null in which case the * value is not returned. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Sep 16, 2003 @@ -380,7 +379,7 @@ done: * Automatic stack traversal is always in the H5E_WALK_DOWNWARD * direction. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Sep 16, 2003 diff --git a/src/H5Eint.c b/src/H5Eint.c index 78b28de..c743ddb 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -650,11 +650,7 @@ herr_t H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, ...) { - va_list ap; /* Varargs info */ -#ifndef H5_HAVE_VASPRINTF - int tmp_len; /* Current size of description buffer */ - int desc_len; /* Actual length of description when formatted */ -#endif /* H5_HAVE_VASPRINTF */ + va_list ap; /* Varargs info */ char * tmp = NULL; /* Buffer to place formatted description in */ hbool_t va_started = FALSE; /* Whether the variable argument list is open */ herr_t ret_value = SUCCEED; /* Return value */ @@ -683,31 +679,9 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin HDva_start(ap, fmt); va_started = TRUE; -#ifdef H5_HAVE_VASPRINTF /* Use the vasprintf() routine, since it does what we're trying to do below */ if (HDvasprintf(&tmp, fmt, ap) < 0) HGOTO_DONE(FAIL) -#else /* H5_HAVE_VASPRINTF */ - /* Allocate space for the formatted description buffer */ - tmp_len = 128; - if (NULL == (tmp = H5MM_malloc((size_t)tmp_len))) - HGOTO_DONE(FAIL) - - /* If the description doesn't fit into the initial buffer size, allocate more space and try again */ - while ((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) { - /* shutdown & restart the va_list */ - HDva_end(ap); - HDva_start(ap, fmt); - - /* Release the previous description, it's too small */ - H5MM_xfree(tmp); - - /* Allocate a description of the appropriate length */ - tmp_len = desc_len + 1; - if (NULL == (tmp = H5MM_malloc((size_t)tmp_len))) - HGOTO_DONE(FAIL) - } /* end while */ -#endif /* H5_HAVE_VASPRINTF */ /* Push the error on the stack */ if (H5E__push_stack(estack, file, func, line, cls_id, maj_id, min_id, tmp) < 0) @@ -716,16 +690,11 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin done: if (va_started) HDva_end(ap); -#ifdef H5_HAVE_VASPRINTF /* Memory was allocated with HDvasprintf so it needs to be freed * with HDfree */ if (tmp) HDfree(tmp); -#else /* H5_HAVE_VASPRINTF */ - if (tmp) - H5MM_xfree(tmp); -#endif /* H5_HAVE_VASPRINTF */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_printf_stack() */ diff --git a/src/H5F.c b/src/H5F.c index 7cafd82..3c6df2b 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -68,8 +68,6 @@ typedef struct { /* Local Prototypes */ /********************/ -static herr_t H5F__close_cb(H5VL_object_t *file_vol_obj); - /* Callback for getting object counts in a file */ static int H5F__get_all_count_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key); @@ -80,9 +78,6 @@ static int H5F__get_all_ids_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t obj_id, void /* Package Variables */ /*********************/ -/* Package initialization variable */ -hbool_t H5_PKG_INIT_VAR = FALSE; - /*****************************/ /* Library Private Variables */ /*****************************/ @@ -97,146 +92,6 @@ H5FL_EXTERN(H5VL_t); /* Declare a free list to manage the H5VL_object_t struct */ H5FL_EXTERN(H5VL_object_t); -/* File ID class */ -static const H5I_class_t H5I_FILE_CLS[1] = {{ - H5I_FILE, /* ID class value */ - 0, /* Class flags */ - 0, /* # of reserved IDs for class */ - (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */ -}}; - -/*------------------------------------------------------------------------- - * Function: H5F_init - * - * Purpose: Initialize the interface from some other layer. - * - * Return: Success: non-negative - * - * Failure: negative - *------------------------------------------------------------------------- - */ -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() */ - -/*-------------------------------------------------------------------------- -NAME - H5F__init_package -- Initialize interface-specific information -USAGE - herr_t H5F__init_package() -RETURNS - Non-negative on success/Negative on failure -DESCRIPTION - Initializes any interface-specific data or routines. - ---------------------------------------------------------------------------*/ -herr_t -H5F__init_package(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* - * Initialize the atom group for the file IDs. - */ - if (H5I_register_type(H5I_FILE_CLS) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to initialize interface") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5F__init_package() */ - -/*------------------------------------------------------------------------- - * Function: H5F_term_package - * - * 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 - * - *------------------------------------------------------------------------- - */ -int -H5F_term_package(void) -{ - int n = 0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if (H5_PKG_INIT_VAR) { - if (H5I_nmembers(H5I_FILE) > 0) { - (void)H5I_clear_type(H5I_FILE, FALSE, FALSE); - n++; /*H5I*/ - } /* end if */ - else { - /* Make certain we've cleaned up all the shared file objects */ - H5F_sfile_assert_num(0); - - /* Destroy the file object id group */ - n += (H5I_dec_type_ref(H5I_FILE) > 0); - - /* Mark closed */ - if (0 == n) - H5_PKG_INIT_VAR = FALSE; - } /* end else */ - } /* end if */ - - FUNC_LEAVE_NOAPI(n) -} /* end H5F_term_package() */ - -/*------------------------------------------------------------------------- - * Function: H5F__close_cb - * - * Purpose: Closes a file or causes the close operation to be pended. - * This function is called from the API and gets called - * by H5Fclose->H5I_dec_ref->H5F__close_cb when H5I_dec_ref() - * decrements the file ID reference count to zero. The file ID - * is removed from the H5I_FILE group by H5I_dec_ref() just - * before H5F__close_cb() is called. If there are open object - * headers then the close is pended by moving the file to the - * H5I_FILE_CLOSING ID group (the f->closing contains the ID - * assigned to file). - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -H5F__close_cb(H5VL_object_t *file_vol_obj) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Sanity check */ - HDassert(file_vol_obj); - - /* Close the file */ - if (H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") - - /* Free the VOL object */ - if (H5VL_free_object(file_vol_obj) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F__close_cb() */ - /*------------------------------------------------------------------------- * Function: H5Fget_create_plist * diff --git a/src/H5FA.c b/src/H5FA.c index 6ca13a8..39b5376 100644 --- a/src/H5FA.c +++ b/src/H5FA.c @@ -108,50 +108,50 @@ H5FL_BLK_DEFINE(fa_native_elmt); BEGIN_FUNC(STATIC, ERR, H5FA_t *, NULL, NULL, H5FA__new(H5F_t *f, haddr_t fa_addr, hbool_t from_open, void *ctx_udata)) -/* Local variables */ -H5FA_t * fa = NULL; /* Pointer to new fixed array */ -H5FA_hdr_t *hdr = NULL; /* The fixed array header information */ + /* Local variables */ + H5FA_t * fa = NULL; /* Pointer to new fixed array */ + H5FA_hdr_t *hdr = NULL; /* The fixed array header information */ -/* - * Check arguments. - */ -HDassert(f); -HDassert(H5F_addr_defined(fa_addr)); + /* + * Check arguments. + */ + HDassert(f); + HDassert(H5F_addr_defined(fa_addr)); -/* Allocate fixed array wrapper */ -if (NULL == (fa = H5FL_CALLOC(H5FA_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array info") + /* Allocate fixed array wrapper */ + if (NULL == (fa = H5FL_CALLOC(H5FA_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array info") -/* Lock the array header into memory */ -if (NULL == (hdr = H5FA__hdr_protect(f, fa_addr, ctx_udata, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") + /* Lock the array header into memory */ + if (NULL == (hdr = H5FA__hdr_protect(f, fa_addr, ctx_udata, H5AC__READ_ONLY_FLAG))) + H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") -/* Check for pending array deletion */ -if (from_open && hdr->pending_delete) - H5E_THROW(H5E_CANTOPENOBJ, "can't open fixed array pending deletion") + /* Check for pending array deletion */ + if (from_open && hdr->pending_delete) + H5E_THROW(H5E_CANTOPENOBJ, "can't open fixed array pending deletion") -/* Point fixed array wrapper at header and bump it's ref count */ -fa->hdr = hdr; -if (H5FA__hdr_incr(fa->hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + /* Point fixed array wrapper at header and bump it's ref count */ + fa->hdr = hdr; + if (H5FA__hdr_incr(fa->hdr) < 0) + H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") -/* Increment # of files using this array header */ -if (H5FA__hdr_fuse_incr(fa->hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header") + /* Increment # of files using this array header */ + if (H5FA__hdr_fuse_incr(fa->hdr) < 0) + H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header") -/* Set file pointer for this array open context */ -fa->f = f; + /* Set file pointer for this array open context */ + fa->f = f; -/* Set the return value */ -ret_value = fa; + /* Set the return value */ + ret_value = fa; -CATCH + CATCH -if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") -if (!ret_value) - if (fa && H5FA_close(fa) < 0) - H5E_THROW(H5E_CLOSEERROR, "unable to close fixed array") + if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") + if (!ret_value) + if (fa && H5FA_close(fa) < 0) + H5E_THROW(H5E_CLOSEERROR, "unable to close fixed array") END_FUNC(STATIC) /* end H5FA__new() */ @@ -171,35 +171,35 @@ END_FUNC(STATIC) /* end H5FA__new() */ BEGIN_FUNC(PRIV, ERR, H5FA_t *, NULL, NULL, H5FA_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata)) -/* Local variables */ -H5FA_t *fa = NULL; /* Pointer to new fixed array */ -haddr_t fa_addr; /* Fixed array header address */ + /* Local variables */ + H5FA_t *fa = NULL; /* Pointer to new fixed array */ + haddr_t fa_addr; /* Fixed array header address */ -/* - * Check arguments. - */ -HDassert(f); -HDassert(cparam); + /* + * Check arguments. + */ + HDassert(f); + HDassert(cparam); -/* H5FA interface sanity check */ -HDcompile_assert(H5FA_NUM_CLS_ID == NELMTS(H5FA_client_class_g)); + /* H5FA interface sanity check */ + HDcompile_assert(H5FA_NUM_CLS_ID == NELMTS(H5FA_client_class_g)); -/* Create fixed array header */ -if (HADDR_UNDEF == (fa_addr = H5FA__hdr_create(f, cparam, ctx_udata))) - H5E_THROW(H5E_CANTINIT, "can't create fixed array header") + /* Create fixed array header */ + if (HADDR_UNDEF == (fa_addr = H5FA__hdr_create(f, cparam, ctx_udata))) + H5E_THROW(H5E_CANTINIT, "can't create fixed array header") -/* Allocate and initialize new fixed array wrapper */ -if (NULL == (fa = H5FA__new(f, fa_addr, FALSE, ctx_udata))) - H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for fixed array wrapper") + /* Allocate and initialize new fixed array wrapper */ + if (NULL == (fa = H5FA__new(f, fa_addr, FALSE, ctx_udata))) + H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for fixed array wrapper") -/* Set the return value */ -ret_value = fa; + /* Set the return value */ + ret_value = fa; -CATCH + CATCH -if (!ret_value) - if (fa && H5FA_close(fa) < 0) - H5E_THROW(H5E_CLOSEERROR, "unable to close fixed array") + if (!ret_value) + if (fa && H5FA_close(fa) < 0) + H5E_THROW(H5E_CLOSEERROR, "unable to close fixed array") END_FUNC(PRIV) /* end H5FA_create() */ @@ -218,27 +218,27 @@ END_FUNC(PRIV) /* end H5FA_create() */ */ BEGIN_FUNC(PRIV, ERR, H5FA_t *, NULL, NULL, H5FA_open(H5F_t *f, haddr_t fa_addr, void *ctx_udata)) -/* Local variables */ -H5FA_t *fa = NULL; /* Pointer to new fixed array wrapper */ + /* Local variables */ + H5FA_t *fa = NULL; /* Pointer to new fixed array wrapper */ -/* - * Check arguments. - */ -HDassert(f); -HDassert(H5F_addr_defined(fa_addr)); + /* + * Check arguments. + */ + HDassert(f); + HDassert(H5F_addr_defined(fa_addr)); -/* Allocate and initialize new fixed array wrapper */ -if (NULL == (fa = H5FA__new(f, fa_addr, TRUE, ctx_udata))) - H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for fixed array wrapper") + /* Allocate and initialize new fixed array wrapper */ + if (NULL == (fa = H5FA__new(f, fa_addr, TRUE, ctx_udata))) + H5E_THROW(H5E_CANTINIT, "allocation and/or initialization failed for fixed array wrapper") -/* Set the return value */ -ret_value = fa; + /* Set the return value */ + ret_value = fa; -CATCH + CATCH -if (!ret_value) - if (fa && H5FA_close(fa) < 0) - H5E_THROW(H5E_CLOSEERROR, "unable to close fixed array") + if (!ret_value) + if (fa && H5FA_close(fa) < 0) + H5E_THROW(H5E_CLOSEERROR, "unable to close fixed array") END_FUNC(PRIV) /* end H5FA_open() */ @@ -256,16 +256,16 @@ END_FUNC(PRIV) /* end H5FA_open() */ */ BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_get_nelmts(const H5FA_t *fa, hsize_t *nelmts)) -/* Local variables */ + /* Local variables */ -/* - * Check arguments. - */ -HDassert(fa); -HDassert(nelmts); + /* + * Check arguments. + */ + HDassert(fa); + HDassert(nelmts); -/* Retrieve the current number of elements in the fixed array */ -*nelmts = fa->hdr->stats.nelmts; + /* Retrieve the current number of elements in the fixed array */ + *nelmts = fa->hdr->stats.nelmts; END_FUNC(PRIV) /* end H5FA_get_nelmts() */ @@ -283,17 +283,17 @@ END_FUNC(PRIV) /* end H5FA_get_nelmts() */ */ BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_get_addr(const H5FA_t *fa, haddr_t *addr)) -/* Local variables */ + /* Local variables */ -/* - * Check arguments. - */ -HDassert(fa); -HDassert(fa->hdr); -HDassert(addr); + /* + * Check arguments. + */ + HDassert(fa); + HDassert(fa->hdr); + HDassert(addr); -/* Retrieve the address of the fixed array's header */ -*addr = fa->hdr->addr; + /* Retrieve the address of the fixed array's header */ + *addr = fa->hdr->addr; END_FUNC(PRIV) /* end H5FA_get_addr() */ @@ -311,99 +311,100 @@ END_FUNC(PRIV) /* end H5FA_get_addr() */ */ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt)) -/* Local variables */ -H5FA_hdr_t * hdr = fa->hdr; /* Header for fixed array */ -H5FA_dblock_t * dblock = NULL; /* Pointer to fixed array Data block */ -H5FA_dblk_page_t *dblk_page = NULL; /* Pointer to fixed array Data block page */ -unsigned dblock_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting fixed array Data block */ -unsigned dblk_page_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting FIxed Array Data block page */ -hbool_t hdr_dirty = FALSE; /* Whether header information changed */ + /* Local variables */ + H5FA_hdr_t * hdr = fa->hdr; /* Header for fixed array */ + H5FA_dblock_t * dblock = NULL; /* Pointer to fixed array Data block */ + H5FA_dblk_page_t *dblk_page = NULL; /* Pointer to fixed array Data block page */ + unsigned dblock_cache_flags = H5AC__NO_FLAGS_SET; /* Flags to unprotecting fixed array Data block */ + unsigned dblk_page_cache_flags = + H5AC__NO_FLAGS_SET; /* Flags to unprotecting FIxed Array Data block page */ + hbool_t hdr_dirty = FALSE; /* Whether header information changed */ + + /* + * Check arguments. + */ + HDassert(fa); + HDassert(fa->hdr); -/* - * Check arguments. - */ -HDassert(fa); -HDassert(fa->hdr); - -/* Set the shared array header's file context for this operation */ -hdr->f = fa->f; - -/* Check if we need to create the fixed array data block */ -if (!H5F_addr_defined(hdr->dblk_addr)) { - /* Create the data block */ - hdr->dblk_addr = H5FA__dblock_create(hdr, &hdr_dirty); - if (!H5F_addr_defined(hdr->dblk_addr)) - H5E_THROW(H5E_CANTCREATE, "unable to create fixed array data block") -} /* end if */ - -HDassert(idx < hdr->cparam.nelmts); - -/* Protect data block */ -if (NULL == (dblock = H5FA__dblock_protect(hdr, hdr->dblk_addr, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", - (unsigned long long)hdr->dblk_addr) - -/* Check for paging data block */ -if (!dblock->npages) { - /* Set element in data block */ - H5MM_memcpy(((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), elmt, - hdr->cparam.cls->nat_elmt_size); - dblock_cache_flags |= H5AC__DIRTIED_FLAG; -} /* end if */ -else { /* paging */ - size_t page_idx; /* Index of page within data block */ - size_t dblk_page_nelmts; /* # of elements in a data block page */ - size_t elmt_idx; /* Element index within the page */ - haddr_t dblk_page_addr; /* Address of data block page */ - - /* Compute the page & element index */ - page_idx = (size_t)(idx / dblock->dblk_page_nelmts); - elmt_idx = (size_t)(idx % dblock->dblk_page_nelmts); - - /* Get the address of the data block page */ - dblk_page_addr = - dblock->addr + H5FA_DBLOCK_PREFIX_SIZE(dblock) + ((hsize_t)page_idx * dblock->dblk_page_size); - - /* Check for using last page, to set the number of elements on the page */ - if ((page_idx + 1) == dblock->npages) - dblk_page_nelmts = dblock->last_page_nelmts; - else - dblk_page_nelmts = dblock->dblk_page_nelmts; - - /* Check if the page has been created yet */ - if (!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { - /* Create the data block page */ - if (H5FA__dblk_page_create(hdr, dblk_page_addr, dblk_page_nelmts) < 0) - H5E_THROW(H5E_CANTCREATE, "unable to create data block page") - - /* Mark data block page as initialized in data block */ - H5VM_bit_set(dblock->dblk_page_init, page_idx, TRUE); - dblock_cache_flags |= H5AC__DIRTIED_FLAG; + /* Set the shared array header's file context for this operation */ + hdr->f = fa->f; + + /* Check if we need to create the fixed array data block */ + if (!H5F_addr_defined(hdr->dblk_addr)) { + /* Create the data block */ + hdr->dblk_addr = H5FA__dblock_create(hdr, &hdr_dirty); + if (!H5F_addr_defined(hdr->dblk_addr)) + H5E_THROW(H5E_CANTCREATE, "unable to create fixed array data block") } /* end if */ - /* Protect the data block page */ - if (NULL == - (dblk_page = H5FA__dblk_page_protect(hdr, dblk_page_addr, dblk_page_nelmts, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", - (unsigned long long)dblk_page_addr) - - /* Set the element in the data block page */ - H5MM_memcpy(((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), elmt, - hdr->cparam.cls->nat_elmt_size); - dblk_page_cache_flags |= H5AC__DIRTIED_FLAG; -} /* end else */ - -CATCH -/* Check for header modified */ -if (hdr_dirty) - if (H5FA__hdr_modified(hdr) < 0) - H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark fixed array header as modified") - -/* Release resources */ -if (dblock && H5FA__dblock_unprotect(dblock, dblock_cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block") -if (dblk_page && H5FA__dblk_page_unprotect(dblk_page, dblk_page_cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page") + HDassert(idx < hdr->cparam.nelmts); + + /* Protect data block */ + if (NULL == (dblock = H5FA__dblock_protect(hdr, hdr->dblk_addr, H5AC__NO_FLAGS_SET))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", + (unsigned long long)hdr->dblk_addr) + + /* Check for paging data block */ + if (!dblock->npages) { + /* Set element in data block */ + H5MM_memcpy(((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), elmt, + hdr->cparam.cls->nat_elmt_size); + dblock_cache_flags |= H5AC__DIRTIED_FLAG; + } /* end if */ + else { /* paging */ + size_t page_idx; /* Index of page within data block */ + size_t dblk_page_nelmts; /* # of elements in a data block page */ + size_t elmt_idx; /* Element index within the page */ + haddr_t dblk_page_addr; /* Address of data block page */ + + /* Compute the page & element index */ + page_idx = (size_t)(idx / dblock->dblk_page_nelmts); + elmt_idx = (size_t)(idx % dblock->dblk_page_nelmts); + + /* Get the address of the data block page */ + dblk_page_addr = + dblock->addr + H5FA_DBLOCK_PREFIX_SIZE(dblock) + ((hsize_t)page_idx * dblock->dblk_page_size); + + /* Check for using last page, to set the number of elements on the page */ + if ((page_idx + 1) == dblock->npages) + dblk_page_nelmts = dblock->last_page_nelmts; + else + dblk_page_nelmts = dblock->dblk_page_nelmts; + + /* Check if the page has been created yet */ + if (!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { + /* Create the data block page */ + if (H5FA__dblk_page_create(hdr, dblk_page_addr, dblk_page_nelmts) < 0) + H5E_THROW(H5E_CANTCREATE, "unable to create data block page") + + /* Mark data block page as initialized in data block */ + H5VM_bit_set(dblock->dblk_page_init, page_idx, TRUE); + dblock_cache_flags |= H5AC__DIRTIED_FLAG; + } /* end if */ + + /* Protect the data block page */ + if (NULL == + (dblk_page = H5FA__dblk_page_protect(hdr, dblk_page_addr, dblk_page_nelmts, H5AC__NO_FLAGS_SET))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", + (unsigned long long)dblk_page_addr) + + /* Set the element in the data block page */ + H5MM_memcpy(((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), elmt, + hdr->cparam.cls->nat_elmt_size); + dblk_page_cache_flags |= H5AC__DIRTIED_FLAG; + } /* end else */ + + CATCH + /* Check for header modified */ + if (hdr_dirty) + if (H5FA__hdr_modified(hdr) < 0) + H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark fixed array header as modified") + + /* Release resources */ + if (dblock && H5FA__dblock_unprotect(dblock, dblock_cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block") + if (dblk_page && H5FA__dblk_page_unprotect(dblk_page, dblk_page_cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page") END_FUNC(PRIV) /* end H5FA_set() */ @@ -421,89 +422,90 @@ END_FUNC(PRIV) /* end H5FA_set() */ */ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt)) -/* Local variables */ -H5FA_hdr_t * hdr = fa->hdr; /* Header for FA */ -H5FA_dblock_t * dblock = NULL; /* Pointer to data block for FA */ -H5FA_dblk_page_t *dblk_page = NULL; /* Pointer to data block page for FA */ - -/* - * Check arguments. - */ -HDassert(fa); -HDassert(fa->hdr); - -/* Set the shared array header's file context for this operation */ -hdr->f = fa->f; - -/* Check if the fixed array data block has been allocated on disk yet */ -if (!H5F_addr_defined(hdr->dblk_addr)) { - /* Call the class's 'fill' callback */ - if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) - H5E_THROW(H5E_CANTSET, "can't set element to class's fill value") -} /* end if */ -else { - /* Get the data block */ - HDassert(H5F_addr_defined(hdr->dblk_addr)); - if (NULL == (dblock = H5FA__dblock_protect(hdr, hdr->dblk_addr, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", - (unsigned long long)hdr->dblk_addr) - - /* Check for paged data block */ - if (!dblock->npages) - /* Retrieve element from data block */ - H5MM_memcpy(elmt, ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), - hdr->cparam.cls->nat_elmt_size); - else { /* paging */ - size_t page_idx; /* Index of page within data block */ + /* Local variables */ + H5FA_hdr_t * hdr = fa->hdr; /* Header for FA */ + H5FA_dblock_t * dblock = NULL; /* Pointer to data block for FA */ + H5FA_dblk_page_t *dblk_page = NULL; /* Pointer to data block page for FA */ - /* Compute the page index */ - page_idx = (size_t)(idx / dblock->dblk_page_nelmts); + /* + * Check arguments. + */ + HDassert(fa); + HDassert(fa->hdr); - /* Check if the page is defined yet */ - if (!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { - /* Call the class's 'fill' callback */ - if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) - H5E_THROW(H5E_CANTSET, "can't set element to class's fill value") - - /* We've retrieved the value, leave now */ - H5_LEAVE(SUCCEED) - } /* end if */ - else { /* get the page */ - size_t dblk_page_nelmts; /* # of elements in a data block page */ - size_t elmt_idx; /* Element index within the page */ - haddr_t dblk_page_addr; /* Address of data block page */ - - /* Compute the element index */ - elmt_idx = (size_t)(idx % dblock->dblk_page_nelmts); - - /* Compute the address of the data block */ - dblk_page_addr = - dblock->addr + H5FA_DBLOCK_PREFIX_SIZE(dblock) + ((hsize_t)page_idx * dblock->dblk_page_size); - - /* Check for using last page, to set the number of elements on the page */ - if ((page_idx + 1) == dblock->npages) - dblk_page_nelmts = dblock->last_page_nelmts; - else - dblk_page_nelmts = dblock->dblk_page_nelmts; - - /* Protect the data block page */ - if (NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dblk_page_addr, dblk_page_nelmts, - H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", - (unsigned long long)dblk_page_addr) + /* Set the shared array header's file context for this operation */ + hdr->f = fa->f; + /* Check if the fixed array data block has been allocated on disk yet */ + if (!H5F_addr_defined(hdr->dblk_addr)) { + /* Call the class's 'fill' callback */ + if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) + H5E_THROW(H5E_CANTSET, "can't set element to class's fill value") + } /* end if */ + else { + /* Get the data block */ + HDassert(H5F_addr_defined(hdr->dblk_addr)); + if (NULL == (dblock = H5FA__dblock_protect(hdr, hdr->dblk_addr, H5AC__READ_ONLY_FLAG))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", + (unsigned long long)hdr->dblk_addr) + + /* Check for paged data block */ + if (!dblock->npages) /* Retrieve element from data block */ - H5MM_memcpy(elmt, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), + H5MM_memcpy(elmt, ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), hdr->cparam.cls->nat_elmt_size); - } /* end else */ - } /* end else */ -} /* end else */ - -CATCH -if (dblock && H5FA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block") -if (dblk_page && H5FA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page") + else { /* paging */ + size_t page_idx; /* Index of page within data block */ + + /* Compute the page index */ + page_idx = (size_t)(idx / dblock->dblk_page_nelmts); + + /* Check if the page is defined yet */ + if (!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { + /* Call the class's 'fill' callback */ + if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) + H5E_THROW(H5E_CANTSET, "can't set element to class's fill value") + + /* We've retrieved the value, leave now */ + H5_LEAVE(SUCCEED) + } /* end if */ + else { /* get the page */ + size_t dblk_page_nelmts; /* # of elements in a data block page */ + size_t elmt_idx; /* Element index within the page */ + haddr_t dblk_page_addr; /* Address of data block page */ + + /* Compute the element index */ + elmt_idx = (size_t)(idx % dblock->dblk_page_nelmts); + + /* Compute the address of the data block */ + dblk_page_addr = dblock->addr + H5FA_DBLOCK_PREFIX_SIZE(dblock) + + ((hsize_t)page_idx * dblock->dblk_page_size); + + /* Check for using last page, to set the number of elements on the page */ + if ((page_idx + 1) == dblock->npages) + dblk_page_nelmts = dblock->last_page_nelmts; + else + dblk_page_nelmts = dblock->dblk_page_nelmts; + + /* Protect the data block page */ + if (NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dblk_page_addr, dblk_page_nelmts, + H5AC__READ_ONLY_FLAG))) + H5E_THROW(H5E_CANTPROTECT, + "unable to protect fixed array data block page, address = %llu", + (unsigned long long)dblk_page_addr) + + /* Retrieve element from data block */ + H5MM_memcpy(elmt, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), + hdr->cparam.cls->nat_elmt_size); + } /* end else */ + } /* end else */ + } /* end else */ + + CATCH + if (dblock && H5FA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block") + if (dblk_page && H5FA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page") END_FUNC(PRIV) /* end H5FA_get() */ @@ -521,86 +523,87 @@ END_FUNC(PRIV) /* end H5FA_get() */ */ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_close(H5FA_t *fa)) -/* Local variables */ -hbool_t pending_delete = FALSE; /* Whether the array is pending deletion */ -haddr_t fa_addr = HADDR_UNDEF; /* Address of array (for deletion) */ + /* Local variables */ + hbool_t pending_delete = FALSE; /* Whether the array is pending deletion */ + haddr_t fa_addr = HADDR_UNDEF; /* Address of array (for deletion) */ -/* - * Check arguments. - */ -HDassert(fa); + /* + * Check arguments. + */ + HDassert(fa); -/* Close the header, if it was set */ -if (fa->hdr) { - /* Decrement file reference & check if this is the last open fixed array using the shared array header */ - if (0 == H5FA__hdr_fuse_decr(fa->hdr)) { - /* Set the shared array header's file context for this operation */ - fa->hdr->f = fa->f; - - /* Shut down anything that can't be put in the header's 'flush' callback */ + /* Close the header, if it was set */ + if (fa->hdr) { + /* Decrement file reference & check if this is the last open fixed array using the shared array header + */ + if (0 == H5FA__hdr_fuse_decr(fa->hdr)) { + /* Set the shared array header's file context for this operation */ + fa->hdr->f = fa->f; + + /* Shut down anything that can't be put in the header's 'flush' callback */ + + /* Check for pending array deletion */ + if (fa->hdr->pending_delete) { + /* Set local info, so array deletion can occur after decrementing the + * header's ref count + */ + pending_delete = TRUE; + fa_addr = fa->hdr->addr; + } /* end if */ + } /* end if */ /* Check for pending array deletion */ - if (fa->hdr->pending_delete) { - /* Set local info, so array deletion can occur after decrementing the - * header's ref count - */ - pending_delete = TRUE; - fa_addr = fa->hdr->addr; - } /* end if */ - } /* end if */ - - /* Check for pending array deletion */ - if (pending_delete) { - H5FA_hdr_t *hdr; /* Another pointer to fixed array header */ + if (pending_delete) { + H5FA_hdr_t *hdr; /* Another pointer to fixed array header */ #ifndef NDEBUG - { - unsigned hdr_status = 0; /* Header's status in the metadata cache */ - - /* Check the header's status in the metadata cache */ - if (H5AC_get_entry_status(fa->f, fa_addr, &hdr_status) < 0) - H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for fixed array header") - - /* Sanity checks on header */ - HDassert(hdr_status & H5AC_ES__IN_CACHE); - HDassert(hdr_status & H5AC_ES__IS_PINNED); - HDassert(!(hdr_status & H5AC_ES__IS_PROTECTED)); - } + { + unsigned hdr_status = 0; /* Header's status in the metadata cache */ + + /* Check the header's status in the metadata cache */ + if (H5AC_get_entry_status(fa->f, fa_addr, &hdr_status) < 0) + H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for fixed array header") + + /* Sanity checks on header */ + HDassert(hdr_status & H5AC_ES__IN_CACHE); + HDassert(hdr_status & H5AC_ES__IS_PINNED); + HDassert(!(hdr_status & H5AC_ES__IS_PROTECTED)); + } #endif /* NDEBUG */ - /* Lock the array header into memory */ - /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */ - if (NULL == (hdr = H5FA__hdr_protect(fa->f, fa_addr, NULL, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTLOAD, "unable to load fixed array header") + /* Lock the array header into memory */ + /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */ + if (NULL == (hdr = H5FA__hdr_protect(fa->f, fa_addr, NULL, H5AC__NO_FLAGS_SET))) + H5E_THROW(H5E_CANTLOAD, "unable to load fixed array header") - /* Set the shared array header's file context for this operation */ - hdr->f = fa->f; + /* Set the shared array header's file context for this operation */ + hdr->f = fa->f; - /* Decrement the reference count on the array header */ - /* (don't put in H5FA_hdr_fuse_decr() as the array header may be evicted - * immediately -QAK) - */ - if (H5FA__hdr_decr(fa->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + /* Decrement the reference count on the array header */ + /* (don't put in H5FA_hdr_fuse_decr() as the array header may be evicted + * immediately -QAK) + */ + if (H5FA__hdr_decr(fa->hdr) < 0) + H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") - /* Delete array, starting with header (unprotects header) */ - if (H5FA__hdr_delete(hdr) < 0) - H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array") - } /* end if */ - else { - /* Decrement the reference count on the array header */ - /* (don't put in H5FA_hdr_fuse_decr() as the array header may be evicted - * immediately -QAK) - */ - if (H5FA__hdr_decr(fa->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") - } /* end else */ -} /* end if */ + /* Delete array, starting with header (unprotects header) */ + if (H5FA__hdr_delete(hdr) < 0) + H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array") + } /* end if */ + else { + /* Decrement the reference count on the array header */ + /* (don't put in H5FA_hdr_fuse_decr() as the array header may be evicted + * immediately -QAK) + */ + if (H5FA__hdr_decr(fa->hdr) < 0) + H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + } /* end else */ + } /* end if */ -/* Release the fixed array wrapper */ -fa = H5FL_FREE(H5FA_t, fa); + /* Release the fixed array wrapper */ + fa = H5FL_FREE(H5FA_t, fa); -CATCH + CATCH END_FUNC(PRIV) /* end H5FA_close() */ @@ -618,38 +621,38 @@ END_FUNC(PRIV) /* end H5FA_close() */ */ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_delete(H5F_t *f, haddr_t fa_addr, void *ctx_udata)) -/* Local variables */ -H5FA_hdr_t *hdr = NULL; /* The fixed array header information */ + /* Local variables */ + H5FA_hdr_t *hdr = NULL; /* The fixed array header information */ -/* - * Check arguments. - */ -HDassert(f); -HDassert(H5F_addr_defined(fa_addr)); - -/* Lock the array header into memory */ -if (NULL == (hdr = H5FA__hdr_protect(f, fa_addr, ctx_udata, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array header, address = %llu", - (unsigned long long)fa_addr) - -/* Check for files using shared array header */ -if (hdr->file_rc) - hdr->pending_delete = TRUE; -else { - /* Set the shared array header's file context for this operation */ - hdr->f = f; + /* + * Check arguments. + */ + HDassert(f); + HDassert(H5F_addr_defined(fa_addr)); - /* Delete array now, starting with header (unprotects header) */ - if (H5FA__hdr_delete(hdr) < 0) - H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array") - hdr = NULL; -} /* end if */ + /* Lock the array header into memory */ + if (NULL == (hdr = H5FA__hdr_protect(f, fa_addr, ctx_udata, H5AC__NO_FLAGS_SET))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array header, address = %llu", + (unsigned long long)fa_addr) -CATCH + /* Check for files using shared array header */ + if (hdr->file_rc) + hdr->pending_delete = TRUE; + else { + /* Set the shared array header's file context for this operation */ + hdr->f = f; -/* Unprotect the header, if an error occurred */ -if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") + /* Delete array now, starting with header (unprotects header) */ + if (H5FA__hdr_delete(hdr) < 0) + H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array") + hdr = NULL; + } /* end if */ + + CATCH + + /* Unprotect the header, if an error occurred */ + if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") END_FUNC(PRIV) /* end H5FA_delete() */ @@ -671,39 +674,39 @@ END_FUNC(PRIV) /* end H5FA_delete() */ BEGIN_FUNC(PRIV, ERR, int, H5_ITER_CONT, H5_ITER_ERROR, H5FA_iterate(H5FA_t *fa, H5FA_operator_t op, void *udata)) -/* Local variables */ -uint8_t *elmt = NULL; -hsize_t u; -int cb_ret = H5_ITER_CONT; /* Return value from callback */ - -/* - * Check arguments. - */ -HDassert(fa); -HDassert(op); -HDassert(udata); - -/* Allocate space for a native array element */ -if (NULL == (elmt = H5FL_BLK_MALLOC(fa_native_elmt, fa->hdr->cparam.cls->nat_elmt_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array element") - -/* Iterate over all elements in array */ -for (u = 0; u < fa->hdr->stats.nelmts && cb_ret == H5_ITER_CONT; u++) { - /* Get array element */ - if (H5FA_get(fa, u, elmt) < 0) - H5E_THROW(H5E_CANTGET, "unable to delete fixed array") - - /* Make callback */ - if ((cb_ret = (*op)(u, elmt, udata)) < 0) { - H5E_PRINTF(H5E_BADITER, "iterator function failed"); - H5_LEAVE(cb_ret) - } /* end if */ -} /* end for */ + /* Local variables */ + uint8_t *elmt = NULL; + hsize_t u; + int cb_ret = H5_ITER_CONT; /* Return value from callback */ + + /* + * Check arguments. + */ + HDassert(fa); + HDassert(op); + HDassert(udata); + + /* Allocate space for a native array element */ + if (NULL == (elmt = H5FL_BLK_MALLOC(fa_native_elmt, fa->hdr->cparam.cls->nat_elmt_size))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array element") + + /* Iterate over all elements in array */ + for (u = 0; u < fa->hdr->stats.nelmts && cb_ret == H5_ITER_CONT; u++) { + /* Get array element */ + if (H5FA_get(fa, u, elmt) < 0) + H5E_THROW(H5E_CANTGET, "unable to delete fixed array") + + /* Make callback */ + if ((cb_ret = (*op)(u, elmt, udata)) < 0) { + H5E_PRINTF(H5E_BADITER, "iterator function failed"); + H5_LEAVE(cb_ret) + } /* end if */ + } /* end for */ -CATCH + CATCH -if (elmt) - elmt = H5FL_BLK_FREE(fa_native_elmt, elmt); + if (elmt) + elmt = H5FL_BLK_FREE(fa_native_elmt, elmt); END_FUNC(PRIV) /* end H5FA_iterate() */ @@ -722,35 +725,35 @@ END_FUNC(PRIV) /* end H5FA_iterate() */ */ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5FA_depend(H5FA_t *fa, H5AC_proxy_entry_t *parent)) -/* Local variables */ -H5FA_hdr_t *hdr = fa->hdr; /* Header for FA */ - -/* - * Check arguments. - */ -HDassert(fa); -HDassert(hdr); -HDassert(parent); - -/* - * Check to see if a flush dependency between the fixed array - * and another data structure in the file has already been set up. - * If it hasn't, do so now. - */ -if (NULL == hdr->parent) { - /* Sanity check */ - HDassert(hdr->top_proxy); + /* Local variables */ + H5FA_hdr_t *hdr = fa->hdr; /* Header for FA */ + + /* + * Check arguments. + */ + HDassert(fa); + HDassert(hdr); + HDassert(parent); + + /* + * Check to see if a flush dependency between the fixed array + * and another data structure in the file has already been set up. + * If it hasn't, do so now. + */ + if (NULL == hdr->parent) { + /* Sanity check */ + HDassert(hdr->top_proxy); - /* Set the shared array header's file context for this operation */ - hdr->f = fa->f; + /* Set the shared array header's file context for this operation */ + hdr->f = fa->f; - /* Add the fixed array as a child of the parent (proxy) */ - if (H5AC_proxy_entry_add_child(parent, hdr->f, hdr->top_proxy) < 0) - H5E_THROW(H5E_CANTSET, "unable to add fixed array as child of proxy") - hdr->parent = parent; -} /* end if */ + /* Add the fixed array as a child of the parent (proxy) */ + if (H5AC_proxy_entry_add_child(parent, hdr->f, hdr->top_proxy) < 0) + H5E_THROW(H5E_CANTSET, "unable to add fixed array as child of proxy") + hdr->parent = parent; + } /* end if */ -CATCH + CATCH END_FUNC(PRIV) /* end H5FA_depend() */ @@ -768,15 +771,15 @@ END_FUNC(PRIV) /* end H5FA_depend() */ */ BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_patch_file(H5FA_t *fa, H5F_t *f)) -/* Local variables */ + /* Local variables */ -/* - * Check arguments. - */ -HDassert(fa); -HDassert(f); + /* + * Check arguments. + */ + HDassert(fa); + HDassert(f); -if (fa->f != f || fa->hdr->f != f) - fa->f = fa->hdr->f = f; + if (fa->f != f || fa->hdr->f != f) + fa->f = fa->hdr->f = f; END_FUNC(PRIV) /* end H5FA_patch_file() */ diff --git a/src/H5FAcache.c b/src/H5FAcache.c index b030bd5..3772399 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -170,16 +170,16 @@ const H5AC_class_t H5AC_FARRAY_DBLK_PAGE[1] = {{ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5FA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len)) -/* Local variables */ -H5FA_hdr_cache_ud_t *udata = (H5FA_hdr_cache_ud_t *)_udata; /* User data for callback */ + /* Local variables */ + H5FA_hdr_cache_ud_t *udata = (H5FA_hdr_cache_ud_t *)_udata; /* User data for callback */ -/* Check arguments */ -HDassert(udata); -HDassert(udata->f); -HDassert(image_len); + /* Check arguments */ + HDassert(udata); + HDassert(udata->f); + HDassert(image_len); -/* Set the image length size */ -*image_len = (size_t)H5FA_HEADER_SIZE_FILE(udata->f); + /* Set the image length size */ + *image_len = (size_t)H5FA_HEADER_SIZE_FILE(udata->f); END_FUNC(STATIC) /* end H5FA__cache_hdr_get_initial_load_size() */ @@ -199,19 +199,19 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_get_initial_load_size() */ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, H5FA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) -/* Local variables */ -const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t stored_chksum; /* Stored metadata checksum value */ -uint32_t computed_chksum; /* Computed metadata checksum value */ + /* Local variables */ + const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + uint32_t computed_chksum; /* Computed metadata checksum value */ -/* Check arguments */ -HDassert(image); + /* Check arguments */ + HDassert(image); -/* Get stored and computed checksums */ -H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); + /* Get stored and computed checksums */ + H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); -if (stored_chksum != computed_chksum) - ret_value = FALSE; + if (stored_chksum != computed_chksum) + ret_value = FALSE; END_FUNC(STATIC) /* end H5FA__cache_hdr_verify_chksum() */ @@ -232,97 +232,97 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5FA__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)) -/* Local variables */ -H5FA_cls_id_t id; /* ID of fixed array class, as found in file */ -H5FA_hdr_t * hdr = NULL; /* Fixed array info */ -H5FA_hdr_cache_ud_t *udata = (H5FA_hdr_cache_ud_t *)_udata; -const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t stored_chksum; /* Stored metadata checksum value */ - -/* Check arguments */ -HDassert(udata); -HDassert(udata->f); -HDassert(H5F_addr_defined(udata->addr)); - -/* Allocate space for the fixed array data structure */ -if (NULL == (hdr = H5FA__hdr_alloc(udata->f))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array shared header") - -/* Set the fixed array header's address */ -hdr->addr = udata->addr; - -/* Magic number */ -if (HDmemcmp(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - H5E_THROW(H5E_BADVALUE, "wrong fixed array header signature") -image += H5_SIZEOF_MAGIC; - -/* Version */ -if (*image++ != H5FA_HDR_VERSION) - H5E_THROW(H5E_VERSION, "wrong fixed array header version") - -/* Fixed array class */ -id = (H5FA_cls_id_t)*image++; -if (id >= H5FA_NUM_CLS_ID) - H5E_THROW(H5E_BADTYPE, "incorrect fixed array class") -hdr->cparam.cls = H5FA_client_class_g[id]; - -/* General array creation/configuration information */ -hdr->cparam.raw_elmt_size = *image++; /* Element size in file (in bytes) */ -hdr->cparam.max_dblk_page_nelmts_bits = *image++; /* Log2(Max. # of elements in data block page) - - i.e. # of bits needed to store max. # of - elements in data block page. */ - -/* Array statistics */ -H5F_DECODE_LENGTH(udata->f, image, hdr->cparam.nelmts); /* Number of elements */ - -/* Internal information */ -H5F_addr_decode(udata->f, &image, &hdr->dblk_addr); /* Address of index block */ - -/* Check for data block */ -if (H5F_addr_defined(hdr->dblk_addr)) { - H5FA_dblock_t dblock; /* Fake data block for computing size */ - size_t dblk_page_nelmts; /* # of elements per data block page */ + /* Local variables */ + H5FA_cls_id_t id; /* ID of fixed array class, as found in file */ + H5FA_hdr_t * hdr = NULL; /* Fixed array info */ + H5FA_hdr_cache_ud_t *udata = (H5FA_hdr_cache_ud_t *)_udata; + const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + + /* Check arguments */ + HDassert(udata); + HDassert(udata->f); + HDassert(H5F_addr_defined(udata->addr)); + + /* Allocate space for the fixed array data structure */ + if (NULL == (hdr = H5FA__hdr_alloc(udata->f))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array shared header") + + /* Set the fixed array header's address */ + hdr->addr = udata->addr; + + /* Magic number */ + if (HDmemcmp(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + H5E_THROW(H5E_BADVALUE, "wrong fixed array header signature") + image += H5_SIZEOF_MAGIC; + + /* Version */ + if (*image++ != H5FA_HDR_VERSION) + H5E_THROW(H5E_VERSION, "wrong fixed array header version") + + /* Fixed array class */ + id = (H5FA_cls_id_t)*image++; + if (id >= H5FA_NUM_CLS_ID) + H5E_THROW(H5E_BADTYPE, "incorrect fixed array class") + hdr->cparam.cls = H5FA_client_class_g[id]; + + /* General array creation/configuration information */ + hdr->cparam.raw_elmt_size = *image++; /* Element size in file (in bytes) */ + hdr->cparam.max_dblk_page_nelmts_bits = *image++; /* Log2(Max. # of elements in data block page) - + i.e. # of bits needed to store max. # of + elements in data block page. */ + + /* Array statistics */ + H5F_DECODE_LENGTH(udata->f, image, hdr->cparam.nelmts); /* Number of elements */ + + /* Internal information */ + H5F_addr_decode(udata->f, &image, &hdr->dblk_addr); /* Address of index block */ + + /* Check for data block */ + if (H5F_addr_defined(hdr->dblk_addr)) { + H5FA_dblock_t dblock; /* Fake data block for computing size */ + size_t dblk_page_nelmts; /* # of elements per data block page */ + + /* Set up fake data block for computing size on disk */ + dblock.hdr = hdr; + dblock.dblk_page_init_size = 0; + dblock.npages = 0; + dblk_page_nelmts = (size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits; + if (hdr->cparam.nelmts > dblk_page_nelmts) { + dblock.npages = (size_t)(((hdr->cparam.nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts); + dblock.dblk_page_init_size = (dblock.npages + 7) / 8; + } /* end if */ - /* Set up fake data block for computing size on disk */ - dblock.hdr = hdr; - dblock.dblk_page_init_size = 0; - dblock.npages = 0; - dblk_page_nelmts = (size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits; - if (hdr->cparam.nelmts > dblk_page_nelmts) { - dblock.npages = (size_t)(((hdr->cparam.nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts); - dblock.dblk_page_init_size = (dblock.npages + 7) / 8; + /* Compute Fixed Array data block size for hdr statistics */ + hdr->stats.dblk_size = (size_t)H5FA_DBLOCK_SIZE(&dblock); } /* end if */ - /* Compute Fixed Array data block size for hdr statistics */ - hdr->stats.dblk_size = (size_t)H5FA_DBLOCK_SIZE(&dblock); -} /* end if */ - -/* Sanity check */ -/* (allow for checksum not decoded yet) */ -HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5FA_SIZEOF_CHKSUM)); + /* Sanity check */ + /* (allow for checksum not decoded yet) */ + HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5FA_SIZEOF_CHKSUM)); -/* checksum verification already done in verify_chksum cb */ + /* checksum verification already done in verify_chksum cb */ -/* Metadata checksum */ -UINT32DECODE(image, stored_chksum); + /* Metadata checksum */ + UINT32DECODE(image, stored_chksum); -/* Sanity check */ -HDassert((size_t)(image - (const uint8_t *)_image) == len); + /* Sanity check */ + HDassert((size_t)(image - (const uint8_t *)_image) == len); -/* Finish initializing fixed array header */ -if (H5FA__hdr_init(hdr, udata->ctx_udata) < 0) - H5E_THROW(H5E_CANTINIT, "initialization failed for fixed array header") -HDassert(hdr->size == len); + /* Finish initializing fixed array header */ + if (H5FA__hdr_init(hdr, udata->ctx_udata) < 0) + H5E_THROW(H5E_CANTINIT, "initialization failed for fixed array header") + HDassert(hdr->size == len); -/* Set return value */ -ret_value = hdr; + /* Set return value */ + ret_value = hdr; -CATCH + CATCH -/* Release resources */ -if (!ret_value) - if (hdr && H5FA__hdr_dest(hdr) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array header") + /* Release resources */ + if (!ret_value) + if (hdr && H5FA__hdr_dest(hdr) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array header") END_FUNC(STATIC) /* end H5FA__cache_hdr_deserialize() */ @@ -341,15 +341,15 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_deserialize() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5FA__cache_hdr_image_len(const void *_thing, size_t *image_len)) -/* Local variables */ -const H5FA_hdr_t *hdr = (const H5FA_hdr_t *)_thing; /* Pointer to the object */ + /* Local variables */ + const H5FA_hdr_t *hdr = (const H5FA_hdr_t *)_thing; /* Pointer to the object */ -/* Check arguments */ -HDassert(hdr); -HDassert(image_len); + /* Check arguments */ + HDassert(hdr); + HDassert(image_len); -/* Set the image length size */ -*image_len = hdr->size; + /* Set the image length size */ + *image_len = hdr->size; END_FUNC(STATIC) /* end H5FA__cache_hdr_image_len() */ @@ -368,47 +368,47 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_image_len() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)) -/* Local variables */ -H5FA_hdr_t *hdr = (H5FA_hdr_t *)_thing; /* Pointer to the fixed array header */ -uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t metadata_chksum; /* Computed metadata checksum value */ + /* Local variables */ + H5FA_hdr_t *hdr = (H5FA_hdr_t *)_thing; /* Pointer to the fixed array header */ + uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t metadata_chksum; /* Computed metadata checksum value */ -/* check arguments */ -HDassert(f); -HDassert(image); -HDassert(hdr); + /* check arguments */ + HDassert(f); + HDassert(image); + HDassert(hdr); -/* Magic number */ -H5MM_memcpy(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); -image += H5_SIZEOF_MAGIC; + /* Magic number */ + H5MM_memcpy(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); + image += H5_SIZEOF_MAGIC; -/* Version # */ -*image++ = H5FA_HDR_VERSION; + /* Version # */ + *image++ = H5FA_HDR_VERSION; -/* Fixed array type */ -HDassert(hdr->cparam.cls->id <= 255); -*image++ = (uint8_t)hdr->cparam.cls->id; + /* Fixed array type */ + HDassert(hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)hdr->cparam.cls->id; -/* General array creation/configuration information */ -*image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ -*image++ = - hdr->cparam.max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in data block page) - i.e. # of bits - needed to store max. # of elements in data block page */ + /* General array creation/configuration information */ + *image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */ + *image++ = + hdr->cparam.max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in data block page) - i.e. # of bits + needed to store max. # of elements in data block page */ -/* Array statistics */ -H5F_ENCODE_LENGTH(f, image, hdr->stats.nelmts); /* Number of elements for the fixed array */ + /* Array statistics */ + H5F_ENCODE_LENGTH(f, image, hdr->stats.nelmts); /* Number of elements for the fixed array */ -/* Internal information */ -H5F_addr_encode(f, &image, hdr->dblk_addr); /* Address of fixed array data block */ + /* Internal information */ + H5F_addr_encode(f, &image, hdr->dblk_addr); /* Address of fixed array data block */ -/* Compute metadata checksum */ -metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); + /* Compute metadata checksum */ + metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); -/* Metadata checksum */ -UINT32ENCODE(image, metadata_chksum); + /* Metadata checksum */ + UINT32ENCODE(image, metadata_chksum); -/* Sanity check */ -HDassert((size_t)(image - (uint8_t *)_image) == len); + /* Sanity check */ + HDassert((size_t)(image - (uint8_t *)_image) == len); END_FUNC(STATIC) /* end H5FA__cache_hdr_serialize() */ @@ -427,65 +427,66 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_serialize() */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5FA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing)) -/* Local variables */ -H5FA_hdr_t *hdr = (H5FA_hdr_t *)_thing; /* Pointer to the object */ - -/* Sanity check */ -HDassert(hdr); - -/* Check if the file was opened with SWMR-write access */ -if (hdr->swmr_write) { - /* Determine which action to take */ - switch (action) { - case H5AC_NOTIFY_ACTION_AFTER_INSERT: - case H5AC_NOTIFY_ACTION_AFTER_LOAD: - case H5AC_NOTIFY_ACTION_AFTER_FLUSH: - case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: - case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: - case H5AC_NOTIFY_ACTION_CHILD_DIRTIED: - case H5AC_NOTIFY_ACTION_CHILD_CLEANED: - case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: - case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: - /* do nothing */ - break; - - case H5AC_NOTIFY_ACTION_BEFORE_EVICT: - /* If hdr->parent != NULL, hdr->parent is used to destroy - * the flush dependency before the header is evicted. - */ - if (hdr->parent) { - /* Sanity check */ - HDassert(hdr->top_proxy); - - /* Destroy flush dependency on object header proxy */ - if (H5AC_proxy_entry_remove_child((H5AC_proxy_entry_t *)hdr->parent, (void *)hdr->top_proxy) < - 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between fixed array and proxy") - hdr->parent = NULL; - } /* end if */ - - /* Detach from 'top' proxy for fixed array */ - if (hdr->top_proxy) { - if (H5AC_proxy_entry_remove_child(hdr->top_proxy, hdr) < 0) - H5E_THROW(H5E_CANTUNDEPEND, - "unable to destroy flush dependency between header and fixed array 'top' proxy") - /* Don't reset hdr->top_proxy here, it's destroyed when the header is freed -QAK */ - } /* end if */ - break; - - default: + /* Local variables */ + H5FA_hdr_t *hdr = (H5FA_hdr_t *)_thing; /* Pointer to the object */ + + /* Sanity check */ + HDassert(hdr); + + /* Check if the file was opened with SWMR-write access */ + if (hdr->swmr_write) { + /* Determine which action to take */ + switch (action) { + case H5AC_NOTIFY_ACTION_AFTER_INSERT: + case H5AC_NOTIFY_ACTION_AFTER_LOAD: + case H5AC_NOTIFY_ACTION_AFTER_FLUSH: + case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: + case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: + case H5AC_NOTIFY_ACTION_CHILD_DIRTIED: + case H5AC_NOTIFY_ACTION_CHILD_CLEANED: + case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: + case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: + /* do nothing */ + break; + + case H5AC_NOTIFY_ACTION_BEFORE_EVICT: + /* If hdr->parent != NULL, hdr->parent is used to destroy + * the flush dependency before the header is evicted. + */ + if (hdr->parent) { + /* Sanity check */ + HDassert(hdr->top_proxy); + + /* Destroy flush dependency on object header proxy */ + if (H5AC_proxy_entry_remove_child((H5AC_proxy_entry_t *)hdr->parent, + (void *)hdr->top_proxy) < 0) + H5E_THROW(H5E_CANTUNDEPEND, + "unable to destroy flush dependency between fixed array and proxy") + hdr->parent = NULL; + } /* end if */ + + /* Detach from 'top' proxy for fixed array */ + if (hdr->top_proxy) { + if (H5AC_proxy_entry_remove_child(hdr->top_proxy, hdr) < 0) + H5E_THROW( + H5E_CANTUNDEPEND, + "unable to destroy flush dependency between header and fixed array 'top' proxy") + /* Don't reset hdr->top_proxy here, it's destroyed when the header is freed -QAK */ + } /* end if */ + break; + + default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") -#else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); -#endif /* NDEBUG */ - } /* end switch */ -} /* end if */ -else - HDassert(NULL == hdr->parent); + H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") +#else /* NDEBUG */ + HDassert(0 && "Unknown action?!?"); +#endif /* NDEBUG */ + } /* end switch */ + } /* end if */ + else + HDassert(NULL == hdr->parent); -CATCH + CATCH END_FUNC(STATIC) /* end H5FA__cache_hdr_notify() */ @@ -504,14 +505,14 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_notify() */ */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5FA__cache_hdr_free_icr(void *thing)) -/* Check arguments */ -HDassert(thing); + /* Check arguments */ + HDassert(thing); -/* Release the extensible array header */ -if (H5FA__hdr_dest((H5FA_hdr_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free fixed array header") + /* Release the extensible array header */ + if (H5FA__hdr_dest((H5FA_hdr_t *)thing) < 0) + H5E_THROW(H5E_CANTFREE, "can't free fixed array header") -CATCH + CATCH END_FUNC(STATIC) /* end H5FA__cache_hdr_free_icr() */ @@ -530,38 +531,38 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_free_icr() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5FA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len)) -/* Local variables */ -H5FA_dblock_cache_ud_t *udata = (H5FA_dblock_cache_ud_t *)_udata; /* User data */ -H5FA_dblock_t dblock; /* Fake data block for computing size */ -size_t dblk_page_nelmts; /* # of elements per data block page */ + /* Local variables */ + H5FA_dblock_cache_ud_t *udata = (H5FA_dblock_cache_ud_t *)_udata; /* User data */ + H5FA_dblock_t dblock; /* Fake data block for computing size */ + size_t dblk_page_nelmts; /* # of elements per data block page */ -/* Check arguments */ -HDassert(udata); -HDassert(udata->hdr); -HDassert(image_len); + /* Check arguments */ + HDassert(udata); + HDassert(udata->hdr); + HDassert(image_len); -/* Set up fake data block for computing size on disk */ -/* (Note: extracted from H5FA__dblock_alloc) */ -HDmemset(&dblock, 0, sizeof(dblock)); + /* Set up fake data block for computing size on disk */ + /* (Note: extracted from H5FA__dblock_alloc) */ + HDmemset(&dblock, 0, sizeof(dblock)); + + /* Set up fake data block for computing size on disk + * + * need: dblock->hdr + * dblock->npages + * dblock->dblk_page_init_size + */ + dblock.hdr = udata->hdr; + dblk_page_nelmts = (size_t)1 << udata->hdr->cparam.max_dblk_page_nelmts_bits; + if (udata->hdr->cparam.nelmts > dblk_page_nelmts) { + dblock.npages = (size_t)(((udata->hdr->cparam.nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts); + dblock.dblk_page_init_size = (dblock.npages + 7) / 8; + } /* end if */ -/* Set up fake data block for computing size on disk - * - * need: dblock->hdr - * dblock->npages - * dblock->dblk_page_init_size - */ -dblock.hdr = udata->hdr; -dblk_page_nelmts = (size_t)1 << udata->hdr->cparam.max_dblk_page_nelmts_bits; -if (udata->hdr->cparam.nelmts > dblk_page_nelmts) { - dblock.npages = (size_t)(((udata->hdr->cparam.nelmts + dblk_page_nelmts) - 1) / dblk_page_nelmts); - dblock.dblk_page_init_size = (dblock.npages + 7) / 8; -} /* end if */ - -/* Set the image length size */ -if (!dblock.npages) - *image_len = (size_t)H5FA_DBLOCK_SIZE(&dblock); -else - *image_len = (size_t)H5FA_DBLOCK_PREFIX_SIZE(&dblock); + /* Set the image length size */ + if (!dblock.npages) + *image_len = (size_t)H5FA_DBLOCK_SIZE(&dblock); + else + *image_len = (size_t)H5FA_DBLOCK_PREFIX_SIZE(&dblock); END_FUNC(STATIC) /* end H5FA__cache_dblock_get_initial_load_size() */ @@ -581,19 +582,19 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_get_initial_load_size() */ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, H5FA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) -/* Local variables */ -const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t stored_chksum; /* Stored metadata checksum value */ -uint32_t computed_chksum; /* Computed metadata checksum value */ + /* Local variables */ + const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + uint32_t computed_chksum; /* Computed metadata checksum value */ -/* Check arguments */ -HDassert(image); + /* Check arguments */ + HDassert(image); -/* Get stored and computed checksums */ -H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); + /* Get stored and computed checksums */ + H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); -if (stored_chksum != computed_chksum) - ret_value = FALSE; + if (stored_chksum != computed_chksum) + ret_value = FALSE; END_FUNC(STATIC) /* end H5FA__cache_dblock_verify_chksum() */ @@ -614,85 +615,85 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5FA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)) -/* Local variables */ -H5FA_dblock_t * dblock = NULL; /* Data block info */ -H5FA_dblock_cache_ud_t *udata = (H5FA_dblock_cache_ud_t *)_udata; /* User data for loading data block */ -const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t stored_chksum; /* Stored metadata checksum value */ -haddr_t arr_addr; /* Address of array header in the file */ - -/* Sanity check */ -HDassert(udata); -HDassert(udata->hdr); - -/* Allocate the fixed array data block */ -if (NULL == (dblock = H5FA__dblock_alloc(udata->hdr))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") - -HDassert(((!dblock->npages) && (len == (size_t)H5FA_DBLOCK_SIZE(dblock))) || - (len == (size_t)H5FA_DBLOCK_PREFIX_SIZE(dblock))); - -/* Set the fixed array data block's information */ -dblock->addr = udata->dblk_addr; - -/* Magic number */ -if (HDmemcmp(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) - H5E_THROW(H5E_BADVALUE, "wrong fixed array data block signature") -image += H5_SIZEOF_MAGIC; - -/* Version */ -if (*image++ != H5FA_DBLOCK_VERSION) - H5E_THROW(H5E_VERSION, "wrong fixed array data block version") - -/* Fixed array type */ -if (*image++ != (uint8_t)udata->hdr->cparam.cls->id) - H5E_THROW(H5E_BADTYPE, "incorrect fixed array class") - -/* Address of header for array that owns this block (just for file integrity checks) */ -H5F_addr_decode(udata->hdr->f, &image, &arr_addr); -if (H5F_addr_ne(arr_addr, udata->hdr->addr)) - H5E_THROW(H5E_BADVALUE, "wrong fixed array header address") - -/* Page initialization flags */ -if (dblock->npages > 0) { - H5MM_memcpy(dblock->dblk_page_init, image, dblock->dblk_page_init_size); - image += dblock->dblk_page_init_size; -} /* end if */ - -/* Only decode elements if the data block is not paged */ -if (!dblock->npages) { - /* Decode elements in data block */ - /* Convert from raw elements on disk into native elements in memory */ - if ((udata->hdr->cparam.cls->decode)(image, dblock->elmts, (size_t)udata->hdr->cparam.nelmts, - udata->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTDECODE, "can't decode fixed array data elements") - image += (udata->hdr->cparam.nelmts * udata->hdr->cparam.raw_elmt_size); -} /* end if */ + /* Local variables */ + H5FA_dblock_t * dblock = NULL; /* Data block info */ + H5FA_dblock_cache_ud_t *udata = (H5FA_dblock_cache_ud_t *)_udata; /* User data for loading data block */ + const uint8_t * image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + haddr_t arr_addr; /* Address of array header in the file */ + + /* Sanity check */ + HDassert(udata); + HDassert(udata->hdr); + + /* Allocate the fixed array data block */ + if (NULL == (dblock = H5FA__dblock_alloc(udata->hdr))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") + + HDassert(((!dblock->npages) && (len == (size_t)H5FA_DBLOCK_SIZE(dblock))) || + (len == (size_t)H5FA_DBLOCK_PREFIX_SIZE(dblock))); + + /* Set the fixed array data block's information */ + dblock->addr = udata->dblk_addr; + + /* Magic number */ + if (HDmemcmp(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + H5E_THROW(H5E_BADVALUE, "wrong fixed array data block signature") + image += H5_SIZEOF_MAGIC; + + /* Version */ + if (*image++ != H5FA_DBLOCK_VERSION) + H5E_THROW(H5E_VERSION, "wrong fixed array data block version") + + /* Fixed array type */ + if (*image++ != (uint8_t)udata->hdr->cparam.cls->id) + H5E_THROW(H5E_BADTYPE, "incorrect fixed array class") + + /* Address of header for array that owns this block (just for file integrity checks) */ + H5F_addr_decode(udata->hdr->f, &image, &arr_addr); + if (H5F_addr_ne(arr_addr, udata->hdr->addr)) + H5E_THROW(H5E_BADVALUE, "wrong fixed array header address") + + /* Page initialization flags */ + if (dblock->npages > 0) { + H5MM_memcpy(dblock->dblk_page_init, image, dblock->dblk_page_init_size); + image += dblock->dblk_page_init_size; + } /* end if */ -/* Sanity check */ -/* (allow for checksum not decoded yet) */ -HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5FA_SIZEOF_CHKSUM)); + /* Only decode elements if the data block is not paged */ + if (!dblock->npages) { + /* Decode elements in data block */ + /* Convert from raw elements on disk into native elements in memory */ + if ((udata->hdr->cparam.cls->decode)(image, dblock->elmts, (size_t)udata->hdr->cparam.nelmts, + udata->hdr->cb_ctx) < 0) + H5E_THROW(H5E_CANTDECODE, "can't decode fixed array data elements") + image += (udata->hdr->cparam.nelmts * udata->hdr->cparam.raw_elmt_size); + } /* end if */ + + /* Sanity check */ + /* (allow for checksum not decoded yet) */ + HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5FA_SIZEOF_CHKSUM)); -/* Set the data block's size */ -dblock->size = H5FA_DBLOCK_SIZE(dblock); + /* Set the data block's size */ + dblock->size = H5FA_DBLOCK_SIZE(dblock); -/* checksum verification already done in verify_chksum cb */ + /* checksum verification already done in verify_chksum cb */ -/* Metadata checksum */ -UINT32DECODE(image, stored_chksum); + /* Metadata checksum */ + UINT32DECODE(image, stored_chksum); -/* Sanity check */ -HDassert((size_t)(image - (const uint8_t *)_image) == len); + /* Sanity check */ + HDassert((size_t)(image - (const uint8_t *)_image) == len); -/* Set return value */ -ret_value = dblock; + /* Set return value */ + ret_value = dblock; -CATCH + CATCH -/* Release resources */ -if (!ret_value) - if (dblock && H5FA__dblock_dest(dblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block") + /* Release resources */ + if (!ret_value) + if (dblock && H5FA__dblock_dest(dblock) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block") END_FUNC(STATIC) /* end H5FA__cache_dblock_deserialize() */ @@ -711,18 +712,18 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_deserialize() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5FA__cache_dblock_image_len(const void *_thing, size_t *image_len)) -/* Local variables */ -const H5FA_dblock_t *dblock = (const H5FA_dblock_t *)_thing; /* Pointer to the object */ + /* Local variables */ + const H5FA_dblock_t *dblock = (const H5FA_dblock_t *)_thing; /* Pointer to the object */ -/* Check arguments */ -HDassert(dblock); -HDassert(image_len); + /* Check arguments */ + HDassert(dblock); + HDassert(image_len); -/* Set the image length size */ -if (!dblock->npages) - *image_len = (size_t)dblock->size; -else - *image_len = H5FA_DBLOCK_PREFIX_SIZE(dblock); + /* Set the image length size */ + if (!dblock->npages) + *image_len = (size_t)dblock->size; + else + *image_len = H5FA_DBLOCK_PREFIX_SIZE(dblock); END_FUNC(STATIC) /* end H5FA__cache_dblock_image_len() */ @@ -742,60 +743,60 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)) -/* Local variables */ -H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing; /* Pointer to the object to serialize */ -uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t metadata_chksum; /* Computed metadata checksum value */ + /* Local variables */ + H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing; /* Pointer to the object to serialize */ + uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t metadata_chksum; /* Computed metadata checksum value */ -/* Check arguments */ -HDassert(f); -HDassert(image); -HDassert(dblock); -HDassert(dblock->hdr); + /* Check arguments */ + HDassert(f); + HDassert(image); + HDassert(dblock); + HDassert(dblock->hdr); -/* Magic number */ -H5MM_memcpy(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); -image += H5_SIZEOF_MAGIC; + /* Magic number */ + H5MM_memcpy(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); + image += H5_SIZEOF_MAGIC; -/* Version # */ -*image++ = H5FA_DBLOCK_VERSION; + /* Version # */ + *image++ = H5FA_DBLOCK_VERSION; -/* Fixed array type */ -HDassert(dblock->hdr->cparam.cls->id <= 255); -*image++ = (uint8_t)dblock->hdr->cparam.cls->id; + /* Fixed array type */ + HDassert(dblock->hdr->cparam.cls->id <= 255); + *image++ = (uint8_t)dblock->hdr->cparam.cls->id; -/* Address of array header for array which owns this block */ -H5F_addr_encode(f, &image, dblock->hdr->addr); + /* Address of array header for array which owns this block */ + H5F_addr_encode(f, &image, dblock->hdr->addr); -/* Page init flags */ -if (dblock->npages > 0) { - /* Store the 'page init' bitmasks */ - H5MM_memcpy(image, dblock->dblk_page_init, dblock->dblk_page_init_size); - image += dblock->dblk_page_init_size; -} /* end if */ + /* Page init flags */ + if (dblock->npages > 0) { + /* Store the 'page init' bitmasks */ + H5MM_memcpy(image, dblock->dblk_page_init, dblock->dblk_page_init_size); + image += dblock->dblk_page_init_size; + } /* end if */ -/* Only encode elements if the data block is not paged */ -if (!dblock->npages) { - /* Encode elements in data block */ + /* Only encode elements if the data block is not paged */ + if (!dblock->npages) { + /* Encode elements in data block */ - /* Convert from native elements in memory into raw elements on disk */ - H5_CHECK_OVERFLOW(dblock->hdr->cparam.nelmts, /* From: */ hsize_t, /* To: */ size_t); - if ((dblock->hdr->cparam.cls->encode)(image, dblock->elmts, (size_t)dblock->hdr->cparam.nelmts, - dblock->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTENCODE, "can't encode fixed array data elements") - image += (dblock->hdr->cparam.nelmts * dblock->hdr->cparam.raw_elmt_size); -} /* end if */ + /* Convert from native elements in memory into raw elements on disk */ + H5_CHECK_OVERFLOW(dblock->hdr->cparam.nelmts, /* From: */ hsize_t, /* To: */ size_t); + if ((dblock->hdr->cparam.cls->encode)(image, dblock->elmts, (size_t)dblock->hdr->cparam.nelmts, + dblock->hdr->cb_ctx) < 0) + H5E_THROW(H5E_CANTENCODE, "can't encode fixed array data elements") + image += (dblock->hdr->cparam.nelmts * dblock->hdr->cparam.raw_elmt_size); + } /* end if */ -/* Compute metadata checksum */ -metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); + /* Compute metadata checksum */ + metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); -/* Metadata checksum */ -UINT32ENCODE(image, metadata_chksum); + /* Metadata checksum */ + UINT32ENCODE(image, metadata_chksum); -/* Sanity check */ -HDassert((size_t)(image - (uint8_t *)_image) == len); + /* Sanity check */ + HDassert((size_t)(image - (uint8_t *)_image) == len); -CATCH + CATCH END_FUNC(STATIC) /* end H5FA__cache_dblock_serialize() */ @@ -814,60 +815,60 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_serialize() */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5FA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing)) -/* Local variables */ -H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing; - -/* Sanity check */ -HDassert(dblock); - -/* Check if the file was opened with SWMR-write access */ -if (dblock->hdr->swmr_write) { - /* Determine which action to take */ - switch (action) { - case H5AC_NOTIFY_ACTION_AFTER_INSERT: - case H5AC_NOTIFY_ACTION_AFTER_LOAD: - /* Create flush dependency on parent */ - if (H5FA__create_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0) - H5E_THROW(H5E_CANTDEPEND, - "unable to create flush dependency between data block and header, address = %llu", - (unsigned long long)dblock->addr) - break; - - case H5AC_NOTIFY_ACTION_AFTER_FLUSH: - case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: - case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: - case H5AC_NOTIFY_ACTION_CHILD_DIRTIED: - case H5AC_NOTIFY_ACTION_CHILD_CLEANED: - case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: - case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: - /* do nothing */ - break; + /* Local variables */ + H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing; - case H5AC_NOTIFY_ACTION_BEFORE_EVICT: - /* Destroy flush dependency on parent */ - if (H5FA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency") + /* Sanity check */ + HDassert(dblock); - /* Detach from 'top' proxy for fixed array */ - if (dblock->top_proxy) { - if (H5AC_proxy_entry_remove_child(dblock->top_proxy, dblock) < 0) + /* Check if the file was opened with SWMR-write access */ + if (dblock->hdr->swmr_write) { + /* Determine which action to take */ + switch (action) { + case H5AC_NOTIFY_ACTION_AFTER_INSERT: + case H5AC_NOTIFY_ACTION_AFTER_LOAD: + /* Create flush dependency on parent */ + if (H5FA__create_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0) H5E_THROW( - H5E_CANTUNDEPEND, - "unable to destroy flush dependency between data block and fixed array 'top' proxy") - dblock->top_proxy = NULL; - } /* end if */ - break; - - default: + H5E_CANTDEPEND, + "unable to create flush dependency between data block and header, address = %llu", + (unsigned long long)dblock->addr) + break; + + case H5AC_NOTIFY_ACTION_AFTER_FLUSH: + case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: + case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: + case H5AC_NOTIFY_ACTION_CHILD_DIRTIED: + case H5AC_NOTIFY_ACTION_CHILD_CLEANED: + case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: + case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: + /* do nothing */ + break; + + case H5AC_NOTIFY_ACTION_BEFORE_EVICT: + /* Destroy flush dependency on parent */ + if (H5FA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency") + + /* Detach from 'top' proxy for fixed array */ + if (dblock->top_proxy) { + if (H5AC_proxy_entry_remove_child(dblock->top_proxy, dblock) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block " + "and fixed array 'top' proxy") + dblock->top_proxy = NULL; + } /* end if */ + break; + + default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") -#else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); -#endif /* NDEBUG */ - } /* end switch */ -} /* end if */ + H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") +#else /* NDEBUG */ + HDassert(0 && "Unknown action?!?"); +#endif /* NDEBUG */ + } /* end switch */ + } /* end if */ -CATCH + CATCH END_FUNC(STATIC) /* end H5FA__cache_dblock_notify() */ @@ -886,16 +887,16 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_notify() */ */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5FA__cache_dblock_free_icr(void *_thing)) -H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing; /* Pointer to the object */ + H5FA_dblock_t *dblock = (H5FA_dblock_t *)_thing; /* Pointer to the object */ -/* Check arguments */ -HDassert(dblock); + /* Check arguments */ + HDassert(dblock); -/* Release the fixed array data block */ -if (H5FA__dblock_dest(dblock) < 0) - H5E_THROW(H5E_CANTFREE, "can't free fixed array data block") + /* Release the fixed array data block */ + if (H5FA__dblock_dest(dblock) < 0) + H5E_THROW(H5E_CANTFREE, "can't free fixed array data block") -CATCH + CATCH END_FUNC(STATIC) /* end H5FA__cache_dblock_free_icr() */ @@ -931,15 +932,15 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_free_icr() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5FA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size)) -const H5FA_dblock_t *dblock = (const H5FA_dblock_t *)_thing; /* Pointer to the object */ + const H5FA_dblock_t *dblock = (const H5FA_dblock_t *)_thing; /* Pointer to the object */ -/* Check arguments */ -HDassert(dblock); -HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); -HDassert(dblock->cache_info.type == H5AC_FARRAY_DBLOCK); -HDassert(fsf_size); + /* Check arguments */ + HDassert(dblock); + HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); + HDassert(dblock->cache_info.type == H5AC_FARRAY_DBLOCK); + HDassert(fsf_size); -*fsf_size = dblock->size; + *fsf_size = dblock->size; END_FUNC(STATIC) /* end H5FA__cache_dblock_fsf_size() */ @@ -958,17 +959,17 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_fsf_size() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5FA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len)) -/* Local variables */ -H5FA_dblk_page_cache_ud_t *udata = (H5FA_dblk_page_cache_ud_t *)_udata; /* User data */ + /* Local variables */ + H5FA_dblk_page_cache_ud_t *udata = (H5FA_dblk_page_cache_ud_t *)_udata; /* User data */ -/* Check arguments */ -HDassert(udata); -HDassert(udata->hdr); -HDassert(udata->nelmts > 0); -HDassert(image_len); + /* Check arguments */ + HDassert(udata); + HDassert(udata->hdr); + HDassert(udata->nelmts > 0); + HDassert(image_len); -/* Set the image length size */ -*image_len = (size_t)H5FA_DBLK_PAGE_SIZE(udata->hdr, udata->nelmts); + /* Set the image length size */ + *image_len = (size_t)H5FA_DBLK_PAGE_SIZE(udata->hdr, udata->nelmts); END_FUNC(STATIC) /* end H5FA__cache_dblk_page_get_initial_load_size() */ @@ -988,19 +989,19 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_get_initial_load_size() */ BEGIN_FUNC(STATIC, NOERR, htri_t, TRUE, -, H5FA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSED *_udata)) -/* Local variables */ -const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t stored_chksum; /* Stored metadata checksum value */ -uint32_t computed_chksum; /* Computed metadata checksum value */ + /* Local variables */ + const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + uint32_t computed_chksum; /* Computed metadata checksum value */ -/* Check arguments */ -HDassert(image); + /* Check arguments */ + HDassert(image); -/* Get stored and computed checksums */ -H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); + /* Get stored and computed checksums */ + H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); -if (stored_chksum != computed_chksum) - ret_value = FALSE; + if (stored_chksum != computed_chksum) + ret_value = FALSE; END_FUNC(STATIC) /* end H5FA__cache_dblk_page_verify_chksum() */ @@ -1021,58 +1022,58 @@ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5FA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty)) -/* Local variables */ -H5FA_dblk_page_t * dblk_page = NULL; /* Data block page info */ -H5FA_dblk_page_cache_ud_t *udata = - (H5FA_dblk_page_cache_ud_t *)_udata; /* User data for loading data block page */ -const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t stored_chksum; /* Stored metadata checksum value */ + /* Local variables */ + H5FA_dblk_page_t * dblk_page = NULL; /* Data block page info */ + H5FA_dblk_page_cache_ud_t *udata = + (H5FA_dblk_page_cache_ud_t *)_udata; /* User data for loading data block page */ + const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t stored_chksum; /* Stored metadata checksum value */ -/* Sanity check */ -HDassert(udata); -HDassert(udata->hdr); -HDassert(udata->nelmts > 0); -HDassert(H5F_addr_defined(udata->dblk_page_addr)); + /* Sanity check */ + HDassert(udata); + HDassert(udata->hdr); + HDassert(udata->nelmts > 0); + HDassert(H5F_addr_defined(udata->dblk_page_addr)); -/* Allocate the fixed array data block page */ -if (NULL == (dblk_page = H5FA__dblk_page_alloc(udata->hdr, udata->nelmts))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") + /* Allocate the fixed array data block page */ + if (NULL == (dblk_page = H5FA__dblk_page_alloc(udata->hdr, udata->nelmts))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") -/* Set the fixed array data block's information */ -dblk_page->addr = udata->dblk_page_addr; + /* Set the fixed array data block's information */ + dblk_page->addr = udata->dblk_page_addr; -/* Internal information */ + /* Internal information */ -/* Decode elements in data block page */ -/* Convert from raw elements on disk into native elements in memory */ -if ((udata->hdr->cparam.cls->decode)(image, dblk_page->elmts, udata->nelmts, udata->hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTDECODE, "can't decode fixed array data elements") -image += (udata->nelmts * udata->hdr->cparam.raw_elmt_size); + /* Decode elements in data block page */ + /* Convert from raw elements on disk into native elements in memory */ + if ((udata->hdr->cparam.cls->decode)(image, dblk_page->elmts, udata->nelmts, udata->hdr->cb_ctx) < 0) + H5E_THROW(H5E_CANTDECODE, "can't decode fixed array data elements") + image += (udata->nelmts * udata->hdr->cparam.raw_elmt_size); -/* Sanity check */ -/* (allow for checksum not decoded yet) */ -HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5FA_SIZEOF_CHKSUM)); + /* Sanity check */ + /* (allow for checksum not decoded yet) */ + HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5FA_SIZEOF_CHKSUM)); -/* Set the data block page's size */ -dblk_page->size = len; + /* Set the data block page's size */ + dblk_page->size = len; -/* checksum verification already done in verify_chksum cb */ + /* checksum verification already done in verify_chksum cb */ -/* Metadata checksum */ -UINT32DECODE(image, stored_chksum); + /* Metadata checksum */ + UINT32DECODE(image, stored_chksum); -/* Sanity check */ -HDassert((size_t)(image - (const uint8_t *)_image) == dblk_page->size); + /* Sanity check */ + HDassert((size_t)(image - (const uint8_t *)_image) == dblk_page->size); -/* Set return value */ -ret_value = dblk_page; + /* Set return value */ + ret_value = dblk_page; -CATCH + CATCH -/* Release resources */ -if (!ret_value) - if (dblk_page && H5FA__dblk_page_dest(dblk_page) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block page") + /* Release resources */ + if (!ret_value) + if (dblk_page && H5FA__dblk_page_dest(dblk_page) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block page") END_FUNC(STATIC) /* end H5FA__cache_dblk_page_deserialize() */ @@ -1091,15 +1092,15 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_deserialize() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5FA__cache_dblk_page_image_len(const void *_thing, size_t *image_len)) -/* Local variables */ -const H5FA_dblk_page_t *dblk_page = (const H5FA_dblk_page_t *)_thing; /* Pointer to the object */ + /* Local variables */ + const H5FA_dblk_page_t *dblk_page = (const H5FA_dblk_page_t *)_thing; /* Pointer to the object */ -/* Check arguments */ -HDassert(dblk_page); -HDassert(image_len); + /* Check arguments */ + HDassert(dblk_page); + HDassert(image_len); -/* Set the image length size */ -*image_len = dblk_page->size; + /* Set the image length size */ + *image_len = dblk_page->size; END_FUNC(STATIC) /* end H5FA__cache_dblk_page_image_len() */ @@ -1119,37 +1120,37 @@ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5FA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, size_t H5_ATTR_UNUSED len, void *_thing)) -/* Local variables */ -H5FA_dblk_page_t *dblk_page = (H5FA_dblk_page_t *)_thing; /* Pointer to the object to serialize */ -uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ -uint32_t metadata_chksum; /* Computed metadata checksum value */ + /* Local variables */ + H5FA_dblk_page_t *dblk_page = (H5FA_dblk_page_t *)_thing; /* Pointer to the object to serialize */ + uint8_t * image = (uint8_t *)_image; /* Pointer into raw data buffer */ + uint32_t metadata_chksum; /* Computed metadata checksum value */ -/* Sanity check */ -HDassert(f); -HDassert(image); -HDassert(dblk_page); -HDassert(dblk_page->hdr); + /* Sanity check */ + HDassert(f); + HDassert(image); + HDassert(dblk_page); + HDassert(dblk_page->hdr); -/* Internal information */ + /* Internal information */ -/* Encode elements in data block page */ + /* Encode elements in data block page */ -/* Convert from native elements in memory into raw elements on disk */ -if ((dblk_page->hdr->cparam.cls->encode)(image, dblk_page->elmts, dblk_page->nelmts, dblk_page->hdr->cb_ctx) < - 0) - H5E_THROW(H5E_CANTENCODE, "can't encode fixed array data elements") -image += (dblk_page->nelmts * dblk_page->hdr->cparam.raw_elmt_size); + /* Convert from native elements in memory into raw elements on disk */ + if ((dblk_page->hdr->cparam.cls->encode)(image, dblk_page->elmts, dblk_page->nelmts, + dblk_page->hdr->cb_ctx) < 0) + H5E_THROW(H5E_CANTENCODE, "can't encode fixed array data elements") + image += (dblk_page->nelmts * dblk_page->hdr->cparam.raw_elmt_size); -/* Compute metadata checksum */ -metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); + /* Compute metadata checksum */ + metadata_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); -/* Metadata checksum */ -UINT32ENCODE(image, metadata_chksum); + /* Metadata checksum */ + UINT32ENCODE(image, metadata_chksum); -/* Sanity check */ -HDassert((size_t)(image - (uint8_t *)_image) == len); + /* Sanity check */ + HDassert((size_t)(image - (uint8_t *)_image) == len); -CATCH + CATCH END_FUNC(STATIC) /* end H5FA__cache_dblk_page_serialize() */ @@ -1168,49 +1169,48 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_serialize() */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5FA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing)) -/* Local variables */ -H5FA_dblk_page_t *dblk_page = (H5FA_dblk_page_t *)_thing; /* Pointer to the object */ - -/* Sanity check */ -HDassert(dblk_page); - -/* Determine which action to take */ -switch (action) { - case H5AC_NOTIFY_ACTION_AFTER_INSERT: - case H5AC_NOTIFY_ACTION_AFTER_LOAD: - case H5AC_NOTIFY_ACTION_AFTER_FLUSH: - /* do nothing */ - break; - - case H5AC_NOTIFY_ACTION_BEFORE_EVICT: - /* Detach from 'top' proxy for fixed array */ - if (dblk_page->top_proxy) { - if (H5AC_proxy_entry_remove_child(dblk_page->top_proxy, dblk_page) < 0) - H5E_THROW( - H5E_CANTUNDEPEND, - "unable to destroy flush dependency between data block page and fixed array 'top' proxy") - dblk_page->top_proxy = NULL; - } /* end if */ - break; - - case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: - case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: - case H5AC_NOTIFY_ACTION_CHILD_DIRTIED: - case H5AC_NOTIFY_ACTION_CHILD_CLEANED: - case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: - case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: - /* do nothing */ - break; - - default: + /* Local variables */ + H5FA_dblk_page_t *dblk_page = (H5FA_dblk_page_t *)_thing; /* Pointer to the object */ + + /* Sanity check */ + HDassert(dblk_page); + + /* Determine which action to take */ + switch (action) { + case H5AC_NOTIFY_ACTION_AFTER_INSERT: + case H5AC_NOTIFY_ACTION_AFTER_LOAD: + case H5AC_NOTIFY_ACTION_AFTER_FLUSH: + /* do nothing */ + break; + + case H5AC_NOTIFY_ACTION_BEFORE_EVICT: + /* Detach from 'top' proxy for fixed array */ + if (dblk_page->top_proxy) { + if (H5AC_proxy_entry_remove_child(dblk_page->top_proxy, dblk_page) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency between data block page " + "and fixed array 'top' proxy") + dblk_page->top_proxy = NULL; + } /* end if */ + break; + + case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: + case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: + case H5AC_NOTIFY_ACTION_CHILD_DIRTIED: + case H5AC_NOTIFY_ACTION_CHILD_CLEANED: + case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: + case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: + /* do nothing */ + break; + + default: #ifdef NDEBUG - H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") + H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") #else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); + HDassert(0 && "Unknown action?!?"); #endif /* NDEBUG */ -} /* end switch */ + } /* end switch */ -CATCH + CATCH END_FUNC(STATIC) /* end H5FA__cache_dblk_page_notify() */ @@ -1229,13 +1229,13 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_notify() */ */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5FA__cache_dblk_page_free_icr(void *thing)) -/* Check arguments */ -HDassert(thing); + /* Check arguments */ + HDassert(thing); -/* Release the fixed array data block page */ -if (H5FA__dblk_page_dest((H5FA_dblk_page_t *)thing) < 0) - H5E_THROW(H5E_CANTFREE, "can't free fixed array data block page") + /* Release the fixed array data block page */ + if (H5FA__dblk_page_dest((H5FA_dblk_page_t *)thing) < 0) + H5E_THROW(H5E_CANTFREE, "can't free fixed array data block page") -CATCH + CATCH END_FUNC(STATIC) /* end H5FA__cache_dblk_page_free_icr() */ diff --git a/src/H5FAdbg.c b/src/H5FAdbg.c index 37ad94d..a5e758e 100644 --- a/src/H5FAdbg.c +++ b/src/H5FAdbg.c @@ -83,53 +83,54 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls, haddr_t obj_addr)) -/* Local variables */ -H5FA_hdr_t *hdr = NULL; /* Shared fixed array header */ -void * dbg_ctx = NULL; /* Fixed array debugging context */ - -/* Check arguments */ -HDassert(f); -HDassert(H5F_addr_defined(addr)); -HDassert(H5F_addr_defined(obj_addr)); -HDassert(stream); -HDassert(indent >= 0); -HDassert(fwidth >= 0); -HDassert(cls); - -/* Check for debugging context callback available */ -if (cls->crt_dbg_ctx) - /* Create debugging context */ - if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) - H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") - -/* Load the fixed array header */ -if (NULL == (hdr = H5FA__hdr_protect(f, addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") - -/* Print opening message */ -HDfprintf(stream, "%*sFixed Array Header...\n", indent, ""); - -/* Print the values */ -HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); -HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Header size:", hdr->size); -HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Raw Element Size:", (unsigned)hdr->cparam.raw_elmt_size); -HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Native Element Size (on this platform):", hdr->cparam.cls->nat_elmt_size); - -HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Max. # of elements in data block page:", - (unsigned)((size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits)); - -HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of elements in Fixed Array:", hdr->stats.nelmts); - -HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Fixed Array Data Block Address:", hdr->dblk_addr); - -CATCH -if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") -if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") + /* Local variables */ + H5FA_hdr_t *hdr = NULL; /* Shared fixed array header */ + void * dbg_ctx = NULL; /* Fixed array debugging context */ + + /* Check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(H5F_addr_defined(obj_addr)); + HDassert(stream); + HDassert(indent >= 0); + HDassert(fwidth >= 0); + HDassert(cls); + + /* Check for debugging context callback available */ + if (cls->crt_dbg_ctx) + /* Create debugging context */ + if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) + H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") + + /* Load the fixed array header */ + if (NULL == (hdr = H5FA__hdr_protect(f, addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) + H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") + + /* Print opening message */ + HDfprintf(stream, "%*sFixed Array Header...\n", indent, ""); + + /* Print the values */ + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size:", hdr->size); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Raw Element Size:", (unsigned)hdr->cparam.raw_elmt_size); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "Native Element Size (on this platform):", hdr->cparam.cls->nat_elmt_size); + + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Max. # of elements in data block page:", + (unsigned)((size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits)); + + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Number of elements in Fixed Array:", hdr->stats.nelmts); + + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Fixed Array Data Block Address:", hdr->dblk_addr); + + CATCH + if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) + H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") + if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") END_FUNC(PKG) /* end H5FA__hdr_debug() */ @@ -149,114 +150,116 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr)) -/* Local variables */ -H5FA_hdr_t * hdr = NULL; /* Shared fixed array header */ -H5FA_dblock_t *dblock = NULL; /* Fixed array data block */ -void * dbg_ctx = NULL; /* Fixed array context */ -size_t u; /* Local index variable */ - -/* Check arguments */ -HDassert(f); -HDassert(H5F_addr_defined(addr)); -HDassert(stream); -HDassert(indent >= 0); -HDassert(fwidth >= 0); -HDassert(cls); -HDassert(H5F_addr_defined(hdr_addr)); -HDassert(H5F_addr_defined(obj_addr)); - -/* Check for debugging context callback available */ -if (cls->crt_dbg_ctx) - /* Create debugging context */ - if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) - H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") - -/* Load the fixed array header */ -if (NULL == (hdr = H5FA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") - -/* Protect data block */ -if (NULL == (dblock = H5FA__dblock_protect(hdr, addr, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", - (unsigned long long)addr) - -/* Print opening message */ -HDfprintf(stream, "%*sFixed Array data Block...\n", indent, ""); - -/* Print the values */ -HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); -HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of Data Block:", dblock->addr); -HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Data Block size:", dblock->size); -HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of elements in Data Block:", hdr->cparam.nelmts); -HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Number of pages in Data Block:", dblock->npages); -HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of elements per Data Block page:", dblock->dblk_page_nelmts); - -if (dblock->npages) { /* paging */ - size_t dblk_page_nelmts; /* # of elements in a data block page */ - haddr_t dblk_page_addr; /* Address of a data block page */ - size_t page_idx; /* Page index within data block */ - - HDfprintf(stream, "%*sPaging:\n", indent, ""); - - /* Iterate over the pages */ - dblk_page_addr = dblock->addr + H5FA_DBLOCK_PREFIX_SIZE(dblock); - dblk_page_nelmts = dblock->dblk_page_nelmts; - - /* Read and print each page's elements in the data block */ - for (page_idx = 0; page_idx < dblock->npages; page_idx++) { - if (!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { - HDfprintf(stream, "%*s%-*s %Hu %s\n", indent, "", fwidth, "Page %Zu:", page_idx, "empty"); - - } /* end if */ - else { /* get the page */ - H5FA_dblk_page_t *dblk_page; /* Pointer to a data block page */ - hsize_t nelmts_left; /* Remaining elements in the last data block page */ - - /* Check for last page */ - if (((page_idx + 1) == dblock->npages) && - (nelmts_left = hdr->cparam.nelmts % dblock->dblk_page_nelmts)) - dblk_page_nelmts = (size_t)nelmts_left; - - if (NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dblk_page_addr, dblk_page_nelmts, - H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", - (unsigned long long)dblk_page_addr) - - HDfprintf(stream, "%*sElements in page %Zu:\n", indent, "", page_idx); - for (u = 0; u < dblk_page_nelmts; u++) { - /* Call the class's 'debug' callback */ - if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, - ((uint8_t *)dblk_page->elmts) + - (hdr->cparam.cls->nat_elmt_size * u)) < 0) - H5E_THROW(H5E_CANTGET, "can't get element for debugging") - } /* end for */ - if (H5FA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page") - - /* Advance to next page address */ - dblk_page_addr += dblock->dblk_page_size; - } /* paging */ - } /* end for npages */ -} /* end if */ -else { /* not paging */ - /* Print the elements in the data block */ - HDfprintf(stream, "%*sElements:\n", indent, ""); - for (u = 0; u < hdr->cparam.nelmts; u++) { - /* Call the class's 'debug' callback */ - if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, - ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) - H5E_THROW(H5E_CANTGET, "can't get element for debugging") - } /* end for */ -} /* end else */ - -CATCH -if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") -if (dblock && H5FA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block") -if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") + /* Local variables */ + H5FA_hdr_t * hdr = NULL; /* Shared fixed array header */ + H5FA_dblock_t *dblock = NULL; /* Fixed array data block */ + void * dbg_ctx = NULL; /* Fixed array context */ + size_t u; /* Local index variable */ + + /* Check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(stream); + HDassert(indent >= 0); + HDassert(fwidth >= 0); + HDassert(cls); + HDassert(H5F_addr_defined(hdr_addr)); + HDassert(H5F_addr_defined(obj_addr)); + + /* Check for debugging context callback available */ + if (cls->crt_dbg_ctx) + /* Create debugging context */ + if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) + H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") + + /* Load the fixed array header */ + if (NULL == (hdr = H5FA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) + H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") + + /* Protect data block */ + if (NULL == (dblock = H5FA__dblock_protect(hdr, addr, H5AC__READ_ONLY_FLAG))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", + (unsigned long long)addr) + + /* Print opening message */ + HDfprintf(stream, "%*sFixed Array data Block...\n", indent, ""); + + /* Print the values */ + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of Data Block:", dblock->addr); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Data Block size:", dblock->size); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Number of elements in Data Block:", hdr->cparam.nelmts); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Number of pages in Data Block:", dblock->npages); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "Number of elements per Data Block page:", dblock->dblk_page_nelmts); + + if (dblock->npages) { /* paging */ + size_t dblk_page_nelmts; /* # of elements in a data block page */ + haddr_t dblk_page_addr; /* Address of a data block page */ + size_t page_idx; /* Page index within data block */ + + HDfprintf(stream, "%*sPaging:\n", indent, ""); + + /* Iterate over the pages */ + dblk_page_addr = dblock->addr + H5FA_DBLOCK_PREFIX_SIZE(dblock); + dblk_page_nelmts = dblock->dblk_page_nelmts; + + /* Read and print each page's elements in the data block */ + for (page_idx = 0; page_idx < dblock->npages; page_idx++) { + if (!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { + HDfprintf(stream, "%*s%-*s %zu %s\n", indent, "", fwidth, "Page %zu:", page_idx, "empty"); + + } /* end if */ + else { /* get the page */ + H5FA_dblk_page_t *dblk_page; /* Pointer to a data block page */ + hsize_t nelmts_left; /* Remaining elements in the last data block page */ + + /* Check for last page */ + if (((page_idx + 1) == dblock->npages) && + (nelmts_left = hdr->cparam.nelmts % dblock->dblk_page_nelmts)) + dblk_page_nelmts = (size_t)nelmts_left; + + if (NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dblk_page_addr, dblk_page_nelmts, + H5AC__READ_ONLY_FLAG))) + H5E_THROW(H5E_CANTPROTECT, + "unable to protect fixed array data block page, address = %llu", + (unsigned long long)dblk_page_addr) + + HDfprintf(stream, "%*sElements in page %zu:\n", indent, "", page_idx); + for (u = 0; u < dblk_page_nelmts; u++) { + /* Call the class's 'debug' callback */ + if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, + ((uint8_t *)dblk_page->elmts) + + (hdr->cparam.cls->nat_elmt_size * u)) < 0) + H5E_THROW(H5E_CANTGET, "can't get element for debugging") + } /* end for */ + if (H5FA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page") + + /* Advance to next page address */ + dblk_page_addr += dblock->dblk_page_size; + } /* paging */ + } /* end for npages */ + } /* end if */ + else { /* not paging */ + /* Print the elements in the data block */ + HDfprintf(stream, "%*sElements:\n", indent, ""); + for (u = 0; u < hdr->cparam.nelmts; u++) { + /* Call the class's 'debug' callback */ + if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, + ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < + 0) + H5E_THROW(H5E_CANTGET, "can't get element for debugging") + } /* end for */ + } /* end else */ + + CATCH + if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) + H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") + if (dblock && H5FA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block") + if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") END_FUNC(PKG) /* end H5FA__dblock_debug() */ diff --git a/src/H5FAdblkpage.c b/src/H5FAdblkpage.c index 24012ec..61aaf0e 100644 --- a/src/H5FAdblkpage.c +++ b/src/H5FAdblkpage.c @@ -86,36 +86,36 @@ H5FL_BLK_DEFINE(page_elmts); */ BEGIN_FUNC(PKG, ERR, H5FA_dblk_page_t *, NULL, NULL, H5FA__dblk_page_alloc(H5FA_hdr_t *hdr, size_t nelmts)) -/* Local variables */ -H5FA_dblk_page_t *dblk_page = NULL; /* Fixed array data block page */ + /* Local variables */ + H5FA_dblk_page_t *dblk_page = NULL; /* Fixed array data block page */ -/* Check arguments */ -HDassert(hdr); + /* Check arguments */ + HDassert(hdr); -/* Allocate memory for the data block */ -if (NULL == (dblk_page = H5FL_CALLOC(H5FA_dblk_page_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") + /* Allocate memory for the data block */ + if (NULL == (dblk_page = H5FL_CALLOC(H5FA_dblk_page_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") -/* Share common array information */ -if (H5FA__hdr_incr(hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") -dblk_page->hdr = hdr; + /* Share common array information */ + if (H5FA__hdr_incr(hdr) < 0) + H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + dblk_page->hdr = hdr; -/* Set non-zero internal fields */ -dblk_page->nelmts = nelmts; + /* Set non-zero internal fields */ + dblk_page->nelmts = nelmts; -/* Allocate buffer for elements in data block page */ -if (NULL == (dblk_page->elmts = H5FL_BLK_MALLOC(page_elmts, nelmts * hdr->cparam.cls->nat_elmt_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block page element buffer") + /* Allocate buffer for elements in data block page */ + if (NULL == (dblk_page->elmts = H5FL_BLK_MALLOC(page_elmts, nelmts * hdr->cparam.cls->nat_elmt_size))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block page element buffer") -/* Set the return value */ -ret_value = dblk_page; + /* Set the return value */ + ret_value = dblk_page; -CATCH + CATCH -if (!ret_value) - if (dblk_page && H5FA__dblk_page_dest(dblk_page) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block page") + if (!ret_value) + if (dblk_page && H5FA__dblk_page_dest(dblk_page) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block page") END_FUNC(PKG) /* end H5FA__dblk_page_alloc() */ @@ -134,57 +134,57 @@ END_FUNC(PKG) /* end H5FA__dblk_page_alloc() */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts)) -/* Local variables */ -H5FA_dblk_page_t *dblk_page = NULL; /* Fixed array data block page */ -hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + /* Local variables */ + H5FA_dblk_page_t *dblk_page = NULL; /* Fixed array data block page */ + hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ #ifdef H5FA_DEBUG -HDfprintf(stderr, "%s: Called, addr = %a\n", FUNC, addr); + HDfprintf(stderr, "%s: Called, addr = %a\n", FUNC, addr); #endif /* H5FA_DEBUG */ -/* Sanity check */ -HDassert(hdr); + /* Sanity check */ + HDassert(hdr); -/* Allocate the data block page */ -if (NULL == (dblk_page = H5FA__dblk_page_alloc(hdr, nelmts))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") + /* Allocate the data block page */ + if (NULL == (dblk_page = H5FA__dblk_page_alloc(hdr, nelmts))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block page") -/* Set info about data block page on disk */ -dblk_page->addr = addr; -dblk_page->size = H5FA_DBLK_PAGE_SIZE(hdr, nelmts); + /* Set info about data block page on disk */ + dblk_page->addr = addr; + dblk_page->size = H5FA_DBLK_PAGE_SIZE(hdr, nelmts); #ifdef H5FA_DEBUG -HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", FUNC, dblk_page->size); + HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", FUNC, dblk_page->size); #endif /* H5FA_DEBUG */ -/* Clear any elements in data block page to fill value */ -if ((hdr->cparam.cls->fill)(dblk_page->elmts, nelmts) < 0) - H5E_THROW(H5E_CANTSET, "can't set fixed array data block page elements to class's fill value") - -/* Cache the new fixed array data block page */ -if (H5AC_insert_entry(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block page to cache") -inserted = TRUE; - -/* Add data block page as child of 'top' proxy */ -if (hdr->top_proxy) { - if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0) - H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy") - dblk_page->top_proxy = hdr->top_proxy; -} /* end if */ - -CATCH -if (ret_value < 0) - if (dblk_page) { - /* Remove from cache, if inserted */ - if (inserted) - if (H5AC_remove_entry(dblk_page) < 0) - H5E_THROW(H5E_CANTREMOVE, "unable to remove fixed array data block page from cache") - - /* Destroy data block page */ - if (H5FA__dblk_page_dest(dblk_page) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block page") + /* Clear any elements in data block page to fill value */ + if ((hdr->cparam.cls->fill)(dblk_page->elmts, nelmts) < 0) + H5E_THROW(H5E_CANTSET, "can't set fixed array data block page elements to class's fill value") + + /* Cache the new fixed array data block page */ + if (H5AC_insert_entry(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block page to cache") + inserted = TRUE; + + /* Add data block page as child of 'top' proxy */ + if (hdr->top_proxy) { + if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0) + H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy") + dblk_page->top_proxy = hdr->top_proxy; } /* end if */ + CATCH + if (ret_value < 0) + if (dblk_page) { + /* Remove from cache, if inserted */ + if (inserted) + if (H5AC_remove_entry(dblk_page) < 0) + H5E_THROW(H5E_CANTREMOVE, "unable to remove fixed array data block page from cache") + + /* Destroy data block page */ + if (H5FA__dblk_page_dest(dblk_page) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block page") + } /* end if */ + END_FUNC(PKG) /* end H5FA__dblk_page_create() */ /*------------------------------------------------------------------------- @@ -204,53 +204,53 @@ BEGIN_FUNC(PKG, ERR, H5FA_dblk_page_t *, NULL, NULL, H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, size_t dblk_page_nelmts, unsigned flags)) -/* Local variables */ -H5FA_dblk_page_t * dblk_page = NULL; /* Fixed array data block page */ -H5FA_dblk_page_cache_ud_t udata; /* Information needed for loading data block page */ + /* Local variables */ + H5FA_dblk_page_t * dblk_page = NULL; /* Fixed array data block page */ + H5FA_dblk_page_cache_ud_t udata; /* Information needed for loading data block page */ #ifdef H5FA_DEBUG -HDfprintf(stderr, "%s: Called\n", FUNC); + HDfprintf(stderr, "%s: Called\n", FUNC); #endif /* H5FA_DEBUG */ -/* Sanity check */ -HDassert(hdr); -HDassert(H5F_addr_defined(dblk_page_addr)); - -/* only the H5AC__READ_ONLY_FLAG is permitted */ -HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); - -/* Set up user data */ -udata.hdr = hdr; -udata.nelmts = dblk_page_nelmts; -udata.dblk_page_addr = dblk_page_addr; - -/* Protect the data block page */ -if (NULL == (dblk_page = (H5FA_dblk_page_t *)H5AC_protect(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page_addr, - &udata, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", - (unsigned long long)dblk_page_addr) - -/* Create top proxy, if it doesn't exist */ -if (hdr->top_proxy && NULL == dblk_page->top_proxy) { - /* Add data block page as child of 'top' proxy */ - if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0) - H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy") - dblk_page->top_proxy = hdr->top_proxy; -} /* end if */ + /* Sanity check */ + HDassert(hdr); + HDassert(H5F_addr_defined(dblk_page_addr)); + + /* only the H5AC__READ_ONLY_FLAG is permitted */ + HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + + /* Set up user data */ + udata.hdr = hdr; + udata.nelmts = dblk_page_nelmts; + udata.dblk_page_addr = dblk_page_addr; + + /* Protect the data block page */ + if (NULL == (dblk_page = (H5FA_dblk_page_t *)H5AC_protect(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page_addr, + &udata, flags))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", + (unsigned long long)dblk_page_addr) + + /* Create top proxy, if it doesn't exist */ + if (hdr->top_proxy && NULL == dblk_page->top_proxy) { + /* Add data block page as child of 'top' proxy */ + if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0) + H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy") + dblk_page->top_proxy = hdr->top_proxy; + } /* end if */ -/* Set return value */ -ret_value = dblk_page; + /* Set return value */ + ret_value = dblk_page; -CATCH + CATCH -/* Clean up on error */ -if (!ret_value) { - /* Release the data block page, if it was protected */ - if (dblk_page && - H5AC_unprotect(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block page, address = %llu", - (unsigned long long)dblk_page->addr) -} /* end if */ + /* Clean up on error */ + if (!ret_value) { + /* Release the data block page, if it was protected */ + if (dblk_page && + H5AC_unprotect(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block page, address = %llu", + (unsigned long long)dblk_page->addr) + } /* end if */ END_FUNC(PKG) /* end H5FA__dblk_page_protect() */ @@ -273,18 +273,18 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, /* Local variables */ #ifdef H5FA_DEBUG -HDfprintf(stderr, "%s: Called\n", FUNC); + HDfprintf(stderr, "%s: Called\n", FUNC); #endif /* H5FA_DEBUG */ -/* Sanity check */ -HDassert(dblk_page); + /* Sanity check */ + HDassert(dblk_page); -/* Unprotect the data block page */ -if (H5AC_unprotect(dblk_page->hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block page, address = %llu", - (unsigned long long)dblk_page->addr) + /* Unprotect the data block page */ + if (H5AC_unprotect(dblk_page->hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block page, address = %llu", + (unsigned long long)dblk_page->addr) -CATCH + CATCH END_FUNC(PKG) /* end H5FA__dblk_page_unprotect() */ @@ -302,29 +302,29 @@ END_FUNC(PKG) /* end H5FA__dblk_page_unprotect() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblk_page_dest(H5FA_dblk_page_t *dblk_page)) -/* Sanity check */ -HDassert(dblk_page); - -/* Check if header field has been initialized */ -if (dblk_page->hdr) { - /* Check if buffer for data block page elements has been initialized */ - if (dblk_page->elmts) { - /* Free buffer for data block page elements */ - dblk_page->elmts = H5FL_BLK_FREE(page_elmts, dblk_page->elmts); + /* Sanity check */ + HDassert(dblk_page); + + /* Check if header field has been initialized */ + if (dblk_page->hdr) { + /* Check if buffer for data block page elements has been initialized */ + if (dblk_page->elmts) { + /* Free buffer for data block page elements */ + dblk_page->elmts = H5FL_BLK_FREE(page_elmts, dblk_page->elmts); + } /* end if */ + + /* Decrement reference count on shared info */ + if (H5FA__hdr_decr(dblk_page->hdr) < 0) + H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + dblk_page->hdr = NULL; } /* end if */ - /* Decrement reference count on shared info */ - if (H5FA__hdr_decr(dblk_page->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") - dblk_page->hdr = NULL; -} /* end if */ - -/* Sanity check */ -HDassert(NULL == dblk_page->top_proxy); + /* Sanity check */ + HDassert(NULL == dblk_page->top_proxy); -/* Free the data block page itself */ -dblk_page = H5FL_FREE(H5FA_dblk_page_t, dblk_page); + /* Free the data block page itself */ + dblk_page = H5FL_FREE(H5FA_dblk_page_t, dblk_page); -CATCH + CATCH END_FUNC(PKG) /* end H5FA__dblk_page_dest() */ diff --git a/src/H5FAdblock.c b/src/H5FAdblock.c index 09585c5..1c0a2d7 100644 --- a/src/H5FAdblock.c +++ b/src/H5FAdblock.c @@ -90,70 +90,70 @@ H5FL_BLK_DEFINE(fa_page_init); */ BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL, H5FA__dblock_alloc(H5FA_hdr_t *hdr)) -/* Local variables */ -H5FA_dblock_t *dblock = NULL; /* fixed array data block */ + /* Local variables */ + H5FA_dblock_t *dblock = NULL; /* fixed array data block */ -/* Check arguments */ -HDassert(hdr); -HDassert(hdr->cparam.nelmts > 0); + /* Check arguments */ + HDassert(hdr); + HDassert(hdr->cparam.nelmts > 0); -/* Allocate memory for the data block */ -if (NULL == (dblock = H5FL_CALLOC(H5FA_dblock_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") + /* Allocate memory for the data block */ + if (NULL == (dblock = H5FL_CALLOC(H5FA_dblock_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") -/* Share common array information */ -if (H5FA__hdr_incr(hdr) < 0) - H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") -dblock->hdr = hdr; + /* Share common array information */ + if (H5FA__hdr_incr(hdr) < 0) + H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + dblock->hdr = hdr; -/* Set non-zero internal fields */ -dblock->dblk_page_nelmts = (size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits; + /* Set non-zero internal fields */ + dblock->dblk_page_nelmts = (size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits; -/* Check if this data block should be paged */ -if (hdr->cparam.nelmts > dblock->dblk_page_nelmts) { - /* Compute number of pages */ - hsize_t npages = ((hdr->cparam.nelmts + dblock->dblk_page_nelmts) - 1) / dblock->dblk_page_nelmts; + /* Check if this data block should be paged */ + if (hdr->cparam.nelmts > dblock->dblk_page_nelmts) { + /* Compute number of pages */ + hsize_t npages = ((hdr->cparam.nelmts + dblock->dblk_page_nelmts) - 1) / dblock->dblk_page_nelmts; - /* Safely assign the number of pages */ - H5_CHECKED_ASSIGN(dblock->npages, size_t, npages, hsize_t); + /* Safely assign the number of pages */ + H5_CHECKED_ASSIGN(dblock->npages, size_t, npages, hsize_t); - /* Sanity check that we have at least 1 page */ - HDassert(dblock->npages > 0); + /* Sanity check that we have at least 1 page */ + HDassert(dblock->npages > 0); - /* Compute size of 'page init' flag array, in bytes */ - dblock->dblk_page_init_size = (dblock->npages + 7) / 8; - HDassert(dblock->dblk_page_init_size > 0); + /* Compute size of 'page init' flag array, in bytes */ + dblock->dblk_page_init_size = (dblock->npages + 7) / 8; + HDassert(dblock->dblk_page_init_size > 0); - /* Allocate space for 'page init' flags */ - if (NULL == (dblock->dblk_page_init = H5FL_BLK_CALLOC(fa_page_init, dblock->dblk_page_init_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for page init bitmask") + /* Allocate space for 'page init' flags */ + if (NULL == (dblock->dblk_page_init = H5FL_BLK_CALLOC(fa_page_init, dblock->dblk_page_init_size))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for page init bitmask") - /* Compute data block page size */ - dblock->dblk_page_size = (dblock->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5FA_SIZEOF_CHKSUM; + /* Compute data block page size */ + dblock->dblk_page_size = (dblock->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5FA_SIZEOF_CHKSUM; - /* Compute the # of elements on last page */ - if (0 == hdr->cparam.nelmts % dblock->dblk_page_nelmts) - dblock->last_page_nelmts = dblock->dblk_page_nelmts; - else - dblock->last_page_nelmts = (size_t)(hdr->cparam.nelmts % dblock->dblk_page_nelmts); -} /* end if */ -else { - hsize_t dblk_size = hdr->cparam.nelmts * hdr->cparam.cls->nat_elmt_size; + /* Compute the # of elements on last page */ + if (0 == hdr->cparam.nelmts % dblock->dblk_page_nelmts) + dblock->last_page_nelmts = dblock->dblk_page_nelmts; + else + dblock->last_page_nelmts = (size_t)(hdr->cparam.nelmts % dblock->dblk_page_nelmts); + } /* end if */ + else { + hsize_t dblk_size = hdr->cparam.nelmts * hdr->cparam.cls->nat_elmt_size; - /* Allocate buffer for elements in data block */ - H5_CHECK_OVERFLOW(dblk_size, /* From: */ hsize_t, /* To: */ size_t); - if (NULL == (dblock->elmts = H5FL_BLK_MALLOC(chunk_elmts, (size_t)dblk_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block element buffer") -} /* end else */ + /* Allocate buffer for elements in data block */ + H5_CHECK_OVERFLOW(dblk_size, /* From: */ hsize_t, /* To: */ size_t); + if (NULL == (dblock->elmts = H5FL_BLK_MALLOC(chunk_elmts, (size_t)dblk_size))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for data block element buffer") + } /* end else */ -/* Set the return value */ -ret_value = dblock; + /* Set the return value */ + ret_value = dblock; -CATCH + CATCH -if (!ret_value) - if (dblock && H5FA__dblock_dest(dblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block") + if (!ret_value) + if (dblock && H5FA__dblock_dest(dblock) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block") END_FUNC(PKG) /* end H5FA__dblock_alloc() */ @@ -172,70 +172,70 @@ END_FUNC(PKG) /* end H5FA__dblock_alloc() */ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, H5FA__dblock_create(H5FA_hdr_t *hdr, hbool_t *hdr_dirty)) -/* Local variables */ -H5FA_dblock_t *dblock = NULL; /* Fixed array data block */ -haddr_t dblock_addr; /* Fixed array data block address */ -hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ - -/* Sanity check */ -HDassert(hdr); -HDassert(hdr_dirty); - -/* Allocate the data block */ -if (NULL == (dblock = H5FA__dblock_alloc(hdr))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") - -/* Set size of data block on disk */ -hdr->stats.dblk_size = dblock->size = H5FA_DBLOCK_SIZE(dblock); - -/* Allocate space for the data block on disk */ -if (HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_FARRAY_DBLOCK, (hsize_t)dblock->size))) - H5E_THROW(H5E_CANTALLOC, "file allocation failed for fixed array data block") -dblock->addr = dblock_addr; - -/* Don't initialize elements if paged */ -if (!dblock->npages) - /* Clear any elements in data block to fill value */ - if ((hdr->cparam.cls->fill)(dblock->elmts, (size_t)hdr->cparam.nelmts) < 0) - H5E_THROW(H5E_CANTSET, "can't set fixed array data block elements to class's fill value") - -/* Cache the new fixed array data block */ -if (H5AC_insert_entry(hdr->f, H5AC_FARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block to cache") -inserted = TRUE; - -/* Add data block as child of 'top' proxy */ -if (hdr->top_proxy) { - if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0) - H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy") - dblock->top_proxy = hdr->top_proxy; -} /* end if */ - -/* Mark the header dirty (for updating statistics) */ -*hdr_dirty = TRUE; - -/* Set address of data block to return */ -ret_value = dblock_addr; - -CATCH - -if (!H5F_addr_defined(ret_value)) - if (dblock) { - /* Remove from cache, if inserted */ - if (inserted) - if (H5AC_remove_entry(dblock) < 0) - H5E_THROW(H5E_CANTREMOVE, "unable to remove fixed array data block from cache") - - /* Release data block's disk space */ - if (H5F_addr_defined(dblock->addr) && - H5MF_xfree(hdr->f, H5FD_MEM_FARRAY_DBLOCK, dblock->addr, (hsize_t)dblock->size) < 0) - H5E_THROW(H5E_CANTFREE, "unable to release fixed array data block") - - /* Destroy data block */ - if (H5FA__dblock_dest(dblock) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block") + /* Local variables */ + H5FA_dblock_t *dblock = NULL; /* Fixed array data block */ + haddr_t dblock_addr; /* Fixed array data block address */ + hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + + /* Sanity check */ + HDassert(hdr); + HDassert(hdr_dirty); + + /* Allocate the data block */ + if (NULL == (dblock = H5FA__dblock_alloc(hdr))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block") + + /* Set size of data block on disk */ + hdr->stats.dblk_size = dblock->size = H5FA_DBLOCK_SIZE(dblock); + + /* Allocate space for the data block on disk */ + if (HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_FARRAY_DBLOCK, (hsize_t)dblock->size))) + H5E_THROW(H5E_CANTALLOC, "file allocation failed for fixed array data block") + dblock->addr = dblock_addr; + + /* Don't initialize elements if paged */ + if (!dblock->npages) + /* Clear any elements in data block to fill value */ + if ((hdr->cparam.cls->fill)(dblock->elmts, (size_t)hdr->cparam.nelmts) < 0) + H5E_THROW(H5E_CANTSET, "can't set fixed array data block elements to class's fill value") + + /* Cache the new fixed array data block */ + if (H5AC_insert_entry(hdr->f, H5AC_FARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTINSERT, "can't add fixed array data block to cache") + inserted = TRUE; + + /* Add data block as child of 'top' proxy */ + if (hdr->top_proxy) { + if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0) + H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy") + dblock->top_proxy = hdr->top_proxy; } /* end if */ + /* Mark the header dirty (for updating statistics) */ + *hdr_dirty = TRUE; + + /* Set address of data block to return */ + ret_value = dblock_addr; + + CATCH + + if (!H5F_addr_defined(ret_value)) + if (dblock) { + /* Remove from cache, if inserted */ + if (inserted) + if (H5AC_remove_entry(dblock) < 0) + H5E_THROW(H5E_CANTREMOVE, "unable to remove fixed array data block from cache") + + /* Release data block's disk space */ + if (H5F_addr_defined(dblock->addr) && + H5MF_xfree(hdr->f, H5FD_MEM_FARRAY_DBLOCK, dblock->addr, (hsize_t)dblock->size) < 0) + H5E_THROW(H5E_CANTFREE, "unable to release fixed array data block") + + /* Destroy data block */ + if (H5FA__dblock_dest(dblock) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array data block") + } /* end if */ + END_FUNC(PKG) /* end H5FA__dblock_create() */ /*------------------------------------------------------------------------- @@ -253,45 +253,47 @@ END_FUNC(PKG) /* end H5FA__dblock_create() */ BEGIN_FUNC(PKG, ERR, H5FA_dblock_t *, NULL, NULL, H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, unsigned flags)) -/* Local variables */ -H5FA_dblock_t * dblock; /* Fixed array data block */ -H5FA_dblock_cache_ud_t udata; /* Information needed for loading data block */ - -/* Sanity check */ -HDassert(hdr); -HDassert(H5F_addr_defined(dblk_addr)); - -/* only the H5AC__READ_ONLY_FLAG flag is permitted */ -HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); - -/* Set up user data */ -udata.hdr = hdr; -udata.dblk_addr = dblk_addr; - -/* Protect the data block */ -if (NULL == (dblock = (H5FA_dblock_t *)H5AC_protect(hdr->f, H5AC_FARRAY_DBLOCK, dblk_addr, &udata, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", - (unsigned long long)dblk_addr) - -/* Create top proxy, if it doesn't exist */ -if (hdr->top_proxy && NULL == dblock->top_proxy) { - /* Add data block as child of 'top' proxy */ - if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0) - H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy") - dblock->top_proxy = hdr->top_proxy; -} /* end if */ + /* Local variables */ + H5FA_dblock_t * dblock; /* Fixed array data block */ + H5FA_dblock_cache_ud_t udata; /* Information needed for loading data block */ + + /* Sanity check */ + HDassert(hdr); + HDassert(H5F_addr_defined(dblk_addr)); + + /* only the H5AC__READ_ONLY_FLAG flag is permitted */ + HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + + /* Set up user data */ + udata.hdr = hdr; + udata.dblk_addr = dblk_addr; + + /* Protect the data block */ + if (NULL == + (dblock = (H5FA_dblock_t *)H5AC_protect(hdr->f, H5AC_FARRAY_DBLOCK, dblk_addr, &udata, flags))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", + (unsigned long long)dblk_addr) + + /* Create top proxy, if it doesn't exist */ + if (hdr->top_proxy && NULL == dblock->top_proxy) { + /* Add data block as child of 'top' proxy */ + if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0) + H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy") + dblock->top_proxy = hdr->top_proxy; + } /* end if */ -/* Set return value */ -ret_value = dblock; + /* Set return value */ + ret_value = dblock; -CATCH + CATCH -/* Clean up on error */ -if (!ret_value) - /* Release the data block, if it was protected */ - if (dblock && H5AC_unprotect(hdr->f, H5AC_FARRAY_DBLOCK, dblock->addr, dblock, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block, address = %llu", - (unsigned long long)dblock->addr) + /* Clean up on error */ + if (!ret_value) + /* Release the data block, if it was protected */ + if (dblock && + H5AC_unprotect(hdr->f, H5AC_FARRAY_DBLOCK, dblock->addr, dblock, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block, address = %llu", + (unsigned long long)dblock->addr) END_FUNC(PKG) /* end H5FA__dblock_protect() */ @@ -310,17 +312,17 @@ END_FUNC(PKG) /* end H5FA__dblock_protect() */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_unprotect(H5FA_dblock_t *dblock, unsigned cache_flags)) -/* Local variables */ + /* Local variables */ -/* Sanity check */ -HDassert(dblock); + /* Sanity check */ + HDassert(dblock); -/* Unprotect the data block */ -if (H5AC_unprotect(dblock->hdr->f, H5AC_FARRAY_DBLOCK, dblock->addr, dblock, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block, address = %llu", - (unsigned long long)dblock->addr) + /* Unprotect the data block */ + if (H5AC_unprotect(dblock->hdr->f, H5AC_FARRAY_DBLOCK, dblock->addr, dblock, cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array data block, address = %llu", + (unsigned long long)dblock->addr) -CATCH + CATCH END_FUNC(PKG) /* end H5FA__dblock_unprotect() */ @@ -338,44 +340,44 @@ END_FUNC(PKG) /* end H5FA__dblock_unprotect() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_delete(H5FA_hdr_t *hdr, haddr_t dblk_addr)) -/* Local variables */ -H5FA_dblock_t *dblock = NULL; /* Pointer to data block */ + /* Local variables */ + H5FA_dblock_t *dblock = NULL; /* Pointer to data block */ -/* Sanity check */ -HDassert(hdr); -HDassert(H5F_addr_defined(dblk_addr)); + /* Sanity check */ + HDassert(hdr); + HDassert(H5F_addr_defined(dblk_addr)); -/* Protect data block */ -if (NULL == (dblock = H5FA__dblock_protect(hdr, dblk_addr, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", - (unsigned long long)dblk_addr) + /* Protect data block */ + if (NULL == (dblock = H5FA__dblock_protect(hdr, dblk_addr, H5AC__NO_FLAGS_SET))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block, address = %llu", + (unsigned long long)dblk_addr) -/* Check if data block is paged */ -if (dblock->npages) { - haddr_t dblk_page_addr; /* Address of each data block page */ - size_t u; /* Local index variable */ + /* Check if data block is paged */ + if (dblock->npages) { + haddr_t dblk_page_addr; /* Address of each data block page */ + size_t u; /* Local index variable */ - /* Set up initial state */ - dblk_page_addr = dblk_addr + H5FA_DBLOCK_PREFIX_SIZE(dblock); + /* Set up initial state */ + dblk_page_addr = dblk_addr + H5FA_DBLOCK_PREFIX_SIZE(dblock); - /* Iterate over pages in data block */ - for (u = 0; u < dblock->npages; u++) { - /* Evict the data block page from the metadata cache */ - /* (OK to call if it doesn't exist in the cache) */ - if (H5AC_expunge_entry(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page_addr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTEXPUNGE, "unable to remove array data block page from metadata cache") + /* Iterate over pages in data block */ + for (u = 0; u < dblock->npages; u++) { + /* Evict the data block page from the metadata cache */ + /* (OK to call if it doesn't exist in the cache) */ + if (H5AC_expunge_entry(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page_addr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTEXPUNGE, "unable to remove array data block page from metadata cache") - /* Advance to next page address */ - dblk_page_addr += dblock->dblk_page_size; - } /* end for */ -} /* end if */ + /* Advance to next page address */ + dblk_page_addr += dblock->dblk_page_size; + } /* end for */ + } /* end if */ -CATCH + CATCH -/* Finished deleting data block in metadata cache */ -if (dblock && - H5FA__dblock_unprotect(dblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block") + /* Finished deleting data block in metadata cache */ + if (dblock && H5FA__dblock_unprotect(dblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | + H5AC__FREE_FILE_SPACE_FLAG) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block") END_FUNC(PKG) /* end H5FA__dblock_delete() */ @@ -393,38 +395,38 @@ END_FUNC(PKG) /* end H5FA__dblock_delete() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__dblock_dest(H5FA_dblock_t *dblock)) -/* Sanity check */ -HDassert(dblock); - -/* Check if shared header field has been initialized */ -if (dblock->hdr) { - /* Check if we've got elements in the data block */ - if (dblock->elmts && !dblock->npages) { - /* Free buffer for data block elements */ - HDassert(dblock->hdr->cparam.nelmts > 0); - dblock->elmts = H5FL_BLK_FREE(chunk_elmts, dblock->elmts); + /* Sanity check */ + HDassert(dblock); + + /* Check if shared header field has been initialized */ + if (dblock->hdr) { + /* Check if we've got elements in the data block */ + if (dblock->elmts && !dblock->npages) { + /* Free buffer for data block elements */ + HDassert(dblock->hdr->cparam.nelmts > 0); + dblock->elmts = H5FL_BLK_FREE(chunk_elmts, dblock->elmts); + } /* end if */ + + /* Check if data block is paged */ + if (dblock->npages) { + /* Free buffer for 'page init' bitmask, if there is one */ + HDassert(dblock->dblk_page_init_size > 0); + if (dblock->dblk_page_init) + dblock->dblk_page_init = H5FL_BLK_FREE(fa_page_init, dblock->dblk_page_init); + } /* end if */ + + /* Decrement reference count on shared info */ + if (H5FA__hdr_decr(dblock->hdr) < 0) + H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") + dblock->hdr = NULL; } /* end if */ - /* Check if data block is paged */ - if (dblock->npages) { - /* Free buffer for 'page init' bitmask, if there is one */ - HDassert(dblock->dblk_page_init_size > 0); - if (dblock->dblk_page_init) - dblock->dblk_page_init = H5FL_BLK_FREE(fa_page_init, dblock->dblk_page_init); - } /* end if */ - - /* Decrement reference count on shared info */ - if (H5FA__hdr_decr(dblock->hdr) < 0) - H5E_THROW(H5E_CANTDEC, "can't decrement reference count on shared array header") - dblock->hdr = NULL; -} /* end if */ - -/* Sanity check */ -HDassert(NULL == dblock->top_proxy); + /* Sanity check */ + HDassert(NULL == dblock->top_proxy); -/* Free the data block itself */ -dblock = H5FL_FREE(H5FA_dblock_t, dblock); + /* Free the data block itself */ + dblock = H5FL_FREE(H5FA_dblock_t, dblock); -CATCH + CATCH END_FUNC(PKG) /* end H5FA__dblock_dest() */ diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c index 9e9faee..f9049f8 100644 --- a/src/H5FAhdr.c +++ b/src/H5FAhdr.c @@ -84,33 +84,33 @@ H5FL_DEFINE_STATIC(H5FA_hdr_t); */ BEGIN_FUNC(PKG, ERR, H5FA_hdr_t *, NULL, NULL, H5FA__hdr_alloc(H5F_t *f)) -/* Local variables */ -H5FA_hdr_t *hdr = NULL; /* Shared Fixed Array header */ + /* Local variables */ + H5FA_hdr_t *hdr = NULL; /* Shared Fixed Array header */ -/* Check arguments */ -HDassert(f); + /* Check arguments */ + HDassert(f); -/* Allocate space for the shared information */ -if (NULL == (hdr = H5FL_CALLOC(H5FA_hdr_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header") + /* Allocate space for the shared information */ + if (NULL == (hdr = H5FL_CALLOC(H5FA_hdr_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header") -/* Set non-zero internal fields */ -hdr->addr = HADDR_UNDEF; + /* Set non-zero internal fields */ + hdr->addr = HADDR_UNDEF; -/* Set the internal parameters for the array */ -hdr->f = f; -hdr->swmr_write = (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) > 0; -hdr->sizeof_addr = H5F_SIZEOF_ADDR(f); -hdr->sizeof_size = H5F_SIZEOF_SIZE(f); + /* Set the internal parameters for the array */ + hdr->f = f; + hdr->swmr_write = (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) > 0; + hdr->sizeof_addr = H5F_SIZEOF_ADDR(f); + hdr->sizeof_size = H5F_SIZEOF_SIZE(f); -/* Set the return value */ -ret_value = hdr; + /* Set the return value */ + ret_value = hdr; -CATCH + CATCH -if (!ret_value) - if (hdr && H5FA__hdr_dest(hdr) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array header") + if (!ret_value) + if (hdr && H5FA__hdr_dest(hdr) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy fixed array header") END_FUNC(PKG) /* end H5FA__hdr_alloc() */ @@ -128,24 +128,24 @@ END_FUNC(PKG) /* end H5FA__hdr_alloc() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_init(H5FA_hdr_t *hdr, void *ctx_udata)) -/* Local variables */ + /* Local variables */ -/* Check arguments */ -HDassert(hdr); + /* Check arguments */ + HDassert(hdr); -/* Set size of header on disk (locally and in statistics) */ -hdr->stats.hdr_size = hdr->size = H5FA_HEADER_SIZE_HDR(hdr); + /* Set size of header on disk (locally and in statistics) */ + hdr->stats.hdr_size = hdr->size = H5FA_HEADER_SIZE_HDR(hdr); -/* Set number of elements for Fixed Array in statistics */ -hdr->stats.nelmts = hdr->cparam.nelmts; + /* Set number of elements for Fixed Array in statistics */ + hdr->stats.nelmts = hdr->cparam.nelmts; -/* Create the callback context, if there's one */ -if (hdr->cparam.cls->crt_context) { - if (NULL == (hdr->cb_ctx = (*hdr->cparam.cls->crt_context)(ctx_udata))) - H5E_THROW(H5E_CANTCREATE, "unable to create fixed array client callback context") -} /* end if */ + /* Create the callback context, if there's one */ + if (hdr->cparam.cls->crt_context) { + if (NULL == (hdr->cb_ctx = (*hdr->cparam.cls->crt_context)(ctx_udata))) + H5E_THROW(H5E_CANTCREATE, "unable to create fixed array client callback context") + } /* end if */ -CATCH + CATCH END_FUNC(PKG) /* end H5FA__hdr_init() */ @@ -164,79 +164,79 @@ END_FUNC(PKG) /* end H5FA__hdr_init() */ BEGIN_FUNC(PKG, ERR, haddr_t, HADDR_UNDEF, HADDR_UNDEF, H5FA__hdr_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata)) -/* Local variables */ -H5FA_hdr_t *hdr = NULL; /* Fixed array header */ -hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ + /* Local variables */ + H5FA_hdr_t *hdr = NULL; /* Fixed array header */ + hbool_t inserted = FALSE; /* Whether the header was inserted into cache */ -/* Check arguments */ -HDassert(f); -HDassert(cparam); + /* Check arguments */ + HDassert(f); + HDassert(cparam); #ifndef NDEBUG -{ - /* Check for valid parameters */ - if (cparam->raw_elmt_size == 0) - H5E_THROW(H5E_BADVALUE, "element size must be greater than zero") - if (cparam->max_dblk_page_nelmts_bits == 0) - H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be greater than zero") - if (cparam->nelmts == 0) - H5E_THROW(H5E_BADVALUE, "# of elements must be greater than zero") -} + { + /* Check for valid parameters */ + if (cparam->raw_elmt_size == 0) + H5E_THROW(H5E_BADVALUE, "element size must be greater than zero") + if (cparam->max_dblk_page_nelmts_bits == 0) + H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be greater than zero") + if (cparam->nelmts == 0) + H5E_THROW(H5E_BADVALUE, "# of elements must be greater than zero") + } #endif /* NDEBUG */ -/* Allocate space for the shared information */ -if (NULL == (hdr = H5FA__hdr_alloc(f))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header") + /* Allocate space for the shared information */ + if (NULL == (hdr = H5FA__hdr_alloc(f))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for Fixed Array shared header") -hdr->dblk_addr = HADDR_UNDEF; + hdr->dblk_addr = HADDR_UNDEF; -/* Set the creation parameters for the array */ -H5MM_memcpy(&hdr->cparam, cparam, sizeof(hdr->cparam)); + /* Set the creation parameters for the array */ + H5MM_memcpy(&hdr->cparam, cparam, sizeof(hdr->cparam)); -/* Finish initializing fixed array header */ -if (H5FA__hdr_init(hdr, ctx_udata) < 0) - H5E_THROW(H5E_CANTINIT, "initialization failed for fixed array header") + /* Finish initializing fixed array header */ + if (H5FA__hdr_init(hdr, ctx_udata) < 0) + H5E_THROW(H5E_CANTINIT, "initialization failed for fixed array header") -/* Allocate space for the header on disk */ -if (HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_FARRAY_HDR, (hsize_t)hdr->size))) - H5E_THROW(H5E_CANTALLOC, "file allocation failed for Fixed Array header") + /* Allocate space for the header on disk */ + if (HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_FARRAY_HDR, (hsize_t)hdr->size))) + H5E_THROW(H5E_CANTALLOC, "file allocation failed for Fixed Array header") -/* Create 'top' proxy for extensible array entries */ -if (hdr->swmr_write) - if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) - H5E_THROW(H5E_CANTCREATE, "can't create fixed array entry proxy") + /* Create 'top' proxy for extensible array entries */ + if (hdr->swmr_write) + if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) + H5E_THROW(H5E_CANTCREATE, "can't create fixed array entry proxy") -/* Cache the new Fixed Array header */ -if (H5AC_insert_entry(f, H5AC_FARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTINSERT, "can't add fixed array header to cache") -inserted = TRUE; + /* Cache the new Fixed Array header */ + if (H5AC_insert_entry(f, H5AC_FARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTINSERT, "can't add fixed array header to cache") + inserted = TRUE; -/* Add header as child of 'top' proxy */ -if (hdr->top_proxy) - if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0) - H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy") + /* Add header as child of 'top' proxy */ + if (hdr->top_proxy) + if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0) + H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy") -/* Set address of array header to return */ -ret_value = hdr->addr; + /* Set address of array header to return */ + ret_value = hdr->addr; -CATCH + CATCH -if (!H5F_addr_defined(ret_value)) - if (hdr) { - /* Remove from cache, if inserted */ - if (inserted) - if (H5AC_remove_entry(hdr) < 0) - H5E_THROW(H5E_CANTREMOVE, "unable to remove fixed array header from cache") + if (!H5F_addr_defined(ret_value)) + if (hdr) { + /* Remove from cache, if inserted */ + if (inserted) + if (H5AC_remove_entry(hdr) < 0) + H5E_THROW(H5E_CANTREMOVE, "unable to remove fixed array header from cache") - /* Release header's disk space */ - if (H5F_addr_defined(hdr->addr) && - H5MF_xfree(f, H5FD_MEM_FARRAY_HDR, hdr->addr, (hsize_t)hdr->size) < 0) - H5E_THROW(H5E_CANTFREE, "unable to free Fixed Array header") + /* Release header's disk space */ + if (H5F_addr_defined(hdr->addr) && + H5MF_xfree(f, H5FD_MEM_FARRAY_HDR, hdr->addr, (hsize_t)hdr->size) < 0) + H5E_THROW(H5E_CANTFREE, "unable to free Fixed Array header") - /* Destroy header */ - if (H5FA__hdr_dest(hdr) < 0) - H5E_THROW(H5E_CANTFREE, "unable to destroy Fixed Array header") - } /* end if */ + /* Destroy header */ + if (H5FA__hdr_dest(hdr) < 0) + H5E_THROW(H5E_CANTFREE, "unable to destroy Fixed Array header") + } /* end if */ END_FUNC(PKG) /* end H5FA__hdr_create() */ @@ -254,18 +254,18 @@ END_FUNC(PKG) /* end H5FA__hdr_create() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_incr(H5FA_hdr_t *hdr)) -/* Sanity check */ -HDassert(hdr); + /* Sanity check */ + HDassert(hdr); -/* Mark header as un-evictable when something is depending on it */ -if (hdr->rc == 0) - if (H5AC_pin_protected_entry(hdr) < 0) - H5E_THROW(H5E_CANTPIN, "unable to pin fixed array header") + /* Mark header as un-evictable when something is depending on it */ + if (hdr->rc == 0) + if (H5AC_pin_protected_entry(hdr) < 0) + H5E_THROW(H5E_CANTPIN, "unable to pin fixed array header") -/* Increment reference count on shared header */ -hdr->rc++; + /* Increment reference count on shared header */ + hdr->rc++; -CATCH + CATCH END_FUNC(PKG) /* end H5FA__hdr_incr() */ @@ -283,21 +283,21 @@ END_FUNC(PKG) /* end H5FA__hdr_incr() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_decr(H5FA_hdr_t *hdr)) -/* Sanity check */ -HDassert(hdr); -HDassert(hdr->rc); + /* Sanity check */ + HDassert(hdr); + HDassert(hdr->rc); -/* Decrement reference count on shared header */ -hdr->rc--; + /* Decrement reference count on shared header */ + hdr->rc--; -/* Mark header as evictable again when nothing depend on it */ -if (hdr->rc == 0) { - HDassert(hdr->file_rc == 0); - if (H5AC_unpin_entry(hdr) < 0) - H5E_THROW(H5E_CANTUNPIN, "unable to unpin fixed array header") -} /* end if */ + /* Mark header as evictable again when nothing depend on it */ + if (hdr->rc == 0) { + HDassert(hdr->file_rc == 0); + if (H5AC_unpin_entry(hdr) < 0) + H5E_THROW(H5E_CANTUNPIN, "unable to unpin fixed array header") + } /* end if */ -CATCH + CATCH END_FUNC(PKG) /* end H5FA__hdr_decr() */ @@ -315,11 +315,11 @@ END_FUNC(PKG) /* end H5FA__hdr_decr() */ */ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5FA__hdr_fuse_incr(H5FA_hdr_t *hdr)) -/* Sanity check */ -HDassert(hdr); + /* Sanity check */ + HDassert(hdr); -/* Increment file reference count on shared header */ -hdr->file_rc++; + /* Increment file reference count on shared header */ + hdr->file_rc++; END_FUNC(PKG) /* end H5FA__hdr_fuse_incr() */ @@ -337,15 +337,15 @@ END_FUNC(PKG) /* end H5FA__hdr_fuse_incr() */ */ BEGIN_FUNC(PKG, NOERR, size_t, 0, -, H5FA__hdr_fuse_decr(H5FA_hdr_t *hdr)) -/* Sanity check */ -HDassert(hdr); -HDassert(hdr->file_rc); + /* Sanity check */ + HDassert(hdr); + HDassert(hdr->file_rc); -/* Decrement file reference count on shared header */ -hdr->file_rc--; + /* Decrement file reference count on shared header */ + hdr->file_rc--; -/* Set return value */ -ret_value = hdr->file_rc; + /* Set return value */ + ret_value = hdr->file_rc; END_FUNC(PKG) /* end H5FA__hdr_fuse_decr() */ @@ -363,14 +363,14 @@ END_FUNC(PKG) /* end H5FA__hdr_fuse_decr() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_modified(H5FA_hdr_t *hdr)) -/* Sanity check */ -HDassert(hdr); + /* Sanity check */ + HDassert(hdr); -/* Mark header as dirty in cache */ -if (H5AC_mark_entry_dirty(hdr) < 0) - H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark fixed array header as dirty") + /* Mark header as dirty in cache */ + if (H5AC_mark_entry_dirty(hdr) < 0) + H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark fixed array header as dirty") -CATCH + CATCH END_FUNC(PKG) /* end H5FA__hdr_modified() */ @@ -389,43 +389,43 @@ END_FUNC(PKG) /* end H5FA__hdr_modified() */ BEGIN_FUNC(PKG, ERR, H5FA_hdr_t *, NULL, NULL, H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, unsigned flags)) -/* Local variables */ -H5FA_hdr_t * hdr; /* Fixed array header */ -H5FA_hdr_cache_ud_t udata; /* User data for cache callbacks */ - -/* Sanity check */ -HDassert(f); -HDassert(H5F_addr_defined(fa_addr)); - -/* only the H5AC__READ_ONLY_FLAG is permitted */ -HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); - -/* Set up user data for cache callbacks */ -udata.f = f; -udata.addr = fa_addr; -udata.ctx_udata = ctx_udata; - -/* Protect the header */ -if (NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, H5AC_FARRAY_HDR, fa_addr, &udata, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array header, address = %llu", - (unsigned long long)fa_addr) -hdr->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */ - -/* Create top proxy, if it doesn't exist */ -if (hdr->swmr_write && NULL == hdr->top_proxy) { - /* Create 'top' proxy for fixed array entries */ - if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) - H5E_THROW(H5E_CANTCREATE, "can't create fixed array entry proxy") - - /* Add header as child of 'top' proxy */ - if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0) - H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy") -} /* end if */ + /* Local variables */ + H5FA_hdr_t * hdr; /* Fixed array header */ + H5FA_hdr_cache_ud_t udata; /* User data for cache callbacks */ + + /* Sanity check */ + HDassert(f); + HDassert(H5F_addr_defined(fa_addr)); + + /* only the H5AC__READ_ONLY_FLAG is permitted */ + HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + + /* Set up user data for cache callbacks */ + udata.f = f; + udata.addr = fa_addr; + udata.ctx_udata = ctx_udata; + + /* Protect the header */ + if (NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, H5AC_FARRAY_HDR, fa_addr, &udata, flags))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array header, address = %llu", + (unsigned long long)fa_addr) + hdr->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */ + + /* Create top proxy, if it doesn't exist */ + if (hdr->swmr_write && NULL == hdr->top_proxy) { + /* Create 'top' proxy for fixed array entries */ + if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) + H5E_THROW(H5E_CANTCREATE, "can't create fixed array entry proxy") + + /* Add header as child of 'top' proxy */ + if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0) + H5E_THROW(H5E_CANTSET, "unable to add fixed array entry as child of array proxy") + } /* end if */ -/* Set return value */ -ret_value = hdr; + /* Set return value */ + ret_value = hdr; -CATCH + CATCH END_FUNC(PKG) /* end H5FA__hdr_protect() */ @@ -443,17 +443,17 @@ END_FUNC(PKG) /* end H5FA__hdr_protect() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_unprotect(H5FA_hdr_t *hdr, unsigned cache_flags)) -/* Local variables */ + /* Local variables */ -/* Sanity check */ -HDassert(hdr); + /* Sanity check */ + HDassert(hdr); -/* Unprotect the header */ -if (H5AC_unprotect(hdr->f, H5AC_FARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array hdr, address = %llu", - (unsigned long long)hdr->addr) + /* Unprotect the header */ + if (H5AC_unprotect(hdr->f, H5AC_FARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array hdr, address = %llu", + (unsigned long long)hdr->addr) -CATCH + CATCH END_FUNC(PKG) /* end H5FA__hdr_unprotect() */ @@ -471,42 +471,42 @@ END_FUNC(PKG) /* end H5FA__hdr_unprotect() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_delete(H5FA_hdr_t *hdr)) -/* Local variables */ -unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting header */ + /* Local variables */ + unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting header */ -/* Sanity check */ -HDassert(hdr); -HDassert(!hdr->file_rc); + /* Sanity check */ + HDassert(hdr); + HDassert(!hdr->file_rc); #ifndef NDEBUG -{ - unsigned hdr_status = 0; /* Array header's status in the metadata cache */ + { + unsigned hdr_status = 0; /* Array header's status in the metadata cache */ - /* Check the array header's status in the metadata cache */ - if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0) - H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for array header") + /* Check the array header's status in the metadata cache */ + if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0) + H5E_THROW(H5E_CANTGET, "unable to check metadata cache status for array header") - /* Sanity checks on array header */ - HDassert(hdr_status & H5AC_ES__IN_CACHE); - HDassert(hdr_status & H5AC_ES__IS_PROTECTED); -} /* end block */ + /* Sanity checks on array header */ + HDassert(hdr_status & H5AC_ES__IN_CACHE); + HDassert(hdr_status & H5AC_ES__IS_PROTECTED); + } /* end block */ #endif /* NDEBUG */ -/* Check for Fixed Array Data block */ -if (H5F_addr_defined(hdr->dblk_addr)) { - /* Delete Fixed Array Data block */ - if (H5FA__dblock_delete(hdr, hdr->dblk_addr) < 0) - H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array data block") -} /* end if */ + /* Check for Fixed Array Data block */ + if (H5F_addr_defined(hdr->dblk_addr)) { + /* Delete Fixed Array Data block */ + if (H5FA__dblock_delete(hdr, hdr->dblk_addr) < 0) + H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array data block") + } /* end if */ -/* Set flags to finish deleting header on unprotect */ -cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; + /* Set flags to finish deleting header on unprotect */ + cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; -CATCH + CATCH -/* Unprotect the header, deleting it if an error hasn't occurred */ -if (H5AC_unprotect(hdr->f, H5AC_FARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") + /* Unprotect the header, deleting it if an error hasn't occurred */ + if (H5AC_unprotect(hdr->f, H5AC_FARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") END_FUNC(PKG) /* end H5FA__hdr_delete() */ @@ -524,27 +524,27 @@ END_FUNC(PKG) /* end H5FA__hdr_delete() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__hdr_dest(H5FA_hdr_t *hdr)) -/* Check arguments */ -HDassert(hdr); -HDassert(hdr->rc == 0); + /* Check arguments */ + HDassert(hdr); + HDassert(hdr->rc == 0); -/* Destroy the callback context */ -if (hdr->cb_ctx) { - if ((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to destroy fixed array client callback context") -} /* end if */ -hdr->cb_ctx = NULL; + /* Destroy the callback context */ + if (hdr->cb_ctx) { + if ((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0) + H5E_THROW(H5E_CANTRELEASE, "unable to destroy fixed array client callback context") + } /* end if */ + hdr->cb_ctx = NULL; -/* Destroy the 'top' proxy */ -if (hdr->top_proxy) { - if (H5AC_proxy_entry_dest(hdr->top_proxy) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to destroy fixed array 'top' proxy") - hdr->top_proxy = NULL; -} /* end if */ + /* Destroy the 'top' proxy */ + if (hdr->top_proxy) { + if (H5AC_proxy_entry_dest(hdr->top_proxy) < 0) + H5E_THROW(H5E_CANTRELEASE, "unable to destroy fixed array 'top' proxy") + hdr->top_proxy = NULL; + } /* end if */ -/* Free the shared info itself */ -hdr = H5FL_FREE(H5FA_hdr_t, hdr); + /* Free the shared info itself */ + hdr = H5FL_FREE(H5FA_hdr_t, hdr); -CATCH + CATCH END_FUNC(PKG) /* end H5FA__hdr_dest() */ diff --git a/src/H5FAint.c b/src/H5FAint.c index 7c357a9..c8e6826 100644 --- a/src/H5FAint.c +++ b/src/H5FAint.c @@ -82,15 +82,15 @@ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)) -/* Sanity check */ -HDassert(parent_entry); -HDassert(child_entry); + /* Sanity check */ + HDassert(parent_entry); + HDassert(child_entry); -/* Create a flush dependency between parent and child entry */ -if (H5AC_create_flush_dependency(parent_entry, child_entry) < 0) - H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency") + /* Create a flush dependency between parent and child entry */ + if (H5AC_create_flush_dependency(parent_entry, child_entry) < 0) + H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency") -CATCH + CATCH END_FUNC(PKG) /* end H5FA__create_flush_depend() */ @@ -109,14 +109,14 @@ END_FUNC(PKG) /* end H5FA__create_flush_depend() */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5FA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)) -/* Sanity check */ -HDassert(parent_entry); -HDassert(child_entry); + /* Sanity check */ + HDassert(parent_entry); + HDassert(child_entry); -/* Destroy a flush dependency between parent and child entry */ -if (H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency") + /* Destroy a flush dependency between parent and child entry */ + if (H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0) + H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency") -CATCH + CATCH END_FUNC(PKG) /* end H5FA__destroy_flush_depend() */ diff --git a/src/H5FAstat.c b/src/H5FAstat.c index 775acbc..a625d3a 100644 --- a/src/H5FAstat.c +++ b/src/H5FAstat.c @@ -83,16 +83,16 @@ BEGIN_FUNC(PRIV, NOERR, herr_t, SUCCEED, -, H5FA_get_stats(const H5FA_t *fa, H5F /* Local variables */ #ifdef H5FA_DEBUG -HDfprintf(stderr, "%s: Called\n", FUNC); + HDfprintf(stderr, "%s: Called\n", FUNC); #endif /* H5FA_DEBUG */ -/* - * Check arguments. - */ -HDassert(fa); -HDassert(stats); + /* + * Check arguments. + */ + HDassert(fa); + HDassert(stats); -/* Copy fixed array statistics */ -H5MM_memcpy(stats, &fa->hdr->stats, sizeof(fa->hdr->stats)); + /* Copy fixed array statistics */ + H5MM_memcpy(stats, &fa->hdr->stats, sizeof(fa->hdr->stats)); END_FUNC(PRIV) /* end H5FA_get_stats() */ diff --git a/src/H5FAtest.c b/src/H5FAtest.c index a6fd267..4da7d6f 100644 --- a/src/H5FAtest.c +++ b/src/H5FAtest.c @@ -114,20 +114,20 @@ H5FL_DEFINE_STATIC(H5FA__test_ctx_t); */ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5FA__test_crt_context(void H5_ATTR_UNUSED *udata)) -/* Local variables */ -H5FA__test_ctx_t *ctx; /* Context for callbacks */ + /* Local variables */ + H5FA__test_ctx_t *ctx; /* Context for callbacks */ -/* Allocate new context structure */ -if (NULL == (ctx = H5FL_MALLOC(H5FA__test_ctx_t))) - H5E_THROW(H5E_CANTALLOC, "can't allocate fixed array client callback context") + /* Allocate new context structure */ + if (NULL == (ctx = H5FL_MALLOC(H5FA__test_ctx_t))) + H5E_THROW(H5E_CANTALLOC, "can't allocate fixed array client callback context") -/* Initialize the context */ -ctx->bogus = H5FA__TEST_BOGUS_VAL; + /* Initialize the context */ + ctx->bogus = H5FA__TEST_BOGUS_VAL; -/* Set return value */ -ret_value = ctx; + /* Set return value */ + ret_value = ctx; -CATCH + CATCH END_FUNC(STATIC) /* end H5FA__test_crt_context() */ @@ -145,14 +145,14 @@ END_FUNC(STATIC) /* end H5FA__test_crt_context() */ */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5FA__test_dst_context(void *_ctx)) -/* Local variables */ -H5FA__test_ctx_t *ctx = (H5FA__test_ctx_t *)_ctx; /* Callback context to destroy */ + /* Local variables */ + H5FA__test_ctx_t *ctx = (H5FA__test_ctx_t *)_ctx; /* Callback context to destroy */ -/* Sanity checks */ -HDassert(H5FA__TEST_BOGUS_VAL == ctx->bogus); + /* Sanity checks */ + HDassert(H5FA__TEST_BOGUS_VAL == ctx->bogus); -/* Release context structure */ -ctx = H5FL_FREE(H5FA__test_ctx_t, ctx); + /* Release context structure */ + ctx = H5FL_FREE(H5FA__test_ctx_t, ctx); END_FUNC(STATIC) /* end H5FA__test_dst_context() */ @@ -170,14 +170,14 @@ END_FUNC(STATIC) /* end H5FA__test_dst_context() */ */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5FA__test_fill(void *nat_blk, size_t nelmts)) -/* Local variables */ -uint64_t fill_val = H5FA_TEST_FILL; /* Value to fill elements with */ + /* Local variables */ + uint64_t fill_val = H5FA_TEST_FILL; /* Value to fill elements with */ -/* Sanity checks */ -HDassert(nat_blk); -HDassert(nelmts); + /* Sanity checks */ + HDassert(nat_blk); + HDassert(nelmts); -H5VM_array_fill(nat_blk, &fill_val, sizeof(uint64_t), nelmts); + H5VM_array_fill(nat_blk, &fill_val, sizeof(uint64_t), nelmts); END_FUNC(STATIC) /* end H5FA__test_fill() */ @@ -198,28 +198,28 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Local variables */ #ifndef NDEBUG -H5FA__test_ctx_t *ctx = (H5FA__test_ctx_t *)_ctx; /* Callback context to destroy */ -#endif /* NDEBUG */ -const uint64_t *elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */ + H5FA__test_ctx_t *ctx = (H5FA__test_ctx_t *)_ctx; /* Callback context to destroy */ +#endif /* NDEBUG */ + const uint64_t *elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */ -/* Sanity checks */ -HDassert(raw); -HDassert(elmt); -HDassert(nelmts); -HDassert(H5FA__TEST_BOGUS_VAL == ctx->bogus); + /* Sanity checks */ + HDassert(raw); + HDassert(elmt); + HDassert(nelmts); + HDassert(H5FA__TEST_BOGUS_VAL == ctx->bogus); -/* Encode native elements into raw elements */ -while (nelmts) { - /* Encode element */ - /* (advances 'raw' pointer) */ - UINT64ENCODE(raw, *elmt); + /* Encode native elements into raw elements */ + while (nelmts) { + /* Encode element */ + /* (advances 'raw' pointer) */ + UINT64ENCODE(raw, *elmt); - /* Advance native element pointer */ - elmt++; + /* Advance native element pointer */ + elmt++; - /* Decrement # of elements to encode */ - nelmts--; -} /* end while */ + /* Decrement # of elements to encode */ + nelmts--; + } /* end while */ END_FUNC(STATIC) /* end H5FA__test_encode() */ @@ -240,29 +240,29 @@ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, /* Local variables */ #ifndef NDEBUG -H5FA__test_ctx_t *ctx = (H5FA__test_ctx_t *)_ctx; /* Callback context to destroy */ -#endif /* NDEBUG */ -uint64_t * elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */ -const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */ - -/* Sanity checks */ -HDassert(raw); -HDassert(elmt); -HDassert(nelmts); -HDassert(H5FA__TEST_BOGUS_VAL == ctx->bogus); - -/* Decode raw elements into native elements */ -while (nelmts) { - /* Decode element */ - /* (advances 'raw' pointer) */ - UINT64DECODE(raw, *elmt); - - /* Advance native element pointer */ - elmt++; - - /* Decrement # of elements to decode */ - nelmts--; -} /* end while */ + H5FA__test_ctx_t *ctx = (H5FA__test_ctx_t *)_ctx; /* Callback context to destroy */ +#endif /* NDEBUG */ + uint64_t * elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */ + const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */ + + /* Sanity checks */ + HDassert(raw); + HDassert(elmt); + HDassert(nelmts); + HDassert(H5FA__TEST_BOGUS_VAL == ctx->bogus); + + /* Decode raw elements into native elements */ + while (nelmts) { + /* Decode element */ + /* (advances 'raw' pointer) */ + UINT64DECODE(raw, *elmt); + + /* Advance native element pointer */ + elmt++; + + /* Decrement # of elements to decode */ + nelmts--; + } /* end while */ END_FUNC(STATIC) /* end H5FA__test_decode() */ @@ -281,17 +281,17 @@ END_FUNC(STATIC) /* end H5FA__test_decode() */ BEGIN_FUNC(STATIC, NOERR, herr_t, SUCCEED, -, H5FA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt)) -/* Local variables */ -char temp_str[128]; /* Temporary string, for formatting */ + /* Local variables */ + char temp_str[128]; /* Temporary string, for formatting */ -/* Sanity checks */ -HDassert(stream); -HDassert(elmt); + /* Sanity checks */ + HDassert(stream); + HDassert(elmt); -/* Print element */ -HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx); -HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str, - (unsigned long long)*(const uint64_t *)elmt); + /* Print element */ + HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx); + HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str, + (unsigned long long)*(const uint64_t *)elmt); END_FUNC(STATIC) /* end H5FA__test_debug() */ @@ -311,20 +311,20 @@ END_FUNC(STATIC) /* end H5FA__test_debug() */ BEGIN_FUNC(STATIC, ERR, void *, NULL, NULL, H5FA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_addr)) -/* Local variables */ -H5FA__test_ctx_t *ctx; /* Context for callbacks */ + /* Local variables */ + H5FA__test_ctx_t *ctx; /* Context for callbacks */ -/* Allocate new context structure */ -if (NULL == (ctx = H5FL_MALLOC(H5FA__test_ctx_t))) - H5E_THROW(H5E_CANTALLOC, "can't allocate fixed array client callback context") + /* Allocate new context structure */ + if (NULL == (ctx = H5FL_MALLOC(H5FA__test_ctx_t))) + H5E_THROW(H5E_CANTALLOC, "can't allocate fixed array client callback context") -/* Initialize the context */ -ctx->bogus = H5FA__TEST_BOGUS_VAL; + /* Initialize the context */ + ctx->bogus = H5FA__TEST_BOGUS_VAL; -/* Set return value */ -ret_value = ctx; + /* Set return value */ + ret_value = ctx; -CATCH + CATCH END_FUNC(STATIC) /* end H5FA__test_crt_dbg_context() */ @@ -342,13 +342,13 @@ END_FUNC(STATIC) /* end H5FA__test_crt_dbg_context() */ */ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5FA__get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam)) -/* Check arguments. */ -HDassert(fa); -HDassert(cparam); + /* Check arguments. */ + HDassert(fa); + HDassert(cparam); -/* Get fixed array creation parameters */ -cparam->raw_elmt_size = fa->hdr->cparam.raw_elmt_size; -cparam->nelmts = fa->hdr->cparam.nelmts; + /* Get fixed array creation parameters */ + cparam->raw_elmt_size = fa->hdr->cparam.raw_elmt_size; + cparam->nelmts = fa->hdr->cparam.nelmts; END_FUNC(PKG) /* end H5FA__get_cparam_test() */ @@ -367,16 +367,16 @@ END_FUNC(PKG) /* end H5FA__get_cparam_test() */ BEGIN_FUNC(PKG, ERRCATCH, int, 0, -, H5FA__cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2)) -/* Check arguments. */ -HDassert(cparam1); -HDassert(cparam2); + /* Check arguments. */ + HDassert(cparam1); + HDassert(cparam2); -/* Compare creation parameters for array */ -if (cparam1->raw_elmt_size < cparam2->raw_elmt_size) - H5_LEAVE(-1) -else if (cparam1->raw_elmt_size > cparam2->raw_elmt_size) - H5_LEAVE(1) + /* Compare creation parameters for array */ + if (cparam1->raw_elmt_size < cparam2->raw_elmt_size) + H5_LEAVE(-1) + else if (cparam1->raw_elmt_size > cparam2->raw_elmt_size) + H5_LEAVE(1) -CATCH + CATCH END_FUNC(PKG) /* end H5FA__cmp_cparam_test() */ diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 50a135d..cf89f26 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -35,7 +35,7 @@ #include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */ #include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* File access */ #include "H5FDprivate.h" /* File drivers */ @@ -313,7 +313,7 @@ done: * Function: H5FD__family_fapl_get * * Purpose: Gets a file access property list which could be used to - * create an identical file. + * create an identical file. * * Return: Success: Ptr to new file access property list. * diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index 9323c4f..569b889 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -20,15 +20,6 @@ * File System (HDFS). */ -#ifdef H5_HAVE_LIBHDFS -/* This source code file is part of the H5FD driver module - * NOTE: If we're just building the binary compatibility stubs, - * we're never going to really initialize the package, so we - * don't include this. - */ -#include "H5FDdrvr_module.h" -#endif /* H5_HAVE_LIBHDFS */ - #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5FDprivate.h" /* File drivers */ @@ -39,19 +30,11 @@ #ifdef H5_HAVE_LIBHDFS -/* HDFS routines - * Have to turn off -Wstrict-prototypes as this header contains functions - * defined as foo() instead of foo(void), which triggers warnings that HDF5 - * then interprets as errors. - * -Wundef isn't interpreted as an error by HDF5, but the header does do - * some bad symbol interpretation that raises a warning that is out of our - * control. - */ -H5_GCC_DIAG_OFF(strict - prototypes) -H5_GCC_DIAG_OFF(undef) -#include -H5_GCC_DIAG_ON(strict - prototypes) -H5_GCC_DIAG_ON(undef) +/* This source code file is part of the H5FD driver module */ +#include "H5FDdrvr_module.h" + +/* HDFS routines */ +#include "hdfs.h" /* toggle function call prints: 1 turns on */ #define HDFS_DEBUG 0 @@ -374,12 +357,12 @@ done: hid_t H5FD_hdfs_init(void) { + hid_t ret_value = H5I_INVALID_HID; /* Return value */ #if HDFS_STATS unsigned int bin_i; #endif - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(H5I_INVALID_HID) + FUNC_ENTER_NOAPI(FAIL) #if HDFS_DEBUG HDfprintf(stdout, "called %s.\n", FUNC); @@ -1716,48 +1699,4 @@ H5FD__hdfs_unlock(H5FD_t H5_ATTR_UNUSED *_file) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD__hdfs_unlock() */ - -#else /* H5_HAVE_LIBHDFS */ - -/* No-op stubs to avoid binary compatibility problems with previous - * HDF5 1.10 versions. Non-functional versions of these API calls were - * erroneously included in the library even when the HDFS VFD was not - * configured. - */ -hid_t -H5FD_hdfs_init(void) -{ - /* This should never be called since the header doesn't invoke it */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(H5I_INVALID_HID) -} - -herr_t -H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_out) -{ - herr_t ret_value = FAIL; - - FUNC_ENTER_API_NOINIT - H5TRACE2("e", "i*x", fapl_id, fa_out); - - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "HDFS VFD not included in the HDF5 library") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} - -herr_t -H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa) -{ - herr_t ret_value = FAIL; - - FUNC_ENTER_API_NOINIT - H5TRACE2("e", "i*x", fapl_id, fa); - - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "HDFS VFD not included in the HDF5 library") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) -} - #endif /* H5_HAVE_LIBHDFS */ diff --git a/src/H5FDhdfs.h b/src/H5FDhdfs.h index 5cc578a..05506d4 100644 --- a/src/H5FDhdfs.h +++ b/src/H5FDhdfs.h @@ -28,6 +28,11 @@ #define H5FD_HDFS (-1) #endif /* H5_HAVE_LIBHDFS */ +#ifdef H5_HAVE_LIBHDFS +#ifdef __cplusplus +extern "C" { +#endif + /**************************************************************************** * * Structure: H5FD_hdfs_fapl_t @@ -107,10 +112,6 @@ typedef struct H5FD_hdfs_fapl_t { int32_t stream_buffer_size; } H5FD_hdfs_fapl_t; -#ifdef __cplusplus -extern "C" { -#endif - H5_DLL hid_t H5FD_hdfs_init(void); H5_DLL herr_t H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_out); H5_DLL herr_t H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa); @@ -118,5 +119,6 @@ H5_DLL herr_t H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa); #ifdef __cplusplus } #endif +#endif /* H5_HAVE_LIBHDFS */ #endif /* ifndef H5FDhdfs_H */ diff --git a/src/H5FDlog.c b/src/H5FDlog.c index e238871..929cd9c 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -717,15 +717,17 @@ H5FD__log_close(H5FD_t *_file) addr = 1; while (addr < file->eoa) { if (file->nwrite[addr] != last_val) { - HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) written to %3d times\n", last_addr, - (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); + HDfprintf(file->logfp, + "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) written to %3d times\n", + last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); last_val = file->nwrite[addr]; last_addr = addr; } /* end if */ addr++; } /* end while */ - HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) written to %3d times\n", last_addr, - (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); + HDfprintf(file->logfp, + "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) written to %3d times\n", + last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); } /* end if */ /* Dump the read I/O information */ @@ -736,15 +738,17 @@ H5FD__log_close(H5FD_t *_file) addr = 1; while (addr < file->eoa) { if (file->nread[addr] != last_val) { - HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) read from %3d times\n", last_addr, - (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); + HDfprintf(file->logfp, + "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) read from %3d times\n", + last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); last_val = file->nread[addr]; last_addr = addr; } /* end if */ addr++; } /* end while */ - HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) read from %3d times\n", last_addr, - (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); + HDfprintf(file->logfp, + "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) read from %3d times\n", + last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); } /* end if */ /* Dump the I/O flavor information */ @@ -755,15 +759,16 @@ H5FD__log_close(H5FD_t *_file) addr = 1; while (addr < file->eoa) { if (file->flavor[addr] != last_val) { - HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) flavor is %s\n", last_addr, - (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]); + HDfprintf(file->logfp, + "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) flavor is %s\n", + last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]); last_val = file->flavor[addr]; last_addr = addr; } /* end if */ addr++; } /* end while */ - HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) flavor is %s\n", last_addr, (addr - 1), - (unsigned long)(addr - last_addr), flavors[last_val]); + HDfprintf(file->logfp, "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) flavor is %s\n", + last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]); } /* end if */ /* Free the logging information */ @@ -933,8 +938,9 @@ H5FD__log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hs } /* end if */ if (file->fa.flags & H5FD_LOG_ALLOC) - HDfprintf(file->logfp, "%10a-%10a (%10Hu bytes) (%s) Allocated\n", addr, (addr + size) - 1, size, - flavors[type]); + HDfprintf(file->logfp, + "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Allocated\n", addr, + (haddr_t)((addr + size) - 1), size, flavors[type]); } /* end if */ /* Set return value */ @@ -972,8 +978,8 @@ H5FD__log_free(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had /* Log the file memory freed */ if (file->fa.flags & H5FD_LOG_FREE) - HDfprintf(file->logfp, "%10a-%10a (%10Hu bytes) (%s) Freed\n", addr, (addr + size) - 1, size, - flavors[type]); + HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Freed\n", + addr, (haddr_t)((addr + size) - 1), size, flavors[type]); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -1039,8 +1045,9 @@ H5FD__log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) /* Log the extension like an allocation */ if (file->fa.flags & H5FD_LOG_ALLOC) - HDfprintf(file->logfp, "%10a-%10a (%10Hu bytes) (%s) Allocated\n", file->eoa, addr, size, - flavors[type]); + HDfprintf(file->logfp, + "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Allocated\n", + file->eoa, addr, size, flavors[type]); } /* end if */ /* Check for decreasing file size */ @@ -1056,8 +1063,9 @@ H5FD__log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) /* Log the shrink like a free */ if (file->fa.flags & H5FD_LOG_FREE) - HDfprintf(file->logfp, "%10a-%10a (%10Hu bytes) (%s) Freed\n", file->eoa, addr, size, - flavors[type]); + HDfprintf(file->logfp, + "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Freed\n", + file->eoa, addr, size, flavors[type]); } /* end if */ } /* end if */ @@ -1206,7 +1214,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had /* Emit log string if we're tracking individual seek events. */ if (file->fa.flags & H5FD_LOG_LOC_SEEK) { - HDfprintf(file->logfp, "Seek: From %10a To %10a", file->pos, addr); + HDfprintf(file->logfp, "Seek: From %10" PRIuHADDR " To %10" PRIuHADDR, file->pos, addr); /* Add the seek time, if we're tracking that. * Note that the seek time is NOT emitted for when just H5FD_LOG_TIME_SEEK @@ -1259,8 +1267,8 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); if (file->fa.flags & H5FD_LOG_LOC_READ) - HDfprintf(file->logfp, "Error! Reading: %10a-%10a (%10Zu bytes)\n", orig_addr, - (orig_addr + orig_size) - 1, orig_size); + HDfprintf(file->logfp, "Error! Reading: %10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes)\n", + orig_addr, (orig_addr + orig_size) - 1, orig_size); HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, " @@ -1302,8 +1310,8 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had /* Log information about the read */ if (file->fa.flags & H5FD_LOG_LOC_READ) { - HDfprintf(file->logfp, "%10a-%10a (%10Zu bytes) (%s) Read", orig_addr, (orig_addr + orig_size) - 1, - orig_size, flavors[type]); + HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes) (%s) Read", orig_addr, + (orig_addr + orig_size) - 1, orig_size, flavors[type]); /* Verify that we are reading in the type of data we allocated in this location */ if (file->flavor) { @@ -1428,7 +1436,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha /* Emit log string if we're tracking individual seek events. */ if (file->fa.flags & H5FD_LOG_LOC_SEEK) { - HDfprintf(file->logfp, "Seek: From %10a To %10a", file->pos, addr); + HDfprintf(file->logfp, "Seek: From %10" PRIuHADDR " To %10" PRIuHADDR, file->pos, addr); /* Add the seek time, if we're tracking that. * Note that the seek time is NOT emitted for when just H5FD_LOG_TIME_SEEK @@ -1481,8 +1489,8 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); if (file->fa.flags & H5FD_LOG_LOC_WRITE) - HDfprintf(file->logfp, "Error! Writing: %10a-%10a (%10Zu bytes)\n", orig_addr, - (orig_addr + orig_size) - 1, orig_size); + HDfprintf(file->logfp, "Error! Writing: %10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes)\n", + orig_addr, (orig_addr + orig_size) - 1, orig_size); HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, " @@ -1517,8 +1525,8 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha /* Log information about the write */ if (file->fa.flags & H5FD_LOG_LOC_WRITE) { - HDfprintf(file->logfp, "%10a-%10a (%10Zu bytes) (%s) Written", orig_addr, (orig_addr + orig_size) - 1, - orig_size, flavors[type]); + HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes) (%s) Written", orig_addr, + (orig_addr + orig_size) - 1, orig_size, flavors[type]); /* Check if this is the first write into a "default" section, grabbed by the metadata agregation * algorithm */ @@ -1638,7 +1646,7 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ /* Emit log string if we're tracking individual truncate events. */ if (file->fa.flags & H5FD_LOG_TRUNCATE) { - HDfprintf(file->logfp, "Truncate: To %10a", file->eoa); + HDfprintf(file->logfp, "Truncate: To %10" PRIuHADDR, file->eoa); /* Add the truncate time, if we're tracking that. * Note that the truncate time is NOT emitted for when just H5FD_LOG_TIME_TRUNCATE diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index 0745acf..2ac27d0 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -1267,8 +1267,8 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) rangebytesstr = (char *)H5MM_malloc(sizeof(char) * (S3COMMS_MAX_RANGE_STRING_SIZE + 1)); if (rangebytesstr == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc range format string."); - ret = HDsnprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), - "bytes=" H5_PRINTF_HADDR_FMT "-" H5_PRINTF_HADDR_FMT, offset, offset + len - 1); + ret = HDsnprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), "bytes=%" PRIuHADDR "-%" PRIuHADDR, + offset, offset + len - 1); if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format HTTP Range value"); } @@ -1276,8 +1276,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) rangebytesstr = (char *)H5MM_malloc(sizeof(char) * (S3COMMS_MAX_RANGE_STRING_SIZE + 1)); if (rangebytesstr == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc range format string."); - ret = HDsnprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), "bytes=" H5_PRINTF_HADDR_FMT "-", - offset); + ret = HDsnprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), "bytes=%" PRIuHADDR "-", offset); if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format HTTP Range value"); } diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index c0836c2..45ea503 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -235,6 +235,7 @@ H5FD_stdio_init(void) if (H5I_VFL != H5Iget_type(H5FD_STDIO_g)) H5FD_STDIO_g = H5FDregister(&H5FD_stdio_g); + return H5FD_STDIO_g; } /* end H5FD_stdio_init() */ @@ -314,7 +315,7 @@ H5Pset_fapl_stdio(hid_t fapl_id) *------------------------------------------------------------------------- */ static H5FD_t * -H5FD_stdio_open(const char *name, unsigned flags, hid_t /*UNUSED*/ fapl_id, haddr_t maxaddr) +H5FD_stdio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { FILE * f = NULL; unsigned write_access = 0; /* File opened with write access? */ diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c index 549cc3d..8082c02 100644 --- a/src/H5FSdbg.c +++ b/src/H5FSdbg.c @@ -121,12 +121,13 @@ H5FS_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) (fspace->client == H5FS_CLIENT_FHEAP_ID ? "Fractal heap" : (fspace->client == H5FS_CLIENT_FILE_ID ? "File" : "Unknown"))); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Total free space tracked:", fspace->tot_space); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Total free space tracked:", fspace->tot_space); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Total number of free space sections tracked:", fspace->tot_sect_count); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of serializable free space sections tracked:", fspace->serial_sect_count); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of ghost free space sections tracked:", fspace->ghost_sect_count); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of free space section classes:", (unsigned)fspace->nclasses); @@ -134,11 +135,13 @@ H5FS_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) HDfprintf(stream, "%*s%-*s %u%%\n", indent, "", fwidth, "Expand percent:", fspace->expand_percent); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "# of bits for section address space:", fspace->max_sect_addr); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Maximum section size:", fspace->max_sect_size); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Serialized sections address:", fspace->sect_addr); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Maximum section size:", fspace->max_sect_size); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Serialized sections address:", fspace->sect_addr); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Serialized sections size used:", fspace->sect_size); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Serialized sections size allocated:", fspace->alloc_sect_size); done: diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c index 08ec535..8a7f114 100644 --- a/src/H5Fdbg.c +++ b/src/H5Fdbg.c @@ -72,9 +72,10 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth) "File name (after resolving symlinks):", H5F_ACTUAL_NAME(f)); HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "File access flags", f->shared->flags); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "File open reference count:", f->shared->nrefs); - HDfprintf(stream, "%*s%-*s %a (abs)\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (abs)\n", indent, "", fwidth, "Address of super block:", f->shared->sblock->base_addr); - HDfprintf(stream, "%*s%-*s %Hu bytes\n", indent, "", fwidth, "Size of userblock:", userblock_size); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " bytes\n", indent, "", fwidth, + "Size of userblock:", userblock_size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Superblock version number:", f->shared->sblock->super_vers); @@ -99,16 +100,16 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int 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, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth, "Superblock extension address:", f->shared->sblock->ext_addr); - HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth, "Shared object header message table address:", f->shared->sohm_addr); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Shared object header message version number:", (unsigned)f->shared->sohm_vers); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of shared object header message indexes:", (unsigned)f->shared->sohm_nindexes); - HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth, "Address of driver information block:", f->shared->sblock->driver_addr); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, diff --git a/src/H5Fint.c b/src/H5Fint.c index 8dc92fe..d364a04 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -72,6 +72,7 @@ typedef struct H5F_olist_t { /* Local Prototypes */ /********************/ +static herr_t H5F__close_cb(H5VL_object_t *file_vol_obj); static herr_t H5F__set_vol_conn(H5F_t *file); static herr_t H5F__get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); @@ -88,6 +89,9 @@ static herr_t H5F__flush_phase2(H5F_t *f, hbool_t closing); /* Package Variables */ /*********************/ +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + /*****************************/ /* Library Private Variables */ /*****************************/ @@ -102,6 +106,146 @@ H5FL_DEFINE(H5F_t); /* Declare a free list to manage the H5F_shared_t struct */ H5FL_DEFINE(H5F_shared_t); +/* File ID class */ +static const H5I_class_t H5I_FILE_CLS[1] = {{ + H5I_FILE, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5F__close_cb /* Callback routine for closing objects of this class */ +}}; + +/*------------------------------------------------------------------------- + * Function: H5F_init + * + * Purpose: Initialize the interface from some other layer. + * + * Return: Success: non-negative + * + * Failure: negative + *------------------------------------------------------------------------- + */ +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() */ + +/*-------------------------------------------------------------------------- +NAME + H5F__init_package -- Initialize interface-specific information +USAGE + herr_t H5F__init_package() +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Initializes any interface-specific data or routines. + +--------------------------------------------------------------------------*/ +herr_t +H5F__init_package(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* + * Initialize the atom group for the file IDs. + */ + if (H5I_register_type(H5I_FILE_CLS) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to initialize interface") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5F__init_package() */ + +/*------------------------------------------------------------------------- + * Function: H5F_term_package + * + * 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 + * + *------------------------------------------------------------------------- + */ +int +H5F_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if (H5_PKG_INIT_VAR) { + if (H5I_nmembers(H5I_FILE) > 0) { + (void)H5I_clear_type(H5I_FILE, FALSE, FALSE); + n++; /*H5I*/ + } /* end if */ + else { + /* Make certain we've cleaned up all the shared file objects */ + H5F_sfile_assert_num(0); + + /* Destroy the file object id group */ + n += (H5I_dec_type_ref(H5I_FILE) > 0); + + /* Mark closed */ + if (0 == n) + H5_PKG_INIT_VAR = FALSE; + } /* end else */ + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5F_term_package() */ + +/*------------------------------------------------------------------------- + * Function: H5F__close_cb + * + * Purpose: Closes a file or causes the close operation to be pended. + * This function is called from the API and gets called + * by H5Fclose->H5I_dec_ref->H5F__close_cb when H5I_dec_ref() + * decrements the file ID reference count to zero. The file ID + * is removed from the H5I_FILE group by H5I_dec_ref() just + * before H5F__close_cb() is called. If there are open object + * headers then the close is pended by moving the file to the + * H5I_FILE_CLOSING ID group (the f->closing contains the ID + * assigned to file). + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5F__close_cb(H5VL_object_t *file_vol_obj) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(file_vol_obj); + + /* Close the file */ + if (H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + + /* Free the VOL object */ + if (H5VL_free_object(file_vol_obj) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__close_cb() */ + /*------------------------------------------------------------------------- * Function: H5F__set_vol_conn * diff --git a/src/H5Gent.c b/src/H5Gent.c index 10c9499..12a2caf 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -526,7 +526,7 @@ H5G__ent_debug(const H5G_entry_t *ent, FILE *stream, int indent, int fwidth, con HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, "Name offset into private heap:", (unsigned long)(ent->name_off)); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Object header address:", ent->header); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Object header address:", ent->header); HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Cache info type:"); switch (ent->type) { @@ -538,10 +538,10 @@ H5G__ent_debug(const H5G_entry_t *ent, FILE *stream, int indent, int fwidth, con HDfprintf(stream, "Symbol Table\n"); HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Cached entry information:"); - HDfprintf(stream, "%*s%-*s %a\n", nested_indent, "", nested_fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", nested_indent, "", nested_fwidth, "B-tree address:", ent->cache.stab.btree_addr); - HDfprintf(stream, "%*s%-*s %a\n", nested_indent, "", nested_fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", nested_indent, "", nested_fwidth, "Heap address:", ent->cache.stab.heap_addr); break; diff --git a/src/H5Gobj.c b/src/H5Gobj.c index a20b8c6..40ed72c 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -370,7 +370,7 @@ H5G__obj_compact_to_dense_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, voi done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_obj_compact_to_dense_cb() */ +} /* end H5G__obj_compact_to_dense_cb() */ /*------------------------------------------------------------------------- * Function: H5G__obj_stab_to_new_cb diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c index 51eb480..c34289c 100644 --- a/src/H5HFbtree2.c +++ b/src/H5HFbtree2.c @@ -434,8 +434,8 @@ H5HF__huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, const void *_nr FUNC_ENTER_STATIC_NOERR - HDfprintf(stream, "%*s%-*s {%a, %Hu, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len, - nrecord->id); + HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE ", %" PRIuHSIZE "}\n", indent, "", fwidth, + "Record:", nrecord->addr, nrecord->len, nrecord->id); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_indir_debug() */ @@ -636,8 +636,9 @@ H5HF__huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, const void FUNC_ENTER_STATIC_NOERR - HDfprintf(stream, "%*s%-*s {%a, %Hu, %x, %Hu, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr, - nrecord->len, nrecord->filter_mask, nrecord->obj_size, nrecord->id); + HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE ", %x, %" PRIuHSIZE ", %" PRIuHSIZE "}\n", + indent, "", fwidth, "Record:", nrecord->addr, nrecord->len, nrecord->filter_mask, + nrecord->obj_size, nrecord->id); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_filt_indir_debug() */ @@ -818,7 +819,8 @@ H5HF__huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, const void *_nrec FUNC_ENTER_STATIC_NOERR - HDfprintf(stream, "%*s%-*s {%a, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len); + HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE "}\n", indent, "", fwidth, + "Record:", nrecord->addr, nrecord->len); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_dir_debug() */ @@ -1028,8 +1030,8 @@ H5HF__huge_bt2_filt_dir_debug(FILE *stream, int indent, int fwidth, const void * FUNC_ENTER_STATIC_NOERR - HDfprintf(stream, "%*s%-*s {%a, %Hu, %x, %Hu}\n", indent, "", fwidth, "Record:", nrecord->addr, - nrecord->len, nrecord->filter_mask, nrecord->obj_size); + HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE ", %x, %" PRIuHSIZE "}\n", indent, "", fwidth, + "Record:", nrecord->addr, nrecord->len, nrecord->filter_mask, nrecord->obj_size); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_filt_dir_debug() */ diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 76c20e1..9d1adb1 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -153,8 +153,8 @@ H5HF_id_print(H5HF_t *fh, const void *_id, FILE *stream, int indent, int fwidth) 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); + HDfprintf(stream, "%*s%-*s (%c, %" PRIuHSIZE " , %zu)\n", indent, "", fwidth, + "Heap ID info: (type, offset, length)", id_type, obj_off, obj_len); done: FUNC_LEAVE_NOAPI(ret_value) @@ -190,9 +190,9 @@ H5HF__dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fw */ /* Creation parameter values */ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Doubling table width:", dtable->cparam.width); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Starting block size:", dtable->cparam.start_block_size); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Max. direct block size:", dtable->cparam.max_direct_size); HDfprintf(stream, "%*s%-*s %u (bits)\n", indent, "", fwidth, "Max. index size:", dtable->cparam.max_index); @@ -200,7 +200,8 @@ H5HF__dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fw "Starting # of rows in root indirect block:", dtable->cparam.start_root_rows); /* Run-time varying parameter values */ - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Table's root address:", dtable->table_addr); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Table's root address:", dtable->table_addr); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Current # of rows in root indirect block:", dtable->curr_root_rows); @@ -211,7 +212,7 @@ H5HF__dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fw "Max. # of direct rows in any indirect block:", dtable->max_direct_rows); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "# of bits for IDs in first row:", dtable->first_row_bits); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, "# of IDs in first row:", dtable->num_id_first_row); FUNC_LEAVE_NOAPI(SUCCEED) @@ -250,32 +251,37 @@ H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal, FILE *stream, int i */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Heap is:", hdr->man_dtable.curr_root_rows > 0 ? "Indirect" : "Direct"); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, - "Objects stored in 'debugging' format:", hdr->debug_objs); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, "'Write once' flag:", hdr->write_once); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, - "'Huge' object IDs have wrapped:", hdr->huge_ids_wrapped); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Objects stored in 'debugging' format:", hdr->debug_objs ? "TRUE" : "FALSE"); + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "'Write once' flag:", hdr->write_once ? "TRUE" : "FALSE"); + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "'Huge' object IDs have wrapped:", hdr->huge_ids_wrapped ? "TRUE" : "FALSE"); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, "Free space in managed blocks:", hdr->total_man_free); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Managed space data block size:", hdr->man_size); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, + "Managed space data block size:", hdr->man_size); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, "Total managed space allocated:", hdr->man_alloc_size); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, "Offset of managed space iterator:", hdr->man_iter_off); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, "Number of managed objects in heap:", hdr->man_nobjs); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of free space manager for managed blocks:", hdr->fs_addr); HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, "Max. size of managed object:", (unsigned long)hdr->max_man_size); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "'Huge' object space used:", hdr->huge_size); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, + "'Huge' object space used:", hdr->huge_size); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, "Number of 'huge' objects in heap:", hdr->huge_nobjs); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "ID of next 'huge' object:", hdr->huge_next_id); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, + "ID of next 'huge' object:", hdr->huge_next_id); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of v2 B-tree for 'huge' objects:", hdr->huge_bt2_addr); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "'Tiny' object space used:", hdr->tiny_size); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, + "'Tiny' object space used:", hdr->tiny_size); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, "Number of 'tiny' objects in heap:", hdr->tiny_nobjs); HDfprintf(stream, "%*sManaged Objects Doubling-Table Info...\n", indent, ""); @@ -285,7 +291,7 @@ H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal, FILE *stream, int i if (hdr->filter_len > 0) { HDfprintf(stream, "%*sI/O filter Info...\n", indent, ""); if (hdr->man_dtable.curr_root_rows == 0) { - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), "Compressed size of root direct block:", hdr->pline_root_direct_size); HDfprintf(stream, "%*s%-*s %x\n", indent + 3, "", MAX(0, fwidth - 3), "Filter mask for root direct block:", hdr->pline_root_direct_filter_mask); @@ -301,7 +307,7 @@ H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal, FILE *stream, int i HDfprintf(stream, "%*s%-*s %x\n", indent + 3, "", MAX(0, fwidth - 3), "Root indirect block flags:", hdr->root_iblock_flags); HDfprintf(stream, "%*s%-*s %p\n", indent + 3, "", MAX(0, fwidth - 3), - "Root indirect block pointer:", hdr->root_iblock); + "Root indirect block pointer:", (void *)hdr->root_iblock); if (hdr->root_iblock) H5HF_iblock_print(hdr->root_iblock, dump_internal, stream, indent + 3, fwidth); } /* end if */ @@ -412,7 +418,7 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata) len = end - start; HDsnprintf(temp_str, sizeof(temp_str), "Section #%u:", (unsigned)udata->sect_count); - HDfprintf(udata->stream, "%*s%-*s %8Zu, %8Zu\n", udata->indent + 3, "", MAX(0, udata->fwidth - 9), + HDfprintf(udata->stream, "%*s%-*s %8zu, %8zu\n", udata->indent + 3, "", MAX(0, udata->fwidth - 9), temp_str, start, len); udata->sect_count++; @@ -486,12 +492,12 @@ H5HF_dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* * Print the values. */ - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of fractal heap that owns this block:", hdr->heap_addr); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, "Offset of direct block in heap:", dblock->block_off); blk_prefix_size = H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of block header:", blk_prefix_size); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of block header:", blk_prefix_size); /* Allocate space for the free space markers */ if (NULL == (marker = (uint8_t *)H5MM_calloc(dblock->size))) @@ -594,11 +600,11 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal, FILE *st /* * Print the values. */ - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of fractal heap that owns this block:", hdr->heap_addr); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, "Offset of indirect block in heap:", iblock->block_off); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Size of indirect block:", iblock->size); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of indirect block:", iblock->size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Current # of rows:", iblock->nrows); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Max. # of rows:", iblock->max_rows); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, @@ -618,11 +624,11 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal, FILE *st HDsnprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v); if (hdr->filter_len > 0) - HDfprintf(stream, "%*s%-*s %9a/%6Zu/%x\n", indent + 6, "", MAX(0, fwidth - 6), temp_str, - iblock->ents[off].addr, iblock->filt_ents[off].size, + HDfprintf(stream, "%*s%-*s %9" PRIuHADDR "/%6zu/%x\n", indent + 6, "", MAX(0, fwidth - 6), + temp_str, iblock->ents[off].addr, iblock->filt_ents[off].size, iblock->filt_ents[off].filter_mask); else - HDfprintf(stream, "%*s%-*s %9a\n", indent + 6, "", MAX(0, fwidth - 6), temp_str, + HDfprintf(stream, "%*s%-*s %9" PRIuHADDR "\n", indent + 6, "", MAX(0, fwidth - 6), temp_str, iblock->ents[off].addr); } /* end for */ } /* end for */ @@ -642,7 +648,7 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal, FILE *st size_t off = (u * hdr->man_dtable.cparam.width) + v; HDsnprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v); - HDfprintf(stream, "%*s%-*s %9a\n", indent + 6, "", MAX(0, fwidth - 6), temp_str, + HDfprintf(stream, "%*s%-*s %9" PRIuHADDR "\n", indent + 6, "", MAX(0, fwidth - 6), temp_str, iblock->ents[off].addr); } /* end for */ } /* end for */ @@ -655,12 +661,12 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal, FILE *st HDfprintf(stream, "%*sFractal Indirect Block Internal Information:\n", indent, ""); /* Print general information */ - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), "Reference count:", iblock->rc); /* Print parent's information */ HDfprintf(stream, "%*s%-*s %p\n", indent + 3, "", MAX(0, fwidth - 3), - "Parent indirect block address:", iblock->parent); + "Parent indirect block address:", (void *)iblock->parent); if (iblock->parent) H5HF_iblock_print(iblock->parent, TRUE, stream, indent + 6, fwidth); } /* end if */ @@ -760,9 +766,9 @@ H5HF_sects_debug_cb(H5FS_section_info_t *_sect, void *_udata) : (sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW ? "first row" : (sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW ? "normal row" : "unknown")))); - HDfprintf(udata->stream, "%*s%-*s %a\n", udata->indent, "", udata->fwidth, + HDfprintf(udata->stream, "%*s%-*s %" PRIuHADDR "\n", udata->indent, "", udata->fwidth, "Section address:", sect->sect_info.addr); - HDfprintf(udata->stream, "%*s%-*s %Hu\n", udata->indent, "", udata->fwidth, + HDfprintf(udata->stream, "%*s%-*s %" PRIuHSIZE "\n", udata->indent, "", udata->fwidth, "Section size:", sect->sect_info.size); /* Dump section-specific debugging information */ diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 341b83b..ad2c833 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -396,7 +396,7 @@ H5HF__man_dblock_new(H5HF_hdr_t *hdr, size_t request, H5HF_free_section_t **ret_ if (min_dblock_size > next_size) { HDfprintf( stderr, - "%s: Skipping direct block sizes not supported, min_dblock_size = %Zu, next_size = %Zu\n", + "%s: Skipping direct block sizes not supported, min_dblock_size = %zu, next_size = %zu\n", FUNC, min_dblock_size, next_size); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "skipping direct block sizes not supported yet") } /* end if */ diff --git a/src/H5HL.c b/src/H5HL.c index a12194b..4186d2a 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -100,78 +100,78 @@ H5FL_BLK_DEFINE(lheap_chunk); */ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_create(H5F_t *f, 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 = 0; /* Total heap size on disk */ - -/* check arguments */ -HDassert(f); -HDassert(addr_p); - -/* Adjust size hint as necessary */ -if (size_hint && size_hint < H5HL_SIZEOF_FREE(f)) - size_hint = H5HL_SIZEOF_FREE(f); -size_hint = H5HL_ALIGN(size_hint); - -/* Allocate new heap structure */ -if (NULL == (heap = H5HL__new(H5F_SIZEOF_SIZE(f), H5F_SIZEOF_ADDR(f), H5HL_SIZEOF_HDR(f)))) - H5E_THROW(H5E_CANTALLOC, "can't allocate new heap struct"); - -/* Allocate file space */ -total_size = heap->prfx_size + size_hint; -if (HADDR_UNDEF == (heap->prfx_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, total_size))) - H5E_THROW(H5E_CANTALLOC, "unable to allocate file memory"); - -/* Initialize info */ -heap->single_cache_obj = TRUE; -heap->dblk_addr = heap->prfx_addr + (hsize_t)heap->prfx_size; -heap->dblk_size = size_hint; -if (size_hint) - if (NULL == (heap->dblk_image = H5FL_BLK_CALLOC(lheap_chunk, size_hint))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); - -/* free list */ -if (size_hint) { - if (NULL == (heap->freelist = H5FL_MALLOC(H5HL_free_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); - heap->freelist->offset = 0; - heap->freelist->size = size_hint; - heap->freelist->prev = heap->freelist->next = NULL; - heap->free_block = 0; -} /* end if */ -else { - heap->freelist = NULL; - heap->free_block = H5HL_FREE_NULL; -} /* end else */ - -/* Allocate the heap prefix */ -if (NULL == (prfx = H5HL__prfx_new(heap))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); - -/* Add to cache */ -if (FAIL == H5AC_insert_entry(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET)) - H5E_THROW(H5E_CANTINIT, "unable to cache local heap prefix"); - -/* Set address to return */ -*addr_p = heap->prfx_addr; - -CATCH -if (ret_value < 0) { - *addr_p = HADDR_UNDEF; - if (prfx) { - if (FAIL == H5HL__prfx_dest(prfx)) - H5E_THROW(H5E_CANTFREE, "unable to destroy local heap prefix"); + H5HL_t * heap = NULL; /* Heap created */ + H5HL_prfx_t *prfx = NULL; /* Heap prefix */ + hsize_t total_size = 0; /* Total heap size on disk */ + + /* check arguments */ + HDassert(f); + HDassert(addr_p); + + /* Adjust size hint as necessary */ + if (size_hint && size_hint < H5HL_SIZEOF_FREE(f)) + size_hint = H5HL_SIZEOF_FREE(f); + size_hint = H5HL_ALIGN(size_hint); + + /* Allocate new heap structure */ + if (NULL == (heap = H5HL__new(H5F_SIZEOF_SIZE(f), H5F_SIZEOF_ADDR(f), H5HL_SIZEOF_HDR(f)))) + H5E_THROW(H5E_CANTALLOC, "can't allocate new heap struct"); + + /* Allocate file space */ + total_size = heap->prfx_size + size_hint; + if (HADDR_UNDEF == (heap->prfx_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, total_size))) + H5E_THROW(H5E_CANTALLOC, "unable to allocate file memory"); + + /* Initialize info */ + heap->single_cache_obj = TRUE; + heap->dblk_addr = heap->prfx_addr + (hsize_t)heap->prfx_size; + heap->dblk_size = size_hint; + if (size_hint) + if (NULL == (heap->dblk_image = H5FL_BLK_CALLOC(lheap_chunk, size_hint))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + + /* free list */ + if (size_hint) { + if (NULL == (heap->freelist = H5FL_MALLOC(H5HL_free_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + heap->freelist->offset = 0; + heap->freelist->size = size_hint; + heap->freelist->prev = heap->freelist->next = NULL; + heap->free_block = 0; } /* end if */ else { - if (heap) { - if (H5F_addr_defined(heap->prfx_addr)) - if (FAIL == H5MF_xfree(f, H5FD_MEM_LHEAP, heap->prfx_addr, total_size)) - H5E_THROW(H5E_CANTFREE, "can't release heap data?"); - if (FAIL == H5HL__dest(heap)) - H5E_THROW(H5E_CANTFREE, "unable to destroy local heap"); + heap->freelist = NULL; + heap->free_block = H5HL_FREE_NULL; + } /* end else */ + + /* Allocate the heap prefix */ + if (NULL == (prfx = H5HL__prfx_new(heap))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + + /* Add to cache */ + if (FAIL == H5AC_insert_entry(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET)) + H5E_THROW(H5E_CANTINIT, "unable to cache local heap prefix"); + + /* Set address to return */ + *addr_p = heap->prfx_addr; + + CATCH + if (ret_value < 0) { + *addr_p = HADDR_UNDEF; + if (prfx) { + if (FAIL == H5HL__prfx_dest(prfx)) + H5E_THROW(H5E_CANTFREE, "unable to destroy local heap prefix"); } /* end if */ - } /* end else */ -} /* end if */ + else { + if (heap) { + if (H5F_addr_defined(heap->prfx_addr)) + if (FAIL == H5MF_xfree(f, H5FD_MEM_LHEAP, heap->prfx_addr, total_size)) + H5E_THROW(H5E_CANTFREE, "can't release heap data?"); + if (FAIL == H5HL__dest(heap)) + H5E_THROW(H5E_CANTFREE, "unable to destroy local heap"); + } /* end if */ + } /* end else */ + } /* end if */ END_FUNC(PRIV) /* end H5HL_create() */ @@ -190,103 +190,104 @@ END_FUNC(PRIV) /* end H5HL_create() */ */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__minimize_heap_space(H5F_t *f, H5HL_t *heap)) -size_t new_heap_size = heap->dblk_size; /* New size of heap */ - -/* check args */ -HDassert(f); -HDassert(heap); + size_t new_heap_size = heap->dblk_size; /* New size of heap */ -/* - * Check to see if we can reduce the size of the heap in memory by - * eliminating free blocks at the tail of the buffer before flushing the - * buffer out. - */ -if (heap->freelist) { - H5HL_free_t *tmp_fl; - H5HL_free_t *last_fl = NULL; - - /* Search for a free block at the end of the buffer */ - for (tmp_fl = heap->freelist; tmp_fl; tmp_fl = tmp_fl->next) - /* Check if the end of this free block is at the end of the buffer */ - if (tmp_fl->offset + tmp_fl->size == heap->dblk_size) { - last_fl = tmp_fl; - break; - } /* end if */ + /* check args */ + HDassert(f); + HDassert(heap); /* - * Found free block at the end of the buffer, decide what to do - * about it + * Check to see if we can reduce the size of the heap in memory by + * eliminating free blocks at the tail of the buffer before flushing the + * buffer out. */ - if (last_fl) { + if (heap->freelist) { + H5HL_free_t *tmp_fl; + H5HL_free_t *last_fl = NULL; + + /* Search for a free block at the end of the buffer */ + for (tmp_fl = heap->freelist; tmp_fl; tmp_fl = tmp_fl->next) + /* Check if the end of this free block is at the end of the buffer */ + if (tmp_fl->offset + tmp_fl->size == heap->dblk_size) { + last_fl = tmp_fl; + break; + } /* end if */ + /* - * If the last free block's size is more than half the memory - * buffer size (and the memory buffer is larger than the - * minimum size), reduce or eliminate it. + * Found free block at the end of the buffer, decide what to do + * about it */ - if (last_fl->size >= (heap->dblk_size / 2) && heap->dblk_size > H5HL_MIN_HEAP) { - /* - * Reduce size of buffer until it's too small or would - * eliminate the free block - */ - while (new_heap_size > H5HL_MIN_HEAP && new_heap_size >= (last_fl->offset + H5HL_SIZEOF_FREE(f))) - new_heap_size /= 2; - + if (last_fl) { /* - * Check if reducing the memory buffer size would - * eliminate the free block + * If the last free block's size is more than half the memory + * buffer size (and the memory buffer is larger than the + * minimum size), reduce or eliminate it. */ - if (new_heap_size < (last_fl->offset + H5HL_SIZEOF_FREE(f))) { - /* Check if this is the only block on the free list */ - if (last_fl->prev == NULL && last_fl->next == NULL) { - /* Double the new memory size */ - new_heap_size *= 2; - + if (last_fl->size >= (heap->dblk_size / 2) && heap->dblk_size > H5HL_MIN_HEAP) { + /* + * Reduce size of buffer until it's too small or would + * eliminate the free block + */ + while (new_heap_size > H5HL_MIN_HEAP && + new_heap_size >= (last_fl->offset + H5HL_SIZEOF_FREE(f))) + new_heap_size /= 2; + + /* + * Check if reducing the memory buffer size would + * eliminate the free block + */ + if (new_heap_size < (last_fl->offset + H5HL_SIZEOF_FREE(f))) { + /* Check if this is the only block on the free list */ + if (last_fl->prev == NULL && last_fl->next == NULL) { + /* Double the new memory size */ + new_heap_size *= 2; + + /* Truncate the free block */ + last_fl->size = H5HL_ALIGN(new_heap_size - last_fl->offset); + new_heap_size = last_fl->offset + last_fl->size; + HDassert(last_fl->size >= H5HL_SIZEOF_FREE(f)); + } /* end if */ + else { + /* + * Set the size of the memory buffer to the start + * of the free list + */ + new_heap_size = last_fl->offset; + + /* Eliminate the free block from the list */ + last_fl = H5HL__remove_free(heap, last_fl); + } /* end else */ + } /* end if */ + else { /* Truncate the free block */ last_fl->size = H5HL_ALIGN(new_heap_size - last_fl->offset); new_heap_size = last_fl->offset + last_fl->size; HDassert(last_fl->size >= H5HL_SIZEOF_FREE(f)); - } /* end if */ - else { - /* - * Set the size of the memory buffer to the start - * of the free list - */ - new_heap_size = last_fl->offset; - - /* Eliminate the free block from the list */ - last_fl = H5HL__remove_free(heap, last_fl); + HDassert(last_fl->size == H5HL_ALIGN(last_fl->size)); } /* end else */ } /* end if */ - else { - /* Truncate the free block */ - last_fl->size = H5HL_ALIGN(new_heap_size - last_fl->offset); - new_heap_size = last_fl->offset + last_fl->size; - HDassert(last_fl->size >= H5HL_SIZEOF_FREE(f)); - HDassert(last_fl->size == H5HL_ALIGN(last_fl->size)); - } /* end else */ - } /* end if */ - } /* end if */ -} /* end if */ + } /* end if */ + } /* end if */ -/* - * If the heap grew smaller than disk storage then move the - * data segment of the heap to another contiguous block of disk - * storage. - */ -if (new_heap_size != heap->dblk_size) { - HDassert(new_heap_size < heap->dblk_size); + /* + * If the heap grew smaller than disk storage then move the + * data segment of the heap to another contiguous block of disk + * storage. + */ + if (new_heap_size != heap->dblk_size) { + HDassert(new_heap_size < heap->dblk_size); - /* Resize the memory buffer */ - if (NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, new_heap_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + /* Resize the memory buffer */ + if (NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, new_heap_size))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); - /* Reallocate data block in file */ - if (FAIL == H5HL__dblk_realloc(f, heap, new_heap_size)) - H5E_THROW(H5E_CANTRESIZE, "reallocating data block failed"); -} /* end if */ + /* Reallocate data block in file */ + if (FAIL == H5HL__dblk_realloc(f, heap, new_heap_size)) + H5E_THROW(H5E_CANTRESIZE, "reallocating data block failed"); + } /* end if */ -CATCH -/* No special processing on errors */ + CATCH + /* No special processing on errors */ END_FUNC(STATIC) /* H5HL__minimize_heap_space() */ @@ -305,64 +306,65 @@ END_FUNC(STATIC) /* H5HL__minimize_heap_space() */ */ BEGIN_FUNC(PRIV, ERR, H5HL_t *, NULL, NULL, H5HL_protect(H5F_t *f, 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 = 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 */ - -/* check arguments */ -HDassert(f); -HDassert(H5F_addr_defined(addr)); - -/* only the H5AC__READ_ONLY_FLAG may appear in flags */ -HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); - -/* Construct the user data for protect callback */ -prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); -prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f); -prfx_udata.prfx_addr = addr; -prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f); - -/* Protect the local heap prefix */ -if (NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix"); - -/* Get the pointer to the heap */ -heap = prfx->heap; - -/* Check if the heap is already pinned in memory */ -/* (for re-entrant situation) */ -if (heap->prots == 0) { - /* Check if heap has separate data block */ - if (heap->single_cache_obj) - /* Set the flag for pinning the prefix when unprotecting it */ - prfx_cache_flags |= H5AC__PIN_ENTRY_FLAG; - else { - /* Protect the local heap data block */ - if (NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, heap, flags))) - H5E_THROW(H5E_CANTPROTECT, "unable to load heap data block"); + 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 = 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 */ + + /* check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + + /* only the H5AC__READ_ONLY_FLAG may appear in flags */ + HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + + /* Construct the user data for protect callback */ + prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); + prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f); + prfx_udata.prfx_addr = addr; + prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f); + + /* Protect the local heap prefix */ + if (NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, flags))) + H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix"); + + /* Get the pointer to the heap */ + heap = prfx->heap; + + /* Check if the heap is already pinned in memory */ + /* (for re-entrant situation) */ + if (heap->prots == 0) { + /* Check if heap has separate data block */ + if (heap->single_cache_obj) + /* Set the flag for pinning the prefix when unprotecting it */ + prfx_cache_flags |= H5AC__PIN_ENTRY_FLAG; + else { + /* Protect the local heap data block */ + if (NULL == + (dblk = (H5HL_dblk_t *)H5AC_protect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, heap, flags))) + H5E_THROW(H5E_CANTPROTECT, "unable to load heap data block"); - /* Set the flag for pinning the data block when unprotecting it */ - dblk_cache_flags |= H5AC__PIN_ENTRY_FLAG; - } /* end if */ -} /* end if */ + /* Set the flag for pinning the data block when unprotecting it */ + dblk_cache_flags |= H5AC__PIN_ENTRY_FLAG; + } /* end if */ + } /* end if */ -/* Increment # of times heap is protected */ -heap->prots++; + /* Increment # of times heap is protected */ + heap->prots++; -/* Set return value */ -ret_value = heap; + /* Set return value */ + ret_value = heap; -CATCH -/* Release the prefix from the cache, now pinned */ -if (prfx && heap && H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, prfx_cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix"); + CATCH + /* Release the prefix from the cache, now pinned */ + if (prfx && heap && H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, prfx_cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix"); -/* Release the data block from the cache, now pinned */ -if (dblk && heap && H5AC_unprotect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, dblk_cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap data block"); + /* Release the data block from the cache, now pinned */ + if (dblk && heap && H5AC_unprotect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, dblk_cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap data block"); END_FUNC(PRIV) /* end H5HL_protect() */ @@ -382,14 +384,14 @@ END_FUNC(PRIV) /* end H5HL_protect() */ */ BEGIN_FUNC(PRIV, ERR, void *, NULL, NULL, H5HL_offset_into(const H5HL_t *heap, size_t offset)) -/* Sanity check */ -HDassert(heap); -if (offset >= heap->dblk_size) - H5E_THROW(H5E_CANTGET, "unable to offset into local heap data block"); + /* Sanity check */ + HDassert(heap); + if (offset >= heap->dblk_size) + H5E_THROW(H5E_CANTGET, "unable to offset into local heap data block"); -ret_value = heap->dblk_image + offset; + ret_value = heap->dblk_image + offset; -CATCH + CATCH /* No special processing on errors */ END_FUNC(PRIV) /* end H5HL_offset_into() */ @@ -407,33 +409,33 @@ END_FUNC(PRIV) /* end H5HL_offset_into() */ */ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_unprotect(H5HL_t *heap)) -/* check arguments */ -HDassert(heap); + /* check arguments */ + HDassert(heap); -/* Decrement # of times heap is protected */ -heap->prots--; + /* Decrement # of times heap is protected */ + heap->prots--; -/* Check for last unprotection of heap */ -if (heap->prots == 0) { - /* Check for separate heap data block */ - if (heap->single_cache_obj) { - /* Mark local heap prefix as evictable again */ - if (FAIL == H5AC_unpin_entry(heap->prfx)) - H5E_THROW(H5E_CANTUNPIN, "unable to unpin local heap data block"); - } /* end if */ - else { - /* Sanity check */ - HDassert(heap->dblk); + /* Check for last unprotection of heap */ + if (heap->prots == 0) { + /* Check for separate heap data block */ + if (heap->single_cache_obj) { + /* Mark local heap prefix as evictable again */ + if (FAIL == H5AC_unpin_entry(heap->prfx)) + H5E_THROW(H5E_CANTUNPIN, "unable to unpin local heap data block"); + } /* end if */ + else { + /* Sanity check */ + HDassert(heap->dblk); - /* Mark local heap data block as evictable again */ - /* (data block still pins prefix) */ - if (FAIL == H5AC_unpin_entry(heap->dblk)) - H5E_THROW(H5E_CANTUNPIN, "unable to unpin local heap data block"); - } /* end else */ -} /* end if */ + /* Mark local heap data block as evictable again */ + /* (data block still pins prefix) */ + if (FAIL == H5AC_unpin_entry(heap->dblk)) + H5E_THROW(H5E_CANTUNPIN, "unable to unpin local heap data block"); + } /* end else */ + } /* end if */ -CATCH -/* No special processing on errors */ + CATCH + /* No special processing on errors */ END_FUNC(PRIV) /* end H5HL_unprotect() */ @@ -452,16 +454,16 @@ END_FUNC(PRIV) /* end H5HL_unprotect() */ */ BEGIN_FUNC(STATIC, NOERR, H5HL_free_t *, NULL, -, H5HL__remove_free(H5HL_t *heap, H5HL_free_t *fl)) -if (fl->prev) - fl->prev->next = fl->next; -if (fl->next) - fl->next->prev = fl->prev; + if (fl->prev) + fl->prev->next = fl->next; + if (fl->next) + fl->next->prev = fl->prev; -if (!fl->prev) - heap->freelist = fl->next; + if (!fl->prev) + heap->freelist = fl->next; -/* H5FL_FREE always returns NULL so we can't check for errors */ -ret_value = (H5HL_free_t *)H5FL_FREE(H5HL_free_t, fl); + /* H5FL_FREE always returns NULL so we can't check for errors */ + ret_value = (H5HL_free_t *)H5FL_FREE(H5HL_free_t, fl); END_FUNC(STATIC) /* end H5HL__remove_free() */ @@ -479,25 +481,25 @@ END_FUNC(STATIC) /* end H5HL__remove_free() */ */ BEGIN_FUNC(STATIC, ERR, herr_t, SUCCEED, FAIL, H5HL__dirty(H5HL_t *heap)) -/* check arguments */ -HDassert(heap); -HDassert(heap->prfx); + /* check arguments */ + HDassert(heap); + HDassert(heap->prfx); -/* Mark heap data block as dirty, if there is one */ -if (!heap->single_cache_obj) { - /* Sanity check */ - HDassert(heap->dblk); + /* Mark heap data block as dirty, if there is one */ + if (!heap->single_cache_obj) { + /* Sanity check */ + HDassert(heap->dblk); - if (FAIL == H5AC_mark_entry_dirty(heap->dblk)) - H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap data block as dirty"); -} /* end if */ + if (FAIL == H5AC_mark_entry_dirty(heap->dblk)) + H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap data block as dirty"); + } /* end if */ -/* Mark heap prefix as dirty */ -if (FAIL == H5AC_mark_entry_dirty(heap->prfx)) - H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap prefix as dirty"); + /* Mark heap prefix as dirty */ + if (FAIL == H5AC_mark_entry_dirty(heap->prfx)) + H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap prefix as dirty"); -CATCH -/* No special processing on errors */ + CATCH + /* No special processing on errors */ END_FUNC(STATIC) /* end H5HL__dirty() */ @@ -517,192 +519,192 @@ END_FUNC(STATIC) /* end H5HL__dirty() */ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL, H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf)) -H5HL_free_t *fl = NULL, *last_fl = NULL; -size_t offset = 0; -size_t need_size; -hbool_t found; - -/* check arguments */ -HDassert(f); -HDassert(heap); -HDassert(buf_size > 0); -HDassert(buf); - -/* Mark heap as dirty in cache */ -/* (A bit early in the process, but it's difficult to determine in the - * code below where to mark the heap as dirty, especially in error cases, - * so we just accept that an extra flush of the heap info could occur - * if an error occurs -QAK) - */ -if (FAIL == H5HL__dirty(heap)) - H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap as dirty"); - -/* - * In order to keep the free list descriptors aligned on word boundaries, - * whatever that might mean, we round the size up to the next multiple of - * a word. - */ -need_size = H5HL_ALIGN(buf_size); + H5HL_free_t *fl = NULL, *last_fl = NULL; + size_t offset = 0; + size_t need_size; + hbool_t found; + + /* check arguments */ + HDassert(f); + HDassert(heap); + HDassert(buf_size > 0); + HDassert(buf); + + /* Mark heap as dirty in cache */ + /* (A bit early in the process, but it's difficult to determine in the + * code below where to mark the heap as dirty, especially in error cases, + * so we just accept that an extra flush of the heap info could occur + * if an error occurs -QAK) + */ + if (FAIL == H5HL__dirty(heap)) + H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap as dirty"); -/* - * Look for a free slot large enough for this object and which would - * leave zero or at least H5G_SIZEOF_FREE bytes left over. - */ -for (fl = heap->freelist, found = FALSE; fl; fl = fl->next) { - if (fl->size > need_size && fl->size - need_size >= H5HL_SIZEOF_FREE(f)) { - /* a big enough free block was found */ - offset = fl->offset; - fl->offset += need_size; - fl->size -= need_size; - HDassert(fl->offset == H5HL_ALIGN(fl->offset)); - HDassert(fl->size == H5HL_ALIGN(fl->size)); - found = TRUE; - break; - } - else if (fl->size == need_size) { - /* free block of exact size found */ - offset = fl->offset; - fl = H5HL__remove_free(heap, fl); - found = TRUE; - break; - } - else if (!last_fl || last_fl->offset < fl->offset) { - /* track free space that's closest to end of heap */ - last_fl = fl; - } -} /* end for */ - -/* - * If no free chunk was large enough, then allocate more space and - * add it to the free list. If the heap ends with a free chunk, we - * can extend that free chunk. Otherwise we'll have to make another - * free chunk. If the heap must expand, we double its size. - */ -if (found == FALSE) { - size_t need_more; /* How much more space we need */ - size_t new_dblk_size; /* Final size of space allocated for heap data block */ - size_t old_dblk_size; /* Previous size of space allocated for heap data block */ - htri_t was_extended; /* Whether the local heap's data segment on disk was extended */ - - /* At least double the heap's size, making certain there's enough room - * for the new object */ - need_more = MAX(need_size, heap->dblk_size); - - /* If there is no last free block or it's not at the end of the heap, - * and the amount of space to allocate is not big enough to include at - * least the new object and a free-list info, trim down the amount of - * space requested to just the amount of space needed. (Generally - * speaking, this only occurs when the heap is small -QAK) + /* + * In order to keep the free list descriptors aligned on word boundaries, + * whatever that might mean, we round the size up to the next multiple of + * a word. */ - if (!(last_fl && last_fl->offset + last_fl->size == heap->dblk_size) && - (need_more < (need_size + H5HL_SIZEOF_FREE(f)))) - need_more = need_size; - - new_dblk_size = heap->dblk_size + need_more; - HDassert(heap->dblk_size < new_dblk_size); - old_dblk_size = heap->dblk_size; - H5_CHECK_OVERFLOW(heap->dblk_size, size_t, hsize_t); - H5_CHECK_OVERFLOW(new_dblk_size, size_t, hsize_t); - - /* Extend current heap if possible */ - was_extended = - H5MF_try_extend(f, H5FD_MEM_LHEAP, heap->dblk_addr, (hsize_t)(heap->dblk_size), (hsize_t)need_more); - if (FAIL == was_extended) - H5E_THROW(H5E_CANTEXTEND, "error trying to extend heap"); - - /* Check if we extended the heap data block in file */ - if (was_extended == TRUE) { - /* Check for prefix & data block contiguous */ - if (heap->single_cache_obj) { - /* Resize prefix+data block */ - if (FAIL == H5AC_resize_entry(heap->prfx, (size_t)(heap->prfx_size + new_dblk_size))) - H5E_THROW(H5E_CANTRESIZE, "unable to resize heap prefix in cache"); - } /* end if */ - else { - /* Resize 'standalone' data block */ - if (FAIL == H5AC_resize_entry(heap->dblk, (size_t)new_dblk_size)) - H5E_THROW(H5E_CANTRESIZE, "unable to resize heap data block in cache"); - } /* end else */ + need_size = H5HL_ALIGN(buf_size); - /* Note new size */ - heap->dblk_size = new_dblk_size; - } /* end if */ - else { /* ...if we can't, allocate a new chunk & release the old */ - /* Reallocate data block in file */ - if (FAIL == H5HL__dblk_realloc(f, heap, new_dblk_size)) - H5E_THROW(H5E_CANTRESIZE, "reallocating data block failed"); - } /* end if */ + /* + * Look for a free slot large enough for this object and which would + * leave zero or at least H5G_SIZEOF_FREE bytes left over. + */ + for (fl = heap->freelist, found = FALSE; fl; fl = fl->next) { + if (fl->size > need_size && fl->size - need_size >= H5HL_SIZEOF_FREE(f)) { + /* a big enough free block was found */ + offset = fl->offset; + fl->offset += need_size; + fl->size -= need_size; + HDassert(fl->offset == H5HL_ALIGN(fl->offset)); + HDassert(fl->size == H5HL_ALIGN(fl->size)); + found = TRUE; + break; + } + else if (fl->size == need_size) { + /* free block of exact size found */ + offset = fl->offset; + fl = H5HL__remove_free(heap, fl); + found = TRUE; + break; + } + else if (!last_fl || last_fl->offset < fl->offset) { + /* track free space that's closest to end of heap */ + last_fl = fl; + } + } /* end for */ - /* If the last free list in the heap is at the end of the heap, extend it */ - if (last_fl && last_fl->offset + last_fl->size == old_dblk_size) { - /* - * Increase the size of the last free block. + /* + * If no free chunk was large enough, then allocate more space and + * add it to the free list. If the heap ends with a free chunk, we + * can extend that free chunk. Otherwise we'll have to make another + * free chunk. If the heap must expand, we double its size. + */ + if (found == FALSE) { + size_t need_more; /* How much more space we need */ + size_t new_dblk_size; /* Final size of space allocated for heap data block */ + size_t old_dblk_size; /* Previous size of space allocated for heap data block */ + htri_t was_extended; /* Whether the local heap's data segment on disk was extended */ + + /* At least double the heap's size, making certain there's enough room + * for the new object */ + need_more = MAX(need_size, heap->dblk_size); + + /* If there is no last free block or it's not at the end of the heap, + * and the amount of space to allocate is not big enough to include at + * least the new object and a free-list info, trim down the amount of + * space requested to just the amount of space needed. (Generally + * speaking, this only occurs when the heap is small -QAK) */ - offset = last_fl->offset; - last_fl->offset += need_size; - last_fl->size += need_more - need_size; - HDassert(last_fl->offset == H5HL_ALIGN(last_fl->offset)); - HDassert(last_fl->size == H5HL_ALIGN(last_fl->size)); + if (!(last_fl && last_fl->offset + last_fl->size == heap->dblk_size) && + (need_more < (need_size + H5HL_SIZEOF_FREE(f)))) + need_more = need_size; + + new_dblk_size = heap->dblk_size + need_more; + HDassert(heap->dblk_size < new_dblk_size); + old_dblk_size = heap->dblk_size; + H5_CHECK_OVERFLOW(heap->dblk_size, size_t, hsize_t); + H5_CHECK_OVERFLOW(new_dblk_size, size_t, hsize_t); + + /* Extend current heap if possible */ + was_extended = H5MF_try_extend(f, H5FD_MEM_LHEAP, heap->dblk_addr, (hsize_t)(heap->dblk_size), + (hsize_t)need_more); + if (FAIL == was_extended) + H5E_THROW(H5E_CANTEXTEND, "error trying to extend heap"); + + /* Check if we extended the heap data block in file */ + if (was_extended == TRUE) { + /* Check for prefix & data block contiguous */ + if (heap->single_cache_obj) { + /* Resize prefix+data block */ + if (FAIL == H5AC_resize_entry(heap->prfx, (size_t)(heap->prfx_size + new_dblk_size))) + H5E_THROW(H5E_CANTRESIZE, "unable to resize heap prefix in cache"); + } /* end if */ + else { + /* Resize 'standalone' data block */ + if (FAIL == H5AC_resize_entry(heap->dblk, (size_t)new_dblk_size)) + H5E_THROW(H5E_CANTRESIZE, "unable to resize heap data block in cache"); + } /* end else */ + + /* Note new size */ + heap->dblk_size = new_dblk_size; + } /* end if */ + else { /* ...if we can't, allocate a new chunk & release the old */ + /* Reallocate data block in file */ + if (FAIL == H5HL__dblk_realloc(f, heap, new_dblk_size)) + H5E_THROW(H5E_CANTRESIZE, "reallocating data block failed"); + } /* end if */ - if (last_fl->size < H5HL_SIZEOF_FREE(f)) { + /* If the last free list in the heap is at the end of the heap, extend it */ + if (last_fl && last_fl->offset + last_fl->size == old_dblk_size) { + /* + * Increase the size of the last free block. + */ + offset = last_fl->offset; + last_fl->offset += need_size; + last_fl->size += need_more - need_size; + HDassert(last_fl->offset == H5HL_ALIGN(last_fl->offset)); + HDassert(last_fl->size == H5HL_ALIGN(last_fl->size)); + + if (last_fl->size < H5HL_SIZEOF_FREE(f)) { #ifdef H5HL_DEBUG - if (H5DEBUG(HL) && last_fl->size) { - HDfprintf(H5DEBUG(HL), "H5HL: lost %lu bytes at line %d\n", (unsigned long)(last_fl->size), - __LINE__); - } + if (H5DEBUG(HL) && last_fl->size) { + HDfprintf(H5DEBUG(HL), "H5HL: lost %lu bytes at line %d\n", + (unsigned long)(last_fl->size), __LINE__); + } #endif - last_fl = H5HL__remove_free(heap, last_fl); - } - } /* end if */ - else { - /* - * Create a new free list element large enough that we can - * take some space out of it right away. - */ - offset = old_dblk_size; - if (need_more - need_size >= H5HL_SIZEOF_FREE(f)) { - if (NULL == (fl = H5FL_MALLOC(H5HL_free_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); - fl->offset = old_dblk_size + need_size; - fl->size = need_more - need_size; - HDassert(fl->offset == H5HL_ALIGN(fl->offset)); - HDassert(fl->size == H5HL_ALIGN(fl->size)); - fl->prev = NULL; - fl->next = heap->freelist; - if (heap->freelist) - heap->freelist->prev = fl; - heap->freelist = fl; + last_fl = H5HL__remove_free(heap, last_fl); + } + } /* end if */ + else { + /* + * Create a new free list element large enough that we can + * take some space out of it right away. + */ + offset = old_dblk_size; + if (need_more - need_size >= H5HL_SIZEOF_FREE(f)) { + if (NULL == (fl = H5FL_MALLOC(H5HL_free_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + fl->offset = old_dblk_size + need_size; + fl->size = need_more - need_size; + HDassert(fl->offset == H5HL_ALIGN(fl->offset)); + HDassert(fl->size == H5HL_ALIGN(fl->size)); + fl->prev = NULL; + fl->next = heap->freelist; + if (heap->freelist) + heap->freelist->prev = fl; + heap->freelist = fl; #ifdef H5HL_DEBUG - } - else if (H5DEBUG(HL) && need_more > need_size) { - HDfprintf(H5DEBUG(HL), "H5HL_insert: lost %lu bytes at line %d\n", - (unsigned long)(need_more - need_size), __LINE__); + } + else if (H5DEBUG(HL) && need_more > need_size) { + HDfprintf(H5DEBUG(HL), "H5HL_insert: lost %lu bytes at line %d\n", + (unsigned long)(need_more - need_size), __LINE__); #endif - } - } /* end else */ + } + } /* end else */ #ifdef H5HL_DEBUG - if (H5DEBUG(HL)) { - HDfprintf(H5DEBUG(HL), "H5HL: resize mem buf from %lu to %lu bytes\n", (unsigned long)(old_dblk_size), - (unsigned long)(old_dblk_size + need_more)); - } + if (H5DEBUG(HL)) { + HDfprintf(H5DEBUG(HL), "H5HL: resize mem buf from %lu to %lu bytes\n", + (unsigned long)(old_dblk_size), (unsigned long)(old_dblk_size + need_more)); + } #endif - if (NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, heap->dblk_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + if (NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, heap->dblk_size))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); - /* Clear new section so junk doesn't appear in the file */ - /* (Avoid clearing section which will be overwritten with newly inserted data) */ - HDmemset(heap->dblk_image + offset + buf_size, 0, (new_dblk_size - (offset + buf_size))); -} /* end if */ + /* Clear new section so junk doesn't appear in the file */ + /* (Avoid clearing section which will be overwritten with newly inserted data) */ + HDmemset(heap->dblk_image + offset + buf_size, 0, (new_dblk_size - (offset + buf_size))); + } /* end if */ -/* Copy the data into the heap */ -H5MM_memcpy(heap->dblk_image + offset, buf, buf_size); + /* Copy the data into the heap */ + H5MM_memcpy(heap->dblk_image + offset, buf, buf_size); -/* Set return value */ -ret_value = offset; + /* Set return value */ + ret_value = offset; -CATCH -/* No special processing on errors */ + CATCH + /* No special processing on errors */ END_FUNC(PRIV) /* H5HL_insert() */ @@ -731,125 +733,125 @@ END_FUNC(PRIV) /* H5HL_insert() */ */ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size)) -H5HL_free_t *fl = NULL; + H5HL_free_t *fl = NULL; -/* check arguments */ -HDassert(f); -HDassert(heap); -HDassert(size > 0); -HDassert(offset == H5HL_ALIGN(offset)); + /* check arguments */ + HDassert(f); + HDassert(heap); + HDassert(size > 0); + HDassert(offset == H5HL_ALIGN(offset)); -size = H5HL_ALIGN(size); + size = H5HL_ALIGN(size); -HDassert(offset < heap->dblk_size); -HDassert(offset + size <= heap->dblk_size); + HDassert(offset < heap->dblk_size); + HDassert(offset + size <= heap->dblk_size); -/* Mark heap as dirty in cache */ -/* (A bit early in the process, but it's difficult to determine in the - * code below where to mark the heap as dirty, especially in error cases, - * so we just accept that an extra flush of the heap info could occur - * if an error occurs -QAK) - */ -if (FAIL == H5HL__dirty(heap)) - H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap as dirty"); + /* Mark heap as dirty in cache */ + /* (A bit early in the process, but it's difficult to determine in the + * code below where to mark the heap as dirty, especially in error cases, + * so we just accept that an extra flush of the heap info could occur + * if an error occurs -QAK) + */ + if (FAIL == H5HL__dirty(heap)) + H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap as dirty"); -/* - * Check if this chunk can be prepended or appended to an already - * free chunk. It might also fall between two chunks in such a way - * that all three chunks can be combined into one. - */ -fl = heap->freelist; -while (fl) { - H5HL_free_t *fl2 = NULL; - - if ((offset + size) == fl->offset) { - fl->offset = offset; - fl->size += size; - HDassert(fl->offset == H5HL_ALIGN(fl->offset)); - HDassert(fl->size == H5HL_ALIGN(fl->size)); - fl2 = fl->next; - while (fl2) { - if ((fl2->offset + fl2->size) == fl->offset) { - fl->offset = fl2->offset; - fl->size += fl2->size; - HDassert(fl->offset == H5HL_ALIGN(fl->offset)); - HDassert(fl->size == H5HL_ALIGN(fl->size)); - fl2 = H5HL__remove_free(heap, fl2); - if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) { - if (FAIL == H5HL__minimize_heap_space(f, heap)) - H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); + /* + * Check if this chunk can be prepended or appended to an already + * free chunk. It might also fall between two chunks in such a way + * that all three chunks can be combined into one. + */ + fl = heap->freelist; + while (fl) { + H5HL_free_t *fl2 = NULL; + + if ((offset + size) == fl->offset) { + fl->offset = offset; + fl->size += size; + HDassert(fl->offset == H5HL_ALIGN(fl->offset)); + HDassert(fl->size == H5HL_ALIGN(fl->size)); + fl2 = fl->next; + while (fl2) { + if ((fl2->offset + fl2->size) == fl->offset) { + fl->offset = fl2->offset; + fl->size += fl2->size; + HDassert(fl->offset == H5HL_ALIGN(fl->offset)); + HDassert(fl->size == H5HL_ALIGN(fl->size)); + fl2 = H5HL__remove_free(heap, fl2); + if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) { + if (FAIL == H5HL__minimize_heap_space(f, heap)) + H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); + } + H5_LEAVE(SUCCEED); } - H5_LEAVE(SUCCEED); + fl2 = fl2->next; } - fl2 = fl2->next; - } - if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) { - if (FAIL == H5HL__minimize_heap_space(f, heap)) - H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); + if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) { + if (FAIL == H5HL__minimize_heap_space(f, heap)) + H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); + } + H5_LEAVE(SUCCEED); } - H5_LEAVE(SUCCEED); - } - else if (fl->offset + fl->size == offset) { - fl->size += size; - fl2 = fl->next; - HDassert(fl->size == H5HL_ALIGN(fl->size)); - while (fl2) { - if (fl->offset + fl->size == fl2->offset) { - fl->size += fl2->size; - HDassert(fl->size == H5HL_ALIGN(fl->size)); - fl2 = H5HL__remove_free(heap, fl2); - if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) { - if (FAIL == H5HL__minimize_heap_space(f, heap)) - H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); + else if (fl->offset + fl->size == offset) { + fl->size += size; + fl2 = fl->next; + HDassert(fl->size == H5HL_ALIGN(fl->size)); + while (fl2) { + if (fl->offset + fl->size == fl2->offset) { + fl->size += fl2->size; + HDassert(fl->size == H5HL_ALIGN(fl->size)); + fl2 = H5HL__remove_free(heap, fl2); + if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) { + if (FAIL == H5HL__minimize_heap_space(f, heap)) + H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); + } /* end if */ + H5_LEAVE(SUCCEED); } /* end if */ - H5_LEAVE(SUCCEED); + fl2 = fl2->next; + } /* end while */ + if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) { + if (FAIL == H5HL__minimize_heap_space(f, heap)) + H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); } /* end if */ - fl2 = fl2->next; - } /* end while */ - if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) { - if (FAIL == H5HL__minimize_heap_space(f, heap)) - H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); + H5_LEAVE(SUCCEED); } /* end if */ - H5_LEAVE(SUCCEED); - } /* end if */ - fl = fl->next; -} /* end while */ + fl = fl->next; + } /* end while */ -/* - * The amount which is being removed must be large enough to - * hold the free list data. If not, the freed chunk is forever - * lost. - */ -if (size < H5HL_SIZEOF_FREE(f)) { + /* + * The amount which is being removed must be large enough to + * hold the free list data. If not, the freed chunk is forever + * lost. + */ + if (size < H5HL_SIZEOF_FREE(f)) { #ifdef H5HL_DEBUG - if (H5DEBUG(HL)) { - HDfprintf(H5DEBUG(HL), "H5HL: lost %lu bytes\n", (unsigned long)size); - } + if (H5DEBUG(HL)) { + HDfprintf(H5DEBUG(HL), "H5HL: lost %lu bytes\n", (unsigned long)size); + } #endif - H5_LEAVE(SUCCEED); -} /* end if */ + H5_LEAVE(SUCCEED); + } /* end if */ -/* - * Add an entry to the free list. - */ -if (NULL == (fl = H5FL_MALLOC(H5HL_free_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); -fl->offset = offset; -fl->size = size; -HDassert(fl->offset == H5HL_ALIGN(fl->offset)); -HDassert(fl->size == H5HL_ALIGN(fl->size)); -fl->prev = NULL; -fl->next = heap->freelist; -if (heap->freelist) - heap->freelist->prev = fl; -heap->freelist = fl; - -if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) - if (FAIL == H5HL__minimize_heap_space(f, heap)) - H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); - -CATCH -/* No special processing on exit */ + /* + * Add an entry to the free list. + */ + if (NULL == (fl = H5FL_MALLOC(H5HL_free_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + fl->offset = offset; + fl->size = size; + HDassert(fl->offset == H5HL_ALIGN(fl->offset)); + HDassert(fl->size == H5HL_ALIGN(fl->size)); + fl->prev = NULL; + fl->next = heap->freelist; + if (heap->freelist) + heap->freelist->prev = fl; + heap->freelist = fl; + + if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) + if (FAIL == H5HL__minimize_heap_space(f, heap)) + H5E_THROW(H5E_CANTFREE, "heap size minimization failed"); + + CATCH + /* No special processing on exit */ END_FUNC(PRIV) /* end H5HL_remove() */ @@ -867,47 +869,48 @@ END_FUNC(PRIV) /* end H5HL_remove() */ */ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_delete(H5F_t *f, haddr_t addr)) -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 */ -unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting heap */ + 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 */ + unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting heap */ -/* check arguments */ -HDassert(f); -HDassert(H5F_addr_defined(addr)); + /* check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); -/* Construct the user data for protect callback */ -prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); -prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f); -prfx_udata.prfx_addr = addr; -prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f); + /* Construct the user data for protect callback */ + prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); + prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f); + prfx_udata.prfx_addr = addr; + prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f); -/* Protect the local heap prefix */ -if (NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix"); + /* Protect the local heap prefix */ + if (NULL == + (prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC__NO_FLAGS_SET))) + H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix"); -/* Get the pointer to the heap */ -heap = prfx->heap; + /* Get the pointer to the heap */ + heap = prfx->heap; -/* Check if heap has separate data block */ -if (!heap->single_cache_obj) - /* Protect the local heap data block */ - if (NULL == - (dblk = (H5HL_dblk_t *)H5AC_protect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, heap, H5AC__NO_FLAGS_SET))) - H5E_THROW(H5E_CANTPROTECT, "unable to load heap data block"); + /* Check if heap has separate data block */ + if (!heap->single_cache_obj) + /* Protect the local heap data block */ + if (NULL == (dblk = (H5HL_dblk_t *)H5AC_protect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, heap, + H5AC__NO_FLAGS_SET))) + H5E_THROW(H5E_CANTPROTECT, "unable to load heap data block"); -/* Set the flags for releasing the prefix and data block */ -cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; + /* Set the flags for releasing the prefix and data block */ + cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; -CATCH -/* Release the data block from the cache, now deleted */ -if (dblk && heap && H5AC_unprotect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap data block"); + CATCH + /* Release the data block from the cache, now deleted */ + if (dblk && heap && H5AC_unprotect(f, H5AC_LHEAP_DBLK, heap->dblk_addr, dblk, cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap data block"); -/* Release the prefix from the cache, now deleted */ -if (prfx && heap && H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, cache_flags) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix"); + /* Release the prefix from the cache, now deleted */ + if (prfx && heap && H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix"); END_FUNC(PRIV) /* end H5HL_delete() */ @@ -925,34 +928,35 @@ END_FUNC(PRIV) /* end H5HL_delete() */ */ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_get_size(H5F_t *f, haddr_t addr, size_t *size)) -H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ -H5HL_prfx_t * prfx = NULL; /* Local heap prefix */ -H5HL_t * heap; /* Heap data structure */ + H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ + H5HL_prfx_t * prfx = NULL; /* Local heap prefix */ + H5HL_t * heap; /* Heap data structure */ -/* check arguments */ -HDassert(f); -HDassert(H5F_addr_defined(addr)); -HDassert(size); + /* check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(size); -/* Construct the user data for protect callback */ -prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); -prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f); -prfx_udata.prfx_addr = addr; -prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f); + /* Construct the user data for protect callback */ + prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); + prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f); + prfx_udata.prfx_addr = addr; + prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f); -/* Protect the local heap prefix */ -if (NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix"); + /* Protect the local heap prefix */ + if (NULL == + (prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC__READ_ONLY_FLAG))) + H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix"); -/* Get the pointer to the heap */ -heap = prfx->heap; + /* Get the pointer to the heap */ + heap = prfx->heap; -/* Set the size to return */ -*size = heap->dblk_size; + /* Set the size to return */ + *size = heap->dblk_size; -CATCH -if (prfx && FAIL == H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET)) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix"); + CATCH + if (prfx && FAIL == H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET)) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix"); END_FUNC(PRIV) /* end H5HL_get_size() */ @@ -971,33 +975,34 @@ END_FUNC(PRIV) /* end H5HL_get_size() */ */ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_heapsize(H5F_t *f, haddr_t addr, hsize_t *heap_size)) -H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ -H5HL_prfx_t * prfx = NULL; /* Local heap prefix */ -H5HL_t * heap; /* Heap data structure */ + H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ + H5HL_prfx_t * prfx = NULL; /* Local heap prefix */ + H5HL_t * heap; /* Heap data structure */ -/* check arguments */ -HDassert(f); -HDassert(H5F_addr_defined(addr)); -HDassert(heap_size); + /* check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(heap_size); -/* Construct the user data for protect callback */ -prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); -prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f); -prfx_udata.prfx_addr = addr; -prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f); + /* Construct the user data for protect callback */ + prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); + prfx_udata.sizeof_addr = H5F_SIZEOF_ADDR(f); + prfx_udata.prfx_addr = addr; + prfx_udata.sizeof_prfx = H5HL_SIZEOF_HDR(f); -/* Protect the local heap prefix */ -if (NULL == (prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix"); + /* Protect the local heap prefix */ + if (NULL == + (prfx = (H5HL_prfx_t *)H5AC_protect(f, H5AC_LHEAP_PRFX, addr, &prfx_udata, H5AC__READ_ONLY_FLAG))) + H5E_THROW(H5E_CANTPROTECT, "unable to load heap prefix"); -/* Get the pointer to the heap */ -heap = prfx->heap; + /* Get the pointer to the heap */ + heap = prfx->heap; -/* Accumulate the size of the local heap */ -*heap_size += (hsize_t)(heap->prfx_size + heap->dblk_size); + /* Accumulate the size of the local heap */ + *heap_size += (hsize_t)(heap->prfx_size + heap->dblk_size); -CATCH -if (prfx && FAIL == H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET)) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix"); + CATCH + if (prfx && FAIL == H5AC_unprotect(f, H5AC_LHEAP_PRFX, heap->prfx_addr, prfx, H5AC__NO_FLAGS_SET)) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release local heap prefix"); END_FUNC(PRIV) /* end H5HL_heapsize() */ diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index 4638543..bca7855 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -47,72 +47,71 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth)) -H5HL_t * h = NULL; -int free_block; -H5HL_free_t *freelist; -uint8_t * marker = NULL; -size_t amount_free = 0; - -/* check arguments */ -HDassert(f); -HDassert(H5F_addr_defined(addr)); -HDassert(stream); -HDassert(indent >= 0); -HDassert(fwidth >= 0); - -if (NULL == (h = (H5HL_t *)H5HL_protect(f, addr, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load/protect local heap"); - -HDfprintf(stream, "%*sLocal Heap...\n", indent, ""); -HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, - "Header size (in bytes):", (unsigned long)h->prfx_size); -HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of heap data:", h->dblk_addr); -HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Data bytes allocated for heap:", h->dblk_size); - -/* Traverse the free list and check that all free blocks fall within - * the heap and that no two free blocks point to the same region of - * the heap. - */ -if (NULL == (marker = (uint8_t *)H5MM_calloc(h->dblk_size))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); - -HDfprintf(stream, "%*sFree Blocks (offset, size):\n", indent, ""); -for (free_block = 0, freelist = h->freelist; freelist; freelist = freelist->next, free_block++) { - char temp_str[32]; - - HDsnprintf(temp_str, sizeof(temp_str), "Block #%d:", free_block); - HDfprintf(stream, "%*s%-*s %8Zu, %8Zu\n", indent + 3, "", MAX(0, fwidth - 9), temp_str, freelist->offset, - freelist->size); - if ((freelist->offset + freelist->size) > h->dblk_size) - HDfprintf(stream, "***THAT FREE BLOCK IS OUT OF BOUNDS!\n"); - else { - int overlap = 0; - size_t i; - - for (i = 0; i < freelist->size; i++) { - if (marker[freelist->offset + i]) - overlap++; - marker[freelist->offset + i] = 1; - } /* end for */ - if (overlap) - HDfprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n"); - else - amount_free += freelist->size; - } /* end else */ -} /* end for */ - -if (h->dblk_size) - HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of heap used:", - ((double)100.0f * (double)(h->dblk_size - amount_free) / (double)h->dblk_size)); - -/* Print the data in a VMS-style octal dump */ -H5_buffer_dump(stream, indent, h->dblk_image, marker, (size_t)0, h->dblk_size); - -CATCH -if (h && FAIL == H5HL_unprotect(h)) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release/unprotect local heap"); - -if (marker && NULL != (marker = (uint8_t *)H5MM_xfree(marker))) - H5E_THROW(H5E_CANTFREE, "can't free marker buffer"); + H5HL_t * h = NULL; + int free_block; + H5HL_free_t *freelist; + uint8_t * marker = NULL; + size_t amount_free = 0; + + /* check arguments */ + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(stream); + HDassert(indent >= 0); + HDassert(fwidth >= 0); + + if (NULL == (h = (H5HL_t *)H5HL_protect(f, addr, H5AC__READ_ONLY_FLAG))) + H5E_THROW(H5E_CANTPROTECT, "unable to load/protect local heap"); + + HDfprintf(stream, "%*sLocal Heap...\n", indent, ""); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size (in bytes):", h->prfx_size); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of heap data:", h->dblk_addr); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Data bytes allocated for heap:", h->dblk_size); + + /* Traverse the free list and check that all free blocks fall within + * the heap and that no two free blocks point to the same region of + * the heap. + */ + if (NULL == (marker = (uint8_t *)H5MM_calloc(h->dblk_size))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + + HDfprintf(stream, "%*sFree Blocks (offset, size):\n", indent, ""); + for (free_block = 0, freelist = h->freelist; freelist; freelist = freelist->next, free_block++) { + char temp_str[32]; + + HDsnprintf(temp_str, sizeof(temp_str), "Block #%d:", free_block); + HDfprintf(stream, "%*s%-*s %8zu, %8zu\n", indent + 3, "", MAX(0, fwidth - 9), temp_str, + freelist->offset, freelist->size); + if ((freelist->offset + freelist->size) > h->dblk_size) + HDfprintf(stream, "***THAT FREE BLOCK IS OUT OF BOUNDS!\n"); + else { + int overlap = 0; + size_t i; + + for (i = 0; i < freelist->size; i++) { + if (marker[freelist->offset + i]) + overlap++; + marker[freelist->offset + i] = 1; + } /* end for */ + if (overlap) + HDfprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n"); + else + amount_free += freelist->size; + } /* end else */ + } /* end for */ + + if (h->dblk_size) + HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of heap used:", + ((double)100.0f * (double)(h->dblk_size - amount_free) / (double)h->dblk_size)); + + /* Print the data in a VMS-style octal dump */ + H5_buffer_dump(stream, indent, h->dblk_image, marker, (size_t)0, h->dblk_size); + + CATCH + if (h && FAIL == H5HL_unprotect(h)) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release/unprotect local heap"); + + if (marker && NULL != (marker = (uint8_t *)H5MM_xfree(marker))) + H5E_THROW(H5E_CANTFREE, "can't free marker buffer"); END_FUNC(PRIV) /* end H5HL_debug() */ diff --git a/src/H5HLdblk.c b/src/H5HLdblk.c index 8c4f447..0081a47 100644 --- a/src/H5HLdblk.c +++ b/src/H5HLdblk.c @@ -83,31 +83,31 @@ H5FL_DEFINE_STATIC(H5HL_dblk_t); */ BEGIN_FUNC(PKG, ERR, H5HL_dblk_t *, NULL, NULL, H5HL__dblk_new(H5HL_t *heap)) -H5HL_dblk_t *dblk = NULL; /* New local heap data block */ + H5HL_dblk_t *dblk = NULL; /* New local heap data block */ -/* check arguments */ -HDassert(heap); + /* check arguments */ + HDassert(heap); -/* Allocate new local heap data block */ -if (NULL == (dblk = H5FL_CALLOC(H5HL_dblk_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for local heap data block") + /* Allocate new local heap data block */ + if (NULL == (dblk = H5FL_CALLOC(H5HL_dblk_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for local heap data block") -/* Increment ref. count on heap data structure */ -if (FAIL == H5HL__inc_rc(heap)) - H5E_THROW(H5E_CANTINC, "can't increment heap ref. count") + /* Increment ref. count on heap data structure */ + if (FAIL == H5HL__inc_rc(heap)) + H5E_THROW(H5E_CANTINC, "can't increment heap ref. count") -/* Link the heap & the data block */ -dblk->heap = heap; -heap->dblk = dblk; + /* Link the heap & the data block */ + dblk->heap = heap; + heap->dblk = dblk; -/* Set the return value */ -ret_value = dblk; + /* Set the return value */ + ret_value = dblk; -CATCH -/* Ensure that the data block memory is deallocated on errors */ -if (!ret_value && dblk != NULL) - /* H5FL_FREE always returns NULL so we can't check for errors */ - dblk = H5FL_FREE(H5HL_dblk_t, dblk); + CATCH + /* Ensure that the data block memory is deallocated on errors */ + if (!ret_value && dblk != NULL) + /* H5FL_FREE always returns NULL so we can't check for errors */ + dblk = H5FL_FREE(H5HL_dblk_t, dblk); END_FUNC(PKG) /* end H5HL__dblk_new() */ @@ -125,26 +125,26 @@ END_FUNC(PKG) /* end H5HL__dblk_new() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_dest(H5HL_dblk_t *dblk)) -/* check arguments */ -HDassert(dblk); + /* check arguments */ + HDassert(dblk); -/* Check if data block was initialized */ -if (dblk->heap) { - /* Unlink data block from heap */ - dblk->heap->dblk = NULL; + /* Check if data block was initialized */ + if (dblk->heap) { + /* Unlink data block from heap */ + dblk->heap->dblk = NULL; - /* Decrement ref. count on heap data structure */ - if (FAIL == H5HL__dec_rc(dblk->heap)) - H5E_THROW(H5E_CANTDEC, "can't decrement heap ref. count") + /* Decrement ref. count on heap data structure */ + if (FAIL == H5HL__dec_rc(dblk->heap)) + H5E_THROW(H5E_CANTDEC, "can't decrement heap ref. count") - /* Unlink heap from data block */ - dblk->heap = NULL; -} /* end if */ + /* Unlink heap from data block */ + dblk->heap = NULL; + } /* end if */ -CATCH -/* Free local heap data block */ -/* H5FL_FREE always returns NULL so we can't check for errors */ -dblk = H5FL_FREE(H5HL_dblk_t, dblk); + CATCH + /* Free local heap data block */ + /* H5FL_FREE always returns NULL so we can't check for errors */ + dblk = H5FL_FREE(H5HL_dblk_t, dblk); END_FUNC(PKG) /* end H5HL__dblk_dest() */ @@ -162,94 +162,94 @@ END_FUNC(PKG) /* end H5HL__dblk_dest() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dblk_realloc(H5F_t *f, H5HL_t *heap, size_t new_heap_size)) -H5HL_dblk_t *dblk; /* Local heap data block */ -haddr_t old_addr; /* Old location of heap data block */ -haddr_t new_addr; /* New location of heap data block */ -size_t old_heap_size; /* Old size of heap data block */ - -/* check arguments */ -HDassert(heap); -HDassert(new_heap_size > 0); - -/* Release old space on disk */ -old_addr = heap->dblk_addr; -old_heap_size = heap->dblk_size; -H5_CHECK_OVERFLOW(old_heap_size, size_t, hsize_t); -if (FAIL == H5MF_xfree(f, H5FD_MEM_LHEAP, old_addr, (hsize_t)old_heap_size)) - H5E_THROW(H5E_CANTFREE, "can't free old local heap data"); - -/* Allocate new space on disk */ -H5_CHECK_OVERFLOW(new_heap_size, size_t, hsize_t); -if (HADDR_UNDEF == (new_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, (hsize_t)new_heap_size))) - H5E_THROW(H5E_CANTALLOC, "unable to allocate file space for local heap"); - -/* Update heap info*/ -heap->dblk_addr = new_addr; -heap->dblk_size = new_heap_size; - -/* Check if heap data block actually moved in the file */ -if (H5F_addr_eq(old_addr, new_addr)) { - /* Check if heap data block is contiguous w/prefix */ - if (heap->single_cache_obj) { - /* Sanity check */ - HDassert(H5F_addr_eq(heap->prfx_addr + heap->prfx_size, old_addr)); - HDassert(heap->prfx); - - /* Resize the heap prefix in the cache */ - if (FAIL == H5AC_resize_entry(heap->prfx, (size_t)(heap->prfx_size + new_heap_size))) - H5E_THROW(H5E_CANTRESIZE, "unable to resize heap in cache"); - } /* end if */ + H5HL_dblk_t *dblk; /* Local heap data block */ + haddr_t old_addr; /* Old location of heap data block */ + haddr_t new_addr; /* New location of heap data block */ + size_t old_heap_size; /* Old size of heap data block */ + + /* check arguments */ + HDassert(heap); + HDassert(new_heap_size > 0); + + /* Release old space on disk */ + old_addr = heap->dblk_addr; + old_heap_size = heap->dblk_size; + H5_CHECK_OVERFLOW(old_heap_size, size_t, hsize_t); + if (FAIL == H5MF_xfree(f, H5FD_MEM_LHEAP, old_addr, (hsize_t)old_heap_size)) + H5E_THROW(H5E_CANTFREE, "can't free old local heap data"); + + /* Allocate new space on disk */ + H5_CHECK_OVERFLOW(new_heap_size, size_t, hsize_t); + if (HADDR_UNDEF == (new_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, (hsize_t)new_heap_size))) + H5E_THROW(H5E_CANTALLOC, "unable to allocate file space for local heap"); + + /* Update heap info*/ + heap->dblk_addr = new_addr; + heap->dblk_size = new_heap_size; + + /* Check if heap data block actually moved in the file */ + if (H5F_addr_eq(old_addr, new_addr)) { + /* Check if heap data block is contiguous w/prefix */ + if (heap->single_cache_obj) { + /* Sanity check */ + HDassert(H5F_addr_eq(heap->prfx_addr + heap->prfx_size, old_addr)); + HDassert(heap->prfx); + + /* Resize the heap prefix in the cache */ + if (FAIL == H5AC_resize_entry(heap->prfx, (size_t)(heap->prfx_size + new_heap_size))) + H5E_THROW(H5E_CANTRESIZE, "unable to resize heap in cache"); + } /* end if */ + else { + /* Sanity check */ + HDassert(H5F_addr_ne(heap->prfx_addr + heap->prfx_size, old_addr)); + HDassert(heap->dblk); + + /* Resize the heap data block in the cache */ + if (H5AC_resize_entry(heap->dblk, (size_t)new_heap_size) < 0) + H5E_THROW(H5E_CANTRESIZE, "unable to resize heap (data block) in cache"); + } /* end else */ + } /* end if */ else { - /* Sanity check */ - HDassert(H5F_addr_ne(heap->prfx_addr + heap->prfx_size, old_addr)); - HDassert(heap->dblk); - - /* Resize the heap data block in the cache */ - if (H5AC_resize_entry(heap->dblk, (size_t)new_heap_size) < 0) - H5E_THROW(H5E_CANTRESIZE, "unable to resize heap (data block) in cache"); - } /* end else */ -} /* end if */ -else { - /* Check if heap data block was contiguous w/prefix previously */ - if (heap->single_cache_obj) { - /* Create new heap data block */ - if (NULL == (dblk = H5HL__dblk_new(heap))) - H5E_THROW(H5E_CANTALLOC, "unable to allocate local heap data block"); - - /* Resize current heap prefix */ - heap->prfx_size = H5HL_SIZEOF_HDR(f); - if (FAIL == H5AC_resize_entry(heap->prfx, (size_t)heap->prfx_size)) - H5E_THROW(H5E_CANTRESIZE, "unable to resize heap prefix in cache"); - - /* Insert data block into cache (pinned) */ - if (FAIL == H5AC_insert_entry(f, H5AC_LHEAP_DBLK, new_addr, dblk, H5AC__PIN_ENTRY_FLAG)) - H5E_THROW(H5E_CANTINIT, "unable to cache local heap data block"); - - dblk = NULL; - - /* Reset 'single cache object' flag */ - heap->single_cache_obj = FALSE; + /* Check if heap data block was contiguous w/prefix previously */ + if (heap->single_cache_obj) { + /* Create new heap data block */ + if (NULL == (dblk = H5HL__dblk_new(heap))) + H5E_THROW(H5E_CANTALLOC, "unable to allocate local heap data block"); + + /* Resize current heap prefix */ + heap->prfx_size = H5HL_SIZEOF_HDR(f); + if (FAIL == H5AC_resize_entry(heap->prfx, (size_t)heap->prfx_size)) + H5E_THROW(H5E_CANTRESIZE, "unable to resize heap prefix in cache"); + + /* Insert data block into cache (pinned) */ + if (FAIL == H5AC_insert_entry(f, H5AC_LHEAP_DBLK, new_addr, dblk, H5AC__PIN_ENTRY_FLAG)) + H5E_THROW(H5E_CANTINIT, "unable to cache local heap data block"); + + dblk = NULL; + + /* Reset 'single cache object' flag */ + heap->single_cache_obj = FALSE; + } /* end if */ + else { + /* Resize the heap data block in the cache */ + /* (ignore [unlikely] case where heap data block ends up + * contiguous w/heap prefix again. + */ + if (FAIL == H5AC_resize_entry(heap->dblk, (size_t)new_heap_size)) + H5E_THROW(H5E_CANTRESIZE, "unable to resize heap data block in cache"); + + /* Relocate the heap data block in the cache */ + if (FAIL == H5AC_move_entry(f, H5AC_LHEAP_DBLK, old_addr, new_addr)) + H5E_THROW(H5E_CANTMOVE, "unable to move heap data block in cache"); + + } /* end else */ + } /* end else */ + + CATCH + /* Restore old heap address & size on errors */ + if (FAIL == ret_value) { + heap->dblk_addr = old_addr; + heap->dblk_size = old_heap_size; } /* end if */ - else { - /* Resize the heap data block in the cache */ - /* (ignore [unlikely] case where heap data block ends up - * contiguous w/heap prefix again. - */ - if (FAIL == H5AC_resize_entry(heap->dblk, (size_t)new_heap_size)) - H5E_THROW(H5E_CANTRESIZE, "unable to resize heap data block in cache"); - - /* Relocate the heap data block in the cache */ - if (FAIL == H5AC_move_entry(f, H5AC_LHEAP_DBLK, old_addr, new_addr)) - H5E_THROW(H5E_CANTMOVE, "unable to move heap data block in cache"); - - } /* end else */ -} /* end else */ - -CATCH -/* Restore old heap address & size on errors */ -if (FAIL == ret_value) { - heap->dblk_addr = old_addr; - heap->dblk_size = old_heap_size; -} /* end if */ END_FUNC(PKG) /* end H5HL__dblk_realloc() */ diff --git a/src/H5HLint.c b/src/H5HLint.c index 9b6667f..ef5c712 100644 --- a/src/H5HLint.c +++ b/src/H5HLint.c @@ -83,29 +83,29 @@ H5FL_DEFINE_STATIC(H5HL_t); BEGIN_FUNC(PKG, ERR, H5HL_t *, NULL, NULL, H5HL__new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size)) -H5HL_t *heap = NULL; /* New local heap */ + H5HL_t *heap = NULL; /* New local heap */ -/* check arguments */ -HDassert(sizeof_size > 0); -HDassert(sizeof_addr > 0); -HDassert(prfx_size > 0); + /* check arguments */ + HDassert(sizeof_size > 0); + HDassert(sizeof_addr > 0); + HDassert(prfx_size > 0); -/* Allocate new local heap structure */ -if (NULL == (heap = H5FL_CALLOC(H5HL_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); + /* Allocate new local heap structure */ + if (NULL == (heap = H5FL_CALLOC(H5HL_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed"); -/* Initialize non-zero fields */ -heap->sizeof_size = sizeof_size; -heap->sizeof_addr = sizeof_addr; -heap->prfx_size = prfx_size; + /* Initialize non-zero fields */ + heap->sizeof_size = sizeof_size; + heap->sizeof_addr = sizeof_addr; + heap->prfx_size = prfx_size; -/* Set the return value */ -ret_value = heap; + /* Set the return value */ + ret_value = heap; -CATCH -if (!ret_value && heap != NULL) - if (NULL == (heap = H5FL_FREE(H5HL_t, heap))) - H5E_THROW(H5E_CANTFREE, "can't free heap memory"); + CATCH + if (!ret_value && heap != NULL) + if (NULL == (heap = H5FL_FREE(H5HL_t, heap))) + H5E_THROW(H5E_CANTFREE, "can't free heap memory"); END_FUNC(PKG) /* end H5HL__new() */ @@ -123,11 +123,11 @@ END_FUNC(PKG) /* end H5HL__new() */ */ BEGIN_FUNC(PKG, NOERR, herr_t, SUCCEED, -, H5HL__inc_rc(H5HL_t *heap)) -/* check arguments */ -HDassert(heap); + /* check arguments */ + HDassert(heap); -/* Increment heap's ref. count */ -heap->rc++; + /* Increment heap's ref. count */ + heap->rc++; END_FUNC(PKG) /* end H5HL__inc_rc() */ @@ -145,16 +145,16 @@ END_FUNC(PKG) /* end H5HL__inc_rc() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dec_rc(H5HL_t *heap)) -/* check arguments */ -HDassert(heap); + /* check arguments */ + HDassert(heap); -/* Decrement heap's ref. count */ -heap->rc--; + /* Decrement heap's ref. count */ + heap->rc--; -CATCH -/* Check if we should destroy the heap */ -if (heap->rc == 0 && FAIL == H5HL__dest(heap)) - H5E_THROW(H5E_CANTFREE, "unable to destroy local heap"); + CATCH + /* Check if we should destroy the heap */ + if (heap->rc == 0 && FAIL == H5HL__dest(heap)) + H5E_THROW(H5E_CANTFREE, "unable to destroy local heap"); END_FUNC(PKG) /* end H5HL__dec_rc() */ @@ -172,29 +172,29 @@ END_FUNC(PKG) /* end H5HL__dec_rc() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__dest(H5HL_t *heap)) -/* check arguments */ -HDassert(heap); - -/* Verify that node is unused */ -HDassert(heap->prots == 0); -HDassert(heap->rc == 0); -HDassert(heap->prfx == NULL); -HDassert(heap->dblk == NULL); - -CATCH -if (heap->dblk_image) - if (NULL != (heap->dblk_image = H5FL_BLK_FREE(lheap_chunk, heap->dblk_image))) - H5E_THROW(H5E_CANTFREE, "unable to free local heap data block image"); -while (heap->freelist) { - H5HL_free_t *fl; - - fl = heap->freelist; - heap->freelist = fl->next; - if (NULL != (fl = H5FL_FREE(H5HL_free_t, fl))) - H5E_THROW(H5E_CANTFREE, "unable to free local heap free list"); -} /* end while */ - -if (NULL != (heap = H5FL_FREE(H5HL_t, heap))) - H5E_THROW(H5E_CANTFREE, "unable to free local heap"); + /* check arguments */ + HDassert(heap); + + /* Verify that node is unused */ + HDassert(heap->prots == 0); + HDassert(heap->rc == 0); + HDassert(heap->prfx == NULL); + HDassert(heap->dblk == NULL); + + CATCH + if (heap->dblk_image) + if (NULL != (heap->dblk_image = H5FL_BLK_FREE(lheap_chunk, heap->dblk_image))) + H5E_THROW(H5E_CANTFREE, "unable to free local heap data block image"); + while (heap->freelist) { + H5HL_free_t *fl; + + fl = heap->freelist; + heap->freelist = fl->next; + if (NULL != (fl = H5FL_FREE(H5HL_free_t, fl))) + H5E_THROW(H5E_CANTFREE, "unable to free local heap free list"); + } /* end while */ + + if (NULL != (heap = H5FL_FREE(H5HL_t, heap))) + H5E_THROW(H5E_CANTFREE, "unable to free local heap"); END_FUNC(PKG) /* end H5HL__dest() */ diff --git a/src/H5HLprfx.c b/src/H5HLprfx.c index d17e558..fedc11b 100644 --- a/src/H5HLprfx.c +++ b/src/H5HLprfx.c @@ -82,31 +82,31 @@ H5FL_DEFINE_STATIC(H5HL_prfx_t); */ BEGIN_FUNC(PKG, ERR, H5HL_prfx_t *, NULL, NULL, H5HL__prfx_new(H5HL_t *heap)) -H5HL_prfx_t *prfx = NULL; /* New local heap prefix */ + H5HL_prfx_t *prfx = NULL; /* New local heap prefix */ -/* check arguments */ -HDassert(heap); + /* check arguments */ + HDassert(heap); -/* Allocate new local heap prefix */ -if (NULL == (prfx = H5FL_CALLOC(H5HL_prfx_t))) - H5E_THROW(H5E_CANTALLOC, "memory allocation failed for local heap prefix") + /* Allocate new local heap prefix */ + if (NULL == (prfx = H5FL_CALLOC(H5HL_prfx_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for local heap prefix") -/* Increment ref. count on heap data structure */ -if (FAIL == H5HL__inc_rc(heap)) - H5E_THROW(H5E_CANTINC, "can't increment heap ref. count") + /* Increment ref. count on heap data structure */ + if (FAIL == H5HL__inc_rc(heap)) + H5E_THROW(H5E_CANTINC, "can't increment heap ref. count") -/* Link the heap & the prefix */ -prfx->heap = heap; -heap->prfx = prfx; + /* Link the heap & the prefix */ + prfx->heap = heap; + heap->prfx = prfx; -/* Set the return value */ -ret_value = prfx; + /* Set the return value */ + ret_value = prfx; -CATCH -/* Ensure that the prefix memory is deallocated on errors */ -if (!ret_value && prfx != NULL) - /* H5FL_FREE always returns NULL so we can't check for errors */ - prfx = H5FL_FREE(H5HL_prfx_t, prfx); + CATCH + /* Ensure that the prefix memory is deallocated on errors */ + if (!ret_value && prfx != NULL) + /* H5FL_FREE always returns NULL so we can't check for errors */ + prfx = H5FL_FREE(H5HL_prfx_t, prfx); END_FUNC(PKG) /* end H5HL__prfx_new() */ @@ -124,25 +124,25 @@ END_FUNC(PKG) /* end H5HL__prfx_new() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, H5HL__prfx_dest(H5HL_prfx_t *prfx)) -/* check arguments */ -HDassert(prfx); + /* check arguments */ + HDassert(prfx); -/* Check if prefix was initialized */ -if (prfx->heap) { - /* Unlink prefix from heap */ - prfx->heap->prfx = NULL; + /* Check if prefix was initialized */ + if (prfx->heap) { + /* Unlink prefix from heap */ + prfx->heap->prfx = NULL; - /* Decrement ref. count on heap data structure */ - if (FAIL == H5HL__dec_rc(prfx->heap)) - H5E_THROW(H5E_CANTDEC, "can't decrement heap ref. count") + /* Decrement ref. count on heap data structure */ + if (FAIL == H5HL__dec_rc(prfx->heap)) + H5E_THROW(H5E_CANTDEC, "can't decrement heap ref. count") - /* Unlink heap from prefix */ - prfx->heap = NULL; -} /* end if */ + /* Unlink heap from prefix */ + prfx->heap = NULL; + } /* end if */ -CATCH -/* Free prefix memory */ -/* H5FL_FREE always returns NULL so we can't check for errors */ -prfx = H5FL_FREE(H5HL_prfx_t, prfx); + CATCH + /* Free prefix memory */ + /* H5FL_FREE always returns NULL so we can't check for errors */ + prfx = H5FL_FREE(H5HL_prfx_t, prfx); END_FUNC(PKG) /* end H5HL__prfx_dest() */ diff --git a/src/H5I.c b/src/H5I.c index 6fca3c6..18ba809 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -2358,9 +2358,9 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) FUNC_ENTER_STATIC_NOERR - HDfprintf(stderr, " id = %lu\n", (unsigned long)(item->id)); + HDfprintf(stderr, " id = %" PRIdHID "\n", item->id); HDfprintf(stderr, " count = %u\n", item->count); - HDfprintf(stderr, " obj = 0x%08p\n", item->obj_ptr); + HDfprintf(stderr, " obj = 0x%8p\n", item->obj_ptr); /* Get the group location, so we get get the name */ switch (type) { diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h index 433671b..697777c 100644 --- a/src/H5Ipublic.h +++ b/src/H5Ipublic.h @@ -53,6 +53,12 @@ typedef enum H5I_type_t { /* Type of atoms to return to users */ typedef int64_t hid_t; + +#define PRIdHID PRId64 +#define PRIxHID PRIx64 +#define PRIXHID PRIX64 +#define PRIoHID PRIo64 + #define H5_SIZEOF_HID_T H5_SIZEOF_INT64_T /* An invalid object ID. This is also negative for error return. */ diff --git a/src/H5MF.c b/src/H5MF.c index 6e9f3a8..2fe78a3 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -2630,6 +2630,10 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) HDassert(f->shared); HDassert(fsm_settled); + /* Initialize structs */ + HDmemset(&fsinfo, 0, sizeof(fsinfo)); + HDmemset(&fs_stat, 0, sizeof(fs_stat)); + /* * Only need to settle things if we are persisting free space and * the private property in f->shared->null_fsm_addr is not enabled. diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index da25d55..3c6d91e 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -110,11 +110,11 @@ H5MF__sects_debug_cb(H5FS_section_info_t *_sect, void *_udata) : (sect->sect_info.type == H5MF_FSPACE_SECT_SMALL ? "small" : (sect->sect_info.type == H5MF_FSPACE_SECT_LARGE ? "large" : "unknown")))); - HDfprintf(udata->stream, "%*s%-*s %a\n", udata->indent, "", udata->fwidth, + HDfprintf(udata->stream, "%*s%-*s %" PRIuHADDR "\n", udata->indent, "", udata->fwidth, "Section address:", sect->sect_info.addr); - HDfprintf(udata->stream, "%*s%-*s %Hu\n", udata->indent, "", udata->fwidth, + HDfprintf(udata->stream, "%*s%-*s %" PRIuHSIZE "\n", udata->indent, "", udata->fwidth, "Section size:", sect->sect_info.size); - HDfprintf(udata->stream, "%*s%-*s %Hu\n", udata->indent, "", udata->fwidth, + HDfprintf(udata->stream, "%*s%-*s %" PRIuHADDR "\n", udata->indent, "", udata->fwidth, "End of section:", (haddr_t)((sect->sect_info.addr + sect->sect_info.size) - 1)); HDfprintf(udata->stream, "%*s%-*s %s\n", udata->indent, "", udata->fwidth, "Section state:", (sect->sect_info.state == H5FS_SECT_LIVE ? "live" : "serialized")); @@ -223,7 +223,7 @@ H5MF__sects_dump(H5F_t *f, FILE *stream) if (HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa); + HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %" PRIuHADDR "\n", FUNC, eoa); #endif /* H5MF_ALLOC_DEBUG */ if (H5F_PAGED_AGGR(f)) { /* File space paging */ @@ -265,15 +265,17 @@ H5MF__sects_dump(H5F_t *f, FILE *stream) /* Retrieve metadata aggregator info, if available */ H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: ma_addr = %a, ma_size = %Hu, end of ma = %a\n", FUNC, ma_addr, ma_size, - (haddr_t)((ma_addr + ma_size) - 1)); + HDfprintf(stderr, + "%s: ma_addr = %" PRIuHADDR ", ma_size = %" PRIuHSIZE ", end of ma = %" PRIuHADDR "\n", + FUNC, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1)); #endif /* H5MF_ALLOC_DEBUG */ /* Retrieve 'small data' aggregator info, if available */ H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, sda_addr, sda_size, - (haddr_t)((sda_addr + sda_size) - 1)); + HDfprintf(stderr, + "%s: sda_addr = %" PRIuHADDR ", sda_size = %" PRIuHSIZE ", end of sda = %" PRIuHADDR "\n", + FUNC, sda_addr, sda_size, (haddr_t)((sda_addr + sda_size) - 1)); #endif /* H5MF_ALLOC_DEBUG */ /* Iterate over all the free space types that have managers and dump each free list's space */ @@ -286,7 +288,8 @@ H5MF__sects_dump(H5F_t *f, FILE *stream) /* Retrieve the 'eoa' for this file memory type */ if (HADDR_UNDEF == (eoa = H5F_get_eoa(f, atype))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") - HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), "eoa:", eoa); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", MAX(0, fwidth - 3), + "eoa:", eoa); /* Print header for sections */ HDfprintf(stream, "%*sSections:\n", indent + 3, ""); diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 59a5755..a426089 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -500,18 +500,18 @@ H5O__ainfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int i HDassert(indent >= 0); HDassert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Number of attributes:", ainfo->nattrs); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, - "Track creation order of attributes:", ainfo->track_corder); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, - "Index creation order of attributes:", ainfo->index_corder); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of attributes:", ainfo->nattrs); + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Track creation order of attributes:", ainfo->track_corder ? "TRUE" : "FALSE"); + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Index creation order of attributes:", ainfo->index_corder ? "TRUE" : "FALSE"); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Max. creation index value:", (unsigned)ainfo->max_crt_idx); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "'Dense' attribute storage fractal heap address:", ainfo->fheap_addr); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "'Dense' attribute storage name index v2 B-tree address:", ainfo->name_bt2_addr); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "'Dense' attribute storage creation order index v2 B-tree address:", ainfo->corder_bt2_addr); FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5Oattr.c b/src/H5Oattr.c index d9f117d..052b73c 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -103,8 +103,11 @@ H5FL_EXTERN(H5S_extent_t); with the decoded information USAGE void *H5O__attr_decode(f, mesg_flags, p) - H5F_t *f; IN: pointer to the HDF5 file struct - unsigned mesg_flags; IN: Message flags to influence decoding + H5F_t *f; IN: pointer to the HDF5 file struct + H5O_t *open_oh; IN: pointer to the object header + unsigned mesg_flags; IN: message flags to influence decoding + unsigned *ioflags; IN/OUT: flags for decoding + size_t p_size; IN: size of buffer *p const uint8_t *p; IN: the raw information buffer RETURNS Pointer to the new message in native order on success, NULL on failure @@ -115,7 +118,7 @@ H5FL_EXTERN(H5S_extent_t); --------------------------------------------------------------------------*/ static void * H5O__attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned *ioflags, - size_t H5_ATTR_UNUSED p_size, const uint8_t *p) + size_t p_size, const uint8_t *p) { H5A_t * attr = NULL; H5S_extent_t *extent; /*extent dimensionality information */ @@ -833,8 +836,9 @@ H5O__attr_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidt break; } /* end switch */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Character Set of Name:", s); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, "Object opened:", mesg->obj_opened); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Object:", mesg->oloc.addr); + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Object opened:", mesg->obj_opened ? "TRUE" : "FALSE"); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Object:", mesg->oloc.addr); /* Check for attribute creation order index on the attribute */ if (mesg->shared->crt_idx != H5O_MAX_CRT_ORDER_IDX) diff --git a/src/H5Ocache_image.c b/src/H5Ocache_image.c index 0782f98..e6ba2bf 100644 --- a/src/H5Ocache_image.c +++ b/src/H5Ocache_image.c @@ -326,9 +326,10 @@ H5O__mdci_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in HDassert(indent >= 0); HDassert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Metadata Cache Image Block address:", mdci->addr); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Metadata Cache Image Block address:", mdci->addr); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Metadata Cache Image Block size in bytes:", mdci->size); FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5Ocont.c b/src/H5Ocont.c index c8241f8..7c08a57 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -258,7 +258,7 @@ H5O__cont_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in HDassert(indent >= 0); HDassert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Continuation address:", cont->addr); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Continuation address:", cont->addr); HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, "Continuation size in bytes:", (unsigned long)(cont->size)); diff --git a/src/H5Odbg.c b/src/H5Odbg.c index aeea21e..f206184 100644 --- a/src/H5Odbg.c +++ b/src/H5Odbg.c @@ -295,7 +295,8 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int /* debug */ HDfprintf(stream, "%*sObject Header...\n", indent, ""); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, "Dirty:", oh->cache_info.is_dirty); + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Dirty:", oh->cache_info.is_dirty ? "TRUE" : "FALSE"); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Version:", oh->version); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Header size (in bytes):", (unsigned)H5O_SIZEOF_HDR(oh)); @@ -344,9 +345,9 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int } /* end if */ } /* end if */ - HDfprintf(stream, "%*s%-*s %Zu (%Zu)\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu (%zu)\n", indent, "", fwidth, "Number of messages (allocated):", oh->nmesgs, oh->alloc_nmesgs); - HDfprintf(stream, "%*s%-*s %Zu (%Zu)\n", indent, "", fwidth, "Number of chunks (allocated):", oh->nchunks, + HDfprintf(stream, "%*s%-*s %zu (%zu)\n", indent, "", fwidth, "Number of chunks (allocated):", oh->nchunks, oh->alloc_nchunks); /* debug each chunk */ @@ -355,7 +356,8 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int HDfprintf(stream, "%*sChunk %d...\n", indent, "", i); - HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), "Address:", oh->chunk[i].addr); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", MAX(0, fwidth - 3), + "Address:", oh->chunk[i].addr); /* Decrement chunk 0's size by the object header prefix size */ if (0 == i) { @@ -370,9 +372,9 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int chunk_total += chunk_size; gap_total += oh->chunk[i].gap; - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), "Size in bytes:", chunk_size); + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), "Size in bytes:", chunk_size); - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), "Gap:", oh->chunk[i].gap); + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), "Gap:", oh->chunk[i].gap); } /* end for */ /* debug each message */ @@ -401,7 +403,8 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int HDfprintf(stream, "%*s%-*s 0x%04x `%s' (%d)\n", indent + 3, "", MAX(0, fwidth - 3), "Message ID (sequence number):", (unsigned)(oh->mesg[i].type->id), oh->mesg[i].type->name, sequence[oh->mesg[i].type->id]++); - HDfprintf(stream, "%*s%-*s %t\n", indent + 3, "", MAX(0, fwidth - 3), "Dirty:", oh->mesg[i].dirty); + HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", MAX(0, fwidth - 3), + "Dirty:", oh->mesg[i].dirty ? "TRUE" : "FALSE"); HDfprintf(stream, "%*s%-*s ", indent + 3, "", MAX(0, fwidth - 3), "Message flags:"); if (oh->mesg[i].flags) { hbool_t flag_printed = FALSE; @@ -461,7 +464,7 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int chunkno = oh->mesg[i].chunkno; if (chunkno >= oh->nchunks) HDfprintf(stream, "*** BAD CHUNK NUMBER\n"); - HDfprintf(stream, "%*s%-*s (%Zu, %Zu) bytes\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s (%zu, %zu) bytes\n", indent + 3, "", MAX(0, fwidth - 3), "Raw message data (offset, size) in chunk:", (size_t)(oh->mesg[i].raw - oh->chunk[chunkno].image), oh->mesg[i].raw_size); diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c index 9a8b0f1..b68eb08 100644 --- a/src/H5Odrvinfo.c +++ b/src/H5Odrvinfo.c @@ -295,7 +295,7 @@ H5O__drvinfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int HDassert(fwidth >= 0); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Driver name:", mesg->name); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Buffer size:", mesg->len); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Buffer size:", mesg->len); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__drvinfo_debug() */ diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 5166d32..c8cd954 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -1102,9 +1102,12 @@ done: with the decoded information USAGE void *H5O__dtype_decode(f, mesg_flags, p) - H5F_t *f; IN: pointer to the HDF5 file struct + H5F_t *f; IN: pointer to the HDF5 file struct + H5O_t *open_oh; IN: pointer to the object header unsigned mesg_flags; IN: Message flags to influence decoding - const uint8 *p; IN: the raw information buffer + unsigned *ioflags; IN/OUT: flags for decoding + size_t p_size; IN: size of buffer *p + const uint8_t *p; IN: the raw information buffer RETURNS Pointer to the new message in native order on success, NULL on failure DESCRIPTION diff --git a/src/H5Oefl.c b/src/H5Oefl.c index f4693a9..f34286a 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -529,28 +529,28 @@ H5O__efl_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int ind HDassert(indent >= 0); HDassert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Heap address:", mesg->heap_addr); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Heap address:", mesg->heap_addr); - HDfprintf(stream, "%*s%-*s %u/%u\n", indent, "", fwidth, "Slots used/allocated:", mesg->nused, + HDfprintf(stream, "%*s%-*s %zu/%zu\n", indent, "", fwidth, "Slots used/allocated:", mesg->nused, mesg->nalloc); for (u = 0; u < mesg->nused; u++) { char buf[64]; - HDsnprintf(buf, sizeof(buf), "File %u", (unsigned)u); + HDsnprintf(buf, sizeof(buf), "File %zu", u); HDfprintf(stream, "%*s%s:\n", indent, "", buf); HDfprintf(stream, "%*s%-*s \"%s\"\n", indent + 3, "", MAX(fwidth - 3, 0), "Name:", mesg->slot[u].name); - HDfprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(fwidth - 3, 0), - "Name offset:", (unsigned long)(mesg->slot[u].name_offset)); + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(fwidth - 3, 0), + "Name offset:", mesg->slot[u].name_offset); - HDfprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(fwidth - 3, 0), - "Offset of data in file:", (unsigned long)(mesg->slot[u].offset)); + HDfprintf(stream, "%*s%-*s %" PRIdMAX "\n", indent + 3, "", MAX(fwidth - 3, 0), + "Offset of data in file:", (intmax_t)(mesg->slot[u].offset)); - HDfprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(fwidth - 3, 0), - "Bytes reserved for data:", (unsigned long)(mesg->slot[u].size)); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent + 3, "", MAX(fwidth - 3, 0), + "Bytes reserved for data:", (mesg->slot[u].size)); } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 010d47a..92135b8 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -937,7 +937,7 @@ H5O__fill_debug(H5F_t H5_ATTR_UNUSED *f, const void *_fill, FILE *stream, int in break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %Zd\n", indent, "", fwidth, "Size:", fill->size); + HDfprintf(stream, "%*s%-*s %zd\n", indent, "", fwidth, "Size:", fill->size); HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Data type:"); if (fill->type) { H5T_debug(fill->type, stream); diff --git a/src/H5Oflush.c b/src/H5Oflush.c index 07b0ab5..19e231d 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -58,7 +58,7 @@ static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t * * * Purpose: Flushes all buffers associated with an object to disk. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success, negative on failure * * Programmer: Mike McGreevy * May 19, 2010 @@ -81,7 +81,7 @@ H5Oflush(hid_t obj_id) /* Set up collective metadata if appropriate */ if (H5CX_set_loc(obj_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -164,7 +164,7 @@ H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id) /* Flush metadata based on tag value of the object */ if (H5F_flush_tagged_metadata(oloc->file, tag) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") /* Check to invoke callback */ if (H5F_object_flush_cb(oloc->file, obj_id) < 0) @@ -219,7 +219,7 @@ done: * * Purpose: Refreshes all buffers associated with an object. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success, negative on failure * * Programmer: Mike McGreevy * July 28, 2010 @@ -387,32 +387,32 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc) /* Handle close for multiple dataset opens */ if (H5I_get_type(oid) == H5I_DATASET) if (H5D_mult_refresh_close(oid) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset") /* Retrieve tag for object */ if (H5O__oh_tag(&oloc, &tag) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to get object header address") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to get object header address") /* Get cork status of the object with tag */ if (H5AC_cork(oloc.file, tag, H5AC__GET_CORKED, &corked) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_SYSTEM, FAIL, "unable to retrieve an object's cork status") + HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "unable to retrieve an object's cork status") /* Close the object */ if (H5I_dec_ref(oid) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to close object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to close object") /* Flush metadata based on tag value of the object */ if (H5F_flush_tagged_metadata(oloc.file, tag) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") /* Evict the object's tagged metadata */ if (H5F_evict_tagged_metadata(oloc.file, tag) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to evict metadata") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to evict metadata") /* Re-cork object with tag */ if (corked) if (H5AC_cork(oloc.file, tag, H5AC__SET_CORK, &corked) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_SYSTEM, FAIL, "unable to cork the object") + HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "unable to cork the object") done: FUNC_LEAVE_NOAPI(ret_value); diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index 5eaff2c..166fe18 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -378,23 +378,26 @@ H5O__fsinfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int HDfprintf(stream, "%s\n", "unknown"); } /* end switch */ - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, "Free-space persist:", fsinfo->persist); + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Free-space persist:", fsinfo->persist ? "TRUE" : "FALSE"); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Free-space section threshold:", fsinfo->threshold); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "File space page size:", fsinfo->page_size); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "File space page size:", fsinfo->page_size); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Page end metadata threshold:", fsinfo->pgend_meta_thres); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "eoa_pre_fsm_fsalloc:", fsinfo->eoa_pre_fsm_fsalloc); - if (fsinfo->persist) + if (fsinfo->persist) { for (ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Free space manager address:", fsinfo->fs_addr[ptype - 1]); + } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__fsinfo_debug() */ diff --git a/src/H5Oint.c b/src/H5Oint.c index 583909a..a49e71b 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -570,7 +570,7 @@ H5O_open(H5O_loc_t *loc) #ifdef H5O_DEBUG if (H5DEBUG(O)) - HDfprintf(H5DEBUG(O), "> %a\n", loc->addr); + HDfprintf(H5DEBUG(O), "> %" PRIuHADDR "\n", loc->addr); #endif /* Turn off the variable for holding file or increment open-lock counters */ @@ -801,10 +801,10 @@ H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/) #ifdef H5O_DEBUG if (H5DEBUG(O)) { if (FALSE == H5F_ID_EXISTS(loc->file) && 1 == H5F_NREFS(loc->file)) - HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n", loc->addr, + HDfprintf(H5DEBUG(O), "< %" PRIuHADDR " auto %lu remaining\n", loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file)); else - HDfprintf(H5DEBUG(O), "< %a\n", loc->addr); + HDfprintf(H5DEBUG(O), "< %" PRIuHADDR "\n", loc->addr); } #endif @@ -2211,7 +2211,7 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info2_t *oinfo, unsigned fields) /* Set the object's reference count */ oinfo->rc = oh->nlink; - } /* end if */ + } /* Get time information, if requested */ if (fields & H5O_INFO_TIME) { @@ -2505,8 +2505,8 @@ H5O_get_oh_addr(const H5O_t *oh) /*------------------------------------------------------------------------- * Function: H5O_get_oh_flags * - * Programmer: Jacob Smith - * 2018 August 17 + * Programmer: Jacob Smith + * 2018 August 17 * *------------------------------------------------------------------------- */ @@ -2521,12 +2521,12 @@ H5O_get_oh_flags(const H5O_t *oh) /*------------------------------------------------------------------------- * Function: H5O_get_oh_mtime * - * Purpose: Retrieve an object's modification time. Assumes that the + * Purpose: Retrieve an object's modification time. Assumes that the * caller has verified that accessing this variable is appropriate * to the header in question. * - * Programmer: Jacob Smith - * 2018 August 17 + * Programmer: Jacob Smith + * 2018 August 17 * *------------------------------------------------------------------------- */ @@ -2542,8 +2542,8 @@ H5O_get_oh_mtime(const H5O_t *oh) /*------------------------------------------------------------------------- * Function: H5O_get_oh_version * - * Programmer: Jacob Smith - * 2018 August 17 + * Programmer: Jacob Smith + * 2018 August 17 * *------------------------------------------------------------------------- */ diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 9710769..b4c1bbb 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -433,8 +433,7 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU (mesg->storage.u.virt.list[i].source_file_name = (char *)H5MM_malloc(tmp_size))) HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, NULL, "unable to allocate memory for source file name") - (void)H5MM_memcpy(mesg->storage.u.virt.list[i].source_file_name, heap_block_p, - tmp_size); + H5MM_memcpy(mesg->storage.u.virt.list[i].source_file_name, heap_block_p, tmp_size); heap_block_p += tmp_size; /* Source dataset name */ @@ -443,8 +442,7 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU (mesg->storage.u.virt.list[i].source_dset_name = (char *)H5MM_malloc(tmp_size))) HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, NULL, "unable to allocate memory for source dataset name") - (void)H5MM_memcpy(mesg->storage.u.virt.list[i].source_dset_name, heap_block_p, - tmp_size); + H5MM_memcpy(mesg->storage.u.virt.list[i].source_dset_name, heap_block_p, tmp_size); heap_block_p += tmp_size; /* Source selection */ @@ -1196,31 +1194,32 @@ H5O__layout_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int (unsigned)mesg->u.chunk.idx_type); break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Index address:", mesg->storage.u.chunk.idx_addr); break; case H5D_CONTIGUOUS: HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Contiguous"); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Data address:", mesg->storage.u.contig.addr); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Data Size:", mesg->storage.u.contig.size); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Data Size:", mesg->storage.u.contig.size); break; case H5D_COMPACT: HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Compact"); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Data Size:", mesg->storage.u.compact.size); break; case H5D_VIRTUAL: HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Virtual"); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Global heap address:", mesg->storage.u.virt.serial_list_hobjid.addr); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Global heap index:", mesg->storage.u.virt.serial_list_hobjid.idx); for (u = 0; u < mesg->storage.u.virt.list_nused; u++) { - HDfprintf(stream, "%*sMapping %u:\n", indent, "", u); + HDfprintf(stream, "%*sMapping %zu:\n", indent, "", u); HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth - 3, "Virtual selection:", ""); HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth - 3, diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index 3b2765c..fa24714 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -548,17 +548,18 @@ H5O__linfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int i HDassert(indent >= 0); HDassert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, - "Track creation order of links:", linfo->track_corder); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, - "Index creation order of links:", linfo->index_corder); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Number of links:", linfo->nlinks); - HDfprintf(stream, "%*s%-*s %Hd\n", indent, "", fwidth, "Max. creation order value:", linfo->max_corder); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Track creation order of links:", linfo->track_corder ? "TRUE" : "FALSE"); + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Index creation order of links:", linfo->index_corder ? "TRUE" : "FALSE"); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of links:", linfo->nlinks); + HDfprintf(stream, "%*s%-*s %" PRId64 "\n", indent, "", fwidth, + "Max. creation order value:", linfo->max_corder); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "'Dense' link storage fractal heap address:", linfo->fheap_addr); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "'Dense' link storage name index v2 B-tree address:", linfo->name_bt2_addr); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "'Dense' link storage creation order index v2 B-tree address:", linfo->corder_bt2_addr); FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5Olink.c b/src/H5Olink.c index 152c660..baba6b8 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -817,7 +817,7 @@ H5O__link_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in : (lnk->type >= H5L_TYPE_UD_MIN ? "User-defined" : "Unknown"))))); if (lnk->corder_valid) - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Creation Order:", lnk->corder); + HDfprintf(stream, "%*s%-*s %" PRId64 "\n", indent, "", fwidth, "Creation Order:", lnk->corder); 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"))); @@ -826,7 +826,8 @@ H5O__link_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in /* Display link-specific information */ switch (lnk->type) { case H5L_TYPE_HARD: - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Object address:", lnk->u.hard.addr); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Object address:", lnk->u.hard.addr); break; case H5L_TYPE_SOFT: @@ -843,11 +844,11 @@ H5O__link_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in (const char *)lnk->u.ud.udata + (HDstrlen((const char *)lnk->u.ud.udata) + 1); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "External File Name:", lnk->u.ud.udata); + "External File Name:", (const char *)lnk->u.ud.udata); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "External Object Name:", objname); } /* end if */ else { - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "User-Defined Link Size:", lnk->u.ud.size); } /* end else */ } /* end if */ diff --git a/src/H5Opline.c b/src/H5Opline.c index 7c6c4ee..71e04d5 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -649,14 +649,14 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int in HDassert(indent >= 0); HDassert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %Zu/%Zu\n", indent, "", fwidth, "Number of filters:", pline->nused, + HDfprintf(stream, "%*s%-*s %zu/%zu\n", indent, "", fwidth, "Number of filters:", pline->nused, pline->nalloc); /* Loop over all the filters */ for (i = 0; i < pline->nused; i++) { char name[32]; - HDsnprintf(name, sizeof(name), "Filter at position %u", (unsigned)i); + HDsnprintf(name, sizeof(name), "Filter at position %zu", i); HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, name); HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), "Filter identification:", (unsigned)(pline->filter[i].id)); @@ -667,7 +667,7 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int in HDfprintf(stream, "%*s%-*s NONE\n", indent + 3, "", MAX(0, fwidth - 3), "Filter name:"); HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), "Flags:", pline->filter[i].flags); - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), "Num CD values:", pline->filter[i].cd_nelmts); /* Filter parameters */ diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 5631ea6..b34eb76 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -490,7 +490,7 @@ H5O__sdspace_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:"); for (u = 0; u < sdim->rank; u++) - HDfprintf(stream, "%s%Hu", u ? ", " : "", sdim->size[u]); + HDfprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", sdim->size[u]); HDfprintf(stream, "}\n"); HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Dim Max:"); @@ -500,7 +500,7 @@ H5O__sdspace_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int if (H5S_UNLIMITED == sdim->max[u]) HDfprintf(stream, "%sUNLIM", u ? ", " : ""); else - HDfprintf(stream, "%s%Hu", u ? ", " : "", sdim->max[u]); + HDfprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", sdim->max[u]); } /* end for */ HDfprintf(stream, "}\n"); } /* end if */ diff --git a/src/H5Oshared.c b/src/H5Oshared.c index 0beb647..a33da0f 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -707,7 +707,8 @@ H5O__shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth case H5O_SHARE_TYPE_COMMITTED: HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Shared Message type:", "Obj Hdr"); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Object address:", mesg->u.loc.oh_addr); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Object address:", mesg->u.loc.oh_addr); break; case H5O_SHARE_TYPE_SOHM: diff --git a/src/H5Oshmesg.c b/src/H5Oshmesg.c index 97546fa..a9647cb 100644 --- a/src/H5Oshmesg.c +++ b/src/H5Oshmesg.c @@ -229,7 +229,8 @@ H5O__shmesg_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int HDassert(fwidth >= 0); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Version:", mesg->version); - HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth, "Shared message table address:", mesg->addr); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth, + "Shared message table address:", mesg->addr); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of indexes:", mesg->nindexes); FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 81ab61d..071be91 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -412,9 +412,9 @@ H5O__stab_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in HDassert(indent >= 0); HDassert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "B-tree address:", stab->btree_addr); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "B-tree address:", stab->btree_addr); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Name heap address:", stab->heap_addr); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Name heap address:", stab->heap_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__stab_debug() */ diff --git a/src/H5PLpath.c b/src/H5PLpath.c index 1858cf8..3879dc6 100644 --- a/src/H5PLpath.c +++ b/src/H5PLpath.c @@ -669,8 +669,10 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo HDstrerror(errno)) /* If it is a directory, skip it */ - if (S_ISDIR(my_stat.st_mode)) + if (S_ISDIR(my_stat.st_mode)) { + path = (char *)H5MM_xfree(path); continue; + } /* attempt to open the dynamic library as a filter library */ if (H5PL__open(path, search_params->type, search_params->key, found, plugin_info) < 0) diff --git a/src/H5PLprivate.h b/src/H5PLprivate.h index 43930ad..fff36a7 100644 --- a/src/H5PLprivate.h +++ b/src/H5PLprivate.h @@ -21,8 +21,8 @@ #include "H5PLpublic.h" /* Private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ -#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5private.h" /* Generic Functions */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /**************************/ /* Library Private Macros */ diff --git a/src/H5Rint.c b/src/H5Rint.c index 5372563..8f3163a 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -89,7 +89,6 @@ } while (0) /* Debug */ -//#define H5R_DEBUG #ifdef H5R_DEBUG #define H5R_LOG_DEBUG(...) \ do { \ @@ -807,7 +806,7 @@ H5R__set_obj_token(H5R_ref_priv_t *ref, const H5O_token_t *obj_token, size_t tok HDassert(token_size); HDassert(token_size <= H5O_MAX_TOKEN_SIZE); - H5MM_memcpy(&ref->info.obj.token, obj_token, sizeof(H5O_token_t)); + H5MM_memcpy(&ref->info.obj.token, obj_token, token_size); HDassert(token_size <= 255); ref->token_size = (uint8_t)token_size; diff --git a/src/H5SM.c b/src/H5SM.c index 450baac..2e3fe04 100644 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -2583,19 +2583,19 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, int fwi ? "List" : (table->indexes[x].index_type == H5SM_BTREE ? "B-Tree" : "Unknown"))); - HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth, "Address of index:", table->indexes[x].index_addr); - HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth, "Address of index's heap:", table->indexes[x].heap_addr); HDfprintf(stream, "%*s%-*s 0x%08x\n", indent + 3, "", fwidth, "Message type flags:", table->indexes[x].mesg_types); - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth, "Minimum size of messages:", table->indexes[x].min_mesg_size); - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth, "Number of messages:", table->indexes[x].num_messages); - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth, "Maximum list size:", table->indexes[x].list_max); - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth, "Minimum B-tree size:", table->indexes[x].btree_min); } /* end for */ @@ -2683,16 +2683,16 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, int fwidt HDassert(fh); HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth, "Location:", "in heap"); - HDfprintf(stream, "%*s%-*s 0x%Zx\n", indent + 3, "", fwidth, - "Heap ID:", list->messages[x].u.heap_loc.fheap_id); - HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", fwidth, + HDfprintf(stream, "%*s%-*s 0x%" PRIx64 "\n", indent + 3, "", fwidth, + "Heap ID:", list->messages[x].u.heap_loc.fheap_id.val); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent + 3, "", fwidth, "Reference count:", list->messages[x].u.heap_loc.ref_count); } /* end if */ else if (list->messages[x].location == H5SM_IN_OH) { HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth, "Location:", "in object header"); - HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth, "Object header address:", list->messages[x].u.mesg_loc.oh_addr); - HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth, "Message creation index:", list->messages[x].u.mesg_loc.oh_addr); HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", fwidth, "Message type ID:", list->messages[x].msg_type_id); diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c index 7873472..446f721 100644 --- a/src/H5SMbtree2.c +++ b/src/H5SMbtree2.c @@ -187,12 +187,12 @@ H5SM__bt2_debug(FILE *stream, int indent, int fwidth, const void *record, const FUNC_ENTER_STATIC_NOERR if (sohm->location == H5SM_IN_HEAP) - HDfprintf(stream, "%*s%-*s {%a, %lo, %Hx}\n", indent, "", fwidth, - "Shared Message in heap:", sohm->u.heap_loc.fheap_id, sohm->hash, + HDfprintf(stream, "%*s%-*s {%" PRIu64 ", %" PRIo32 ", %" PRIxHSIZE "}\n", indent, "", fwidth, + "Shared Message in heap:", sohm->u.heap_loc.fheap_id.val, sohm->hash, sohm->u.heap_loc.ref_count); else { HDassert(sohm->location == H5SM_IN_OH); - HDfprintf(stream, "%*s%-*s {%a, %lo, %Hx, %Hx}\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIo32 ", %x, %" PRIx32 "}\n", indent, "", fwidth, "Shared Message in OH:", sohm->u.mesg_loc.oh_addr, sohm->hash, sohm->msg_type_id, sohm->u.mesg_loc.index); } /* end else */ diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 307cabc..f737944 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -697,8 +697,10 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new #ifdef H5S_DEBUG if (H5DEBUG(S)) { - HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu", FUNC, - d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent); + HDfprintf(H5DEBUG(S), + "%s: start=%" PRIdHSIZE " stride=%" PRIuHSIZE " count=%" PRIuHSIZE + " block=%" PRIuHSIZE " xtent=%" PRIuHSIZE, + FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent); if (u == 0) HDfprintf(H5DEBUG(S), " rank=%u\n", rank); else @@ -729,8 +731,10 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new #ifdef H5S_DEBUG if (H5DEBUG(S)) { - HDfprintf(H5DEBUG(S), "%s: start=%Hd stride=%Hu count=%Hu block=%Hu xtent=%Hu", FUNC, - d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent); + HDfprintf(H5DEBUG(S), + "%s: start=%" PRIdHSIZE " stride=%" PRIuHSIZE " count=%" PRIuHSIZE + " block=%" PRIuHSIZE " xtent=%" PRIuHSIZE, + FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent); if (u == 0) HDfprintf(H5DEBUG(S), " rank=%u\n", rank); else @@ -754,7 +758,8 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new #ifdef H5S_DEBUG if (H5DEBUG(S)) { i = ((int)rank) - 1; - HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n", i, offset[i], i, max_xtent[i]); + HDfprintf(H5DEBUG(S), " offset[%2d]=%" PRIuHSIZE "; max_xtent[%2d]=%" PRIuHSIZE "\n", i, offset[i], i, + max_xtent[i]); } #endif for (i = ((int)rank) - 2; i >= 0; --i) { @@ -762,7 +767,8 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new max_xtent[i] = max_xtent[i + 1] * d[i].xtent; #ifdef H5S_DEBUG if (H5DEBUG(S)) - HDfprintf(H5DEBUG(S), " offset[%2d]=%Hu; max_xtent[%2d]=%Hu\n", i, offset[i], i, max_xtent[i]); + HDfprintf(H5DEBUG(S), " offset[%2d]=%" PRIuHSIZE "; max_xtent[%2d]=%" PRIuHSIZE "\n", i, + offset[i], i, max_xtent[i]); #endif } /* end for */ @@ -777,9 +783,9 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new *******************************************************/ #ifdef H5S_DEBUG if (H5DEBUG(S)) { - HDfprintf(H5DEBUG(S), "%s: Making contig type %Zu MPI_BYTEs\n", FUNC, elmt_size); + HDfprintf(H5DEBUG(S), "%s: Making contig type %zu MPI_BYTEs\n", FUNC, elmt_size); for (i = ((int)rank) - 1; i >= 0; --i) - HDfprintf(H5DEBUG(S), "d[%d].xtent=%Hu \n", i, d[i].xtent); + HDfprintf(H5DEBUG(S), "d[%d].xtent=%" PRIuHSIZE "\n", i, d[i].xtent); } #endif @@ -809,7 +815,8 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new if (H5DEBUG(S)) HDfprintf(H5DEBUG(S), "%s: Dimension i=%d \n" - "start=%Hd count=%Hu block=%Hu stride=%Hu, xtent=%Hu max_xtent=%d\n", + "start=%" PRIdHSIZE " count=%" PRIuHSIZE " block=%" PRIuHSIZE " stride=%" PRIuHSIZE + ", xtent=%" PRIuHSIZE " max_xtent=%" PRIuHSIZE "\n", FUNC, i, d[i].start, d[i].count, d[i].block, d[i].strid, d[i].xtent, max_xtent[i]); #endif @@ -950,7 +957,8 @@ done: #ifdef H5S_DEBUG if (H5DEBUG(S)) - HDfprintf(H5DEBUG(S), "Leave %s, count=%ld is_derived_type=%t\n", FUNC, *count, *is_derived_type); + HDfprintf(H5DEBUG(S), "Leave %s, count=%d is_derived_type=%s\n", FUNC, *count, + (*is_derived_type) ? "TRUE" : "FALSE"); #endif FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__mpio_reg_hyper_type() */ diff --git a/src/H5Snone.c b/src/H5Snone.c index 4b03059..1909ff8 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -680,7 +680,7 @@ H5S__none_bounds(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *star HDassert(end); FUNC_LEAVE_NOAPI(FAIL) -} /* end H5S__none_bounds() */ +} /* end H5S_none_bounds() */ /*-------------------------------------------------------------------------- NAME diff --git a/src/H5T.c b/src/H5T.c index 0c75531..c145a04 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -5819,10 +5819,12 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) case H5T_VLEN: /* Recurse on the VL information if it's VL, compound or array, then free VL sequence */ - /* Recurse if it's VL, compound, enum or array */ + /* Recurse if it's VL, compound, enum or array (ignore references here so that we can encode + * them as part of the same blob)*/ /* (If the force_conv flag is _not_ set, the type cannot change in size, so don't recurse) */ if (dt->shared->parent->shared->force_conv && - H5T_IS_COMPLEX(dt->shared->parent->shared->type)) { + H5T_IS_COMPLEX(dt->shared->parent->shared->type) && + (dt->shared->parent->shared->type != H5T_REFERENCE)) { if ((changed = H5T_set_loc(dt->shared->parent, file, loc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); if (changed > 0) diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 08948b2..3eecfb3 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -84,7 +84,10 @@ H5FL_EXTERN(H5VL_object_t); * Purpose: Save a transient datatype to a file and turn the type handle * into a "named", immutable type. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * April 5, 2007 * *------------------------------------------------------------------------- */ @@ -248,7 +251,10 @@ done: * Note: The datatype access property list is unused currently, but * is checked for sanity anyway. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure + * + * Programmer: Peter Cao + * May 17, 2005 * *------------------------------------------------------------------------- */ @@ -479,7 +485,10 @@ done: * * Purpose: Determines if a datatype is committed or not. * - * Return: TRUE/FALSE/FAIL + * Return: TRUE/FALSE/Negative + * + * Programmer: Robb Matzke + * Thursday, June 4, 1998 * *------------------------------------------------------------------------- */ @@ -510,7 +519,7 @@ done: * ADJUST to the link count. * * Return: Success: New link count - * Failure: Negative + * Failure: -1 * * Programmer: Quincey Koziol * Friday, September 26, 2003 @@ -545,6 +554,9 @@ done: * * Failure: H5I_INVALID_HID * + * Programmer: James Laird + * Thursday July 27, 2006 + * *------------------------------------------------------------------------- */ hid_t @@ -608,6 +620,9 @@ done: * * Failure: H5I_INVALID_HID * + * Programmer: Quincey Koziol + * Tuesday, November 28, 2006 + * *------------------------------------------------------------------------- */ hid_t diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 01f6b41..d8e4759 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -983,14 +983,12 @@ done: #define CI_PRINT_STATS(STYPE, DTYPE) \ { \ if (H5DEBUG(T) && ((H5T_conv_hw_t *)cdata->priv)->s_aligned) { \ - HDfprintf(H5DEBUG(T), " %Hu src elements aligned on %lu-byte boundaries\n", \ - ((H5T_conv_hw_t *)cdata->priv)->s_aligned, \ - (unsigned long)H5T_NATIVE_##STYPE##_ALIGN_g); \ + HDfprintf(H5DEBUG(T), " %zu src elements aligned on %zu-byte boundaries\n", \ + ((H5T_conv_hw_t *)cdata->priv)->s_aligned, H5T_NATIVE_##STYPE##_ALIGN_g); \ } \ if (H5DEBUG(T) && ((H5T_conv_hw_t *)cdata->priv)->d_aligned) { \ - HDfprintf(H5DEBUG(T), " %Hu dst elements aligned on %lu-byte boundaries\n", \ - ((H5T_conv_hw_t *)cdata->priv)->d_aligned, \ - (unsigned long)H5T_NATIVE_##DTYPE##_ALIGN_g); \ + HDfprintf(H5DEBUG(T), " %zu dst elements aligned on %zu-byte boundaries\n", \ + ((H5T_conv_hw_t *)cdata->priv)->d_aligned, H5T_NATIVE_##DTYPE##_ALIGN_g); \ } \ } diff --git a/src/H5Tdbg.c b/src/H5Tdbg.c index 9dae22d..5d0c5cd 100644 --- a/src/H5Tdbg.c +++ b/src/H5Tdbg.c @@ -91,6 +91,13 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED *path, int H5_ATTR_UNUSED *nprint /*i if (H5DEBUG(T) && path->stats.ncalls > 0) { hsize_t nbytes; char bandwidth[32]; + struct { + char *user; + char *system; + char *elapsed; + } timestrs = {H5_timer_get_time_string(path->stats.times.user), + H5_timer_get_time_string(path->stats.times.system), + H5_timer_get_time_string(path->stats.times.elapsed)}; if (nprint && 0 == (*nprint)++) { HDfprintf(H5DEBUG(T), "H5T: type conversion statistics:\n"); @@ -108,13 +115,15 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED *path, int H5_ATTR_UNUSED *nprint /*i nbytes = H5T_get_size(path->dst); else nbytes = 0; - nbytes *= path->stats.nelmts; H5_bandwidth(bandwidth, (double)nbytes, path->stats.times.elapsed); - HDfprintf(H5DEBUG(T), " %-16s %10Hd %10d %8T %8T %8T %10s\n", path->name, path->stats.nelmts, - path->stats.ncalls, path->stats.times.user, path->stats.times.system, - path->stats.times.elapsed, bandwidth); - } /* end if */ + HDfprintf(H5DEBUG(T), " %-16s %10" PRIdHSIZE " %10u %8s %8s %8s %10s\n", path->name, + path->stats.nelmts, path->stats.ncalls, timestrs.user, timestrs.system, timestrs.elapsed, + bandwidth); + free(timestrs.user); + free(timestrs.system); + free(timestrs.elapsed); + } #endif FUNC_LEAVE_NOAPI(SUCCEED) @@ -394,7 +403,8 @@ H5T_debug(const H5T_t *dt, FILE *stream) HDfprintf(stream, "\n\"%s\" = 0x", dt->shared->u.enumer.name[i]); for (k = 0; k < base_size; k++) - HDfprintf(stream, "%02p", ((uint8_t *)dt->shared->u.enumer.value + (i * base_size) + k)); + HDfprintf(stream, "%02" PRIx8, + *((uint8_t *)dt->shared->u.enumer.value + (i * base_size) + k)); } /* end for */ HDfprintf(stream, "\n"); } diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 4a57ac2..0261428 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -49,7 +49,8 @@ #define H5T_NAMELEN 32 /* Macro to ease detecting "complex" datatypes (i.e. those with base types or fields) */ -#define H5T_IS_COMPLEX(t) ((t) == H5T_COMPOUND || (t) == H5T_ENUM || (t) == H5T_VLEN || (t) == H5T_ARRAY) +#define H5T_IS_COMPLEX(t) \ + ((t) == H5T_COMPOUND || (t) == H5T_ENUM || (t) == H5T_VLEN || (t) == H5T_ARRAY || (t) == H5T_REFERENCE) /* Macro to ease detecting fixed "string" datatypes */ #define H5T_IS_FIXED_STRING(dt) (H5T_STRING == (dt)->type) diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 25c8cea..4675871 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -56,10 +56,7 @@ typedef struct H5T_path_t H5T_path_t; struct H5S_t; /* How to copy a datatype */ -typedef enum H5T_copy_t { - H5T_COPY_TRANSIENT, - H5T_COPY_ALL, -} H5T_copy_t; +typedef enum H5T_copy_t { H5T_COPY_TRANSIENT, H5T_COPY_ALL } H5T_copy_t; /* Location of datatype information */ typedef enum { diff --git a/src/H5Tref.c b/src/H5Tref.c index 7fb6c0e..7092a71 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -40,6 +40,22 @@ #define H5T_REF_OBJ_DISK_SIZE(f) (H5F_SIZEOF_ADDR(f)) #define H5T_REF_DSETREG_DISK_SIZE(f) (H5HG_HEAP_ID_SIZE(f)) +/* Debug */ +// #define H5T_REF_DEBUG +#ifdef H5T_REF_DEBUG +#define H5T_REF_LOG_DEBUG(...) \ + do { \ + HDfprintf(stdout, " # %s(): ", __func__); \ + HDfprintf(stdout, __VA_ARGS__); \ + HDfprintf(stdout, "\n"); \ + HDfflush(stdout); \ + } while (0) +#else +#define H5T_REF_LOG_DEBUG(...) \ + do { \ + } while (0) +#endif + /******************/ /* Local Typedefs */ /******************/ @@ -145,6 +161,7 @@ H5T__ref_set_loc(const H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) htri_t ret_value = FALSE; /* Indicate success, but no location change */ FUNC_ENTER_PACKAGE + H5T_REF_LOG_DEBUG("loc=%d", (int)loc); HDassert(dt); /* f is NULL when loc == H5T_LOC_MEMORY */ @@ -331,6 +348,7 @@ H5T__ref_mem_isnull(const H5VL_object_t H5_ATTR_UNUSED *src_file, const void *sr herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC_NOERR + H5T_REF_LOG_DEBUG(""); /* Check parameters */ HDassert(src_buf); @@ -356,6 +374,7 @@ H5T__ref_mem_setnull(H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, H5_A herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC_NOERR + H5T_REF_LOG_DEBUG(""); HDmemset(dst_buf, 0, H5T_REF_MEM_SIZE); @@ -383,6 +402,7 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf size_t ret_value = 0; /* Return value */ FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); /* Sanity check */ HDassert(src_buf); @@ -483,6 +503,7 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); /* Sanity check */ HDassert(src_buf); @@ -571,6 +592,7 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); /* Sanity check */ HDassert(src_buf); @@ -678,6 +700,7 @@ H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); /* Check parameters */ HDassert(src_file); @@ -720,6 +743,7 @@ H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf) herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); HDassert(dst_file); HDassert(dst_buf); @@ -768,6 +792,7 @@ H5T__ref_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_bu size_t ret_value = 0; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); HDassert(src_buf); @@ -816,6 +841,7 @@ H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t H5_ATTR_ herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); HDassert(src_file); HDassert(src_buf); @@ -861,6 +887,7 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); HDassert(src_buf); HDassert(src_size); @@ -919,6 +946,7 @@ H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbo herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); /* Check parameters */ HDassert(src_file); @@ -970,6 +998,7 @@ H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void H5_ATTR_UNUSED *sr size_t ret_value = 0; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); HDassert(src_file); HDassert(src_buf); @@ -1016,6 +1045,7 @@ H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_ herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); HDassert(src_file); HDassert(src_buf); @@ -1068,6 +1098,7 @@ H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); /* Check parameters */ HDassert(src_file); @@ -1122,6 +1153,7 @@ H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void #else FUNC_ENTER_STATIC_NOERR #endif + H5T_REF_LOG_DEBUG(""); HDassert(src_buf); @@ -1170,6 +1202,7 @@ H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC + H5T_REF_LOG_DEBUG(""); HDassert(src_file); HDassert(src_buf); @@ -1219,6 +1252,7 @@ H5T__ref_reclaim(void *elem, const H5T_t *dt) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE + H5T_REF_LOG_DEBUG(""); /* Sanity checks */ HDassert(elem); diff --git a/src/H5VLint.c b/src/H5VLint.c index b1c690a..cc5b8b7 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -2315,24 +2315,26 @@ H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref) /* Sanity check */ HDassert(obj); + /* Retrieve the VOL object wrapping context */ + if (H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") + if (NULL == vol_wrap_ctx || NULL == vol_wrap_ctx->connector) + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, + "VOL object wrap context or its connector is NULL???") + /* If the datatype is already VOL-managed, the datatype's vol_obj * field will get clobbered later, so disallow this. */ - if (type == H5I_DATATYPE) - if (TRUE == H5T_already_vol_managed((const H5T_t *)obj)) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can't wrap an uncommitted datatype") + if (type == H5I_DATATYPE) { + if (vol_wrap_ctx->connector->id == H5VL_NATIVE) + if (TRUE == H5T_already_vol_managed((const H5T_t *)obj)) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can't wrap an uncommitted datatype") + } /* Wrap the object with VOL connector info */ if (NULL == (new_obj = H5VL__wrap_obj(obj, type))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't wrap library object") - /* Retrieve the VOL object wrapping context */ - if (H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") - if (NULL == vol_wrap_ctx || NULL == vol_wrap_ctx->connector) - HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, - "VOL object wrap context or its connector is NULL???") - /* Get an ID for the object */ if ((ret_value = H5VL_register_using_vol_id(type, new_obj, vol_wrap_ctx->connector->id, app_ref)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object") diff --git a/src/H5Z.c b/src/H5Z.c index f731c27..8f9a050 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -137,8 +137,15 @@ H5Z_term_package(void) if (H5DEBUG(Z)) { for (i = 0; i < H5Z_table_used_g; i++) { for (dir = 0; dir < 2; dir++) { + struct { + char *user; + char *system; + char *elapsed; + } timestrs = {H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.user), + H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.system), + H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.elapsed)}; if (0 == H5Z_stat_table_g[i].stats[dir].total) - continue; + goto next; if (0 == nprint++) { /* Print column headers */ @@ -163,12 +170,14 @@ H5Z_term_package(void) H5Z_stat_table_g[i].stats[dir].times.elapsed); /* Print the statistics */ - HDfprintf(H5DEBUG(Z), " %s%-15s %10Hd %10Hd %8T %8T %8T %10s\n", (dir ? "<" : ">"), - comment, H5Z_stat_table_g[i].stats[dir].total, - H5Z_stat_table_g[i].stats[dir].errors, - H5Z_stat_table_g[i].stats[dir].times.user, - H5Z_stat_table_g[i].stats[dir].times.system, - H5Z_stat_table_g[i].stats[dir].times.elapsed, bandwidth); + HDfprintf(H5DEBUG(Z), " %s%-15s %10" PRIdHSIZE " %10" PRIdHSIZE " %8s %8s %8s %10s\n", + (dir ? "<" : ">"), comment, H5Z_stat_table_g[i].stats[dir].total, + H5Z_stat_table_g[i].stats[dir].errors, timestrs.user, timestrs.system, + timestrs.elapsed, bandwidth); +next: + free(timestrs.user); + free(timestrs.system); + free(timestrs.elapsed); } /* end for */ } /* end for */ } /* end if */ @@ -334,8 +343,8 @@ done: * * Purpose: This function unregisters a filter. * - * Return: SUCCEED/FAIL - * + * Return: Non-negative on success + * Negative on failure *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5dbg.c b/src/H5dbg.c index fe4e757..1b64d2c 100644 --- a/src/H5dbg.c +++ b/src/H5dbg.c @@ -13,11 +13,11 @@ /*------------------------------------------------------------------------- * - * Created: H5dbg.c - * Mar 4 2006 - * Quincey Koziol + * Created: H5dbg.c + * Mar 4 2006 + * Quincey Koziol * - * Purpose: Generic debugging routines + * Purpose: Generic debugging routines * *------------------------------------------------------------------------- */ @@ -29,7 +29,7 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ +#include "H5private.h" /* Generic Functions */ /****************/ /* Local Macros */ @@ -56,14 +56,14 @@ /*******************/ /*------------------------------------------------------------------------- - * Function: H5_buffer_dump + * Function: H5_buffer_dump * - * Purpose: Dumps a buffer of memory in an octal dump form + * Purpose: Dumps a buffer of memory in an octal dump form * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 4 2006 + * Programmer: Quincey Koziol + * Mar 4 2006 * *------------------------------------------------------------------------- */ @@ -91,7 +91,7 @@ H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, const uint8_t *mark for (u = 0; u < buf_size; u += 16) { uint8_t c; - HDfprintf(stream, "%*s %8d: ", indent, "", u + buf_offset); + HDfprintf(stream, "%*s %8zu: ", indent, "", u + buf_offset); /* Print the hex values */ for (v = 0; v < 16; v++) { @@ -105,6 +105,7 @@ H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, const uint8_t *mark } /* end if */ else HDfprintf(stream, " "); + if (7 == v) HDfputc(' ', stream); } /* end for */ @@ -117,12 +118,14 @@ H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, const uint8_t *mark HDfputc(' ', stream); else { c = buf[buf_offset + u + v]; + if (HDisprint(c)) HDfputc(c, stream); else HDfputc('.', stream); } /* end else */ } /* end if */ + if (7 == v) HDfputc(' ', stream); } /* end for */ diff --git a/src/H5private.h b/src/H5private.h index 650604b..ca005f6 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -685,6 +685,11 @@ typedef struct { #ifndef HDacos #define HDacos(X) acos(X) #endif /* HDacos */ +#ifndef HDvasprintf +#ifdef H5_HAVE_VASPRINTF +#define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A) +#endif /* H5_HAVE_VASPRINTF */ +#endif /* HDvasprintf */ #ifndef HDalarm #ifdef H5_HAVE_ALARM #define HDalarm(N) alarm(N) @@ -886,8 +891,8 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDflock /* NOTE: flock(2) is not present on all POSIX systems. * If it is not present, we try a flock() equivalent based on - * fcntl(2), then fall back to a function that always fails if - * it is not present at all (Windows uses a separate Wflock() + * fcntl(2), then fall back to a function that always succeeds + * if it is not present at all (Windows uses a separate Wflock() * function). */ #if defined(H5_HAVE_FLOCK) @@ -910,10 +915,12 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDfork #define HDfork() fork() #endif /* HDfork */ +#ifndef HDfprintf +#define HDfprintf fprintf +#endif #ifndef HDfpathconf #define HDfpathconf(F, N) fpathconf(F, N) #endif /* HDfpathconf */ -H5_DLL int HDfprintf(FILE *stream, const char *fmt, ...); #ifndef HDfputc #define HDfputc(C, F) fputc(C, F) #endif /* HDfputc */ @@ -1246,7 +1253,7 @@ typedef off_t h5_stat_size_t; #define HDpread(F, B, C, O) pread(F, B, C, O) #endif /* HDpread */ #ifndef HDprintf -#define HDprintf(...) HDfprintf(stdout, __VA_ARGS__) +#define HDprintf printf #endif /* HDprintf */ #ifndef HDputc #define HDputc(C, F) putc(C, F) @@ -1611,9 +1618,6 @@ H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base); #ifndef HDva_start #define HDva_start(A, P) va_start(A, P) #endif /* HDva_start */ -#ifndef HDvasprintf -#define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A) -#endif /* HDvasprintf */ #ifndef HDvfprintf #define HDvfprintf(F, FMT, A) vfprintf(F, FMT, A) #endif /* HDvfprintf */ diff --git a/src/H5public.h b/src/H5public.h index fedefcc..2de4459 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -171,59 +171,118 @@ typedef long long ssize_t; #endif #endif +/* int64_t type is used for creation order field for links. It may be + * defined in Posix.1g, otherwise it is defined here. + */ +#if H5_SIZEOF_INT64_T >= 8 +#elif H5_SIZEOF_INT >= 8 +typedef int int64_t; +#undef H5_SIZEOF_INT64_T +#define H5_SIZEOF_INT64_T H5_SIZEOF_INT +#elif H5_SIZEOF_LONG >= 8 +typedef long int64_t; +#undef H5_SIZEOF_INT64_T +#define H5_SIZEOF_INT64_T H5_SIZEOF_LONG +#elif H5_SIZEOF_LONG_LONG >= 8 +typedef long long int64_t; +#undef H5_SIZEOF_INT64_T +#define H5_SIZEOF_INT64_T H5_SIZEOF_LONG_LONG +#else +#error "nothing appropriate for int64_t" +#endif + +/* uint64_t type is used for fields for H5O_info_t. It may be + * defined in Posix.1g, otherwise it is defined here. + */ +#if H5_SIZEOF_UINT64_T >= 8 +#ifndef UINT64_MAX +#define UINT64_MAX ((uint64_t)-1) +#endif +#elif H5_SIZEOF_INT >= 8 +typedef unsigned uint64_t; +#define UINT64_MAX UINT_MAX +#undef H5_SIZEOF_UINT64_T +#define H5_SIZEOF_UINT64_T H5_SIZEOF_INT +#elif H5_SIZEOF_LONG >= 8 +typedef unsigned long uint64_t; +#define UINT64_MAX ULONG_MAX +#undef H5_SIZEOF_UINT64_T +#define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG +#elif H5_SIZEOF_LONG_LONG >= 8 +typedef unsigned long long uint64_t; +#define UINT64_MAX ULLONG_MAX +#undef H5_SIZEOF_UINT64_T +#define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG_LONG +#else +#error "nothing appropriate for uint64_t" +#endif + /* - * The sizes of file objects have their own types defined here, use a 64-bit - * type. + * The sizes of file objects have their own types defined here, use a minimum + * 64-bit type. */ #if H5_SIZEOF_LONG_LONG >= 8 H5_GCC_DIAG_OFF("long-long") typedef unsigned long long hsize_t; typedef signed long long hssize_t; H5_GCC_DIAG_ON("long-long") +#define PRIdHSIZE H5_PRINTF_LL_WIDTH "d" +#define PRIiHSIZE H5_PRINTF_LL_WIDTH "i" +#define PRIoHSIZE H5_PRINTF_LL_WIDTH "o" +#define PRIuHSIZE H5_PRINTF_LL_WIDTH "u" +#define PRIxHSIZE H5_PRINTF_LL_WIDTH "x" +#define PRIXHSIZE H5_PRINTF_LL_WIDTH "X" #define H5_SIZEOF_HSIZE_T H5_SIZEOF_LONG_LONG #define H5_SIZEOF_HSSIZE_T H5_SIZEOF_LONG_LONG +#define HSIZE_UNDEF ULLONG_MAX #else #error "nothing appropriate for hsize_t" #endif -#define HSIZE_UNDEF ((hsize_t)(hssize_t)(-1)) /* * File addresses have their own types. */ #if H5_SIZEOF_INT >= 8 typedef unsigned haddr_t; -#define HADDR_UNDEF ((haddr_t)(-1)) +#define HADDR_UNDEF UINT_MAX #define H5_SIZEOF_HADDR_T H5_SIZEOF_INT #ifdef H5_HAVE_PARALLEL #define HADDR_AS_MPI_TYPE MPI_UNSIGNED #endif /* H5_HAVE_PARALLEL */ +#define PRIdHADDR "d" +#define PRIoHADDR "o" +#define PRIuHADDR "u" +#define PRIxHADDR "x" +#define PRIXHADDR "X" #elif H5_SIZEOF_LONG >= 8 typedef unsigned long haddr_t; -#define HADDR_UNDEF ((haddr_t)(long)(-1)) +#define HADDR_UNDEF ULONG_MAX #define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG #ifdef H5_HAVE_PARALLEL #define HADDR_AS_MPI_TYPE MPI_UNSIGNED_LONG #endif /* H5_HAVE_PARALLEL */ +#define PRIdHADDR "ld" +#define PRIoHADDR "lo" +#define PRIuHADDR "lu" +#define PRIxHADDR "lx" +#define PRIXHADDR "lX" #elif H5_SIZEOF_LONG_LONG >= 8 typedef unsigned long long haddr_t; -#define HADDR_UNDEF ((haddr_t)(long long)(-1)) +#define HADDR_UNDEF ULLONG_MAX #define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG_LONG #ifdef H5_HAVE_PARALLEL #define HADDR_AS_MPI_TYPE MPI_LONG_LONG_INT #endif /* H5_HAVE_PARALLEL */ +#define PRIdHADDR H5_PRINTF_LL_WIDTH "d" +#define PRIoHADDR H5_PRINTF_LL_WIDTH "o" +#define PRIuHADDR H5_PRINTF_LL_WIDTH "u" +#define PRIxHADDR H5_PRINTF_LL_WIDTH "x" +#define PRIXHADDR H5_PRINTF_LL_WIDTH "X" #else #error "nothing appropriate for haddr_t" #endif -#if H5_SIZEOF_HADDR_T == H5_SIZEOF_INT -#define H5_PRINTF_HADDR_FMT "%u" -#elif H5_SIZEOF_HADDR_T == H5_SIZEOF_LONG -#define H5_PRINTF_HADDR_FMT "%lu" -#elif H5_SIZEOF_HADDR_T == H5_SIZEOF_LONG_LONG -#define H5_PRINTF_HADDR_FMT "%" H5_PRINTF_LL_WIDTH "u" -#else -#error "nothing appropriate for H5_PRINTF_HADDR_FMT" -#endif -#define HADDR_MAX (HADDR_UNDEF - 1) +#define H5_PRINTF_HADDR_FMT "%" PRIuHADDR +#define HADDR_MAX (HADDR_UNDEF - 1) /* uint32_t type is used for creation order field for messages. It may be * defined in Posix.1g, otherwise it is defined here. @@ -245,46 +304,6 @@ typedef unsigned long uint32_t; #error "nothing appropriate for uint32_t" #endif -/* int64_t type is used for creation order field for links. It may be - * defined in Posix.1g, otherwise it is defined here. - */ -#if H5_SIZEOF_INT64_T >= 8 -#elif H5_SIZEOF_INT >= 8 -typedef int int64_t; -#undef H5_SIZEOF_INT64_T -#define H5_SIZEOF_INT64_T H5_SIZEOF_INT -#elif H5_SIZEOF_LONG >= 8 -typedef long int64_t; -#undef H5_SIZEOF_INT64_T -#define H5_SIZEOF_INT64_T H5_SIZEOF_LONG -#elif H5_SIZEOF_LONG_LONG >= 8 -typedef long long int64_t; -#undef H5_SIZEOF_INT64_T -#define H5_SIZEOF_INT64_T H5_SIZEOF_LONG_LONG -#else -#error "nothing appropriate for int64_t" -#endif - -/* uint64_t type is used for fields for H5O_info_t. It may be - * defined in Posix.1g, otherwise it is defined here. - */ -#if H5_SIZEOF_UINT64_T >= 8 -#elif H5_SIZEOF_INT >= 8 -typedef unsigned uint64_t; -#undef H5_SIZEOF_UINT64_T -#define H5_SIZEOF_UINT64_T H5_SIZEOF_INT -#elif H5_SIZEOF_LONG >= 8 -typedef unsigned long uint64_t; -#undef H5_SIZEOF_UINT64_T -#define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG -#elif H5_SIZEOF_LONG_LONG >= 8 -typedef unsigned long long uint64_t; -#undef H5_SIZEOF_UINT64_T -#define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG_LONG -#else -#error "nothing appropriate for uint64_t" -#endif - /* Common iteration orders */ typedef enum { H5_ITER_UNKNOWN = -1, /* Unknown order */ diff --git a/src/H5system.c b/src/H5system.c index 40a91c7..b2a2668 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -65,406 +65,35 @@ /* Track whether tzset routine was called */ static hbool_t H5_ntzset = FALSE; -/*------------------------------------------------------------------------- - * Function: HDfprintf - * - * Purpose: Prints the optional arguments under the control of the format - * string FMT to the stream STREAM. This function takes the - * same format as fprintf(3c) with a few added features: - * - * The conversion modifier `H' refers to the size of an - * `hsize_t' or `hssize_t' type. For instance, "0x%018Hx" - * prints an `hsize_t' value as a hex number right justified and - * zero filled in an 18-character field. - * - * The conversion 'a' refers to an haddr_t type. - * - * The conversion 't' refers to an htri_t type. - * - * The conversion 'k' refers to an H5O_token_t type. - * - * Return: Success: Number of characters printed - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Thursday, April 9, 1998 - * - *------------------------------------------------------------------------- - */ -/* Disable warning for "format not a string literal" here -QAK */ -/* - * This pragma only needs to surround the fprintf() calls with - * format_templ in the code below, but early (4.4.7, at least) gcc only - * allows diagnostic pragmas to be toggled outside of functions. +#ifndef HDvasprintf +/* HDvasprintf provides vasprintf-like function on targets where it is + * unavailable. */ -H5_GCC_DIAG_OFF("format-nonliteral") int -HDfprintf(FILE *stream, const char *fmt, ...) +HDvasprintf(char **bufp, const char *fmt, va_list _ap) { - int n = 0, nout = 0; - int fwidth, prec; - int zerofill; - int leftjust; - int plussign; - int ldspace; - int prefix; - char modifier[8]; - int conv; - char * rest, format_templ[128]; - int len; - const char *s; - va_list ap; - - HDassert(stream); - HDassert(fmt); - - HDva_start(ap, fmt); - while (*fmt) { - fwidth = prec = 0; - zerofill = 0; - leftjust = 0; - plussign = 0; - prefix = 0; - ldspace = 0; - modifier[0] = '\0'; - - if ('%' == fmt[0] && '%' == fmt[1]) { - HDputc('%', stream); - fmt += 2; - nout++; - } - else if ('%' == fmt[0]) { - s = fmt + 1; - - /* Flags */ - while (HDstrchr("-+ #", *s)) { - switch (*s) { - case '-': - leftjust = 1; - break; - - case '+': - plussign = 1; - break; - - case ' ': - ldspace = 1; - break; - - case '#': - prefix = 1; - break; - - default: - HDassert(0 && "Unknown format flag"); - } /* end switch */ /*lint !e744 Switch statement doesn't _need_ default */ - s++; - } /* end while */ - - /* Field width */ - if (HDisdigit(*s)) { - zerofill = ('0' == *s); - fwidth = (int)HDstrtol(s, &rest, 10); - s = rest; - } /* end if */ - else if ('*' == *s) { - fwidth = HDva_arg(ap, int); - if (fwidth < 0) { - leftjust = 1; - fwidth = -fwidth; - } - s++; - } - - /* Precision */ - if ('.' == *s) { - s++; - if (HDisdigit(*s)) { - prec = (int)HDstrtol(s, &rest, 10); - s = rest; - } - else if ('*' == *s) { - prec = HDva_arg(ap, int); - s++; - } - if (prec < 1) - prec = 1; - } - - /* Extra type modifiers */ - if (HDstrchr("zZHhlqLI", *s)) { - switch (*s) { - /*lint --e{506} Don't issue warnings about constant value booleans */ - /*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true */ - case 'H': - if (sizeof(hsize_t) < sizeof(long)) - modifier[0] = '\0'; - else if (sizeof(hsize_t) == sizeof(long)) { - HDstrncpy(modifier, "l", sizeof(modifier)); - modifier[sizeof(modifier) - 1] = '\0'; - } /* end if */ - else { - HDstrncpy(modifier, H5_PRINTF_LL_WIDTH, sizeof(modifier)); - modifier[sizeof(modifier) - 1] = '\0'; - } /* end else */ - break; - - case 'Z': - case 'z': - if (sizeof(size_t) < sizeof(long)) - modifier[0] = '\0'; - else if (sizeof(size_t) == sizeof(long)) { - HDstrncpy(modifier, "l", sizeof(modifier)); - modifier[sizeof(modifier) - 1] = '\0'; - } /* end if */ - else { - HDstrncpy(modifier, H5_PRINTF_LL_WIDTH, sizeof(modifier)); - modifier[sizeof(modifier) - 1] = '\0'; - } /* end else */ - break; - - default: - /* Handle 'I64' modifier for Microsoft's "__int64" type */ - if (*s == 'I' && *(s + 1) == '6' && *(s + 2) == '4') { - modifier[0] = *s; - modifier[1] = *(s + 1); - modifier[2] = *(s + 2); - modifier[3] = '\0'; - s += 2; /* Increment over 'I6', the '4' is taken care of below */ - } /* end if */ - else { - /* Handle 'll' for long long types */ - if (*s == 'l' && *(s + 1) == 'l') { - modifier[0] = *s; - modifier[1] = *s; - modifier[2] = '\0'; - s++; /* Increment over first 'l', second is taken care of below */ - } /* end if */ - else { - modifier[0] = *s; - modifier[1] = '\0'; - } /* end else */ - } /* end else */ - break; - } - s++; - } - - /* Conversion */ - conv = *s++; - - /* Create the format template */ - len = 0; - len += HDsnprintf(format_templ, (sizeof(format_templ) - (size_t)(len + 1)), "%%%s%s%s%s%s", - (leftjust ? "-" : ""), (plussign ? "+" : ""), (ldspace ? " " : ""), - (prefix ? "#" : ""), (zerofill ? "0" : "")); - if (fwidth > 0) - len += - HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%d", fwidth); - if (prec > 0) - len += - HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), ".%d", prec); - if (*modifier) - len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%s", - modifier); - HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%c", conv); - - /* Conversion */ - switch (conv) { - case 'd': - case 'i': - if (!HDstrcmp(modifier, "h")) { - short x = (short)HDva_arg(ap, int); - n = fprintf(stream, format_templ, x); - } - else if (!*modifier) { - int x = HDva_arg(ap, int); - n = fprintf(stream, format_templ, x); - } - else if (!HDstrcmp(modifier, "l")) { - long x = HDva_arg(ap, long); - n = fprintf(stream, format_templ, x); - } - else { - int64_t x = HDva_arg(ap, int64_t); - n = fprintf(stream, format_templ, x); - } - break; - - case 'o': - case 'u': - case 'x': - case 'X': - if (!HDstrcmp(modifier, "h")) { - unsigned short x = (unsigned short)HDva_arg(ap, unsigned int); - n = fprintf(stream, format_templ, x); - } - else if (!*modifier) { - unsigned int x = HDva_arg(ap, unsigned int); - n = fprintf(stream, format_templ, x); - } - else if (!HDstrcmp(modifier, "l")) { - unsigned long x = HDva_arg(ap, unsigned long); - n = fprintf(stream, format_templ, x); - } - else { - uint64_t x = HDva_arg(ap, uint64_t); - n = fprintf(stream, format_templ, x); - } - break; - - case 'f': - case 'e': - case 'E': - case 'g': - case 'G': - if (!HDstrcmp(modifier, "h")) { - float x = (float)HDva_arg(ap, double); - n = fprintf(stream, format_templ, (double)x); - } - else if (!*modifier || !HDstrcmp(modifier, "l")) { - double x = HDva_arg(ap, double); - n = fprintf(stream, format_templ, x); - } - else { - /* - * Some compilers complain when `long double' and - * `double' are the same thing. - */ -#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE - long double x = HDva_arg(ap, long double); - n = fprintf(stream, format_templ, x); -#else - double x = HDva_arg(ap, double); - n = fprintf(stream, format_templ, x); -#endif - } - break; - - case 'a': { - haddr_t x = HDva_arg(ap, haddr_t); - - if (H5F_addr_defined(x)) { - len = 0; - len += HDsnprintf(format_templ, (sizeof(format_templ) - (size_t)(len + 1)), - "%%%s%s%s%s%s", (leftjust ? "-" : ""), (plussign ? "+" : ""), - (ldspace ? " " : ""), (prefix ? "#" : ""), (zerofill ? "0" : "")); - if (fwidth > 0) - len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), - "%d", fwidth); - - /*lint --e{506} Don't issue warnings about constant value booleans */ - /*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true - */ - if (sizeof(x) == H5_SIZEOF_INT) { - HDstrncat(format_templ, "u", (sizeof(format_templ) - (size_t)(len + 1))); - len++; - } /* end if */ - else if (sizeof(x) == H5_SIZEOF_LONG) { - HDstrncat(format_templ, "lu", (sizeof(format_templ) - (size_t)(len + 1))); - len++; - } /* end if */ - else if (sizeof(x) == H5_SIZEOF_LONG_LONG) { - HDstrncat(format_templ, H5_PRINTF_LL_WIDTH, - (sizeof(format_templ) - (size_t)(len + 1))); - len += (int)sizeof(H5_PRINTF_LL_WIDTH); - HDstrncat(format_templ, "u", (sizeof(format_templ) - (size_t)(len + 1))); - len++; - } - n = fprintf(stream, format_templ, x); - } - else { - len = 0; - HDstrncpy(format_templ, "%", (sizeof(format_templ) - (size_t)(len + 1))); - len++; - if (leftjust) { - HDstrncat(format_templ, "-", (sizeof(format_templ) - (size_t)(len + 1))); - len++; - } /* end if */ - if (fwidth) - len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), - "%d", fwidth); - HDstrncat(format_templ, "s", (sizeof(format_templ) - (size_t)(len + 1))); - n = fprintf(stream, format_templ, "UNDEF"); - } - } break; - - case 'c': { - char x = (char)HDva_arg(ap, int); - n = fprintf(stream, format_templ, x); - } break; - - case 's': - case 'p': { - char *x = HDva_arg(ap, char *); - n = fprintf(stream, format_templ, x); - } break; - - case 'n': - format_templ[HDstrlen(format_templ) - 1] = 'u'; - n = fprintf(stream, format_templ, nout); - break; - - case 't': { - htri_t tri_var = HDva_arg(ap, htri_t); - - if (tri_var > 0) - n = fprintf(stream, "TRUE"); - else if (!tri_var) - n = fprintf(stream, "FALSE"); - else - n = fprintf(stream, "FAIL(%d)", (int)tri_var); - } break; - - case 'T': /* Elapsed time, in seconds */ - { - double seconds = HDva_arg(ap, double); - char * time_string = H5_timer_get_time_string(seconds); - - if (time_string) { - n = fprintf(stream, format_templ, time_string); - HDfree(time_string); - } /* end if */ - else - n = fprintf(stream, format_templ, "(error)"); - } break; - - case 'k': { - H5O_token_t token = HDva_arg(ap, H5O_token_t); - - /* Print the raw token. */ - n = fprintf( - stream, - "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", - (unsigned char)token.__data[15], (unsigned char)token.__data[14], - (unsigned char)token.__data[13], (unsigned char)token.__data[12], - (unsigned char)token.__data[11], (unsigned char)token.__data[10], - (unsigned char)token.__data[9], (unsigned char)token.__data[8], - (unsigned char)token.__data[7], (unsigned char)token.__data[6], - (unsigned char)token.__data[5], (unsigned char)token.__data[4], - (unsigned char)token.__data[3], (unsigned char)token.__data[2], - (unsigned char)token.__data[1], (unsigned char)token.__data[0]); - } break; - - default: - HDfputs(format_templ, stream); - n = (int)HDstrlen(format_templ); - break; - } - nout += n; - fmt = s; - } - else { - HDputc(*fmt, stream); - fmt++; - nout++; + char * buf; /* buffer to receive formatted string */ + size_t bufsz; /* size of buffer to allocate */ + + for (bufsz = 32; (buf = HDmalloc(bufsz)) != NULL;) { + int ret; + va_list ap; + + HDva_copy(ap, _ap); + ret = HDvsnprintf(buf, bufsz, fmt, ap); + va_end(ap); + if (ret >= 0 && (size_t)ret < bufsz) { + *bufp = buf; + return ret; } + HDfree(buf); + if (ret < 0) + return ret; + bufsz = (size_t)ret + 1; } - HDva_end(ap); - return nout; -} /* end HDfprintf() */ -H5_GCC_DIAG_ON("format-nonliteral") + return -1; +} +#endif /*------------------------------------------------------------------------- * Function: HDstrtoll @@ -677,15 +306,15 @@ Pflock(int fd, int operation) * Purpose: Wrapper function for systems where no file locking is * available. * - * Return: Failure: -1 (always fails) + * Return: 0 (success) * *------------------------------------------------------------------------- */ int H5_ATTR_CONST Nflock(int H5_ATTR_UNUSED fd, int H5_ATTR_UNUSED operation) { - /* just fail */ - return -1; + /* just succeed */ + return 0; } /* end Nflock() */ /*------------------------------------------------------------------------- diff --git a/src/H5trace.c b/src/H5trace.c index 635b9e7..18c7f7e 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -261,7 +261,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else { haddr_t addr = HDva_arg(ap, haddr_t); - HDfprintf(out, "%a", addr); + HDfprintf(out, "%" PRIuHADDR, addr); } /* end else */ break; @@ -825,7 +825,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else { H5E_error2_t *error = HDva_arg(ap, H5E_error2_t *); - HDfprintf(out, "0x%p", error); + HDfprintf(out, "0x%p", (void *)error); } /* end else */ break; @@ -1153,7 +1153,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else { H5G_stat_t *statbuf = HDva_arg(ap, H5G_stat_t *); - HDfprintf(out, "0x%p", statbuf); + HDfprintf(out, "0x%p", (void *)statbuf); } break; #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -1176,7 +1176,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) if (H5S_UNLIMITED == p[i]) HDfprintf(out, "%sH5S_UNLIMITED", (i ? ", " : "")); else - HDfprintf(out, "%s%Hu", (i ? ", " : ""), p[i]); + HDfprintf(out, "%s%" PRIuHSIZE, (i ? ", " : ""), p[i]); } /* end for */ HDfprintf(out, "}"); } /* end if */ @@ -1190,7 +1190,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) if (H5S_UNLIMITED == hsize) HDfprintf(out, "H5S_UNLIMITED"); else { - HDfprintf(out, "%Hu", hsize); + HDfprintf(out, "%" PRIuHSIZE, hsize); asize[argno] = (hssize_t)hsize; } /* end else */ } /* end else */ @@ -1207,7 +1207,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, " {"); for (i = 0; i < asize[asize_idx]; i++) - HDfprintf(out, "%s%Hd", (i ? ", " : ""), p[i]); + HDfprintf(out, "%s%" PRIdHSIZE, (i ? ", " : ""), p[i]); HDfprintf(out, "}"); } /* end if */ } /* end if */ @@ -1217,7 +1217,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else { hssize_t hssize = HDva_arg(ap, hssize_t); - HDfprintf(out, "%Hd", hssize); + HDfprintf(out, "%" PRIdHSIZE, hssize); asize[argno] = (hssize_t)hssize; } /* end else */ break; @@ -1896,7 +1896,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else { hobj_ref_t ref = HDva_arg(ap, hobj_ref_t); - HDfprintf(out, "Reference Object=%a", ref); + HDfprintf(out, "Reference Object=%" PRIuHADDR, ref); } /* end else */ break; @@ -3560,7 +3560,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, " {"); for (i = 0; i < asize[asize_idx]; i++) - HDfprintf(out, "%s%Zu", (i ? ", " : ""), p[i]); + HDfprintf(out, "%s%zu", (i ? ", " : ""), p[i]); HDfprintf(out, "}"); } /* end if */ } /* end if */ @@ -3570,7 +3570,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else { size_t size = HDva_arg(ap, size_t); - HDfprintf(out, "%Zu", size); + HDfprintf(out, "%zu", size); asize[argno] = (hssize_t)size; } /* end else */ break; @@ -3617,7 +3617,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else { H5Z_class2_t *filter = HDva_arg(ap, H5Z_class2_t *); - HDfprintf(out, "0x%p", filter); + HDfprintf(out, "0x%p", (void *)filter); } /* end else */ break; @@ -3666,7 +3666,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, " {"); for (i = 0; i < asize[asize_idx]; i++) - HDfprintf(out, "%s%Zd", (i ? ", " : ""), p[i]); + HDfprintf(out, "%s%zd", (i ? ", " : ""), p[i]); HDfprintf(out, "}"); } /* end if */ } /* end if */ @@ -3676,7 +3676,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else { ssize_t ssize = HDva_arg(ap, ssize_t); - HDfprintf(out, "%Zd", ssize); + HDfprintf(out, "%zd", ssize); asize[argno] = (hssize_t)ssize; } /* end else */ break; diff --git a/src/H5win32defs.h b/src/H5win32defs.h index ebffd7e..d5096e5 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -31,33 +31,40 @@ #define PRIoPTR "llo" #define PRIuPTR "llu" #define PRIxPTR "llx" +#define PRIXPTR "llX" #else /* _WIN64 */ #define PRIdPTR "ld" #define PRIoPTR "lo" #define PRIuPTR "lu" #define PRIxPTR "lx" +#define PRIXPTR "lX" #endif /* _WIN64 */ #define PRId8 "d" #define PRIo8 "o" #define PRIu8 "u" #define PRIx8 "x" +#define PRIX8 "X" #define PRId16 "d" #define PRIo16 "o" #define PRIu16 "u" #define PRIx16 "x" +#define PRIX16 "X" #define PRId32 "d" #define PRIo32 "o" #define PRIu32 "u" #define PRIx32 "x" +#define PRIX32 "X" #define PRId64 "lld" #define PRIo64 "llo" #define PRIu64 "llu" #define PRIx64 "llx" +#define PRIX64 "llX" #define PRIdMAX "lld" #define PRIoMAX "llo" #define PRIuMAX "llu" #define PRIxMAX "llx" +#define PRIXMAX "llX" #endif /* diff --git a/src/Makefile.am b/src/Makefile.am index 787b502..cbecccd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -141,8 +141,8 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers H5Apublic.h H5ACpublic.h \ H5Cpublic.h H5Dpublic.h \ H5Epubgen.h H5Epublic.h H5ESpublic.h H5Fpublic.h \ - H5FDpublic.h H5FDcore.h H5FDdirect.h H5FDfamily.h H5FDhdfs.h \ - H5FDlog.h H5FDmirror.h H5FDmpi.h H5FDmpio.h H5FDmulti.h H5FDros3.h \ + H5FDpublic.h H5FDcore.h H5FDdirect.h H5FDfamily.h H5FDhdfs.h \ + H5FDlog.h H5FDmirror.h H5FDmpi.h H5FDmpio.h H5FDmulti.h H5FDros3.h \ H5FDsec2.h H5FDsplitter.h H5FDstdio.h H5FDwindows.h \ H5Gpublic.h H5Ipublic.h H5Lpublic.h \ H5Mpublic.h H5MMpublic.h H5Opublic.h H5Ppublic.h \ diff --git a/test/accum.c b/test/accum.c index abd6a5e..183f955 100644 --- a/test/accum.c +++ b/test/accum.c @@ -2329,16 +2329,18 @@ accum_printf(const H5F_t *f) HDprintf("=====================================================\n"); HDprintf(" accumulator allocated size == %zu\n", accum->alloc_size); HDprintf(" accumulated data size == %zu\n", accum->size); - HDfprintf(stdout, " accumulator dirty? == %t\n", accum->dirty); + HDfprintf(stdout, " accumulator dirty? == %s\n", accum->dirty ? "TRUE" : "FALSE"); HDprintf("=====================================================\n"); - HDfprintf(stdout, " start of accumulated data, loc = %a\n", accum->loc); + HDfprintf(stdout, " start of accumulated data, loc = %" PRIuHADDR "\n", accum->loc); if (accum->dirty) { - HDfprintf(stdout, " start of dirty region, loc = %a\n", (haddr_t)(accum->loc + accum->dirty_off)); - HDfprintf(stdout, " end of dirty region, loc = %a\n", + HDfprintf(stdout, " start of dirty region, loc = %" PRIuHADDR "\n", + (haddr_t)(accum->loc + accum->dirty_off)); + HDfprintf(stdout, " end of dirty region, loc = %" PRIuHADDR "\n", (haddr_t)(accum->loc + accum->dirty_off + accum->dirty_len)); } /* end if */ - HDfprintf(stdout, " end of accumulated data, loc = %a\n", (haddr_t)(accum->loc + accum->size)); - HDfprintf(stdout, " end of accumulator allocation, loc = %a\n", + HDfprintf(stdout, " end of accumulated data, loc = %" PRIuHADDR "\n", + (haddr_t)(accum->loc + accum->size)); + HDfprintf(stdout, " end of accumulator allocation, loc = %" PRIuHADDR "\n", (haddr_t)(accum->loc + accum->alloc_size)); HDprintf("=====================================================\n"); } diff --git a/test/big.c b/test/big.c index 4dd7c74..6bdbf58 100644 --- a/test/big.c +++ b/test/big.c @@ -429,7 +429,7 @@ writer(char *filename, hid_t fapl, fsizes_t testsize, int wrt_n) for (i = 0; i < wrt_n; i++) { /* start position must be at least hs_size from the end */ hs_start[0] = randll(size2[0] - hs_size[0], i); - HDfprintf(out, "#%03d 0x%016Hx\n", i, hs_start[0]); + HDfprintf(out, "#%03d 0x%016" PRIxHSIZE "\n", i, hs_start[0]); if (H5Sselect_hyperslab(space2, H5S_SELECT_SET, hs_start, NULL, hs_size, NULL) < 0) goto error; for (j = 0; j < WRT_SIZE; j++) { @@ -524,7 +524,7 @@ reader(char *filename, hid_t fapl) break; i = (int)HDstrtol(ln + 1, &s, 10); hs_offset[0] = HDstrtoull(s, NULL, 0); - HDfprintf(stdout, "#%03d 0x%016Hx%47s", i, hs_offset[0], ""); + HDfprintf(stdout, "#%03d 0x%016" PRIxHSIZE "%47s", i, hs_offset[0], ""); HDfflush(stdout); if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) @@ -605,7 +605,7 @@ usage(void) "\t-c\tFile system Checking skipped. Caution: this test generates\n" "\t\tmany big files and may fill up the file system.\n" "\t-fsize\tChange family size default to where is\n" - "\t\ta positive float point number. Default value is %Hu.\n" + "\t\ta positive float point number. Default value is %" PRIuHSIZE ".\n" "Examples:\n" "\tbig -fsize 2.1e9 \t# test with file size just under 2GB\n" "\tbig -fsize 2.2e9 \t# test with file size just above 2GB\n" diff --git a/test/cache.c b/test/cache.c index 8b5597d..0587aa7 100644 --- a/test/cache.c +++ b/test/cache.c @@ -2770,17 +2770,17 @@ write_permitted_check(int /*------------------------------------------------------------------------- * Function: check_insert_entry() * - * Purpose: Verify that H5C_insert_entry behaves as expected. - * Test the behaviour with different flags. + * Purpose: Verify that H5C_insert_entry behaves as expected. + * Test the behaviour with different flags. * - * This test was added primarily to test basic insert - * pinned entry functionallity, but I through in explicit - * tests for other functionallity that is tested implicitly - * elsewhere. + * This test was added primarily to test basic insert + * pinned entry functionallity, but I through in explicit + * tests for other functionallity that is tested implicitly + * elsewhere. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 8/10/06 * * Modifications: @@ -3137,14 +3137,15 @@ check_flush_cache(unsigned paged) } /* check_flush_cache() */ /*------------------------------------------------------------------------- + * * Function: check_flush_cache__empty_cache() * - * Purpose: Verify that flush_cache behaves as expected with an empty + * Purpose : Verify that flush_cache behaves as expected with an empty * cache. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 1/12/05 * * Modifications: @@ -4425,11 +4426,11 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) /*------------------------------------------------------------------------- * Function: check_flush_cache__multi_entry_test() * - * Purpose: Run a multi entry flush cache test. + * Purpose : Run a multi entry flush cache test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 1/13/05 * * Modifications: @@ -4453,7 +4454,7 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int /* This gets used a lot, so lets leave it in. */ HDfprintf(stdout, "check_flush_cache__multi_entry_test: test %d\n", - test_num); + test_num); #endif /* JRM */ if (cache_ptr == NULL) { @@ -4478,6 +4479,7 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int u = 0; while (pass && (u < spec_size)) { + if (((unsigned)spec[u].entry_num != u) || (spec[u].entry_type < 0) || (spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES) || (spec[u].entry_index < 0) || (spec[u].entry_index > max_indices[spec[u].entry_type])) { @@ -4492,6 +4494,7 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int u = 0; while (pass && (u < spec_size)) { + if (spec[u].insert_flag) { insert_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, spec[u].flags); @@ -4587,6 +4590,7 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int u = 0; while (pass && (u < spec_size)) { + base_addr = entries[spec[u].entry_type]; entry_ptr = &(base_addr[spec[u].entry_index]); @@ -4602,13 +4606,14 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int } /* check_flush_cache__multi_entry_test() */ /*------------------------------------------------------------------------- + * * Function: check_flush_cache__pe_multi_entry_test() * - * Purpose: Run a multi entry flush cache test. + * Purpose: Run a multi entry flush cache test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/5/06 * * Modifications: @@ -4658,6 +4663,7 @@ check_flush_cache__pe_multi_entry_test(H5F_t *file_ptr, int test_num, unsigned i u = 0; while (pass && (u < spec_size)) { + if (((unsigned)spec[u].entry_num != u) || (spec[u].entry_type < 0) || (spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES) || (spec[u].entry_index < 0) || (spec[u].entry_index > max_indices[spec[u].entry_type]) || (spec[u].num_pins < 0) || @@ -4687,6 +4693,7 @@ check_flush_cache__pe_multi_entry_test(H5F_t *file_ptr, int test_num, unsigned i total_entry_size += entry_sizes[spec[u].entry_type]; for (j = 0; j < spec[u].num_pins; j++) { + create_pinned_entry_dependency(file_ptr, spec[u].entry_type, spec[u].entry_index, spec[u].pin_type[j], spec[u].pin_idx[j]); } @@ -4709,6 +4716,7 @@ check_flush_cache__pe_multi_entry_test(H5F_t *file_ptr, int test_num, unsigned i u = 0; while (pass && (u < spec_size)) { + base_addr = entries[spec[u].entry_type]; entry_ptr = &(base_addr[spec[u].entry_index]); @@ -4773,6 +4781,7 @@ check_flush_cache__pe_multi_entry_test(H5F_t *file_ptr, int test_num, unsigned i u = 0; while (pass && (u < spec_size)) { + base_addr = entries[spec[u].entry_type]; entry_ptr = &(base_addr[spec[u].entry_index]); @@ -7987,12 +7996,12 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) /*------------------------------------------------------------------------- * Function: check_flush_cache__flush_op_test() * - * Purpose: Run a flush op flush cache test. Of the nature of - * flush operations, this is a multi-entry test. + * Purpose: Run a flush op flush cache test. Of the nature of + * flush operations, this is a multi-entry test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 9/3/06 * * Modifications: @@ -8042,6 +8051,7 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu i = 0; while (pass && (i < spec_size)) { + if ((spec[i].entry_num != i) || (spec[i].entry_type < 0) || (spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || (spec[i].entry_index < 0) || (spec[i].entry_index > max_indices[spec[i].entry_type]) || (spec[i].num_pins < 0) || @@ -8057,6 +8067,7 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu i = 0; while (pass && (i < check_size)) { + if ((check[i].entry_num != i) || (check[i].entry_type < 0) || (check[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || (check[i].entry_index < 0) || (check[i].entry_index > max_indices[check[i].entry_type]) || @@ -8084,6 +8095,7 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu i = 0; while (pass && (i < spec_size)) { + if (spec[i].insert_flag) { insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].flags); @@ -8104,6 +8116,7 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu } for (j = 0; j < spec[i].num_flush_ops; j++) { + add_flush_op(spec[i].entry_type, spec[i].entry_index, spec[i].flush_ops[j].op_code, spec[i].flush_ops[j].type, spec[i].flush_ops[j].idx, spec[i].flush_ops[j].flag, spec[i].flush_ops[j].size, spec[i].flush_ops[j].order_ptr); @@ -8139,6 +8152,7 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu i = 0; while (pass && (i < spec_size)) { + base_addr = entries[spec[i].entry_type]; entry_ptr = &(base_addr[spec[i].entry_index]); @@ -8172,6 +8186,7 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu i = 0; while (pass && (i < check_size)) { + if (check[i].in_cache != entry_in_cache(cache_ptr, check[i].entry_type, check[i].entry_index)) { pass = FALSE; @@ -8315,6 +8330,7 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu i = 0; while (pass && (i < spec_size)) { + base_addr = entries[spec[i].entry_type]; entry_ptr = &(base_addr[spec[i].entry_index]); @@ -8329,6 +8345,7 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu i = 0; while (pass && (i < check_size)) { + base_addr = entries[check[i].entry_type]; entry_ptr = &(base_addr[check[i].entry_index]); @@ -8348,14 +8365,14 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu /*------------------------------------------------------------------------- * Function: check_flush_cache__flush_op_eviction_test() * - * Purpose: Verify that flush operations work as expected when an + * Purpose: Verify that flush operations work as expected when an * entry is evicted. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 10/3/06 * * Modifications: @@ -12124,11 +12141,11 @@ check_flush_cache__single_entry(H5F_t *file_ptr) /*------------------------------------------------------------------------- * Function: check_flush_cache__single_entry_test() * - * Purpose: Run a single entry flush cache test. + * Purpose: Run a single entry flush cache test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 1/12/05 * * Modifications: @@ -12194,11 +12211,13 @@ check_flush_cache__single_entry_test(H5F_t *file_ptr, int test_num, int entry_ty pass = FALSE; HDsnprintf(msg, (size_t)128, "flush with flags 0x%x failed in single entry test #%d.", flush_flags, test_num); + failure_mssg = msg; } else if ((entry_ptr->deserialized != expected_deserialized) || (entry_ptr->serialized != expected_serialized) || (entry_ptr->destroyed != expected_destroyed)) { + #if 0 /* This is useful debugging code -- lets keep it for a while */ HDfprintf(stdout, @@ -12260,11 +12279,11 @@ check_flush_cache__single_entry_test(H5F_t *file_ptr, int test_num, int entry_ty /*------------------------------------------------------------------------- * Function: check_flush_cache__pinned_single_entry_test() * - * Purpose: Run a pinned single entry flush cache test. + * Purpose: Run a pinned single entry flush cache test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 3/28/06 * * Modifications: @@ -12357,6 +12376,7 @@ check_flush_cache__pinned_single_entry_test(H5F_t *file_ptr, int test_num, int e else if ((entry_ptr->deserialized != expected_deserialized) || (entry_ptr->serialized != expected_serialized) || (entry_ptr->destroyed != expected_destroyed)) { + #if 0 /* this is useful debugging code -- keep it around */ HDfprintf(stdout, "desrlzd = %d(%d), srlzd = %d(%d), dest = %d(%d)\n", @@ -13686,12 +13706,12 @@ check_pin_protected_entry(unsigned paged) /*------------------------------------------------------------------------- * Function: check_resize_entry() * - * Purpose: Verify that H5C_resize_entry() and H5C_unprotect() resize - * entries as expected. + * Purpose: Verify that H5C_resize_entry() and H5C_unprotect() resize + * entries as expected. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 7/7/06 * *------------------------------------------------------------------------- @@ -14125,6 +14145,7 @@ check_resize_entry(unsigned paged) HDsnprintf(msg, (size_t)128, "Unexpected cache status 8."); failure_mssg = msg; } + base_addr = entries[LARGE_ENTRY_TYPE]; entry_ptr = &(base_addr[3]); entry_size = LARGE_ENTRY_SIZE; @@ -14536,12 +14557,12 @@ check_resize_entry(unsigned paged) /*------------------------------------------------------------------------- * Function: check_evictions_enabled() * - * Purpose: Verify that H5C_get_evictions_enabled() and - * H5C_set_evictions_enabled() functions perform as expected. + * Purpose: Verify that H5C_get_evictions_enabled() and + * H5C_set_evictions_enabled() functions perform as expected. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 8/2/07 * * Modifications: @@ -15174,12 +15195,12 @@ check_evictions_enabled(unsigned paged) /*------------------------------------------------------------------------- * Function: check_flush_protected_err() * - * Purpose: Verify that an attempt to flush the cache when it contains - * a protected entry will generate an error. + * Purpose: Verify that an attempt to flush the cache when it contains + * a protected entry will generate an error. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/24/04 * * Modifications: @@ -16292,12 +16313,12 @@ check_move_entry_errs(unsigned paged) /*------------------------------------------------------------------------- * Function: check_resize_entry_errs() * - * Purpose: Verify that invalid calls to H5C_resize_entry() - * generates errors as expected. + * Purpose: Verify that invalid calls to H5C_resize_entry() + * generates errors as expected. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 7/7/06 * *------------------------------------------------------------------------- @@ -29797,7 +29818,7 @@ done: /*------------------------------------------------------------------------- * Function: check_flush_deps_order() * - * Purpose: Verify that the order that entries with flush dependencies + * Purpose: Verify that the order that entries with flush dependencies * is correct * * Return: 0 on success, non-zero on failure @@ -33578,25 +33599,26 @@ check_entry_deletions_during_scans(unsigned paged) } /* check_entry_deletions_during_scans() */ /*------------------------------------------------------------------------- + * * Function: cedds__expunge_dirty_entry_in_flush_test() * - * Purpose: Verify that H5C_flush_cache() can handle the removal of - * a dirty entry from the cache during its scan of the - * skip list. + * Purpose: Verify that H5C_flush_cache() can handle the removal of + * a dirty entry from the cache during its scan of the + * skip list. * - * Do this by setting up a full cache, with the last entry - * on the LRU being both dirty and having a flush operation - * that deletes the second to last entry on the LRU. Then - * flush the cache, triggering the flush of the last - * item, and thereby the deletion of the second to last item. + * Do this by setting up a full cache, with the last entry + * on the LRU being both dirty and having a flush operation + * that deletes the second to last entry on the LRU. Then + * flush the cache, triggering the flush of the last + * item, and thereby the deletion of the second to last item. * - * H5C_flush_cache() should handle this deletion gracefully. + * H5C_flush_cache() should handle this deletion gracefully. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/4/15 * * Modifications: @@ -33710,15 +33732,15 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t *file_ptr) * are in cache with the following characteristics: * * in - * entry: cache? size: dirty? pinned? pins: flush operations: + * entry: cache? size: dirty? pinned? pins: flush operations: * - * (HET, 0) Y 16 KB Y N - expunge (HET 1) + * (HET, 0) Y 16 KB Y N - expunge (HET 1) * - * (HET, 1) Y 16 KB Y N - - + * (HET, 1) Y 16 KB Y N - - * - * (HET, 2) Y 16 KB Y N - - + * (HET, 2) Y 16 KB Y N - - * - * (HET, 3) Y 16 KB Y N - - + * (HET, 3) Y 16 KB Y N - - * * Recall that in this test bed, flush operations are excuted the * first time the associated entry is flushed, and are then @@ -33793,25 +33815,25 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t *file_ptr) /*------------------------------------------------------------------------- * Function: cedds__H5C_make_space_in_cache() * - * Purpose: Verify that H5C__make_space_in_cache() can handle the - * removal from the cache of the next item in its reverse scan - * of the LRU list. + * Purpose: Verify that H5C__make_space_in_cache() can handle the + * removal from the cache of the next item in its reverse scan + * of the LRU list. * - * Do this by setting up a full cache, with the last entry - * on the LRU being both dirty and having a flush operation - * that deleted the second to last entry on the LRU. Then - * load an additional entry, triggering the flush of the last - * item, and thereby the deletion of the second to last item. + * Do this by setting up a full cache, with the last entry + * on the LRU being both dirty and having a flush operation + * that deleted the second to last entry on the LRU. Then + * load an additional entry, triggering the flush of the last + * item, and thereby the deletion of the second to last item. * - * H5C__make_space_in_cache() should detect this deletion, and - * restart its scan of the LRU from the tail, instead of - * examining the now deleted next item up on the LRU. + * H5C__make_space_in_cache() should detect this deletion, and + * restart its scan of the LRU from the tail, instead of + * examining the now deleted next item up on the LRU. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/4/15 * * Modifications: @@ -34154,25 +34176,25 @@ cedds__H5C_make_space_in_cache(H5F_t *file_ptr) /*------------------------------------------------------------------------- * Function: cedds__H5C__autoadjust__ageout__evict_aged_out_entries() * - * Purpose: Verify that H5C__autoadjust__ageout__evict_aged_out_entries() - * can handle the removal from the cache of the next item in - * its reverse scan of the LRU list. + * Purpose: Verify that H5C__autoadjust__ageout__evict_aged_out_entries() + * can handle the removal from the cache of the next item in + * its reverse scan of the LRU list. * - * Do this by setting up a full cache, with the last entry - * on the LRU being both dirty and having a flush operation - * that deletes the second to last entry on the LRU. Then - * access the first item in the LRU repeatedly until the - * item, and thereby the deletion of the second to last item. + * Do this by setting up a full cache, with the last entry + * on the LRU being both dirty and having a flush operation + * that deletes the second to last entry on the LRU. Then + * access the first item in the LRU repeatedly until the + * item, and thereby the deletion of the second to last item. * - * H5C__make_space_in_cache() should detect this deletion, and - * restart its scan of the LRU from the tail, instead of - * examining the now deleted next item up on the LRU. + * H5C__make_space_in_cache() should detect this deletion, and + * restart its scan of the LRU from the tail, instead of + * examining the now deleted next item up on the LRU. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/4/15 * * Modifications: @@ -34552,86 +34574,86 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *file_ptr) /*------------------------------------------------------------------------- * Function: cedds__H5C_flush_invalidate_cache__bucket_scan() * - * Purpose: Note: We now use the index list when we scan the - * contents of the metadata cache, so in principal, - * this test is obsolete. However, even using the - * index list, restarts are possible, and must be - * handled gracefully. - * - * As it turns out, this test triggers index list - * scan restarts, and thus with minor changes is - * still a useful test. - * - * For this reason, with the exception of changing - * to check the index_scan_restart stat instead of - * hash bucket restarts, I'm leaving the test - * alone. If and when it starts to fail due to - * other changes, we can re-work it to test - * index list scan restarts explicitly. - * - * JRM -- 11/2/16 - * - * Verify that H5C_flush_invalidate_cache() can handle - * the removal from the cache of the next item in - * its scans of hash buckets. - * - * !!!!!!!!!!WARNING !!!!!!!!!! - * - * This test may fail to function correctly if the hash - * table size or hash function is altered. - * - * To setup the test, this function depends on the fact that - * H5C_flush_invalidate_cache() does alternating scans of the - * slist and the index. If this changes, the test will likely - * also cease to function correctly. - * - * The test relies on a known hash function and hash table - * size to select a set of test entries that will all hash - * to the same hash bucket -- call it the test hash bucket. - * It also relies on known behavior of the cache to place - * the entries in the test bucket in a known order. - * - * To avoid pre-mature flushes of the entries in the - * test hash bucket, all entries are initially clean, - * with the exception of the first entry which is dirty. - * It avoids premature flushing by being the parent in - * a flush dependency. The first entry in the test bucket - * also has a flush op which expunges the second entry -- - * setting up the failure. - * - * An additional dirty entry is added (which must hash - * to a different bucket, and must have a higher address - * than at least the first entry in the test hash bucket. - * This entry is the child in a flush dependency with the - * first entry in the above hash bucket, and contains - * a flush op to destroy this flush dependency. - * - * Since the first entry in the test hash bucket has a lower - * address that the other dirty entry, the scan of the - * slist encounters it first, and passes over it because - * it has a flush dependency height of 1. - * - * The scan then encounters the second dirty entry and flushes - * it -- causing it to destroy the flush dependency and thus - * reducing the flush dependency height of the first entry in - * the test hash bucket to zero. - * - * After completing a scan of the slist, - * H5C_flush_invalidate_cache() then scans the index, - * flushing all entries of flush dependency height zero. - * - * This sets up the potential error when the first entry - * in the test hash bucket is flushed -- expunging the - * second entry as a side effect. If - * H5C_flush_invalidate_cache() fails to detect this, - * it will attempt to continue its scan of the bucket with - * an entry that has been deleted from the cache. + * Purpose: Note: We now use the index list when we scan the + * contents of the metadata cache, so in principal, + * this test is obsolete. However, even using the + * index list, restarts are possible, and must be + * handled gracefully. + * + * As it turns out, this test triggers index list + * scan restarts, and thus with minor changes is + * still a useful test. + * + * For this reason, with the exception of changing + * to check the index_scan_restart stat instead of + * hash bucket restarts, I'm leaving the test + * alone. If and when it starts to fail due to + * other changes, we can re-work it to test + * index list scan restarts explicitly. + * + * JRM -- 11/2/16 + * + * Verify that H5C_flush_invalidate_cache() can handle + * the removal from the cache of the next item in + * its scans of hash buckets. + * + * !!!!!!!!!!WARNING !!!!!!!!!! + * + * This test may fail to function correctly if the hash + * table size or hash function is altered. + * + * To setup the test, this function depends on the fact that + * H5C_flush_invalidate_cache() does alternating scans of the + * slist and the index. If this changes, the test will likely + * also cease to function correctly. + * + * The test relies on a known hash function and hash table + * size to select a set of test entries that will all hash + * to the same hash bucket -- call it the test hash bucket. + * It also relies on known behavior of the cache to place + * the entries in the test bucket in a known order. + * + * To avoid pre-mature flushes of the entries in the + * test hash bucket, all entries are initially clean, + * with the exception of the first entry which is dirty. + * It avoids premature flushing by being the parent in + * a flush dependency. The first entry in the test bucket + * also has a flush op which expunges the second entry -- + * setting up the failure. + * + * An additional dirty entry is added (which must hash + * to a different bucket, and must have a higher address + * than at least the first entry in the test hash bucket. + * This entry is the child in a flush dependency with the + * first entry in the above hash bucket, and contains + * a flush op to destroy this flush dependency. + * + * Since the first entry in the test hash bucket has a lower + * address that the other dirty entry, the scan of the + * slist encounters it first, and passes over it because + * it has a flush dependency height of 1. + * + * The scan then encounters the second dirty entry and flushes + * it -- causing it to destroy the flush dependency and thus + * reducing the flush dependency height of the first entry in + * the test hash bucket to zero. + * + * After completing a scan of the slist, + * H5C_flush_invalidate_cache() then scans the index, + * flushing all entries of flush dependency height zero. + * + * This sets up the potential error when the first entry + * in the test hash bucket is flushed -- expunging the + * second entry as a side effect. If + * H5C_flush_invalidate_cache() fails to detect this, + * it will attempt to continue its scan of the bucket with + * an entry that has been deleted from the cache. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/9/15 * * Modifications: @@ -35009,21 +35031,21 @@ check_stats(unsigned paged) /*------------------------------------------------------------------------- * Function: check_stats__smoke_check_1() * - * Purpose: Test to see if the statistics collection code is working - * more or less as expected. Do this by performing a number - * of operations in the cache, and checking to verify that - * they result in the expected statistics. + * Purpose: Test to see if the statistics collection code is working + * more or less as expected. Do this by performing a number + * of operations in the cache, and checking to verify that + * they result in the expected statistics. * - * Note that this function is not intended to be a full test - * of the statistics collection facility -- only a cursory - * check that will serve as a place holder until more complete - * tests are implemented. + * Note that this function is not intended to be a full test + * of the statistics collection facility -- only a cursory + * check that will serve as a place holder until more complete + * tests are implemented. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/22/15 * * Modifications: diff --git a/test/cache_common.c b/test/cache_common.c index b1b69f9..d0c267f 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -721,9 +721,11 @@ deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void *udata, hb else { if ((*(((const char *)image) + 2)) != (char)(idx & 0xFF)) { HDfprintf(stdout, "type = %d, idx = %d, addr = 0x%lx.\n", type, idx, (long)addr); - HDfprintf(stdout, "*image = 0x%x 0x%x 0x%x\n", (int)(*((const char *)image)), - (int)(*(((const char *)image) + 1)), (int)(*(((const char *)image) + 2))); - HDfprintf(stdout, "expected *image = 0x%x\n", (int)(idx & 0xFF), (int)((idx & 0xFF00) >> 8)); + HDfprintf(stdout, "*image = 0x%" PRIx8 " 0x%" PRIx8 " 0x%" PRIx8 "\n", + (*((const uint8_t *)image)), (*(((const uint8_t *)image) + 1)), + (*(((const uint8_t *)image) + 2))); + HDfprintf(stdout, "expected *image = 0x%02" PRIx32 "%02" PRIx32 "\n", (uint32_t)idx & 0xFF, + (((uint32_t)idx & 0xFF00) >> 8)); } /* end if */ HDassert((*((const char *)image)) == (char)(type & 0xFF)); HDassert((*(((const char *)image) + 1)) == (char)((idx & 0xFF00) >> 8)); @@ -2747,7 +2749,7 @@ expunge_entry(H5F_t *file_ptr, int32_t type, int32_t idx) * Function: flush_cache() * * Purpose: Flush the specified cache, destroying all entries if - requested. If requested, dump stats first. + * requested. If requested, dump stats first. * * Return: void * @@ -2790,6 +2792,7 @@ flush_cache(H5F_t *file_ptr, hbool_t destroy_entries, hbool_t dump_stats, hbool_ (cache_ptr->clean_index_size != 0) || (cache_ptr->dirty_index_size != 0))) { if (verbose) { + HDfprintf(stdout, "%s: unexpected il/is/cis/dis = %lld/%lld/%lld/%lld.\n", FUNC, (long long)(cache_ptr->index_len), (long long)(cache_ptr->index_size), (long long)(cache_ptr->clean_index_size), (long long)(cache_ptr->dirty_index_size)); @@ -3533,8 +3536,8 @@ unprotect_entry(H5F_t *file_ptr, int32_t type, int32_t idx, unsigned int flags) * Function: row_major_scan_forward() * * Purpose: Do a sequence of inserts, protects, unprotects, moves, - * destroys while scanning through the set of entries. If - * pass is false on entry, do nothing. + * destroys while scanning through the set of entries. If + * pass is false on entry, do nothing. * * Return: void * diff --git a/test/cache_tagging.c b/test/cache_tagging.c index b4af425..dbb7c81 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -345,7 +345,8 @@ evict_entries(hid_t fid) /* Evict all we can from the cache to examine full tag creation tree */ /* This function will likely return failure since the root group - * is still protected. Thus, don't check its return value. */ + * is still protected. Thus, don't check its return value. + */ H5C_flush_cache(f, H5C__FLUSH_INVALIDATE_FLAG); return 0; diff --git a/test/chunk_info.c b/test/chunk_info.c index a663e5e..7774873 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -335,8 +335,9 @@ verify_selected_chunks(hid_t dset, hid_t plist, hsize_t *start, hsize_t *end) /* Verify that read chunk is the same as the corresponding written one */ if (HDmemcmp(expected_buf[chk_index], read_buf, CHUNK_NX * CHUNK_NY) != 0) { - HDfprintf(stderr, "Read chunk differs from written chunk at offset (%d,%d)\n", offset[0], - offset[1]); + HDfprintf(stderr, + "Read chunk differs from written chunk at offset (%" PRIuHSIZE ",%" PRIuHSIZE ")\n", + offset[0], offset[1]); return FAIL; } } @@ -709,7 +710,8 @@ test_get_chunk_info_highest_v18(hid_t fapl) /* Verify that the number of chunks is NUM_CHUNKS */ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - VERIFY(nchunks, NUM_CHUNKS, "H5Dget_num_chunks, number of chunks"); + if (nchunks != NUM_CHUNKS) + TEST_ERROR /* Attempt to get info of a chunk from an empty dataset, verify the returned address and size in the case of H5D_ALLOC_TIME_EARLY */ @@ -718,11 +720,12 @@ test_get_chunk_info_highest_v18(hid_t fapl) ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size); if (ret < 0) TEST_ERROR + /* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */ if (addr == HADDR_UNDEF) - FAIL_PUTS_ERROR(MSG_CHK_ADDR); + TEST_ERROR if (size == EMPTY_CHK_SIZE) - FAIL_PUTS_ERROR(MSG_CHK_SIZE); + TEST_ERROR chk_index = 10; reinit_vars(&read_flt_msk, &addr, &size); @@ -731,9 +734,9 @@ test_get_chunk_info_highest_v18(hid_t fapl) TEST_ERROR /* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */ if (addr == HADDR_UNDEF) - FAIL_PUTS_ERROR(MSG_CHK_ADDR); + TEST_ERROR if (size == EMPTY_CHK_SIZE) - FAIL_PUTS_ERROR(MSG_CHK_SIZE); + TEST_ERROR /* Attempt to get info of a chunk given its coords from an empty dataset, verify the returned address and size */ @@ -743,9 +746,9 @@ test_get_chunk_info_highest_v18(hid_t fapl) TEST_ERROR /* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */ if (addr == HADDR_UNDEF) - FAIL_PUTS_ERROR(MSG_CHK_ADDR); + TEST_ERROR if (size == 0) - FAIL_PUTS_ERROR(MSG_CHK_SIZE); + TEST_ERROR if (H5Dclose(dset) < 0) TEST_ERROR @@ -855,7 +858,8 @@ test_chunk_info_single_chunk(const char *filename, hid_t fapl) /* Get the number of chunks and verify that no chunk has been written */ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - VERIFY(nchunks, NO_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks"); + if (nchunks != NO_CHUNK_WRITTEN) + TEST_ERROR /* Initialize the array of chunk data for the single chunk */ for (ii = 0; ii < NX; ii++) @@ -869,7 +873,8 @@ test_chunk_info_single_chunk(const char *filename, hid_t fapl) /* Get and verify that one chunk had been written */ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - VERIFY(nchunks, ONE_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks"); + if (nchunks != ONE_CHUNK_WRITTEN) + TEST_ERROR /* Offset of the only chunk */ offset[0] = 0; @@ -2061,8 +2066,7 @@ error: * * Purpose: Tests functions related to chunk information * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Binh-Minh Ribler * November 5, 2018 @@ -2094,18 +2098,18 @@ main(void) nerrors += test_flt_msk_with_skip_compress(fapl) < 0 ? 1 : 0; if (nerrors) - TEST_ERROR + goto error; HDprintf("All chunk query tests passed.\n"); h5_cleanup(FILENAME, fapl); - return SUCCEED; + return EXIT_SUCCESS; error: nerrors = MAX(1, nerrors); HDprintf("***** %d QUERY CHUNK INFO TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); - return FAIL; + return EXIT_FAILURE; } /**************************************************************************** diff --git a/test/dsets.c b/test/dsets.c index d76be02..e81a33e 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -4552,7 +4552,7 @@ test_nbit_int_size(hid_t file) if ((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1 * DSET_DIM2 * (precision / 8) || dset_size > DSET_DIM1 * DSET_DIM2 * (precision / 8) + 1 * KB) { H5_FAILED(); - HDfprintf(stdout, " Line %d: wrong dataset size: %Hu\n", __LINE__, dset_size); + HDfprintf(stdout, " Line %d: wrong dataset size: %" PRIuHSIZE "\n", __LINE__, dset_size); goto error; } @@ -4762,7 +4762,7 @@ test_nbit_flt_size(hid_t file) if ((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1 * DSET_DIM2 * (precision / 8) || dset_size > DSET_DIM1 * DSET_DIM2 * (precision / 8) + 1 * KB) { H5_FAILED(); - HDfprintf(stdout, " Line %d: wrong dataset size: %Hu\n", __LINE__, dset_size); + HDfprintf(stdout, " Line %d: wrong dataset size: %" PRIuHSIZE "\n", __LINE__, dset_size); goto error; } /* end if */ @@ -12318,6 +12318,9 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) TESTING("Version 2 B-tree chunk index header flush dependencies handled correctly"); + /* Initialize struct */ + HDmemset(&info, 0, sizeof(info)); + /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ diff --git a/test/dt_arith.c b/test/dt_arith.c index 2489539..466554c 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -775,7 +775,7 @@ test_particular_fp_integer(void) /* Print errors */ if (dst_c != SCHAR_MAX) { - double x = 0.; + double x = 0.0; signed char y; if (0 == fails_this_test++) @@ -819,7 +819,7 @@ test_particular_fp_integer(void) /* Print errors */ if (dst_i != fill_value) { - float x = 0.; + float x = 0.0; int y; if (0 == fails_this_test++) @@ -2783,18 +2783,18 @@ my_isnan(dtype_t type, void *val) char s[256]; if (FLT_FLOAT == type) { - float x = 0.; + float x = 0.0; HDmemcpy(&x, val, sizeof(float)); retval = (x != x); } else if (FLT_DOUBLE == type) { - double x = 0.; + double x = 0.0; HDmemcpy(&x, val, sizeof(double)); retval = (x != x); #if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0 } else if (FLT_LDOUBLE == type) { - long double x = 0.; + long double x = 0.0; HDmemcpy(&x, val, sizeof(long double)); retval = (x != x); #endif @@ -2809,20 +2809,20 @@ my_isnan(dtype_t type, void *val) */ if (!retval) { if (FLT_FLOAT == type) { - float x = 0.; + float x = 0.0; HDmemcpy(&x, val, sizeof(float)); HDsnprintf(s, sizeof(s), "%g", (double)x); } else if (FLT_DOUBLE == type) { - double x = 0.; + double x = 0.0; HDmemcpy(&x, val, sizeof(double)); HDsnprintf(s, sizeof(s), "%g", x); #if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0 } else if (FLT_LDOUBLE == type) { - long double x = 0.; + long double x = 0.0; HDmemcpy(&x, val, sizeof(long double)); HDsnprintf(s, sizeof(s), "%Lg", x); @@ -3283,7 +3283,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) int check_expo[2]; if (FLT_FLOAT == dst_type) { - float x = 0.; + float x = 0.0; HDmemcpy(&x, &buf[j * dst_size], sizeof(float)); if (underflow && HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN) continue; /* all underflowed, no error */ @@ -3294,7 +3294,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) check_mant[1] = HDfrexpf(hw_f, check_expo + 1); } else if (FLT_DOUBLE == dst_type) { - double x = 0.; + double x = 0.0; HDmemcpy(&x, &buf[j * dst_size], sizeof(double)); if (underflow && HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN) continue; /* all underflowed, no error */ @@ -3306,7 +3306,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) #if H5_SIZEOF_LONG_DOUBLE != 0 && (H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE) } else { - long double x = 0.; + long double x = 0.0; HDmemcpy(&x, &buf[j * dst_size], sizeof(long double)); /* dst is largest float, no need to check underflow. */ check_mant[0] = (double)HDfrexpl(x, check_expo + 0); @@ -3353,18 +3353,18 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) HDprintf(" %02x", saved[j * src_size + ENDIAN(src_size, k, sendian)]); HDprintf("%*s", (int)(3 * MAX(0, (ssize_t)dst_size - (ssize_t)src_size)), ""); if (FLT_FLOAT == src_type) { - float x = 0.; + float x = 0.0; HDmemcpy(&x, &saved[j * src_size], sizeof(float)); HDprintf(" %29.20e\n", (double)x); } else if (FLT_DOUBLE == src_type) { - double x = 0.; + double x = 0.0; HDmemcpy(&x, &saved[j * src_size], sizeof(double)); HDprintf(" %29.20e\n", x); #if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE } else { - long double x = 0.; + long double x = 0.0; HDmemcpy(&x, &saved[j * src_size], sizeof(long double)); HDfprintf(stdout, " %29.20Le\n", x); #endif @@ -3375,18 +3375,18 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) HDprintf(" %02x", buf[j * dst_size + ENDIAN(dst_size, k, dendian)]); HDprintf("%*s", (int)(3 * MAX(0, (ssize_t)src_size - (ssize_t)dst_size)), ""); if (FLT_FLOAT == dst_type) { - float x = 0.; + float x = 0.0; HDmemcpy(&x, &buf[j * dst_size], sizeof(float)); HDprintf(" %29.20e\n", (double)x); } else if (FLT_DOUBLE == dst_type) { - double x = 0.; + double x = 0.0; HDmemcpy(&x, &buf[j * dst_size], sizeof(double)); HDprintf(" %29.20e\n", x); #if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE } else { - long double x = 0.; + long double x = 0.0; HDmemcpy(&x, &buf[j * dst_size], sizeof(long double)); HDfprintf(stdout, " %29.20Le\n", x); #endif diff --git a/test/dtypes.c b/test/dtypes.c index 5fd32b7..157e3fa 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -5184,7 +5184,7 @@ test_conv_bitfield(void) goto error; if (buf[0] != 0xAA || buf[1] != 0xAA || buf[2] != 0 || buf[3] != 0) { H5_FAILED(); - printf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n", buf[3], buf[2], buf[1], buf[0]); + HDprintf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n", buf[3], buf[2], buf[1], buf[0]); goto error; } @@ -5205,7 +5205,7 @@ test_conv_bitfield(void) goto error; if (buf[0] != 0 || buf[1] != 0xA8 || buf[2] != 0x2A || buf[3] != 0) { H5_FAILED(); - printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n", buf[3], buf[2], buf[1], buf[0]); + HDprintf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n", buf[3], buf[2], buf[1], buf[0]); goto error; } @@ -5221,7 +5221,7 @@ test_conv_bitfield(void) goto error; if (buf[0] != 0xff || buf[1] != 0xAB || buf[2] != 0xEA || buf[3] != 0xff) { H5_FAILED(); - printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n", buf[3], buf[2], buf[1], buf[0]); + HDprintf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n", buf[3], buf[2], buf[1], buf[0]); goto error; } @@ -5475,7 +5475,7 @@ opaque_check(int tag_it) H5E_END_TRY; if (status >= 0) { H5_FAILED(); - printf(" opaque conversion should have failed but succeeded\n"); + HDprintf(" opaque conversion should have failed but succeeded\n"); goto error; } @@ -5488,7 +5488,7 @@ opaque_check(int tag_it) goto error; if (saved + 1 != num_opaque_conversions_g) { H5_FAILED(); - printf(" unexpected number of opaque conversions\n"); + HDprintf(" unexpected number of opaque conversions\n"); goto error; } @@ -8529,7 +8529,7 @@ int main(void) { long nerrors = 0; - hid_t fapl = -1; + hid_t fapl = H5I_INVALID_HID; /* Set the random # seed */ HDsrandom((unsigned)HDtime(NULL)); @@ -8538,7 +8538,7 @@ main(void) fapl = h5_fileaccess(); if (ALIGNMENT) - printf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT); + HDprintf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT); /* Do the tests */ nerrors += test_classes(); diff --git a/test/earray.c b/test/earray.c index 95ef728..79bf0f1 100644 --- a/test/earray.c +++ b/test/earray.c @@ -332,52 +332,63 @@ check_stats(const H5EA_t *ea, const earray_state_t *state) /* Compare information */ if (earray_stats.stored.max_idx_set != state->max_idx_set) { - HDfprintf(stdout, "earray_stats.stored.max_idx_set = %Hu, state->max_idx_set = %Hu\n", + HDfprintf(stdout, + "earray_stats.stored.max_idx_set = %" PRIuHSIZE ", state->max_idx_set = %" PRIuHSIZE "\n", earray_stats.stored.max_idx_set, state->max_idx_set); TEST_ERROR } /* end if */ if (earray_stats.stored.nelmts != state->nelmts) { - HDfprintf(stdout, "earray_stats.stored.nelmts = %Hu, state->nelmts = %Hu\n", + HDfprintf(stdout, "earray_stats.stored.nelmts = %" PRIuHSIZE ", state->nelmts = %" PRIuHSIZE "\n", earray_stats.stored.nelmts, state->nelmts); TEST_ERROR } /* end if */ if (earray_stats.computed.hdr_size != state->hdr_size) { - HDfprintf(stdout, "earray_stats.computed.hdr_size = %Hu, state->hdr_size = %Hu\n", + HDfprintf(stdout, + "earray_stats.computed.hdr_size = %" PRIuHSIZE ", state->hdr_size = %" PRIuHSIZE "\n", earray_stats.computed.hdr_size, state->hdr_size); TEST_ERROR } /* end if */ if (earray_stats.computed.nindex_blks != state->nindex_blks) { - HDfprintf(stdout, "earray_stats.computed.nindex_blks = %Hu, state->nindex_blks = %Hu\n", + HDfprintf(stdout, + "earray_stats.computed.nindex_blks = %" PRIuHSIZE ", state->nindex_blks = %" PRIuHSIZE "\n", earray_stats.computed.nindex_blks, state->nindex_blks); TEST_ERROR } /* end if */ if (earray_stats.computed.index_blk_size != state->index_blk_size) { - HDfprintf(stdout, "earray_stats.computed.index_blk_size = %Hu, state->index_blk_size = %Hu\n", + HDfprintf(stdout, + "earray_stats.computed.index_blk_size = %" PRIuHSIZE ", state->index_blk_size = %" PRIuHSIZE + "\n", earray_stats.computed.index_blk_size, state->index_blk_size); TEST_ERROR } /* end if */ if (earray_stats.stored.ndata_blks != state->ndata_blks) { - HDfprintf(stdout, "earray_stats.stored.ndata_blks = %Hu, state->ndata_blks = %Hu\n", + HDfprintf(stdout, + "earray_stats.stored.ndata_blks = %" PRIuHSIZE ", state->ndata_blks = %" PRIuHSIZE "\n", earray_stats.stored.ndata_blks, state->ndata_blks); TEST_ERROR } /* end if */ /* Don't compare this currently, it's very hard to compute */ #ifdef NOT_YET if (earray_stats.stored.data_blk_size != state->data_blk_size) { - HDfprintf(stdout, "earray_stats.stored.data_blk_size = %Hu, state->data_blk_size = %Hu\n", + HDfprintf(stdout, + "earray_stats.stored.data_blk_size = %" PRIuHSIZE ", state->data_blk_size = %" PRIuHSIZE + "\n", earray_stats.stored.data_blk_size, state->data_blk_size); TEST_ERROR } /* end if */ #endif /* NOT_YET */ if (earray_stats.stored.nsuper_blks != state->nsuper_blks) { - HDfprintf(stdout, "earray_stats.stored.nsuper_blks = %Hu, state->nsuper_blks = %Hu\n", + HDfprintf(stdout, + "earray_stats.stored.nsuper_blks = %" PRIuHSIZE ", state->nsuper_blks = %" PRIuHSIZE "\n", earray_stats.stored.nsuper_blks, state->nsuper_blks); TEST_ERROR } /* end if */ /* Don't compare this currently, it's very hard to compute */ #ifdef NOT_YET if (earray_stats.stored.super_blk_size != state->super_blk_size) { - HDfprintf(stdout, "earray_stats.stored.super_blk_size = %Hu, state->super_blk_size = %Hu\n", + HDfprintf(stdout, + "earray_stats.stored.super_blk_size = %" PRIuHSIZE ", state->super_blk_size = %" PRIuHSIZE + "\n", earray_stats.stored.super_blk_size, state->super_blk_size); TEST_ERROR } /* end if */ diff --git a/test/farray.c b/test/farray.c index a108512..b6a6c31 100644 --- a/test/farray.c +++ b/test/farray.c @@ -178,20 +178,20 @@ check_stats(const H5FA_t *fa, const farray_state_t *state) /* Compare information */ if (farray_stats.hdr_size != state->hdr_size) { - HDfprintf(stdout, "farray_stats.hdr_size = %Hu, state->hdr_size = %Hu\n", farray_stats.hdr_size, - state->hdr_size); + HDfprintf(stdout, "farray_stats.hdr_size = %" PRIuHSIZE ", state->hdr_size = %" PRIuHSIZE "\n", + farray_stats.hdr_size, state->hdr_size); TEST_ERROR } if (farray_stats.dblk_size != state->dblk_size) { - HDfprintf(stdout, "farray_stats.dblk_size = %Hu, state->dblk_size = %Hu\n", farray_stats.dblk_size, - state->dblk_size); + HDfprintf(stdout, "farray_stats.dblk_size = %" PRIuHSIZE ", state->dblk_size = %" PRIuHSIZE "\n", + farray_stats.dblk_size, state->dblk_size); TEST_ERROR } if (farray_stats.nelmts != state->nelmts) { - HDfprintf(stdout, "farray_stats.nelmts = %Hu, state->nelmts = %Hu\n", farray_stats.nelmts, - state->nelmts); + HDfprintf(stdout, "farray_stats.nelmts = %" PRIuHSIZE ", state->nelmts = %" PRIuHSIZE "\n", + farray_stats.nelmts, state->nelmts); TEST_ERROR } diff --git a/test/fheap.c b/test/fheap.c index 8bf1ba6..9a73cd0 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -272,43 +272,45 @@ check_stats(const H5HF_t *fh, const fheap_heap_state_t *state) if (H5HF_stat_info(fh, &heap_stats) < 0) FAIL_STACK_ERROR if (heap_stats.man_nobjs != state->man_nobjs) { - HDfprintf(stdout, "heap_stats.man_nobjs = %Hu, state->man_nobjs = %Zu\n", heap_stats.man_nobjs, - state->man_nobjs); + HDfprintf(stdout, "heap_stats.man_nobjs = %" PRIuHSIZE ", state->man_nobjs = %zu\n", + heap_stats.man_nobjs, state->man_nobjs); TEST_ERROR } /* end if */ if (heap_stats.man_size != state->man_size) { - HDfprintf(stdout, "heap_stats.man_size = %Hu, state->man_size = %Hu\n", heap_stats.man_size, - state->man_size); + HDfprintf(stdout, "heap_stats.man_size = %" PRIuHSIZE ", state->man_size = %" PRIuHSIZE "\n", + heap_stats.man_size, state->man_size); TEST_ERROR } /* end if */ if (heap_stats.man_alloc_size != state->man_alloc_size) { - HDfprintf(stdout, "heap_stats.man_alloc_size = %Hu, state->man_alloc_size = %Hu\n", + HDfprintf(stdout, + "heap_stats.man_alloc_size = %" PRIuHSIZE ", state->man_alloc_size = %" PRIuHSIZE "\n", heap_stats.man_alloc_size, state->man_alloc_size); TEST_ERROR } /* end if */ if (heap_stats.man_free_space != state->man_free_space) { - HDfprintf(stdout, "heap_stats.man_free_space = %Hu, state->man_free_space = %Hu\n", + HDfprintf(stdout, + "heap_stats.man_free_space = %" PRIuHSIZE ", state->man_free_space = %" PRIuHSIZE "\n", heap_stats.man_free_space, state->man_free_space); TEST_ERROR } /* end if */ if (heap_stats.huge_nobjs != state->huge_nobjs) { - HDfprintf(stdout, "heap_stats.huge_nobjs = %Hu, state->huge_nobjs = %Zu\n", heap_stats.huge_nobjs, - state->huge_nobjs); + HDfprintf(stdout, "heap_stats.huge_nobjs = %" PRIuHSIZE ", state->huge_nobjs = %zu\n", + heap_stats.huge_nobjs, state->huge_nobjs); TEST_ERROR } /* end if */ if (heap_stats.huge_size != state->huge_size) { - HDfprintf(stdout, "heap_stats.huge_size = %Hu, state->huge_size = %Hu\n", heap_stats.huge_size, - state->huge_size); + HDfprintf(stdout, "heap_stats.huge_size = %" PRIuHSIZE ", state->huge_size = %" PRIuHSIZE "\n", + heap_stats.huge_size, state->huge_size); TEST_ERROR } /* end if */ if (heap_stats.tiny_nobjs != state->tiny_nobjs) { - HDfprintf(stdout, "heap_stats.tiny_nobjs = %Hu, state->tiny_nobjs = %Zu\n", heap_stats.tiny_nobjs, - state->tiny_nobjs); + HDfprintf(stdout, "heap_stats.tiny_nobjs = %" PRIuHSIZE ", state->tiny_nobjs = %zu\n", + heap_stats.tiny_nobjs, state->tiny_nobjs); TEST_ERROR } /* end if */ if (heap_stats.tiny_size != state->tiny_size) { - HDfprintf(stdout, "heap_stats.tiny_size = %Hu, state->tiny_size = %Hu\n", heap_stats.tiny_size, - state->tiny_size); + HDfprintf(stdout, "heap_stats.tiny_size = %" PRIuHSIZE ", state->tiny_size = %" PRIuHSIZE "\n", + heap_stats.tiny_size, state->tiny_size); TEST_ERROR } /* end if */ diff --git a/test/fillval.c b/test/fillval.c index 2cd6989..05570f0 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -927,7 +927,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, H5D_f H5_FAILED(); HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__); HDfprintf(stdout, - " Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %u, " + " Elmt={%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE + "}, read: %u, " "Fill value: %u\n", hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4], val_rd, fillval); @@ -944,7 +945,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, H5D_f H5_FAILED(); HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__); HDfprintf(stdout, - " Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %f, %d, %f, %c" + " Elmt={%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE + "}, read: %f, %d, %f, %c" "Fill value: %f, %d, %f, %c\n", hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4], (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z, (double)fill_c.a, fill_c.x, fill_c.y, @@ -986,7 +988,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, H5D_f H5_FAILED(); HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__); HDfprintf(stdout, - " Elmt={%Hu, %Hu, %Hu, %Hu, %Hu}, read: %u, " + " Elmt={%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE + ", %" PRIuHSIZE "}, read: %u, " "Fill value: %u\n", hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4], buf[u], fillval); @@ -1012,7 +1015,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, H5D_f H5_FAILED(); HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__); HDfprintf(stdout, - " Elmt={%Hu, %Hu, %Hu, %Hu, %Hu}, read: %f, %d, %f, %c" + " Elmt={%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE + ", %" PRIuHSIZE "}, read: %f, %d, %f, %c" "Fill value: %f, %d, %f, %c\n", hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4], (double)buf_c[u].a, buf_c[u].x, buf_c[u].y, buf_c[u].z, (double)fill_c.a, @@ -1437,7 +1441,8 @@ test_extend_verify_integer(unsigned lineno, const hsize_t *offset, const void *_ if (*test_val != *compare_val) { HDfprintf(stdout, "%u: Value read was not expected.\n", lineno); HDfprintf(stdout, - " Elmt = {%Hu, %Hu, %Hu, %Hu, %Hu}, read: %d, " + " Elmt = {%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE + "}, read: %d, " "expected: %d\n", offset[0], offset[1], offset[2], offset[3], offset[4], *test_val, *compare_val); goto error; @@ -1528,7 +1533,8 @@ test_extend_verify_cmpd_vl(unsigned lineno, const hsize_t *offset, const void *_ HDstrcmp(test_val->b, compare_val->b) || (test_val->y != compare_val->y)) { HDfprintf(stdout, "%u: Value read was not expected.\n", lineno); HDfprintf(stdout, - " Elmt = {%Hu, %Hu, %Hu, %Hu, %Hu}, read: {%d, '%s', '%s', %d} " + " Elmt = {%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE + "}, read: {%d, '%s', '%s', %d} " "expected: {%d, '%s', '%s', %d}\n", offset[0], offset[1], offset[2], offset[3], offset[4], test_val->x, test_val->a, test_val->b, test_val->y, compare_val->x, compare_val->a, compare_val->b, compare_val->y); diff --git a/test/filter_plugin.c b/test/filter_plugin.c index b807218..7956ab3 100644 --- a/test/filter_plugin.c +++ b/test/filter_plugin.c @@ -1053,7 +1053,7 @@ test_path_api_calls(void) /* Get the path */ if ((path_len = H5PLget(0, path, 256)) <= 0) { - HDfprintf(stderr, " get 0 len: %u : %s\n", path_len, path); + HDfprintf(stderr, " get 0 len: %zd : %s\n", path_len, path); TEST_ERROR; } if (HDstrcmp(path, "a_path_0") != 0) { diff --git a/test/freespace.c b/test/freespace.c index cf9460c..4b6f54c 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -400,22 +400,27 @@ check_stats(const H5F_t *f, const H5FS_t *frsp, frspace_state_t *state) FAIL_STACK_ERROR if (frspace_stats.tot_space != state->tot_space) { - HDfprintf(stdout, "frspace_stats.tot_space = %Hu, state->tot_space = %Zu\n", frspace_stats.tot_space, - state->tot_space); + HDfprintf(stdout, "frspace_stats.tot_space = %" PRIuHSIZE ", state->tot_space = %" PRIuHSIZE "\n", + frspace_stats.tot_space, state->tot_space); TEST_ERROR } /* end if */ if (frspace_stats.tot_sect_count != state->tot_sect_count) { - HDfprintf(stdout, "frspace_stats.tot_sect_count = %Hu, state->tot_sect_count = %Hu\n", + HDfprintf(stdout, + "frspace_stats.tot_sect_count = %" PRIuHSIZE ", state->tot_sect_count = %" PRIuHSIZE "\n", frspace_stats.tot_sect_count, state->tot_sect_count); TEST_ERROR } /* end if */ if (frspace_stats.serial_sect_count != state->serial_sect_count) { - HDfprintf(stdout, "frspace_stats.serial_sect_count = %Hu, state->serial_sect_count = %Hu\n", + HDfprintf(stdout, + "frspace_stats.serial_sect_count = %" PRIuHSIZE ", state->serial_sect_count = %" PRIuHSIZE + "\n", frspace_stats.serial_sect_count, state->serial_sect_count); TEST_ERROR } /* end if */ if (frspace_stats.ghost_sect_count != state->ghost_sect_count) { - HDfprintf(stdout, "frspace_stats.ghost_sect_count = %Hu, state->ghost_sect_count = %Hu\n", + HDfprintf(stdout, + "frspace_stats.ghost_sect_count = %" PRIuHSIZE ", state->ghost_sect_count = %" PRIuHSIZE + "\n", frspace_stats.ghost_sect_count, state->ghost_sect_count); TEST_ERROR } /* end if */ diff --git a/test/gen_new_super.c b/test/gen_new_super.c index 69bf5fa..c3c22c1 100644 --- a/test/gen_new_super.c +++ b/test/gen_new_super.c @@ -49,10 +49,10 @@ main(void) /* Create a file creation property list */ fcpl = H5Pcreate(H5P_FILE_CREATE); - assert(fcpl >= 0); + HDassert(fcpl >= 0); ret = H5Pset_istore_k(fcpl, ISTORE_IK); - assert(ret >= 0); + HDassert(ret >= 0); /* Creating a file with the non-default file creation property list should * create a version 1 superblock @@ -60,15 +60,15 @@ main(void) /* Create file with custom file creation property list */ file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); - assert(file >= 0); + HDassert(file >= 0); /* Close FCPL */ ret = H5Pclose(fcpl); - assert(ret >= 0); + HDassert(ret >= 0); /* Close file */ ret = H5Fclose(file); - assert(ret >= 0); + HDassert(ret >= 0); - return 0; + return EXIT_SUCCESS; } diff --git a/test/gen_nullspace.c b/test/gen_nullspace.c index 5205b21..9002309 100644 --- a/test/gen_nullspace.c +++ b/test/gen_nullspace.c @@ -42,42 +42,42 @@ main(void) /* Create the file */ fid = H5Fcreate(NULLFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid > 0); + HDassert(fid > 0); sid = H5Screate(H5S_NULL); - assert(sid > 0); + HDassert(sid > 0); /* Create dataset */ did = H5Dcreate2(fid, NULLDATASET, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(did > 0); + HDassert(did > 0); /* Close the dataset */ ret = H5Dclose(did); - assert(ret >= 0); + HDassert(ret >= 0); /* Open the root group */ gid = H5Gopen2(fid, "/", H5P_DEFAULT); - assert(gid > 0); + HDassert(gid > 0); /* Create an attribute for the group */ attr = H5Acreate2(gid, NULLATTR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT); - assert(attr > 0); + HDassert(attr > 0); /* Close attribute */ ret = H5Aclose(attr); - assert(ret >= 0); + HDassert(ret >= 0); /* Close the group */ ret = H5Gclose(gid); - assert(ret >= 0); + HDassert(ret >= 0); /* Close the dataspace */ ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); /* Close the file */ ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); - return 0; + return EXIT_SUCCESS; } diff --git a/test/h5test.c b/test/h5test.c index 3033d97..33af30d 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -2089,13 +2089,13 @@ h5_compare_file_bytes(char *f1name, char *f2name) int ret_value = 0; /* for error handling */ /* Open files for reading */ - f1ptr = HDfopen(f1name, "r"); + f1ptr = HDfopen(f1name, "rb"); if (f1ptr == NULL) { HDfprintf(stderr, "Unable to fopen() %s\n", f1name); ret_value = -1; goto done; } - f2ptr = HDfopen(f2name, "r"); + f2ptr = HDfopen(f2name, "rb"); if (f2ptr == NULL) { HDfprintf(stderr, "Unable to fopen() %s\n", f2name); ret_value = -1; @@ -2110,7 +2110,8 @@ h5_compare_file_bytes(char *f1name, char *f2name) f2size = HDftell(f2ptr); if (f1size != f2size) { - HDfprintf(stderr, "Files differ in size, %llu vs. %llu\n", f1size, f2size); + HDfprintf(stderr, "Files differ in size, %" PRIuHSIZE " vs. %" PRIuHSIZE "\n", (hsize_t)f1size, + (hsize_t)f2size); ret_value = -1; goto done; } @@ -2119,23 +2120,27 @@ h5_compare_file_bytes(char *f1name, char *f2name) HDrewind(f1ptr); HDrewind(f2ptr); for (ii = 0; ii < f1size; ii++) { - HDfread(&f1char, 1, 1, f1ptr); - HDfread(&f2char, 1, 1, f2ptr); + if (HDfread(&f1char, 1, 1, f1ptr) != 1) { + ret_value = -1; + goto done; + } + if (HDfread(&f2char, 1, 1, f2ptr) != 1) { + ret_value = -1; + goto done; + } if (f1char != f2char) { - HDfprintf(stderr, "Mismatch @ 0x%llX: 0x%X != 0x%X\n", ii, f1char, f2char); + HDfprintf(stderr, "Mismatch @ 0x%" PRIXHSIZE ": 0x%X != 0x%X\n", (hsize_t)ii, f1char, f2char); ret_value = -1; goto done; } } done: - if (f1ptr) { + if (f1ptr) HDfclose(f1ptr); - } - if (f2ptr) { + if (f2ptr) HDfclose(f2ptr); - } - return (ret_value); + return ret_value; } /* end h5_compare_file_bytes() */ /*------------------------------------------------------------------------- @@ -2220,7 +2225,7 @@ h5_duplicate_file_by_bytes(const char *orig, const char *dest) max_buf = 4096 * sizeof(char); - orig_ptr = HDfopen(orig, "r"); + orig_ptr = HDfopen(orig, "rb"); if (NULL == orig_ptr) { ret_value = -1; goto done; @@ -2230,7 +2235,7 @@ h5_duplicate_file_by_bytes(const char *orig, const char *dest) fsize = (hsize_t)HDftell(orig_ptr); HDrewind(orig_ptr); - dest_ptr = HDfopen(dest, "w"); + dest_ptr = HDfopen(dest, "wb"); if (NULL == dest_ptr) { ret_value = -1; goto done; @@ -2244,7 +2249,10 @@ h5_duplicate_file_by_bytes(const char *orig, const char *dest) } while (read_size > 0) { - HDfread(dup_buf, read_size, 1, orig_ptr); /* warning: no error-check */ + if (HDfread(dup_buf, read_size, 1, orig_ptr) != 1) { + ret_value = -1; + goto done; + } HDfwrite(dup_buf, read_size, 1, dest_ptr); fsize -= read_size; read_size = MIN(fsize, max_buf); diff --git a/test/hyperslab.c b/test/hyperslab.c index 42cdafa..43992de 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -1117,8 +1117,8 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z) /* Check computed coordinates */ for (v = 0; v < ARRAY_OFFSET_NDIMS; v++) if (coords[v] != new_coords[v]) { - HDfprintf(stderr, "coords[%u]=%Hu, new_coords[%u]=%Hu\n", (unsigned)v, coords[v], (unsigned)v, - new_coords[v]); + HDfprintf(stderr, "coords[%zu]=%" PRIuHSIZE ", new_coords[%zu]=%" PRIuHSIZE "\n", v, + coords[v], v, new_coords[v]); TEST_ERROR; } /* end if */ } /* end for */ diff --git a/test/mf.c b/test/mf.c index 4f224af..c4a2aa1 100644 --- a/test/mf.c +++ b/test/mf.c @@ -168,22 +168,27 @@ check_stats(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *state) FAIL_STACK_ERROR if (frspace_stats.tot_space != state->tot_space) { - HDfprintf(stdout, "frspace_stats.tot_space = %Hu, state->tot_space = %Zu\n", frspace_stats.tot_space, - state->tot_space); + HDfprintf(stdout, "frspace_stats.tot_space = %" PRIuHSIZE ", state->tot_space = %" PRIuHSIZE "\n", + frspace_stats.tot_space, state->tot_space); TEST_ERROR } /* end if */ if (frspace_stats.tot_sect_count != state->tot_sect_count) { - HDfprintf(stdout, "frspace_stats.tot_sect_count = %Hu, state->tot_sect_count = %Hu\n", + HDfprintf(stdout, + "frspace_stats.tot_sect_count = %" PRIuHSIZE ", state->tot_sect_count = %" PRIuHSIZE "\n", frspace_stats.tot_sect_count, state->tot_sect_count); TEST_ERROR } /* end if */ if (frspace_stats.serial_sect_count != state->serial_sect_count) { - HDfprintf(stdout, "frspace_stats.serial_sect_count = %Hu, state->serial_sect_count = %Hu\n", + HDfprintf(stdout, + "frspace_stats.serial_sect_count = %" PRIuHSIZE ", state->serial_sect_count = %" PRIuHSIZE + "\n", frspace_stats.serial_sect_count, state->serial_sect_count); TEST_ERROR } /* end if */ if (frspace_stats.ghost_sect_count != state->ghost_sect_count) { - HDfprintf(stdout, "frspace_stats.ghost_sect_count = %Hu, state->ghost_sect_count = %Hu\n", + HDfprintf(stdout, + "frspace_stats.ghost_sect_count = %" PRIuHSIZE ", state->ghost_sect_count = %" PRIuHSIZE + "\n", frspace_stats.ghost_sect_count, state->ghost_sect_count); TEST_ERROR } /* end if */ diff --git a/test/mirror_vfd.c b/test/mirror_vfd.c index 416a338..325999b 100644 --- a/test/mirror_vfd.c +++ b/test/mirror_vfd.c @@ -2341,7 +2341,7 @@ test_vanishing_datasets(void) TEST_ERROR; } if (group_info.nlinks > 0) { - HDfprintf(stderr, "links in rw file: %d\n", group_info.nlinks); + HDfprintf(stderr, "links in rw file: %" PRIuHSIZE "\n", group_info.nlinks); HDfflush(stderr); TEST_ERROR; } @@ -2356,7 +2356,7 @@ test_vanishing_datasets(void) TEST_ERROR; } if (group_info.nlinks > 0) { - HDfprintf(stderr, "links in wo file: %d\n", group_info.nlinks); + HDfprintf(stderr, "links in wo file: %" PRIuHSIZE "\n", group_info.nlinks); HDfflush(stderr); TEST_ERROR; } diff --git a/test/ros3.c b/test/ros3.c index 856160d..7ecba0e 100644 --- a/test/ros3.c +++ b/test/ros3.c @@ -193,15 +193,21 @@ * *---------------------------------------------------------------------------- */ +static inline void +jserr_long(long expected, long actual, const char *reason) +{ + if (reason != NULL) { + HDprintf("%s\n", reason); + } + else { + HDprintf(" ! Expected %ld\n ! Actual %ld\n", expected, actual); + } +} + #define JSERR_LONG(expected, actual, reason) \ { \ JSFAILED_AT() \ - if (reason != NULL) { \ - HDprintf("%s\n", (reason)); \ - } \ - else { \ - HDprintf(" ! Expected %ld\n ! Actual %ld\n", (long)(expected), (long)(actual)); \ - } \ + jserr_long((long)(expected), (long)(actual), (reason)); \ } /*---------------------------------------------------------------------------- @@ -232,15 +238,21 @@ * *---------------------------------------------------------------------------- */ +static inline void +jserr_str(const char *expected, const char *actual, const char *reason) +{ + if (reason != NULL) { + HDprintf("%s\n", reason); + } + else { + HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", expected, actual); + } +} + #define JSERR_STR(expected, actual, reason) \ { \ JSFAILED_AT() \ - if ((reason) != NULL) { \ - HDprintf("%s\n", (reason)); \ - } \ - else { \ - HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", (expected), (actual)); \ - } \ + jserr_str((expected), (actual), (reason)); \ } #ifdef JSVERIFY_EXP_ACT diff --git a/test/s3comms.c b/test/s3comms.c index 73d59a4..862914e 100644 --- a/test/s3comms.c +++ b/test/s3comms.c @@ -181,15 +181,21 @@ * *---------------------------------------------------------------------------- */ +static inline void +jserr_long(long expected, long actual, const char *reason) +{ + if (reason != NULL) { + HDprintf("%s\n", reason); + } + else { + HDprintf(" ! Expected %ld\n ! Actual %ld\n", expected, actual); + } +} + #define JSERR_LONG(expected, actual, reason) \ { \ JSFAILED_AT() \ - if (reason != NULL) { \ - HDprintf("%s\n", (reason)); \ - } \ - else { \ - HDprintf(" ! Expected %ld\n ! Actual %ld\n", (long)(expected), (long)(actual)); \ - } \ + jserr_long((long)(expected), (long)(actual), reason); \ } /*---------------------------------------------------------------------------- @@ -220,15 +226,21 @@ * *---------------------------------------------------------------------------- */ +static inline void +jserr_str(const char *expected, const char *actual, const char *reason) +{ + if (reason != NULL) { + HDprintf("%s\n", reason); + } + else { + HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", expected, actual); + } +} + #define JSERR_STR(expected, actual, reason) \ { \ JSFAILED_AT() \ - if ((reason) != NULL) { \ - HDprintf("%s\n", (reason)); \ - } \ - else { \ - HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", (expected), (actual)); \ - } \ + jserr_str((expected), (actual), (reason)); \ } #ifdef JSVERIFY_EXP_ACT @@ -2218,7 +2230,7 @@ test_signing_key(void) NULL) JSVERIFY(0, strncmp((const char *)cases[i].exp, (const char *)key, SHA256_DIGEST_LENGTH), - cases[i].exp) + (const char *)cases[i].exp) free(key); key = NULL; diff --git a/test/swmr.c b/test/swmr.c index df52037..44f4277 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -5575,7 +5575,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) } /* Open the test file */ - H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); } + H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); } H5E_END_TRY; /* Should fail */ @@ -5900,7 +5900,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR /* Open the test file */ - if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Notify child process */ @@ -6092,7 +6092,7 @@ test_file_lock_env_var(hid_t in_fapl) /* Child process */ - hid_t child_fid; /* File ID */ + hid_t child_fid = H5I_INVALID_HID; /* File ID */ int child_notify = 0; /* Close unused write end for out_pdf */ @@ -6103,7 +6103,7 @@ test_file_lock_env_var(hid_t in_fapl) while (child_notify != 1) { if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) HDexit(EXIT_FAILURE); - } /* end while */ + } /* Open the test file */ if ((child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) @@ -7013,7 +7013,7 @@ error: } H5E_END_TRY; - return -1; + return 1; } /* test_multiple_same() */ diff --git a/test/vfd.c b/test/vfd.c index 076273b..fb20c50 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -3336,7 +3336,7 @@ main(void) nerrors += test_stdio() < 0 ? 1 : 0; nerrors += test_windows() < 0 ? 1 : 0; nerrors += test_ros3() < 0 ? 1 : 0; -/* nerrors += test_splitter() < 0 ? 1 : 0; */ + /* nerrors += test_splitter() < 0 ? 1 : 0; */ if (nerrors) { HDprintf("***** %d Virtual File Driver TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); diff --git a/testpar/t_2Gio.c b/testpar/t_2Gio.c index 4bba243..3e92f18 100644 --- a/testpar/t_2Gio.c +++ b/testpar/t_2Gio.c @@ -578,8 +578,9 @@ MpioTest2G(MPI_Comm comm) MPI_Comm_rank(comm, &mpi_rank); if (mpi_rank == 0) { - HDprintf("Using %d process on dataset shape [%llu, %llu, %llu]\n", mpi_size, shape[0], shape[1], - shape[2]); + HDprintf("Using %d process on dataset shape " + "[%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE "]\n", + mpi_size, shape[0], shape[1], shape[2]); } /* @@ -606,7 +607,7 @@ MpioTest2G(MPI_Comm comm) tot_size_bytes *= shape[i]; } if (mpi_rank == 0) { - HDprintf("Dataset of %llu bytes\n", tot_size_bytes); + HDprintf("Dataset of %zu bytes\n", tot_size_bytes); } filespace = H5Screate_simple(3, shape, NULL); VRFY((filespace >= 0), "H5Screate_simple succeeded"); @@ -681,7 +682,7 @@ MpioTest2G(MPI_Comm comm) H5Fclose(file_id); free(data); - HDprintf("Proc %d - MpioTest2G test succeeded\n", mpi_rank, data_size_bytes); + HDprintf("Proc %d - MpioTest2G test succeeded\n", mpi_rank); if (mpi_rank == 0) HDremove(FILENAME[1]); diff --git a/testpar/t_bigio.c b/testpar/t_bigio.c index 60faf68..7884ecb 100644 --- a/testpar/t_bigio.c +++ b/testpar/t_bigio.c @@ -131,12 +131,13 @@ point_set(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], s } if (VERBOSE_MED) { - HDprintf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total " - "datapoints=%lu\n", - (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], - (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], - (unsigned long)block[0], (unsigned long)block[1], - (unsigned long)(block[0] * block[1] * count[0] * count[1])); + HDprintf("start[]=(%" PRIuHSIZE ", %" PRIuHSIZE "), " + "count[]=(%" PRIuHSIZE ", %" PRIuHSIZE "), " + "stride[]=(%" PRIuHSIZE ", %" PRIuHSIZE "), " + "block[]=(%" PRIuHSIZE ", %" PRIuHSIZE "), " + "total datapoints=%" PRIuHSIZE "\n", + start[0], start[1], count[0], count[1], stride[0], stride[1], block[0], block[1], + block[0] * block[1] * count[0] * count[1]); k = 0; for (i = 0; i < num_points; i++) { HDprintf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); @@ -157,15 +158,15 @@ dataset_print(hsize_t start[], hsize_t block[], B_DATATYPE *dataset) /* print the column heading */ HDprintf("%-8s", "Cols:"); for (j = 0; j < block[1]; j++) { - HDprintf("%3lu ", (unsigned long)(start[1] + j)); + HDprintf("%3" PRIuHSIZE " ", start[1] + j); } HDprintf("\n"); /* print the slab data */ for (i = 0; i < block[0]; i++) { - HDprintf("Row %2lu: ", (unsigned long)(i + start[0])); + HDprintf("Row %2" PRIuHSIZE ": ", i + start[0]); for (j = 0; j < block[1]; j++) { - HDprintf("%llu ", *dataptr++); + HDprintf("%" PRIuHSIZE " ", *dataptr++); } HDprintf("\n"); } @@ -184,10 +185,11 @@ verify_data(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], /* print it if VERBOSE_MED */ if (VERBOSE_MED) { HDprintf("verify_data dumping:::\n"); - HDprintf("start(%lu, %lu), count(%lu, %lu), stride(%lu, %lu), block(%lu, %lu)\n", - (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], - (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], - (unsigned long)block[0], (unsigned long)block[1]); + HDprintf("start(%" PRIuHSIZE ", %" PRIuHSIZE "), " + "count(%" PRIuHSIZE ", %" PRIuHSIZE "), " + "stride(%" PRIuHSIZE ", %" PRIuHSIZE "), " + "block(%" PRIuHSIZE ", %" PRIuHSIZE ")\n", + start[0], start[1], count[0], count[1], stride[0], stride[1], block[0], block[1]); HDprintf("original values:\n"); dataset_print(start, block, original); HDprintf("compared values:\n"); @@ -199,9 +201,10 @@ verify_data(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], for (j = 0; j < block[1]; j++) { if (*dataset != *original) { if (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED) { - HDprintf("Dataset Verify failed at [%lu][%lu](row %lu, col %lu): expect %llu, got %llu\n", - (unsigned long)i, (unsigned long)j, (unsigned long)(i + start[0]), - (unsigned long)(j + start[1]), *(original), *(dataset)); + HDprintf("Dataset Verify failed at [%" PRIuHSIZE "][%" PRIuHSIZE "]" + "(row %" PRIuHSIZE ", col %" PRIuHSIZE "): " + "expect %" PRIuHSIZE ", got %" PRIuHSIZE "\n", + i, j, i + start[0], j + start[1], *(original), *(dataset)); } dataset++; original++; diff --git a/testpar/t_cache.c b/testpar/t_cache.c index bb5f22c..e0e03f2 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -1253,7 +1253,7 @@ reset_server_counters(void) success = FALSE; nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: actual/total reads mismatch (%ld/%ld).\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: actual/total reads mismatch (%ld/%d).\n", world_mpi_rank, FUNC, actual_total_reads, total_reads); } } @@ -1263,7 +1263,7 @@ reset_server_counters(void) success = FALSE; nerrors++; if (verbose) { - HDfprintf(stdout, "%d:%s: actual/total writes mismatch (%ld/%ld).\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: actual/total writes mismatch (%ld/%d).\n", world_mpi_rank, FUNC, actual_total_writes, total_writes); } } @@ -1467,7 +1467,8 @@ serve_read_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: addr lookup failed for %a.\n", world_mpi_rank, FUNC, target_addr); + HDfprintf(stdout, "%d:%s: addr lookup failed for %" PRIuHADDR ".\n", world_mpi_rank, FUNC, + target_addr); } } else if (data[target_index].len != mssg_ptr->len) { @@ -1475,7 +1476,7 @@ serve_read_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: data[i].len = %Zu != mssg->len = %d.\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: data[i].len = %zu != mssg->len = %d.\n", world_mpi_rank, FUNC, data[target_index].len, mssg_ptr->len); } } @@ -1484,7 +1485,9 @@ serve_read_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: proc %d read invalid entry. idx/base_addr = %d/%a.\n", + HDfprintf(stdout, + "%d:%s: proc %d read invalid entry. " + "idx/base_addr = %d/%" PRIuHADDR ".\n", world_mpi_rank, FUNC, mssg_ptr->src, target_index, data[target_index].base_addr); } } @@ -1653,7 +1656,8 @@ serve_write_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: addr lookup failed for %a.\n", world_mpi_rank, FUNC, target_addr); + HDfprintf(stdout, "%d:%s: addr lookup failed for %" PRIuHADDR ".\n", world_mpi_rank, FUNC, + target_addr); } } else if (data[target_index].len != mssg_ptr->len) { @@ -1661,7 +1665,7 @@ serve_write_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: data[i].len = %Zu != mssg->len = %d.\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: data[i].len = %zu != mssg->len = %d.\n", world_mpi_rank, FUNC, data[target_index].len, mssg_ptr->len); } } @@ -1790,11 +1794,11 @@ serve_total_writes_request(struct mssg_t *mssg_ptr) if (success) { - HDfprintf(stdout, "%d request total writes %ld.\n", (int)(mssg_ptr->src), total_writes); + HDfprintf(stdout, "%d request total writes %d.\n", (int)(mssg_ptr->src), total_writes); } else { - HDfprintf(stdout, "%d request total writes %ld -- FAILED.\n", (int)(mssg_ptr->src), total_writes); + HDfprintf(stdout, "%d request total writes %d -- FAILED.\n", (int)(mssg_ptr->src), total_writes); } } @@ -1860,11 +1864,11 @@ serve_total_reads_request(struct mssg_t *mssg_ptr) if (success) { - HDfprintf(stdout, "%d request total reads %ld.\n", (int)(mssg_ptr->src), total_reads); + HDfprintf(stdout, "%d request total reads %d.\n", (int)(mssg_ptr->src), total_reads); } else { - HDfprintf(stdout, "%d request total reads %ld -- FAILED.\n", (int)(mssg_ptr->src), total_reads); + HDfprintf(stdout, "%d request total reads %d -- FAILED.\n", (int)(mssg_ptr->src), total_reads); } } @@ -1919,7 +1923,8 @@ serve_entry_writes_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: addr lookup failed for %a.\n", world_mpi_rank, FUNC, target_addr); + HDfprintf(stdout, "%d:%s: addr lookup failed for %" PRIuHADDR ".\n", world_mpi_rank, FUNC, + target_addr); } } else { @@ -2007,7 +2012,8 @@ serve_entry_reads_request(struct mssg_t *mssg_ptr) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: addr lookup failed for %a.\n", world_mpi_rank, FUNC, target_addr); + HDfprintf(stdout, "%d:%s: addr lookup failed for %" PRIuHADDR ".\n", world_mpi_rank, FUNC, + target_addr); } } else { @@ -2488,10 +2494,10 @@ datum_notify(H5C_notify_action_t action, void *thing) HDfprintf(stdout, "%d:%s: mssg.base_addr != entry_ptr->base_addr.\n", world_mpi_rank, FUNC); - HDfprintf(stdout, "%d:%s: mssg.base_addr = %a.\n", + HDfprintf(stdout, "%d:%s: mssg.base_addr = %" PRIuHADDR ".\n", world_mpi_rank, FUNC, mssg.base_addr); HDfprintf(stdout, - "%d:%s: entry_ptr->base_addr = %a.\n", + "%d:%s: entry_ptr->base_addr = %" PRIuHADDR ".\n", world_mpi_rank, FUNC, entry_ptr->base_addr); } @@ -2501,7 +2507,7 @@ datum_notify(H5C_notify_action_t action, void *thing) HDfprintf(stdout, "%d:%s: mssg.len != entry_ptr->len.\n", world_mpi_rank, FUNC); - HDfprintf(stdout, "%d:%s: mssg.len = %a.\n", + HDfprintf(stdout, "%d:%s: mssg.len = %" PRIuHADDR ".\n", world_mpi_rank, FUNC, mssg.len); } @@ -4296,8 +4302,8 @@ verify_entry_reads(haddr_t addr, int expected_entry_reads) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: rep/exp entry 0x%llx reads mismatch (%ld/%ld).\n", world_mpi_rank, - FUNC, (long long)addr, reported_entry_reads, expected_entry_reads); + HDfprintf(stdout, "%d:%s: rep/exp entry 0x%" PRIxHADDR " reads mismatch (%d/%d).\n", + world_mpi_rank, FUNC, addr, reported_entry_reads, expected_entry_reads); } } } @@ -4393,7 +4399,7 @@ verify_entry_writes(haddr_t addr, int expected_entry_writes) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: rep/exp entry 0x%llx writes mismatch (%ld/%ld).\n", world_mpi_rank, + HDfprintf(stdout, "%d:%s: rep/exp entry 0x%llx writes mismatch (%d/%d).\n", world_mpi_rank, FUNC, (long long)addr, reported_entry_writes, expected_entry_writes); } } @@ -4485,8 +4491,8 @@ verify_total_reads(int expected_total_reads) nerrors++; success = FALSE; if (verbose) { - HDfprintf(stdout, "%d:%s: reported/expected total reads mismatch (%ld/%ld).\n", - world_mpi_rank, FUNC, reported_total_reads, expected_total_reads); + HDfprintf(stdout, "%d:%s: reported/expected total reads mismatch (%ld/%d).\n", world_mpi_rank, + FUNC, reported_total_reads, expected_total_reads); } } } @@ -6513,15 +6519,15 @@ trace_file_check(int metadata_write_strategy) HDfprintf(stdout, "%d:%s: Unexpected data in trace file line %d.\n", world_mpi_rank, FUNC, i); if (expected_line_len == 0) { - HDfprintf(stdout, "%d:%s: expected = \"%s\" %d\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: expected = \"%s\" %zu\n", world_mpi_rank, FUNC, "", expected_line_len); - HDfprintf(stdout, "%d:%s: actual = \"%s\" %d\n", world_mpi_rank, FUNC, buffer, + HDfprintf(stdout, "%d:%s: actual = \"%s\" %zu\n", world_mpi_rank, FUNC, buffer, actual_line_len); } if (actual_line_len == 0) { - HDfprintf(stdout, "%d:%s: expected = \"%s\" %d\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: expected = \"%s\" %zu\n", world_mpi_rank, FUNC, (*expected_output)[i], expected_line_len); - HDfprintf(stdout, "%d:%s: actual = \"%s\" %d\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: actual = \"%s\" %zu\n", world_mpi_rank, FUNC, "", actual_line_len); } } @@ -6537,9 +6543,9 @@ trace_file_check(int metadata_write_strategy) if (verbose) { HDfprintf(stdout, "%d:%s: Unexpected data in trace file line %d.\n", world_mpi_rank, FUNC, i); - HDfprintf(stdout, "%d:%s: expected = \"%s\" %d\n", world_mpi_rank, FUNC, + HDfprintf(stdout, "%d:%s: expected = \"%s\" %zu\n", world_mpi_rank, FUNC, (*expected_output)[i], expected_line_len); - HDfprintf(stdout, "%d:%s: actual = \"%s\" %d\n", world_mpi_rank, FUNC, buffer, + HDfprintf(stdout, "%d:%s: actual = \"%s\" %zu\n", world_mpi_rank, FUNC, buffer, actual_line_len); } } diff --git a/testpar/t_cache_image.c b/testpar/t_cache_image.c index 39cfbf3..776da2e 100644 --- a/testpar/t_cache_image.c +++ b/testpar/t_cache_image.c @@ -3117,8 +3117,9 @@ verify_cache_image_RO(int file_name_id, int md_write_strat, int mpi_rank) H5_FAILED(); - if (show_progress) - HDfprintf(stdout, "%s: failure_mssg = \"%s\"\n", failure_mssg); + if (show_progress) { + HDfprintf(stdout, "%s: failure_mssg = \"%s\"\n", fcn_name, failure_mssg); + } } } @@ -3401,8 +3402,9 @@ verify_cache_image_RW(int file_name_id, int md_write_strat, int mpi_rank) H5_FAILED(); - if (show_progress) - HDfprintf(stdout, "%s: failure_mssg = \"%s\"\n", failure_mssg); + if (show_progress) { + HDfprintf(stdout, "%s: failure_mssg = \"%s\"\n", fcn_name, failure_mssg); + } } } diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c index 37479b3..5153bce 100644 --- a/testpar/t_filters_parallel.c +++ b/testpar/t_filters_parallel.c @@ -255,8 +255,9 @@ test_write_one_chunk_filtered_dataset(void) start[1] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -418,8 +419,9 @@ test_write_filtered_dataset_no_overlap(void) start[1] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -578,8 +580,9 @@ test_write_filtered_dataset_overlap(void) start[1] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -746,8 +749,9 @@ test_write_filtered_dataset_single_no_selection(void) start[1] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -1202,8 +1206,9 @@ test_write_filtered_dataset_interleaved_write(void) start[1] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -1379,8 +1384,10 @@ test_write_3d_filtered_dataset_no_overlap_separate_pages(void) start[2] = (hsize_t)mpi_rank; if (VERBOSE_MED) { - HDprintf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], start[ " - "%llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE + " ], stride[ %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE + ", %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE + " ]\n", mpi_rank, count[0], count[1], count[2], stride[0], stride[1], stride[2], start[0], start[1], start[2], block[0], block[1], block[2]); HDfflush(stdout); @@ -1547,8 +1554,10 @@ test_write_3d_filtered_dataset_no_overlap_same_pages(void) start[2] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], start[ " - "%llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE + " ], stride[ %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE + ", %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE + " ]\n", mpi_rank, count[0], count[1], count[2], stride[0], stride[1], stride[2], start[0], start[1], start[2], block[0], block[1], block[2]); HDfflush(stdout); @@ -1714,8 +1723,10 @@ test_write_3d_filtered_dataset_overlap(void) start[2] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], start[ " - "%llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE + " ], stride[ %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE + ", %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE + " ]\n", mpi_rank, count[0], count[1], count[2], stride[0], stride[1], stride[2], start[0], start[1], start[2], block[0], block[1], block[2]); HDfflush(stdout); @@ -1900,8 +1911,9 @@ test_write_cmpd_filtered_dataset_no_conversion_unshared(void) start[1] = ((hsize_t)mpi_rank * WRITE_COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_UNSHARED_CH_NCOLS); if (VERBOSE_MED) { - HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -2080,8 +2092,9 @@ test_write_cmpd_filtered_dataset_no_conversion_shared(void) start[1] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -2279,8 +2292,9 @@ test_write_cmpd_filtered_dataset_type_conversion_unshared(void) start[1] = ((hsize_t)mpi_rank * WRITE_COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_UNSHARED_CH_NCOLS); if (VERBOSE_MED) { - HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -2471,8 +2485,9 @@ test_write_cmpd_filtered_dataset_type_conversion_shared(void) start[1] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -2687,8 +2702,9 @@ test_read_one_chunk_filtered_dataset(void) start[1] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -2890,8 +2906,9 @@ test_read_filtered_dataset_no_overlap(void) start[1] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -3094,8 +3111,9 @@ test_read_filtered_dataset_overlap(void) start[1] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -3324,8 +3342,9 @@ test_read_filtered_dataset_single_no_selection(void) start[1] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -3906,8 +3925,9 @@ test_read_filtered_dataset_interleaved_read(void) start[1] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -4135,8 +4155,9 @@ test_read_3d_filtered_dataset_no_overlap_separate_pages(void) start[2] = (hsize_t)mpi_rank; if (VERBOSE_MED) { - HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -4351,8 +4372,9 @@ test_read_3d_filtered_dataset_no_overlap_same_pages(void) start[2] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -4574,8 +4596,9 @@ test_read_3d_filtered_dataset_overlap(void) start[2] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -4807,8 +4830,9 @@ test_read_cmpd_filtered_dataset_no_conversion_unshared(void) start[1] = ((hsize_t)mpi_rank * READ_COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_UNSHARED_CH_NCOLS); if (VERBOSE_MED) { - HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -5035,8 +5059,9 @@ test_read_cmpd_filtered_dataset_no_conversion_shared(void) start[1] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -5265,8 +5290,9 @@ test_read_cmpd_filtered_dataset_type_conversion_unshared(void) start[1] = ((hsize_t)mpi_rank * READ_COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_UNSHARED_CH_NCOLS); if (VERBOSE_MED) { - HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -5502,8 +5528,9 @@ test_read_cmpd_filtered_dataset_type_conversion_shared(void) start[1] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is reading with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } @@ -5803,8 +5830,10 @@ test_write_parallel_read_serial(void) offset[2] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], offset[ " - "%llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE + " ], stride[ %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE " ], offset[ %" PRIuHSIZE + ", %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE + " ]\n", mpi_rank, count[0], count[1], count[2], stride[0], stride[1], stride[2], offset[0], offset[1], offset[2], block[0], block[1], block[2]); HDfflush(stdout); @@ -5973,8 +6002,9 @@ test_shrinking_growing_chunks(void) start[1] = 0; if (VERBOSE_MED) { - HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], " - "block size[ %llu, %llu ]\n", + HDprintf("Process %d is writing with count[ %" PRIuHSIZE ", %" PRIuHSIZE " ], stride[ %" PRIuHSIZE + ", %" PRIuHSIZE " ], start[ %" PRIuHSIZE ", %" PRIuHSIZE " ], block size[ %" PRIuHSIZE + ", %" PRIuHSIZE " ]\n", mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]); HDfflush(stdout); } diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index 9ef3178..1c5e875 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -2000,8 +2000,8 @@ contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type) } if ((MAINPROCESS) && (tests_skipped > 0)) { - HDfprintf(stdout, " %lld of %lld subtests skipped to expedite testing.\n", tests_skipped, - total_tests); + HDfprintf(stdout, " %" PRId64 " of %" PRId64 " subtests skipped to expedite testing.\n", + tests_skipped, total_tests); } return; @@ -3913,16 +3913,16 @@ ckrbrd_hs_dr_pio_test(ShapeSameTestMethods sstest_type) } /* end of switch(sstest_type) */ #if CONTIG_HS_DR_PIO_TEST__DEBUG if ((MAINPROCESS) && (tests_skipped > 0)) { - HDfprintf(stdout, " run/skipped/total = %lld/%lld/%lld.\n", tests_run, tests_skipped, - total_tests); + HDfprintf(stdout, " run/skipped/total = %" PRId64 "/%" PRId64 "/%" PRId64 ".\n", + tests_run, tests_skipped, total_tests); } #endif /* CONTIG_HS_DR_PIO_TEST__DEBUG */ } } if ((MAINPROCESS) && (tests_skipped > 0)) { - HDfprintf(stdout, " %lld of %lld subtests skipped to expedite testing.\n", tests_skipped, - total_tests); + HDfprintf(stdout, " %" PRId64 " of %" PRId64 " subtests skipped to expedite testing.\n", + tests_skipped, total_tests); } return; diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index ade7dcd..0c20447 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -322,9 +322,9 @@ void print_found(hsize_t nfound) { if (g_Parallel) - parallel_print("%" H5_PRINTF_LL_WIDTH "u differences found\n", (unsigned long long)nfound); + parallel_print("%" PRIuHSIZE " differences found\n", nfound); else - HDfprintf(stdout, "%Hu differences found\n", nfound); + HDfprintf(stdout, "%" PRIuHSIZE " differences found\n", nfound); } /*----------------------------------------------------------------- diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 34b70ac..56ffd27 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -81,8 +81,8 @@ h5tool_format_t h5tools_dataformat = { 1, /*skip_first */ - 1, /*obj_hidefileno */ - " " H5_PRINTF_HADDR_FMT, /*obj_format */ + 1, /*obj_hidefileno */ + " %" PRIuHADDR, /*obj_format */ 1, /*dset_hidefileno */ "DATASET %s ", /*dset_format */ @@ -3331,7 +3331,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t * if (HADDR_UNDEF == ioffset) h5tools_str_append(&buffer, "OFFSET HADDR_UNDEF"); else - h5tools_str_append(&buffer, "OFFSET " H5_PRINTF_HADDR_FMT, ioffset); + h5tools_str_append(&buffer, "OFFSET %" PRIuHADDR, ioffset); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c index 94dc1fd..8c637b1 100644 --- a/tools/src/h5dump/h5dump_ddl.c +++ b/tools/src/h5dump/h5dump_ddl.c @@ -1252,9 +1252,9 @@ dump_fcpl(hid_t fid) indentation(dump_indent + COL); PRINTSTREAM(rawoutstream, "%s %s\n", "FREE_SPACE_PERSIST", fs_persist ? "TRUE" : "FALSE"); indentation(dump_indent + COL); - PRINTSTREAM(rawoutstream, "%s %Hu\n", "FREE_SPACE_SECTION_THRESHOLD", fs_threshold); + PRINTSTREAM(rawoutstream, "%s %" PRIuHSIZE "\n", "FREE_SPACE_SECTION_THRESHOLD", fs_threshold); indentation(dump_indent + COL); - PRINTSTREAM(rawoutstream, "%s %Hu\n", "FILE_SPACE_PAGE_SIZE", fsp_size); + PRINTSTREAM(rawoutstream, "%s %" PRIuHSIZE "\n", "FILE_SPACE_PAGE_SIZE", fsp_size); /*------------------------------------------------------------------------- * USER_BLOCK @@ -1263,7 +1263,7 @@ dump_fcpl(hid_t fid) indentation(dump_indent + COL); PRINTSTREAM(rawoutstream, "USER_BLOCK %s\n", BEGIN); indentation(dump_indent + COL + COL); - PRINTSTREAM(rawoutstream, "%s %Hu\n", "USERBLOCK_SIZE", userblock); + PRINTSTREAM(rawoutstream, "%s %" PRIuHSIZE "\n", "USERBLOCK_SIZE", userblock); indentation(dump_indent + COL); PRINTSTREAM(rawoutstream, "%s\n", END); diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index e4bbb9b..0457d32 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -93,8 +93,8 @@ static h5tool_format_t xml_dataformat = { 1, /*skip_first */ - 1, /*obj_hidefileno */ - " " H5_PRINTF_HADDR_FMT, /*obj_format */ + 1, /*obj_hidefileno */ + " %" PRIuHADDR, /*obj_format */ 1, /*dset_hidefileno */ "DATASET %s ", /*dset_format */ diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 14de44b..7a7887f 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -946,7 +946,7 @@ readFloatData(FILE *strm, struct Input *in) * * Return: 0, ok, -1 no * - * Programmer: Pedro Vicente, pvn@hdfgroup.org + * Programmer: Pedro Vicente * * Date: July, 26, 2007 * diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 68a8647..9ebd4d5 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -95,8 +95,8 @@ static h5tool_format_t ls_dataformat = { 0, /*skip_first */ - 0, /*obj_hidefileno */ - "-%lu:" H5_PRINTF_HADDR_FMT, /*obj_format */ + 0, /*obj_hidefileno */ + "-%lu:%" PRIuHADDR, /*obj_format */ 0, /*dset_hidefileno */ "DSET-%s ", /*dset_format */ @@ -965,7 +965,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" *strangely, unless use another pointer "copy".*/ copy = value + i * dst_size; - h5tools_str_append(buffer, "%" H5_PRINTF_LL_WIDTH "d", *((long long *)((void *)copy))); + h5tools_str_append(buffer, "%lld", *((long long *)((void *)copy))); } } @@ -1908,10 +1908,9 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) print_string(&buffer, f_name, TRUE); } else { - h5tools_str_append(&buffer, - " #%03d %10" H5_PRINTF_LL_WIDTH - "u %10" H5_PRINTF_LL_WIDTH "u %10" H5_PRINTF_LL_WIDTH "u ", - i, total, (hsize_t)f_offset, f_size); + h5tools_str_append( + &buffer, " #%03d %10" PRIuHSIZE " %10" PRIuHSIZE " %10" PRIuHSIZE " ", + i, total, (hsize_t)f_offset, f_size); print_string(&buffer, f_name, TRUE); } h5tools_str_append(&buffer, "\n"); diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index 395b66b..a1764df 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -718,7 +718,7 @@ check_options(pack_opt_t *options) } if (options->ublock_filename == NULL && options->ublock_size != 0) - H5TOOLS_GOTO_ERROR((-1), "file name missing for user block", options->ublock_filename); + H5TOOLS_GOTO_ERROR((-1), "file name missing for user block"); /*------------------------------------------------------------------------ * Verify alignment options; threshold is zero default but alignment not diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index f834706..12a408e 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -1196,7 +1196,7 @@ print_file_info(const iter_t *iter) HDprintf("\t# of unique links: %lu\n", iter->uniq_links); HDprintf("\t# of unique other: %lu\n", iter->uniq_others); HDprintf("\tMax. # of links to object: %lu\n", iter->max_links); - HDfprintf(stdout, "\tMax. # of objects in group: %Hu\n", iter->max_fanout); + HDfprintf(stdout, "\tMax. # of objects in group: %" PRIuHSIZE "\n", iter->max_fanout); return 0; } /* print_file_info() */ @@ -1219,40 +1219,40 @@ static herr_t print_file_metadata(const iter_t *iter) { HDfprintf(stdout, "File space information for file metadata (in bytes):\n"); - HDfprintf(stdout, "\tSuperblock: %Hu\n", iter->super_size); - HDfprintf(stdout, "\tSuperblock extension: %Hu\n", iter->super_ext_size); - HDfprintf(stdout, "\tUser block: %Hu\n", iter->ublk_size); + HDfprintf(stdout, "\tSuperblock: %" PRIuHSIZE "\n", iter->super_size); + HDfprintf(stdout, "\tSuperblock extension: %" PRIuHSIZE "\n", iter->super_ext_size); + HDfprintf(stdout, "\tUser block: %" PRIuHSIZE "\n", iter->ublk_size); HDfprintf(stdout, "\tObject headers: (total/unused)\n"); - HDfprintf(stdout, "\t\tGroups: %Hu/%Hu\n", iter->group_ohdr_info.total_size, + HDfprintf(stdout, "\t\tGroups: %" PRIuHSIZE "/%" PRIuHSIZE "\n", iter->group_ohdr_info.total_size, iter->group_ohdr_info.free_size); - HDfprintf(stdout, "\t\tDatasets(exclude compact data): %Hu/%Hu\n", iter->dset_ohdr_info.total_size, - iter->dset_ohdr_info.free_size); - HDfprintf(stdout, "\t\tDatatypes: %Hu/%Hu\n", iter->dtype_ohdr_info.total_size, + HDfprintf(stdout, "\t\tDatasets(exclude compact data): %" PRIuHSIZE "/%" PRIuHSIZE "\n", + iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size); + HDfprintf(stdout, "\t\tDatatypes: %" PRIuHSIZE "/%" PRIuHSIZE "\n", iter->dtype_ohdr_info.total_size, iter->dtype_ohdr_info.free_size); HDfprintf(stdout, "\tGroups:\n"); - HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->groups_btree_storage_size); - HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->groups_heap_storage_size); + HDfprintf(stdout, "\t\tB-tree/List: %" PRIuHSIZE "\n", iter->groups_btree_storage_size); + HDfprintf(stdout, "\t\tHeap: %" PRIuHSIZE "\n", iter->groups_heap_storage_size); HDfprintf(stdout, "\tAttributes:\n"); - HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->attrs_btree_storage_size); - HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->attrs_heap_storage_size); + HDfprintf(stdout, "\t\tB-tree/List: %" PRIuHSIZE "\n", iter->attrs_btree_storage_size); + HDfprintf(stdout, "\t\tHeap: %" PRIuHSIZE "\n", iter->attrs_heap_storage_size); HDfprintf(stdout, "\tChunked datasets:\n"); - HDfprintf(stdout, "\t\tIndex: %Hu\n", iter->datasets_index_storage_size); + HDfprintf(stdout, "\t\tIndex: %" PRIuHSIZE "\n", iter->datasets_index_storage_size); HDfprintf(stdout, "\tDatasets:\n"); - HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->datasets_heap_storage_size); + HDfprintf(stdout, "\t\tHeap: %" PRIuHSIZE "\n", iter->datasets_heap_storage_size); HDfprintf(stdout, "\tShared Messages:\n"); - HDfprintf(stdout, "\t\tHeader: %Hu\n", iter->SM_hdr_storage_size); - HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->SM_index_storage_size); - HDfprintf(stdout, "\t\tHeap: %Hu\n", iter->SM_heap_storage_size); + HDfprintf(stdout, "\t\tHeader: %" PRIuHSIZE "\n", iter->SM_hdr_storage_size); + HDfprintf(stdout, "\t\tB-tree/List: %" PRIuHSIZE "\n", iter->SM_index_storage_size); + HDfprintf(stdout, "\t\tHeap: %" PRIuHSIZE "\n", iter->SM_heap_storage_size); HDfprintf(stdout, "\tFree-space managers:\n"); - HDfprintf(stdout, "\t\tHeader: %Hu\n", iter->free_hdr); - HDfprintf(stdout, "\t\tAmount of free space: %Hu\n", iter->free_space); + HDfprintf(stdout, "\t\tHeader: %" PRIuHSIZE "\n", iter->free_hdr); + HDfprintf(stdout, "\t\tAmount of free space: %" PRIuHSIZE "\n", iter->free_space); return 0; } /* print_file_metadata() */ @@ -1330,11 +1330,11 @@ print_group_metadata(const iter_t *iter) { HDprintf("File space information for groups' metadata (in bytes):\n"); - HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n", iter->group_ohdr_info.total_size, - iter->group_ohdr_info.free_size); + HDfprintf(stdout, "\tObject headers (total/unused): %" PRIuHSIZE "/%" PRIuHSIZE "\n", + iter->group_ohdr_info.total_size, iter->group_ohdr_info.free_size); - HDfprintf(stdout, "\tB-tree/List: %Hu\n", iter->groups_btree_storage_size); - HDfprintf(stdout, "\tHeap: %Hu\n", iter->groups_heap_storage_size); + HDfprintf(stdout, "\tB-tree/List: %" PRIuHSIZE "\n", iter->groups_btree_storage_size); + HDfprintf(stdout, "\tHeap: %" PRIuHSIZE "\n", iter->groups_heap_storage_size); return 0; } /* print_group_metadata() */ @@ -1368,7 +1368,7 @@ print_dataset_info(const iter_t *iter) HDprintf("\t\t# of dataset with rank %u: %lu\n", u, iter->dset_rank_count[u]); HDprintf("1-D Dataset information:\n"); - HDfprintf(stdout, "\tMax. dimension size of 1-D datasets: %Hu\n", iter->max_dset_dims); + HDfprintf(stdout, "\tMax. dimension size of 1-D datasets: %" PRIuHSIZE "\n", iter->max_dset_dims); HDprintf("\tSmall 1-D datasets (with dimension sizes 0 to %u):\n", sdsets_threshold - 1); total = 0; for (u = 0; u < (unsigned)sdsets_threshold; u++) { @@ -1400,8 +1400,9 @@ print_dataset_info(const iter_t *iter) } /* end if */ HDprintf("Dataset storage information:\n"); - HDfprintf(stdout, "\tTotal raw data size: %Hu\n", iter->dset_storage_size); - HDfprintf(stdout, "\tTotal external raw data size: %Hu\n", iter->dset_external_storage_size); + HDfprintf(stdout, "\tTotal raw data size: %" PRIuHSIZE "\n", iter->dset_storage_size); + HDfprintf(stdout, "\tTotal external raw data size: %" PRIuHSIZE "\n", + iter->dset_external_storage_size); HDprintf("Dataset layout information:\n"); for (u = 0; u < H5D_NLAYOUTS; u++) @@ -1445,11 +1446,11 @@ print_dset_metadata(const iter_t *iter) { HDprintf("File space information for datasets' metadata (in bytes):\n"); - HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n", iter->dset_ohdr_info.total_size, - iter->dset_ohdr_info.free_size); + HDfprintf(stdout, "\tObject headers (total/unused): %" PRIuHSIZE "/%" PRIuHSIZE "\n", + iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size); - HDfprintf(stdout, "\tIndex for Chunked datasets: %Hu\n", iter->datasets_index_storage_size); - HDfprintf(stdout, "\tHeap: %Hu\n", iter->datasets_heap_storage_size); + HDfprintf(stdout, "\tIndex for Chunked datasets: %" PRIuHSIZE "\n", iter->datasets_index_storage_size); + HDfprintf(stdout, "\tHeap: %" PRIuHSIZE "\n", iter->datasets_heap_storage_size); return 0; } /* print_dset_metadata() */ @@ -1563,7 +1564,7 @@ print_freespace_info(const iter_t *iter) unsigned u; /* Local index variable */ HDfprintf(stdout, "Free-space persist: %s\n", iter->fs_persist ? "TRUE" : "FALSE"); - HDfprintf(stdout, "Free-space section threshold: %Hu bytes\n", iter->fs_threshold); + HDfprintf(stdout, "Free-space section threshold: %" PRIuHSIZE " bytes\n", iter->fs_threshold); HDprintf("Small size free-space sections (< %u bytes):\n", (unsigned)SIZE_SMALL_SECTS); total = 0; for (u = 0; u < SIZE_SMALL_SECTS; u++) { @@ -1611,7 +1612,7 @@ print_storage_summary(const iter_t *iter) double percent = 0.0f; HDfprintf(stdout, "File space management strategy: %s\n", FS_STRATEGY_NAME[iter->fs_strategy]); - HDfprintf(stdout, "File space page size: %Hu bytes\n", iter->fsp_size); + HDfprintf(stdout, "File space page size: %" PRIuHSIZE " bytes\n", iter->fsp_size); HDprintf("Summary of file space information:\n"); total_meta = iter->super_size + iter->super_ext_size + iter->ublk_size + iter->group_ohdr_info.total_size + @@ -1620,27 +1621,28 @@ print_storage_summary(const iter_t *iter) iter->datasets_index_storage_size + iter->datasets_heap_storage_size + iter->SM_hdr_storage_size + iter->SM_index_storage_size + iter->SM_heap_storage_size + iter->free_hdr; - HDfprintf(stdout, " File metadata: %Hu bytes\n", total_meta); - HDfprintf(stdout, " Raw data: %Hu bytes\n", iter->dset_storage_size); + HDfprintf(stdout, " File metadata: %" PRIuHSIZE " bytes\n", total_meta); + HDfprintf(stdout, " Raw data: %" PRIuHSIZE " bytes\n", iter->dset_storage_size); percent = ((double)iter->free_space / (double)iter->filesize) * (double)100.0f; - HDfprintf(stdout, " Amount/Percent of tracked free space: %Hu bytes/%3.1f%\n", iter->free_space, - percent); + HDfprintf(stdout, " Amount/Percent of tracked free space: %" PRIuHSIZE " bytes/%3.1f%%\n", + iter->free_space, percent); if (iter->filesize < (total_meta + iter->dset_storage_size + iter->free_space)) { unaccount = (total_meta + iter->dset_storage_size + iter->free_space) - iter->filesize; - HDfprintf(stdout, " ??? File has %Hu more bytes accounted for than its size! ???\n", unaccount); + HDfprintf(stdout, " ??? File has %" PRIuHSIZE " more bytes accounted for than its size! ???\n", + unaccount); } else { unaccount = iter->filesize - (total_meta + iter->dset_storage_size + iter->free_space); - HDfprintf(stdout, " Unaccounted space: %Hu bytes\n", unaccount); + HDfprintf(stdout, " Unaccounted space: %" PRIuHSIZE " bytes\n", unaccount); } - HDfprintf(stdout, "Total space: %Hu bytes\n", + HDfprintf(stdout, "Total space: %" PRIuHSIZE " bytes\n", total_meta + iter->dset_storage_size + iter->free_space + unaccount); if (iter->nexternal) - HDfprintf(stdout, "External raw data: %Hu bytes\n", iter->dset_external_storage_size); + HDfprintf(stdout, "External raw data: %" PRIuHSIZE " bytes\n", iter->dset_external_storage_size); return 0; } /* print_storage_summary() */ diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c index 0ef9483..a931833 100644 --- a/tools/src/misc/h5clear.c +++ b/tools/src/misc/h5clear.c @@ -358,7 +358,7 @@ main(int argc, const char *argv[]) h5tools_setstatus(EXIT_FAILURE); goto done; } - HDfprintf(stdout, "EOA is %a; EOF is %a \n", eoa, st.st_size); + HDfprintf(stdout, "EOA is %" PRIuHADDR "; EOF is %" PRIuHADDR " \n", eoa, (haddr_t)st.st_size); } /* --increment option */ diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c index 268498f..85abb8a 100644 --- a/tools/src/misc/h5debug.c +++ b/tools/src/misc/h5debug.c @@ -347,7 +347,7 @@ main(int argc, char *argv[]) /* * Read the signature at the specified file position. */ - HDfprintf(stdout, "Reading signature at address %a (rel)\n", addr); + HDfprintf(stdout, "Reading signature at address %" PRIuHADDR " (rel)\n", addr); if (H5F_block_read(f, H5FD_MEM_SUPER, addr, sizeof(sig), sig) < 0) { HDfprintf(stderr, "cannot read signature\n"); exit_value = 3; diff --git a/tools/test/perform/chunk.c b/tools/test/perform/chunk.c index 90ae815..9f99ce9 100644 --- a/tools/test/perform/chunk.c +++ b/tools/test/perform/chunk.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, May 14, 1998 * * Purpose: Checks the effect of various I/O request sizes and raw data diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index 9a6d5fa..3a6a209 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -259,11 +259,11 @@ check_partial_chunks_perf(hid_t file) end_t = H5_get_time(); if ((end_t - start_t) > (double)0.0f) - printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %lu\n", + printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %zu\n", (end_t - start_t), nbytes_global); else printf("1. Partial chunks: no total read time because timer is not available; number of bytes being " - "read from file is %lu\n", + "read from file is %zu\n", nbytes_global); H5Dclose(dataset); @@ -337,11 +337,11 @@ check_hash_value_perf(hid_t file) end_t = H5_get_time(); if ((end_t - start_t) > (double)0.0f) - printf("2. Hash value: total read time is %lf; number of bytes being read from file is %lu\n", + printf("2. Hash value: total read time is %lf; number of bytes being read from file is %zu\n", (end_t - start_t), nbytes_global); else printf("2. Hash value: no total read time because timer is not available; number of bytes being read " - "from file is %lu\n", + "from file is %zu\n", nbytes_global); H5Dclose(dataset); diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c index 6d467e1..22aca04 100644 --- a/tools/test/perform/perf.c +++ b/tools/test/perform/perf.c @@ -313,7 +313,7 @@ main(int argc, char **argv) VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL); if (ret < 0) - HDfprintf(stderr, "node %d, read error, loc = %Ld: %s\n", mynod, mynod * opt_block, + HDfprintf(stderr, "node %d, read error, loc = %" PRId64 ": %s\n", mynod, mynod * opt_block, strerror(myerrno)); /* if the user wanted to check correctness, compare the write @@ -427,7 +427,8 @@ parse_args(int argc, char **argv) if (NULL != (p = (char *)HDstrchr(optarg, '/'))) opt_threshold = (hsize_t)HDatoi(p + 1); } - HDfprintf(stdout, "alignment/threshold=%Hu/%Hu\n", opt_alignment, opt_threshold); + HDfprintf(stdout, "alignment/threshold=%" PRIuHSIZE "/%" PRIuHSIZE "\n", opt_alignment, + opt_threshold); break; case '2': /* use 2-files, i.e., split file driver */ opt_split_vfd = 1; diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h index 0e0ac26..d64f421 100644 --- a/tools/test/perform/pio_standalone.h +++ b/tools/test/perform/pio_standalone.h @@ -130,12 +130,12 @@ #else /* H5_HAVE_WIN32_API */ #define HDfileno(F) fileno(F) #endif /* H5_HAVE_WIN32_API */ -#define HDfloor(X) floor(X) -#define HDfmod(X, Y) fmod(X, Y) -#define HDfopen(S, M) fopen(S, M) -#define HDfork() fork() -#define HDfpathconf(F, N) fpathconf(F, N) -H5_DLL int HDfprintf(FILE *stream, const char *fmt, ...); +#define HDfloor(X) floor(X) +#define HDfmod(X, Y) fmod(X, Y) +#define HDfopen(S, M) fopen(S, M) +#define HDfork() fork() +#define HDfpathconf(F, N) fpathconf(F, N) +#define HDfprintf fprintf #define HDfputc(C, F) fputc(C, F) #define HDfputs(S, F) fputs(S, F) #define HDfread(M, Z, N, F) fread(M, Z, N, F) diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c index 79577b3..11001c6 100644 --- a/tools/test/perform/sio_engine.c +++ b/tools/test/perform/sio_engine.c @@ -783,7 +783,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) /* Allocate data verification buffer */ if (NULL == (buffer2 = (char *)malloc(linear_buf_size))) { - HDfprintf(stderr, "malloc for data verification buffer size (%Zu) failed\n", linear_buf_size); + HDfprintf(stderr, "malloc for data verification buffer size (%zu) failed\n", linear_buf_size); GOTOERROR(FAIL); } /* end if */ diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c index d2425fd..fb31080 100644 --- a/tools/test/perform/sio_perf.c +++ b/tools/test/perform/sio_perf.c @@ -872,9 +872,9 @@ report_parameters(struct options *opts) HDfprintf(output, "\n"); if (opts->page_size) { - HDfprintf(output, "Page Aggregation Enabled. Page size = %ld\n", opts->page_size); + HDfprintf(output, "Page Aggregation Enabled. Page size = %zu\n", opts->page_size); if (opts->page_buffer_size) - HDfprintf(output, "Page Buffering Enabled. Page Buffer size = %ld\n", opts->page_buffer_size); + HDfprintf(output, "Page Buffering Enabled. Page Buffer size = %zu\n", opts->page_buffer_size); else HDfprintf(output, "Page Buffering Disabled\n"); } diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h index 02ec6c6..4001257 100644 --- a/tools/test/perform/sio_standalone.h +++ b/tools/test/perform/sio_standalone.h @@ -145,12 +145,12 @@ #else /* H5_HAVE_WIN32_API */ #define HDfileno(F) fileno(F) #endif /* H5_HAVE_WIN32_API */ -#define HDfloor(X) floor(X) -#define HDfmod(X, Y) fmod(X, Y) -#define HDfopen(S, M) fopen(S, M) -#define HDfork() fork() -#define HDfpathconf(F, N) fpathconf(F, N) -H5_DLL int HDfprintf(FILE *stream, const char *fmt, ...); +#define HDfloor(X) floor(X) +#define HDfmod(X, Y) fmod(X, Y) +#define HDfopen(S, M) fopen(S, M) +#define HDfork() fork() +#define HDfpathconf(F, N) fpathconf(F, N) +#define HDfprintf fprintf #define HDfputc(C, F) fputc(C, F) #define HDfputs(S, F) fputs(S, F) #define HDfread(M, Z, N, F) fread(M, Z, N, F) -- cgit v0.12 From d62e0753021df5510b97b38aa632ba570ca84275 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 8 Oct 2020 10:54:04 -0500 Subject: Remove line referencing new cache feature not yet moved --- src/H5Cdbg.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c index f45e52c..0752673 100644 --- a/src/H5Cdbg.c +++ b/src/H5Cdbg.c @@ -278,7 +278,6 @@ H5C_dump_cache_skip_list(H5C_t *cache_ptr, char *calling_fcn) HDassert(calling_fcn != NULL); HDfprintf(stdout, "\n\nDumping metadata cache skip list from %s.\n", calling_fcn); - HDfprintf(stdout, " slist %s.\n", cache_ptr->slist_enabled ? "enabled" : "disabled"); HDfprintf(stdout, " slist len = %" PRIu32 ".\n", cache_ptr->slist_len); HDfprintf(stdout, " slist size = %zu.\n", cache_ptr->slist_size); -- cgit v0.12