summaryrefslogtreecommitdiffstats
path: root/test/getname.c
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2006-07-31 19:46:16 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2006-07-31 19:46:16 (GMT)
commitbeb04ae817268a49656b5abe043627dcbba15e5d (patch)
tree557b0c0908867dbb7185c3954626b2a2da3bcaf4 /test/getname.c
parent70b46a1d89e7f9f4a82748a9e1cc21fb4f121ebe (diff)
downloadhdf5-beb04ae817268a49656b5abe043627dcbba15e5d.zip
hdf5-beb04ae817268a49656b5abe043627dcbba15e5d.tar.gz
hdf5-beb04ae817268a49656b5abe043627dcbba15e5d.tar.bz2
[svn-r12519] Fixed "make check-vfd"
"make check-vfd" will now run all tests in the test directory with different file drivers (at least, all of those tests that use the testing framework's FAPL). Tests that fail will be skipped. This is not a perfect fix, but is better than nothing. Along with this change, check-vfd should be added to the Daily Tests.
Diffstat (limited to 'test/getname.c')
-rw-r--r--test/getname.c3071
1 files changed, 1540 insertions, 1531 deletions
diff --git a/test/getname.c b/test/getname.c
index d5404cc..e52a654 100644
--- a/test/getname.c
+++ b/test/getname.c
@@ -96,947 +96,951 @@ int main( void )
hid_t space_id;
hid_t type_id, type2_id;
hsize_t dims[1] = { 5 };
+ const char *envval = NULL;
- /* Name length */
- size_t name_len;
+ envval = HDgetenv("HDF5_DRIVER");
+ if (envval == NULL)
+ envval = "nomatch";
+ if (HDstrcmp(envval, "split")) {
+ /* Name length */
+ size_t name_len;
- /* Reset the library and get the file access property list */
- h5_reset();
- fapl = h5_fileaccess();
+ /* Reset the library and get the file access property list */
+ h5_reset();
+ fapl = h5_fileaccess();
- /* Initialize the file names */
- h5_fixname(FILENAME[0], fapl, filename0, sizeof filename0);
- h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1);
- h5_fixname(FILENAME[2], fapl, filename2, sizeof filename2);
- h5_fixname(FILENAME[3], fapl, filename3, sizeof filename3);
+ /* Initialize the file names */
+ h5_fixname(FILENAME[0], fapl, filename0, sizeof filename0);
+ h5_fixname(FILENAME[1], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[2], fapl, filename2, sizeof filename2);
+ h5_fixname(FILENAME[3], fapl, filename3, sizeof filename3);
- /* Create a new file_id using default properties. */
- if ((file_id = H5Fcreate( filename0, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR;
+ /* Create a new file_id using default properties. */
+ if ((file_id = H5Fcreate( filename0, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR;
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Gcreate, one group
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Gcreate, one group
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Gcreate, one group");
+ TESTING("H5Iget_name with H5Gcreate, one group");
- /* Create group "g0" in the root group using absolute name */
- if ((group_id = H5Gcreate( file_id, "/g0", 0 ))<0) TEST_ERROR;
+ /* Create group "g0" in the root group using absolute name */
+ if ((group_id = H5Gcreate( file_id, "/g0", 0 ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "/g0", "/g0") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g0", "/g0") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
+ /* Close */
+ H5Gclose( group_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Gcreate, more than one group
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Gcreate, more than one group
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Gcreate, more than one group");
+ TESTING("H5Iget_name with H5Gcreate, more than one group");
+ /* Create group "g1" in the root group using absolute name */
+ if ((group_id = H5Gcreate( file_id, "/g1", 0 ))<0) TEST_ERROR;
- /* Create group "g1" in the root group using absolute name */
- if ((group_id = H5Gcreate( file_id, "/g1", 0 ))<0) TEST_ERROR;
+ /* Create group "g2" in group "g1" using absolute name */
+ if ((group2_id = H5Gcreate( file_id, "/g1/g2", 0 ))<0) TEST_ERROR;
- /* Create group "g2" in group "g1" using absolute name */
- if ((group2_id = H5Gcreate( file_id, "/g1/g2", 0 ))<0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR;
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
-
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Gopen
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Gopen
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Gopen");
+ TESTING("H5Iget_name with H5Gopen");
- /* Reopen the group */
- if ((group_id = H5Gopen( file_id, "/g1" ))<0) TEST_ERROR;
+ /* Reopen the group */
+ if ((group_id = H5Gopen( file_id, "/g1" ))<0) TEST_ERROR;
- /* Reopen the group */
- if ((group2_id = H5Gopen( file_id, "/g1/g2" ))<0) TEST_ERROR;
+ /* Reopen the group */
+ if ((group2_id = H5Gopen( file_id, "/g1/g2" ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Dcreate
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Dcreate
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Dcreate");
+ TESTING("H5Iget_name with H5Dcreate");
- /* Create the dataspace */
- if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR;
+ /* Create the dataspace */
+ if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR;
- /* Create a new dataset */
- if ((dataset_id = H5Dcreate( file_id , "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
+ /* Create a new dataset */
+ if ((dataset_id = H5Dcreate( file_id , "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(dataset_id, "/d1", "/d1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(dataset_id, "/d1", "/d1") < 0) TEST_ERROR;
- /* Close */
- H5Dclose( dataset_id );
+ /* Close */
+ H5Dclose( dataset_id );
- /* Reopen the group */
- if ((group_id = H5Gopen( file_id, "g1" ))<0) TEST_ERROR;
+ /* Reopen the group */
+ if ((group_id = H5Gopen( file_id, "g1" ))<0) TEST_ERROR;
- /* Create a new dataset inside "g1" */
- if ((dataset_id = H5Dcreate( group_id , "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
+ /* Create a new dataset inside "g1" */
+ if ((dataset_id = H5Dcreate( group_id , "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(dataset_id, "/g1/d1", "/g1/d1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(dataset_id, "/g1/d1", "/g1/d1") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Dclose( dataset_id );
- H5Sclose( space_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Dclose( dataset_id );
+ H5Sclose( space_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Dopen
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Dopen
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Dopen");
+ TESTING("H5Iget_name with H5Dopen");
- /* Reopen the dataset */
- if ((dataset_id = H5Dopen( file_id, "d1"))<0) TEST_ERROR;
+ /* Reopen the dataset */
+ if ((dataset_id = H5Dopen( file_id, "d1"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(dataset_id, "/d1", "/d1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(dataset_id, "/d1", "/d1") < 0) TEST_ERROR;
- /* Close */
- H5Dclose( dataset_id );
+ /* Close */
+ H5Dclose( dataset_id );
- /* Reopen the group */
- if ((group_id = H5Gopen( file_id, "g1" ))<0) TEST_ERROR;
+ /* Reopen the group */
+ if ((group_id = H5Gopen( file_id, "g1" ))<0) TEST_ERROR;
- /* Reopen the dataset */
- if ((dataset_id = H5Dopen( group_id, "d1"))<0) TEST_ERROR;
+ /* Reopen the dataset */
+ if ((dataset_id = H5Dopen( group_id, "d1"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(dataset_id, "/g1/d1", "/g1/d1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(dataset_id, "/g1/d1", "/g1/d1") < 0) TEST_ERROR;
- /* Close */
- H5Dclose( dataset_id );
- H5Gclose( group_id );
+ /* Close */
+ H5Dclose( dataset_id );
+ H5Gclose( group_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with a long path
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with a long path
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with a long path");
+ TESTING("H5Iget_name with a long path");
- /* Create group "g2/bar/baz" */
- if ((group_id = H5Gcreate( file_id, "g2", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "g2/bar", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file_id, "g2/bar/baz", 0 ))<0) TEST_ERROR;
+ /* Create group "g2/bar/baz" */
+ if ((group_id = H5Gcreate( file_id, "g2", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "g2/bar", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file_id, "g2/bar/baz", 0 ))<0) TEST_ERROR;
- /* Create a dataset */
- if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR;
- if ((dataset_id = H5Dcreate( group3_id , "d1", H5T_NATIVE_INT, space_id,
- H5P_DEFAULT ))<0) TEST_ERROR;
+ /* Create a dataset */
+ if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR;
+ if ((dataset_id = H5Dcreate( group3_id , "d1", H5T_NATIVE_INT, space_id,
+ H5P_DEFAULT ))<0) TEST_ERROR;
- /* Close */
- H5Dclose( dataset_id );
- H5Sclose( space_id );
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Dclose( dataset_id );
+ H5Sclose( space_id );
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Reopen the dataset */
- if ((dataset_id = H5Dopen( file_id, "/g2/bar/baz/d1"))<0) TEST_ERROR;
+ /* Reopen the dataset */
+ if ((dataset_id = H5Dopen( file_id, "/g2/bar/baz/d1"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(dataset_id, "/g2/bar/baz/d1", "/g2/bar/baz/d1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(dataset_id, "/g2/bar/baz/d1", "/g2/bar/baz/d1") < 0) TEST_ERROR;
- /* Close */
- H5Dclose( dataset_id );
+ /* Close */
+ H5Dclose( dataset_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Tcommit
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Tcommit
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Tcommit");
+ TESTING("H5Iget_name with H5Tcommit");
- /* Create a datatype */
- if ((type_id = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)))<0) TEST_ERROR;
+ /* Create a datatype */
+ if ((type_id = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)))<0) TEST_ERROR;
- /* Insert fields */
- if (H5Tinsert (type_id, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT)<0) TEST_ERROR;
- if (H5Tinsert (type_id, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT)<0) TEST_ERROR;
- if (H5Tinsert (type_id, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT)<0) TEST_ERROR;
+ /* Insert fields */
+ if (H5Tinsert (type_id, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT)<0) TEST_ERROR;
+ if (H5Tinsert (type_id, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT)<0) TEST_ERROR;
+ if (H5Tinsert (type_id, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT)<0) TEST_ERROR;
- /* Save datatype for later */
- if (H5Tcommit (file_id, "t1", type_id)<0) TEST_ERROR;
+ /* Save datatype for later */
+ if (H5Tcommit (file_id, "t1", type_id)<0) TEST_ERROR;
- /* Verify */
- if(check_name(type_id, "/t1", "/t1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(type_id, "/t1", "/t1") < 0) TEST_ERROR;
- /* Close datatype */
- H5Tclose(type_id);
+ /* Close datatype */
+ H5Tclose(type_id);
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Topen
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Topen
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Topen");
+ TESTING("H5Iget_name with H5Topen");
- /* Open the named datatype */
- if((type_id=H5Topen(file_id, "t1"))<0) TEST_ERROR;
+ /* Open the named datatype */
+ if((type_id=H5Topen(file_id, "t1"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(type_id, "/t1", "/t1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(type_id, "/t1", "/t1") < 0) TEST_ERROR;
- /* Close datatype */
- H5Tclose(type_id);
+ /* Close datatype */
+ H5Tclose(type_id);
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Gmove and H5Gopen
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Gmove and H5Gopen
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Gmove and H5Gopen");
+ TESTING("H5Iget_name with H5Gmove and H5Gopen");
- /* Reopen the group */
- if ((group_id = H5Gopen( file_id, "/g1" ))<0) TEST_ERROR;
+ /* Reopen the group */
+ if ((group_id = H5Gopen( file_id, "/g1" ))<0) TEST_ERROR;
- /* Rename group */
- if (H5Gmove( file_id, "/g1", "/g1a" )<0) TEST_ERROR;
+ /* Rename group */
+ if (H5Gmove( file_id, "/g1", "/g1a" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "/g1a", "/g1a") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g1a", "/g1a") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
+ /* Close */
+ H5Gclose( group_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Gmove and H5Dopen
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Gmove and H5Dopen
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Gmove and H5Dopen");
+ TESTING("H5Iget_name with H5Gmove and H5Dopen");
- /* Reopen the dataset */
- if ((dataset_id = H5Dopen( file_id, "/d1"))<0) TEST_ERROR;
+ /* Reopen the dataset */
+ if ((dataset_id = H5Dopen( file_id, "/d1"))<0) TEST_ERROR;
- /* Rename dataset */
- if (H5Gmove( file_id, "/d1", "/d1a" )<0) TEST_ERROR;
+ /* Rename dataset */
+ if (H5Gmove( file_id, "/d1", "/d1a" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(dataset_id, "/d1a", "/d1a") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(dataset_id, "/d1a", "/d1a") < 0) TEST_ERROR;
- /* Close */
- H5Dclose( dataset_id );
+ /* Close */
+ H5Dclose( dataset_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Gmove and H5Topen
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Gmove and H5Topen
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Gmove and H5Topen");
+ TESTING("H5Iget_name with H5Gmove and H5Topen");
- /* Open the named datatype */
- if((type_id=H5Topen(file_id, "/t1"))<0) TEST_ERROR;
+ /* Open the named datatype */
+ if((type_id=H5Topen(file_id, "/t1"))<0) TEST_ERROR;
- /* Rename datatype */
- if (H5Gmove( file_id, "/t1", "/t1a" )<0) TEST_ERROR;
+ /* Rename datatype */
+ if (H5Gmove( file_id, "/t1", "/t1a" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(type_id, "/t1a", "/t1a") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(type_id, "/t1a", "/t1a") < 0) TEST_ERROR;
- /* Close datatype */
- H5Tclose(type_id);
+ /* Close datatype */
+ H5Tclose(type_id);
- PASSED();
+ PASSED();
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Gmove and relative names
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Gmove and relative names
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Gmove and relative names");
+ TESTING("H5Iget_name with H5Gmove and relative names");
- /* Create group "/g3" */
- if ((group_id = H5Gcreate( file_id, "/g3", 0 ))<0) TEST_ERROR;
+ /* Create group "/g3" */
+ if ((group_id = H5Gcreate( file_id, "/g3", 0 ))<0) TEST_ERROR;
- /* Create group "/g3/foo" using absolute name */
- if ((group2_id = H5Gcreate( file_id, "/g3/foo1", 0 ))<0) TEST_ERROR;
+ /* Create group "/g3/foo" using absolute name */
+ if ((group2_id = H5Gcreate( file_id, "/g3/foo1", 0 ))<0) TEST_ERROR;
- /* Open group "/g3/foo" again */
- if ((group3_id = H5Gopen( file_id, "/g3/foo1"))<0) TEST_ERROR;
+ /* Open group "/g3/foo" again */
+ if ((group3_id = H5Gopen( file_id, "/g3/foo1"))<0) TEST_ERROR;
- /* Rename group */
- if (H5Gmove( group_id, "foo1", "foo2" )<0) TEST_ERROR;
+ /* Rename group */
+ if (H5Gmove( group_id, "foo1", "foo2" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "/g3", "/g3") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g3", "/g3") < 0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g3/foo2", "/g3/foo2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g3/foo2", "/g3/foo2") < 0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "/g3/foo2", "/g3/foo2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "/g3/foo2", "/g3/foo2") < 0) TEST_ERROR;
- /* Rename group again */
- if (H5Gmove( file_id, "g3/foo2", "g3/foo1" )<0) TEST_ERROR;
+ /* Rename group again */
+ if (H5Gmove( file_id, "g3/foo2", "g3/foo1" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "/g3", "/g3") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g3", "/g3") < 0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g3/foo1", "/g3/foo1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g3/foo1", "/g3/foo1") < 0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "/g3/foo1", "/g3/foo1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "/g3/foo1", "/g3/foo1") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Gmove and a long path
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Gmove and a long path
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Gmove and a long path");
+ TESTING("H5Iget_name with H5Gmove and a long path");
- /* Create group "g4/A/B" */
- if ((group_id = H5Gcreate( file_id, "g4", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "g4/A", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file_id, "g4/A/B", 0 ))<0) TEST_ERROR;
+ /* Create group "g4/A/B" */
+ if ((group_id = H5Gcreate( file_id, "g4", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "g4/A", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file_id, "g4/A/B", 0 ))<0) TEST_ERROR;
- /* Create group "g5/C" */
- if ((group4_id = H5Gcreate( file_id, "g5", 0 ))<0) TEST_ERROR;
- if ((group5_id = H5Gcreate( file_id, "g5/C", 0 ))<0) TEST_ERROR;
+ /* Create group "g5/C" */
+ if ((group4_id = H5Gcreate( file_id, "g5", 0 ))<0) TEST_ERROR;
+ if ((group5_id = H5Gcreate( file_id, "g5/C", 0 ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "/g4/A/B", "/g4/A/B") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "/g4/A/B", "/g4/A/B") < 0) TEST_ERROR;
- /* Move group "B" to "D"*/
- if (H5Gmove( file_id, "/g4/A/B", "/g5/C/D" )<0) TEST_ERROR;
+ /* Move group "B" to "D"*/
+ if (H5Gmove( file_id, "/g4/A/B", "/g5/C/D" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "/g5/C/D", "/g5/C/D") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "/g5/C/D", "/g5/C/D") < 0) TEST_ERROR;
- /* Move group "/g5/C/D" back to "/g4/A/B" using relative name */
- if (H5Gmove2( group5_id, "D", group2_id, "B" )<0) TEST_ERROR;
+ /* Move group "/g5/C/D" back to "/g4/A/B" using relative name */
+ if (H5Gmove2( group5_id, "D", group2_id, "B" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "/g4/A/B", "/g4/A/B") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "/g4/A/B", "/g4/A/B") < 0) TEST_ERROR;
- /* Move group "/g4/A/B" to "/g4/F/B" using relative name */
- if (H5Gmove2( group_id, "A", group_id, "F")<0) TEST_ERROR;
+ /* Move group "/g4/A/B" to "/g4/F/B" using relative name */
+ if (H5Gmove2( group_id, "A", group_id, "F")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "/g4/F/B", "/g4/F/B") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "/g4/F/B", "/g4/F/B") < 0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g4/F", "/g4/F") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g4/F", "/g4/F") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
- H5Gclose( group4_id );
- H5Gclose( group5_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
+ H5Gclose( group4_id );
+ H5Gclose( group5_id );
- PASSED();
+ PASSED();
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Gmove and a long path #2
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with H5Gmove and a long path #2
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Gmove and a long path #2");
+ TESTING("H5Iget_name with H5Gmove and a long path #2");
- /* Create group "g6/A/B" and "g7" */
- if ((group_id = H5Gcreate( file_id, "g6", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "g6/A", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file_id, "g6/A/B", 0 ))<0) TEST_ERROR;
- if ((group4_id = H5Gcreate( file_id, "g7", 0 ))<0) TEST_ERROR;
+ /* Create group "g6/A/B" and "g7" */
+ if ((group_id = H5Gcreate( file_id, "g6", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "g6/A", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file_id, "g6/A/B", 0 ))<0) TEST_ERROR;
+ if ((group4_id = H5Gcreate( file_id, "g7", 0 ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "/g6/A/B", "/g6/A/B") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "/g6/A/B", "/g6/A/B") < 0) TEST_ERROR;
- /* Move group "A" to "C"*/
- if (H5Gmove( file_id, "/g6/A", "/g7/C" )<0) TEST_ERROR;
+ /* Move group "A" to "C"*/
+ if (H5Gmove( file_id, "/g6/A", "/g7/C" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g7/C", "/g7/C") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g7/C", "/g7/C") < 0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "/g7/C/B", "/g7/C/B") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "/g7/C/B", "/g7/C/B") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
- H5Gclose( group4_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
+ H5Gclose( group4_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Gunlink
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Gunlink
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Gunlink");
+ TESTING("H5Iget_name with H5Gunlink");
- /* Create a new group. */
- if ((group_id = H5Gcreate( file_id, "/g8", 0 ))<0) TEST_ERROR;
+ /* Create a new group. */
+ if ((group_id = H5Gcreate( file_id, "/g8", 0 ))<0) TEST_ERROR;
- /* Delete */
- if (H5Gunlink( file_id, "/g8")<0) TEST_ERROR;
+ /* Delete */
+ if (H5Gunlink( file_id, "/g8")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "", "") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
+ /* Close */
+ H5Gclose( group_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Gunlink and a long path
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Gunlink and a long path
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Gunlink and a long path");
+ TESTING("H5Iget_name with H5Gunlink and a long path");
- /* Create group "g9/a/b" */
- if ((group_id = H5Gcreate( file_id, "g9", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "g9/a", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file_id, "g9/a/b", 0 ))<0) TEST_ERROR;
+ /* Create group "g9/a/b" */
+ if ((group_id = H5Gcreate( file_id, "g9", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "g9/a", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file_id, "g9/a/b", 0 ))<0) TEST_ERROR;
- /* Delete */
- if (H5Gunlink( file_id, "/g9/a")<0) TEST_ERROR;
+ /* Delete */
+ if (H5Gunlink( file_id, "/g9/a")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "", "") < 0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "", "") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Recreate groups */
- if ((group2_id = H5Gcreate( group_id, "a", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( group_id, "a/b", 0 ))<0) TEST_ERROR;
+ /* Recreate groups */
+ if ((group2_id = H5Gcreate( group_id, "a", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( group_id, "a/b", 0 ))<0) TEST_ERROR;
- /* Delete, using relative path */
- if (H5Gunlink( group_id, "a")<0) TEST_ERROR;
+ /* Delete, using relative path */
+ if (H5Gunlink( group_id, "a")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "", "") < 0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "", "") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Close */
- H5Gclose( group_id );
+ /* Close */
+ H5Gclose( group_id );
- /* Create group "g10/a/b" */
- if ((group_id = H5Gcreate( file_id, "g10", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "g10/a", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file_id, "g10/a/b", 0 ))<0) TEST_ERROR;
+ /* Create group "g10/a/b" */
+ if ((group_id = H5Gcreate( file_id, "g10", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "g10/a", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file_id, "g10/a/b", 0 ))<0) TEST_ERROR;
- /* Delete */
- if (H5Gunlink( file_id, "/g10/a/b")<0) TEST_ERROR;
+ /* Delete */
+ if (H5Gunlink( file_id, "/g10/a/b")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "", "") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group3_id );
- /* Recreate group */
- if ((group3_id = H5Gcreate( group_id, "a/b", 0 ))<0) TEST_ERROR;
+ /* Recreate group */
+ if ((group3_id = H5Gcreate( group_id, "a/b", 0 ))<0) TEST_ERROR;
- /* Delete, using relative path */
- if (H5Gunlink( group_id, "a/b")<0) TEST_ERROR;
+ /* Delete, using relative path */
+ if (H5Gunlink( group_id, "a/b")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "", "") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group3_id );
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Gunlink, same names
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Gunlink, same names
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Gunlink, same names");
+ TESTING("H5Iget_name with H5Gunlink, same names");
- /* Create group "g11/g" */
- if ((group_id = H5Gcreate( file_id, "g11", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "g11/g", 0 ))<0) TEST_ERROR;
+ /* Create group "g11/g" */
+ if ((group_id = H5Gcreate( file_id, "g11", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "g11/g", 0 ))<0) TEST_ERROR;
- /* Create two datasets "g11/d" and "g11/g/d"*/
- if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR;
- if ((dataset_id = H5Dcreate( group_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
- if ((dataset2_id = H5Dcreate( group2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
+ /* Create two datasets "g11/d" and "g11/g/d"*/
+ if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR;
+ if ((dataset_id = H5Dcreate( group_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
+ if ((dataset2_id = H5Dcreate( group2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
- /* Delete */
- if (H5Gunlink( file_id, "/g11/d")<0) TEST_ERROR;
+ /* Delete */
+ if (H5Gunlink( file_id, "/g11/d")<0) TEST_ERROR;
- /* Verify */
- if(check_name(dataset_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(dataset_id, "", "") < 0) TEST_ERROR;
- /* Verify */
- if(check_name(dataset2_id, "/g11/g/d", "/g11/g/d") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(dataset2_id, "/g11/g/d", "/g11/g/d") < 0) TEST_ERROR;
- /* Close */
- H5Dclose( dataset_id );
- H5Dclose( dataset2_id );
- H5Sclose( space_id );
- H5Gclose( group_id );
- H5Gclose( group2_id );
+ /* Close */
+ H5Dclose( dataset_id );
+ H5Dclose( dataset2_id );
+ H5Sclose( space_id );
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Fmount; with IDs on the list
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Fmount; with IDs on the list
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Fmount; with IDs on the list");
+ TESTING("H5Iget_name with H5Fmount; with IDs on the list");
- /* Create a group "g12" in the first file */
- if ((group_id = H5Gcreate( file_id, "/g12", 0 ))<0) TEST_ERROR;
+ /* Create a group "g12" in the first file */
+ if ((group_id = H5Gcreate( file_id, "/g12", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
+ /* Close */
+ H5Gclose( group_id );
- /* Create second file and dataset "d" in it */
- file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ /* Create second file and dataset "d" in it */
+ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- /* Create a dataspace */
- if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR;
+ /* Create a dataspace */
+ if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR;
- /* Create the dataset */
- if ((dataset_id = H5Dcreate( file1_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
+ /* Create the dataset */
+ if ((dataset_id = H5Dcreate( file1_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
- /* Close */
- H5Dclose( dataset_id );
+ /* Close */
+ H5Dclose( dataset_id );
- /* Mount second file under "g12" in the first file */
- if (H5Fmount(file_id, "/g12", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
+ /* Mount second file under "g12" in the first file */
+ if (H5Fmount(file_id, "/g12", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
- /* Access dataset D in the first file under "/G/D" name */
- if ((dataset_id = H5Dopen( file_id, "/g12/d"))<0) TEST_ERROR;
+ /* Access dataset D in the first file under "/G/D" name */
+ if ((dataset_id = H5Dopen( file_id, "/g12/d"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(dataset_id, "/g12/d", "/g12/d") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(dataset_id, "/g12/d", "/g12/d") < 0) TEST_ERROR;
- if (H5Funmount(file_id, "/g12")<0) TEST_ERROR;
+ if (H5Funmount(file_id, "/g12")<0) TEST_ERROR;
- /* Close */
- H5Dclose( dataset_id );
- H5Fclose( file1_id );
- H5Sclose( space_id );
+ /* Close */
+ H5Dclose( dataset_id );
+ H5Fclose( file1_id );
+ H5Sclose( space_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Fmount; long name
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Fmount; long name
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Fmount; long name");
+ TESTING("H5Iget_name with H5Fmount; long name");
- /* Create a group "g13/g1/g2" in the first file */
- if ((group_id = H5Gcreate( file_id, "/g13", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "/g13/g1", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file_id, "/g13/g1/g2", 0 ))<0) TEST_ERROR;
+ /* Create a group "g13/g1/g2" in the first file */
+ if ((group_id = H5Gcreate( file_id, "/g13", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "/g13/g1", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file_id, "/g13/g1/g2", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Create second file and group "g" in it */
- file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ /* Create second file and group "g" in it */
+ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group_id = H5Gcreate( file1_id, "/g14", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file1_id, "/g14/g3", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file1_id, "/g14/g3/g4", 0 ))<0) TEST_ERROR;
+ if ((group_id = H5Gcreate( file1_id, "/g14", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file1_id, "/g14/g3", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file1_id, "/g14/g3/g4", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Mount second file under "/g13/g1" in the first file */
- if (H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
+ /* Mount second file under "/g13/g1" in the first file */
+ if (H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
- /* Access group in the first file */
- if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR;
+ /* Access group in the first file */
+ if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR;
- if (H5Funmount(file_id, "/g13/g1")<0) TEST_ERROR;
+ if (H5Funmount(file_id, "/g13/g1")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "", "") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
+ /* Close */
+ H5Gclose( group_id );
- /* Access group in the file to mount */
- if ((group3_id = H5Gopen( file1_id, "/g14/g3/g4"))<0) TEST_ERROR;
+ /* Access group in the file to mount */
+ if ((group3_id = H5Gopen( file1_id, "/g14/g3/g4"))<0) TEST_ERROR;
- /* Mount second file under "/g13/g1" in the first file (again) */
- if (H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
+ /* Mount second file under "/g13/g1" in the first file (again) */
+ if (H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
- /* Get a group ID for the parent of the newly mounted group */
- if ((group2_id = H5Gopen( file_id, "/g13"))<0) TEST_ERROR;
+ /* Get a group ID for the parent of the newly mounted group */
+ if ((group2_id = H5Gopen( file_id, "/g13"))<0) TEST_ERROR;
- /* Access group in the first file */
- if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR;
+ /* Access group in the first file */
+ if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR;
- if(check_name(group3_id, "/g14/g3/g4", "/g14/g3/g4") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR;
+ if(check_name(group3_id, "/g14/g3/g4", "/g14/g3/g4") < 0) TEST_ERROR;
- if (H5Funmount(group2_id, "g1")<0) TEST_ERROR;
+ if (H5Funmount(group2_id, "g1")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "", "") < 0) TEST_ERROR;
- if(check_name(group3_id, "/g14/g3/g4", "/g14/g3/g4") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group3_id, "/g14/g3/g4", "/g14/g3/g4") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Mount second file under "/g13/g1" in the first file (again) */
- if (H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
+ /* Mount second file under "/g13/g1" in the first file (again) */
+ if (H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
- /* Get a group ID for the newly mounted group */
- if ((group2_id = H5Gopen( file_id, "/g13/g1"))<0) TEST_ERROR;
+ /* Get a group ID for the newly mounted group */
+ if ((group2_id = H5Gopen( file_id, "/g13/g1"))<0) TEST_ERROR;
- /* Access group in the first file */
- if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR;
+ /* Access group in the first file */
+ if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR;
- if(check_name(group2_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR;
+ if(check_name(group2_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR;
- if (H5Funmount(group2_id, ".")<0) TEST_ERROR;
+ if (H5Funmount(group2_id, ".")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "", "") < 0) TEST_ERROR;
- if(check_name(group2_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group2_id, "", "") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
- /* Mount second file under "/g13/g1" in the first file, using relative path */
+ /* Mount second file under "/g13/g1" in the first file, using relative path */
- if ((group3_id = H5Gopen( file_id, "/g13"))<0) TEST_ERROR;
+ if ((group3_id = H5Gopen( file_id, "/g13"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "/g13", "/g13") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "/g13", "/g13") < 0) TEST_ERROR;
- if (H5Fmount(group3_id, "g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
+ if (H5Fmount(group3_id, "g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
- /* Get a group ID for the newly mounted group */
- if ((group2_id = H5Gopen( file_id, "/g13/g1"))<0) TEST_ERROR;
+ /* Get a group ID for the newly mounted group */
+ if ((group2_id = H5Gopen( file_id, "/g13/g1"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR;
- /* Access group in the first file */
- if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR;
+ /* Access group in the first file */
+ if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
+ /* Close */
+ H5Gclose( group_id );
- /* Access group in the first file, with relative path */
- if ((group_id = H5Gopen( group2_id, "g14/g3/g4"))<0) TEST_ERROR;
+ /* Access group in the first file, with relative path */
+ if ((group_id = H5Gopen( group2_id, "g14/g3/g4"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
+ /* Close */
+ H5Gclose( group_id );
- if (H5Funmount(group2_id, ".")<0) TEST_ERROR;
+ if (H5Funmount(group2_id, ".")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "", "") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Mount second file under "/g13/g1" in the first file, using relative path */
+ /* Mount second file under "/g13/g1" in the first file, using relative path */
- if ((group3_id = H5Gopen( file_id, "/g13/g1"))<0) TEST_ERROR;
+ if ((group3_id = H5Gopen( file_id, "/g13/g1"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR;
- if (H5Fmount(group3_id, ".", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
+ if (H5Fmount(group3_id, ".", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
- /* Get a group ID for the newly mounted group */
- if ((group2_id = H5Gopen( file_id, "/g13/g1"))<0) TEST_ERROR;
+ /* Get a group ID for the newly mounted group */
+ if ((group2_id = H5Gopen( file_id, "/g13/g1"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR;
- /* Access group in the first file */
- if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR;
+ /* Access group in the first file */
+ if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
+ /* Close */
+ H5Gclose( group_id );
- /* Access group in the first file, with relative path */
- if ((group_id = H5Gopen( group2_id, "g14/g3/g4"))<0) TEST_ERROR;
+ /* Access group in the first file, with relative path */
+ if ((group_id = H5Gopen( group2_id, "g14/g3/g4"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
+ /* Close */
+ H5Gclose( group_id );
- if (H5Funmount(group2_id, ".")<0) TEST_ERROR;
+ if (H5Funmount(group2_id, ".")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "", "") < 0) TEST_ERROR;
- if(check_name(group3_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group3_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- H5Fclose( file1_id );
+ H5Fclose( file1_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Funmount
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Funmount
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Funmount");
+ TESTING("H5Iget_name with H5Funmount");
- /* Create a group "g15/g1/g2" in the first file */
- if ((group_id = H5Gcreate( file_id, "/g15", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "/g15/g1", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file_id, "/g15/g1/g2", 0 ))<0) TEST_ERROR;
- if ((group4_id = H5Gcreate( file_id, "/g15/g1/g2/g3", 0 ))<0) TEST_ERROR;
+ /* Create a group "g15/g1/g2" in the first file */
+ if ((group_id = H5Gcreate( file_id, "/g15", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "/g15/g1", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file_id, "/g15/g1/g2", 0 ))<0) TEST_ERROR;
+ if ((group4_id = H5Gcreate( file_id, "/g15/g1/g2/g3", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
- H5Gclose( group4_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
+ H5Gclose( group4_id );
- /* Create second file and group "g" in it */
- file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ /* Create second file and group "g" in it */
+ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group_id = H5Gcreate( file1_id, "/g16", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file1_id, "/g16/g4", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file1_id, "/g16/g4/g5", 0 ))<0) TEST_ERROR;
+ if ((group_id = H5Gcreate( file1_id, "/g16", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file1_id, "/g16/g4", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file1_id, "/g16/g4/g5", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Access group in the first file */
- if ((group_id = H5Gopen( file_id, "/g15/g1/g2/g3"))<0) TEST_ERROR;
+ /* Access group in the first file */
+ if ((group_id = H5Gopen( file_id, "/g15/g1/g2/g3"))<0) TEST_ERROR;
- /* Mount second file under "/g13/g1" in the first file */
- if (H5Fmount(file_id, "/g15/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
+ /* Mount second file under "/g13/g1" in the first file */
+ if (H5Fmount(file_id, "/g15/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
- /* Access group in the second file */
- if ((group2_id = H5Gopen( file_id, "/g15/g1/g16/g4/g5"))<0) TEST_ERROR;
+ /* Access group in the second file */
+ if ((group2_id = H5Gopen( file_id, "/g15/g1/g16/g4/g5"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "", "/g15/g1/g2/g3") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "", "/g15/g1/g2/g3") < 0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g15/g1/g16/g4/g5", "/g15/g1/g16/g4/g5") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g15/g1/g16/g4/g5", "/g15/g1/g16/g4/g5") < 0) TEST_ERROR;
- if (H5Funmount(file_id, "/g15/g1")<0) TEST_ERROR;
+ if (H5Funmount(file_id, "/g15/g1")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "/g15/g1/g2/g3", "/g15/g1/g2/g3") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g15/g1/g2/g3", "/g15/g1/g2/g3") < 0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "", "") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Fclose( file1_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Fclose( file1_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with a defined type dataset
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with a defined type dataset
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with a defined type dataset");
+ TESTING("H5Iget_name with a defined type dataset");
- /* Create a datatype */
- if ((type_id = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)))<0) TEST_ERROR;
+ /* Create a datatype */
+ if ((type_id = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)))<0) TEST_ERROR;
- /* Insert fields */
- if (H5Tinsert (type_id, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT)<0) TEST_ERROR;
- if (H5Tinsert (type_id, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT)<0) TEST_ERROR;
- if (H5Tinsert (type_id, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT)<0) TEST_ERROR;
+ /* Insert fields */
+ if (H5Tinsert (type_id, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT)<0) TEST_ERROR;
+ if (H5Tinsert (type_id, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT)<0) TEST_ERROR;
+ if (H5Tinsert (type_id, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT)<0) TEST_ERROR;
- /* Create group "g17" */
- if ((group_id = H5Gcreate( file_id, "g17", 0 ))<0) TEST_ERROR;
+ /* Create group "g17" */
+ if ((group_id = H5Gcreate( file_id, "g17", 0 ))<0) TEST_ERROR;
- /* Save datatype for later */
- if (H5Tcommit (group_id, "t", type_id)<0) TEST_ERROR;
+ /* Save datatype for later */
+ if (H5Tcommit (group_id, "t", type_id)<0) TEST_ERROR;
- /* Create a dataspace */
- if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR;
+ /* Create a dataspace */
+ if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR;
- /* Create a new dataset */
- if ((dataset_id = H5Dcreate( group_id , "d", type_id, space_id,
- H5P_DEFAULT ))<0) TEST_ERROR;
+ /* Create a new dataset */
+ if ((dataset_id = H5Dcreate( group_id , "d", type_id, space_id,
+ H5P_DEFAULT ))<0) TEST_ERROR;
- /* Close */
- H5Dclose( dataset_id );
- H5Tclose( type_id );
- H5Sclose( space_id );
- H5Gclose( group_id );
+ /* Close */
+ H5Dclose( dataset_id );
+ H5Tclose( type_id );
+ H5Sclose( space_id );
+ H5Gclose( group_id );
- /* Open the named datatype */
- if((type_id=H5Topen(file_id, "/g17/t"))<0) TEST_ERROR;
+ /* Open the named datatype */
+ if((type_id=H5Topen(file_id, "/g17/t"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(type_id, "/g17/t", "/g17/t") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(type_id, "/g17/t", "/g17/t") < 0) TEST_ERROR;
- /* Close datatype */
- H5Tclose(type_id);
+ /* Close datatype */
+ H5Tclose(type_id);
- /* Reopen the dataset */
- if ((dataset_id = H5Dopen( file_id, "/g17/d"))<0) TEST_ERROR;
+ /* Reopen the dataset */
+ if ((dataset_id = H5Dopen( file_id, "/g17/d"))<0) TEST_ERROR;
- /* Get datatype*/
- if((type_id=H5Dget_type(dataset_id))<0) TEST_ERROR;
+ /* Get datatype*/
+ if((type_id=H5Dget_type(dataset_id))<0) TEST_ERROR;
- /* Verify */
- if(check_name(type_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(type_id, "", "") < 0) TEST_ERROR;
- /* Close */
- H5Dclose( dataset_id );
- H5Tclose( type_id );
+ /* Close */
+ H5Dclose( dataset_id );
+ H5Tclose( type_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with objects that have two names
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with objects that have two names
+ *-------------------------------------------------------------------------
+ */
TESTING("H5Iget_name with datasets that have two names");
@@ -1048,8 +1052,8 @@ if (H5Glink2(dataset_id,".",H5G_LINK_HARD,file_id,"/g17/link")<0) TEST_ERROR;
if ((dataset2_id = H5Dopen( file_id, "/g17/link"))<0) TEST_ERROR;
/* Make sure that the two IDs use two different names */
- if(check_name(dataset_id, "/g17/d", "/g17/d") < 0) TEST_ERROR;
- if(check_name(dataset2_id, "/g17/link", "/g17/link") < 0) TEST_ERROR;
+ if(check_name(dataset_id, "/g17/d", "/g17/d") < 0) TEST_ERROR;
+ if(check_name(dataset2_id, "/g17/link", "/g17/link") < 0) TEST_ERROR;
if(H5Dclose(dataset_id)<0) TEST_ERROR;
if(H5Dclose(dataset2_id)<0) TEST_ERROR;
@@ -1057,1328 +1061,1333 @@ if(H5Dclose(dataset2_id)<0) TEST_ERROR;
PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with different files, test1
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with different files, test1
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with different files");
+ TESTING("H5Iget_name with different files");
- /* Create a new file using default properties. */
- if ((file2_id = H5Fcreate( filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR;
+ /* Create a new file using default properties. */
+ if ((file2_id = H5Fcreate( filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR;
/* Create a new file using default properties. */
- if ((file3_id = H5Fcreate( filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR;
+ if ((file3_id = H5Fcreate( filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR;
- /* Create the dataspace */
- if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR;
+ /* Create the dataspace */
+ if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR;
- /* Create a new dataset */
- if ((dataset_id = H5Dcreate( file2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
+ /* Create a new dataset */
+ if ((dataset_id = H5Dcreate( file2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
- /* Create a new dataset */
- if ((dataset2_id = H5Dcreate( file3_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
+ /* Create a new dataset */
+ if ((dataset2_id = H5Dcreate( file3_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
- /* Delete */
- if (H5Gunlink( file2_id, "/d")<0) TEST_ERROR;
+ /* Delete */
+ if (H5Gunlink( file2_id, "/d")<0) TEST_ERROR;
- /* Verify */
- if(check_name(dataset_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(dataset_id, "", "") < 0) TEST_ERROR;
- /* Verify */
- if(check_name(dataset2_id, "/d", "/d") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(dataset2_id, "/d", "/d") < 0) TEST_ERROR;
- /* Close */
- H5Dclose( dataset_id );
- H5Dclose( dataset2_id );
- H5Sclose( space_id );
- H5Fclose( file2_id );
- H5Fclose( file3_id );
+ /* Close */
+ H5Dclose( dataset_id );
+ H5Dclose( dataset2_id );
+ H5Sclose( space_id );
+ H5Fclose( file2_id );
+ H5Fclose( file3_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with different files, test2
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with different files, test2
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with different files #2");
+ TESTING("H5Iget_name with different files #2");
- /* Create a new file using default properties. */
- if ((file2_id = H5Fcreate( filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR;
+ /* Create a new file using default properties. */
+ if ((file2_id = H5Fcreate( filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR;
/* Create a new file using default properties. */
- if ((file3_id = H5Fcreate( filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR;
+ if ((file3_id = H5Fcreate( filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR;
- /* Create the dataspace */
- if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR;
+ /* Create the dataspace */
+ if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR;
- /* Create a new dataset */
- if ((dataset_id = H5Dcreate( file2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
+ /* Create a new dataset */
+ if ((dataset_id = H5Dcreate( file2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
- /* Create a new dataset */
- if ((dataset2_id = H5Dcreate( file3_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
+ /* Create a new dataset */
+ if ((dataset2_id = H5Dcreate( file3_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
- /* Delete */
- if (H5Gunlink( file3_id, "/d")<0) TEST_ERROR;
+ /* Delete */
+ if (H5Gunlink( file3_id, "/d")<0) TEST_ERROR;
- /* Verify */
- if(check_name(dataset_id, "/d", "/d") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(dataset_id, "/d", "/d") < 0) TEST_ERROR;
- /* Verify */
- if(check_name(dataset2_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(dataset2_id, "", "") < 0) TEST_ERROR;
- /* Close */
- H5Dclose( dataset_id );
- H5Dclose( dataset2_id );
- H5Sclose( space_id );
- H5Fclose( file2_id );
- H5Fclose( file3_id );
+ /* Close */
+ H5Dclose( dataset_id );
+ H5Dclose( dataset2_id );
+ H5Sclose( space_id );
+ H5Fclose( file2_id );
+ H5Fclose( file3_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with a small buffer for name
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with a small buffer for name
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with a small buffer for name");
+ TESTING("H5Iget_name with a small buffer for name");
- /* Reopen the group */
- if ((group_id = H5Gopen( file_id, "/g17" ))<0) TEST_ERROR;
+ /* Reopen the group */
+ if ((group_id = H5Gopen( file_id, "/g17" ))<0) TEST_ERROR;
{
- /*small buffer to hold name and its size */
- char name2[SMALL_NAME_BUF_SIZE];
+ /*small buffer to hold name and its size */
+ char name2[SMALL_NAME_BUF_SIZE];
- /* Get name */
- name_len=H5Iget_name( group_id, name2, SMALL_NAME_BUF_SIZE );
+ /* Get name */
+ name_len=H5Iget_name( group_id, name2, SMALL_NAME_BUF_SIZE );
- /* Check that name is longer */
- if(name_len <= SMALL_NAME_BUF_SIZE) TEST_ERROR;
- if(HDstrcmp(name2, "/")) TEST_ERROR;
+ /* Check that name is longer */
+ if(name_len <= SMALL_NAME_BUF_SIZE) TEST_ERROR;
+ if(HDstrcmp(name2, "/")) TEST_ERROR;
}
- /* Verify */
- if(check_name(group_id, "/g17", "/g17") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g17", "/g17") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
+ /* Close */
+ H5Gclose( group_id );
- PASSED();
+ PASSED();
- /*-------------------------------------------------------------------------
- * Test H5Iget_name with a dynamic buffer for name
- *-------------------------------------------------------------------------
- */
+ /*-------------------------------------------------------------------------
+ * Test H5Iget_name with a dynamic buffer for name
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with a dynamic buffer for name");
+ TESTING("H5Iget_name with a dynamic buffer for name");
- /* Reopen the group */
- if ((group_id = H5Gopen( file_id, "/g17" ))<0) TEST_ERROR;
+ /* Reopen the group */
+ if ((group_id = H5Gopen( file_id, "/g17" ))<0) TEST_ERROR;
- /* Get name */
- name_len = H5Iget_name(group_id, NULL, NAME_BUF_SIZE);
+ /* Get name */
+ name_len = H5Iget_name(group_id, NULL, NAME_BUF_SIZE);
{
- /* dynamic buffer to hold name */
- char *name3;
+ /* dynamic buffer to hold name */
+ char *name3;
- /* Include the extra null character */
- name3 = HDmalloc(name_len + 1);
- if(!name3) TEST_ERROR;
+ /* Include the extra null character */
+ name3 = HDmalloc(name_len + 1);
+ if(!name3) TEST_ERROR;
- /* Get name with dynamic buffer */
- if(H5Iget_name(group_id, name3, name_len + 1) < 0) TEST_ERROR;
+ /* Get name with dynamic buffer */
+ if(H5Iget_name(group_id, name3, name_len + 1) < 0) TEST_ERROR;
- /* Verify */
- if(HDstrcmp(name3, "/g17")) TEST_ERROR;
- *name3 = '\0';
+ /* Verify */
+ if(HDstrcmp(name3, "/g17")) TEST_ERROR;
+ *name3 = '\0';
- /* Get name with smaller buffer */
- if(H5Iget_name(group_id, name3, 3) < 0) TEST_ERROR;
+ /* Get name with smaller buffer */
+ if(H5Iget_name(group_id, name3, 3) < 0) TEST_ERROR;
- /* Verify */
- if(HDstrcmp(name3, "/g")) TEST_ERROR;
+ /* Verify */
+ if(HDstrcmp(name3, "/g")) TEST_ERROR;
- HDfree(name3);
+ HDfree(name3);
}
- /* Close */
- H5Gclose( group_id );
+ /* Close */
+ H5Gclose( group_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with invalid IDs
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with invalid IDs
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with invalid IDs");
+ TESTING("H5Iget_name with invalid IDs");
- /* Create a dataspace */
- if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR;
+ /* Create a dataspace */
+ if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR;
- /* Define a datatype */
- if ((type_id = H5Tcopy(H5T_NATIVE_INT))<0) TEST_ERROR;
+ /* Define a datatype */
+ if ((type_id = H5Tcopy(H5T_NATIVE_INT))<0) TEST_ERROR;
- /* Create a new dataset */
- if ((dataset_id = H5Dcreate( file_id , "d2", type_id, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
+ /* Create a new dataset */
+ if ((dataset_id = H5Dcreate( file_id , "d2", type_id, space_id, H5P_DEFAULT ))<0) TEST_ERROR;
{
char name[NAME_BUF_SIZE]; /* Buffer to hold name and its size */
/* Get name for non commited datatype, it should fail */
H5E_BEGIN_TRY {
- if(H5Iget_name( type_id, name, NAME_BUF_SIZE) > 0) TEST_ERROR;
+ if(H5Iget_name( type_id, name, NAME_BUF_SIZE) > 0) TEST_ERROR;
} H5E_END_TRY;
/* Get name for dataspace, it should fail */
H5E_BEGIN_TRY {
- if(H5Iget_name( space_id, name, NAME_BUF_SIZE) > 0) TEST_ERROR;
+ if(H5Iget_name( space_id, name, NAME_BUF_SIZE) > 0) TEST_ERROR;
} H5E_END_TRY;
}
- /* Close */
- H5Dclose( dataset_id );
- H5Sclose( space_id );
- H5Tclose( type_id );
+ /* Close */
+ H5Dclose( dataset_id );
+ H5Sclose( space_id );
+ H5Tclose( type_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with added names with mounting
- *-------------------------------------------------------------------------
- */
-
- TESTING("H5Iget_name with added names with mounting");
-
- /* Create a group "g18/g2" in the first file */
- if ((group_id = H5Gcreate( file_id, "/g18", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "/g18/g2", 0 ))<0) TEST_ERROR;
-
- /* Also create a dataset and a datatype */
- if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR;
- if ((type_id = H5Tcopy(H5T_NATIVE_INT))<0) TEST_ERROR;
- if ((dataset_id = H5Dcreate( file_id, "g18/d2", type_id, space_id,
- H5P_DEFAULT ))<0) TEST_ERROR;
-
- if (H5Tcommit(file_id, "g18/t2", type_id) <0) TEST_ERROR;
-
- /* Create second file and group "/g3/g4/g5" in it */
- file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group3_id = H5Gcreate( file1_id, "/g3", 0 ))<0) TEST_ERROR;
- if ((group4_id = H5Gcreate( file1_id, "/g3/g4", 0 ))<0) TEST_ERROR;
- if ((group5_id = H5Gcreate( file1_id, "/g3/g4/g5", 0 ))<0) TEST_ERROR;
-
- /* Mount first file at "g3/g4" in the second file */
- if (H5Fmount(file1_id, "/g3/g4", file_id, H5P_DEFAULT)<0) TEST_ERROR;
-
- /* Get name for the group ID in the first file, should be "/g18/g2" still */
- if(check_name(group2_id, "/g18/g2", "/g18/g2") < 0) TEST_ERROR;
-
- /* Get name for the dataset ID in the first file, should be "/g18/g2/d2" still */
- if(check_name(dataset_id, "/g18/d2", "/g18/d2") < 0) TEST_ERROR;
-
- /* Get name for the datatype ID in the first file, should be "/g18/g2/t2" still */
- if(check_name(type_id, "/g18/t2", "/g18/t2") < 0) TEST_ERROR;
-
- /* Open the mounted group, dataset, and datatype through their new names */
- if ((group6_id = H5Gopen( file1_id, "/g3/g4/g18/g2" ))<0) TEST_ERROR;
- if ((dataset2_id = H5Dopen( file1_id, "/g3/g4/g18/d2" ))<0) TEST_ERROR;
- if ((type2_id = H5Topen( file1_id, "/g3/g4/g18/t2" ))<0) TEST_ERROR;
-
- /* Verify names */
- if(check_name(group6_id, "/g3/g4/g18/g2", "/g3/g4/g18/g2") < 0) TEST_ERROR;
- if(check_name(dataset2_id, "/g3/g4/g18/d2", "/g3/g4/g18/d2") < 0) TEST_ERROR;
- if(check_name(type2_id, "/g3/g4/g18/t2", "/g3/g4/g18/t2") < 0) TEST_ERROR;
-
- /* Verify that old IDs still refer to objects by their old names */
- if(check_name(group2_id, "/g18/g2", "/g18/g2") < 0) TEST_ERROR;
- if(check_name(dataset_id, "/g18/d2", "/g18/d2") < 0) TEST_ERROR;
- if(check_name(type_id, "/g18/t2", "/g18/t2") < 0) TEST_ERROR;
-
- /* Unmount */
- if (H5Funmount(file1_id, "/g3/g4")<0) TEST_ERROR;
-
- /* Get name for the IDs of the first file, should be unchanged */
- if(check_name(group2_id, "/g18/g2", "/g18/g2") < 0) TEST_ERROR;
- if(check_name(dataset_id, "/g18/d2", "/g18/d2") < 0) TEST_ERROR;
- if(check_name(type_id, "/g18/t2", "/g18/t2") < 0) TEST_ERROR;
-
- /* Get name for the IDs of the second file, should be "" */
- if(check_name(group6_id, "", "") < 0) TEST_ERROR;
- if(check_name(dataset2_id, "", "") < 0) TEST_ERROR;
- if(check_name(type2_id, "", "") < 0) TEST_ERROR;
-
- H5Tclose( type_id );
- H5Tclose( type2_id );
- H5Dclose( dataset_id );
- H5Dclose( dataset2_id );
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
- H5Gclose( group4_id );
- H5Gclose( group5_id );
- H5Gclose( group6_id );
- H5Fclose( file1_id );
+ * Test H5Iget_name with added names with mounting
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING("H5Iget_name with added names with mounting");
+
+ /* Create a group "g18/g2" in the first file */
+ if ((group_id = H5Gcreate( file_id, "/g18", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "/g18/g2", 0 ))<0) TEST_ERROR;
+
+ /* Also create a dataset and a datatype */
+ if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR;
+ if ((type_id = H5Tcopy(H5T_NATIVE_INT))<0) TEST_ERROR;
+ if ((dataset_id = H5Dcreate( file_id, "g18/d2", type_id, space_id,
+ H5P_DEFAULT ))<0) TEST_ERROR;
+
+ if (H5Tcommit(file_id, "g18/t2", type_id) <0) TEST_ERROR;
+
+ /* Create second file and group "/g3/g4/g5" in it */
+ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ if ((group3_id = H5Gcreate( file1_id, "/g3", 0 ))<0) TEST_ERROR;
+ if ((group4_id = H5Gcreate( file1_id, "/g3/g4", 0 ))<0) TEST_ERROR;
+ if ((group5_id = H5Gcreate( file1_id, "/g3/g4/g5", 0 ))<0) TEST_ERROR;
+
+ /* Mount first file at "g3/g4" in the second file */
+ if (H5Fmount(file1_id, "/g3/g4", file_id, H5P_DEFAULT)<0) TEST_ERROR;
+
+ /* Get name for the group ID in the first file, should be "/g18/g2" still */
+ if(check_name(group2_id, "/g18/g2", "/g18/g2") < 0) TEST_ERROR;
+
+ /* Get name for the dataset ID in the first file, should be "/g18/g2/d2" still */
+ if(check_name(dataset_id, "/g18/d2", "/g18/d2") < 0) TEST_ERROR;
+
+ /* Get name for the datatype ID in the first file, should be "/g18/g2/t2" still */
+ if(check_name(type_id, "/g18/t2", "/g18/t2") < 0) TEST_ERROR;
+
+ /* Open the mounted group, dataset, and datatype through their new names */
+ if ((group6_id = H5Gopen( file1_id, "/g3/g4/g18/g2" ))<0) TEST_ERROR;
+ if ((dataset2_id = H5Dopen( file1_id, "/g3/g4/g18/d2" ))<0) TEST_ERROR;
+ if ((type2_id = H5Topen( file1_id, "/g3/g4/g18/t2" ))<0) TEST_ERROR;
+
+ /* Verify names */
+ if(check_name(group6_id, "/g3/g4/g18/g2", "/g3/g4/g18/g2") < 0) TEST_ERROR;
+ if(check_name(dataset2_id, "/g3/g4/g18/d2", "/g3/g4/g18/d2") < 0) TEST_ERROR;
+ if(check_name(type2_id, "/g3/g4/g18/t2", "/g3/g4/g18/t2") < 0) TEST_ERROR;
+
+ /* Verify that old IDs still refer to objects by their old names */
+ if(check_name(group2_id, "/g18/g2", "/g18/g2") < 0) TEST_ERROR;
+ if(check_name(dataset_id, "/g18/d2", "/g18/d2") < 0) TEST_ERROR;
+ if(check_name(type_id, "/g18/t2", "/g18/t2") < 0) TEST_ERROR;
+
+ /* Unmount */
+ if (H5Funmount(file1_id, "/g3/g4")<0) TEST_ERROR;
+
+ /* Get name for the IDs of the first file, should be unchanged */
+ if(check_name(group2_id, "/g18/g2", "/g18/g2") < 0) TEST_ERROR;
+ if(check_name(dataset_id, "/g18/d2", "/g18/d2") < 0) TEST_ERROR;
+ if(check_name(type_id, "/g18/t2", "/g18/t2") < 0) TEST_ERROR;
+
+ /* Get name for the IDs of the second file, should be "" */
+ if(check_name(group6_id, "", "") < 0) TEST_ERROR;
+ if(check_name(dataset2_id, "", "") < 0) TEST_ERROR;
+ if(check_name(type2_id, "", "") < 0) TEST_ERROR;
+
+ H5Tclose( type_id );
+ H5Tclose( type2_id );
+ H5Dclose( dataset_id );
+ H5Dclose( dataset2_id );
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
+ H5Gclose( group4_id );
+ H5Gclose( group5_id );
+ H5Gclose( group6_id );
+ H5Fclose( file1_id );
PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Fclose
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Fclose
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Fclose");
+ TESTING("H5Iget_name with H5Fclose");
- /* Create a file and group "/g1/g2" in it */
- file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group_id = H5Gcreate( file1_id, "/g1", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file1_id, "/g1/g2", 0 ))<0) TEST_ERROR;
+ /* Create a file and group "/g1/g2" in it */
+ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ if ((group_id = H5Gcreate( file1_id, "/g1", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file1_id, "/g1/g2", 0 ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR;
- /* Close file */
- H5Fclose( file1_id );
+ /* Close file */
+ H5Fclose( file1_id );
- /* Verify */
- if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Fmount and H5Gunlink
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Fmount and H5Gunlink
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Fmount and H5Gunlink");
+ TESTING("H5Iget_name with H5Fmount and H5Gunlink");
- /* Create a file and group "/g1/g2" in it */
- file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group_id = H5Gcreate( file1_id, "/g1", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file1_id, "/g1/g2", 0 ))<0) TEST_ERROR;
+ /* Create a file and group "/g1/g2" in it */
+ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ if ((group_id = H5Gcreate( file1_id, "/g1", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file1_id, "/g1/g2", 0 ))<0) TEST_ERROR;
- /* Create a new file and group "/g3/g4" in it */
- if ((file2_id = H5Fcreate( filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file2_id, "/g3", 0 ))<0) TEST_ERROR;
- if ((group4_id = H5Gcreate( file2_id, "/g3/g4", 0 ))<0) TEST_ERROR;
+ /* Create a new file and group "/g3/g4" in it */
+ if ((file2_id = H5Fcreate( filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file2_id, "/g3", 0 ))<0) TEST_ERROR;
+ if ((group4_id = H5Gcreate( file2_id, "/g3/g4", 0 ))<0) TEST_ERROR;
- /* Mount first file at "/g3/g4" in the second file */
- if(H5Fmount(file2_id, "/g3/g4", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
+ /* Mount first file at "/g3/g4" in the second file */
+ if(H5Fmount(file2_id, "/g3/g4", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
- /* Open the mounted group */
- if ((group5_id = H5Gopen( file2_id, "/g3/g4/g1/g2" ))<0) TEST_ERROR;
+ /* Open the mounted group */
+ if ((group5_id = H5Gopen( file2_id, "/g3/g4/g1/g2" ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR;
- /* Delete */
- if (H5Gunlink( file1_id, "/g3/g4/g1/g2")<0) TEST_ERROR;
+ /* Delete */
+ if (H5Gunlink( file1_id, "/g3/g4/g1/g2")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group5_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group5_id, "", "") < 0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "", "") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
- H5Gclose( group4_id );
- H5Gclose( group5_id );
- H5Fclose( file1_id );
- H5Fclose( file2_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
+ H5Gclose( group4_id );
+ H5Gclose( group5_id );
+ H5Fclose( file1_id );
+ H5Fclose( file2_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Fmount and H5Gmove
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Fmount and H5Gmove
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Fmount and H5Gmove");
+ TESTING("H5Iget_name with H5Fmount and H5Gmove");
- /* Create a file and group "/g1/g2" in it */
- file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group_id = H5Gcreate( file1_id, "/g1", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file1_id, "/g1/g2", 0 ))<0) TEST_ERROR;
+ /* Create a file and group "/g1/g2" in it */
+ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ if ((group_id = H5Gcreate( file1_id, "/g1", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file1_id, "/g1/g2", 0 ))<0) TEST_ERROR;
- /* Create a new file and group "/g3/g4" in it */
- if ((file2_id = H5Fcreate( filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file2_id, "/g3", 0 ))<0) TEST_ERROR;
- if ((group4_id = H5Gcreate( file2_id, "/g3/g4", 0 ))<0) TEST_ERROR;
+ /* Create a new file and group "/g3/g4" in it */
+ if ((file2_id = H5Fcreate( filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file2_id, "/g3", 0 ))<0) TEST_ERROR;
+ if ((group4_id = H5Gcreate( file2_id, "/g3/g4", 0 ))<0) TEST_ERROR;
- /* Mount first file at "g3/g4" in the second file */
- if(H5Fmount(file2_id, "/g3/g4", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
+ /* Mount first file at "g3/g4" in the second file */
+ if(H5Fmount(file2_id, "/g3/g4", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
- /* Verify */
- if(check_name(group4_id, "/g3/g4", "/g3/g4") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group4_id, "/g3/g4", "/g3/g4") < 0) TEST_ERROR;
- /* Open the mounted group */
- if ((group5_id = H5Gopen( file2_id, "/g3/g4/g1/g2" ))<0) TEST_ERROR;
+ /* Open the mounted group */
+ if ((group5_id = H5Gopen( file2_id, "/g3/g4/g1/g2" ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR;
- /* Open another mounted group, in the middle of the path */
- if ((group6_id = H5Gopen( file2_id, "/g3/g4/g1" ))<0) TEST_ERROR;
+ /* Open another mounted group, in the middle of the path */
+ if ((group6_id = H5Gopen( file2_id, "/g3/g4/g1" ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR;
- /* Rename group */
- if (H5Gmove( file2_id, "/g3/g4/g1/g2", "/g3/g4/g1/g5" )<0) TEST_ERROR;
+ /* Rename group */
+ if (H5Gmove( file2_id, "/g3/g4/g1/g2", "/g3/g4/g1/g5" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group5_id, "/g3/g4/g1/g5", "/g3/g4/g1/g5") < 0) TEST_ERROR;
- if(check_name(group2_id, "/g1/g5", "/g1/g5") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group5_id, "/g3/g4/g1/g5", "/g3/g4/g1/g5") < 0) TEST_ERROR;
+ if(check_name(group2_id, "/g1/g5", "/g1/g5") < 0) TEST_ERROR;
- /* Rename group */
- if (H5Gmove( file2_id, "/g3/g4/g1", "/g3/g4/g1a" )<0) TEST_ERROR;
+ /* Rename group */
+ if (H5Gmove( file2_id, "/g3/g4/g1", "/g3/g4/g1a" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group5_id, "/g3/g4/g1a/g5", "/g3/g4/g1a/g5") < 0) TEST_ERROR;
- if(check_name(group2_id, "/g1a/g5", "/g1a/g5") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group5_id, "/g3/g4/g1a/g5", "/g3/g4/g1a/g5") < 0) TEST_ERROR;
+ if(check_name(group2_id, "/g1a/g5", "/g1a/g5") < 0) TEST_ERROR;
- /* Verify */
- if(check_name(group6_id, "/g3/g4/g1a", "/g3/g4/g1a") < 0) TEST_ERROR;
- if(check_name(group_id, "/g1a", "/g1a") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group6_id, "/g3/g4/g1a", "/g3/g4/g1a") < 0) TEST_ERROR;
+ if(check_name(group_id, "/g1a", "/g1a") < 0) TEST_ERROR;
- /* Rename middle group back, using relative path */
- if (H5Gmove( group3_id, "g4/g1a", "g4/g1" )<0) TEST_ERROR;
+ /* Rename middle group back, using relative path */
+ if (H5Gmove( group3_id, "g4/g1a", "g4/g1" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group5_id, "/g3/g4/g1/g5", "/g3/g4/g1/g5") < 0) TEST_ERROR;
- if(check_name(group2_id, "/g1/g5", "/g1/g5") < 0) TEST_ERROR;
- if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR;
- if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group5_id, "/g3/g4/g1/g5", "/g3/g4/g1/g5") < 0) TEST_ERROR;
+ if(check_name(group2_id, "/g1/g5", "/g1/g5") < 0) TEST_ERROR;
+ if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR;
+ if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR;
- /* Rename end group back, using relative path */
- if (H5Gmove( group3_id, "g4/g1/g5", "g4/g1/g2" )<0) TEST_ERROR;
+ /* Rename end group back, using relative path */
+ if (H5Gmove( group3_id, "g4/g1/g5", "g4/g1/g2" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR;
- if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR;
- if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR;
- if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR;
+ if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR;
+ if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR;
+ if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR;
- /* Rename mount point */
- if (H5Gmove( file2_id, "/g3/g4", "/g3/g4a" )<0) TEST_ERROR;
+ /* Rename mount point */
+ if (H5Gmove( file2_id, "/g3/g4", "/g3/g4a" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group4_id, "/g3/g4a", "/g3/g4a") < 0) TEST_ERROR;
- if(check_name(group5_id, "/g3/g4a/g1/g2", "/g3/g4a/g1/g2") < 0) TEST_ERROR;
- if(check_name(group6_id, "/g3/g4a/g1", "/g3/g4a/g1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group4_id, "/g3/g4a", "/g3/g4a") < 0) TEST_ERROR;
+ if(check_name(group5_id, "/g3/g4a/g1/g2", "/g3/g4a/g1/g2") < 0) TEST_ERROR;
+ if(check_name(group6_id, "/g3/g4a/g1", "/g3/g4a/g1") < 0) TEST_ERROR;
- /* Rename mount point back, using relative path*/
- if (H5Gmove( group3_id, "g4a", "g4" )<0) TEST_ERROR;
+ /* Rename mount point back, using relative path*/
+ if (H5Gmove( group3_id, "g4a", "g4" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group4_id, "/g3/g4", "/g3/g4") < 0) TEST_ERROR;
- if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR;
- if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group4_id, "/g3/g4", "/g3/g4") < 0) TEST_ERROR;
+ if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR;
+ if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
- H5Gclose( group4_id );
- H5Gclose( group5_id );
- H5Gclose( group6_id );
- H5Fclose( file1_id );
- H5Fclose( file2_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
+ H5Gclose( group4_id );
+ H5Gclose( group5_id );
+ H5Gclose( group6_id );
+ H5Fclose( file1_id );
+ H5Fclose( file2_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Glink hard
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Glink hard
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Glink hard");
+ TESTING("H5Iget_name with H5Glink hard");
- /* Create group "g19/g1" */
- if ((group_id = H5Gcreate( file_id, "/g19", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "/g19/g1", 0 ))<0) TEST_ERROR;
+ /* Create group "g19/g1" */
+ if ((group_id = H5Gcreate( file_id, "/g19", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "/g19/g1", 0 ))<0) TEST_ERROR;
- /* Create hard link to "g19/g1/ group */
- if (H5Glink(file_id, H5G_LINK_HARD, "/g19/g1", "/g19/g2")<0) TEST_ERROR;
+ /* Create hard link to "g19/g1/ group */
+ if (H5Glink(file_id, H5G_LINK_HARD, "/g19/g1", "/g19/g2")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR;
- /* Open the group */
- if ((group3_id = H5Gopen( file_id, "/g19/g2" ))<0) TEST_ERROR;
+ /* Open the group */
+ if ((group3_id = H5Gopen( file_id, "/g19/g2" ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR;
- /* Rename original group */
- if (H5Gmove( file_id, "/g19/g1", "/g19/g3" )<0) TEST_ERROR;
+ /* Rename original group */
+ if (H5Gmove( file_id, "/g19/g1", "/g19/g3" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR;
- if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR;
+ if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR;
- /* Rename original group back, using relative path */
- if (H5Gmove( group_id, "g3", "g1" )<0) TEST_ERROR;
+ /* Rename original group back, using relative path */
+ if (H5Gmove( group_id, "g3", "g1" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR;
- if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR;
+ if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR;
- /* Create another hard link to "/g19/g1" group */
- if (H5Glink(file_id, H5G_LINK_HARD, "/g19/g1", "/g19/g3")<0) TEST_ERROR;
+ /* Create another hard link to "/g19/g1" group */
+ if (H5Glink(file_id, H5G_LINK_HARD, "/g19/g1", "/g19/g3")<0) TEST_ERROR;
- /* Open the group */
- if ((group4_id = H5Gopen( file_id, "/g19/g3" ))<0) TEST_ERROR;
+ /* Open the group */
+ if ((group4_id = H5Gopen( file_id, "/g19/g3" ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group4_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group4_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR;
- /* Delete group */
- if (H5Gunlink( file_id, "/g19/g3")<0) TEST_ERROR;
+ /* Delete group */
+ if (H5Gunlink( file_id, "/g19/g3")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group4_id, "", "") < 0) TEST_ERROR;
- if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR;
- if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group4_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR;
+ if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR;
- /* Close the unlinked group */
- H5Gclose( group4_id );
+ /* Close the unlinked group */
+ H5Gclose( group4_id );
- /* Create another hard link to "/g19/g1" group */
- if (H5Glink(file_id, H5G_LINK_HARD, "/g19/g1", "/g19/g3")<0) TEST_ERROR;
+ /* Create another hard link to "/g19/g1" group */
+ if (H5Glink(file_id, H5G_LINK_HARD, "/g19/g1", "/g19/g3")<0) TEST_ERROR;
- /* Open the group */
- if ((group4_id = H5Gopen( file_id, "/g19/g3" ))<0) TEST_ERROR;
+ /* Open the group */
+ if ((group4_id = H5Gopen( file_id, "/g19/g3" ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group4_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group4_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR;
- /* Delete group, using relative path */
- if (H5Gunlink( group_id, "g3")<0) TEST_ERROR;
+ /* Delete group, using relative path */
+ if (H5Gunlink( group_id, "g3")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group4_id, "", "") < 0) TEST_ERROR;
- if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR;
- if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group4_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR;
+ if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR;
- /* Close the unlinked group */
- H5Gclose( group4_id );
+ /* Close the unlinked group */
+ H5Gclose( group4_id );
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Glink symbolic
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Glink symbolic
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Glink symbolic");
+ TESTING("H5Iget_name with H5Glink symbolic");
- /* Create group "g20/g1" */
- if ((group_id = H5Gcreate( file_id, "/g20", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "/g20/g1", 0 ))<0) TEST_ERROR;
+ /* Create group "g20/g1" */
+ if ((group_id = H5Gcreate( file_id, "/g20", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "/g20/g1", 0 ))<0) TEST_ERROR;
- /* Create symbolic link to "g20/g1/ group */
- if (H5Glink(file_id, H5G_LINK_SOFT, "/g20/g1", "/g20/g2")<0) TEST_ERROR;
+ /* Create symbolic link to "g20/g1/ group */
+ if (H5Glink(file_id, H5G_LINK_SOFT, "/g20/g1", "/g20/g2")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g20/g1", "/g20/g1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g20/g1", "/g20/g1") < 0) TEST_ERROR;
- /* Open the group */
- if ((group3_id = H5Gopen( file_id, "/g20/g2" ))<0) TEST_ERROR;
+ /* Open the group */
+ if ((group3_id = H5Gopen( file_id, "/g20/g2" ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "/g20/g2", "/g20/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "/g20/g2", "/g20/g2") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Glink symbolic and move target
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Glink symbolic and move target
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Glink symbolic and move target");
+ TESTING("H5Iget_name with H5Glink symbolic and move target");
- /* Create group "g21/g1" */
- if ((group_id = H5Gcreate( file_id, "/g21", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "/g21/g1", 0 ))<0) TEST_ERROR;
+ /* Create group "g21/g1" */
+ if ((group_id = H5Gcreate( file_id, "/g21", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "/g21/g1", 0 ))<0) TEST_ERROR;
- /* Create symbolic link to "g21/g1/ group */
- if (H5Glink(file_id, H5G_LINK_SOFT, "/g21/g1", "/g21/g2")<0) TEST_ERROR;
+ /* Create symbolic link to "g21/g1/ group */
+ if (H5Glink(file_id, H5G_LINK_SOFT, "/g21/g1", "/g21/g2")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g21/g1", "/g21/g1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g21/g1", "/g21/g1") < 0) TEST_ERROR;
- /* Open the group */
- if ((group3_id = H5Gopen( file_id, "/g21/g2" ))<0) TEST_ERROR;
+ /* Open the group */
+ if ((group3_id = H5Gopen( file_id, "/g21/g2" ))<0) TEST_ERROR;
- /* Rename group */
- if (H5Gmove( file_id, "/g21/g1", "/g21/g3" )<0) TEST_ERROR;
+ /* Rename group */
+ if (H5Gmove( file_id, "/g21/g1", "/g21/g3" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g21/g3", "/g21/g3") < 0) TEST_ERROR;
- if(check_name(group3_id, "/g21/g2", "/g21/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g21/g3", "/g21/g3") < 0) TEST_ERROR;
+ if(check_name(group3_id, "/g21/g2", "/g21/g2") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Glink symbolic and move source
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Glink symbolic and move source
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Glink symbolic and move source");
+ TESTING("H5Iget_name with H5Glink symbolic and move source");
- /* Create group "g22/g1" */
- if ((group_id = H5Gcreate( file_id, "/g22", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "/g22/g1", 0 ))<0) TEST_ERROR;
+ /* Create group "g22/g1" */
+ if ((group_id = H5Gcreate( file_id, "/g22", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "/g22/g1", 0 ))<0) TEST_ERROR;
- /* Create symbolic link to "g22/g1/ group */
- if (H5Glink(file_id, H5G_LINK_SOFT, "/g22/g1", "/g22/g2")<0) TEST_ERROR;
+ /* Create symbolic link to "g22/g1/ group */
+ if (H5Glink(file_id, H5G_LINK_SOFT, "/g22/g1", "/g22/g2")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g22/g1", "/g22/g1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g22/g1", "/g22/g1") < 0) TEST_ERROR;
- /* Open the group */
- if ((group3_id = H5Gopen( file_id, "/g22/g2" ))<0) TEST_ERROR;
+ /* Open the group */
+ if ((group3_id = H5Gopen( file_id, "/g22/g2" ))<0) TEST_ERROR;
- /* Rename soft link */
- if (H5Gmove( file_id, "/g22/g2", "/g22/g3" )<0) TEST_ERROR;
+ /* Rename soft link */
+ if (H5Gmove( file_id, "/g22/g2", "/g22/g3" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g22/g1", "/g22/g1") < 0) TEST_ERROR;
- if(check_name(group3_id, "/g22/g3", "/g22/g3") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g22/g1", "/g22/g1") < 0) TEST_ERROR;
+ if(check_name(group3_id, "/g22/g3", "/g22/g3") < 0) TEST_ERROR;
- /* Rename soft link, using relative paths */
- if (H5Gmove( group_id, "g3", "g2" )<0) TEST_ERROR;
+ /* Rename soft link, using relative paths */
+ if (H5Gmove( group_id, "g3", "g2" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g22/g1", "/g22/g1") < 0) TEST_ERROR;
- if(check_name(group3_id, "/g22/g2", "/g22/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g22/g1", "/g22/g1") < 0) TEST_ERROR;
+ if(check_name(group3_id, "/g22/g2", "/g22/g2") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Glink symbolic and unlink target
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Glink symbolic and unlink target
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Glink symbolic and unlink target");
+ TESTING("H5Iget_name with H5Glink symbolic and unlink target");
- /* Create group "g23/g1" */
- if ((group_id = H5Gcreate( file_id, "/g23", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "/g23/g1", 0 ))<0) TEST_ERROR;
+ /* Create group "g23/g1" */
+ if ((group_id = H5Gcreate( file_id, "/g23", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "/g23/g1", 0 ))<0) TEST_ERROR;
- /* Create symbolic link to "g23/g1/ group */
- if (H5Glink(file_id, H5G_LINK_SOFT, "/g23/g1", "/g23/g2")<0) TEST_ERROR;
+ /* Create symbolic link to "g23/g1/ group */
+ if (H5Glink(file_id, H5G_LINK_SOFT, "/g23/g1", "/g23/g2")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g23/g1", "/g23/g1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g23/g1", "/g23/g1") < 0) TEST_ERROR;
- /* Open the group */
- if ((group3_id = H5Gopen( file_id, "/g23/g2" ))<0) TEST_ERROR;
+ /* Open the group */
+ if ((group3_id = H5Gopen( file_id, "/g23/g2" ))<0) TEST_ERROR;
- /* Delete group */
- if (H5Gunlink( file_id, "/g23/g1")<0) TEST_ERROR;
+ /* Delete group */
+ if (H5Gunlink( file_id, "/g23/g1")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "/g23/g2", "/g23/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "/g23/g2", "/g23/g2") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with H5Glink symbolic and unlink source
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with H5Glink symbolic and unlink source
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with H5Glink symbolic and unlink source");
+ TESTING("H5Iget_name with H5Glink symbolic and unlink source");
- /* Create group "g24/g1" */
- if ((group_id = H5Gcreate( file_id, "/g24", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "/g24/g1", 0 ))<0) TEST_ERROR;
+ /* Create group "g24/g1" */
+ if ((group_id = H5Gcreate( file_id, "/g24", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "/g24/g1", 0 ))<0) TEST_ERROR;
- /* Create symbolic link to "g24/g1/ group */
- if (H5Glink(file_id, H5G_LINK_SOFT, "/g24/g1", "/g24/g2")<0) TEST_ERROR;
+ /* Create symbolic link to "g24/g1/ group */
+ if (H5Glink(file_id, H5G_LINK_SOFT, "/g24/g1", "/g24/g2")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g24/g1", "/g24/g1") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g24/g1", "/g24/g1") < 0) TEST_ERROR;
- /* Open the group */
- if ((group3_id = H5Gopen( file_id, "/g24/g2" ))<0) TEST_ERROR;
+ /* Open the group */
+ if ((group3_id = H5Gopen( file_id, "/g24/g2" ))<0) TEST_ERROR;
- /* Delete group */
- if (H5Gunlink( file_id, "/g24/g2")<0) TEST_ERROR;
+ /* Delete group */
+ if (H5Gunlink( file_id, "/g24/g2")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "", "") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with several nested mounted files
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with several nested mounted files
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with several nested mounted files");
+ TESTING("H5Iget_name with several nested mounted files");
- /* Create a group "g25/g1/g2" in the first file */
- if ((group_id = H5Gcreate( file_id, "/g25", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "/g25/g1", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file_id, "/g25/g1/g2", 0 ))<0) TEST_ERROR;
+ /* Create a group "g25/g1/g2" in the first file */
+ if ((group_id = H5Gcreate( file_id, "/g25", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "/g25/g1", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file_id, "/g25/g1/g2", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Create second file and group "/g26/g3/g4" in it */
- file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ /* Create second file and group "/g26/g3/g4" in it */
+ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group_id = H5Gcreate( file1_id, "/g26", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file1_id, "/g26/g3", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file1_id, "/g26/g3/g4", 0 ))<0) TEST_ERROR;
+ if ((group_id = H5Gcreate( file1_id, "/g26", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file1_id, "/g26/g3", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file1_id, "/g26/g3/g4", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Create third file and group "/g27/g5/g6" in it */
- file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ /* Create third file and group "/g27/g5/g6" in it */
+ file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group_id = H5Gcreate( file2_id, "/g27", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file2_id, "/g27/g5", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file2_id, "/g27/g5/g6", 0 ))<0) TEST_ERROR;
+ if ((group_id = H5Gcreate( file2_id, "/g27", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file2_id, "/g27/g5", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file2_id, "/g27/g5/g6", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Create fourth file and group "/g28/g5/g6" in it */
- file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ /* Create fourth file and group "/g28/g5/g6" in it */
+ file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group_id = H5Gcreate( file3_id, "/g28", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file3_id, "/g28/g7", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file3_id, "/g28/g7/g8", 0 ))<0) TEST_ERROR;
+ if ((group_id = H5Gcreate( file3_id, "/g28", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file3_id, "/g28/g7", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file3_id, "/g28/g7/g8", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Access group which will be hidden in the first file */
- if ((group_id = H5Gopen( file_id, "/g25/g1/g2"))<0) TEST_ERROR;
+ /* Access group which will be hidden in the first file */
+ if ((group_id = H5Gopen( file_id, "/g25/g1/g2"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "/g25/g1/g2", "/g25/g1/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g25/g1/g2", "/g25/g1/g2") < 0) TEST_ERROR;
- /* Mount second file under "/g25/g1" in the first file */
- if (H5Fmount(file_id, "/g25/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
+ /* Mount second file under "/g25/g1" in the first file */
+ if (H5Fmount(file_id, "/g25/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR;
- /* Access group which will be hidden in the second file */
- if ((group2_id = H5Gopen( file_id, "/g25/g1/g26/g3/g4"))<0) TEST_ERROR;
+ /* Access group which will be hidden in the second file */
+ if ((group2_id = H5Gopen( file_id, "/g25/g1/g26/g3/g4"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g25/g1/g26/g3/g4", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g25/g1/g26/g3/g4", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR;
- /* Mount third file under "/g25/g1/g26/g3" in the first file */
- if (H5Fmount(file_id, "/g25/g1/g26/g3", file2_id, H5P_DEFAULT)<0) TEST_ERROR;
+ /* Mount third file under "/g25/g1/g26/g3" in the first file */
+ if (H5Fmount(file_id, "/g25/g1/g26/g3", file2_id, H5P_DEFAULT)<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR;
- /* Access group in the third file */
- if ((group3_id = H5Gopen( file_id, "/g25/g1/g26/g3/g27/g5/g6"))<0) TEST_ERROR;
+ /* Access group in the third file */
+ if ((group3_id = H5Gopen( file_id, "/g25/g1/g26/g3/g27/g5/g6"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "/g25/g1/g26/g3/g27/g5/g6", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "/g25/g1/g26/g3/g27/g5/g6", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR;
- /* Mount fourth file under "/g25/g1/g26/g3/g27/g5" in the first file */
- if (H5Fmount(file_id, "/g25/g1/g26/g3/g27/g5", file3_id, H5P_DEFAULT)<0) TEST_ERROR;
+ /* Mount fourth file under "/g25/g1/g26/g3/g27/g5" in the first file */
+ if (H5Fmount(file_id, "/g25/g1/g26/g3/g27/g5", file3_id, H5P_DEFAULT)<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR;
- /* Access group in the fourth file */
- if ((group4_id = H5Gopen( file_id, "/g25/g1/g26/g3/g27/g5/g28/g7/g8"))<0) TEST_ERROR;
+ /* Access group in the fourth file */
+ if ((group4_id = H5Gopen( file_id, "/g25/g1/g26/g3/g27/g5/g28/g7/g8"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group4_id, "/g25/g1/g26/g3/g27/g5/g28/g7/g8", "/g25/g1/g26/g3/g27/g5/g28/g7/g8") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group4_id, "/g25/g1/g26/g3/g27/g5/g28/g7/g8", "/g25/g1/g26/g3/g27/g5/g28/g7/g8") < 0) TEST_ERROR;
- if (H5Funmount(file_id, "/g25/g1/g26/g3/g27/g5")<0) TEST_ERROR;
+ if (H5Funmount(file_id, "/g25/g1/g26/g3/g27/g5")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group4_id, "", "") < 0) TEST_ERROR;
- if(check_name(group3_id, "/g25/g1/g26/g3/g27/g5/g6", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR;
- if(check_name(group2_id, "", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR;
- if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group4_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group3_id, "/g25/g1/g26/g3/g27/g5/g6", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR;
+ if(check_name(group2_id, "", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR;
+ if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group4_id );
- H5Fclose( file3_id );
+ /* Close */
+ H5Gclose( group4_id );
+ H5Fclose( file3_id );
- if (H5Funmount(file_id, "/g25/g1/g26/g3")<0) TEST_ERROR;
+ if (H5Funmount(file_id, "/g25/g1/g26/g3")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "", "") < 0) TEST_ERROR;
- if(check_name(group2_id, "/g25/g1/g26/g3/g4", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR;
- if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group2_id, "/g25/g1/g26/g3/g4", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR;
+ if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group3_id );
- H5Fclose( file2_id );
+ /* Close */
+ H5Gclose( group3_id );
+ H5Fclose( file2_id );
- if (H5Funmount(file_id, "/g25/g1")<0) TEST_ERROR;
+ if (H5Funmount(file_id, "/g25/g1")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "", "") < 0) TEST_ERROR;
- if(check_name(group_id, "/g25/g1/g2", "/g25/g1/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group_id, "/g25/g1/g2", "/g25/g1/g2") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Fclose( file1_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Fclose( file1_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name and H5Gmove with repeated path components
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name and H5Gmove with repeated path components
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name and H5Gmove with repeated path components");
+ TESTING("H5Iget_name and H5Gmove with repeated path components");
- /* Create a group "g29/g1/g2/g1/g2" in a file */
- if ((group_id = H5Gcreate( file_id, "/g29", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "/g29/g1", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file_id, "/g29/g1/g2", 0 ))<0) TEST_ERROR;
- if ((group4_id = H5Gcreate( file_id, "/g29/g1/g2/g1", 0 ))<0) TEST_ERROR;
- if ((group5_id = H5Gcreate( file_id, "/g29/g1/g2/g1/g2", 0 ))<0) TEST_ERROR;
+ /* Create a group "g29/g1/g2/g1/g2" in a file */
+ if ((group_id = H5Gcreate( file_id, "/g29", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "/g29/g1", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file_id, "/g29/g1/g2", 0 ))<0) TEST_ERROR;
+ if ((group4_id = H5Gcreate( file_id, "/g29/g1/g2/g1", 0 ))<0) TEST_ERROR;
+ if ((group5_id = H5Gcreate( file_id, "/g29/g1/g2/g1/g2", 0 ))<0) TEST_ERROR;
- /* Rename group */
- if (H5Gmove( file_id, "/g29/g1/g2/g1/g2", "/g29/g1/g2/g1/g3" )<0) TEST_ERROR;
+ /* Rename group */
+ if (H5Gmove( file_id, "/g29/g1/g2/g1/g2", "/g29/g1/g2/g1/g3" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group5_id, "/g29/g1/g2/g1/g3", "/g29/g1/g2/g1/g3") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group5_id, "/g29/g1/g2/g1/g3", "/g29/g1/g2/g1/g3") < 0) TEST_ERROR;
- /* Rename group in middle of path, keeping within the same group */
- if (H5Gmove( file_id, "/g29/g1/g2/g1", "/g29/g1/g2/g3" )<0) TEST_ERROR;
+ /* Rename group in middle of path, keeping within the same group */
+ if (H5Gmove( file_id, "/g29/g1/g2/g1", "/g29/g1/g2/g3" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group4_id, "/g29/g1/g2/g3", "/g29/g1/g2/g3") < 0) TEST_ERROR;
- if(check_name(group5_id, "/g29/g1/g2/g3/g3", "/g29/g1/g2/g3/g3") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group4_id, "/g29/g1/g2/g3", "/g29/g1/g2/g3") < 0) TEST_ERROR;
+ if(check_name(group5_id, "/g29/g1/g2/g3/g3", "/g29/g1/g2/g3/g3") < 0) TEST_ERROR;
- /* Rename group in middle of path, moving to another group in file */
- if (H5Gmove( file_id, "/g29/g1/g2/g3", "/g29/g3" )<0) TEST_ERROR;
+ /* Rename group in middle of path, moving to another group in file */
+ if (H5Gmove( file_id, "/g29/g1/g2/g3", "/g29/g3" )<0) TEST_ERROR;
- /* Verify */
- if(check_name(group4_id, "/g29/g3", "/g29/g3") < 0) TEST_ERROR;
- if(check_name(group5_id, "/g29/g3/g3", "/g29/g3/g3") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group4_id, "/g29/g3", "/g29/g3") < 0) TEST_ERROR;
+ if(check_name(group5_id, "/g29/g3/g3", "/g29/g3/g3") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
- H5Gclose( group4_id );
- H5Gclose( group5_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
+ H5Gclose( group4_id );
+ H5Gclose( group5_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with higher mounted file
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with higher mounted file
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with higher mounted file");
+ TESTING("H5Iget_name with higher mounted file");
- /* Create a group "/g30/g1/g2" in the first file */
- if ((group_id = H5Gcreate( file_id, "/g30", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "/g30/g1", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file_id, "/g30/g1/g2", 0 ))<0) TEST_ERROR;
+ /* Create a group "/g30/g1/g2" in the first file */
+ if ((group_id = H5Gcreate( file_id, "/g30", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "/g30/g1", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file_id, "/g30/g1/g2", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Create second file and group "/g31/g3/g4" in it */
- file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ /* Create second file and group "/g31/g3/g4" in it */
+ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group_id = H5Gcreate( file1_id, "/g31", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file1_id, "/g31/g3", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file1_id, "/g31/g3/g4", 0 ))<0) TEST_ERROR;
+ if ((group_id = H5Gcreate( file1_id, "/g31", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file1_id, "/g31/g3", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file1_id, "/g31/g3/g4", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Create third file and group "/g32/g5/g6" in it */
- file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ /* Create third file and group "/g32/g5/g6" in it */
+ file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group_id = H5Gcreate( file2_id, "/g32", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file2_id, "/g32/g5", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file2_id, "/g32/g5/g6", 0 ))<0) TEST_ERROR;
+ if ((group_id = H5Gcreate( file2_id, "/g32", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file2_id, "/g32/g5", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file2_id, "/g32/g5/g6", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Create fourth file and group "/g33/g5/g6" in it */
- file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ /* Create fourth file and group "/g33/g5/g6" in it */
+ file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group_id = H5Gcreate( file3_id, "/g33", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file3_id, "/g33/g7", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file3_id, "/g33/g7/g8", 0 ))<0) TEST_ERROR;
+ if ((group_id = H5Gcreate( file3_id, "/g33", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file3_id, "/g33/g7", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file3_id, "/g33/g7/g8", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Access group which will be hidden in the first file */
- if ((group_id = H5Gopen( file_id, "/g30/g1/g2"))<0) TEST_ERROR;
+ /* Access group which will be hidden in the first file */
+ if ((group_id = H5Gopen( file_id, "/g30/g1/g2"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "/g30/g1/g2", "/g30/g1/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g30/g1/g2", "/g30/g1/g2") < 0) TEST_ERROR;
- /* Mount second file under "/g30/g1" in the first file */
- if (H5Fmount(file_id, "/g30/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
+ /* Mount second file under "/g30/g1" in the first file */
+ if (H5Fmount(file_id, "/g30/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "", "/g30/g1/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "", "/g30/g1/g2") < 0) TEST_ERROR;
- /* Access group which will be hidden in the second file */
- if ((group2_id = H5Gopen( file_id, "/g30/g1/g31/g3/g4"))<0) TEST_ERROR;
+ /* Access group which will be hidden in the second file */
+ if ((group2_id = H5Gopen( file_id, "/g30/g1/g31/g3/g4"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g30/g1/g31/g3/g4", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g30/g1/g31/g3/g4", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR;
- /* Mount third file under "/g30/g1/g31/g3" in the first file */
- if (H5Fmount(file_id, "/g30/g1/g31/g3", file2_id, H5P_DEFAULT)<0) TEST_ERROR;
+ /* Mount third file under "/g30/g1/g31/g3" in the first file */
+ if (H5Fmount(file_id, "/g30/g1/g31/g3", file2_id, H5P_DEFAULT)<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR;
- /* Access group which will be hidden in the third file */
- if ((group3_id = H5Gopen( file_id, "/g30/g1/g31/g3/g32/g5/g6"))<0) TEST_ERROR;
+ /* Access group which will be hidden in the third file */
+ if ((group3_id = H5Gopen( file_id, "/g30/g1/g31/g3/g32/g5/g6"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "/g30/g1/g31/g3/g32/g5/g6", "/g30/g1/g31/g3/g32/g5/g6") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "/g30/g1/g31/g3/g32/g5/g6", "/g30/g1/g31/g3/g32/g5/g6") < 0) TEST_ERROR;
- /* Mount fourth file under "/g30" in the first file, hiding the files below it */
- if (H5Fmount(file_id, "/g30", file3_id, H5P_DEFAULT)<0) TEST_ERROR;
+ /* Mount fourth file under "/g30" in the first file, hiding the files below it */
+ if (H5Fmount(file_id, "/g30", file3_id, H5P_DEFAULT)<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "", "/g30/g1/g31/g3/g32/g5/g6") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "", "/g30/g1/g31/g3/g32/g5/g6") < 0) TEST_ERROR;
- /* Access group which will be in the fourth file */
- if ((group4_id = H5Gopen( file_id, "/g30/g33/g7/g8"))<0) TEST_ERROR;
+ /* Access group which will be in the fourth file */
+ if ((group4_id = H5Gopen( file_id, "/g30/g33/g7/g8"))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group4_id, "/g30/g33/g7/g8", "/g30/g33/g7/g8") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group4_id, "/g30/g33/g7/g8", "/g30/g33/g7/g8") < 0) TEST_ERROR;
- /* Unmount fourth file */
- if (H5Funmount(file_id, "/g30")<0) TEST_ERROR;
+ /* Unmount fourth file */
+ if (H5Funmount(file_id, "/g30")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group4_id, "", "") < 0) TEST_ERROR;
- if(check_name(group3_id, "/g30/g1/g31/g3/g32/g5/g6", "/g30/g1/g31/g3/g32/g5/g6") < 0) TEST_ERROR;
- if(check_name(group2_id, "", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR;
- if(check_name(group_id, "", "/g30/g1/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group4_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group3_id, "/g30/g1/g31/g3/g32/g5/g6", "/g30/g1/g31/g3/g32/g5/g6") < 0) TEST_ERROR;
+ if(check_name(group2_id, "", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR;
+ if(check_name(group_id, "", "/g30/g1/g2") < 0) TEST_ERROR;
- /* Unmount third file */
- if (H5Funmount(file_id, "/g30/g1/g31/g3")<0) TEST_ERROR;
+ /* Unmount third file */
+ if (H5Funmount(file_id, "/g30/g1/g31/g3")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group4_id, "", "") < 0) TEST_ERROR;
- if(check_name(group3_id, "", "") < 0) TEST_ERROR;
- if(check_name(group2_id, "/g30/g1/g31/g3/g4", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR;
- if(check_name(group_id, "", "/g30/g1/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group4_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group3_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group2_id, "/g30/g1/g31/g3/g4", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR;
+ if(check_name(group_id, "", "/g30/g1/g2") < 0) TEST_ERROR;
- /* Unmount second file */
- if (H5Funmount(file_id, "/g30/g1")<0) TEST_ERROR;
+ /* Unmount second file */
+ if (H5Funmount(file_id, "/g30/g1")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group4_id, "", "") < 0) TEST_ERROR;
- if(check_name(group3_id, "", "") < 0) TEST_ERROR;
- if(check_name(group2_id, "", "") < 0) TEST_ERROR;
- if(check_name(group_id, "/g30/g1/g2", "/g30/g1/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group4_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group3_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group2_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group_id, "/g30/g1/g2", "/g30/g1/g2") < 0) TEST_ERROR;
- /* Close groups */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
- H5Gclose( group4_id );
+ /* Close groups */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
+ H5Gclose( group4_id );
- /* Close files */
- H5Fclose( file1_id );
- H5Fclose( file2_id );
- H5Fclose( file3_id );
+ /* Close files */
+ H5Fclose( file1_id );
+ H5Fclose( file2_id );
+ H5Fclose( file3_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with multiple hard links and mounted files
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with multiple hard links and mounted files
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with multiple hard links and mounted files");
+ TESTING("H5Iget_name with multiple hard links and mounted files");
- /* Create second file and group "/g35/g3/g4" in it */
- file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ /* Create second file and group "/g35/g3/g4" in it */
+ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group_id = H5Gcreate( file1_id, "/g35", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file1_id, "/g35/g3", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file1_id, "/g35/g3/g4", 0 ))<0) TEST_ERROR;
+ if ((group_id = H5Gcreate( file1_id, "/g35", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file1_id, "/g35/g3", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file1_id, "/g35/g3/g4", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Create group "/g34/g1/g2" in first file */
- if ((group_id = H5Gcreate( file_id, "/g34", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "/g34/g1", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file_id, "/g34/g1/g2", 0 ))<0) TEST_ERROR;
+ /* Create group "/g34/g1/g2" in first file */
+ if ((group_id = H5Gcreate( file_id, "/g34", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "/g34/g1", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file_id, "/g34/g1/g2", 0 ))<0) TEST_ERROR;
- /* Create hard link to "/g34/g1/g2 group */
- if (H5Glink(file_id, H5G_LINK_HARD, "/g34/g1/g2", "/g34/g2a")<0) TEST_ERROR;
+ /* Create hard link to "/g34/g1/g2 group */
+ if (H5Glink(file_id, H5G_LINK_HARD, "/g34/g1/g2", "/g34/g2a")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "/g34/g1/g2", "/g34/g1/g2") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "/g34/g1/g2", "/g34/g1/g2") < 0) TEST_ERROR;
- /* Open the link to the group */
- if ((group4_id = H5Gopen( file_id, "/g34/g2a" ))<0) TEST_ERROR;
+ /* Open the link to the group */
+ if ((group4_id = H5Gopen( file_id, "/g34/g2a" ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0) TEST_ERROR;
- /* Mount second file under "/g34/g1" in the first file */
- if (H5Fmount(file_id, "/g34/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
+ /* Mount second file under "/g34/g1" in the first file */
+ if (H5Fmount(file_id, "/g34/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "", "/g34/g1/g2") < 0) TEST_ERROR;
- if(check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "", "/g34/g1/g2") < 0) TEST_ERROR;
+ if(check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0) TEST_ERROR;
- /* Unmount second file */
- if (H5Funmount(file_id, "/g34/g1")<0) TEST_ERROR;
+ /* Unmount second file */
+ if (H5Funmount(file_id, "/g34/g1")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group3_id, "/g34/g1/g2", "/g34/g1/g2") < 0) TEST_ERROR;
- if(check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group3_id, "/g34/g1/g2", "/g34/g1/g2") < 0) TEST_ERROR;
+ if(check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
- H5Gclose( group4_id );
- H5Fclose( file1_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
+ H5Gclose( group4_id );
+ H5Fclose( file1_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with mounted files and unlinking
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with mounted files and unlinking
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with mounted files and unlinking");
+ TESTING("H5Iget_name with mounted files and unlinking");
- /* Create group "/g36/g1/g2" in first file */
- if ((group_id = H5Gcreate( file_id, "/g36", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file_id, "/g36/g1", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file_id, "/g36/g1/g2", 0 ))<0) TEST_ERROR;
+ /* Create group "/g36/g1/g2" in first file */
+ if ((group_id = H5Gcreate( file_id, "/g36", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file_id, "/g36/g1", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file_id, "/g36/g1/g2", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Create second file and group "/g37/g4" in it */
- file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ /* Create second file and group "/g37/g4" in it */
+ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group_id = H5Gcreate( file1_id, "/g37", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file1_id, "/g37/g4", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file1_id, "/g37/g4/g5a", 0 ))<0) TEST_ERROR;
- if ((group4_id = H5Gcreate( file1_id, "/g37/g4/g5b", 0 ))<0) TEST_ERROR;
+ if ((group_id = H5Gcreate( file1_id, "/g37", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file1_id, "/g37/g4", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file1_id, "/g37/g4/g5a", 0 ))<0) TEST_ERROR;
+ if ((group4_id = H5Gcreate( file1_id, "/g37/g4/g5b", 0 ))<0) TEST_ERROR;
- /* Mount second file under "/g36/g1" in the first file */
- if (H5Fmount(file_id, "/g36/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
+ /* Mount second file under "/g36/g1" in the first file */
+ if (H5Fmount(file_id, "/g36/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
- /* Open group in mounted file */
- if ((group5_id = H5Gopen( file_id, "/g36/g1/g37/" ))<0) TEST_ERROR;
+ /* Open group in mounted file */
+ if ((group5_id = H5Gopen( file_id, "/g36/g1/g37/" ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group5_id, "/g36/g1/g37", "/g36/g1/g37") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group5_id, "/g36/g1/g37", "/g36/g1/g37") < 0) TEST_ERROR;
- /* Open group to delete in mounted file */
- if ((group6_id = H5Gopen( file_id, "/g36/g1/g37/g4/g5a" ))<0) TEST_ERROR;
+ /* Open group to delete in mounted file */
+ if ((group6_id = H5Gopen( file_id, "/g36/g1/g37/g4/g5a" ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group6_id, "/g36/g1/g37/g4/g5a", "/g36/g1/g37/g4/g5a") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group6_id, "/g36/g1/g37/g4/g5a", "/g36/g1/g37/g4/g5a") < 0) TEST_ERROR;
- /* Delete end group in mounted file, using relative paths */
- if (H5Gunlink( group5_id, "g4/g5a")<0) TEST_ERROR;
+ /* Delete end group in mounted file, using relative paths */
+ if (H5Gunlink( group5_id, "g4/g5a")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group6_id, "", "") < 0) TEST_ERROR;
- if(check_name(group3_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group6_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group3_id, "", "") < 0) TEST_ERROR;
- /* Close deleted group */
- H5Gclose( group6_id );
+ /* Close deleted group */
+ H5Gclose( group6_id );
- /* Open groups to delete in mounted file */
- if ((group6_id = H5Gopen( file_id, "/g36/g1/g37/g4" ))<0) TEST_ERROR;
- if ((group7_id = H5Gopen( file_id, "/g36/g1/g37/g4/g5b" ))<0) TEST_ERROR;
+ /* Open groups to delete in mounted file */
+ if ((group6_id = H5Gopen( file_id, "/g36/g1/g37/g4" ))<0) TEST_ERROR;
+ if ((group7_id = H5Gopen( file_id, "/g36/g1/g37/g4/g5b" ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group6_id, "/g36/g1/g37/g4", "/g36/g1/g37/g4") < 0) TEST_ERROR;
- if(check_name(group7_id, "/g36/g1/g37/g4/g5b", "/g36/g1/g37/g4/g5b") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group6_id, "/g36/g1/g37/g4", "/g36/g1/g37/g4") < 0) TEST_ERROR;
+ if(check_name(group7_id, "/g36/g1/g37/g4/g5b", "/g36/g1/g37/g4/g5b") < 0) TEST_ERROR;
- /* Delete middle group in mounted file, using relative paths */
- if (H5Gunlink( group5_id, "g4")<0) TEST_ERROR;
+ /* Delete middle group in mounted file, using relative paths */
+ if (H5Gunlink( group5_id, "g4")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group6_id, "", "") < 0) TEST_ERROR;
- if(check_name(group2_id, "", "") < 0) TEST_ERROR;
- if(check_name(group7_id, "", "") < 0) TEST_ERROR;
- if(check_name(group4_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group6_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group2_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group7_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group4_id, "", "") < 0) TEST_ERROR;
- /* Close deleted groups */
- H5Gclose( group6_id );
- H5Gclose( group7_id );
+ /* Close deleted groups */
+ H5Gclose( group6_id );
+ H5Gclose( group7_id );
- /* Close group in mounted file */
- H5Gclose( group5_id );
+ /* Close group in mounted file */
+ H5Gclose( group5_id );
- if (H5Funmount(file_id, "/g36/g1")<0) TEST_ERROR;
+ if (H5Funmount(file_id, "/g36/g1")<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
- H5Gclose( group4_id );
- H5Fclose( file1_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
+ H5Gclose( group4_id );
+ H5Fclose( file1_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with mounting already mounted files
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with mounting already mounted files
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with mounting already mounted files");
+ TESTING("H5Iget_name with mounting already mounted files");
- /* Create file and group "/g38/g1/g2" in it */
- file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ /* Create file and group "/g38/g1/g2" in it */
+ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group_id = H5Gcreate( file1_id, "/g38", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file1_id, "/g38/g1", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file1_id, "/g38/g1/g2", 0 ))<0) TEST_ERROR;
+ if ((group_id = H5Gcreate( file1_id, "/g38", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file1_id, "/g38/g1", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file1_id, "/g38/g1/g2", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Create second file and group "/g39/g1/g2" in it */
- file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ /* Create second file and group "/g39/g1/g2" in it */
+ file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group_id = H5Gcreate( file2_id, "/g39", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file2_id, "/g39/g3", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file2_id, "/g39/g3/g4", 0 ))<0) TEST_ERROR;
+ if ((group_id = H5Gcreate( file2_id, "/g39", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file2_id, "/g39/g3", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file2_id, "/g39/g3/g4", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Create third file and group "/g40/g5/g6" in it */
- file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ /* Create third file and group "/g40/g5/g6" in it */
+ file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group_id = H5Gcreate( file3_id, "/g40", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file3_id, "/g40/g5", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file3_id, "/g40/g5/g6", 0 ))<0) TEST_ERROR;
+ if ((group_id = H5Gcreate( file3_id, "/g40", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file3_id, "/g40/g5", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file3_id, "/g40/g5/g6", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Mount second file under "/g38/g1" in the first file */
- if (H5Fmount(file1_id, "/g38/g1", file2_id, H5P_DEFAULT)<0) TEST_ERROR;
+ /* Mount second file under "/g38/g1" in the first file */
+ if (H5Fmount(file1_id, "/g38/g1", file2_id, H5P_DEFAULT)<0) TEST_ERROR;
- if ((group_id = H5Gopen( file1_id, "/g38/g1/g39/g3/g4" ))<0) TEST_ERROR;
+ if ((group_id = H5Gopen( file1_id, "/g38/g1/g39/g3/g4" ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0) TEST_ERROR;
- /* Mount first file under "/g40/g5" in the third file */
- if (H5Fmount(file3_id, "/g40/g5", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
+ /* Mount first file under "/g40/g5" in the third file */
+ if (H5Fmount(file3_id, "/g40/g5", file1_id, H5P_DEFAULT)<0) TEST_ERROR;
- if ((group2_id = H5Gopen( file3_id, "/g40/g5/g38/g1/g39/g3/g4" ))<0) TEST_ERROR;
+ if ((group2_id = H5Gopen( file3_id, "/g40/g5/g38/g1/g39/g3/g4" ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "/g40/g5/g38/g1/g39/g3/g4", "/g40/g5/g38/g1/g39/g3/g4") < 0) TEST_ERROR;
- if(check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "/g40/g5/g38/g1/g39/g3/g4", "/g40/g5/g38/g1/g39/g3/g4") < 0) TEST_ERROR;
+ if(check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0) TEST_ERROR;
- /* Unmount first file */
- if (H5Funmount(file3_id, "/g40/g5")<0) TEST_ERROR;
+ /* Unmount first file */
+ if (H5Funmount(file3_id, "/g40/g5")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "", "") < 0) TEST_ERROR;
- if(check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "", "") < 0) TEST_ERROR;
+ if(check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0) TEST_ERROR;
- /* Unmount second file */
- if (H5Funmount(file1_id, "/g38/g1")<0) TEST_ERROR;
+ /* Unmount second file */
+ if (H5Funmount(file1_id, "/g38/g1")<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "", "") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Fclose( file1_id );
- H5Fclose( file2_id );
- H5Fclose( file3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Fclose( file1_id );
+ H5Fclose( file2_id );
+ H5Fclose( file3_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * Test H5Iget_name with opening object in unmounted file
- *-------------------------------------------------------------------------
- */
+ * Test H5Iget_name with opening object in unmounted file
+ *-------------------------------------------------------------------------
+ */
- TESTING("H5Iget_name with opening object in unmounted file");
+ TESTING("H5Iget_name with opening object in unmounted file");
- /* Create file and group "/g39/g1/g2" in it */
- file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ /* Create file and group "/g39/g1/g2" in it */
+ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group_id = H5Gcreate( file1_id, "/g41", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file1_id, "/g41/g1", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file1_id, "/g41/g1/g2", 0 ))<0) TEST_ERROR;
+ if ((group_id = H5Gcreate( file1_id, "/g41", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file1_id, "/g41/g1", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file1_id, "/g41/g1/g2", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Create second file and group "/g42/g1/g2" in it */
- file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ /* Create second file and group "/g42/g1/g2" in it */
+ file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- if ((group_id = H5Gcreate( file2_id, "/g42", 0 ))<0) TEST_ERROR;
- if ((group2_id = H5Gcreate( file2_id, "/g42/g3", 0 ))<0) TEST_ERROR;
- if ((group3_id = H5Gcreate( file2_id, "/g42/g3/g4", 0 ))<0) TEST_ERROR;
+ if ((group_id = H5Gcreate( file2_id, "/g42", 0 ))<0) TEST_ERROR;
+ if ((group2_id = H5Gcreate( file2_id, "/g42/g3", 0 ))<0) TEST_ERROR;
+ if ((group3_id = H5Gcreate( file2_id, "/g42/g3/g4", 0 ))<0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Gclose( group3_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Gclose( group3_id );
- /* Mount second file under "/g41/g1" in the first file */
- if (H5Fmount(file1_id, "/g41/g1", file2_id, H5P_DEFAULT)<0) TEST_ERROR;
+ /* Mount second file under "/g41/g1" in the first file */
+ if (H5Fmount(file1_id, "/g41/g1", file2_id, H5P_DEFAULT)<0) TEST_ERROR;
- if ((group_id = H5Gopen( file1_id, "/g41/g1/g42/g3" ))<0) TEST_ERROR;
+ if ((group_id = H5Gopen( file1_id, "/g41/g1/g42/g3" ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group_id, "/g41/g1/g42/g3", "/g41/g1/g42/g3") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group_id, "/g41/g1/g42/g3", "/g41/g1/g42/g3") < 0) TEST_ERROR;
- /* Unmount file */
- if (H5Funmount(file1_id, "/g41/g1")<0) TEST_ERROR;
+ /* Unmount file */
+ if (H5Funmount(file1_id, "/g41/g1")<0) TEST_ERROR;
- if ((group2_id = H5Gopen( group_id, "g4" ))<0) TEST_ERROR;
+ if ((group2_id = H5Gopen( group_id, "g4" ))<0) TEST_ERROR;
- /* Verify */
- if(check_name(group2_id, "", "") < 0) TEST_ERROR;
+ /* Verify */
+ if(check_name(group2_id, "", "") < 0) TEST_ERROR;
- /* Close */
- H5Gclose( group_id );
- H5Gclose( group2_id );
- H5Fclose( file1_id );
- H5Fclose( file2_id );
+ /* Close */
+ H5Gclose( group_id );
+ H5Gclose( group2_id );
+ H5Fclose( file1_id );
+ H5Fclose( file2_id );
- PASSED();
+ PASSED();
/*-------------------------------------------------------------------------
- * end tests
- *-------------------------------------------------------------------------
- */
-
-
- /* Close file */
- H5Fclose( file_id );
- puts("All getname tests passed.");
- h5_cleanup(FILENAME, fapl);
+ * end tests
+ *-------------------------------------------------------------------------
+ */
+
+
+ /* Close file */
+ H5Fclose( file_id );
+ puts("All getname tests passed.");
+ h5_cleanup(FILENAME, fapl);
+ }
+ else
+ {
+ puts("All getname tests skipped - Incompatible with current Virtual File Driver");
+ }
return 0;
-error:
- H5Fclose( file_id );
- H5_FAILED();
- return 1;
+ error:
+ H5Fclose( file_id );
+ H5_FAILED();
+ return 1;
}
ref='#n6459'>6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Copyright by The HDF Group.                                               *
 * Copyright by the Board of Trustees of the University of Illinois.         *
 * All rights reserved.                                                      *
 *                                                                           *
 * This file is part of HDF5.  The full HDF5 copyright notice, including     *
 * terms governing use, modification, and redistribution, is contained in    *
 * the files COPYING and Copyright.html.  COPYING can be found at the root   *
 * of the source code distribution tree; Copyright.html can be found at the  *
 * root level of an installed copy of the electronic HDF5 document set and   *
 * is linked from the top-level documents page.  It can also be found at     *
 * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
 * access to either file, you may request a copy from help@hdfgroup.org.     *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/*-------------------------------------------------------------------------
 *
 * Created:     H5C.c
 *              June 1 2004
 *              John Mainzer
 *
 * Purpose:     Functions in this file implement a generic cache for
 *              things which exist on disk, and which may be
 *	 	unambiguously referenced by their disk addresses.
 *
 *              The code in this module was initially written in
 *		support of a complete re-write of the metadata cache
 *		in H5AC.c  However, other uses for the cache code
 *		suggested themselves, and thus this file was created
 *		in an attempt to support re-use.
 *
 *		For a detailed overview of the cache, please see the
 *		header comment for H5C_t in H5Cpkg.h.
 *
 *-------------------------------------------------------------------------
 */

/**************************************************************************
 *
 *				To Do:
 *
 *	Code Changes:
 *
 *	 - Remove extra functionality in H5C_flush_single_entry()?
 *
 *	 - Change protect/unprotect to lock/unlock.
 *
 *	 - Flush entries in increasing address order in
 *	   H5C_make_space_in_cache().
 *
 *	 - Also in H5C_make_space_in_cache(), use high and low water marks
 *	   to reduce the number of I/O calls.
 *
 *	 - When flushing, attempt to combine contiguous entries to reduce
 *	   I/O overhead.  Can't do this just yet as some entries are not
 *	   contiguous.  Do this in parallel only or in serial as well?
 *
 *	 - Create MPI type for dirty objects when flushing in parallel.
 *
 *	 - Now that TBBT routines aren't used, fix nodes in memory to
 *         point directly to the skip list node from the LRU list, eliminating
 *         skip list lookups when evicting objects from the cache.
 *
 *	Tests:
 *
 *	 - Trim execution time.  (This is no longer a major issue with the
 *	   shift from the TBBT to a hash table for indexing.)
 *
 *	 - Add random tests.
 *
 **************************************************************************/

#define H5C_PACKAGE		/*suppress error about including H5Cpkg   */
#define H5F_PACKAGE		/*suppress error about including H5Fpkg	  */


#include "H5private.h"		/* Generic Functions			*/
#include "H5Cpkg.h"		/* Cache				*/
#include "H5Dprivate.h"		/* Dataset functions			*/
#include "H5Eprivate.h"		/* Error handling		  	*/
#include "H5Fpkg.h"		/* Files				*/
#include "H5FDprivate.h"	/* File drivers				*/
#include "H5FLprivate.h"	/* Free Lists                           */
#include "H5Iprivate.h"		/* IDs			  		*/
#include "H5MMprivate.h"	/* Memory management			*/
#include "H5Pprivate.h"         /* Property lists                       */
#include "H5SLprivate.h"	/* Skip lists				*/


/*
 * Private file-scope variables.
 */

/* Declare a free list to manage the H5C_t struct */
H5FL_DEFINE_STATIC(H5C_t);


/*
 * Private file-scope function declarations:
 */

static herr_t H5C__auto_adjust_cache_size(H5F_t * f,
                                          hid_t primary_dxpl_id,
                                          hid_t secondary_dxpl_id,
                                          hbool_t write_permitted,
                                          hbool_t * first_flush_ptr);

static herr_t H5C__autoadjust__ageout(H5F_t * f,
                                      double hit_rate,
                                      enum H5C_resize_status * status_ptr,
                                      size_t * new_max_cache_size_ptr,
                                      hid_t primary_dxpl_id,
                                      hid_t secondary_dxpl_id,
                                      hbool_t write_permitted,
                                      hbool_t * first_flush_ptr);

static herr_t H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t * cache_ptr);

static herr_t H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f,
                                                    hid_t primary_dxpl_id,
                                                    hid_t secondary_dxpl_id,
                                                    hbool_t write_permitted,
                                                    hbool_t * first_flush_ptr);

static herr_t H5C__autoadjust__ageout__insert_new_marker(H5C_t * cache_ptr);

static herr_t H5C__autoadjust__ageout__remove_all_markers(H5C_t * cache_ptr);

static herr_t H5C__autoadjust__ageout__remove_excess_markers(H5C_t * cache_ptr);

static herr_t H5C__flash_increase_cache_size(H5C_t * cache_ptr,
                                             size_t old_entry_size,
                                             size_t new_entry_size);

static herr_t H5C_flush_single_entry(H5F_t *       	 f,
                                     hid_t               primary_dxpl_id,
                                     hid_t               secondary_dxpl_id,
                                     const H5C_class_t * type_ptr,
                                     haddr_t             addr,
                                     unsigned            flags,
                                     hbool_t *           first_flush_ptr,
                                     hbool_t    del_entry_from_slist_on_destroy);

static herr_t H5C_flush_invalidate_cache(H5F_t *  f,
	                                 hid_t    primary_dxpl_id,
				         hid_t    secondary_dxpl_id,
					 unsigned flags);

static void * H5C_load_entry(H5F_t *             f,
                             hid_t               dxpl_id,
                             const H5C_class_t * type,
                             haddr_t             addr,
                             void *              udata);

static herr_t H5C_make_space_in_cache(H5F_t * f,
                                      hid_t   primary_dxpl_id,
                                      hid_t   secondary_dxpl_id,
                                      size_t  space_needed,
                                      hbool_t write_permitted,
                                      hbool_t * first_flush_ptr);

static herr_t H5C_tag_entry(H5C_t * cache_ptr, 
                            H5C_cache_entry_t * entry_ptr,
                            hid_t dxpl_id);

static herr_t H5C_flush_tagged_entries(H5F_t * f, 
                                       hid_t primary_dxpl_id, 
                                       hid_t secondary_dxpl_id, 
                                       H5C_t * cache_ptr, 
                                       haddr_t tag);

static herr_t H5C_mark_tagged_entries(H5C_t * cache_ptr, 
                                      haddr_t tag);

static herr_t H5C_flush_marked_entries(H5F_t * f, 
                                       hid_t primary_dxpl_id, 
                                       hid_t secondary_dxpl_id, 
                                       H5C_t * cache_ptr);

#if H5C_DO_TAGGING_SANITY_CHECKS
static herr_t H5C_verify_tag(int id, haddr_t tag);
#endif

#if H5C_DO_EXTREME_SANITY_CHECKS
static herr_t H5C_validate_lru_list(H5C_t * cache_ptr);
static herr_t H5C_verify_not_in_index(H5C_t * cache_ptr,
                                      H5C_cache_entry_t * entry_ptr);
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */


/****************************************************************************
 *
 * #defines and declarations for epoch marker cache entries.
 *
 * As a strategy for automatic cache size reduction, the cache may insert
 * marker entries in the LRU list at the end of each epoch.  These markers
 * are then used to identify entries that have not been accessed for n
 * epochs so that they can be evicted from the cache.
 *
 ****************************************************************************/

/* Note that H5C__MAX_EPOCH_MARKERS is defined in H5Cpkg.h, not here because
 * it is needed to dimension arrays in H5C_t.
 */

#define H5C__EPOCH_MARKER_TYPE	H5C__MAX_NUM_TYPE_IDS

static void *H5C_epoch_marker_load(H5F_t *f, hid_t dxpl_id, haddr_t addr,
                                   void *udata);
static herr_t H5C_epoch_marker_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest,
                                     haddr_t addr, void *thing,
				     unsigned *flags_ptr);
static herr_t H5C_epoch_marker_dest(H5F_t *f, void *thing);
static herr_t H5C_epoch_marker_clear(H5F_t *f, void *thing, hbool_t dest);
static herr_t H5C_epoch_marker_notify(H5C_notify_action_t action, void *thing);
static herr_t H5C_epoch_marker_size(const H5F_t *f, const void *thing, size_t *size_ptr);

const H5C_class_t epoch_marker_class =
{
    /* id    = */ H5C__EPOCH_MARKER_TYPE,
    /* load  = */ &H5C_epoch_marker_load,
    /* flush = */ &H5C_epoch_marker_flush,
    /* dest  = */ &H5C_epoch_marker_dest,
    /* clear = */ &H5C_epoch_marker_clear,
    /* notify = */&H5C_epoch_marker_notify,
    /* size  = */ &H5C_epoch_marker_size
};

/***************************************************************************
 * Class functions for H5C__EPOCH_MAKER_TYPE:
 *
 * None of these functions should ever be called, so there is no point in
 * documenting them separately.
 *                                                     JRM - 11/16/04
 *
 ***************************************************************************/

static void *
H5C_epoch_marker_load(H5F_t UNUSED * f,
                      hid_t UNUSED dxpl_id,
                      haddr_t UNUSED addr,
                      void UNUSED * udata)
{
    void * ret_value = NULL;      /* Return value */

    FUNC_ENTER_NOAPI(H5C_epoch_marker_load, NULL)

    HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "called unreachable fcn.")

done:

    FUNC_LEAVE_NOAPI(ret_value)
}

static herr_t
H5C_epoch_marker_flush(H5F_t UNUSED *f,
                       hid_t UNUSED dxpl_id,
                       hbool_t UNUSED dest,
                       haddr_t UNUSED addr,
                       void UNUSED *thing,
		       unsigned UNUSED * flags_ptr)
{
    herr_t ret_value = FAIL;      /* Return value */

    FUNC_ENTER_NOAPI(H5C_epoch_marker_flush, FAIL)

    HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "called unreachable fcn.")

done:

    FUNC_LEAVE_NOAPI(ret_value)
}

static herr_t
H5C_epoch_marker_dest(H5F_t UNUSED * f,
                      void UNUSED * thing)
{
    herr_t ret_value = FAIL;      /* Return value */

    FUNC_ENTER_NOAPI(H5C_epoch_marker_dest, FAIL)

    HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "called unreachable fcn.")

done:

    FUNC_LEAVE_NOAPI(ret_value)
}

static herr_t
H5C_epoch_marker_clear(H5F_t UNUSED * f,
                       void UNUSED * thing,
                       hbool_t UNUSED dest)
{
    herr_t ret_value = FAIL;      /* Return value */

    FUNC_ENTER_NOAPI(H5C_epoch_marker_clear, FAIL)

    HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "called unreachable fcn.")

done:

    FUNC_LEAVE_NOAPI(ret_value)
}

static herr_t
H5C_epoch_marker_notify(H5C_notify_action_t UNUSED action,
                       void UNUSED * thing)
{
    herr_t ret_value = FAIL;      /* Return value */

    FUNC_ENTER_NOAPI_NOINIT(H5C_epoch_marker_notify)

    HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "called unreachable fcn.")

done:
    FUNC_LEAVE_NOAPI(ret_value)
}

static herr_t
H5C_epoch_marker_size(const H5F_t UNUSED * f,
                      const void UNUSED * thing,
                      size_t UNUSED * size_ptr)
{
    herr_t ret_value = FAIL;      /* Return value */

    FUNC_ENTER_NOAPI(H5C_epoch_marker_size, FAIL)

    HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "called unreachable fcn.")

done:

    FUNC_LEAVE_NOAPI(ret_value)
}


/*-------------------------------------------------------------------------
 * Function:    H5C_apply_candidate_list
 *
 * Purpose:     Apply the supplied candidate list.
 *
 *		We used to do this by simply having each process write 
 *		every mpi_size-th entry in the candidate list, starting 
 *		at index mpi_rank, and mark all the others clean.  
 *
 *		However, this can cause unnecessary contention in a file 
 *		system by increasing the number of processes writing to 
 *		adjacent locations in the HDF5 file.
 *
 *		To attempt to minimize this, we now arange matters such 
 *		that each process writes n adjacent entries in the 
 *		candidate list, and marks all others clean.  We must do
 *		this in such a fashion as to guarantee that each entry 
 *		on the candidate list is written by exactly one process, 
 *		and marked clean by all others.  
 *
 *		To do this, first construct a table mapping mpi_rank
 *		to the index of the first entry in the candidate list to
 *		be written by the process of that mpi_rank, and then use
 *		the table to control which entries are written and which
 *		are marked as clean as a function of the mpi_rank.
 *
 *		Note that the table must be identical on all processes, as
 *		all see the same candidate list, mpi_size, and mpi_rank --
 *		the inputs used to construct the table.  
 *
 *		We construct the table as follows.  Let:
 *
 *			n = num_candidates / mpi_size;
 *
 *			m = num_candidates % mpi_size;
 *
 *		Now allocate an array of integers of length mpi_size + 1, 
 *		and call this array candidate_assignment_table. 
 *
 *		Conceptually, if the number of candidates is a multiple
 *		of the mpi_size, we simply pass through the candidate list
 *		and assign n entries to each process to flush, with the 
 *		index of the first entry to flush in the location in 
 *		the candidate_assignment_table indicated by the mpi_rank
 *		of the process.  
 *
 *		In the more common case in which the candidate list isn't 
 *		isn't a multiple of the mpi_size, we pretend it is, and 
 *		give num_candidates % mpi_size processes one extra entry
 *		each to make things work out.
 *
 *		Once the table is constructed, we determine the first and
 *		last entry this process is to flush as follows:
 *
 *	 	first_entry_to_flush = candidate_assignment_table[mpi_rank]
 *
 *		last_entry_to_flush = 
 *			candidate_assignment_table[mpi_rank + 1] - 1;
 *		
 *		With these values determined, we simply scan through the 
 *		candidate list, marking all entries in the range 
 *		[first_entry_to_flush, last_entry_to_flush] for flush,
 *		and all others to be cleaned.
 *
 *		Finally, we scan the LRU from tail to head, flushing 
 *		or marking clean the candidate entries as indicated.
 *		If necessary, we scan the pinned list as well.
 *
 *		Note that this function will fail if any protected or 
 *		clean entries appear on the candidate list.
 *
 *		This function is used in managing sync points, and 
 *		shouldn't be used elsewhere.
 *
 * Return:      Success:        SUCCEED
 *
 *              Failure:        FAIL
 *
 * Programmer:  John Mainzer
 *              3/17/10
 *
 * Modifications:
 *
 *		Heavily reworked to have each process flush a group of 
 *		adjacent entries.
 *						JRM -- 4/15/10
 *
 *-------------------------------------------------------------------------
 */
#ifdef H5_HAVE_PARALLEL
#define H5C_APPLY_CANDIDATE_LIST__DEBUG 0
herr_t
H5C_apply_candidate_list(H5F_t * f,
                         hid_t primary_dxpl_id,
                         hid_t secondary_dxpl_id,
                         H5C_t * cache_ptr,
                         int num_candidates,
                         haddr_t * candidates_list_ptr,
                         int mpi_rank,
                         int mpi_size)
{
    hbool_t             first_flush = FALSE;
    int                 i;
    int			m;
    int			n;
    int			first_entry_to_flush;
    int			last_entry_to_flush;
    int			entries_to_clear = 0;
    int			entries_to_flush = 0;
    int			entries_cleared = 0;
    int			entries_flushed = 0;
    int			entries_examined = 0;
    int			initial_list_len;
    int               * candidate_assignment_table = NULL;
    haddr_t		addr;
    H5C_cache_entry_t *	clear_ptr = NULL;
    H5C_cache_entry_t *	entry_ptr = NULL;
    H5C_cache_entry_t *	flush_ptr = NULL;
#if H5C_DO_SANITY_CHECKS
    haddr_t		last_addr;
#endif /* H5C_DO_SANITY_CHECKS */
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
    char		tbl_buf[1024];
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
    herr_t              ret_value = SUCCEED;      /* Return value */

    FUNC_ENTER_NOAPI(H5C_apply_candidate_list, FAIL)

    HDassert( cache_ptr != NULL );
    HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
    HDassert( num_candidates > 0 );
    HDassert( num_candidates <= cache_ptr->slist_len );
    HDassert( candidates_list_ptr != NULL );
    HDassert( 0 <= mpi_rank );
    HDassert( mpi_rank < mpi_size );

#if H5C_APPLY_CANDIDATE_LIST__DEBUG
    HDfprintf(stdout, "%s:%d: setting up candidate assignment table.\n", 
              FUNC, mpi_rank);
    for ( i = 0; i < 1024; i++ ) tbl_buf[i] = '\0';
    sprintf(&(tbl_buf[0]), "candidate list = ");
    for ( i = 0; i < num_candidates; i++ )
    {
        sprintf(&(tbl_buf[strlen(tbl_buf)]), " 0x%llx", 
                (long long)(*(candidates_list_ptr + i)));
    }
    sprintf(&(tbl_buf[strlen(tbl_buf)]), "\n");
    HDfprintf(stdout, "%s", tbl_buf);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */

    n = num_candidates / mpi_size;
    m = num_candidates % mpi_size;
    HDassert(n >= 0);

    if(NULL == (candidate_assignment_table = (int *)H5MM_malloc(sizeof(int) * (size_t)(mpi_size + 1))))
        HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for candidate assignment table")

    candidate_assignment_table[0] = 0;
    candidate_assignment_table[mpi_size] = num_candidates;

    if(m == 0) { /* mpi_size is an even divisor of num_candidates */
        HDassert(n > 0);
        for(i = 1; i < mpi_size; i++)
            candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n;
    } /* end if */
    else { 
        for(i = 1; i <= m; i++)
            candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n + 1;

        if(num_candidates < mpi_size) {
            for(i = m + 1; i < mpi_size; i++)
                candidate_assignment_table[i] = num_candidates;
        } /* end if */
        else {
            for(i = m + 1; i < mpi_size; i++)
                candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n;
        } /* end else */
    } /* end else */
    HDassert((candidate_assignment_table[mpi_size - 1] + n) == num_candidates);

#if H5C_DO_SANITY_CHECKS
    /* verify that the candidate assignment table has the expected form */
    for ( i = 1; i < mpi_size - 1; i++ ) 
    {
        int a, b;

        a = candidate_assignment_table[i] - candidate_assignment_table[i - 1];
        b = candidate_assignment_table[i + 1] - candidate_assignment_table[i];

        HDassert( n + 1 >= a );
        HDassert( a >= b );
        HDassert( b >= n );
    }
#endif /* H5C_DO_SANITY_CHECKS */

    first_entry_to_flush = candidate_assignment_table[mpi_rank];
    last_entry_to_flush = candidate_assignment_table[mpi_rank + 1] - 1;

#if H5C_APPLY_CANDIDATE_LIST__DEBUG
    for ( i = 0; i < 1024; i++ )
        tbl_buf[i] = '\0';
    sprintf(&(tbl_buf[0]), "candidate assignment table = ");
    for(i = 0; i <= mpi_size; i++)
        sprintf(&(tbl_buf[strlen(tbl_buf)]), " %d", candidate_assignment_table[i]);
    sprintf(&(tbl_buf[strlen(tbl_buf)]), "\n");
    HDfprintf(stdout, "%s", tbl_buf);

    HDfprintf(stdout, "%s:%d: flush entries [%d, %d].\n", 
              FUNC, mpi_rank, first_entry_to_flush, last_entry_to_flush);

    HDfprintf(stdout, "%s:%d: marking entries.\n", FUNC, mpi_rank);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */

    for(i = 0; i < num_candidates; i++) {
        addr = candidates_list_ptr[i];
        HDassert( H5F_addr_defined(addr) );

#if H5C_DO_SANITY_CHECKS
        if ( i > 0 ) {
            if ( last_addr == addr ) {
                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Duplicate entry in cleaned list.\n")
            } else if ( last_addr > addr ) {
                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "candidate list not sorted.\n")
            }
        }

        last_addr = addr;
#endif /* H5C_DO_SANITY_CHECKS */

        H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL)
        if(entry_ptr == NULL) {
            HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed candidate entry not in cache?!?!?.")
        } else if(!entry_ptr->is_dirty) {
            HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not dirty?!?!?.")
        } else if ( entry_ptr->is_protected ) {
            /* For now at least, we can't deal with protected entries.
             * If we encounter one, scream and die.  If it becomes an
             * issue, we should be able to work around this. 
             */
            HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry is protected?!?!?.")
        } else {
            /* determine whether the entry is to be cleared or flushed,
             * and mark it accordingly.  We will scan the protected and 
             * pinned list shortly, and clear or flush according to these
             * markings.  
             */
            if((i >= first_entry_to_flush) && (i <= last_entry_to_flush)) {
                entries_to_flush++;
                entry_ptr->flush_immediately = TRUE;
            } /* end if */
            else {
                entries_to_clear++;
                entry_ptr->clear_on_unprotect = TRUE;
            } /* end else */
        } /* end else */
    } /* end for */

#if H5C_APPLY_CANDIDATE_LIST__DEBUG
    HDfprintf(stdout, "%s:%d: num candidates/to clear/to flush = %d/%d/%d.\n", 
              FUNC, mpi_rank, (int)num_candidates, (int)entries_to_clear,
              (int)entries_to_flush);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */


    /* We have now marked all the entries on the candidate list for 
     * either flush or clear -- now scan the LRU and the pinned list
     * for these entries and do the deed.
     *
     * Note that we are doing things in this round about manner so as
     * to preserve the order of the LRU list to the best of our ability.
     * If we don't do this, my experiments indicate that we will have a
     * noticably poorer hit ratio as a result.
     */

#if H5C_APPLY_CANDIDATE_LIST__DEBUG
    HDfprintf(stdout, "%s:%d: scanning LRU list. len = %d.\n", FUNC, mpi_rank,
              (int)(cache_ptr->LRU_list_len));
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */

    entries_examined = 0;
    initial_list_len = cache_ptr->LRU_list_len;
    entry_ptr = cache_ptr->LRU_tail_ptr;

    while((entry_ptr != NULL) && (entries_examined <= initial_list_len) &&
            ((entries_cleared + entries_flushed) < num_candidates)) {
        if(entry_ptr->clear_on_unprotect) {
            entry_ptr->clear_on_unprotect = FALSE;
            clear_ptr = entry_ptr;
            entry_ptr = entry_ptr->prev;
            entries_cleared++;

#if ( H5C_APPLY_CANDIDATE_LIST__DEBUG > 1 )
    HDfprintf(stdout, "%s:%d: clearing 0x%llx.\n", FUNC, mpi_rank, 
              (long long)clear_ptr->addr);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */

            if(H5C_flush_single_entry(f,
                                      primary_dxpl_id,
                                      secondary_dxpl_id,
                                      clear_ptr->type,
                                      clear_ptr->addr,
                                      H5C__FLUSH_CLEAR_ONLY_FLAG,
                                      &first_flush,
                                      TRUE) < 0)
                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
        } else if(entry_ptr->flush_immediately) {
            entry_ptr->flush_immediately = FALSE;
            flush_ptr = entry_ptr;
            entry_ptr = entry_ptr->prev;
            entries_flushed++;

#if ( H5C_APPLY_CANDIDATE_LIST__DEBUG > 1 )
    HDfprintf(stdout, "%s:%d: flushing 0x%llx.\n", FUNC, mpi_rank, 
              (long long)flush_ptr->addr);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */

            if(H5C_flush_single_entry(f,
                                      primary_dxpl_id,
                                      secondary_dxpl_id,
                                      flush_ptr->type,
                                      flush_ptr->addr,
                                      H5C__NO_FLAGS_SET,
                                      &first_flush,
                                      TRUE) < 0)
                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
        } else {
            entry_ptr = entry_ptr->prev;
        }

        entries_examined++;
    } /* end while */

#if H5C_APPLY_CANDIDATE_LIST__DEBUG
    HDfprintf(stdout, "%s:%d: entries examined/cleared/flushed = %d/%d/%d.\n", 
              FUNC, mpi_rank, entries_examined, 
              entries_cleared, entries_flushed);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */

    /* It is also possible that some of the cleared entries are on the
     * pinned list.  Must scan that also.
     */

#if H5C_APPLY_CANDIDATE_LIST__DEBUG
    HDfprintf(stdout, "%s:%d: scanning pinned entry list. len = %d\n", 
             FUNC, mpi_rank, (int)(cache_ptr->pel_len));
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */

    entry_ptr = cache_ptr->pel_head_ptr;
    while((entry_ptr != NULL) &&
            ((entries_cleared + entries_flushed) < num_candidates)) {
        if(entry_ptr->clear_on_unprotect) {
            entry_ptr->clear_on_unprotect = FALSE;
            clear_ptr = entry_ptr;
            entry_ptr = entry_ptr->next;
            entries_cleared++;

#if ( H5C_APPLY_CANDIDATE_LIST__DEBUG > 1 )
            HDfprintf(stdout, "%s:%d: clearing 0x%llx.\n", FUNC, mpi_rank, 
                      (long long)clear_ptr->addr);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */

            if(H5C_flush_single_entry(f,
                                      primary_dxpl_id,
                                      secondary_dxpl_id,
                                      clear_ptr->type,
                                      clear_ptr->addr,
                                      H5C__FLUSH_CLEAR_ONLY_FLAG,
                                      &first_flush,
                                      TRUE) < 0)
                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
        } else if(entry_ptr->flush_immediately) {
            entry_ptr->flush_immediately = FALSE;
            flush_ptr = entry_ptr;
            entry_ptr = entry_ptr->next;
            entries_flushed++;

#if ( H5C_APPLY_CANDIDATE_LIST__DEBUG > 1 )
            HDfprintf(stdout, "%s:%d: flushing 0x%llx.\n", FUNC, mpi_rank, 
                      (long long)flush_ptr->addr);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */

            if(H5C_flush_single_entry(f,
                                      primary_dxpl_id,
                                      secondary_dxpl_id,
                                      flush_ptr->type,
                                      flush_ptr->addr,
                                      H5C__NO_FLAGS_SET,
                                      &first_flush,
                                      TRUE) < 0)
                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
        } else {
            entry_ptr = entry_ptr->next;
        }
    } /* end while */

#if H5C_APPLY_CANDIDATE_LIST__DEBUG
    HDfprintf(stdout, 
              "%s:%d: pel entries examined/cleared/flushed = %d/%d/%d.\n", 
              FUNC, mpi_rank, entries_examined, 
              entries_cleared, entries_flushed);
    HDfprintf(stdout, "%s:%d: done.\n", FUNC, mpi_rank);

    fsync(stdout);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */

    if((entries_flushed != entries_to_flush) || (entries_cleared != entries_to_clear))
        HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry count mismatch.")

done:
    if(candidate_assignment_table != NULL)
        candidate_assignment_table = (int *)H5MM_xfree((void *)candidate_assignment_table);

    FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_apply_candidate_list() */
#endif /* H5_HAVE_PARALLEL */


/*-------------------------------------------------------------------------
 * Function:    H5C_construct_candidate_list__clean_cache
 *
 * Purpose:     Construct the list of entries that should be flushed to 
 *		clean all entries in the cache.
 *
 *		This function is used in managing sync points, and 
 *		shouldn't be used elsewhere.
 *
 * Return:      Success:        SUCCEED
 *
 *              Failure:        FAIL
 *
 * Programmer:  John Mainzer
 *              3/17/10
 *
 *-------------------------------------------------------------------------
 */
#ifdef H5_HAVE_PARALLEL
herr_t
H5C_construct_candidate_list__clean_cache(H5C_t * cache_ptr)
{
    size_t              space_needed;
    herr_t              ret_value = SUCCEED;      /* Return value */

    FUNC_ENTER_NOAPI(H5C_construct_candidate_list__clean_cache, FAIL)

    HDassert( cache_ptr != NULL );
    HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );

    /* As a sanity check, set space needed to the size of the skip list.
     * This should be the sum total of the sizes of all the dirty entries
     * in the metadata cache.
     */
    space_needed = cache_ptr->slist_size;

    /* Recall that while we shouldn't have any protected entries at this
     * point, it is possible that some dirty entries may reside on the
     * pinned list at this point.
     */
    HDassert( cache_ptr->slist_size <= 
              (cache_ptr->dLRU_list_size + cache_ptr->pel_size) );
    HDassert( cache_ptr->slist_len  <= 
              (cache_ptr->dLRU_list_len + cache_ptr->pel_len) );

    if(space_needed > 0) { /* we have work to do */
        H5C_cache_entry_t *entry_ptr;
        int     nominated_entries_count = 0;
        size_t  nominated_entries_size = 0;
        haddr_t	nominated_addr;

        HDassert( cache_ptr->slist_len > 0 );

        /* Scan the dirty LRU list from tail forward and nominate sufficient
         * entries to free up the necessary space. 
         */
        entry_ptr = cache_ptr->dLRU_tail_ptr;
        while((nominated_entries_size < space_needed) &&
                (nominated_entries_count < cache_ptr->slist_len) &&
                (entry_ptr != NULL)) {
            HDassert( ! (entry_ptr->is_protected) );
            HDassert( ! (entry_ptr->is_read_only) );
            HDassert( entry_ptr->ro_ref_count == 0 );
            HDassert( entry_ptr->is_dirty );
            HDassert( entry_ptr->in_slist );

            nominated_addr = entry_ptr->addr;
            if(H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0)
                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed(1).")

            nominated_entries_size += entry_ptr->size;
            nominated_entries_count++;
            entry_ptr = entry_ptr->aux_prev;
        } /* end while */
        HDassert( entry_ptr == NULL );

        /* it is possible that there are some dirty entries on the 
         * protected entry list as well -- scan it too if necessary
         */
        entry_ptr = cache_ptr->pel_head_ptr;
        while((nominated_entries_size < space_needed) &&
                (nominated_entries_count < cache_ptr->slist_len) &&
                (entry_ptr != NULL)) {
            if(entry_ptr->is_dirty) {
                HDassert( ! (entry_ptr->is_protected) );
                HDassert( ! (entry_ptr->is_read_only) );
                HDassert( entry_ptr->ro_ref_count == 0 );
                HDassert( entry_ptr->is_dirty );
                HDassert( entry_ptr->in_slist );

                nominated_addr = entry_ptr->addr;
                if(H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0)
                    HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed(2).")

                nominated_entries_size += entry_ptr->size;
                nominated_entries_count++;
            } /* end if */

            entry_ptr = entry_ptr->next;
        } /* end while */

        HDassert( nominated_entries_count == cache_ptr->slist_len );
        HDassert( nominated_entries_size == space_needed );
    } /* end if */

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_construct_candidate_list__clean_cache() */
#endif /* H5_HAVE_PARALLEL */


/*-------------------------------------------------------------------------
 * Function:    H5C_construct_candidate_list__min_clean
 *
 * Purpose:     Construct the list of entries that should be flushed to 
 *		get the cache back within its min clean constraints.
 *
 *		This function is used in managing sync points, and 
 *		shouldn't be used elsewhere.
 *
 * Return:      Success:        SUCCEED
 *
 *              Failure:        FAIL
 *
 * Programmer:  John Mainzer
 *              3/17/10
 *
 *-------------------------------------------------------------------------
 */
#ifdef H5_HAVE_PARALLEL
herr_t
H5C_construct_candidate_list__min_clean(H5C_t * cache_ptr)
{
    size_t              space_needed = 0;
    herr_t              ret_value = SUCCEED;      /* Return value */

    FUNC_ENTER_NOAPI(H5C_construct_candidate_list__min_clean, FAIL)

    HDassert( cache_ptr != NULL );
    HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );

    /* compute the number of bytes (if any) that must be flushed to get the 
     * cache back within its min clean constraints.
     */
    if(cache_ptr->max_cache_size > cache_ptr->index_size) {
        if(((cache_ptr->max_cache_size - cache_ptr->index_size) +
               cache_ptr->cLRU_list_size) >= cache_ptr->min_clean_size)
            space_needed = 0;
        else
            space_needed = cache_ptr->min_clean_size -
                ((cache_ptr->max_cache_size - cache_ptr->index_size) +
                 cache_ptr->cLRU_list_size);
    } /* end if */
    else {
        if(cache_ptr->min_clean_size <= cache_ptr->cLRU_list_size)
           space_needed = 0;
        else
            space_needed = cache_ptr->min_clean_size -
                           cache_ptr->cLRU_list_size;
    } /* end else */

    if(space_needed > 0) { /* we have work to do */
        H5C_cache_entry_t *entry_ptr;
        int    nominated_entries_count = 0;
        size_t nominated_entries_size = 0;

        HDassert( cache_ptr->slist_len > 0 );

        /* Scan the dirty LRU list from tail forward and nominate sufficient
         * entries to free up the necessary space. 
         */
        entry_ptr = cache_ptr->dLRU_tail_ptr;
        while((nominated_entries_size < space_needed) &&
                (nominated_entries_count < cache_ptr->slist_len) &&
                (entry_ptr != NULL)) {
            haddr_t		nominated_addr;

            HDassert( ! (entry_ptr->is_protected) );
            HDassert( ! (entry_ptr->is_read_only) );
            HDassert( entry_ptr->ro_ref_count == 0 );
            HDassert( entry_ptr->is_dirty );
            HDassert( entry_ptr->in_slist );

            nominated_addr = entry_ptr->addr;
            if(H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0)
                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed.")

            nominated_entries_size += entry_ptr->size;
            nominated_entries_count++;
            entry_ptr = entry_ptr->aux_prev;
        } /* end while */
        HDassert( nominated_entries_count <= cache_ptr->slist_len );
        HDassert( nominated_entries_size >= space_needed );
    } /* end if */

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_construct_candidate_list__min_clean() */
#endif /* H5_HAVE_PARALLEL */


/*-------------------------------------------------------------------------
 * Function:    H5C_create
 *
 * Purpose:     Allocate, initialize, and return the address of a new
 *		instance of H5C_t.
 *
 *		In general, the max_cache_size parameter must be positive,
 *		and the min_clean_size parameter must lie in the closed
 *		interval [0, max_cache_size].
 *
 *		The check_write_permitted parameter must either be NULL,
 *		or point to a function of type H5C_write_permitted_func_t.
 *		If it is NULL, the cache will use the write_permitted
 *		flag to determine whether writes are permitted.
 *
 * Return:      Success:        Pointer to the new instance.
 *
 *              Failure:        NULL
 *
 * Programmer:  John Mainzer
 *              6/2/04
 *
 *-------------------------------------------------------------------------
 */
H5C_t *
H5C_create(size_t		      max_cache_size,
           size_t		      min_clean_size,
           int			      max_type_id,
           const char *		      (* type_name_table_ptr),
           H5C_write_permitted_func_t check_write_permitted,
           hbool_t		      write_permitted,
           H5C_log_flush_func_t       log_flush,
           void *                     aux_ptr)
{
    int i;
    H5C_t * cache_ptr = NULL;
    H5C_t * ret_value = NULL;      /* Return value */

    FUNC_ENTER_NOAPI(H5C_create, NULL)

    HDassert( max_cache_size >= H5C__MIN_MAX_CACHE_SIZE );
    HDassert( max_cache_size <= H5C__MAX_MAX_CACHE_SIZE );
    HDassert( min_clean_size <= max_cache_size );

    HDassert( max_type_id >= 0 );
    HDassert( max_type_id < H5C__MAX_NUM_TYPE_IDS );
    HDassert( type_name_table_ptr );

    HDassert( ( write_permitted == TRUE ) || ( write_permitted == FALSE ) );

    for ( i = 0; i <= max_type_id; i++ ) {

        HDassert( (type_name_table_ptr)[i] );
        HDassert( HDstrlen(( type_name_table_ptr)[i]) > 0 );
    }

    if ( NULL == (cache_ptr = H5FL_CALLOC(H5C_t)) ) {

	HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, \
                    "memory allocation failed")
    }

    if ( (cache_ptr->slist_ptr = H5SL_create(H5SL_TYPE_HADDR)) == NULL ) {

        HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, NULL, "can't create skip list.")
    }

    /* If we get this far, we should succeed.  Go ahead and initialize all
     * the fields.
     */

    cache_ptr->magic 				= H5C__H5C_T_MAGIC;

    cache_ptr->flush_in_progress		= FALSE;

    cache_ptr->trace_file_ptr			= NULL;

    cache_ptr->aux_ptr				= aux_ptr;

    cache_ptr->max_type_id			= max_type_id;

    cache_ptr->type_name_table_ptr		= type_name_table_ptr;

    cache_ptr->max_cache_size			= max_cache_size;
    cache_ptr->min_clean_size			= min_clean_size;

    cache_ptr->check_write_permitted		= check_write_permitted;
    cache_ptr->write_permitted			= write_permitted;

    cache_ptr->log_flush			= log_flush;

    cache_ptr->evictions_enabled		= TRUE;

    cache_ptr->index_len			= 0;
    cache_ptr->index_size			= (size_t)0;
    cache_ptr->clean_index_size			= (size_t)0;
    cache_ptr->dirty_index_size			= (size_t)0;

    /* Tagging Field Initializations */
    cache_ptr->ignore_tags                      = FALSE;

    cache_ptr->slist_len			= 0;
    cache_ptr->slist_size			= (size_t)0;

#if H5C_DO_SANITY_CHECKS
    cache_ptr->slist_len_increase		= 0;
    cache_ptr->slist_size_increase		= 0;
#endif /* H5C_DO_SANITY_CHECKS */

    for ( i = 0; i < H5C__HASH_TABLE_LEN; i++ )
    {
        (cache_ptr->index)[i] = NULL;
    }

    cache_ptr->pl_len				= 0;
    cache_ptr->pl_size				= (size_t)0;
    cache_ptr->pl_head_ptr			= NULL;
    cache_ptr->pl_tail_ptr			= NULL;

    cache_ptr->pel_len				= 0;
    cache_ptr->pel_size				= (size_t)0;
    cache_ptr->pel_head_ptr			= NULL;
    cache_ptr->pel_tail_ptr			= NULL;

    cache_ptr->LRU_list_len			= 0;
    cache_ptr->LRU_list_size			= (size_t)0;
    cache_ptr->LRU_head_ptr			= NULL;
    cache_ptr->LRU_tail_ptr			= NULL;

    cache_ptr->cLRU_list_len			= 0;
    cache_ptr->cLRU_list_size			= (size_t)0;
    cache_ptr->cLRU_head_ptr			= NULL;
    cache_ptr->cLRU_tail_ptr			= NULL;

    cache_ptr->dLRU_list_len			= 0;
    cache_ptr->dLRU_list_size			= (size_t)0;
    cache_ptr->dLRU_head_ptr			= NULL;
    cache_ptr->dLRU_tail_ptr			= NULL;

    cache_ptr->size_increase_possible		= FALSE;
    cache_ptr->flash_size_increase_possible     = FALSE;
    cache_ptr->flash_size_increase_threshold    = 0;
    cache_ptr->size_decrease_possible		= FALSE;
    cache_ptr->resize_enabled			= FALSE;
    cache_ptr->cache_full			= FALSE;
    cache_ptr->size_decreased			= FALSE;

    (cache_ptr->resize_ctl).version		= H5C__CURR_AUTO_SIZE_CTL_VER;
    (cache_ptr->resize_ctl).rpt_fcn		= NULL;
    (cache_ptr->resize_ctl).set_initial_size	= FALSE;
    (cache_ptr->resize_ctl).initial_size	= H5C__DEF_AR_INIT_SIZE;
    (cache_ptr->resize_ctl).min_clean_fraction	= H5C__DEF_AR_MIN_CLEAN_FRAC;
    (cache_ptr->resize_ctl).max_size		= H5C__DEF_AR_MAX_SIZE;
    (cache_ptr->resize_ctl).min_size		= H5C__DEF_AR_MIN_SIZE;
    (cache_ptr->resize_ctl).epoch_length	= H5C__DEF_AR_EPOCH_LENGTH;

    (cache_ptr->resize_ctl).incr_mode		= H5C_incr__off;
    (cache_ptr->resize_ctl).lower_hr_threshold	= H5C__DEF_AR_LOWER_THRESHHOLD;
    (cache_ptr->resize_ctl).increment	        = H5C__DEF_AR_INCREMENT;
    (cache_ptr->resize_ctl).apply_max_increment	= TRUE;
    (cache_ptr->resize_ctl).max_increment	= H5C__DEF_AR_MAX_INCREMENT;

    (cache_ptr->resize_ctl).flash_incr_mode     = H5C_flash_incr__off;
    (cache_ptr->resize_ctl).flash_multiple      = 1.0;
    (cache_ptr->resize_ctl).flash_threshold     = 0.25;

    (cache_ptr->resize_ctl).decr_mode		= H5C_decr__off;
    (cache_ptr->resize_ctl).upper_hr_threshold	= H5C__DEF_AR_UPPER_THRESHHOLD;
    (cache_ptr->resize_ctl).decrement	        = H5C__DEF_AR_DECREMENT;
    (cache_ptr->resize_ctl).apply_max_decrement	= TRUE;
    (cache_ptr->resize_ctl).max_decrement	= H5C__DEF_AR_MAX_DECREMENT;
    (cache_ptr->resize_ctl).epochs_before_eviction = H5C__DEF_AR_EPCHS_B4_EVICT;
    (cache_ptr->resize_ctl).apply_empty_reserve = TRUE;
    (cache_ptr->resize_ctl).empty_reserve	= H5C__DEF_AR_EMPTY_RESERVE;

    cache_ptr->epoch_markers_active		= 0;

    /* no need to initialize the ring buffer itself */
    cache_ptr->epoch_marker_ringbuf_first	= 1;
    cache_ptr->epoch_marker_ringbuf_last	= 0;
    cache_ptr->epoch_marker_ringbuf_size	= 0;

    /* Initialize all epoch marker entries' fields to zero/FALSE/NULL */
    HDmemset(cache_ptr->epoch_markers, 0, sizeof(cache_ptr->epoch_markers));

    /* Set non-zero/FALSE/NULL fields for epoch markers */
    for ( i = 0; i < H5C__MAX_EPOCH_MARKERS; i++ )
    {
        (cache_ptr->epoch_marker_active)[i]		 = FALSE;
#ifndef NDEBUG
        ((cache_ptr->epoch_markers)[i]).magic		 =
					       H5C__H5C_CACHE_ENTRY_T_MAGIC;
#endif /* NDEBUG */
        ((cache_ptr->epoch_markers)[i]).addr		 = (haddr_t)i;
        ((cache_ptr->epoch_markers)[i]).type		 = &epoch_marker_class;
    }

    if ( H5C_reset_cache_hit_rate_stats(cache_ptr) != SUCCEED ) {

        /* this should be impossible... */
        HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, \
                    "H5C_reset_cache_hit_rate_stats failed.")
    }

    H5C_stats__reset(cache_ptr);

    cache_ptr->prefix[0]			= '\0';  /* empty string */

    /* Set return value */
    ret_value = cache_ptr;

done:

    if ( ret_value == 0 ) {

        if ( cache_ptr != NULL ) {

            if ( cache_ptr->slist_ptr != NULL )
                H5SL_close(cache_ptr->slist_ptr);

            cache_ptr->magic = 0;
            cache_ptr = H5FL_FREE(H5C_t, cache_ptr);

        } /* end if */

    } /* end if */

    FUNC_LEAVE_NOAPI(ret_value)

} /* H5C_create() */


/*-------------------------------------------------------------------------
 * Function:    H5C_def_auto_resize_rpt_fcn
 *
 * Purpose:     Print results of a automatic cache resize.
 *
 *		This function should only be used where HDprintf() behaves
 *		well -- i.e. not on Windows.
 *
 * Return:      void
 *
 * Programmer:  John Mainzer
 *		10/27/04
 *
 *-------------------------------------------------------------------------
 */
void
H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr,
#ifndef NDEBUG
                            int32_t version,
#else /* NDEBUG */
                            int32_t UNUSED version,
#endif /* NDEBUG */
                            double hit_rate,
                            enum H5C_resize_status status,
                            size_t old_max_cache_size,
                            size_t new_max_cache_size,
                            size_t old_min_clean_size,
                            size_t new_min_clean_size)
{
    HDassert( cache_ptr != NULL );
    HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
    HDassert( version == H5C__CURR_AUTO_RESIZE_RPT_FCN_VER );

    switch ( status )
    {
        case in_spec:
            HDfprintf(stdout,
                      "%sAuto cache resize -- no change. (hit rate = %lf)\n",
                      cache_ptr->prefix, hit_rate);
            break;

        case increase:
            HDassert( hit_rate < (cache_ptr->resize_ctl).lower_hr_threshold );
            HDassert( old_max_cache_size < new_max_cache_size );

            HDfprintf(stdout,
                      "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n",
                      cache_ptr->prefix, hit_rate,
                      (cache_ptr->resize_ctl).lower_hr_threshold);

            HDfprintf(stdout,
                    "%s	cache size increased from (%Zu/%Zu) to (%Zu/%Zu).\n",
                    cache_ptr->prefix,
                    old_max_cache_size,
                    old_min_clean_size,
                    new_max_cache_size,
                    new_min_clean_size);
            break;

        case flash_increase:
            HDassert( old_max_cache_size < new_max_cache_size );

            HDfprintf(stdout,
                    "%sflash cache resize(%d) -- size threshold = %Zu.\n",
                    cache_ptr->prefix,
                    (int)((cache_ptr->resize_ctl).flash_incr_mode),
                    cache_ptr->flash_size_increase_threshold);

            HDfprintf(stdout,
                  "%s cache size increased from (%Zu/%Zu) to (%Zu/%Zu).\n",
                   cache_ptr->prefix,
                   old_max_cache_size,
                   old_min_clean_size,
                   new_max_cache_size,
                   new_min_clean_size);
                break;

        case decrease:
            HDassert( old_max_cache_size > new_max_cache_size );

            switch ( (cache_ptr->resize_ctl).decr_mode )
            {
                case H5C_decr__off:
                    HDfprintf(stdout,
                              "%sAuto cache resize -- decrease off.  HR = %lf\n",
                              cache_ptr->prefix, hit_rate);
                    break;

                case H5C_decr__threshold:
                    HDassert( hit_rate >
                              (cache_ptr->resize_ctl).upper_hr_threshold );

                    HDfprintf(stdout,
                              "%sAuto cache resize -- decrease by threshold.  HR = %lf > %6.5lf\n",
                              cache_ptr->prefix, hit_rate,
                              (cache_ptr->resize_ctl).upper_hr_threshold);

                    HDfprintf(stdout, "%sout of bounds high (%6.5lf).\n",
                              cache_ptr->prefix,
                              (cache_ptr->resize_ctl).upper_hr_threshold);
                    break;

                case H5C_decr__age_out:
                    HDfprintf(stdout,
                              "%sAuto cache resize -- decrease by ageout.  HR = %lf\n",
                              cache_ptr->prefix, hit_rate);
                    break;

                case H5C_decr__age_out_with_threshold:
                    HDassert( hit_rate >
                              (cache_ptr->resize_ctl).upper_hr_threshold );

                    HDfprintf(stdout,
                              "%sAuto cache resize -- decrease by ageout with threshold. HR = %lf > %6.5lf\n",
                              cache_ptr->prefix, hit_rate,
                              (cache_ptr->resize_ctl).upper_hr_threshold);
                    break;

                default:
                    HDfprintf(stdout,
                              "%sAuto cache resize -- decrease by unknown mode.  HR = %lf\n",
                              cache_ptr->prefix, hit_rate);
            }

            HDfprintf(stdout,
                      "%s	cache size decreased from (%Zu/%Zu) to (%Zu/%Zu).\n",
                      cache_ptr->prefix,
                      old_max_cache_size,
                      old_min_clean_size,
                      new_max_cache_size,
                      new_min_clean_size);
            break;

        case at_max_size:
            HDfprintf(stdout,
                      "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n",
                      cache_ptr->prefix, hit_rate,
                      (cache_ptr->resize_ctl).lower_hr_threshold);
            HDfprintf(stdout,
                      "%s	cache already at maximum size so no change.\n",
                      cache_ptr->prefix);
            break;

        case at_min_size:
            HDfprintf(stdout,
                      "%sAuto cache resize -- hit rate (%lf) -- can't decrease.\n",
                      cache_ptr->prefix, hit_rate);
            HDfprintf(stdout, "%s	cache already at minimum size.\n",
                      cache_ptr->prefix);
            break;

        case increase_disabled:
            HDfprintf(stdout,
                      "%sAuto cache resize -- increase disabled -- HR = %lf.",
                      cache_ptr->prefix, hit_rate);
            break;

        case decrease_disabled:
            HDfprintf(stdout,
                      "%sAuto cache resize -- decrease disabled -- HR = %lf.\n",
                      cache_ptr->prefix, hit_rate);
            break;

        case not_full:
            HDassert( hit_rate < (cache_ptr->resize_ctl).lower_hr_threshold );

            HDfprintf(stdout,
                      "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n",
                      cache_ptr->prefix, hit_rate,
                      (cache_ptr->resize_ctl).lower_hr_threshold);
            HDfprintf(stdout,
                      "%s	cache not full so no increase in size.\n",
                      cache_ptr->prefix);
            break;

        default:
            HDfprintf(stdout, "%sAuto cache resize -- unknown status code.\n",
                      cache_ptr->prefix);
            break;
    }

    return;

} /* H5C_def_auto_resize_rpt_fcn() */


/*-------------------------------------------------------------------------
 * Function:    H5C_dest
 *
 * Purpose:     Flush all data to disk and destroy the cache.
 *
 *              This function fails if any object are protected since the
 *              resulting file might not be consistent.
 *
 *		The primary_dxpl_id and secondary_dxpl_id parameters
 *		specify the dxpl_ids used on the first write occasioned
 *		by the destroy (primary_dxpl_id), and on all subsequent
 *		writes (secondary_dxpl_id).  This is useful in the metadata
 *		cache, but may not be needed elsewhere.  If so, just use the
 *		same dxpl_id for both parameters.
 *
 *		Note that *cache_ptr has been freed upon successful return.
 *
 * Return:      Non-negative on success/Negative on failure
 *
 * Programmer:  John Mainzer
 *		6/2/04
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5C_dest(H5F_t * f,
         hid_t	 primary_dxpl_id,
         hid_t	 secondary_dxpl_id)
{
    H5C_t * cache_ptr = f->shared->cache;
    herr_t ret_value = SUCCEED;      /* Return value */

    FUNC_ENTER_NOAPI(H5C_dest, FAIL)

    /* Sanity check */
    HDassert(cache_ptr);
    HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);

    /* Flush and invalidate all cache entries */
    if(H5C_flush_invalidate_cache(f, primary_dxpl_id, secondary_dxpl_id,
                H5C__NO_FLAGS_SET) < 0 )
        HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")

    if(cache_ptr->slist_ptr != NULL) {
        H5SL_close(cache_ptr->slist_ptr);
        cache_ptr->slist_ptr = NULL;
    } /* end if */

    cache_ptr->magic = 0;

    cache_ptr = H5FL_FREE(H5C_t, cache_ptr);

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_dest() */


/*-------------------------------------------------------------------------
 *
 * Function:    H5C_expunge_entry
 *
 * Purpose:     Use this function to tell the cache to expunge an entry
 * 		from the cache without writing it to disk even if it is
 * 		dirty.  The entry may not be either pinned or protected.
 *
 * Return:      Non-negative on success/Negative on failure
 *
 * Programmer:  John Mainzer
 *              6/29/06
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5C_expunge_entry(H5F_t *             f,
                  hid_t               primary_dxpl_id,
                  hid_t               secondary_dxpl_id,
                  const H5C_class_t * type,
                  haddr_t 	      addr,
                  unsigned 	      flags)
{
    H5C_t *		cache_ptr;
    herr_t		result;
    hbool_t		first_flush = TRUE;
    H5C_cache_entry_t *	entry_ptr = NULL;
    herr_t		ret_value = SUCCEED;      /* Return value */

    FUNC_ENTER_NOAPI(H5C_expunge_entry, FAIL)

    HDassert( f );
    HDassert( f->shared );

    cache_ptr = f->shared->cache;

    HDassert( cache_ptr );
    HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
    HDassert( type );
    HDassert( type->clear );
    HDassert( type->dest );
    HDassert( H5F_addr_defined(addr) );

#if H5C_DO_EXTREME_SANITY_CHECKS
        if ( H5C_validate_lru_list(cache_ptr) < 0 ) {

                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
                            "LRU sanity check failed.\n");
        }
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */

    H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL)

    if ( ( entry_ptr == NULL ) || ( entry_ptr->type != type ) ) {

        /* the target doesn't exist in the cache, so we are done. */
        HGOTO_DONE(SUCCEED)
    }

    HDassert( entry_ptr->addr == addr );
    HDassert( entry_ptr->type == type );

    if ( entry_ptr->is_protected ) {

        HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, \
		    "Target entry is protected.")
    }

    if ( entry_ptr->is_pinned ) {

        HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, \
		    "Target entry is pinned.")
    }

    /* Pass along 'free file space' flag to cache client */
    entry_ptr->free_file_space_on_destroy = ( (flags & H5C__FREE_FILE_SPACE_FLAG) != 0 );

    /* If we get this far, call H5C_flush_single_entry() with the
     * H5C__FLUSH_INVALIDATE_FLAG and the H5C__FLUSH_CLEAR_ONLY_FLAG.
     * This will clear the entry, and then delete it from the cache.
     */
    result = H5C_flush_single_entry(f,
                                    primary_dxpl_id,
                                    secondary_dxpl_id,
                                    entry_ptr->type,
                                    entry_ptr->addr,
                                    H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG,
                                    &first_flush,
                                    TRUE);

    if ( result < 0 ) {

        HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, \
                    "H5C_flush_single_entry() failed.")
    }

done:

#if H5C_DO_EXTREME_SANITY_CHECKS
        if ( H5C_validate_lru_list(cache_ptr) < 0 ) {

                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
                            "LRU sanity check failed.\n");
        }
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */

    FUNC_LEAVE_NOAPI(ret_value)

} /* H5C_expunge_entry() */


/*-------------------------------------------------------------------------
 * Function:    H5C_flush_cache
 *
 * Purpose:	Flush (and possibly destroy) the entries contained in the
 *		specified cache.
 *
 *		If the cache contains protected entries, the function will
 *		fail, as protected entries cannot be flushed.  However
 *		all unprotected entries should be flushed before the
 *		function returns failure.
 *
 *		The primary_dxpl_id and secondary_dxpl_id parameters
 *		specify the dxpl_ids used on the first write occasioned
 *		by the flush (primary_dxpl_id), and on all subsequent
 *		writes (secondary_dxpl_id).  This is useful in the metadata
 *		cache, but may not be needed elsewhere.  If so, just use the
 *		same dxpl_id for both parameters.
 *
 * Return:      Non-negative on success/Negative on failure or if there was
 *		a request to flush all items and something was protected.
 *
 * Programmer:  John Mainzer
 *		6/2/04
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5C_flush_cache(H5F_t *f, hid_t primary_dxpl_id, hid_t secondary_dxpl_id, unsigned flags)
{
    H5C_t * cache_ptr = f->shared->cache;
    herr_t              status;
    herr_t		ret_value = SUCCEED;
    hbool_t             destroy;
    hbool_t		flushed_entries_last_pass;
    hbool_t		flush_marked_entries;
    hbool_t		first_flush = TRUE;
    hbool_t		ignore_protected;
    hbool_t		tried_to_flush_protected_entry = FALSE;
    int32_t		passes = 0;
    int32_t		protected_entries = 0;
    H5SL_node_t * 	node_ptr = NULL;
    H5C_cache_entry_t *	entry_ptr = NULL;
    H5C_cache_entry_t *	next_entry_ptr = NULL;
#if H5C_DO_SANITY_CHECKS
    int64_t		flushed_entries_count;
    size_t		flushed_entries_size;
    int64_t		initial_slist_len;
    size_t              initial_slist_size;
#endif /* H5C_DO_SANITY_CHECKS */

    FUNC_ENTER_NOAPI(H5C_flush_cache, FAIL)

    HDassert( cache_ptr );
    HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
    HDassert( cache_ptr->slist_ptr );

    ignore_protected = ( (flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0 );

    destroy = ( (flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 );

    /* note that flush_marked_entries is set to FALSE if destroy is TRUE */
    flush_marked_entries = ( ( (flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0 )
                             &&
                             ( ! destroy )
                           );

    HDassert( ! ( destroy && ignore_protected ) );

    HDassert( ! ( cache_ptr->flush_in_progress ) );

    cache_ptr->flush_in_progress = TRUE;

    if ( destroy ) {

        status = H5C_flush_invalidate_cache(f,
			                    primary_dxpl_id,
					    secondary_dxpl_id,
					    flags);

        if ( status < 0 ) {

            /* This shouldn't happen -- if it does, we are toast so
             * just scream and die.
             */
            HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
			"flush invalidate failed.")
        }
    } else {
	/* When we are only flushing marked entries, the slist will usually
	 * still contain entries when we have flushed everything we should.
	 * Thus we track whether we have flushed any entries in the last
	 * pass, and terminate if we haven't.
	 */

	flushed_entries_last_pass = TRUE;

        while ( ( passes < H5C__MAX_PASSES_ON_FLUSH ) &&
		( cache_ptr->slist_len != 0 ) &&
		( protected_entries == 0 ) &&
		( flushed_entries_last_pass ) )
	{
            unsigned curr_flush_dep_height = 0;
            unsigned flush_dep_passes = 0;

	    flushed_entries_last_pass = FALSE;

            /* Loop over all flush dependency heights of entries */
            while((curr_flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS) &&
                    (cache_ptr->slist_len != 0) &&
                    (flush_dep_passes < H5C__MAX_PASSES_ON_FLUSH) )
            {
                hbool_t flushed_during_dep_loop = FALSE;

                /* Start at beginning of skip list each time */
                node_ptr = H5SL_first(cache_ptr->slist_ptr);
                HDassert( node_ptr != NULL );

                /* Get cache entry for this node */
                next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
                if ( NULL == next_entry_ptr )
                    HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!")
                HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC );
                HDassert( next_entry_ptr->is_dirty );
                HDassert( next_entry_ptr->in_slist );

#if H5C_DO_SANITY_CHECKS
                /* For sanity checking, try to verify that the skip list has
                 * the expected size and number of entries at the end of each
                 * internal while loop (see below).
                 *
                 * Doing this get a bit tricky, as depending on flags, we may
                 * or may not flush all the entries in the slist.
                 *
                 * To make things more entertaining, with the advent of the
                 * fractal heap, the entry flush callback can cause entries
                 * to be dirtied, resized, and/or moved.
                 *
                 * To deal with this, we first make note of the initial
                 * skip list length and size:
                 */
                initial_slist_len = cache_ptr->slist_len;
                initial_slist_size = cache_ptr->slist_size;

                /* We then zero counters that we use to track the number
                 * and total size of entries flushed:
                 */
                flushed_entries_count = 0;
                flushed_entries_size = 0;

                /* As mentioned above, there is the possibility that
                 * entries will be dirtied, resized, and/or flushed during
                 * our pass through the skip list.  To capture the number
                 * of entries added, and the skip list size delta,
                 * zero the slist_len_increase and slist_size_increase of
                 * the cache's instance of H5C_t.  These fields will be
                 * updated elsewhere to account for slist insertions and/or
                 * dirty entry size changes.
                 */
                cache_ptr->slist_len_increase = 0;
                cache_ptr->slist_size_increase = 0;

                /* at the end of the loop, use these values to compute the
                 * expected slist length and size and compare this with the
                 * value recorded in the cache's instance of H5C_t.
                 */
#endif /* H5C_DO_SANITY_CHECKS */

                while ( node_ptr != NULL )
                {
                    entry_ptr = next_entry_ptr;

                    /* With the advent of the fractal heap, it is possible
                     * that the flush callback will dirty and/or resize
                     * other entries in the cache.  In particular, while
                     * Quincey has promised me that this will never happen,
                     * it is possible that the flush callback for an
                     * entry may protect an entry that is not in the cache,
                     * perhaps causing the cache to flush and possibly
                     * evict the entry associated with node_ptr to make
                     * space for the new entry.
                     *
                     * Thus we do a bit of extra sanity checking on entry_ptr,
                     * and break out of this scan of the skip list if we
                     * detect minor problems.  We have a bit of leaway on the
                     * number of passes though the skip list, so this shouldn't
                     * be an issue in the flush in and of itself, as it should
                     * be all but impossible for this to happen more than once
                     * in any flush.
                     *
                     * Observe that that breaking out of the scan early
                     * shouldn't break the sanity checks just after the end
                     * of this while loop.
                     *
                     * If an entry has merely been marked clean and removed from
                     * the s-list, we simply break out of the scan.
                     *
                     * If the entry has been evicted, we flag an error and
                     * exit.
                     */
#ifndef NDEBUG
                    if ( entry_ptr->magic != H5C__H5C_CACHE_ENTRY_T_MAGIC ) {

                        HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry_ptr->magic is invalid ?!?!")

                    } else
#endif /* NDEBUG */
                    if ( ( ! entry_ptr->is_dirty ) ||
                         ( ! entry_ptr->in_slist ) ) {

                        /* the s-list has been modified out from under us.
                         * break out of the loop.
                         */
                        goto end_of_inner_loop;;
                    }

                    /* increment node pointer now, before we delete its target
                     * from the slist.
                     */
                    node_ptr = H5SL_next(node_ptr);

                    if ( node_ptr != NULL ) {
                        next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr);
                        if ( NULL == next_entry_ptr )
                            HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!")
                        HDassert( next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC );
                        HDassert( next_entry_ptr->is_dirty );
                        HDassert( next_entry_ptr->in_slist );
                    } else {
                        next_entry_ptr = NULL;
		    }

                    HDassert( entry_ptr != NULL );
                    HDassert( entry_ptr->in_slist );

                    if ( ( ! flush_marked_entries ) ||
                         ( entry_ptr->flush_marker ) ) {

                        if ( entry_ptr->is_protected ) {

                            /* we probably have major problems -- but lets flush
                             * everything we can before we decide whether to flag
                             * an error.
                             */
                            tried_to_flush_protected_entry = TRUE;
                            protected_entries++;

                        } else if ( entry_ptr->is_pinned ) {
                            /* Test to see if we are can flush the entry now.
                             * If we can, go ahead and flush.  Note that we
                             * aren't trying to do a destroy here, so that
                             * is not an issue.
                             */
                            if(entry_ptr->flush_dep_height == curr_flush_dep_height ) {
#if H5C_DO_SANITY_CHECKS
                                flushed_entries_count++;
                                flushed_entries_size += entry_ptr->size;
#endif /* H5C_DO_SANITY_CHECKS */
                                status = H5C_flush_single_entry(f,
                                                                primary_dxpl_id,
                                                                secondary_dxpl_id,
                                                                NULL,
                                                                entry_ptr->addr,
                                                                flags,
                                                                &first_flush,
                                                                FALSE);
                                if ( status < 0 ) {

                                    /* This shouldn't happen -- if it does, we are toast
                                     * so just scream and die.
                                     */
                                    HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
                                                "dirty pinned entry flush failed.")
                                } /* end if */
                                flushed_during_dep_loop = TRUE;
                            } /* end if */
                            else if(entry_ptr->flush_dep_height < curr_flush_dep_height)
                                /* This shouldn't happen -- if it does, just scream and die.  */
                                HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL,  "dirty entry below current flush dep. height.")
                        } /* end if */
                        else {
                            /* Test to see if we are can flush the entry now.
                             * If we can, go ahead and flush.  Note that we
                             * aren't trying to do a destroy here, so that
                             * is not an issue.
                             */
                            if(entry_ptr->flush_dep_height == curr_flush_dep_height ){
#if H5C_DO_SANITY_CHECKS
                                flushed_entries_count++;
                                flushed_entries_size += entry_ptr->size;
#endif /* H5C_DO_SANITY_CHECKS */
                                status = H5C_flush_single_entry(f,
                                                                primary_dxpl_id,
                                                                secondary_dxpl_id,
                                                                NULL,
                                                                entry_ptr->addr,
                                                                flags,
                                                                &first_flush,
                                                                FALSE);
                                if ( status < 0 ) {

                                    /* This shouldn't happen -- if it does, we are
                                     * toast so just scream and die.
                                     */
                                    HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
                                                "Can't flush entry.")
                                }
                                flushed_during_dep_loop = TRUE;
                            } /* end if */
                            else if(entry_ptr->flush_dep_height < curr_flush_dep_height)
                                /* This shouldn't happen -- if it does, just scream and die.  */
                                HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL,  "dirty entry below current flush dep. height.")
                        } /* end else */
                    } /* end if */
                } /* while ( node_ptr != NULL ) */

                /* Check for incrementing flush dependency height */
                if(flushed_during_dep_loop) {
                    /* If we flushed an entry at this flush dependency height
                     *  start over at the bottom level of the flush dependencies
                     */
                    curr_flush_dep_height = 0;

                    /* Make certain we don't get stuck in an infinite loop */
                    flush_dep_passes++;

                    /* Set flag for outer loop */
                    flushed_entries_last_pass = TRUE;
                } /* end if */
                else
                    curr_flush_dep_height++;

            } /* while ( curr_flush_dep_height <= H5C__NUM_FLUSH_DEP_HEIGHTS) */
end_of_inner_loop:

#if H5C_DO_SANITY_CHECKS
            /* Verify that the slist size and length are as expected. */

	    HDassert( (initial_slist_len + cache_ptr->slist_len_increase -
                       flushed_entries_count) == cache_ptr->slist_len );
	    HDassert( (initial_slist_size + cache_ptr->slist_size_increase -
		       flushed_entries_size) == cache_ptr->slist_size );
#endif /* H5C_DO_SANITY_CHECKS */

	    passes++;

	} /* while */

        HDassert( protected_entries <= cache_ptr->pl_len );

        if ( ( ( cache_ptr->pl_len > 0 ) && ( !ignore_protected ) )
             ||
             ( tried_to_flush_protected_entry ) ) {

            HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
		        "cache has protected items")
        }

	if ( ( cache_ptr->slist_len != 0 ) &&
	     ( passes >= H5C__MAX_PASSES_ON_FLUSH ) ) {

            HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
		        "flush pass limit exceeded.")
	}

#if H5C_DO_SANITY_CHECKS
        if ( ! flush_marked_entries ) {

            HDassert( cache_ptr->slist_len == 0 );
            HDassert( cache_ptr->slist_size == 0 );
        }
#endif /* H5C_DO_SANITY_CHECKS */

    }

done:

    cache_ptr->flush_in_progress = FALSE;

    FUNC_LEAVE_NOAPI(ret_value)

} /* H5C_flush_cache() */


/*-------------------------------------------------------------------------
 * Function:    H5C_flush_to_min_clean
 *
 * Purpose:	Flush dirty entries until the caches min clean size is
 *		attained.
 *
 *		This function is used in the implementation of the
 *		metadata cache in PHDF5.  To avoid "messages from the
 *		future", the cache on process 0 can't be allowed to
 *		flush entries until the other processes have reached
 *		the same point in the calculation.  If this constraint
 *		is not met, it is possible that the other processes will
 *		read metadata generated at a future point in the
 *		computation.
 *
 *
 * Return:      Non-negative on success/Negative on failure or if
 *		write is not permitted.
 *
 * Programmer:  John Mainzer
 *		9/16/05
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5C_flush_to_min_clean(H5F_t * f,
                       hid_t   primary_dxpl_id,
                       hid_t   secondary_dxpl_id)
{
    H5C_t *            cache_ptr;
    herr_t      	result;
    hbool_t		first_flush = TRUE;
    hbool_t		write_permitted;
#if 0 /* modified code -- commented out for now */
    int			i;
    int			flushed_entries_count = 0;
    size_t		flushed_entries_size = 0;
    size_t		space_needed = 0;
    haddr_t	      * flushed_entries_list = NULL;
    H5C_cache_entry_t *	entry_ptr = NULL;
#endif /* JRM */
    herr_t		ret_value = SUCCEED;

    FUNC_ENTER_NOAPI(H5C_flush_to_min_clean, FAIL)

    HDassert( f );
    HDassert( f->shared );

    cache_ptr = f->shared->cache;

    HDassert( cache_ptr );
    HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );

    if ( cache_ptr->check_write_permitted != NULL ) {

        result = (cache_ptr->check_write_permitted)(f,
                                                    primary_dxpl_id,
                                                    &write_permitted);

        if ( result < 0 ) {

            HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
                        "Can't get write_permitted")
        }
    } else {

        write_permitted = cache_ptr->write_permitted;
    }

    if ( ! write_permitted ) {

        HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
                    "cache write is not permitted!?!\n");
    }
#if 1 /* original code */
    result = H5C_make_space_in_cache(f,
                                     primary_dxpl_id,
                                     secondary_dxpl_id,
                                     (size_t)0,
                                     write_permitted,
                                     &first_flush);

    if ( result < 0 ) {

        HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
                    "H5C_make_space_in_cache failed.")
    }
#else /* modified code -- commented out for now */
    if ( cache_ptr->max_cache_size > cache_ptr->index_size ) {

        if ( ((cache_ptr->max_cache_size - cache_ptr->index_size) +
               cache_ptr->cLRU_list_size) >= cache_ptr->min_clean_size ) {

            space_needed = 0;

        } else {

            space_needed = cache_ptr->min_clean_size -
                ((cache_ptr->max_cache_size - cache_ptr->index_size) +
                 cache_ptr->cLRU_list_size);
        }
    } else {

        if ( cache_ptr->min_clean_size <= cache_ptr->cLRU_list_size ) {

           space_needed = 0;

        } else {

            space_needed = cache_ptr->min_clean_size -
                           cache_ptr->cLRU_list_size;
        }
    }

    if ( space_needed > 0 ) { /* we have work to do */

        HDassert( cache_ptr->slist_len > 0 );

        /* allocate an array to keep a list of the entries that we
         * mark for flush.  We need this list to touch up the LRU
         * list after the flush.
         */
        flushed_entries_list = (haddr_t *)H5MM_malloc(sizeof(haddr_t) *
                                              (size_t)(cache_ptr->slist_len));

        if ( flushed_entries_list == NULL ) {

            HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, \
                        "memory allocation failed for flushed entries list")
        }

        /* Scan the dirty LRU list from tail forward and mark sufficient
         * entries to free up the necessary space.  Keep a list of the
         * entries marked in the order in which they are encountered.
         */
        entry_ptr = cache_ptr->dLRU_tail_ptr;

        while ( ( flushed_entries_size < space_needed ) &&
                ( flushed_entries_count < cache_ptr->slist_len ) &&
                ( entry_ptr != NULL ) )
        {
            HDassert( ! (entry_ptr->is_protected) );
            HDassert( ! (entry_ptr->is_read_only) );
            HDassert( entry_ptr->ro_ref_count == 0 );
            HDassert( entry_ptr->is_dirty );
            HDassert( entry_ptr->in_slist );

            entry_ptr->flush_marker = TRUE;
            flushed_entries_size += entry_ptr->size;
            flushed_entries_list[flushed_entries_count] = entry_ptr->addr;
            flushed_entries_count++;
            entry_ptr = entry_ptr->aux_prev;
        }

        HDassert( flushed_entries_count <= cache_ptr->slist_len );
        HDassert( flushed_entries_size >= space_needed );


        /* Flush the marked entries */
	result = H5C_flush_cache(f, primary_dxpl_id, secondary_dxpl_id,
                                 H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_IGNORE_PROTECTED_FLAG);

        if ( result < 0 ) {

            HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_flush_cache failed.")
        }

        /* Now touch up the LRU list so as to place the flushed entries in
         * the order they they would be in if we had flushed them in the
         * order we encountered them in.
         */

        i = 0;
        while ( i < flushed_entries_count )
        {
            H5C__SEARCH_INDEX_NO_STATS(cache_ptr, flushed_entries_list[i], \
                                       entry_ptr, FAIL)

	    /* At present, the above search must always succeed.  However,
             * that may change.  Write the code so we need only remove the
             * following assert in that event.
             */
            HDassert( entry_ptr != NULL );
            H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS(cache_ptr, entry_ptr, FAIL)
            i++;
        }
    } /* if ( space_needed > 0 ) */
#endif /* end modified code -- commented out for now */

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_flush_to_min_clean() */


/*-------------------------------------------------------------------------
 * Function:    H5C_get_cache_auto_resize_config
 *
 * Purpose:	Copy the current configuration of the cache automatic
 *		re-sizing function into the instance of H5C_auto_size_ctl_t
 *		pointed to by config_ptr.
 *
 * Return:      SUCCEED on success, and FAIL on failure.
 *
 * Programmer:  John Mainzer
 *		10/8/04
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5C_get_cache_auto_resize_config(const H5C_t * cache_ptr,
                                 H5C_auto_size_ctl_t *config_ptr)
{
    herr_t ret_value = SUCCEED;      /* Return value */

    FUNC_ENTER_NOAPI(H5C_get_cache_auto_resize_config, FAIL)

    if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {

        HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.")
    }

    if ( config_ptr == NULL ) {

        HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad config_ptr on entry.")
    }

    *config_ptr = cache_ptr->resize_ctl;

    config_ptr->set_initial_size = FALSE;
    config_ptr->initial_size = cache_ptr->max_cache_size;

done:

    FUNC_LEAVE_NOAPI(ret_value)

} /* H5C_get_cache_auto_resize_config() */


/*-------------------------------------------------------------------------
 * Function:    H5C_get_cache_size
 *
 * Purpose:	Return the cache maximum size, the minimum clean size, the
 *		current size, and the current number of entries in
 *              *max_size_ptr, *min_clean_size_ptr, *cur_size_ptr, and
 *		*cur_num_entries_ptr respectively.  If any of these
 *		parameters are NULL, skip that value.
 *
 * Return:      SUCCEED on success, and FAIL on failure.
 *
 * Programmer:  John Mainzer
 *		10/8/04
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5C_get_cache_size(H5C_t * cache_ptr,
                   size_t * max_size_ptr,
                   size_t * min_clean_size_ptr,
                   size_t * cur_size_ptr,
                   int32_t * cur_num_entries_ptr)
{
    herr_t ret_value = SUCCEED;      /* Return value */

    FUNC_ENTER_NOAPI(H5C_get_cache_size, FAIL)

    if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {

        HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.")
    }

    if ( max_size_ptr != NULL ) {

        *max_size_ptr = cache_ptr->max_cache_size;
    }

    if ( min_clean_size_ptr != NULL ) {

        *min_clean_size_ptr = cache_ptr->min_clean_size;
    }

    if ( cur_size_ptr != NULL ) {

        *cur_size_ptr = cache_ptr->index_size;
    }

    if ( cur_num_entries_ptr != NULL ) {

        *cur_num_entries_ptr = cache_ptr->index_len;
    }

done:

    FUNC_LEAVE_NOAPI(ret_value)

} /* H5C_get_cache_size() */


/*-------------------------------------------------------------------------
 * Function:    H5C_get_cache_hit_rate
 *
 * Purpose:	Compute and return the current cache hit rate in
 *              *hit_rate_ptr.  If there have been no accesses since the
 *              last time the cache hit rate stats were reset, set
 *		*hit_rate_ptr to 0.0.  On error, *hit_rate_ptr is
 *		undefined.
 *
 * Return:      SUCCEED on success, and FAIL on failure.
 *
 * Programmer:  John Mainzer
 *		10/7/04
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5C_get_cache_hit_rate(H5C_t * cache_ptr,
                       double * hit_rate_ptr)

{
    herr_t ret_value = SUCCEED;      /* Return value */

    FUNC_ENTER_NOAPI(H5C_get_cache_hit_rate, FAIL)

    if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {

        HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.")
    }

    if ( hit_rate_ptr == NULL ) {

        HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad hit_rate_ptr on entry.")
    }

    HDassert( cache_ptr->cache_hits >= 0 );
    HDassert( cache_ptr->cache_accesses >= cache_ptr->cache_hits );

    if ( cache_ptr->cache_accesses > 0 ) {

        *hit_rate_ptr = ((double)(cache_ptr->cache_hits)) /
                         ((double)(cache_ptr->cache_accesses));

    } else {

        *hit_rate_ptr = 0.0;
    }

done:

    FUNC_LEAVE_NOAPI(ret_value)

} /* H5C_get_cache_hit_rate() */


/*-------------------------------------------------------------------------
 *
 * Function:    H5C_get_entry_status
 *
 * Purpose:     This function is used to determine whether the cache
 *		contains an entry with the specified base address.  If
 *		the entry exists, it also reports some status information
 *		on the entry.
 *
 *		Status information is reported in the locations pointed
 *		to by the size_ptr, in_cache_ptr, is_dirty_ptr, and
 *		is_protected_ptr.  While in_cache_ptr must be defined,
 *		the remaining pointers may be NULL, in which case the
 *		associated data is not reported.
 *
 * Return:      Non-negative on success/Negative on failure
 *
 * Programmer:  John Mainzer
 *              7/1/05
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5C_get_entry_status(const H5F_t *f,
                     haddr_t   addr,
                     size_t *  size_ptr,
                     hbool_t * in_cache_ptr,
                     hbool_t * is_dirty_ptr,
                     hbool_t * is_protected_ptr,
		     hbool_t * is_pinned_ptr,
		     hbool_t * is_flush_dep_parent_ptr,
                     hbool_t * is_flush_dep_child_ptr)
{
    H5C_t             * cache_ptr;
    H5C_cache_entry_t *	entry_ptr = NULL;
    herr_t		ret_value = SUCCEED;      /* Return value */

    FUNC_ENTER_NOAPI(H5C_get_entry_status, FAIL)

    HDassert( f );
    HDassert( f->shared );

    cache_ptr = f->shared->cache;

    HDassert( cache_ptr != NULL );
    HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
    HDassert( H5F_addr_defined(addr) );
    HDassert( in_cache_ptr != NULL );

    /* this test duplicates two of the above asserts, but we need an
     * invocation of HGOTO_ERROR to keep the compiler happy.
     */
    if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {

        HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.")
    }

    H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL)

    if ( entry_ptr == NULL ) {

        /* the entry doesn't exist in the cache -- report this
         * and quit.
         */
        *in_cache_ptr = FALSE;

    } else {

        *in_cache_ptr = TRUE;

        if ( size_ptr != NULL ) {

            *size_ptr = entry_ptr->size;
        }

        if ( is_dirty_ptr != NULL ) {

            *is_dirty_ptr = entry_ptr->is_dirty;
        }

        if ( is_protected_ptr != NULL ) {

            *is_protected_ptr = entry_ptr->is_protected;
        }

        if ( is_pinned_ptr != NULL ) {

            *is_pinned_ptr = entry_ptr->is_pinned;
        }

        if ( is_flush_dep_parent_ptr != NULL ) {

            *is_flush_dep_parent_ptr = (entry_ptr->flush_dep_height > 0);
        }

        if ( is_flush_dep_child_ptr != NULL ) {

            *is_flush_dep_child_ptr = (entry_ptr->flush_dep_parent != NULL);
        }
    }

done:

    FUNC_LEAVE_NOAPI(ret_value)

} /* H5C_get_entry_status() */


/*-------------------------------------------------------------------------
 * Function:    H5C_get_evictions_enabled()
 *
 * Purpose:     Copy the current value of cache_ptr->evictions_enabled into
 *              *evictions_enabled_ptr.
 *
 * Return:      SUCCEED on success, and FAIL on failure.
 *
 * Programmer:  John Mainzer
 *              7/27/07
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5C_get_evictions_enabled(const H5C_t *cache_ptr,
                          hbool_t * evictions_enabled_ptr)
{
    herr_t ret_value = SUCCEED;      /* Return value */

    FUNC_ENTER_NOAPI(H5C_get_evictions_enabled, FAIL)

    if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) {

        HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.")
    }

    if ( evictions_enabled_ptr == NULL ) {

        HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
                    "Bad evictions_enabled_ptr on entry.")
    }

    *evictions_enabled_ptr = cache_ptr->evictions_enabled;

done:

    FUNC_LEAVE_NOAPI(ret_value)

} /* H5C_get_evictions_enabled() */


/*-------------------------------------------------------------------------
 * Function:    H5C_get_trace_file_ptr
 *
 * Purpose:     Get the trace_file_ptr field from the cache.
 *
 *              This field will either be NULL (which indicates that trace
 *              file logging is turned off), or contain a pointer to the
 *              open file to which trace file data is to be written.
 *
 * Return:      Non-negative on success/Negative on failure
 *
 * Programmer:  John Mainzer
 *              1/20/06
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5C_get_trace_file_ptr(const H5C_t *cache_ptr, FILE **trace_file_ptr_ptr)
{
    FUNC_ENTER_NOAPI_NOFUNC(H5C_get_trace_file_ptr)

    HDassert(cache_ptr);
    HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
    HDassert(trace_file_ptr_ptr);

    *trace_file_ptr_ptr = cache_ptr->trace_file_ptr;

    FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5C_get_trace_file_ptr() */


/*-------------------------------------------------------------------------
 * Function:    H5C_get_trace_file_ptr_from_entry
 *
 * Purpose:     Get the trace_file_ptr field from the cache, via an entry.
 *
 *              This field will either be NULL (which indicates that trace
 *              file logging is turned off), or contain a pointer to the
 *              open file to which trace file data is to be written.
 *
 * Return:      Non-negative on success/Negative on failure
 *
 * Programmer:  Quincey Koziol
 *              6/9/08
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr,
    FILE **trace_file_ptr_ptr)
{
    FUNC_ENTER_NOAPI_NOFUNC(H5C_get_trace_file_ptr_from_entry)

    /* Sanity checks */
    HDassert(entry_ptr);
    HDassert(entry_ptr->cache_ptr);

    H5C_get_trace_file_ptr(entry_ptr->cache_ptr, trace_file_ptr_ptr);

    FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5C_get_trace_file_ptr_from_entry() */


/*-------------------------------------------------------------------------
 * Function:    H5C_insert_entry
 *
 * Purpose:     Adds the specified thing to the cache.  The thing need not
 *              exist on disk yet, but it must have an address and disk
 *              space reserved.
 *
 *		The primary_dxpl_id and secondary_dxpl_id parameters
 *		specify the dxpl_ids used on the first write occasioned
 *		by the insertion (primary_dxpl_id), and on all subsequent
 *		writes (secondary_dxpl_id).  This is useful in the
 *		metadata cache, but may not be needed elsewhere.  If so,
 *		just use the same dxpl_id for both parameters.
 *
 *		The primary_dxpl_id is the dxpl_id passed to the
 *		check_write_permitted function if such a function has been
 *		provided.
 *
 *		Observe that this function cannot occasion a read.
 *
 * Return:      Non-negative on success/Negative on failure
 *
 * Programmer:  John Mainzer
 *		6/2/04
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5C_insert_entry(H5F_t *             f,
                 hid_t		     primary_dxpl_id,
                 hid_t		     secondary_dxpl_id,
                 const H5C_class_t * type,
                 haddr_t 	     addr,
                 void *		     thing,
                 unsigned int        flags)
{
    H5C_t *             cache_ptr;
    herr_t		result;
    hbool_t		first_flush = TRUE;
    hbool_t		insert_pinned;
    hbool_t             set_flush_marker;
    hbool_t		write_permitted = TRUE;
    size_t		empty_space;
    H5C_cache_entry_t *	entry_ptr;
    H5C_cache_entry_t *	test_entry_ptr;
    unsigned            u;                      /* Local index variable */
    herr_t		ret_value = SUCCEED;    /* Return value */

    FUNC_ENTER_NOAPI(H5C_insert_entry, FAIL)

    HDassert( f );
    HDassert( f->shared );

    cache_ptr = f->shared->cache;

    HDassert( cache_ptr );
    HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
    HDassert( type );
    HDassert( type->flush );
    HDassert( type->size );
    HDassert( H5F_addr_defined(addr) );
    HDassert( thing );

#if H5C_DO_EXTREME_SANITY_CHECKS
    if ( H5C_verify_not_in_index(cache_ptr, (H5C_cache_entry_t *)thing) < 0 ) {

        HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "thing already in index.\n");
    }
#endif /* H5C_DO_SANITY_CHECKS */

#if H5C_DO_EXTREME_SANITY_CHECKS
    if ( H5C_validate_lru_list(cache_ptr) < 0 ) {

            HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
                        "LRU sanity check failed.\n");
    }
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */

    set_flush_marker = ( (flags & H5C__SET_FLUSH_MARKER_FLAG) != 0 );
    insert_pinned    = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 );

    entry_ptr = (H5C_cache_entry_t *)thing;

    /* verify that the new entry isn't already in the hash table -- scream
     * and die if it is.
     */

    H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL)

    if ( test_entry_ptr != NULL ) {

        if ( test_entry_ptr == entry_ptr ) {

            HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \
                        "entry already in cache.")

        } else {

            HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \
                        "duplicate entry in cache.")
        }
    }

#ifndef NDEBUG
    entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC;
#endif /* NDEBUG */
    entry_ptr->cache_ptr = cache_ptr;
    entry_ptr->addr  = addr;
    entry_ptr->type  = type;
 
    /* Apply tag to newly inserted entry */
    if(H5C_tag_entry(cache_ptr, entry_ptr, primary_dxpl_id) < 0)
        HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Cannot tag metadata entry")

    entry_ptr->is_protected = FALSE;
    entry_ptr->is_read_only = FALSE;
    entry_ptr->ro_ref_count = 0;

    entry_ptr->is_pinned = insert_pinned;
    entry_ptr->pinned_from_client = insert_pinned;

    /* newly inserted entries are assumed to be dirty */
    entry_ptr->is_dirty = TRUE;

    /* not protected, so can't be dirtied */
    entry_ptr->dirtied  = FALSE;

    /* Retrieve the size of the thing */
    if((type->size)(f, thing, &(entry_ptr->size)) < 0)
        HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGETSIZE, FAIL, "Can't get size of thing")
    HDassert(entry_ptr->size > 0 &&  entry_ptr->size < H5C_MAX_ENTRY_SIZE);

    entry_ptr->in_slist = FALSE;

#ifdef H5_HAVE_PARALLEL
    entry_ptr->clear_on_unprotect = FALSE;
    entry_ptr->flush_immediately = FALSE;
#endif /* H5_HAVE_PARALLEL */

    entry_ptr->flush_in_progress = FALSE;
    entry_ptr->destroy_in_progress = FALSE;
    entry_ptr->free_file_space_on_destroy = FALSE;

    /* Initialize flush dependency height fields */
    entry_ptr->flush_dep_parent = NULL;
    for(u = 0; u < H5C__NUM_FLUSH_DEP_HEIGHTS; u++)
        entry_ptr->child_flush_dep_height_rc[u] = 0;
    entry_ptr->flush_dep_height = 0;

    entry_ptr->ht_next = NULL;
    entry_ptr->ht_prev = NULL;

    entry_ptr->next = NULL;
    entry_ptr->prev = NULL;

    entry_ptr->aux_next = NULL;
    entry_ptr->aux_prev = NULL;

    H5C__RESET_CACHE_ENTRY_STATS(entry_ptr)

    if ( ( cache_ptr->flash_size_increase_possible ) &&
         ( entry_ptr->size > cache_ptr->flash_size_increase_threshold ) ) {

        result = H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size);

        if ( result < 0 ) {

            HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \
                        "H5C__flash_increase_cache_size failed.")
        }
    }

    if ( cache_ptr->index_size >= cache_ptr->max_cache_size ) {

       empty_space = 0;

    } else {

       empty_space = cache_ptr->max_cache_size - cache_ptr->index_size;

    }

    if ( ( cache_ptr->evictions_enabled )
	 &&
         ( ( (cache_ptr->index_size + entry_ptr->size) >
	     cache_ptr->max_cache_size
	   )
	   ||
	   (
	     ( ( empty_space + cache_ptr->clean_index_size ) <
	       cache_ptr->min_clean_size )
	   )
	 )
       ) {

        size_t space_needed;

	if ( empty_space <= entry_ptr->size ) {

            cache_ptr->cache_full = TRUE;
	}

        if ( cache_ptr->check_write_permitted != NULL ) {

            result = (cache_ptr->check_write_permitted)(f,
                                                        primary_dxpl_id,
                                                        &write_permitted);

            if ( result < 0 ) {

                HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \
                            "Can't get write_permitted")
            }
        } else {

            write_permitted = cache_ptr->write_permitted;
        }

        HDassert( entry_ptr->size <= H5C_MAX_ENTRY_SIZE );

        space_needed = entry_ptr->size;

        if ( space_needed > cache_ptr->max_cache_size ) {

            space_needed = cache_ptr->max_cache_size;
        }

        /* Note that space_needed is just the amount of space that
         * needed to insert the new entry without exceeding the cache
         * size limit.  The subsequent call to H5C_make_space_in_cache()
         * may evict the entries required to free more or less space
         * depending on conditions.  It MAY be less if the cache is
         * currently undersized, or more if the cache is oversized.
         *
         * The cache can exceed its maximum size limit via the following
         * mechanisms:
         *
         * First, it is possible for the cache to grow without
         * bound as long as entries are protected and not unprotected.
         *
         * Second, when writes are not permitted it is also possible
         * for the cache to grow without bound.
         *
         * Finally, we usually don't check to see if the cache is
         * oversized at the end of an unprotect.  As a result, it is
         * possible to have a vastly oversized cache with no protected
         * entries as long as all the protects preceed the unprotects.
         *
         * Since items 1 and 2 are not changing any time soon, I see
         * no point in worrying about the third.
         */

        result = H5C_make_space_in_cache(f,
                                         primary_dxpl_id,
                                         secondary_dxpl_id,
                                         space_needed,
                                         write_permitted,
                                         &first_flush);

        if ( result < 0 ) {

            HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, \
                        "H5C_make_space_in_cache failed.")
        }
    }

    H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL)

    /* New entries are presumed to be dirty, so this if statement is
     * unnecessary.  Rework it once the rest of the code changes are
     * in and tested.   -- JRM
     */
    if ( entry_ptr->is_dirty ) {

        entry_ptr->flush_marker = set_flush_marker;
        H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)

    } else {

        entry_ptr->flush_marker = FALSE;
    }

    H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, FAIL)

#if H5C_DO_EXTREME_SANITY_CHECKS
    if ( H5C_validate_lru_list(cache_ptr) < 0 ) {

            HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
                        "LRU sanity check failed.\n");
    }
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */

    /* If the entry's type has a 'notify' callback send a 'after insertion'
     * notice now that the entry is fully integrated into the cache.
     */
    if(entry_ptr->type->notify &&
            (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_INSERT, entry_ptr) < 0)
        HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry inserted into cache")

    H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr)

done:

#if H5C_DO_EXTREME_SANITY_CHECKS
    if ( H5C_validate_lru_list(cache_ptr) < 0 ) {

            HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
                        "LRU sanity check failed.\n");
    }
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */

    FUNC_LEAVE_NOAPI(ret_value)

} /* H5C_insert_entry() */


/*-------------------------------------------------------------------------
 *
 * Function:    H5C_mark_entries_as_clean
 *
 * Purpose:     When the H5C code is used to implement the metadata caches
 *		in PHDF5, only the cache with MPI_rank 0 is allowed to
 *		actually write entries to disk -- all other caches must
 *		retain dirty entries until they are advised that the
 *		entries are clean.
 *
 *		This function exists to allow the H5C code to receive these
 *		notifications.
 *
 *		The function receives a list of entry base addresses
 *		which must refer to dirty entries in the cache.  If any
 *		of the entries are either clean or don't exist, the
 *		function flags an error.
 *
 *		The function scans the list of entries and flushes all
 *		those that are currently unprotected with the
 *		H5C__FLUSH_CLEAR_ONLY_FLAG.  Those that are currently
 *		protected are flagged for clearing when they are
 *		unprotected.
 *
 * Return:      Non-negative on success/Negative on failure
 *
 * Programmer:  John Mainzer
 *              7/5/05
 *
 *-------------------------------------------------------------------------
 */
#ifdef H5_HAVE_PARALLEL
herr_t
H5C_mark_entries_as_clean(H5F_t *  f,
                          hid_t     primary_dxpl_id,
                          hid_t     secondary_dxpl_id,
                          int32_t   ce_array_len,
                          haddr_t * ce_array_ptr)
{
    H5C_t *             cache_ptr;
    hbool_t		first_flush = TRUE;
    int			entries_cleared;
    int			entries_examined;
    int                 i;
    int			initial_list_len;
    haddr_t		addr;
#if H5C_DO_SANITY_CHECKS
    int			pinned_entries_marked = 0;
    int			protected_entries_marked = 0;
    int			other_entries_marked = 0;
    haddr_t		last_addr;
#endif /* H5C_DO_SANITY_CHECKS */
    H5C_cache_entry_t *	clear_ptr = NULL;
    H5C_cache_entry_t *	entry_ptr = NULL;
    herr_t		ret_value = SUCCEED;      /* Return value */

    FUNC_ENTER_NOAPI(H5C_mark_entries_as_clean, FAIL)

    HDassert( f );
    HDassert( f->shared );
    cache_ptr = f->shared->cache;
    HDassert( cache_ptr );
    HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );

    HDassert( ce_array_len > 0 );
    HDassert( ce_array_ptr != NULL );

#if H5C_DO_EXTREME_SANITY_CHECKS
        if ( H5C_validate_lru_list(cache_ptr) < 0 ) {

                HDassert(0);
                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
                            "LRU sanity check failed.\n");
        }
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */

    for ( i = 0; i < ce_array_len; i++ )
    {
        addr = ce_array_ptr[i];

#if H5C_DO_SANITY_CHECKS
        if ( i == 0 ) {

            last_addr = addr;

        } else {

            if ( last_addr == addr ) {

                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
                            "Duplicate entry in cleaned list.\n");

            } else if ( last_addr > addr ) {

                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
                            "cleaned list not sorted.\n");
            }
        }

#if H5C_DO_EXTREME_SANITY_CHECKS
        if ( H5C_validate_lru_list(cache_ptr) < 0 ) {

                HDassert(0);
                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
                            "LRU sanity check failed.\n");
        }
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */
#endif /* H5C_DO_SANITY_CHECKS */

        HDassert( H5F_addr_defined(addr) );

        H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL)

        if ( entry_ptr == NULL ) {
#if H5C_DO_SANITY_CHECKS
	    HDfprintf(stdout,
                  "H5C_mark_entries_as_clean: entry[%d] = %ld not in cache.\n",
                      (int)i,
                      (long)addr);
#endif /* H5C_DO_SANITY_CHECKS */
            HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
                        "Listed entry not in cache?!?!?.")

        } else if ( ! entry_ptr->is_dirty ) {

#if H5C_DO_SANITY_CHECKS
	    HDfprintf(stdout,
                      "H5C_mark_entries_as_clean: entry %ld is not dirty!?!\n",
                      (long)addr);
#endif /* H5C_DO_SANITY_CHECKS */
            HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
                        "Listed entry not dirty?!?!?.")
#if 0 /* original code */
        } else if ( entry_ptr->is_protected ) {

            entry_ptr->clear_on_unprotect = TRUE;

        } else {

            if ( H5C_flush_single_entry(f,
                                        primary_dxpl_id,
                                        secondary_dxpl_id,
                                        entry_ptr->type,
                                        addr,
                                        H5C__FLUSH_CLEAR_ONLY_FLAG,
                                        &first_flush,
                                        TRUE) < 0 ) {

                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
            }
        }
#else /* modified code */
        } else {
            /* Mark the entry to be cleared on unprotect.  We will
             * scan the LRU list shortly, and clear all those entries
             * not currently protected.
             */
            entry_ptr->clear_on_unprotect = TRUE;
#if H5C_DO_SANITY_CHECKS
	    if ( entry_ptr->is_protected ) {

		protected_entries_marked++;

	    } else if ( entry_ptr->is_pinned ) {

		pinned_entries_marked++;

	    } else {

		other_entries_marked++;
	    }
#endif /* H5C_DO_SANITY_CHECKS */
        }
#endif /* end modified code */
    }
#if 1 /* modified code */
    /* Scan through the LRU list from back to front, and flush the
     * entries whose clear_on_unprotect flags are set.  Observe that
     * any protected entries will not be on the LRU, and therefore
     * will not be flushed at this time.
     */

    entries_cleared = 0;
    entries_examined = 0;
    initial_list_len = cache_ptr->LRU_list_len;
    entry_ptr = cache_ptr->LRU_tail_ptr;

    while ( ( entry_ptr != NULL ) &&
            ( entries_examined <= initial_list_len ) &&
            ( entries_cleared < ce_array_len ) )
    {
        if ( entry_ptr->clear_on_unprotect ) {

            entry_ptr->clear_on_unprotect = FALSE;
            clear_ptr = entry_ptr;
            entry_ptr = entry_ptr->prev;
            entries_cleared++;

            if ( H5C_flush_single_entry(f,
                                        primary_dxpl_id,
                                        secondary_dxpl_id,
                                        clear_ptr->type,
                                        clear_ptr->addr,
                                        H5C__FLUSH_CLEAR_ONLY_FLAG,
                                        &first_flush,
                                        TRUE) < 0 ) {

                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
            }
        } else {

            entry_ptr = entry_ptr->prev;
        }
        entries_examined++;
    }

#if H5C_DO_SANITY_CHECKS
    HDassert( entries_cleared == other_entries_marked );
#endif /* H5C_DO_SANITY_CHECKS */

    /* It is also possible that some of the cleared entries are on the
     * pinned list.  Must scan that also.
     */

    entry_ptr = cache_ptr->pel_head_ptr;

    while ( entry_ptr != NULL )
    {
        if ( entry_ptr->clear_on_unprotect ) {

            entry_ptr->clear_on_unprotect = FALSE;
            clear_ptr = entry_ptr;
            entry_ptr = entry_ptr->next;
            entries_cleared++;

            if ( H5C_flush_single_entry(f,
                                        primary_dxpl_id,
                                        secondary_dxpl_id,
                                        clear_ptr->type,
                                        clear_ptr->addr,
                                        H5C__FLUSH_CLEAR_ONLY_FLAG,
                                        &first_flush,
                                        TRUE) < 0 ) {

                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.")
            }
        } else {

            entry_ptr = entry_ptr->next;
        }
    }

#if H5C_DO_SANITY_CHECKS
    HDassert( entries_cleared == pinned_entries_marked + other_entries_marked );
    HDassert( entries_cleared + protected_entries_marked == ce_array_len );
#endif /* H5C_DO_SANITY_CHECKS */

    HDassert( ( entries_cleared == ce_array_len ) ||
              ( (ce_array_len - entries_cleared) <= cache_ptr->pl_len ) );

#if H5C_DO_SANITY_CHECKS
    i = 0;
    entry_ptr = cache_ptr->pl_head_ptr;
    while ( entry_ptr != NULL )
    {
        if ( entry_ptr->clear_on_unprotect ) {

            i++;
        }
        entry_ptr = entry_ptr->next;
    }
    HDassert( (entries_cleared + i) == ce_array_len );
#endif /* H5C_DO_SANITY_CHECKS */
#endif /* modified code */

done:

#if H5C_DO_EXTREME_SANITY_CHECKS
        if ( H5C_validate_lru_list(cache_ptr) < 0 ) {

                HDassert(0);
                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
                            "LRU sanity check failed.\n");
        }
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */

    FUNC_LEAVE_NOAPI(ret_value)

} /* H5C_mark_entries_as_clean() */
#endif /* H5_HAVE_PARALLEL */


/*-------------------------------------------------------------------------
 * Function:    H5C_mark_entry_dirty
 *
 * Purpose:	Mark a pinned or protected entry as dirty.  The target entry
 * 		MUST be either pinned or protected, and MAY be both.
 *
 * 		In the protected case, this call is the functional
 * 		equivalent of setting the H5C__DIRTIED_FLAG on an unprotect
 * 		call.
 *
 * 		In the pinned but not protected case, if the entry is not
 * 		already dirty, the function places function marks the entry
 * 		dirty and places it on the skip list.
 *
 * Return:      Non-negative on success/Negative on failure
 *
 * Programmer:  John Mainzer
 *              5/15/06
 *
 * 		JRM -- 11/5/08
 * 		Added call to H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY() to
 * 		update the new clean_index_size and dirty_index_size
 * 		fields of H5C_t in the case that the entry was clean
 * 		prior to this call, and is pinned and not protected.
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5C_mark_entry_dirty(void *thing)
{
    H5C_t *             cache_ptr;
    H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing;
    herr_t              ret_value = SUCCEED;    /* Return value */

    FUNC_ENTER_NOAPI(H5C_mark_entry_dirty, FAIL)

    /* Sanity checks */
    HDassert(entry_ptr);
    HDassert(H5F_addr_defined(entry_ptr->addr));
    cache_ptr = entry_ptr->cache_ptr;
    HDassert(cache_ptr);
    HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);

    if ( entry_ptr->is_protected ) {
	HDassert( ! ((entry_ptr)->is_read_only) );

        /* set the dirtied flag */
        entry_ptr->dirtied = TRUE;

    } else if ( entry_ptr->is_pinned ) {
        hbool_t		was_pinned_unprotected_and_clean;

	was_pinned_unprotected_and_clean = ! ( entry_ptr->is_dirty );

        /* mark the entry as dirty if it isn't already */
        entry_ptr->is_dirty = TRUE;

	if ( was_pinned_unprotected_and_clean ) {

	    H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr);
	}

        if ( ! (entry_ptr->in_slist) ) {

            H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)
        }

        H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr)

    } else {

        HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, \
                    "Entry is neither pinned nor protected??")
    }

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_mark_entry_dirty() */


/*-------------------------------------------------------------------------
 *
 * Function:    H5C_move_entry
 *
 * Purpose:     Use this function to notify the cache that an entry's
 *              file address changed.
 *
 * Return:      Non-negative on success/Negative on failure
 *
 * Programmer:  John Mainzer
 *              6/2/04
 *
 *              JRM -- 11/5/08
 *              On review this function looks like no change is needed to
 *              support the new clean_index_size and dirty_index_size
 *              fields of H5C_t.
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5C_move_entry(H5C_t *	     cache_ptr,
                 const H5C_class_t * type,
                 haddr_t 	     old_addr,
	         haddr_t 	     new_addr)
{
    hbool_t			was_dirty;
    H5C_cache_entry_t *	entry_ptr = NULL;
    H5C_cache_entry_t *	test_entry_ptr = NULL;
#if H5C_DO_SANITY_CHECKS
    hbool_t			removed_entry_from_slist = FALSE;
#endif /* H5C_DO_SANITY_CHECKS */
    herr_t			ret_value = SUCCEED;      /* Return value */

    FUNC_ENTER_NOAPI(H5C_move_entry, FAIL)

    HDassert( cache_ptr );
    HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC );
    HDassert( type );
    HDassert( H5F_addr_defined(old_addr) );
    HDassert( H5F_addr_defined(new_addr) );
    HDassert( H5F_addr_ne(old_addr, new_addr) );

#if H5C_DO_EXTREME_SANITY_CHECKS
        if ( H5C_validate_lru_list(cache_ptr) < 0 ) {

                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
                            "LRU sanity check failed.\n");
        }
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */

    H5C__SEARCH_INDEX(cache_ptr, old_addr, entry_ptr, FAIL)

    if ( ( entry_ptr == NULL ) || ( entry_ptr->type != type ) ) {

        /* the old item doesn't exist in the cache, so we are done. */
        HGOTO_DONE(SUCCEED)
    }

    HDassert( entry_ptr->addr == old_addr );
    HDassert( entry_ptr->type == type );

    if ( entry_ptr->is_protected ) {

        HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, \
		    "Target entry is protected.")
    }

    H5C__SEARCH_INDEX(cache_ptr, new_addr, test_entry_ptr, FAIL)

    if ( test_entry_ptr != NULL ) { /* we are hosed */

        if ( test_entry_ptr->type == type ) {

            HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, \
                        "Target already moved & reinserted???.")

        } else {

            HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, \
                        "New address already in use?.")

        }
    }

    /* If we get this far we have work to do.  Remove *entry_ptr from
     * the hash table (and skip list if necessary), change its address to the
     * new address, mark it as dirty (if it isn't already) and then re-insert.
     *
     * Update the replacement policy for a hit to avoid an eviction before
     * the moved entry is touched.  Update stats for a move.
     *
     * Note that we do not check the size of the cache, or evict anything.
     * Since this is a simple re-name, cache size should be unaffected.
     *
     * Check to see if the target entry is in the process of being destroyed
     * before we delete from the index, etc.  If it is, all we do is
     * change the addr.  If the entry is only in the process of being flushed,
     * don't mark it as dirty either, lest we confuse the flush call back.
     */

    if ( ! ( entry_ptr->destroy_in_progress ) ) {

        H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr)

        if ( entry_ptr->in_slist ) {

            HDassert( cache_ptr->slist_ptr );

            H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr)

#if H5C_DO_SANITY_CHECKS

            removed_entry_from_slist = TRUE;

#endif /* H5C_DO_SANITY_CHECKS */
        }
    }

    entry_ptr->addr = new_addr;

    if ( ! ( entry_ptr->destroy_in_progress ) ) {

        was_dirty = entry_ptr->is_dirty;

	if ( ! ( entry_ptr->flush_in_progress ) ) {

            entry_ptr->is_dirty = TRUE;
	}

        H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL)

	if ( ! ( entry_ptr->flush_in_progress ) ) {

            H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)

#if H5C_DO_SANITY_CHECKS

            if ( removed_entry_from_slist ) {

		/* we just removed the entry from the slist.  Thus we
		 * must touch up cache_ptr->slist_len_increase and
		 * cache_ptr->slist_size_increase to keep from skewing
		 * the sanity checks.
		 */
		HDassert( cache_ptr->slist_len_increase > 1 );
		HDassert( cache_ptr->slist_size_increase > entry_ptr->size );

		cache_ptr->slist_len_increase -= 1;
		cache_ptr->slist_size_increase -= entry_ptr->size;
	    }

#endif /* H5C_DO_SANITY_CHECKS */

            H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, FAIL)
	}
    }

    H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr)

done:

#if H5C_DO_EXTREME_SANITY_CHECKS
        if ( H5C_validate_lru_list(cache_ptr) < 0 ) {

                HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
                            "LRU sanity check failed.\n");
        }
#endif /* H5C_DO_EXTREME_SANITY_CHECKS */

    FUNC_LEAVE_NOAPI(ret_value)

} /* H5C_move_entry() */


/*-------------------------------------------------------------------------
 * Function:    H5C_resize_entry
 *
 * Purpose:	Resize a pinned or protected entry.
 *
 * 		Resizing an entry dirties it, so if the entry is not
 * 		already dirty, the function places the entry on the
 * 		skip list.
 *
 * Return:      Non-negative on success/Negative on failure
 *
 * Programmer:  John Mainzer
 *              7/5/06
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5C_resize_entry(void *thing, size_t new_size)
{
    H5C_t             * cache_ptr;
    H5C_cache_entry_t * entry_ptr = (H5C_cache_entry_t *)thing;
    herr_t              ret_value = SUCCEED;    /* Return value */

    FUNC_ENTER_NOAPI(H5C_resize_entry, FAIL)

    /* Sanity checks */
    HDassert(entry_ptr);
    HDassert(H5F_addr_defined(entry_ptr->addr));
    cache_ptr = entry_ptr->cache_ptr;
    HDassert(cache_ptr);
    HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);

    /* Check for usage errors */
    if(new_size <= 0)
        HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "New size is non-positive.")
    if(!(entry_ptr->is_pinned || entry_ptr->is_protected))
        HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "Entry isn't pinned or protected??")

    /* update for change in entry size if necessary */
    if ( entry_ptr->size != new_size ) {
        hbool_t		was_clean;

        /* make note of whether the entry was clean to begin with */
        was_clean = ! ( entry_ptr->is_dirty );

        /* mark the entry as dirty if it isn't already */
        entry_ptr->is_dirty = TRUE;

        /* do a flash cache size increase if appropriate */
        if ( cache_ptr->flash_size_increase_possible ) {

            if ( new_size > entry_ptr->size ) {
                size_t             	size_increase;

                size_increase = new_size - entry_ptr->size;

                if(size_increase >= cache_ptr->flash_size_increase_threshold) {
                    if(H5C__flash_increase_cache_size(cache_ptr, entry_ptr->size, new_size) < 0)
                        HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "flash cache increase failed")
                }
            }
        }

        /* update the pinned and/or protected entry list */
        if(entry_ptr->is_pinned) {
            H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pel_len), \
                                            (cache_ptr->pel_size), \
                                            (entry_ptr->size), (new_size))
        } /* end if */
        if(entry_ptr->is_protected) {
            H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pl_len), \
                                            (cache_ptr->pl_size), \
                                            (entry_ptr->size), (new_size))
        } /* end if */

        /* update the hash table */
	H5C__UPDATE_INDEX_FOR_SIZE_CHANGE((cache_ptr), (entry_ptr->size),\
                                          (new_size), (entry_ptr), (was_clean));

        /* if the entry is in the skip list, update that too */
        if ( entry_ptr->in_slist ) {
	    H5C__UPDATE_SLIST_FOR_SIZE_CHANGE((cache_ptr), (entry_ptr->size),\
                                              (new_size));
        } /* end if */

        /* update statistics just before changing the entry size */
	H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE((cache_ptr), (entry_ptr), \
                                                (new_size));

	/* finally, update the entry size proper */
	entry_ptr->size = new_size;

        if(!entry_ptr->in_slist) {
            H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL)
        } /* end if */

        if(entry_ptr->is_pinned) {
            H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr)
        } /* end if */
    } /* end if */

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_resize_entry() */


/*-------------------------------------------------------------------------
 * Function:    H5C_pin_entry_from_client()
 *
 * Purpose:	Internal routine to pin a cache entry from a client action.
 *
 * Return:      Non-negative on success/Negative on failure
 *
 * Programmer:  Quincey Koziol
 *              3/26/09
 *