summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MANIFEST3
-rw-r--r--fortran/src/Makefile.am2
-rw-r--r--hl/c++/src/H5PacketTable.h2
-rw-r--r--hl/src/H5PT.c4
-rw-r--r--hl/src/H5TB.c342
-rw-r--r--release_docs/RELEASE.txt43
-rw-r--r--src/CMakeLists.txt11
-rw-r--r--src/H5Dmpio.c2
-rw-r--r--src/H5Eprivate.h13
-rw-r--r--src/H5FDlog.c236
-rw-r--r--src/H5FDmpio.c324
-rw-r--r--src/H5FDmulti.c44
-rw-r--r--src/H5Gdeprec.c10
-rw-r--r--src/H5MM.c15
-rw-r--r--src/H5Pfapl.c11
-rw-r--r--src/H5R.c2
-rw-r--r--src/H5Rdeprec.c2
-rw-r--r--src/H5ST.c779
-rw-r--r--src/H5STprivate.h63
-rw-r--r--src/Makefile.am1
-rw-r--r--test/CMakeLists.txt1
-rw-r--r--test/Makefile.am2
-rw-r--r--test/cache_common.c1
-rw-r--r--test/cache_logging.c6
-rw-r--r--test/dtypes.c2
-rw-r--r--test/reserved.c6
-rw-r--r--test/testhdf5.c1
-rw-r--r--test/testhdf5.h1
-rw-r--r--test/theap.c2
-rw-r--r--test/tmisc.c25
-rw-r--r--test/ttst.c391
-rw-r--r--test/vfd.c13
-rw-r--r--testpar/t_dset.c67
-rw-r--r--testpar/testphdf5.c3
-rw-r--r--testpar/testphdf5.h12
35 files changed, 664 insertions, 1778 deletions
diff --git a/MANIFEST b/MANIFEST
index 72e8558..d5be436 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1029,8 +1029,6 @@
./src/H5SMpkg.h
./src/H5SMprivate.h
./src/H5SMtest.c
-./src/H5ST.c
-./src/H5STprivate.h
./src/H5T.c
./src/H5Tarray.c
./src/H5Tbit.c
@@ -1343,7 +1341,6 @@
./test/ttsafe_cancel.c
./test/ttsafe_dcreate.c
./test/ttsafe_error.c
-./test/ttst.c
./test/tunicode.c
./test/tvlstr.c
./test/tvltypes.c
diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am
index 5168eb6..65ffa0c 100644
--- a/fortran/src/Makefile.am
+++ b/fortran/src/Makefile.am
@@ -155,7 +155,7 @@ H5Pff.lo: $(srcdir)/H5Pff.F90 H5f90global.lo H5fortkit.lo
H5Rff.lo: $(srcdir)/H5Rff.F90 H5f90global.lo
H5Sff.lo: $(srcdir)/H5Sff.F90 H5f90global.lo
H5Tff.lo: $(srcdir)/H5Tff.F90 H5f90global.lo
-H5VLff.lo: $(srcdir)/H5VLff.F90 H5f90global.lo
+H5VLff.lo: $(srcdir)/H5VLff.F90 H5f90global.lo H5fortkit.lo
H5Zff.lo: $(srcdir)/H5Zff.F90 H5f90global.lo
H5_gen.lo: H5_gen.F90 H5f90global.lo H5Aff.lo H5Dff.lo H5Pff.lo
HDF5.lo: $(srcdir)/HDF5.F90 H5f90global.lo H5_ff.lo H5Aff.lo \
diff --git a/hl/c++/src/H5PacketTable.h b/hl/c++/src/H5PacketTable.h
index a73b4c9..acd0ccf 100644
--- a/hl/c++/src/H5PacketTable.h
+++ b/hl/c++/src/H5PacketTable.h
@@ -35,7 +35,7 @@ class H5_HLCPPDLL PacketTable {
*/
PacketTable()
{
- table_id = H5I_BADID;
+ table_id = H5I_INVALID_HID;
}
/* "Open" Constructor
diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c
index d9fdfb0..f5fb99f 100644
--- a/hl/src/H5PT.c
+++ b/hl/src/H5PT.c
@@ -29,7 +29,7 @@ static H5I_type_t H5PT_ptable_id_type = H5I_UNINIT;
#define H5PT_HASH_TABLE_SIZE 64
/* Packet Table private functions */
-static herr_t H5PT_free_id(void *id);
+static herr_t H5PT_free_id(void *id, void **_ctx);
static herr_t H5PT_close(htbl_t *table);
static herr_t H5PT_create_index(htbl_t *table_id);
static herr_t H5PT_set_index(htbl_t *table_id, hsize_t pt_index);
@@ -402,7 +402,7 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-H5PT_free_id(void *id)
+H5PT_free_id(void *id, void H5_ATTR_UNUSED **_ctx)
{
HDfree(id);
return SUCCEED;
diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c
index 1ac162f..efa61a3 100644
--- a/hl/src/H5TB.c
+++ b/hl/src/H5TB.c
@@ -57,11 +57,11 @@ H5TBmake_table(const char *table_title, hid_t loc_id, const char *dset_name, hsi
hsize_t nrecords, size_t type_size, const char *field_names[], const size_t *field_offset,
const hid_t *field_types, hsize_t chunk_size, void *fill_data, int compress, const void *buf)
{
- hid_t did = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
- hid_t plist_id = H5I_BADID;
- hid_t attr_id = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t mem_type_id = H5I_INVALID_HID;
+ hid_t plist_id = H5I_INVALID_HID;
+ hid_t attr_id = H5I_INVALID_HID;
hsize_t dims[1];
hsize_t dims_chunk[1];
hsize_t maxdims[1] = {H5S_UNLIMITED};
@@ -129,17 +129,17 @@ H5TBmake_table(const char *table_title, hid_t loc_id, const char *dset_name, hsi
/* terminate access to the data space. */
if (H5Sclose(sid) < 0)
goto out;
- sid = H5I_BADID;
+ sid = H5I_INVALID_HID;
/* end access to the dataset */
if (H5Dclose(did) < 0)
goto out;
- did = H5I_BADID;
+ did = H5I_INVALID_HID;
/* end access to the property list */
if (H5Pclose(plist_id) < 0)
goto out;
- plist_id = H5I_BADID;
+ plist_id = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* set the conforming table attributes
@@ -196,24 +196,24 @@ H5TBmake_table(const char *table_title, hid_t loc_id, const char *dset_name, hsi
if (H5Aclose(attr_id) < 0)
goto out;
- attr_id = H5I_BADID;
+ attr_id = H5I_INVALID_HID;
} /* end for */
/* terminate access to the data space. */
if (H5Sclose(sid) < 0)
goto out;
- sid = H5I_BADID;
+ sid = H5I_INVALID_HID;
/* end access to the dataset */
if (H5Dclose(did) < 0)
goto out;
- did = H5I_BADID;
+ did = H5I_INVALID_HID;
} /* end if */
/* release the datatype. */
if (H5Tclose(mem_type_id) < 0)
goto out;
- mem_type_id = H5I_BADID;
+ mem_type_id = H5I_INVALID_HID;
ret_val = 0;
@@ -267,9 +267,9 @@ herr_t
H5TBappend_records(hid_t loc_id, const char *dset_name, hsize_t nrecords, size_t type_size,
const size_t *field_offset, const size_t *field_sizes, const void *buf)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t mem_type_id = H5I_INVALID_HID;
hsize_t nrecords_orig;
hsize_t nfields;
herr_t ret_val = -1;
@@ -332,11 +332,11 @@ herr_t
H5TBwrite_records(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t type_size,
const size_t *field_offset, const size_t *field_sizes, const void *buf)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
+ hid_t mem_type_id = H5I_INVALID_HID;
hsize_t count[1];
hsize_t offset[1];
hsize_t mem_size[1];
@@ -425,14 +425,14 @@ H5TBwrite_fields_name(hid_t loc_id, const char *dset_name, const char *field_nam
hsize_t nrecords, size_t type_size, const size_t *field_offset,
const size_t *field_sizes, const void *buf)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t write_type_id = H5I_BADID;
- hid_t member_type_id = H5I_BADID;
- hid_t nmtype_id = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hid_t file_space_id = H5I_BADID;
- hid_t preserve_id = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t write_type_id = H5I_INVALID_HID;
+ hid_t member_type_id = H5I_INVALID_HID;
+ hid_t nmtype_id = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
+ hid_t file_space_id = H5I_INVALID_HID;
+ hid_t preserve_id = H5I_INVALID_HID;
hssize_t nfields;
hssize_t i, j;
hsize_t count[1];
@@ -510,10 +510,10 @@ H5TBwrite_fields_name(hid_t loc_id, const char *dset_name, const char *field_nam
/* close */
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
if (H5Tclose(nmtype_id) < 0)
goto out;
- nmtype_id = H5I_BADID;
+ nmtype_id = H5I_INVALID_HID;
} /* end if */
H5free_memory(member_name);
@@ -583,14 +583,14 @@ H5TBwrite_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, con
hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset,
const size_t *field_sizes, const void *buf)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t write_type_id = H5I_BADID;
- hid_t member_type_id = H5I_BADID;
- hid_t nmtype_id = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hid_t file_space_id = H5I_BADID;
- hid_t preserve_id = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t write_type_id = H5I_INVALID_HID;
+ hid_t member_type_id = H5I_INVALID_HID;
+ hid_t nmtype_id = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
+ hid_t file_space_id = H5I_INVALID_HID;
+ hid_t preserve_id = H5I_INVALID_HID;
hsize_t count[1];
hsize_t offset[1];
hsize_t i;
@@ -663,10 +663,10 @@ H5TBwrite_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, con
/* close */
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
if (H5Tclose(nmtype_id) < 0)
goto out;
- nmtype_id = H5I_BADID;
+ nmtype_id = H5I_INVALID_HID;
H5free_memory(member_name);
member_name = NULL;
@@ -747,10 +747,10 @@ herr_t
H5TBread_table(hid_t loc_id, const char *dset_name, size_t type_size, const size_t *field_offset,
const size_t *field_sizes, void *dst_buf)
{
- hid_t did = H5I_BADID;
- hid_t ftype_id = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
- hid_t sid = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t ftype_id = H5I_INVALID_HID;
+ hid_t mem_type_id = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
hsize_t dims[1];
herr_t ret_val = -1;
@@ -820,9 +820,9 @@ herr_t
H5TBread_records(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t type_size,
const size_t *field_offset, const size_t *field_sizes, void *buf)
{
- hid_t did = H5I_BADID;
- hid_t ftype_id = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t ftype_id = H5I_INVALID_HID;
+ hid_t mem_type_id = H5I_INVALID_HID;
hsize_t nrecords_orig;
hsize_t nfields;
herr_t ret_val = -1;
@@ -887,13 +887,13 @@ H5TBread_fields_name(hid_t loc_id, const char *dset_name, const char *field_name
hsize_t nrecords, size_t type_size, const size_t *field_offset,
const size_t *field_sizes, void *buf)
{
- hid_t did = H5I_BADID;
- hid_t ftype_id = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
- hid_t mtype_id = H5I_BADID;
- hid_t nmtype_id = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t ftype_id = H5I_INVALID_HID;
+ hid_t mem_type_id = H5I_INVALID_HID;
+ hid_t mtype_id = H5I_INVALID_HID;
+ hid_t nmtype_id = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
hssize_t nfields;
hsize_t count[1];
hsize_t offset[1];
@@ -960,10 +960,10 @@ H5TBread_fields_name(hid_t loc_id, const char *dset_name, const char *field_name
/* close */
if (H5Tclose(mtype_id) < 0)
goto out;
- mtype_id = H5I_BADID;
+ mtype_id = H5I_INVALID_HID;
if (H5Tclose(nmtype_id) < 0)
goto out;
- nmtype_id = H5I_BADID;
+ nmtype_id = H5I_INVALID_HID;
j++;
} /* end if */
@@ -1044,13 +1044,13 @@ H5TBread_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, cons
hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset,
const size_t *field_sizes, void *buf)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t read_type_id = H5I_BADID;
- hid_t member_type_id = H5I_BADID;
- hid_t nmtype_id = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t read_type_id = H5I_INVALID_HID;
+ hid_t member_type_id = H5I_INVALID_HID;
+ hid_t nmtype_id = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
hsize_t count[1];
hsize_t offset[1];
hsize_t mem_size[1];
@@ -1117,10 +1117,10 @@ H5TBread_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, cons
/* close the member type */
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
if (H5Tclose(nmtype_id) < 0)
goto out;
- nmtype_id = H5I_BADID;
+ nmtype_id = H5I_INVALID_HID;
H5free_memory(member_name);
member_name = NULL;
@@ -1198,11 +1198,11 @@ out:
herr_t
H5TBdelete_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
+ hid_t mem_type_id = H5I_INVALID_HID;
hsize_t nfields;
hsize_t ntotal_records;
hsize_t read_start;
@@ -1294,16 +1294,16 @@ H5TBdelete_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nr
/* close */
if (H5Sclose(m_sid) < 0)
goto out;
- m_sid = H5I_BADID;
+ m_sid = H5I_INVALID_HID;
if (H5Tclose(mem_type_id) < 0)
goto out;
- mem_type_id = H5I_BADID;
+ mem_type_id = H5I_INVALID_HID;
if (H5Sclose(sid) < 0)
goto out;
- sid = H5I_BADID;
+ sid = H5I_INVALID_HID;
if (H5Tclose(tid) < 0)
goto out;
- tid = H5I_BADID;
+ tid = H5I_INVALID_HID;
} /* read_nrecords */
/*-------------------------------------------------------------------------
@@ -1361,11 +1361,11 @@ herr_t
H5TBinsert_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t type_size,
const size_t *field_offset, const size_t *field_sizes, void *buf)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t mem_type_id = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t mem_type_id = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
hsize_t nfields;
hsize_t ntotal_records;
hsize_t read_nrecords;
@@ -1442,10 +1442,10 @@ H5TBinsert_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nr
/* terminate access to the dataspace */
if (H5Sclose(m_sid) < 0)
goto out;
- m_sid = H5I_BADID;
+ m_sid = H5I_INVALID_HID;
if (H5Sclose(sid) < 0)
goto out;
- sid = H5I_BADID;
+ sid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* write the "pushed down" records
@@ -1513,10 +1513,10 @@ herr_t
H5TBadd_records_from(hid_t loc_id, const char *dset_name1, hsize_t start1, hsize_t nrecords,
const char *dset_name2, hsize_t start2)
{
- hid_t did = H5I_BADID;
- hid_t tid = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
hsize_t count[1];
hsize_t offset[1];
hsize_t mem_size[1];
@@ -1643,24 +1643,24 @@ H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const c
const char *dset_name3)
{
/* identifiers for the 1st dataset. */
- hid_t did_1 = H5I_BADID;
- hid_t tid_1 = H5I_BADID;
- hid_t sid_1 = H5I_BADID;
- hid_t pid_1 = H5I_BADID;
+ hid_t did_1 = H5I_INVALID_HID;
+ hid_t tid_1 = H5I_INVALID_HID;
+ hid_t sid_1 = H5I_INVALID_HID;
+ hid_t pid_1 = H5I_INVALID_HID;
/* identifiers for the 2nd dataset. */
- hid_t did_2 = H5I_BADID;
- hid_t tid_2 = H5I_BADID;
- hid_t sid_2 = H5I_BADID;
- hid_t pid_2 = H5I_BADID;
+ hid_t did_2 = H5I_INVALID_HID;
+ hid_t tid_2 = H5I_INVALID_HID;
+ hid_t sid_2 = H5I_INVALID_HID;
+ hid_t pid_2 = H5I_INVALID_HID;
/* identifiers for the 3rd dataset. */
- hid_t did_3 = H5I_BADID;
- hid_t tid_3 = H5I_BADID;
- hid_t sid_3 = H5I_BADID;
- hid_t pid_3 = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
- hid_t member_type_id = H5I_BADID;
- hid_t attr_id = H5I_BADID;
+ hid_t did_3 = H5I_INVALID_HID;
+ hid_t tid_3 = H5I_INVALID_HID;
+ hid_t sid_3 = H5I_INVALID_HID;
+ hid_t pid_3 = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
+ hid_t member_type_id = H5I_INVALID_HID;
+ hid_t attr_id = H5I_INVALID_HID;
hsize_t count[1];
hsize_t offset[1];
hsize_t mem_size[1];
@@ -1807,17 +1807,17 @@ H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const c
if (H5Aclose(attr_id) < 0)
goto out;
- attr_id = H5I_BADID;
+ attr_id = H5I_INVALID_HID;
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
} /* end for */
/* close data space. */
if (H5Sclose(sid) < 0)
goto out;
- sid = H5I_BADID;
+ sid = H5I_INVALID_HID;
} /* end if */
/*-------------------------------------------------------------------------
@@ -1856,7 +1856,7 @@ H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const c
*/
if (H5Sclose(m_sid) < 0)
goto out;
- m_sid = H5I_BADID;
+ m_sid = H5I_INVALID_HID;
HDfree(tmp_buf);
tmp_buf = NULL;
@@ -1999,25 +1999,25 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi
hsize_t position, const void *fill_data, const void *buf)
{
/* identifiers for the 1st, original dataset */
- hid_t did_1 = H5I_BADID;
- hid_t tid_1 = H5I_BADID;
- hid_t sid_1 = H5I_BADID;
- hid_t pid_1 = H5I_BADID;
- hid_t msid_1 = H5I_BADID;
+ hid_t did_1 = H5I_INVALID_HID;
+ hid_t tid_1 = H5I_INVALID_HID;
+ hid_t sid_1 = H5I_INVALID_HID;
+ hid_t pid_1 = H5I_INVALID_HID;
+ hid_t msid_1 = H5I_INVALID_HID;
/* identifiers for the 2nd, new dataset */
- hid_t did_2 = H5I_BADID;
- hid_t tid_2 = H5I_BADID;
- hid_t sid_2 = H5I_BADID;
- hid_t pid_2 = H5I_BADID;
- hid_t msid_2 = H5I_BADID;
+ hid_t did_2 = H5I_INVALID_HID;
+ hid_t tid_2 = H5I_INVALID_HID;
+ hid_t sid_2 = H5I_INVALID_HID;
+ hid_t pid_2 = H5I_INVALID_HID;
+ hid_t msid_2 = H5I_INVALID_HID;
/* identifiers for the 3rd, final dataset */
- hid_t did_3 = H5I_BADID;
- hid_t tid_3 = H5I_BADID;
- hid_t sid_3 = H5I_BADID;
- hid_t member_type_id = H5I_BADID;
- hid_t write_type_id = H5I_BADID;
- hid_t preserve_id = H5I_BADID;
- hid_t attr_id = H5I_BADID;
+ hid_t did_3 = H5I_INVALID_HID;
+ hid_t tid_3 = H5I_INVALID_HID;
+ hid_t sid_3 = H5I_INVALID_HID;
+ hid_t member_type_id = H5I_INVALID_HID;
+ hid_t write_type_id = H5I_INVALID_HID;
+ hid_t preserve_id = H5I_INVALID_HID;
+ hid_t attr_id = H5I_INVALID_HID;
size_t member_size;
size_t new_member_size = 0;
size_t total_size;
@@ -2157,7 +2157,7 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi
/* close the member type */
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
} /* end else */
} /* end for */
@@ -2307,12 +2307,12 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi
if (H5Aclose(attr_id) < 0)
goto out;
- attr_id = H5I_BADID;
+ attr_id = H5I_INVALID_HID;
/* close the member type */
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
} /* end for */
/*-------------------------------------------------------------------------
@@ -2334,11 +2334,11 @@ H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, hi
if (H5Aclose(attr_id) < 0)
goto out;
- attr_id = H5I_BADID;
+ attr_id = H5I_INVALID_HID;
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
} /* end fill_data */
ret_val = 0;
@@ -2415,23 +2415,23 @@ herr_t
H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name)
{
/* identifiers for the 1st original dataset */
- hid_t did_1 = H5I_BADID;
- hid_t tid_1 = H5I_BADID;
- hid_t sid_1 = H5I_BADID;
- hid_t pid_1 = H5I_BADID;
+ hid_t did_1 = H5I_INVALID_HID;
+ hid_t tid_1 = H5I_INVALID_HID;
+ hid_t sid_1 = H5I_INVALID_HID;
+ hid_t pid_1 = H5I_INVALID_HID;
/* identifiers for the 2nd new dataset */
- hid_t did_2 = H5I_BADID;
- hid_t tid_2 = H5I_BADID;
- hid_t sid_2 = H5I_BADID;
- hid_t pid_2 = H5I_BADID;
+ hid_t did_2 = H5I_INVALID_HID;
+ hid_t tid_2 = H5I_INVALID_HID;
+ hid_t sid_2 = H5I_INVALID_HID;
+ hid_t pid_2 = H5I_INVALID_HID;
/* identifiers for the 3rd final dataset */
- hid_t did_3 = H5I_BADID;
- hid_t tid_3 = H5I_BADID;
- hid_t member_type_id = H5I_BADID;
- hid_t preserve_id = H5I_BADID;
- hid_t read_type_id = H5I_BADID;
- hid_t write_type_id = H5I_BADID;
- hid_t attr_id = H5I_BADID;
+ hid_t did_3 = H5I_INVALID_HID;
+ hid_t tid_3 = H5I_INVALID_HID;
+ hid_t member_type_id = H5I_INVALID_HID;
+ hid_t preserve_id = H5I_INVALID_HID;
+ hid_t read_type_id = H5I_INVALID_HID;
+ hid_t write_type_id = H5I_INVALID_HID;
+ hid_t attr_id = H5I_INVALID_HID;
size_t member_size;
size_t type_size1;
size_t type_size2;
@@ -2515,7 +2515,7 @@ H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name)
/* close the member type */
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
H5free_memory(member_name);
member_name = NULL;
@@ -2598,7 +2598,7 @@ H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name)
/* close the member type */
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
} /* end if */
H5free_memory(member_name);
@@ -2682,22 +2682,22 @@ H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name)
/* end access to the property list */
if (H5Pclose(preserve_id) < 0)
goto out;
- preserve_id = H5I_BADID;
+ preserve_id = H5I_INVALID_HID;
/* close the member type */
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
/* close the read type */
if (H5Tclose(read_type_id) < 0)
goto out;
- read_type_id = H5I_BADID;
+ read_type_id = H5I_INVALID_HID;
/* close the write type */
if (H5Tclose(write_type_id) < 0)
goto out;
- write_type_id = H5I_BADID;
+ write_type_id = H5I_INVALID_HID;
HDfree(tmp_buf);
tmp_buf = NULL;
@@ -2769,18 +2769,18 @@ H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name)
if (H5Aclose(attr_id) < 0)
goto out;
- attr_id = H5I_BADID;
+ attr_id = H5I_INVALID_HID;
/* close the member type */
if (H5Tclose(member_type_id) < 0)
goto out;
- member_type_id = H5I_BADID;
+ member_type_id = H5I_INVALID_HID;
} /* end for */
/* close data space. */
if (H5Sclose(sid_1) < 0)
goto out;
- sid_1 = H5I_BADID;
+ sid_1 = H5I_INVALID_HID;
} /* end if */
ret_val = 0;
@@ -2962,9 +2962,9 @@ out:
herr_t
H5TBget_table_info(hid_t loc_id, const char *dset_name, hsize_t *nfields, hsize_t *nrecords)
{
- hid_t tid = H5I_BADID;
- hid_t sid = H5I_BADID;
- hid_t did = H5I_BADID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
hsize_t dims[1];
int num_members;
herr_t ret_val = -1;
@@ -3008,7 +3008,7 @@ H5TBget_table_info(hid_t loc_id, const char *dset_name, hsize_t *nfields, hsize_
/* terminate access to the dataspace */
if (H5Sclose(sid) < 0)
goto out;
- sid = H5I_BADID;
+ sid = H5I_INVALID_HID;
*nrecords = dims[0];
} /* end if */
@@ -3048,11 +3048,11 @@ herr_t
H5TBget_field_info(hid_t loc_id, const char *dset_name, char *field_names[], size_t *field_sizes,
size_t *field_offsets, size_t *type_size)
{
- hid_t did = H5I_BADID; /* dataset ID */
- hid_t tid = H5I_BADID; /* file type ID */
- hid_t n_tid = H5I_BADID; /* native type ID */
- hid_t m_tid = H5I_BADID; /* member type ID */
- hid_t nm_tid = H5I_BADID; /* native member ID */
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
+ hid_t tid = H5I_INVALID_HID; /* file type ID */
+ hid_t n_tid = H5I_INVALID_HID; /* native type ID */
+ hid_t m_tid = H5I_INVALID_HID; /* member type ID */
+ hid_t nm_tid = H5I_INVALID_HID; /* native member ID */
hssize_t nfields;
hssize_t i;
herr_t ret_val = -1;
@@ -3111,10 +3111,10 @@ H5TBget_field_info(hid_t loc_id, const char *dset_name, char *field_names[], siz
/* close the member types */
if (H5Tclose(m_tid) < 0)
goto out;
- m_tid = H5I_BADID;
+ m_tid = H5I_INVALID_HID;
if (H5Tclose(nm_tid) < 0)
goto out;
- nm_tid = H5I_BADID;
+ nm_tid = H5I_INVALID_HID;
} /* end for */
ret_val = 0;
@@ -3267,9 +3267,9 @@ static hid_t
H5TB_create_type(hid_t loc_id, const char *dset_name, size_t type_size, const size_t *field_offset,
const size_t *field_sizes, hid_t ftype_id)
{
- hid_t mem_type_id = H5I_BADID;
- hid_t mtype_id = H5I_BADID;
- hid_t nmtype_id = H5I_BADID;
+ hid_t mem_type_id = H5I_INVALID_HID;
+ hid_t mtype_id = H5I_INVALID_HID;
+ hid_t nmtype_id = H5I_INVALID_HID;
size_t size_native;
hsize_t nfields = 0;
char ** fnames = NULL;
@@ -3310,10 +3310,10 @@ H5TB_create_type(hid_t loc_id, const char *dset_name, size_t type_size, const si
goto out;
if (H5Tclose(mtype_id) < 0)
goto out;
- mtype_id = H5I_BADID;
+ mtype_id = H5I_INVALID_HID;
if (H5Tclose(nmtype_id) < 0)
goto out;
- nmtype_id = H5I_BADID;
+ nmtype_id = H5I_INVALID_HID;
} /* end for */
ret_val = mem_type_id;
@@ -3364,8 +3364,8 @@ herr_t
H5TB_common_append_records(hid_t dataset_id, hid_t mem_type_id, size_t nrecords, hsize_t orig_table_size,
const void *buf)
{
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
hsize_t count[1];
hsize_t offset[1];
hsize_t dims[1];
@@ -3429,8 +3429,8 @@ herr_t
H5TB_common_read_records(hid_t dataset_id, hid_t mem_type_id, hsize_t start, size_t nrecords,
hsize_t table_size, void *buf)
{
- hid_t sid = H5I_BADID;
- hid_t m_sid = H5I_BADID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
hsize_t count[1];
hsize_t offset[1];
hsize_t mem_size[1];
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index b41eb9e..807d3ab 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -284,6 +284,49 @@ New Features
Library:
--------
+ - H5Gcreate1() now rejects size_hint parameters larger than UINT32_MAX
+
+ The size_hint value is ultimately stored in a uint32_t struct field,
+ so specifying a value larger than this on a 64-bit machine can cause
+ undefined behavior including crashing the system.
+
+ The documentation for this API call was also incorrect, stating that
+ passing a negative value would cause the library to use a default
+ value. Instead, passing a "negative" value actually passes a very large
+ value, which is probably not what the user intends and can cause
+ crashes on 64-bit systems.
+
+ The Doxygen documentation has been updated and passing values larger
+ than UINT32_MAX for size_hint will now produce a normal HDF5 error.
+
+ (DER - 2021/04/29, HDFFV-11241)
+
+
+ - H5Pset_fapl_log() no longer crashes when passed an invalid fapl ID
+
+ When passed an invalid fapl ID, H5Pset_fapl_log() would usually
+ segfault when attempting to free an uninitialized pointer in the error
+ handling code. This behavior is more common in release builds or
+ when the memory sanitization checks were not selected as a build
+ option.
+
+ The pointer is now correctly initialized and the API call now
+ produces a normal HDF5 error when fed an invalid fapl ID.
+
+ (DER - 2021/04/28, HDFFV-11240)
+
+ - Fixes a segfault when H5Pset_mdc_log_options() is called multiple times
+
+ The call incorrectly attempts to free an internal copy of the previous
+ log location string, which causes a segfault. This only happens
+ when the call is invoked multiple times on the same property list.
+ On the first call to a given fapl, the log location is set to NULL so
+ the segfault does not occur.
+
+ The string is now handled properly and the segfault no longer occurs.
+
+ (DER - 2021/04/27, HDFFV-11239)
+
- HSYS_GOTO_ERROR now emits the results of GetLastError() on Windows
HSYS_GOTO_ERROR is an internal macro that is used to produce error
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f9eef06..60d78eb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -596,14 +596,6 @@ set (H5SM_HDRS
IDE_GENERATED_PROPERTIES ("H5SM" "${H5SM_HDRS}" "${H5SM_SOURCES}" )
-set (H5ST_SOURCES
- ${HDF5_SRC_DIR}/H5ST.c
-)
-set (H5ST_HDRS
-)
-IDE_GENERATED_PROPERTIES ("H5ST" "${H5ST_HDRS}" "${H5ST_SOURCES}" )
-
-
set (H5T_SOURCES
${HDF5_SRC_DIR}/H5T.c
${HDF5_SRC_DIR}/H5Tarray.c
@@ -793,7 +785,6 @@ set (common_SRCS
${H5S_SOURCES}
${H5SL_SOURCES}
${H5SM_SOURCES}
- ${H5ST_SOURCES}
${H5T_SOURCES}
${H5TS_SOURCES}
${H5VL_SOURCES}
@@ -948,8 +939,6 @@ set (H5_PRIVATE_HEADERS
${HDF5_SRC_DIR}/H5SMpkg.h
${HDF5_SRC_DIR}/H5SMprivate.h
- ${HDF5_SRC_DIR}/H5STprivate.h
-
${HDF5_SRC_DIR}/H5Tpkg.h
${HDF5_SRC_DIR}/H5Tprivate.h
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index b51b39a..752c144 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -410,7 +410,7 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space, co
* collective I/O
*/
if (MPI_SUCCESS !=
- (mpi_code = MPI_Allreduce(&local_cause, &global_cause, 2, MPI_UNSIGNED, MPI_BOR, io_info->comm)))
+ (mpi_code = MPI_Allreduce(local_cause, global_cause, 2, MPI_UNSIGNED, MPI_BOR, io_info->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Allreduce failed", mpi_code)
} /* end else */
diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h
index c3c440f..4cd8b70 100644
--- a/src/H5Eprivate.h
+++ b/src/H5Eprivate.h
@@ -168,20 +168,15 @@ typedef struct H5E_t H5E_t;
extern char H5E_mpi_error_str[MPI_MAX_ERROR_STRING];
extern int H5E_mpi_error_str_len;
-#define HMPI_ERROR(mpierr) \
- { \
- MPI_Error_string(mpierr, H5E_mpi_error_str, &H5E_mpi_error_str_len); \
- HERROR(H5E_INTERNAL, H5E_MPIERRSTR, "%s", H5E_mpi_error_str); \
- }
#define HMPI_DONE_ERROR(retcode, str, mpierr) \
{ \
- HMPI_ERROR(mpierr); \
- HDONE_ERROR(H5E_INTERNAL, H5E_MPI, retcode, str); \
+ MPI_Error_string(mpierr, H5E_mpi_error_str, &H5E_mpi_error_str_len); \
+ HDONE_ERROR(H5E_INTERNAL, H5E_MPI, retcode, "%s: MPI error string is '%s'", str, H5E_mpi_error_str); \
}
#define HMPI_GOTO_ERROR(retcode, str, mpierr) \
{ \
- HMPI_ERROR(mpierr); \
- HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, retcode, str); \
+ MPI_Error_string(mpierr, H5E_mpi_error_str, &H5E_mpi_error_str_len); \
+ HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, retcode, "%s: MPI error string is '%s'", str, H5E_mpi_error_str); \
}
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index aa2d6db..7214b75 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -326,12 +326,15 @@ H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, si
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*sULz", fapl_id, logfile, flags, buf_size);
+ /* Do this first, so that we don't try to free a wild pointer if
+ * H5P_object_verify() fails.
+ */
+ HDmemset(&fa, 0, sizeof(H5FD_log_fapl_t));
+
/* Check arguments */
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
- HDmemset(&fa, 0, sizeof(H5FD_log_fapl_t));
-
/* Duplicate the log file string
* A little wasteful, since this string will just be copied later, but
* passing it in as a pointer sets off a chain of impossible-to-resolve
@@ -426,7 +429,7 @@ done:
if (new_fa->logfile)
new_fa->logfile = (char *)H5MM_xfree(new_fa->logfile);
H5MM_free(new_fa);
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__log_fapl_copy() */
@@ -484,8 +487,8 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
#ifdef H5_HAVE_WIN32_API
struct _BY_HANDLE_FILE_INFORMATION fileinfo;
#endif
- H5_timer_t open_timer = {{0}, {0}, {0}, FALSE}; /* Timer for open() call */
- H5_timer_t stat_timer = {{0}, {0}, {0}, FALSE}; /* Timer for stat() call */
+ H5_timer_t open_timer; /* Timer for open() call */
+ H5_timer_t stat_timer; /* Timer for stat() call */
h5_stat_t sb;
H5FD_t * ret_value = NULL; /* Return value */
@@ -502,6 +505,10 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
if (ADDR_OVERFLOW(maxaddr))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr")
+ /* Initialize timers */
+ H5_timer_init(&open_timer);
+ H5_timer_init(&stat_timer);
+
/* Build the open flags */
o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY;
if (H5F_ACC_TRUNC & flags)
@@ -518,10 +525,8 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info")
/* Start timer for open() call */
- if (fa->flags & H5FD_LOG_TIME_OPEN) {
- H5_timer_init(&open_timer);
+ if (fa->flags & H5FD_LOG_TIME_OPEN)
H5_timer_start(&open_timer);
- } /* end if */
/* Open the file */
if ((fd = HDopen(name, o_flags, H5_POSIX_CREATE_MODE_RW)) < 0) {
@@ -531,17 +536,15 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
H5E_FILE, H5E_CANTOPENFILE, NULL,
"unable to open file: name = '%s', errno = %d, error message = '%s', flags = %x, o_flags = %x",
name, myerrno, HDstrerror(myerrno), flags, (unsigned)o_flags);
- } /* end if */
+ }
/* Stop timer for open() call */
if (fa->flags & H5FD_LOG_TIME_OPEN)
H5_timer_stop(&open_timer);
/* Start timer for stat() call */
- if (fa->flags & H5FD_LOG_TIME_STAT) {
- H5_timer_init(&stat_timer);
+ if (fa->flags & H5FD_LOG_TIME_STAT)
H5_timer_start(&stat_timer);
- } /* end if */
/* Get the file stats */
if (HDfstat(fd, &sb) < 0)
@@ -594,15 +597,15 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
if (file->fa.flags & H5FD_LOG_FILE_READ) {
file->nread = (unsigned char *)H5MM_calloc(file->iosize);
HDassert(file->nread);
- } /* end if */
+ }
if (file->fa.flags & H5FD_LOG_FILE_WRITE) {
file->nwrite = (unsigned char *)H5MM_calloc(file->iosize);
HDassert(file->nwrite);
- } /* end if */
+ }
if (file->fa.flags & H5FD_LOG_FLAVOR) {
file->flavor = (unsigned char *)H5MM_calloc(file->iosize);
HDassert(file->flavor);
- } /* end if */
+ }
/* Set the log file pointer */
if (fa->logfile)
@@ -616,14 +619,14 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
H5_timer_get_times(open_timer, &open_times);
HDfprintf(file->logfp, "Open took: (%f s)\n", open_times.elapsed);
- } /* end if */
+ }
if (file->fa.flags & H5FD_LOG_TIME_STAT) {
H5_timevals_t stat_times; /* Elapsed time for stat() call */
H5_timer_get_times(stat_timer, &stat_times);
HDfprintf(file->logfp, "Stat took: (%f s)\n", stat_times.elapsed);
- } /* end if */
- } /* end if */
+ }
+ }
/* Check the file locking flags in the fapl */
if (ignore_disabled_file_locks_s != FAIL)
@@ -645,7 +648,7 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
if (H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME) > 0)
if (H5P_get(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME, &file->fam_to_single) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to single")
- } /* end if */
+ }
/* Set return value */
ret_value = (H5FD_t *)file;
@@ -656,7 +659,7 @@ done:
HDclose(fd);
if (file)
file = H5FL_FREE(H5FD_log_t, file);
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__log_open() */
@@ -677,20 +680,21 @@ done:
static herr_t
H5FD__log_close(H5FD_t *_file)
{
- H5FD_log_t *file = (H5FD_log_t *)_file;
- H5_timer_t close_timer = {{0}, {0}, {0}, FALSE}; /* Timer for close() call */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5FD_log_t *file = (H5FD_log_t *)_file;
+ H5_timer_t close_timer; /* Timer for close() call */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
HDassert(file);
+ /* Initialize timer */
+ H5_timer_init(&close_timer);
+
/* Start timer for close() call */
- if (file->fa.flags & H5FD_LOG_TIME_CLOSE) {
- H5_timer_init(&close_timer);
+ if (file->fa.flags & H5FD_LOG_TIME_CLOSE)
H5_timer_start(&close_timer);
- } /* end if */
/* Close the underlying file */
if (HDclose(file->fd) < 0)
@@ -711,7 +715,7 @@ H5FD__log_close(H5FD_t *_file)
H5_timer_get_times(close_timer, &close_times);
HDfprintf(file->logfp, "Close took: (%f s)\n", close_times.elapsed);
- } /* end if */
+ }
/* Dump the total number of seek/read/write operations */
if (file->fa.flags & H5FD_LOG_NUM_READ)
@@ -746,13 +750,13 @@ H5FD__log_close(H5FD_t *_file)
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 %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 */
if (file->fa.flags & H5FD_LOG_FILE_READ) {
@@ -767,13 +771,13 @@ H5FD__log_close(H5FD_t *_file)
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 %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 */
if (file->fa.flags & H5FD_LOG_FLAVOR) {
@@ -788,12 +792,12 @@ H5FD__log_close(H5FD_t *_file)
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 %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 */
if (file->fa.flags & H5FD_LOG_FILE_WRITE)
@@ -920,7 +924,7 @@ H5FD__log_query(const H5FD_t *_file, unsigned long *flags /* out */)
if (file && file->fam_to_single)
*flags |= H5FD_FEAT_IGNORE_DRVRINFO; /* Ignore the driver info when file is opened (which
eliminates it) */
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5FD__log_query() */
@@ -959,13 +963,13 @@ H5FD__log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hs
HDassert(addr < file->iosize);
H5_CHECK_OVERFLOW(size, hsize_t, size_t);
HDmemset(&file->flavor[addr], (int)type, (size_t)size);
- } /* end if */
+ }
if (file->fa.flags & H5FD_LOG_ALLOC)
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 */
ret_value = addr;
@@ -998,13 +1002,13 @@ H5FD__log_free(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
HDassert(addr < file->iosize);
H5_CHECK_OVERFLOW(size, hsize_t, size_t);
HDmemset(&file->flavor[addr], H5FD_MEM_DEFAULT, (size_t)size);
- } /* end if */
+ }
/* Log the file memory freed */
if (file->fa.flags & H5FD_LOG_FREE)
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)
} /* end H5FD__log_free() */
@@ -1065,14 +1069,14 @@ H5FD__log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr)
HDassert(addr < file->iosize);
H5_CHECK_OVERFLOW(size, hsize_t, size_t);
HDmemset(&file->flavor[file->eoa], (int)type, (size_t)size);
- } /* end if */
+ }
/* Log the extension like an allocation */
if (file->fa.flags & H5FD_LOG_ALLOC)
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 */
if (H5F_addr_lt(addr, file->eoa) && H5F_addr_gt(addr, 0)) {
@@ -1083,15 +1087,15 @@ H5FD__log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr)
HDassert((addr + size) < file->iosize);
H5_CHECK_OVERFLOW(size, hsize_t, size_t);
HDmemset(&file->flavor[addr], H5FD_MEM_DEFAULT, (size_t)size);
- } /* end if */
+ }
/* Log the shrink like a free */
if (file->fa.flags & H5FD_LOG_FREE)
HDfprintf(file->logfp,
"%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Freed\n",
file->eoa, addr, size, flavors[type]);
- } /* end if */
- } /* end if */
+ }
+ }
file->eoa = addr;
@@ -1174,23 +1178,22 @@ static herr_t
H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size,
void *buf /*out*/)
{
- H5FD_log_t * file = (H5FD_log_t *)_file;
- size_t orig_size = size; /* Save the original size for later */
- haddr_t orig_addr = addr;
- H5_timer_t read_timer = {{0}, {0}, {0}, FALSE}; /* Timer for read operation */
- H5_timevals_t read_times; /* Elapsed time for read operation */
-#ifndef H5_HAVE_PREADWRITE
- H5_timer_t seek_timer; /* Timer for seek operation */
- H5_timevals_t seek_times; /* Elapsed time for seek operation */
-#endif /* H5_HAVE_PREADWRITE */
- HDoff_t offset = (HDoff_t)addr;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5FD_log_t * file = (H5FD_log_t *)_file;
+ size_t orig_size = size; /* Save the original size for later */
+ haddr_t orig_addr = addr;
+ H5_timer_t read_timer; /* Timer for read operation */
+ H5_timevals_t read_times; /* Elapsed time for read operation */
+ HDoff_t offset = (HDoff_t)addr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
HDassert(file && file->pub.cls);
HDassert(buf);
+ /* Initialize timer */
+ H5_timer_init(&read_timer);
+
/* Check for overflow conditions */
if (!H5F_addr_defined(addr))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr)
@@ -1207,17 +1210,22 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
HDassert((addr + size) < file->iosize);
while (tmp_size-- > 0)
file->nread[tmp_addr++]++;
- } /* end if */
- } /* end if */
+ }
+ }
#ifndef H5_HAVE_PREADWRITE
/* Seek to the correct location (if we don't have pread) */
if (addr != file->pos || OP_READ != file->op) {
+
+ H5_timer_t seek_timer; /* Timer for seek operation */
+ H5_timevals_t seek_times; /* Elapsed time for seek operation */
+
+ /* Initialize timer */
+ H5_timer_init(&seek_timer);
+
/* Start timer for seek() call */
- if (file->fa.flags & H5FD_LOG_TIME_SEEK) {
- H5_timer_init(&seek_timer);
+ if (file->fa.flags & H5FD_LOG_TIME_SEEK)
H5_timer_start(&seek_timer);
- } /* end if */
if (HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
@@ -1234,7 +1242,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
if (file->fa.flags & H5FD_LOG_TIME_SEEK) {
H5_timer_get_times(seek_timer, &seek_times);
file->total_seek_time += seek_times.elapsed;
- } /* end if */
+ }
/* Emit log string if we're tracking individual seek events. */
if (file->fa.flags & H5FD_LOG_LOC_SEEK) {
@@ -1248,15 +1256,13 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
HDfprintf(file->logfp, " (%fs @ %f)\n", seek_times.elapsed, seek_timer.initial.elapsed);
else
HDfprintf(file->logfp, "\n");
- } /* end if */
- } /* end if */
-#endif /* H5_HAVE_PREADWRITE */
+ }
+ }
+#endif /* H5_HAVE_PREADWRITE */
/* Start timer for read operation */
- if (file->fa.flags & H5FD_LOG_TIME_READ) {
- H5_timer_init(&read_timer);
+ if (file->fa.flags & H5FD_LOG_TIME_READ)
H5_timer_start(&read_timer);
- } /* end if */
/*
* Read data, being careful of interrupted system calls, partial results,
@@ -1301,13 +1307,13 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf,
(unsigned long long)size, (unsigned long long)bytes_in,
(unsigned long long)bytes_read, (unsigned long long)offset);
- } /* end if */
+ }
if (0 == bytes_read) {
- /* end of file but not end of format address space */
+ /* End of file but not end of format address space */
HDmemset(buf, 0, size);
break;
- } /* end if */
+ }
HDassert(bytes_read >= 0);
HDassert((size_t)bytes_read <= size);
@@ -1315,8 +1321,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
size -= (size_t)bytes_read;
addr += (haddr_t)bytes_read;
buf = (char *)buf + bytes_read;
-
- } /* end while */
+ }
/* Stop timer for read operation */
if (file->fa.flags & H5FD_LOG_TIME_READ)
@@ -1330,7 +1335,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
if (file->fa.flags & H5FD_LOG_TIME_READ) {
H5_timer_get_times(read_timer, &read_times);
file->total_read_time += read_times.elapsed;
- } /* end if */
+ }
/* Log information about the read */
if (file->fa.flags & H5FD_LOG_LOC_READ) {
@@ -1344,7 +1349,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
HDassert(type == H5FD_MEM_DEFAULT ||
type == (H5FD_mem_t)file->flavor[(orig_addr + orig_size) - 1] ||
(H5FD_mem_t)file->flavor[(orig_addr + orig_size) - 1] == H5FD_MEM_DEFAULT);
- } /* end if */
+ }
/* Add the read time, if we're tracking that.
* Note that the read time is NOT emitted for when just H5FD_LOG_TIME_READ
@@ -1354,7 +1359,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
HDfprintf(file->logfp, " (%fs @ %f)\n", read_times.elapsed, read_timer.initial.elapsed);
else
HDfprintf(file->logfp, "\n");
- } /* end if */
+ }
/* Update current position */
file->pos = addr;
@@ -1365,7 +1370,7 @@ done:
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__log_read() */
@@ -1388,17 +1393,13 @@ static herr_t
H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size,
const void *buf)
{
- H5FD_log_t * file = (H5FD_log_t *)_file;
- size_t orig_size = size; /* Save the original size for later */
- haddr_t orig_addr = addr;
- H5_timer_t write_timer = {{0}, {0}, {0}, FALSE}; /* Timer for write operation */
- H5_timevals_t write_times; /* Elapsed time for write operation */
-#ifndef H5_HAVE_PREADWRITE
- H5_timer_t seek_timer; /* Timer for seek operation */
- H5_timevals_t seek_times; /* Elapsed time for seek operation */
-#endif /* H5_HAVE_PREADWRITE */
- HDoff_t offset = (HDoff_t)addr;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5FD_log_t * file = (H5FD_log_t *)_file;
+ size_t orig_size = size; /* Save the original size for later */
+ haddr_t orig_addr = addr;
+ H5_timer_t write_timer; /* Timer for write operation */
+ H5_timevals_t write_times; /* Elapsed time for write operation */
+ HDoff_t offset = (HDoff_t)addr;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1406,13 +1407,16 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
HDassert(size > 0);
HDassert(buf);
+ /* Initialize timer */
+ H5_timer_init(&write_timer);
+
/* Verify that we are writing out the type of data we allocated in this location */
if (file->flavor) {
HDassert(type == H5FD_MEM_DEFAULT || type == (H5FD_mem_t)file->flavor[addr] ||
(H5FD_mem_t)file->flavor[addr] == H5FD_MEM_DEFAULT);
HDassert(type == H5FD_MEM_DEFAULT || type == (H5FD_mem_t)file->flavor[(addr + size) - 1] ||
(H5FD_mem_t)file->flavor[(addr + size) - 1] == H5FD_MEM_DEFAULT);
- } /* end if */
+ }
/* Check for overflow conditions */
if (!H5F_addr_defined(addr))
@@ -1430,16 +1434,21 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
HDassert((addr + size) < file->iosize);
while (tmp_size-- > 0)
file->nwrite[tmp_addr++]++;
- } /* end if */
+ }
#ifndef H5_HAVE_PREADWRITE
/* Seek to the correct location (if we don't have pwrite) */
if (addr != file->pos || OP_WRITE != file->op) {
+
+ H5_timer_t seek_timer; /* Timer for seek operation */
+ H5_timevals_t seek_times; /* Elapsed time for seek operation */
+
+ /* Initialize timer */
+ H5_timer_init(&seek_timer);
+
/* Start timer for seek() call */
- if (file->fa.flags & H5FD_LOG_TIME_SEEK) {
- H5_timer_init(&seek_timer);
+ if (file->fa.flags & H5FD_LOG_TIME_SEEK)
H5_timer_start(&seek_timer);
- } /* end if */
if (HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
@@ -1456,7 +1465,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
if (file->fa.flags & H5FD_LOG_TIME_SEEK) {
H5_timer_get_times(seek_timer, &seek_times);
file->total_seek_time += seek_times.elapsed;
- } /* end if */
+ }
/* Emit log string if we're tracking individual seek events. */
if (file->fa.flags & H5FD_LOG_LOC_SEEK) {
@@ -1470,15 +1479,13 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
HDfprintf(file->logfp, " (%fs @ %f)\n", seek_times.elapsed, seek_timer.initial.elapsed);
else
HDfprintf(file->logfp, "\n");
- } /* end if */
- } /* end if */
-#endif /* H5_HAVE_PREADWRITE */
+ }
+ }
+#endif /* H5_HAVE_PREADWRITE */
/* Start timer for write operation */
- if (file->fa.flags & H5FD_LOG_TIME_WRITE) {
- H5_timer_init(&write_timer);
+ if (file->fa.flags & H5FD_LOG_TIME_WRITE)
H5_timer_start(&write_timer);
- } /* end if */
/*
* Write the data, being careful of interrupted system calls and partial
@@ -1545,7 +1552,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
if (file->fa.flags & H5FD_LOG_TIME_WRITE) {
H5_timer_get_times(write_timer, &write_times);
file->total_write_time += write_times.elapsed;
- } /* end if */
+ }
/* Log information about the write */
if (file->fa.flags & H5FD_LOG_LOC_WRITE) {
@@ -1558,8 +1565,8 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
if ((H5FD_mem_t)file->flavor[orig_addr] == H5FD_MEM_DEFAULT) {
HDmemset(&file->flavor[orig_addr], (int)type, orig_size);
HDfprintf(file->logfp, " (fresh)");
- } /* end if */
- } /* end if */
+ }
+ }
/* Add the write time, if we're tracking that.
* Note that the write time is NOT emitted for when just H5FD_LOG_TIME_WRITE
@@ -1569,7 +1576,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
HDfprintf(file->logfp, " (%fs @ %f)\n", write_times.elapsed, write_timer.initial.elapsed);
else
HDfprintf(file->logfp, "\n");
- } /* end if */
+ }
/* Update current position and eof */
file->pos = addr;
@@ -1582,7 +1589,7 @@ done:
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__log_write() */
@@ -1612,14 +1619,15 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_
/* Extend the file to make sure it's large enough */
if (!H5F_addr_eq(file->eoa, file->eof)) {
- H5_timer_t trunc_timer = {{0}, {0}, {0}, FALSE}; /* Timer for truncate operation */
- H5_timevals_t trunc_times; /* Elapsed time for truncate operation */
+ H5_timer_t trunc_timer; /* Timer for truncate operation */
+ H5_timevals_t trunc_times; /* Elapsed time for truncate operation */
+
+ /* Initialize timer */
+ H5_timer_init(&trunc_timer);
/* Start timer for truncate operation */
- if (file->fa.flags & H5FD_LOG_TIME_TRUNCATE) {
- H5_timer_init(&trunc_timer);
+ if (file->fa.flags & H5FD_LOG_TIME_TRUNCATE)
H5_timer_start(&trunc_timer);
- } /* end if */
#ifdef H5_HAVE_WIN32_API
{
@@ -1643,7 +1651,7 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_
dwError = GetLastError();
if (dwError != NO_ERROR)
HGOTO_ERROR(H5E_FILE, H5E_FILEOPEN, FAIL, "unable to set file pointer")
- } /* end if */
+ }
if (0 == SetEndOfFile(file->hFile))
HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
@@ -1666,7 +1674,7 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_
if (file->fa.flags & H5FD_LOG_TIME_TRUNCATE) {
H5_timer_get_times(trunc_timer, &trunc_times);
file->total_truncate_time += trunc_times.elapsed;
- } /* end if */
+ }
/* Emit log string if we're tracking individual truncate events. */
if (file->fa.flags & H5FD_LOG_TRUNCATE) {
@@ -1680,7 +1688,7 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_
HDfprintf(file->logfp, " (%fs @ %f)\n", trunc_times.elapsed, trunc_timer.initial.elapsed);
else
HDfprintf(file->logfp, "\n");
- } /* end if */
+ }
/* Update the eof value */
file->eof = file->eoa;
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 576120b..c0b14ce 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -42,7 +42,7 @@
static hid_t H5FD_MPIO_g = 0;
/* Whether to allow collective I/O operations */
-/* (Value can be set from environment variable also) */
+/* (Can be changed by setting "HDF5_MPI_OPT_TYPES" environment variable to '0' or '1') */
hbool_t H5FD_mpi_opt_types_g = TRUE;
/*
@@ -133,23 +133,26 @@ static const H5FD_class_mpi_t H5FD_mpio_g = {
};
#ifdef H5FDmpio_DEBUG
-/* Flags to control debug actions in H5Fmpio.
- * Meant to be indexed by characters.
- *
- * 'c' show result of MPI_Get_count after read
- * 'r' show read offset and size
- * 't' trace function entry and exit
- * 'w' show write offset and size
+/* Flags to control debug actions in the MPI-IO VFD.
+ * (Meant to be indexed by characters)
+ *
+ * These flags can be set with either (or both) the environment variable
+ * "H5FD_mpio_Debug" set to a string containing one or more characters
+ * (flags) or by setting them as a string value for the
+ * "H5F_mpio_debug_key" MPI Info key.
+ *
+ * Supported characters in 'H5FD_mpio_Debug' string:
+ * 't' trace function entry and exit
+ * 'r' show read offset and size
+ * 'w' show write offset and size
+ * '0'-'9' only show output from a single MPI rank (ranks 0-9 supported)
*/
-static int H5FD_mpio_Debug[256] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+static int H5FD_mpio_debug_flags_s[256];
+static int H5FD_mpio_debug_rank_s = -1;
+
+/* Indicate if this rank should output tracing info */
+#define H5FD_MPIO_TRACE_THIS_RANK(file) \
+ (H5FD_mpio_debug_rank_s < 0 || H5FD_mpio_debug_rank_s == (file)->mpi_rank)
#endif
/*--------------------------------------------------------------------------
@@ -181,6 +184,41 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FD__init_package() */
+#ifdef H5FDmpio_DEBUG
+
+/*---------------------------------------------------------------------------
+ * Function: H5FD__mpio_parse_debug_str
+ *
+ * Purpose: Parse a string for debugging flags
+ *
+ * Returns: N/A
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, Aug 12, 2020
+ *
+ *---------------------------------------------------------------------------
+ */
+static void
+H5FD__mpio_parse_debug_str(const char *s)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(s);
+
+ /* Set debug mask */
+ while (*s) {
+ if ((int)(*s) >= (int)'0' && (int)(*s) <= (int)'9')
+ H5FD_mpio_debug_rank_s = ((int)*s) - (int)'0';
+ else
+ H5FD_mpio_debug_flags_s[(int)*s]++;
+ s++;
+ } /* end while */
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5FD__mpio_parse_debug_str() */
+#endif /* H5FDmpio_DEBUG */
+
/*-------------------------------------------------------------------------
* Function: H5FD_mpio_init
*
@@ -198,11 +236,8 @@ done:
hid_t
H5FD_mpio_init(void)
{
-#ifdef H5FDmpio_DEBUG
static int H5FD_mpio_Debug_inited = 0;
-#endif /* H5FDmpio_DEBUG */
- const char *s; /* String for environment variables */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
@@ -210,28 +245,27 @@ H5FD_mpio_init(void)
if (H5I_VFL != H5I_get_type(H5FD_MPIO_g))
H5FD_MPIO_g = H5FD_register((const H5FD_class_t *)&H5FD_mpio_g, sizeof(H5FD_class_mpi_t), FALSE);
- /* Allow MPI buf-and-file-type optimizations? */
- s = HDgetenv("HDF5_MPI_OPT_TYPES");
- if (s && HDisdigit(*s)) {
- long env_val = HDstrtol(s, NULL, 0);
- H5FD_mpi_opt_types_g = (0 == env_val) ? FALSE : TRUE;
- }
+ if (!H5FD_mpio_Debug_inited) {
+ const char *s; /* String for environment variables */
+
+ /* Allow MPI buf-and-file-type optimizations? */
+ s = HDgetenv("HDF5_MPI_OPT_TYPES");
+ if (s && HDisdigit(*s))
+ H5FD_mpi_opt_types_g = (0 == HDstrtol(s, NULL, 0)) ? FALSE : TRUE;
#ifdef H5FDmpio_DEBUG
- if (!H5FD_mpio_Debug_inited) {
+ /* Clear the flag buffer */
+ HDmemset(H5FD_mpio_debug_flags_s, 0, sizeof(H5FD_mpio_debug_flags_s));
+
/* Retrieve MPI-IO debugging environment variable */
s = HDgetenv("H5FD_mpio_Debug");
- if (s) {
- /* Set debug mask */
- while (*s) {
- H5FD_mpio_Debug[(int)*s]++;
- s++;
- } /* end while */
- } /* end if */
- H5FD_mpio_Debug_inited++;
- } /* end if */
+ if (s)
+ H5FD__mpio_parse_debug_str(s);
#endif /* H5FDmpio_DEBUG */
+ H5FD_mpio_Debug_inited++;
+ } /* end if */
+
/* Set return value */
ret_value = H5FD_MPIO_g;
@@ -655,30 +689,27 @@ herr_t
H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag)
{
H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
- int mpi_code; /* MPI return code */
- int temp_flag;
- herr_t ret_value = SUCCEED;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank);
#endif
- if (FALSE == flag)
- temp_flag = 0;
- else
- temp_flag = 1;
-
/* set atomicity value */
- if (MPI_SUCCESS != (mpi_code = MPI_File_set_atomicity(file->f, temp_flag)))
+ if (MPI_SUCCESS != (mpi_code = MPI_File_set_atomicity(file->f, (int)(flag != FALSE))))
HMPI_GOTO_ERROR(FAIL, "MPI_File_set_atomicity", mpi_code)
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -700,15 +731,18 @@ herr_t
H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag)
{
H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
- int mpi_code; /* MPI return code */
int temp_flag;
- herr_t ret_value = SUCCEED;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank);
#endif
/* Get atomicity value */
@@ -722,8 +756,8 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag)
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -759,17 +793,14 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR
int mpi_amode; /* MPI file access flags */
int mpi_rank = INT_MAX; /* MPI rank of this process */
int mpi_size; /* Total number of MPI processes */
- int mpi_code; /* MPI return code */
MPI_Offset file_size; /* File size (of existing files) */
- H5FD_t * ret_value = NULL; /* Return value */
-
- FUNC_ENTER_STATIC
-
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n", FUNC,
- name, flags, (int)fapl_id, (unsigned long)maxaddr);
+ hbool_t H5FD_mpio_debug_t_flag = FALSE;
#endif
+ int mpi_code; /* MPI return code */
+ H5FD_t *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_STATIC
/* Get a pointer to the fapl */
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
@@ -787,6 +818,14 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR
if (MPI_SUCCESS != (mpi_code = MPI_Comm_size(comm, &mpi_size)))
HMPI_GOTO_ERROR(NULL, "MPI_Comm_size failed", mpi_code)
+#ifdef H5FDmpio_DEBUG
+ H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] &&
+ (H5FD_mpio_debug_rank_s < 0 || H5FD_mpio_debug_rank_s == mpi_rank));
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n",
+ FUNC, mpi_rank, name, flags, (int)fapl_id, (unsigned long)maxaddr);
+#endif
+
/* Convert HDF5 flags to MPI-IO flags */
/* Some combinations are illegal; let MPI-IO figure it out */
mpi_amode = (flags & H5F_ACC_RDWR) ? MPI_MODE_RDWR : MPI_MODE_RDONLY;
@@ -802,14 +841,9 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR
int flag;
MPI_Info_get(info, H5F_MPIO_DEBUG_KEY, sizeof(debug_str) - 1, debug_str, &flag);
- if (flag) {
- int i;
-
- HDfprintf(stdout, "H5FD_mpio debug flags = '%s'\n", debug_str);
- for (i = 0; debug_str[i] /*end of string*/ && i < 128 /*just in case*/; ++i)
- H5FD_mpio_Debug[(int)debug_str[i]] = 1;
- } /* end if */
- } /* end if */
+ if (flag)
+ H5FD__mpio_parse_debug_str(debug_str);
+ } /* end if */
#endif
if (MPI_SUCCESS != (mpi_code = MPI_File_open(comm, name, mpi_amode, info, &fh)))
@@ -836,6 +870,7 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR
/* Determine if the file should be truncated */
if (file_size && (flags & H5F_ACC_TRUNC)) {
+ /* Truncate the file */
if (MPI_SUCCESS != (mpi_code = MPI_File_set_size(fh, (MPI_Offset)0)))
HMPI_GOTO_ERROR(NULL, "MPI_File_set_size failed", mpi_code)
@@ -867,8 +902,8 @@ done:
} /* end if */
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -890,14 +925,18 @@ static herr_t
H5FD__mpio_close(H5FD_t *_file)
{
H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
- int mpi_code; /* MPI return code */
- herr_t ret_value = SUCCEED; /* Return value */
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+ int mpi_rank = file->mpi_rank;
+#endif
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank);
#endif
/* Sanity checks */
@@ -915,8 +954,8 @@ H5FD__mpio_close(H5FD_t *_file)
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -948,7 +987,7 @@ H5FD__mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out
*flags |= H5FD_FEAT_HAS_MPI; /* This driver uses MPI */
*flags |= H5FD_FEAT_ALLOCATE_EARLY; /* Allocate space early instead of late */
*flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file which can be opened with the default
- VFD */
+ VFD */
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -1110,7 +1149,6 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
MPI_Offset mpi_off;
MPI_Status mpi_stat; /* Status from I/O operation */
- int mpi_code; /* mpi return code */
MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */
int size_i; /* Integer copy of 'size' to read */
#if MPI_VERSION >= 3
@@ -1126,13 +1164,18 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
#endif
hbool_t use_view_this_time = FALSE;
hbool_t rank0_bcast = FALSE; /* If read-with-rank0-and-bcast flag was used */
- herr_t ret_value = SUCCEED;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+ hbool_t H5FD_mpio_debug_r_flag = (H5FD_mpio_debug_flags_s[(int)'r'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank);
#endif
/* Sanity checks */
@@ -1151,8 +1194,9 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size to size_i")
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) mpi_off = %ld size_i = %d\n", FUNC, file->mpi_rank, (long)mpi_off,
+ size_i);
#endif
/* Only look for MPI views for raw data transfers */
@@ -1198,8 +1242,8 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
H5FD_mpio_collective_opt_t coll_opt_mode;
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", FUNC, file->mpi_rank);
#endif
/* Get the collective_opt property to check whether the application wants to do IO individually. */
if (H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0)
@@ -1207,14 +1251,14 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) {
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", FUNC, file->mpi_rank);
#endif
/* Check whether we should read from rank 0 and broadcast to other ranks */
if (H5CX_get_mpio_rank0_bcast()) {
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: doing read-rank0-and-MPI_Bcast\n", FUNC);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) doing read-rank0-and-MPI_Bcast\n", FUNC, file->mpi_rank);
#endif
/* Indicate path we've taken */
rank0_bcast = TRUE;
@@ -1235,8 +1279,8 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
} /* end if */
else {
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC);
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank);
#endif
/* Perform independent read operation */
@@ -1252,10 +1296,16 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
H5FD_mpi_native_g, file->info)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
} /* end if */
- else
+ else {
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_debug_r_flag)
+ HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank);
+#endif
+
/* Perform independent read operation */
if (MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
- HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code)
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code)
+ } /* end else */
/* Only retrieve bytes read if this rank _actually_ participated in I/O */
if (!rank0_bcast || (rank0_bcast && file->mpi_rank == 0)) {
@@ -1301,8 +1351,8 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -1337,7 +1387,6 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
MPI_Offset mpi_off;
MPI_Status mpi_stat; /* Status from I/O operation */
MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */
- int mpi_code; /* MPI return code */
#if MPI_VERSION >= 3
MPI_Count bytes_written;
MPI_Count type_size; /* MPI datatype used for I/O's size */
@@ -1351,13 +1400,18 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
hbool_t use_view_this_time = FALSE;
hbool_t derived_type = FALSE;
H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */
- herr_t ret_value = SUCCEED;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+ hbool_t H5FD_mpio_debug_w_flag = (H5FD_mpio_debug_flags_s[(int)'w'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ int mpi_code; /* MPI return code */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank);
#endif
/* Sanity checks */
@@ -1377,8 +1431,9 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
size_i = (int)size;
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'w'])
- HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i);
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stderr, "%s: (%d) mpi_off = %ld size_i = %d\n", FUNC, file->mpi_rank, (long)mpi_off,
+ size_i);
#endif
/* Get the transfer mode from the API context */
@@ -1433,8 +1488,8 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
H5FD_mpio_collective_opt_t coll_opt_mode;
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'w'])
- HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC);
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", FUNC, file->mpi_rank);
#endif
/* Get the collective_opt property to check whether the application wants to do IO individually. */
@@ -1443,8 +1498,8 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) {
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'w'])
- HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC);
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", FUNC, file->mpi_rank);
#endif
/* Perform collective write operation */
if (MPI_SUCCESS !=
@@ -1455,9 +1510,10 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
if (type != H5FD_MEM_DRAW)
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL,
"Metadata Coll opt property should be collective at this point")
+
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'w'])
- HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC);
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank);
#endif
/* Perform independent write operation */
if (MPI_SUCCESS !=
@@ -1470,12 +1526,18 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h
H5FD_mpi_native_g, file->info)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
} /* end if */
- else
+ else {
+#ifdef H5FDmpio_DEBUG
+ if (H5FD_mpio_debug_w_flag)
+ HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank);
+#endif
+
/* Perform independent write operation */
if (MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
- HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code)
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code)
+ } /* end else */
- /* How many bytes were actually written? */
+ /* How many bytes were actually written? */
#if MPI_VERSION >= 3
if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_written)))
#else
@@ -1514,8 +1576,8 @@ done:
MPI_Type_free(&buf_type);
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", FUNC, file->mpi_rank, ret_value);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving: ret_value = %d\n", FUNC, file->mpi_rank, ret_value);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -1537,14 +1599,17 @@ static herr_t
H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing)
{
H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
- int mpi_code; /* mpi return code */
- herr_t ret_value = SUCCEED;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ int mpi_code; /* mpi return code */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank);
#endif
/* Sanity checks */
@@ -1558,8 +1623,8 @@ H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing)
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
@@ -1591,14 +1656,17 @@ done:
static herr_t
H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing)
{
- H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
- herr_t ret_value = SUCCEED;
+ H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
+#ifdef H5FDmpio_DEBUG
+ hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file));
+#endif
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Entering\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank);
#endif
/* Sanity checks */
@@ -1666,8 +1734,8 @@ H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- HDfprintf(stdout, "%s: Leaving\n", FUNC);
+ if (H5FD_mpio_debug_t_flag)
+ HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank);
#endif
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index 168bbe1..9226624 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -35,6 +35,15 @@
#define TRUE 1
#endif
+/* Windows doesn't like some POSIX names and redefines them with an
+ * underscore
+ */
+#ifdef _WIN32
+#define my_strdup _strdup
+#else
+#define my_strdup strdup
+#endif
+
/* Loop through all mapped files */
#define UNIQUE_MEMBERS_CORE(MAP, ITER, SEEN, LOOPVAR) \
{ \
@@ -103,9 +112,8 @@ typedef struct H5FD_multi_dxpl_t {
} H5FD_multi_dxpl_t;
/* Private functions */
-static char *my_strdup(const char *s);
-static int compute_next(H5FD_multi_t *file);
-static int open_members(H5FD_multi_t *file);
+static int compute_next(H5FD_multi_t *file);
+static int open_members(H5FD_multi_t *file);
/* Callback prototypes */
static herr_t H5FD_multi_term(void);
@@ -172,36 +180,6 @@ static const H5FD_class_t H5FD_multi_g = {
};
/*-------------------------------------------------------------------------
- * Function: my_strdup
- *
- * Purpose: Private version of strdup()
- *
- * Return: Success: Ptr to new copy of string
- *
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * Friday, August 13, 1999
- *
- *-------------------------------------------------------------------------
- */
-static char *
-my_strdup(const char *s)
-{
- char * x;
- size_t str_len;
-
- if (!s)
- return NULL;
- str_len = strlen(s) + 1;
- if (NULL == (x = (char *)malloc(str_len)))
- return NULL;
- memcpy(x, s, str_len);
-
- return x;
-}
-
-/*-------------------------------------------------------------------------
* Function: H5FD_multi_init
*
* Purpose: Initialize this driver by registering the driver with the
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index b5a42c0..037669b 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -141,10 +141,10 @@ H5G_map_obj_type(H5O_type_t obj_type)
* specified NAME. The group is opened for write access
* and it's object ID is returned.
*
- * The optional SIZE_HINT specifies how much file space to
- * reserve to store the names that will appear in this
- * group. If a non-positive value is supplied for the SIZE_HINT
- * then a default size is chosen.
+ * The SIZE_HINT parameter specifies how much file space to reserve
+ * to store the names that will appear in this group. This number
+ * must be less than or equal to UINT32_MAX. If zero is supplied
+ * for the SIZE_HINT then a default size is chosen.
*
* Note: Deprecated in favor of H5Gcreate2
*
@@ -174,6 +174,8 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
/* Check arguments */
if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name given")
+ if (size_hint > UINT32_MAX)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "size_hint cannot be larger than UINT32_MAX")
/* Check if we need to create a non-standard GCPL */
if (size_hint > 0) {
diff --git a/src/H5MM.c b/src/H5MM.c
index d17db16..b4447f6 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -449,11 +449,17 @@ H5MM_xstrdup(const char *s)
FUNC_ENTER_NOAPI(NULL)
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
if (s) {
if (NULL == (ret_value = (char *)H5MM_malloc(HDstrlen(s) + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDstrcpy(ret_value, s);
- } /* end if */
+ }
+#else
+ if (s)
+ if (NULL == (ret_value = HDstrdup(s)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "string duplication failed")
+#endif
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -483,10 +489,15 @@ H5MM_strdup(const char *s)
FUNC_ENTER_NOAPI(NULL)
if (!s)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "null string")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "NULL string not allowed")
+#if defined H5_MEMORY_ALLOC_SANITY_CHECK
if (NULL == (ret_value = (char *)H5MM_malloc(HDstrlen(s) + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDstrcpy(ret_value, s);
+#else
+ if (NULL == (ret_value = HDstrdup(s)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "string duplication failed")
+#endif
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 1dbb552..f0fc39f 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -4220,7 +4220,7 @@ herr_t
H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location, hbool_t start_on_access)
{
H5P_genplist_t *plist; /* Property list pointer */
- char * tmp_location; /* Working location pointer */
+ char * new_location; /* Working location pointer */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -4236,19 +4236,14 @@ H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location,
if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plist_id is not a file access property list")
- /* Get the current location string and free it */
- if (H5P_get(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &tmp_location) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current log location")
- H5MM_xfree(tmp_location);
-
/* Make a copy of the passed-in location */
- if (NULL == (tmp_location = H5MM_xstrdup(location)))
+ if (NULL == (new_location = H5MM_xstrdup(location)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy passed-in log location")
/* Set values */
if (H5P_set(plist, H5F_ACS_USE_MDC_LOGGING_NAME, &is_enabled) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set is_enabled flag")
- if (H5P_set(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &tmp_location) < 0)
+ if (H5P_set(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &new_location) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set log location")
if (H5P_set(plist, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, &start_on_access) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set start_on_access flag")
diff --git a/src/H5R.c b/src/H5R.c
index d112081..e08e451 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -175,7 +175,7 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
- if ((space_id == H5I_BADID) || (space_id == H5S_ALL))
+ if ((space_id == H5I_INVALID_HID) || (space_id == H5S_ALL))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid")
if (NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c
index 32bd035..f78460d 100644
--- a/src/H5Rdeprec.c
+++ b/src/H5Rdeprec.c
@@ -449,7 +449,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t
size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE;
/* Retrieve space */
- if (space_id == H5I_BADID)
+ if (space_id == H5I_INVALID_HID)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid")
if (NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
diff --git a/src/H5ST.c b/src/H5ST.c
deleted file mode 100644
index 0b7b858..0000000
--- a/src/H5ST.c
+++ /dev/null
@@ -1,779 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://www.hdfgroup.org/licenses. *
- * If you do not have access to either file, you may request a copy from *
- * help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/* TERNARY SEARCH TREE ALGS
- This code is described in "Ternary Search Trees" by Jon
-Bentley and Robert Sedgewick in the April, 1998, Dr. Dobb's Journal.
-*/
-
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5STprivate.h" /* Ternary search trees */
-
-#ifdef H5ST_DEBUG
-static herr_t H5ST__dump_internal(H5ST_ptr_t p);
-#endif /* H5ST_DEBUG */
-
-/* Declare a free list to manage the H5ST_node_t struct */
-H5FL_DEFINE_STATIC(H5ST_node_t);
-
-/* Declare a free list to manage the H5ST_tree_t struct */
-H5FL_DEFINE_STATIC(H5ST_tree_t);
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_create
- PURPOSE
- Create a TST
- USAGE
- H5ST_ptr_t H5ST_create()
-
- RETURNS
- Returns a pointer to the new TST tree on success, NULL on failure.
- DESCRIPTION
- Create a TST.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-H5ST_tree_t *
-H5ST_create(void)
-{
- H5ST_tree_t *ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* Allocate wrapper for TST */
- if (NULL == (ret_value = H5FL_MALLOC(H5ST_tree_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
-
- /* Set the internal fields */
- ret_value->root = NULL;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_create() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST__close_internal
- PURPOSE
- Close a TST, deallocating it.
- USAGE
- herr_t H5ST_close(p)
- H5ST_ptr_t p; IN/OUT: Root of TST to free
-
- RETURNS
- Returns non-negative on success, negative on failure.
- DESCRIPTION
- Close a TST, freeing all nodes.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5ST__close_internal(H5ST_ptr_t p)
-{
- FUNC_ENTER_STATIC_NOERR
-
- /* Recursively free TST */
- if (p) {
- H5ST__close_internal(p->lokid);
- if (p->splitchar)
- H5ST__close_internal(p->eqkid);
- H5ST__close_internal(p->hikid);
- p = H5FL_FREE(H5ST_node_t, p);
- } /* end if */
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5ST__close_internal() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_close
- PURPOSE
- Close a TST, deallocating it.
- USAGE
- herr_t H5ST_close(tree)
- H5ST_tree_t *tree; IN/OUT: TST tree to free
-
- RETURNS
- Returns non-negative on success, negative on failure.
- DESCRIPTION
- Close a TST, freeing all nodes.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5ST_close(H5ST_tree_t *tree)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Check arguments */
- if (NULL == tree)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid TST")
-
- /* Free the TST itself */
- if (H5ST__close_internal(tree->root) < 0)
- HGOTO_ERROR(H5E_TST, H5E_CANTFREE, FAIL, "can't free TST")
-
- /* Free root node itself */
- tree = H5FL_FREE(H5ST_tree_t, tree);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_close() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_insert
- PURPOSE
- Insert a string/object pair into a TST
- USAGE
- herr_t H5ST_insert(tree,s,obj)
- H5ST_tree_t *tree; IN/OUT: TST to insert string into
- const char *s; IN: String to use as key for object
- void *obj; IN: Pointer to object to insert
-
- RETURNS
- Returns non-negative on success, negative on failure.
- DESCRIPTION
- Insert a key (string)/object pair into a TST
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5ST_insert(H5ST_tree_t *tree, const char *s, void *obj)
-{
- int d; /* Comparison value */
- H5ST_ptr_t pp, *p; /* Pointer to current node and pointer to that */
- H5ST_ptr_t parent = NULL; /* Pointer to parent node */
- H5ST_ptr_t up = NULL; /* Pointer to up node */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Find the correct location to insert object */
- p = &tree->root;
- while ((pp = *p)) {
- /* If this node matches the character in the key, then drop down to the lower tree */
- if (0 == (d = *s - pp->splitchar)) {
- if (*s++ == 0)
- HGOTO_ERROR(H5E_TST, H5E_EXISTS, FAIL, "key already in tree")
- up = pp;
- p = &(pp->eqkid);
- } /* end if */
- else {
- /* Walk through the current tree, searching for the matching character */
- parent = pp;
- if (d < 0)
- p = &(pp->lokid);
- else
- p = &(pp->hikid);
- } /* end else */
- } /* end while */
-
- /* Finish walking through the key string, adding nodes until the end */
- for (;;) {
- if (NULL == (*p = H5FL_MALLOC(H5ST_node_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- pp = *p;
- pp->splitchar = *s;
- pp->up = up;
- pp->parent = parent;
- pp->lokid = pp->eqkid = pp->hikid = NULL;
-
- /* If this is the end of the key string, break out */
- if (*s++ == 0) {
- pp->eqkid = (H5ST_ptr_t)obj;
- break;
- } /* end if */
-
- /* Continue to next character */
- parent = NULL;
- up = pp;
- p = &(pp->eqkid);
- } /* end for */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_insert() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_search
- PURPOSE
- Determine if a key is in the TST
- USAGE
- hbool_t H5ST_search(tree,s)
- H5ST_tree_t *tree; IN: TST to find string in
- const char *s; IN: String to use as key to locate
-
- RETURNS
- Success: TRUE if key string in TST, FALSE if not
- Failure: negative
- DESCRIPTION
- Locate a key (string) in a TST
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-htri_t
-H5ST_search(H5ST_tree_t *tree, const char *s)
-{
- H5ST_ptr_t p; /* Temporary pointer to TST node */
- htri_t ret_value = FALSE; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- p = tree->root;
- while (p) {
- if (*s < p->splitchar)
- p = p->lokid;
- else if (*s == p->splitchar) {
- if (*s++ == 0)
- HGOTO_DONE(TRUE);
- p = p->eqkid;
- }
- else
- p = p->hikid;
- } /* end while */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_search() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST__find_internal
- PURPOSE
- Find the node matching a particular key string
- USAGE
- H5ST_ptr_t H5ST_find(p,s)
- H5ST_ptr_t p; IN: TST to find string in
- const char *s; IN: String to use as key to locate
-
- RETURNS
- Success: Non-NULL
- Failure: NULL
- DESCRIPTION
- Locate a key (string) in a TST
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static H5ST_ptr_t
-H5ST__find_internal(H5ST_ptr_t p, const char *s)
-{
- H5ST_ptr_t ret_value = NULL; /* Return value */
-
- FUNC_ENTER_STATIC_NOERR
-
- while (p) {
- if (*s < p->splitchar)
- p = p->lokid;
- else if (*s == p->splitchar) {
- if (*s++ == 0)
- HGOTO_DONE(p);
- p = p->eqkid;
- }
- else
- p = p->hikid;
- } /* end while */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST__find_internal() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_find
- PURPOSE
- Find the node matching a particular key string
- USAGE
- H5ST_ptr_t H5ST_find(tree,s)
- H5ST_tree_t *tree; IN: TST to find string in
- const char *s; IN: String to use as key to locate
-
- RETURNS
- Success: Non-NULL
- Failure: NULL
- DESCRIPTION
- Locate a key (string) in a TST
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-H5ST_ptr_t
-H5ST_find(H5ST_tree_t *tree, const char *s)
-{
- H5ST_ptr_t ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- if (NULL == (ret_value = H5ST__find_internal(tree->root, s)))
- HGOTO_ERROR(H5E_TST, H5E_NOTFOUND, NULL, "key not found in TST")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_find() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_locate
- PURPOSE
- Find an object in a TST
- USAGE
- void *H5ST_locate(tree,s)
- H5ST_tree_t *tree; IN: TST to locate object within
- const char *s; IN: String of key for object to locate
- RETURNS
- Success: Non-NULL, pointer to object stored for key
- Failure: Negative
- DESCRIPTION
- Locate a node in a TST, returning the object from the node.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-void *
-H5ST_locate(H5ST_tree_t *tree, const char *s)
-{
- H5ST_ptr_t node; /* Pointer to node located */
- void * ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* Locate the node to remove */
- if (NULL == (node = H5ST__find_internal(tree->root, s)))
- HGOTO_ERROR(H5E_TST, H5E_NOTFOUND, NULL, "key not found in TST")
-
- /* Get the pointer to the object to return */
- ret_value = node->eqkid;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5ST_locate() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST__findfirst_internal
- PURPOSE
- Find the first node in a TST
- USAGE
- H5ST_ptr_t H5ST__findfirst_internal(p)
- H5ST_ptr_t p; IN: TST to locate first node within
- RETURNS
- Success: Non-NULL
- Failure: NULL
- DESCRIPTION
- Get the first (lexicographically) node in a TST
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static H5ST_ptr_t
-H5ST__findfirst_internal(H5ST_ptr_t p)
-{
- H5ST_ptr_t ret_value = NULL; /* Return value */
-
- FUNC_ENTER_STATIC_NOERR
-
- while (p) {
- /* Find least node in current tree */
- while (p->lokid)
- p = p->lokid;
-
- /* Is least node '\0'? */
- if (p->splitchar == '\0') {
- /* Return it */
- HGOTO_DONE(p);
- } /* end if */
- else {
- /* Go down to next level of tree */
- p = p->eqkid;
- } /* end else */
- } /* end while */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST__findfirst_internal() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_findfirst
- PURPOSE
- Find the first node in a TST
- USAGE
- H5ST_ptr_t H5ST_findfirst(tree)
- H5ST_tree_t *tree; IN: TST to locate first node within
- RETURNS
- Success: Non-NULL
- Failure: NULL
- DESCRIPTION
- Get the first (lexicographically) node in a TST
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-H5ST_ptr_t
-H5ST_findfirst(H5ST_tree_t *tree)
-{
- H5ST_ptr_t ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- if (NULL == (ret_value = H5ST__findfirst_internal(tree->root)))
- HGOTO_ERROR(H5E_TST, H5E_NOTFOUND, NULL, "no nodes in TST");
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_findfirst() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST__getnext
- PURPOSE
- Internal routine to find the next node in a given level of a TST
- USAGE
- H5ST_ptr_t H5ST__getnext(p)
- H5ST_ptr_t *p; IN: Pointer to node to find next node from
- RETURNS
- Success: Non-NULL
- Failure: NULL
- DESCRIPTION
- Get the next (lexicographically) node in the current level of a TST
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static H5ST_ptr_t
-H5ST__getnext(H5ST_ptr_t p)
-{
- H5ST_ptr_t ret_value = NULL; /* Return value */
-
- FUNC_ENTER_STATIC_NOERR
-
- /* If the node to continue from has higher-valued nodes attached */
- if (p->hikid) {
- /* Go to first higher-valued node */
- p = p->hikid;
-
- /* Find least node from here */
- while (p->lokid)
- p = p->lokid;
- HGOTO_DONE(p);
- } /* end if */
- else {
- H5ST_ptr_t q; /* Temporary TST node pointer */
-
- /* Go up one level in current tree */
- q = p->parent;
- if (q == NULL)
- HGOTO_DONE(NULL);
-
- /* While the previous node was the higher-valued node, keep backing up the tree */
- while (q->hikid == p) {
- p = q;
- q = p->parent;
- if (NULL == q)
- HGOTO_DONE(NULL);
- } /* end while */
- HGOTO_DONE(q);
- } /* end else */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST__getnext() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_findnext
- PURPOSE
- Find the next node from a node in a TST
- USAGE
- H5ST_ptr_t H5ST_findnext(p)
- H5ST_ptr_t p; IN: Current node to continue from
- RETURNS
- Success: Non-NULL
- Failure: NULL
- DESCRIPTION
- Get the next (lexicographically) node in a TST
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-H5ST_ptr_t
-H5ST_findnext(H5ST_ptr_t p)
-{
- H5ST_ptr_t q; /* Temporary pointer to TST node */
- H5ST_ptr_t ret_value = NULL; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Find the next node at the current level, or go back up the tree */
- do {
- q = H5ST__getnext(p);
- if (q) {
- HGOTO_DONE(H5ST__findfirst_internal(q->eqkid));
- } /* end if */
- else
- p = p->up;
- } while (p);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_findnext() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST__delete_internal
- PURPOSE
- Delete a node from a TST
- USAGE
- herr_t H5ST__delete_internal(root,p)
- H5ST_ptr_t *root; IN/OUT: Root of TST to delete node from
- H5ST_ptr_t p; IN: Node to delete
- RETURNS
- Success: Non-negative
- Failure: Negative
- DESCRIPTION
- Delete a node from a TST.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- This should be the final node for a string.
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5ST__delete_internal(H5ST_ptr_t *root, H5ST_ptr_t p)
-{
- H5ST_ptr_t q, /* Temporary pointer to TST node */
- newp; /* Pointer to node which will replace deleted node in tree */
-
- FUNC_ENTER_STATIC_NOERR
-
- /* Find node to replace one being deleted */
- if (p->lokid) {
- /* If the deleted node has lo & hi kids, attach them together */
- if (p->hikid) {
- q = p->lokid;
- while (q->hikid)
- q = q->hikid;
- q->hikid = p->hikid;
- p->hikid->parent = q;
- } /* end if */
- newp = p->lokid;
- } /* end if */
- else if (p->hikid) {
- newp = p->hikid;
- } /* end if */
- else {
- newp = NULL;
- } /* end else */
-
- /* Deleted node is in middle of tree */
- if (p->parent) {
- /* Attach new node to correct side of parent */
- if (p == p->parent->lokid)
- p->parent->lokid = newp;
- else
- p->parent->hikid = newp;
- if (newp)
- newp->parent = p->parent;
- } /* end if */
- else {
- if (newp)
- newp->parent = p->parent;
- if (p->up) {
- p->up->eqkid = newp;
-
- /* If we deleted the last node in the TST, delete the upper node also */
- if (NULL == newp)
- H5ST__delete_internal(root, p->up);
- } /* end if */
- else /* Deleted last node at top level of tree */
- *root = newp;
- } /* end else */
-
- p = H5FL_FREE(H5ST_node_t, p);
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5ST__delete_internal() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_delete
- PURPOSE
- Delete a node from a TST
- USAGE
- herr_t H5ST_delete(tree,p)
- H5ST_tree_t *tree; IN/OUT: TST to delete node from
- H5ST_ptr_t p; IN: Node to delete
- RETURNS
- Success: Non-negative
- Failure: Negative
- DESCRIPTION
- Delete a node from a TST.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- This should be the final node for a string.
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5ST_delete(H5ST_tree_t *tree, H5ST_ptr_t p)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- if (H5ST__delete_internal(&tree->root, p) < 0)
- HGOTO_ERROR(H5E_TST, H5E_CANTDELETE, FAIL, "can't delete node from TST")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5ST_delete() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_remove
- PURPOSE
- Remove a node from a TST
- USAGE
- void *H5ST_remove(tree,s)
- H5ST_tree_t *tree; IN/OUT: TST to remove node from
- const char *s; IN: String of key for node to remove
- RETURNS
- Success: Non-NULL, pointer to object stored for key
- Failure: Negative
- DESCRIPTION
- Remove a node from a TST, returning the object from the node.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-void *
-H5ST_remove(H5ST_tree_t *tree, const char *s)
-{
- H5ST_ptr_t node; /* Pointer to node to remove */
- void * ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(NULL)
-
- /* Locate the node to remove */
- if (NULL == (node = H5ST__find_internal(tree->root, s)))
- HGOTO_ERROR(H5E_TST, H5E_NOTFOUND, NULL, "key not found in TST")
-
- /* Get the pointer to the object to return */
- ret_value = node->eqkid;
-
- /* Remove the node from the TST */
- if (H5ST__delete_internal(&tree->root, node) < 0)
- HGOTO_ERROR(H5E_TST, H5E_CANTDELETE, NULL, "can't delete node from TST")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5ST_remove() */
-
-#ifdef H5ST_DEBUG
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST__dump_internal
- PURPOSE
- Dump all the nodes of a TST
- USAGE
- herr_t H5ST_dump(p)
- H5ST_ptr_t p; IN: Root of TST to dump
- RETURNS
- Success: Non-negative
- Failure: Negative
- DESCRIPTION
- Dump information for a TST.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static herr_t
-H5ST__dump_internal(H5ST_ptr_t p)
-{
- FUNC_ENTER_STATIC_NOERR
-
- if (p) {
- HDprintf("p=%p\n", (void *)p);
- HDprintf("\tp->up=%p\n", (void *)p->up);
- HDprintf("\tp->parent=%p\n", (void *)p->parent);
- HDprintf("\tp->lokid=%p\n", (void *)p->lokid);
- HDprintf("\tp->hikid=%p\n", (void *)p->hikid);
- HDprintf("\tp->eqkid=%p\n", (void *)p->eqkid);
- HDprintf("\tp->splitchar=%c\n", p->splitchar);
-
- H5ST__dump_internal(p->lokid);
- if (p->splitchar)
- H5ST__dump_internal(p->eqkid);
- else
- HDprintf("%s\n", (char *)p->eqkid);
- H5ST__dump_internal(p->hikid);
- } /* end if */
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5ST__dump_internal() */
-
-/*--------------------------------------------------------------------------
- NAME
- H5ST_dump
- PURPOSE
- Dump all the nodes of a TST
- USAGE
- herr_t H5ST_dump(tree)
- H5ST_tree_t *tree; IN: TST to dump
- RETURNS
- Success: Non-negative
- Failure: Negative
- DESCRIPTION
- Dump information for a TST.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5ST_dump(H5ST_tree_t *tree)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Dump the tree */
- H5ST__dump_internal(tree->root);
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5ST_dump() */
-#endif /* H5ST_DEBUG */
diff --git a/src/H5STprivate.h b/src/H5STprivate.h
deleted file mode 100644
index 2d009fa..0000000
--- a/src/H5STprivate.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://www.hdfgroup.org/licenses. *
- * If you do not have access to either file, you may request a copy from *
- * help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*
- * This file contains private information about the H5ST module
- */
-#ifndef H5STprivate_H
-#define H5STprivate_H
-
-#ifdef LATER
-#include "H5STpublic.h"
-#endif /* LATER */
-
-/* Private headers needed by this file */
-#include "H5private.h"
-
-/* Typedefs */
-
-/* Internal nodes for TST */
-typedef struct H5ST_node *H5ST_ptr_t;
-typedef struct H5ST_node {
- char splitchar; /* Character represented at node */
- H5ST_ptr_t up; /* Pointer to the node in the tree above (before) this node */
- H5ST_ptr_t parent; /* Pointer to the next higher tree node in this tree */
- H5ST_ptr_t lokid; /* Pointer to the lower node from this one, in this tree */
- H5ST_ptr_t eqkid; /* Pointer to the parent node in the next tree down (after) this node */
- H5ST_ptr_t hikid; /* Pointer to the higher node from this one, in this tree */
-} H5ST_node_t;
-
-/* Wrapper about TST */
-typedef struct {
- H5ST_ptr_t root; /* Pointer to actual TST */
-} H5ST_tree_t;
-
-/* Macro to access "data" pointer in H5ST_node_t's returned from functions */
-#define H5ST_NODE_DATA(p) ((void *)(p->eqkid))
-
-/* Private routines */
-H5_DLL H5ST_tree_t *H5ST_create(void);
-H5_DLL herr_t H5ST_close(H5ST_tree_t *p);
-H5_DLL herr_t H5ST_insert(H5ST_tree_t *root, const char *s, void *obj);
-H5_DLL htri_t H5ST_search(H5ST_tree_t *root, const char *s);
-H5_DLL H5ST_ptr_t H5ST_find(H5ST_tree_t *root, const char *s);
-H5_DLL void * H5ST_locate(H5ST_tree_t *root, const char *s);
-H5_DLL H5ST_ptr_t H5ST_findfirst(H5ST_tree_t *p);
-H5_DLL H5ST_ptr_t H5ST_findnext(H5ST_ptr_t p);
-H5_DLL void * H5ST_remove(H5ST_tree_t *root, const char *s);
-H5_DLL herr_t H5ST_delete(H5ST_tree_t *root, H5ST_ptr_t p);
-#ifdef H5ST_DEBUG
-H5_DLL herr_t H5ST_dump(H5ST_tree_t *tree);
-#endif /* H5ST_DEBUG */
-
-#endif /* H5STprivate_H */
diff --git a/src/Makefile.am b/src/Makefile.am
index a4d57ec..ab9e13a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -98,7 +98,6 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5lib_settings.c H5system.c \
H5Sselect.c H5Stest.c \
H5SL.c \
H5SM.c H5SMbtree2.c H5SMcache.c H5SMmessage.c H5SMtest.c \
- H5ST.c \
H5T.c H5Tarray.c H5Tbit.c H5Tcommit.c H5Tcompound.c H5Tconv.c \
H5Tcset.c H5Tdbg.c H5Tdeprec.c H5Tenum.c H5Tfields.c H5Tfixed.c \
H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Toh.c H5Topaque.c \
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 4cfe8c9..ecfce90 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -234,7 +234,6 @@ set (testhdf5_SOURCES
${HDF5_TEST_SOURCE_DIR}/tskiplist.c
${HDF5_TEST_SOURCE_DIR}/tsohm.c
${HDF5_TEST_SOURCE_DIR}/ttime.c
- ${HDF5_TEST_SOURCE_DIR}/ttst.c
${HDF5_TEST_SOURCE_DIR}/tunicode.c
${HDF5_TEST_SOURCE_DIR}/tvltypes.c
${HDF5_TEST_SOURCE_DIR}/tvlstr.c
diff --git a/test/Makefile.am b/test/Makefile.am
index d489ae2..66bccbb 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -227,7 +227,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse
# Sources for testhdf5 executable
testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \
tgenprop.c th5o.c th5s.c tcoords.c theap.c tid.c titerate.c tmeta.c tmisc.c \
- trefer.c trefer_deprec.c trefstr.c tselect.c tskiplist.c tsohm.c ttime.c ttst.c tunicode.c \
+ trefer.c trefer_deprec.c trefstr.c tselect.c tskiplist.c tsohm.c ttime.c tunicode.c \
tvlstr.c tvltypes.c
# Sources for Use Cases
diff --git a/test/cache_common.c b/test/cache_common.c
index 676b8d1..7269c49 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -2757,7 +2757,6 @@ flush_cache(H5F_t *file_ptr, hbool_t destroy_entries, hbool_t dump_stats, hbool_
if (pass) {
H5C_t *cache_ptr;
- herr_t result = 0;
HDassert(file_ptr);
diff --git a/test/cache_logging.c b/test/cache_logging.c
index 448e12b..af43845 100644
--- a/test/cache_logging.c
+++ b/test/cache_logging.c
@@ -58,6 +58,12 @@ test_logging_api(void)
if (H5Pset_mdc_log_options(fapl, is_enabled, LOG_LOCATION, start_on_access) < 0)
TEST_ERROR;
+ /* Ensure that setting the property twice doesn't cause problems
+ * (addresses a previous bug).
+ */
+ if (H5Pset_mdc_log_options(fapl, is_enabled, LOG_LOCATION, start_on_access) < 0)
+ TEST_ERROR;
+
/* Check to make sure that the property list getter returns the correct
* location string buffer size;
*/
diff --git a/test/dtypes.c b/test/dtypes.c
index 0b8beb7..95e8967 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -1485,7 +1485,7 @@ test_compound_8(void)
struct s2 {
char c;
s1 d;
- } s2;
+ };
hid_t tid1, tid1_copy, tid2, tid2_copy, tid3, arr_tid;
size_t tsize;
hsize_t dims[1] = {ARRAY_DIM};
diff --git a/test/reserved.c b/test/reserved.c
index 1ea73a6..6e41a16 100644
--- a/test/reserved.c
+++ b/test/reserved.c
@@ -126,7 +126,7 @@ rsrv_heap(void)
/* If we can read a dataset from the file, the file has been flushed to disk
* (if the heap or object headers weren't flushed, the file would be empty).
*/
- if (dataset_id == H5I_BADID)
+ if (dataset_id == H5I_INVALID_HID)
TEST_ERROR;
if (H5Dclose(dataset_id) < 0)
@@ -268,7 +268,7 @@ rsrv_ohdr(void)
/* If we can read the dataset from the file, the file has been flushed to disk
* (if the heap or object headers weren't flushed, the file would be empty).
*/
- if (dataset_id == H5I_BADID)
+ if (dataset_id == H5I_INVALID_HID)
TEST_ERROR;
if (H5Dclose(dataset_id) < 0)
@@ -432,7 +432,7 @@ rsrv_vlen(void)
/* If we can read the dataset from the file, the file has been flushed to disk
* (if the heap or object headers weren't flushed, the file would be empty).
*/
- if (dataset_id == H5I_BADID)
+ if (dataset_id == H5I_INVALID_HID)
TEST_ERROR;
if (H5Dclose(dataset_id) < 0)
diff --git a/test/testhdf5.c b/test/testhdf5.c
index 5e413f3..45c0f9f 100644
--- a/test/testhdf5.c
+++ b/test/testhdf5.c
@@ -45,7 +45,6 @@ main(int argc, char *argv[])
AddTest("config", test_configure, cleanup_configure, "Configure definitions", NULL);
AddTest("metadata", test_metadata, cleanup_metadata, "Encoding/decoding metadata", NULL);
AddTest("checksum", test_checksum, cleanup_checksum, "Checksum algorithm", NULL);
- AddTest("tst", test_tst, NULL, "Ternary Search Trees", NULL);
AddTest("heap", test_heap, NULL, "Memory Heaps", NULL);
AddTest("skiplist", test_skiplist, NULL, "Skip Lists", NULL);
AddTest("refstr", test_refstr, NULL, "Reference Counted Strings", NULL);
diff --git a/test/testhdf5.h b/test/testhdf5.h
index f3cb995..5fb01a8 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -203,7 +203,6 @@ extern "C" {
/* Prototypes for the test routines */
void test_metadata(void);
void test_checksum(void);
-void test_tst(void);
void test_heap(void);
void test_refstr(void);
void test_file(void);
diff --git a/test/theap.c b/test/theap.c
index f8a6e9b..9d5787b 100644
--- a/test/theap.c
+++ b/test/theap.c
@@ -1050,7 +1050,7 @@ test_heap_term(void)
HDfree(inc_sort_num);
if (dec_sort_num)
HDfree(dec_sort_num);
-} /* end test_tst_term() */
+} /* end test_heap_term() */
/****************************************************************
**
diff --git a/test/tmisc.c b/test/tmisc.c
index 7741da4..b078eed 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -4088,9 +4088,31 @@ test_misc23(void)
H5E_END_TRY;
VERIFY(tmp_id, FAIL, "H5Gcreate1");
- tmp_id = H5Gcreate1(file_id, "/A/grp", (size_t)0);
+ /* Make sure that size_hint values that can't fit into a 32-bit
+ * unsigned integer are rejected. Only necessary on systems where
+ * size_t is a 64-bit type.
+ */
+ if (SIZE_MAX > UINT32_MAX) {
+ H5E_BEGIN_TRY
+ {
+ tmp_id = H5Gcreate1(file_id, "/size_hint_too_large", SIZE_MAX);
+ }
+ H5E_END_TRY;
+ VERIFY(tmp_id, FAIL, "H5Gcreate1");
+ }
+
+ /* Make sure the largest size_hint value works */
+ H5E_BEGIN_TRY
+ {
+ tmp_id = H5Gcreate1(file_id, "/largest_size_hint", UINT32_MAX);
+ }
+ H5E_END_TRY;
CHECK(tmp_id, FAIL, "H5Gcreate1");
+ status = H5Gclose(tmp_id);
+ CHECK(status, FAIL, "H5Gclose");
+ tmp_id = H5Gcreate1(file_id, "/A/grp", (size_t)0);
+ CHECK(tmp_id, FAIL, "H5Gcreate1");
status = H5Gclose(tmp_id);
CHECK(status, FAIL, "H5Gclose");
@@ -4103,7 +4125,6 @@ test_misc23(void)
tmp_id = H5Dcreate1(file_id, "/A/dset", type_id, space_id, create_id);
CHECK(tmp_id, FAIL, "H5Dcreate1");
-
status = H5Dclose(tmp_id);
CHECK(status, FAIL, "H5Dclose");
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/test/ttst.c b/test/ttst.c
deleted file mode 100644
index 07f118c..0000000
--- a/test/ttst.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://www.hdfgroup.org/licenses. *
- * If you do not have access to either file, you may request a copy from *
- * help@hdfgroup.org. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*
- FILE
- tst.c
- Test HDF Ternary Search Tree (tst) routines.
-
- REMARKS
-
- DESIGN
-
- BUGS/LIMITATIONS
-
- EXPORTED ROUTINES
-
- AUTHOR
- Quincey Koziol
-
- MODIFICATION HISTORY
- 12/9/02 - Started coding
- */
-
-#include "testhdf5.h"
-#include "H5STprivate.h"
-
-/* Test words to insert into s TST */
-static const char *words[] = {
- "We", "hold", "these", "truths", "to", "be", "self-evident,",
- "that", "all", "men", "are", "created", "equal,", "that",
- "they", "are", "endowed", "by", "their", "Creator", "with",
- "certain", "unalienable", "Rights,", "that", "among", "these", "are",
- "Life,", "Liberty", "and", "the", "pursuit", "of", "Happiness."};
-/* Number of words in test words set */
-size_t num_words;
-
-/* Number of unique words in test word set */
-size_t num_uniq_words;
-/* Unique words in test word set */
-char **uniq_words;
-/* Randomized order version of words in test word set */
-char **rand_uniq_words;
-/* Sorted order version of words in test word set */
-char **sort_uniq_words;
-
-static int
-tst_strcmp(const void *_s1, const void *_s2)
-{
- return (HDstrcmp(*(const char *const *)_s1, *(const char *const *)_s2));
-}
-
-/****************************************************************
-**
-** test_tst_init(): Test basic H5ST (ternary search tree) selection code.
-** Initialize data for TST testing
-**
-****************************************************************/
-static void
-test_tst_init(void)
-{
- time_t curr_time; /* Current time, for seeding random number generator */
- char * tmp_word; /* Temporary pointer to word in word set */
- size_t u, v, w; /* Local index variables */
-
- /* Compute the number of words in the test set */
- num_words = sizeof(words) / sizeof(words[0]);
-
- /* Determine the number of unique words in test set */
- /* (Not particularly efficient, be careful if many words are added to set) */
- num_uniq_words = 0;
- for (u = 0; u < num_words; u++) {
- /* Assume word is unique */
- num_uniq_words++;
- for (v = 0; v < u; v++)
- /* If word is already found in words looked at, decrement unique count */
- if (!HDstrcmp(words[u], words[v])) {
- num_uniq_words--;
- break;
- } /* end if */
- } /* end for */
-
- /* Allocate space for the array of unique words */
- uniq_words = (char **)HDmalloc(sizeof(char *) * num_uniq_words);
-
- /* Allocate space for the array of randomized order unique words also */
- rand_uniq_words = (char **)HDmalloc(sizeof(char *) * num_uniq_words);
-
- /* Allocate space for the array of sorted order unique words also */
- sort_uniq_words = (char **)HDmalloc(sizeof(char *) * num_uniq_words);
-
- /* Insert unique words from test set into unique word set */
- w = 0;
- for (u = 0; u < num_words; u++) {
- /* Assume word is unique */
- tmp_word = (char *)words[u];
- for (v = 0; v < u; v++)
- /* If word is already found in words looked at, decrement unique count */
- if (!HDstrcmp(words[u], words[v])) {
- tmp_word = NULL;
- break;
- } /* end if */
-
- /* Check if word was actually unique */
- if (tmp_word != NULL)
- uniq_words[w++] = tmp_word;
- } /* end for */
-
- /* Create randomized set of unique words */
- for (u = 0; u < num_uniq_words; u++)
- rand_uniq_words[u] = uniq_words[u];
- curr_time = HDtime(NULL);
- HDsrandom((unsigned)curr_time);
- for (u = 0; u < num_uniq_words; u++) {
- v = u + ((size_t)HDrandom() % (num_uniq_words - u));
- if (u != v) {
- tmp_word = rand_uniq_words[u];
- rand_uniq_words[u] = rand_uniq_words[v];
- rand_uniq_words[v] = tmp_word;
- } /* end if */
- } /* end for */
-
- /* Create sorted set of unique words */
- for (u = 0; u < num_uniq_words; u++)
- sort_uniq_words[u] = uniq_words[u];
- HDqsort(sort_uniq_words, num_uniq_words, sizeof(char *), tst_strcmp);
-} /* end test_tst_init() */
-
-/****************************************************************
-**
-** test_tst_create(): Test basic H5ST (ternary search tree) selection code.
-** Tests creating and closing TSTs.
-**
-****************************************************************/
-static void
-test_tst_create(void)
-{
- H5ST_tree_t *tree; /* TST created */
- herr_t ret; /* Generic return value */
-
- /* Output message about test being performed */
- MESSAGE(5, ("Testing Creating & Closing TSTs\n"));
-
- /* Try closing a NULL tree */
- tree = NULL;
- ret = H5ST_close(tree);
- VERIFY(ret, FAIL, "H5ST_close");
-
- /* Try creating a TST */
- tree = H5ST_create();
- CHECK_PTR(tree, "H5ST_create");
-
- /* Try closing a real tree */
- ret = H5ST_close(tree);
- CHECK(ret, FAIL, "H5ST_close");
-
-} /* end test_tst_create() */
-
-/****************************************************************
-**
-** test_tst_insert(): Test basic H5ST (ternary search tree) selection code.
-** Tests inserting key/value pairs into TST
-**
-****************************************************************/
-static void
-test_tst_insert(void)
-{
- H5ST_tree_t *tree; /* TST created */
- H5ST_ptr_t found; /* Pointer to TST node found */
- void * obj; /* Pointer to object located in TST */
- size_t u; /* Local index counter */
- htri_t check; /* Is string in TST? */
- herr_t ret; /* Generic return value */
-
- /* Output message about test being performed */
- MESSAGE(5, ("Testing Inserting Values into TSTs\n"));
-
- /* Create the TST */
- tree = H5ST_create();
- CHECK_PTR(tree, "H5ST_create");
-
- /* Insert unique words into TST, in random order */
- for (u = 0; u < num_uniq_words; u++) {
- ret = H5ST_insert(tree, rand_uniq_words[u], rand_uniq_words[u]);
- CHECK(ret, FAIL, "H5ST_insert");
- } /* end for */
-
- /* Verify that all words were inserted into TST properly */
- for (u = 0; u < num_uniq_words; u++) {
- /* Check that the word is present */
- check = H5ST_search(tree, uniq_words[u]);
- VERIFY(check, TRUE, "H5ST_search");
-
- /* Check that the value "payloads" are correct */
- found = H5ST_find(tree, uniq_words[u]);
- CHECK_PTR(found, "H5ST_find");
-
- if (HDstrcmp((const char *)found->eqkid, uniq_words[u]) != 0)
- TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, uniq_words[%u]=%s\n", __LINE__,
- (char *)found->eqkid, (unsigned)u, uniq_words[u]);
-
- obj = H5ST_locate(tree, uniq_words[u]);
- CHECK_PTR(obj, "H5ST_locate");
-
- if (HDstrcmp((const char *)obj, uniq_words[u]) != 0)
- TestErrPrintf("%d: TST objects don't match!, obj=%s, uniq_words[%u]=%s\n", __LINE__, (char *)obj,
- (unsigned)u, uniq_words[u]);
- } /* end for */
-
- /* Verify that words not in the TST aren't found */
- check = H5ST_search(tree, "foo");
- VERIFY(check, FALSE, "H5ST_search");
- check = H5ST_search(tree, "bar");
- VERIFY(check, FALSE, "H5ST_search");
- check = H5ST_search(tree, "baz");
- VERIFY(check, FALSE, "H5ST_search");
-
- /* Close the TST */
- ret = H5ST_close(tree);
- CHECK(ret, FAIL, "H5ST_close");
-} /* end test_tst_insert() */
-
-/****************************************************************
-**
-** test_tst_iterate(): Test basic H5ST (ternary search tree) code.
-** Tests iterating through key/value pairs in TST
-**
-****************************************************************/
-static void
-test_tst_iterate(void)
-{
- H5ST_tree_t *tree; /* TST created */
- H5ST_ptr_t found; /* Pointer to TST node found */
- size_t u; /* Local index counter */
- herr_t ret; /* Generic return value */
-
- /* Output message about test being performed */
- MESSAGE(5, ("Testing Iterating Over TSTs\n"));
-
- /* Create the TST */
- tree = H5ST_create();
- CHECK_PTR(tree, "H5ST_create");
-
- /* Insert unique words into TST, in random order */
- for (u = 0; u < num_uniq_words; u++) {
- ret = H5ST_insert(tree, rand_uniq_words[u], rand_uniq_words[u]);
- CHECK(ret, FAIL, "H5ST_insert");
- } /* end for */
-
- /* Use findfirst/findnext calls to iterate through TST */
- found = H5ST_findfirst(tree);
- CHECK_PTR(found, "H5ST_findfirst");
- u = 0;
- do {
- /* Check that the strings in the TST are in the correct order */
- if (HDstrcmp((const char *)found->eqkid, sort_uniq_words[u]) != 0)
- TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, sort_uniq_words[%u]=%s\n",
- __LINE__, (char *)found->eqkid, (unsigned)u, sort_uniq_words[u]);
-
- /* Advance to next string in TST */
- found = H5ST_findnext(found);
- u++;
- } while (found != NULL);
-
- /* Close the TST */
- ret = H5ST_close(tree);
- CHECK(ret, FAIL, "H5ST_close");
-} /* end test_tst_iterate() */
-
-/****************************************************************
-**
-** test_tst_remove(): Test basic H5ST (ternary search tree) code.
-** Tests removing key/value pairs by string value in TST
-**
-****************************************************************/
-static void
-test_tst_remove(void)
-{
- H5ST_tree_t *tree; /* TST created */
- H5ST_ptr_t found; /* Pointer to TST node found */
- void * obj; /* Pointer to object removed from TST */
- htri_t check; /* Is string in TST? */
- size_t u; /* Local index counter */
- herr_t ret; /* Generic return value */
-
- /* Output message about test being performed */
- MESSAGE(5, ("Testing Removing String Values from TSTs\n"));
-
- /* Create the TST */
- tree = H5ST_create();
- CHECK_PTR(tree, "H5ST_create");
-
- /* Insert unique words into TST, in random order */
- for (u = 0; u < num_uniq_words; u++) {
- ret = H5ST_insert(tree, rand_uniq_words[u], rand_uniq_words[u]);
- CHECK(ret, FAIL, "H5ST_insert");
- } /* end for */
-
- /* Remove strings from TST in random order */
- for (u = 0; u < num_uniq_words; u++) {
- obj = H5ST_remove(tree, rand_uniq_words[u]);
- CHECK_PTR(obj, "H5ST_remove");
-
- /* Check that the correct string was removed from TST */
- if (HDstrcmp((const char *)obj, rand_uniq_words[u]) != 0)
- TestErrPrintf("%d: TST node values don't match!, obj=%s, rand_uniq_words[%u]=%s\n", __LINE__,
- (char *)obj, (unsigned)u, rand_uniq_words[u]);
-
- /* Check that the string can't be found in the TST any longer */
- check = H5ST_search(tree, rand_uniq_words[u]);
- VERIFY(check, FALSE, "H5ST_search");
- } /* end for */
-
- /* Re-insert unique words into TST, in random order */
- for (u = 0; u < num_uniq_words; u++) {
- ret = H5ST_insert(tree, rand_uniq_words[u], rand_uniq_words[u]);
- CHECK(ret, FAIL, "H5ST_insert");
- } /* end for */
-
- /* Remove TST nodes from TST in random order */
- for (u = 0; u < num_uniq_words; u++) {
- /* Get the pointer to the node to delete */
- found = H5ST_find(tree, rand_uniq_words[u]);
- CHECK_PTR(found, "H5ST_find");
-
- /* Check that the correct object will be removed from TST */
- if (HDstrcmp((const char *)found->eqkid, rand_uniq_words[u]) != 0)
- TestErrPrintf("%d: TST node values don't match!, found->eqkid=%s, rand_uniq_words[%u]=%s\n",
- __LINE__, (char *)found->eqkid, (unsigned)u, rand_uniq_words[u]);
-
- /* Remove the node */
- ret = H5ST_delete(tree, found);
- CHECK(ret, FAIL, "H5ST_delete");
-
- /* Check that the string can't be found in the TST any longer */
- check = H5ST_search(tree, rand_uniq_words[u]);
- VERIFY(check, FALSE, "H5ST_search");
- } /* end for */
-
- /* Close the TST */
- ret = H5ST_close(tree);
- CHECK(ret, FAIL, "H5ST_close");
-} /* end test_tst_remove() */
-
-/****************************************************************
-**
-** test_tst_finalize(): Test basic H5ST (ternary search tree) selection code.
-** Wrap up data for TST testing
-**
-****************************************************************/
-static void
-test_tst_finalize(void)
-{
- /* Release memory for unordered, randomized and sorted order unique words */
- HDfree(uniq_words);
- HDfree(rand_uniq_words);
- HDfree(sort_uniq_words);
-} /* end test_tst_finalize() */
-
-/****************************************************************
-**
-** test_tst(): Main H5ST selection testing routine.
-**
-****************************************************************/
-void
-test_tst(void)
-{
- /* Output message about test being performed */
- MESSAGE(5, ("Testing Ternary Search Trees\n"));
-
- /* Initialize TST testing data */
- test_tst_init();
-
- /* Actual TST tests */
- test_tst_create(); /* Test TST creation */
- test_tst_insert(); /* Test TST insertion */
- test_tst_iterate(); /* Test TST iteration */
- test_tst_remove(); /* Test TST deletion */
-
- /* Finalize TST testing data */
- test_tst_finalize();
-} /* end test_tst() */
diff --git a/test/vfd.c b/test/vfd.c
index f129c5d..237086a 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -1835,12 +1835,23 @@ test_log(void)
hsize_t file_size = 0;
unsigned int flags = H5FD_LOG_ALL;
size_t buf_size = 4 * KB;
+ herr_t ret = SUCCEED;
TESTING("LOG file driver");
- /* Set property list and file name for log driver. */
if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
+
+ /* Make sure calling with an invalid fapl doesn't crash */
+ H5E_BEGIN_TRY
+ {
+ ret = H5Pset_fapl_log(H5I_INVALID_HID, LOG_FILENAME, 0, 0);
+ }
+ H5E_END_TRY;
+ if (SUCCEED == ret)
+ TEST_ERROR;
+
+ /* Set property list and file name for log driver. */
if (H5Pset_fapl_log(fapl, LOG_FILENAME, flags, buf_size) < 0)
TEST_ERROR;
h5_fixname(FILENAME[6], fapl, filename, sizeof filename);
diff --git a/testpar/t_dset.c b/testpar/t_dset.c
index 3e4a304..bbd4b28 100644
--- a/testpar/t_dset.c
+++ b/testpar/t_dset.c
@@ -1627,9 +1627,6 @@ extend_writeInd(void)
VRFY((mem_dataspace >= 0), "");
/* Try write to dataset2 beyond its current dim sizes. Should fail. */
- /* Temporary turn off auto error reporting */
- H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
/* create a file dataspace independently */
file_dataspace = H5Dget_space(dataset2);
@@ -1638,11 +1635,13 @@ extend_writeInd(void)
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* write data independently. Should fail. */
- ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1);
+ H5E_BEGIN_TRY
+ {
+ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, H5P_DEFAULT, data_array1);
+ }
+ H5E_END_TRY
VRFY((ret < 0), "H5Dwrite failed as expected");
- /* restore auto error reporting */
- H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data);
H5Sclose(file_dataspace);
/* Extend dataset2 and try again. Should succeed. */
@@ -1911,20 +1910,19 @@ extend_readInd(void)
VRFY((dataset2 >= 0), "");
/* Try extend dataset1 which is open RDONLY. Should fail. */
- /* first turn off auto error reporting */
- H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
file_dataspace = H5Dget_space(dataset1);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sget_simple_extent_dims(file_dataspace, dims, NULL);
VRFY((ret > 0), "H5Sget_simple_extent_dims succeeded");
dims[0]++;
- ret = H5Dset_extent(dataset1, dims);
+ H5E_BEGIN_TRY
+ {
+ ret = H5Dset_extent(dataset1, dims);
+ }
+ H5E_END_TRY
VRFY((ret < 0), "H5Dset_extent failed as expected");
- /* restore auto error reporting */
- H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data);
H5Sclose(file_dataspace);
/* Read dataset1 using BYROW pattern */
@@ -2209,9 +2207,6 @@ extend_writeAll(void)
}
/* Try write to dataset2 beyond its current dim sizes. Should fail. */
- /* Temporary turn off auto error reporting */
- H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
/* create a file dataspace independently */
file_dataspace = H5Dget_space(dataset2);
@@ -2220,11 +2215,13 @@ extend_writeAll(void)
VRFY((ret >= 0), "H5Sset_hyperslab succeeded");
/* write data independently. Should fail. */
- ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
+ H5E_BEGIN_TRY
+ {
+ ret = H5Dwrite(dataset2, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1);
+ }
+ H5E_END_TRY
VRFY((ret < 0), "H5Dwrite failed as expected");
- /* restore auto error reporting */
- H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data);
H5Sclose(file_dataspace);
/* Extend dataset2 and try again. Should succeed. */
@@ -2331,20 +2328,19 @@ extend_readAll(void)
VRFY((dataset2 >= 0), "");
/* Try extend dataset1 which is open RDONLY. Should fail. */
- /* first turn off auto error reporting */
- H5Eget_auto2(H5E_DEFAULT, &old_func, &old_client_data);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
file_dataspace = H5Dget_space(dataset1);
VRFY((file_dataspace >= 0), "H5Dget_space succeeded");
ret = H5Sget_simple_extent_dims(file_dataspace, dims, NULL);
VRFY((ret > 0), "H5Sget_simple_extent_dims succeeded");
dims[0]++;
- ret = H5Dset_extent(dataset1, dims);
+ H5E_BEGIN_TRY
+ {
+ ret = H5Dset_extent(dataset1, dims);
+ }
+ H5E_END_TRY
VRFY((ret < 0), "H5Dset_extent failed as expected");
- /* restore auto error reporting */
- H5Eset_auto2(H5E_DEFAULT, old_func, old_client_data);
H5Sclose(file_dataspace);
/* Read dataset1 using BYROW pattern */
@@ -3321,14 +3317,23 @@ test_actual_io_mode(int selection_mode)
/* Release some resources */
ret = H5Sclose(sid);
+ VRFY((ret >= 0), "H5Sclose succeeded");
ret = H5Pclose(fapl);
+ VRFY((ret >= 0), "H5Pclose succeeded");
ret = H5Pclose(dcpl);
+ VRFY((ret >= 0), "H5Pclose succeeded");
ret = H5Pclose(dxpl_write);
+ VRFY((ret >= 0), "H5Pclose succeeded");
ret = H5Pclose(dxpl_read);
+ VRFY((ret >= 0), "H5Pclose succeeded");
ret = H5Dclose(dataset);
+ VRFY((ret >= 0), "H5Dclose succeeded");
ret = H5Sclose(mem_space);
+ VRFY((ret >= 0), "H5Sclose succeeded");
ret = H5Sclose(file_space);
+ VRFY((ret >= 0), "H5Sclose succeeded");
ret = H5Fclose(fid);
+ VRFY((ret >= 0), "H5Fclose succeeded");
HDfree(buffer);
return;
}
@@ -3344,9 +3349,7 @@ void
actual_io_mode_tests(void)
{
int mpi_size = -1;
- int mpi_rank = -1;
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
- MPI_Comm_size(MPI_COMM_WORLD, &mpi_rank);
test_actual_io_mode(TEST_ACTUAL_IO_NO_COLLECTIVE);
@@ -4112,13 +4115,15 @@ dataset_atomicity(void)
if (MAINPROCESS) {
fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT);
VRFY((fid >= 0), "H5Fopen succeeed");
- }
- /* should fail */
- ret = H5Fset_mpi_atomicity(fid, TRUE);
- VRFY((ret == FAIL), "H5Fset_mpi_atomicity failed");
+ /* should fail */
+ H5E_BEGIN_TRY
+ {
+ ret = H5Fset_mpi_atomicity(fid, TRUE);
+ }
+ H5E_END_TRY
+ VRFY((ret == FAIL), "H5Fset_mpi_atomicity failed");
- if (MAINPROCESS) {
ret = H5Fclose(fid);
VRFY((ret >= 0), "H5Fclose succeeded");
}
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index f5b9e63..e24e1e4 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -33,9 +33,6 @@ int ngroups = 512; /* number of groups to create in root
int facc_type = FACC_MPIO; /*Test file access type */
int dxfer_coll_type = DXFER_COLLECTIVE_IO;
-H5E_auto2_t old_func; /* previous error handler */
-void * old_client_data; /* previous error handler arg.*/
-
/* other option flags */
/* FILENAME and filenames must have the same number of names.
diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h
index bd8de08..007fac0 100644
--- a/testpar/testphdf5.h
+++ b/testpar/testphdf5.h
@@ -225,13 +225,11 @@ typedef enum {
} ShapeSameTestMethods;
/* Shared global variables */
-extern int dim0, dim1; /*Dataset dimensions */
-extern int chunkdim0, chunkdim1; /*Chunk dimensions */
-extern int nerrors; /*errors count */
-extern H5E_auto2_t old_func; /* previous error handler */
-extern void * old_client_data; /*previous error handler arg.*/
-extern int facc_type; /*Test file access type */
-extern int dxfer_coll_type;
+extern int dim0, dim1; /*Dataset dimensions */
+extern int chunkdim0, chunkdim1; /*Chunk dimensions */
+extern int nerrors; /*errors count */
+extern int facc_type; /*Test file access type */
+extern int dxfer_coll_type;
/* Test program prototypes */
void test_plist_ed(void);